-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.oxlintrc.json
More file actions
127 lines (125 loc) · 4.33 KB
/
.oxlintrc.json
File metadata and controls
127 lines (125 loc) · 4.33 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
127
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"typescript",
"unicorn",
"react",
"react-perf",
"oxc",
"import",
"jsx-a11y",
"promise"
],
"jsPlugins": [{"name": "react-hooks-js", "specifier": "eslint-plugin-react-hooks"}],
"ignorePatterns": [
"**/.sanity/*",
"**/dist/*",
"**/sanity.types.ts",
"turbo/generators/config.ts"
],
"options": {
"typeAware": true,
"typeCheck": true
},
"categories": {
"correctness": "error",
"suspicious": "error",
"perf": "error"
},
"rules": {
"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
// Recommended rules (from LintRulePreset.Recommended)
"react-hooks-js/component-hook-factories": "error",
"react-hooks-js/config": "error",
"react-hooks-js/error-boundaries": "error",
"react-hooks-js/gating": "error",
"react-hooks-js/globals": "error",
"react-hooks-js/immutability": "error",
"react-hooks-js/incompatible-library": "error",
"react-hooks-js/preserve-manual-memoization": "error",
"react-hooks-js/purity": "error",
"react-hooks-js/refs": "error",
"react-hooks-js/set-state-in-effect": "error",
"react-hooks-js/set-state-in-render": "error",
"react-hooks-js/static-components": "error",
"react-hooks-js/unsupported-syntax": "error",
"react-hooks-js/use-memo": "error",
// Recommended-latest rules (from LintRulePreset.RecommendedLatest)
"react-hooks-js/void-use-memo": "error",
// Off rules (LintRulePreset.Off) - not enabled by default
"react-hooks-js/automatic-effect-dependencies": "error",
"react-hooks-js/capitalized-calls": "error",
"react-hooks-js/fbt": "error",
"react-hooks-js/fire": "error",
"react-hooks-js/hooks": "error",
"react-hooks-js/invariant": "error",
"react-hooks-js/memoized-effect-dependencies": "error",
"react-hooks-js/no-deriving-state-in-effects": "error",
"react-hooks-js/rule-suppression": "error",
"react-hooks-js/syntax": "error",
"react-hooks-js/todo": "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"
}
}
]
}