-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path.oxlintrc.json
More file actions
126 lines (124 loc) · 3.89 KB
/
Copy path.oxlintrc.json
File metadata and controls
126 lines (124 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"typescript",
"unicorn",
"react",
"react-perf",
"oxc",
"import",
"jsx-a11y",
"promise"
],
"ignorePatterns": [
"**/.sanity/*",
"**/dist/*",
"**/sanity.types.ts",
"turbo/generators/config.ts",
"plugins/sanity-naive-html-serializer/test/**",
// Moved as-is from the standalone repo; legacy code will be brought up to
// monorepo lint standards in a follow-up PR
"plugins/sanity-plugin-media/**",
"plugins/sanity-plugin-mux-input/**"
],
"options": {
"typeAware": true,
"typeCheck": true
},
"categories": {
"correctness": "error",
"suspicious": "error",
"perf": "error"
},
"rules": {
"no-underscore-dangle": "off",
"consistent-function-scoping": "off",
"eslint/no-restricted-imports": [
"error",
{
"paths": [
{
"name": "lodash-es",
"message": "Import from individual modules instead, e.g. `import debounce from 'lodash-es/debounce.js'`. Barrel imports are ~55% slower."
},
{
"name": "react",
"importNames": ["createElement"],
"message": "Please use JSX instead of createElement, for example `createElement(Icon)` should be `<Icon />`"
}
],
"patterns": [
{
"group": ["lodash.*", "lodash/*", "lodash"],
"message": "Please use individual imports from 'lodash-es' instead, e.g. `import debounce from 'lodash-es/debounce.js'`."
}
]
}
],
// React Compiler checks
"react/react-compiler": "error",
"typescript/ban-ts-comment": "error",
"typescript/no-deprecated": "error",
"typescript/no-unnecessary-type-assertion": "error",
"typescript/no-unnecessary-type-arguments": "error",
"typescript/prefer-ts-expect-error": "error",
"import/no-commonjs": "error",
"import/no-unassigned-import": ["error", {"allow": ["**/*.css"]}],
"no-restricted-globals": [
"error",
{"name": "__dirname", "message": "Use path.dirname(fileURLToPath(import.meta.url)) instead"},
{"name": "__filename", "message": "Use fileURLToPath(import.meta.url) instead"}
],
"react/jsx-key": "error",
"unicorn/no-abusive-eslint-disable": "error",
// Not relevant as we use the modern jsx-runtime transform
"react-in-jsx-scope": "off",
// Not relevant due to React Compiler
"react_perf/jsx-no-new-array-as-prop": "off",
"react_perf/jsx-no-new-object-as-prop": "off",
"react_perf/jsx-no-new-function-as-prop": "off",
"react_perf/jsx-no-jsx-as-prop": "off",
// False negatives
"jsx_a11y/anchor-is-valid": "off",
"jsx_a11y/no-autofocus": "off",
// Handy rules that are disabled by default
"react/exhaustive-deps": "error",
"react/rules-of-hooks": "error",
"eslint/no-console": ["error", {"allow": ["warn", "error"]}],
// Requires polyfills for older browsers
"no-array-reverse": "off",
"no-array-sort": "off",
// Too noisy, common in callbacks/closures
"no-shadow": "off"
},
"overrides": [
{
"files": ["turbo/generators/**/*.ts"],
"rules": {
"no-console": "off",
"no-unsafe-type-assertion": "off"
}
},
{
"files": ["plugins/sanity-naive-html-serializer/src/**/*.ts"],
"rules": {
"no-unsafe-type-assertion": "off",
"restrict-template-expressions": "off"
}
},
{
"files": ["plugins/sanity-naive-html-serializer/test/**/*.ts"],
"rules": {
"no-unsafe-type-assertion": "off",
"restrict-template-expressions": "off"
}
},
{
// XState v5's canonical typing pattern relies on `{} as Context` style assertions
"files": ["plugins/sanity-plugin-dashboard-widget-vercel/src/machines/*.ts"],
"rules": {
"no-unsafe-type-assertion": "off"
}
}
]
}