@wistia/oxlint-config 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -2
- package/configs/javascript.jsonc +4 -0
- package/configs/node.jsonc +4 -0
- package/configs/playwright.jsonc +4 -0
- package/configs/react.jsonc +4 -0
- package/configs/storybook.jsonc +4 -0
- package/configs/styled-components.jsonc +4 -0
- package/configs/testing-library.jsonc +4 -0
- package/configs/typescript.jsonc +4 -0
- package/configs/vitest.jsonc +4 -0
- package/jsoncLoader.d.mts +10 -0
- package/jsoncLoader.mjs +27 -0
- package/package.json +48 -3
- package/rules/base.jsonc +636 -0
- package/rules/import.jsonc +89 -0
- package/rules/node.jsonc +133 -0
- package/rules/playwright.jsonc +195 -0
- package/rules/promise.jsonc +70 -0
- package/rules/react-a11y.jsonc +153 -0
- package/rules/react.jsonc +238 -0
- package/rules/storybook.jsonc +67 -0
- package/rules/styled-components.jsonc +153 -0
- package/rules/testing-library.jsonc +173 -0
- package/rules/typescript.jsonc +457 -0
- package/rules/vitest.jsonc +324 -0
- package/.tool-versions +0 -1
- package/.yarn/releases/yarn-4.13.0.cjs +0 -940
- package/.yarnrc.yml +0 -5
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["react"],
|
|
4
|
+
"categories": {},
|
|
5
|
+
"rules": {
|
|
6
|
+
// -- React Core --
|
|
7
|
+
|
|
8
|
+
// Enforce that button elements have an explicit type attribute
|
|
9
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
10
|
+
"react/button-has-type": "error",
|
|
11
|
+
|
|
12
|
+
// Enforce boolean attributes notation in JSX (require explicit ={true})
|
|
13
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value
|
|
14
|
+
"react/jsx-boolean-value": ["error", "always"],
|
|
15
|
+
|
|
16
|
+
// Enforce curly braces or disallow unnecessary curly braces in JSX props and children
|
|
17
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
18
|
+
// decision: stylistic choice best left for formatter
|
|
19
|
+
"react/jsx-curly-brace-presence": "off",
|
|
20
|
+
|
|
21
|
+
// Enforce shorthand or standard form for React fragments
|
|
22
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
23
|
+
"react/jsx-fragments": "error",
|
|
24
|
+
|
|
25
|
+
// Enforce missing key props in iterators/collection literals
|
|
26
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
27
|
+
"react/jsx-key": "error",
|
|
28
|
+
|
|
29
|
+
// Enforce a maximum depth that JSX can be nested
|
|
30
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md
|
|
31
|
+
// decision: not useful enough to justify the performance cost
|
|
32
|
+
"react/jsx-max-depth": "off",
|
|
33
|
+
|
|
34
|
+
// Disallow comments from being inserted as text nodes
|
|
35
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
36
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
37
|
+
|
|
38
|
+
// Disallow JSX context values from taking values that will cause needless rerenders
|
|
39
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
|
|
40
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
41
|
+
|
|
42
|
+
// Disallow duplicate properties in JSX
|
|
43
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
|
|
44
|
+
// decision: stylistic choice best left for formatter
|
|
45
|
+
"react/jsx-no-duplicate-props": "off",
|
|
46
|
+
|
|
47
|
+
// Disallow javascript: URLs
|
|
48
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
|
|
49
|
+
"react/jsx-no-script-url": "error",
|
|
50
|
+
|
|
51
|
+
// Disallow target="_blank" attribute without rel="noreferrer"
|
|
52
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
53
|
+
"react/jsx-no-target-blank": "error",
|
|
54
|
+
|
|
55
|
+
// Disallow undeclared variables in JSX
|
|
56
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
57
|
+
// decision: stylistic choice best left for formatter
|
|
58
|
+
"react/jsx-no-undef": "off",
|
|
59
|
+
|
|
60
|
+
// Disallow unnecessary fragments
|
|
61
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
62
|
+
// decision: disabled — oxlint's implementation differs from @eslint-react/no-useless-fragment
|
|
63
|
+
// and produces false positives on valid patterns
|
|
64
|
+
"react/jsx-no-useless-fragment": "off",
|
|
65
|
+
|
|
66
|
+
// Enforce PascalCase for user-defined JSX components
|
|
67
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
68
|
+
// decision: stylistic choice best left for formatter
|
|
69
|
+
"react/jsx-pascal-case": "off",
|
|
70
|
+
|
|
71
|
+
// Disallow spreading props on multiple JSX elements (and merging objects)
|
|
72
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spread-multi.md
|
|
73
|
+
// decision: stylistic choice best left for formatter
|
|
74
|
+
"react/jsx-props-no-spread-multi": "off",
|
|
75
|
+
|
|
76
|
+
// Disallow JSX prop spreading
|
|
77
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
78
|
+
// decision: this is a decision best left to the implementer
|
|
79
|
+
"react/jsx-props-no-spreading": "off",
|
|
80
|
+
|
|
81
|
+
// Disallow Array.prototype.map() key from being an array index
|
|
82
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
83
|
+
"react/no-array-index-key": "error",
|
|
84
|
+
|
|
85
|
+
// Disallow passing of children as props
|
|
86
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
|
87
|
+
"react/no-children-prop": "error",
|
|
88
|
+
|
|
89
|
+
// Disallow usage of dangerous JSX properties
|
|
90
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
91
|
+
"react/no-danger": "error",
|
|
92
|
+
|
|
93
|
+
// Report when a DOM element is using both children and dangerouslySetInnerHTML
|
|
94
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
95
|
+
"react/no-danger-with-children": "error",
|
|
96
|
+
|
|
97
|
+
// Disallow direct mutation of this.state
|
|
98
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
99
|
+
"react/no-direct-mutation-state": "error",
|
|
100
|
+
|
|
101
|
+
// Disallow usage of findDOMNode
|
|
102
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
103
|
+
"react/no-find-dom-node": "error",
|
|
104
|
+
|
|
105
|
+
// Disallow usage of isMounted
|
|
106
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
107
|
+
// decision: stylistic choice best left for formatter
|
|
108
|
+
"react/no-is-mounted": "off",
|
|
109
|
+
|
|
110
|
+
// Disallow defining multiple components in a single file (allow colocated stateless helpers)
|
|
111
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
|
|
112
|
+
// decision: stylistic choice best left for formatter
|
|
113
|
+
"react/no-multi-comp": "off",
|
|
114
|
+
|
|
115
|
+
// Disallow usage of the return value of ReactDOM.render
|
|
116
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
117
|
+
"react/no-render-return-value": "error",
|
|
118
|
+
|
|
119
|
+
// Disallow usage of setState
|
|
120
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
|
|
121
|
+
// decision: stylistic choice best left for formatter
|
|
122
|
+
"react/no-set-state": "off",
|
|
123
|
+
|
|
124
|
+
// Disallow using string references
|
|
125
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
126
|
+
// decision: stylistic choice best left for formatter
|
|
127
|
+
"react/no-string-refs": "off",
|
|
128
|
+
|
|
129
|
+
// Disallow this from being used in stateless functional components
|
|
130
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
131
|
+
// decision: stylistic choice best left for formatter
|
|
132
|
+
"react/no-this-in-sfc": "off",
|
|
133
|
+
|
|
134
|
+
// Disallow unescaped HTML entities from appearing in markup
|
|
135
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
|
|
136
|
+
// decision: stylistic choice best left for formatter
|
|
137
|
+
"react/no-unescaped-entities": "off",
|
|
138
|
+
|
|
139
|
+
// Disallow usage of unknown DOM property
|
|
140
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
|
|
141
|
+
"react/no-unknown-property": "error",
|
|
142
|
+
|
|
143
|
+
// Disallow usage of unsafe lifecycle methods
|
|
144
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
|
|
145
|
+
// decision: stylistic choice best left for formatter
|
|
146
|
+
"react/no-unsafe": "off",
|
|
147
|
+
|
|
148
|
+
// Disallow usage of deprecated methods
|
|
149
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
|
|
150
|
+
"react/no-redundant-should-component-update": "error",
|
|
151
|
+
|
|
152
|
+
// Disallow creating unstable components inside components
|
|
153
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-namespace.md
|
|
154
|
+
"react/no-namespace": "error",
|
|
155
|
+
|
|
156
|
+
// Disallow usage of setState in componentDidMount
|
|
157
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
|
158
|
+
"react/no-did-mount-set-state": "error",
|
|
159
|
+
|
|
160
|
+
// Disallow usage of setState in componentWillUpdate
|
|
161
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
162
|
+
"react/no-will-update-set-state": "error",
|
|
163
|
+
|
|
164
|
+
// Disallow usage of React.Children APIs
|
|
165
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-react-children.md
|
|
166
|
+
// decision: stylistic choice best left for formatter
|
|
167
|
+
"react/no-react-children": "off",
|
|
168
|
+
|
|
169
|
+
// Disallow usage of cloneElement
|
|
170
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-clone-element.md
|
|
171
|
+
"react/no-clone-element": "error",
|
|
172
|
+
|
|
173
|
+
// Enforce ES5 or ES6 class for React Components
|
|
174
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
175
|
+
// decision: stylistic choice best left for formatter
|
|
176
|
+
"react/prefer-es6-class": "off",
|
|
177
|
+
|
|
178
|
+
// Enforce that components that only export from react can only export components
|
|
179
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/only-export-components.md
|
|
180
|
+
// decision: stylistic choice best left for formatter
|
|
181
|
+
"react/only-export-components": "off",
|
|
182
|
+
|
|
183
|
+
// Prevent missing displayName in a React component definition
|
|
184
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
185
|
+
// decision: stylistic choice best left for formatter (equivalent @eslint-react/no-missing-component-display-name is "off")
|
|
186
|
+
"react/display-name": "off",
|
|
187
|
+
|
|
188
|
+
// Enforce a specific function type for function components
|
|
189
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forward-ref-uses-ref.md
|
|
190
|
+
// decision: stylistic choice best left for formatter
|
|
191
|
+
"react/forward-ref-uses-ref": "off",
|
|
192
|
+
|
|
193
|
+
// Enforce sandbox attribute on iframe elements
|
|
194
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
|
|
195
|
+
"react/iframe-missing-sandbox": "error",
|
|
196
|
+
|
|
197
|
+
// Enforce checked/onChange or readonly for checkboxes
|
|
198
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md
|
|
199
|
+
// decision: stylistic choice best left for formatter
|
|
200
|
+
"react/checked-requires-onchange-or-readonly": "off",
|
|
201
|
+
|
|
202
|
+
// Disallow void DOM elements from receiving children
|
|
203
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
204
|
+
"react/void-dom-elements-no-children": "error",
|
|
205
|
+
|
|
206
|
+
// Enforce component methods order
|
|
207
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
208
|
+
// decision: stylistic choice best left for formatter
|
|
209
|
+
"react/require-render-return": "off",
|
|
210
|
+
|
|
211
|
+
// Enforce Rules of Hooks
|
|
212
|
+
// https://reactjs.org/docs/hooks-rules.html
|
|
213
|
+
"react/rules-of-hooks": "error",
|
|
214
|
+
|
|
215
|
+
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
216
|
+
// https://github.com/facebook/react/issues/14920
|
|
217
|
+
"react/exhaustive-deps": "error",
|
|
218
|
+
|
|
219
|
+
// Enforce JSX filename extension (allow .jsx and .tsx)
|
|
220
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
221
|
+
// decision: stylistic choice best left for formatter
|
|
222
|
+
"react/jsx-filename-extension": "off",
|
|
223
|
+
|
|
224
|
+
// Enforce self-closing tags for components without children
|
|
225
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
226
|
+
// decision: stylistic choice best left for formatter
|
|
227
|
+
"react/self-closing-comp": "off",
|
|
228
|
+
|
|
229
|
+
// Enforce style prop value is an object
|
|
230
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
231
|
+
"react/style-prop-object": "error",
|
|
232
|
+
|
|
233
|
+
// Enforce event handler naming conventions in JSX
|
|
234
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
235
|
+
// decision: stylistic choice best left for formatter
|
|
236
|
+
"react/jsx-handler-names": "off",
|
|
237
|
+
},
|
|
238
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
// All storybook rules loaded via jsPlugins (no native oxlint support).
|
|
3
|
+
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
|
4
|
+
"jsPlugins": ["eslint-plugin-storybook"],
|
|
5
|
+
"categories": {},
|
|
6
|
+
"rules": {
|
|
7
|
+
// Interactions should be awaited
|
|
8
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/await-interactions.md
|
|
9
|
+
"eslint-plugin-storybook/await-interactions": "error",
|
|
10
|
+
|
|
11
|
+
// Pass a context when invoking play function of another story
|
|
12
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/context-in-play-function.md
|
|
13
|
+
"eslint-plugin-storybook/context-in-play-function": "error",
|
|
14
|
+
|
|
15
|
+
// The component property should be set
|
|
16
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/csf-component.md
|
|
17
|
+
"eslint-plugin-storybook/csf-component": "error",
|
|
18
|
+
|
|
19
|
+
// Story files should have a default export
|
|
20
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/default-exports.md
|
|
21
|
+
"eslint-plugin-storybook/default-exports": "error",
|
|
22
|
+
|
|
23
|
+
// Deprecated hierarchy separator in title property
|
|
24
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/hierarchy-separator.md
|
|
25
|
+
"eslint-plugin-storybook/hierarchy-separator": "error",
|
|
26
|
+
|
|
27
|
+
// Meta should only have inline properties
|
|
28
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/meta-inline-properties.md
|
|
29
|
+
"eslint-plugin-storybook/meta-inline-properties": "error",
|
|
30
|
+
|
|
31
|
+
// Meta should use satisfies operator for type safety
|
|
32
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/meta-satisfies-type.md
|
|
33
|
+
"eslint-plugin-storybook/meta-satisfies-type": "error",
|
|
34
|
+
|
|
35
|
+
// A story should not have a redundant name property
|
|
36
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-redundant-story-name.md
|
|
37
|
+
"eslint-plugin-storybook/no-redundant-story-name": "error",
|
|
38
|
+
|
|
39
|
+
// storiesOf is deprecated and should not be used
|
|
40
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-stories-of.md
|
|
41
|
+
"eslint-plugin-storybook/no-stories-of": "error",
|
|
42
|
+
|
|
43
|
+
// Do not step out of the Storybook renderer package
|
|
44
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-renderer-packages.md
|
|
45
|
+
"eslint-plugin-storybook/no-renderer-packages": "error",
|
|
46
|
+
|
|
47
|
+
// No uninstalled addons
|
|
48
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-uninstalled-addons.md
|
|
49
|
+
"eslint-plugin-storybook/no-uninstalled-addons": "error",
|
|
50
|
+
|
|
51
|
+
// Stories should use PascalCase
|
|
52
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/prefer-pascal-case.md
|
|
53
|
+
"eslint-plugin-storybook/prefer-pascal-case": "error",
|
|
54
|
+
|
|
55
|
+
// A story file must contain at least one story export
|
|
56
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/story-exports.md
|
|
57
|
+
"eslint-plugin-storybook/story-exports": "error",
|
|
58
|
+
|
|
59
|
+
// Use @storybook/expect instead of plain expect
|
|
60
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-expect.md
|
|
61
|
+
"eslint-plugin-storybook/use-storybook-expect": "error",
|
|
62
|
+
|
|
63
|
+
// Use @storybook/testing-library instead of plain testing-library
|
|
64
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-testing-library.md
|
|
65
|
+
"eslint-plugin-storybook/use-storybook-testing-library": "error",
|
|
66
|
+
},
|
|
67
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
{
|
|
2
|
+
// All styled-components-a11y rules loaded via jsPlugins (no native oxlint support).
|
|
3
|
+
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
|
4
|
+
"jsPlugins": ["eslint-plugin-styled-components-a11y"],
|
|
5
|
+
"categories": {},
|
|
6
|
+
"rules": {
|
|
7
|
+
// Enforce that all elements that require alternative text have meaningful information
|
|
8
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/alt-text.md
|
|
9
|
+
"eslint-plugin-styled-components-a11y/alt-text": "error",
|
|
10
|
+
|
|
11
|
+
// Enforce that anchors have content
|
|
12
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/anchor-has-content.md
|
|
13
|
+
"eslint-plugin-styled-components-a11y/anchor-has-content": "error",
|
|
14
|
+
|
|
15
|
+
// Enforce all anchors are valid, navigable elements
|
|
16
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/anchor-is-valid.md
|
|
17
|
+
"eslint-plugin-styled-components-a11y/anchor-is-valid": "error",
|
|
18
|
+
|
|
19
|
+
// Enforce that elements with aria-activedescendant have tabindex
|
|
20
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
|
|
21
|
+
"eslint-plugin-styled-components-a11y/aria-activedescendant-has-tabindex": "error",
|
|
22
|
+
|
|
23
|
+
// Enforce that elements have valid aria-* props
|
|
24
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/aria-props.md
|
|
25
|
+
"eslint-plugin-styled-components-a11y/aria-props": "error",
|
|
26
|
+
|
|
27
|
+
// Enforce that ARIA state and property values are valid
|
|
28
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/aria-proptypes.md
|
|
29
|
+
"eslint-plugin-styled-components-a11y/aria-proptypes": "error",
|
|
30
|
+
|
|
31
|
+
// Enforce that elements with ARIA roles have all required attributes for that role
|
|
32
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/aria-role.md
|
|
33
|
+
"eslint-plugin-styled-components-a11y/aria-role": "error",
|
|
34
|
+
|
|
35
|
+
// Enforce that certain elements don't have ARIA roles, states, or properties
|
|
36
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/aria-unsupported-elements.md
|
|
37
|
+
"eslint-plugin-styled-components-a11y/aria-unsupported-elements": "error",
|
|
38
|
+
|
|
39
|
+
// Enforce that autocomplete attribute is correct
|
|
40
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/autocomplete-valid.md
|
|
41
|
+
"eslint-plugin-styled-components-a11y/autocomplete-valid": "error",
|
|
42
|
+
|
|
43
|
+
// Enforce click events have key events
|
|
44
|
+
// https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/click-events-have-key-events.md
|
|
45
|
+
"eslint-plugin-styled-components-a11y/click-events-have-key-events": "error",
|
|
46
|
+
|
|
47
|
+
// Enforce a label tag has a text label and an associated control
|
|
48
|
+
"eslint-plugin-styled-components-a11y/control-has-associated-label": [
|
|
49
|
+
"error",
|
|
50
|
+
{
|
|
51
|
+
"ignoreElements": ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
|
|
52
|
+
"ignoreRoles": [
|
|
53
|
+
"grid",
|
|
54
|
+
"listbox",
|
|
55
|
+
"menu",
|
|
56
|
+
"menubar",
|
|
57
|
+
"radiogroup",
|
|
58
|
+
"row",
|
|
59
|
+
"tablist",
|
|
60
|
+
"toolbar",
|
|
61
|
+
"tree",
|
|
62
|
+
"treegrid",
|
|
63
|
+
],
|
|
64
|
+
"includeRoles": ["alert", "dialog"],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
|
|
68
|
+
// Enforce heading elements have content
|
|
69
|
+
"eslint-plugin-styled-components-a11y/heading-has-content": "error",
|
|
70
|
+
|
|
71
|
+
// Enforce html element has lang prop
|
|
72
|
+
"eslint-plugin-styled-components-a11y/html-has-lang": "error",
|
|
73
|
+
|
|
74
|
+
// Enforce iframe elements have a title attribute
|
|
75
|
+
"eslint-plugin-styled-components-a11y/iframe-has-title": "error",
|
|
76
|
+
|
|
77
|
+
// Enforce img alt prop does not contain the word image, picture, or photo
|
|
78
|
+
"eslint-plugin-styled-components-a11y/img-redundant-alt": "error",
|
|
79
|
+
|
|
80
|
+
// Enforce that interactive elements are focusable
|
|
81
|
+
"eslint-plugin-styled-components-a11y/interactive-supports-focus": [
|
|
82
|
+
"error",
|
|
83
|
+
{
|
|
84
|
+
"tabbable": [
|
|
85
|
+
"button",
|
|
86
|
+
"checkbox",
|
|
87
|
+
"link",
|
|
88
|
+
"progressbar",
|
|
89
|
+
"searchbox",
|
|
90
|
+
"slider",
|
|
91
|
+
"spinbutton",
|
|
92
|
+
"switch",
|
|
93
|
+
"textbox",
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
|
|
98
|
+
// Enforce label-control association
|
|
99
|
+
"eslint-plugin-styled-components-a11y/label-has-associated-control": "error",
|
|
100
|
+
|
|
101
|
+
// Enforce that media elements have captions
|
|
102
|
+
"eslint-plugin-styled-components-a11y/media-has-caption": "error",
|
|
103
|
+
|
|
104
|
+
// Enforce onMouseOver/onMouseOut are accompanied by onFocus/onBlur
|
|
105
|
+
"eslint-plugin-styled-components-a11y/mouse-events-have-key-events": "error",
|
|
106
|
+
|
|
107
|
+
// Enforce that the accessKey prop is not used
|
|
108
|
+
"eslint-plugin-styled-components-a11y/no-access-key": "error",
|
|
109
|
+
|
|
110
|
+
// Enforce autoFocus prop is not used
|
|
111
|
+
"eslint-plugin-styled-components-a11y/no-autofocus": "error",
|
|
112
|
+
|
|
113
|
+
// Enforce distracting elements are not used
|
|
114
|
+
"eslint-plugin-styled-components-a11y/no-distracting-elements": "error",
|
|
115
|
+
|
|
116
|
+
// Enforce interactive elements not assigned non-interactive roles
|
|
117
|
+
"eslint-plugin-styled-components-a11y/no-interactive-element-to-noninteractive-role": "error",
|
|
118
|
+
|
|
119
|
+
// Enforce non-interactive elements do not have interactions
|
|
120
|
+
"eslint-plugin-styled-components-a11y/no-noninteractive-element-interactions": [
|
|
121
|
+
"error",
|
|
122
|
+
{
|
|
123
|
+
"body": ["onError", "onLoad"],
|
|
124
|
+
"iframe": ["onError", "onLoad"],
|
|
125
|
+
"img": ["onError", "onLoad"],
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
|
|
129
|
+
// Enforce non-interactive elements not assigned interactive roles
|
|
130
|
+
"eslint-plugin-styled-components-a11y/no-noninteractive-element-to-interactive-role": "error",
|
|
131
|
+
|
|
132
|
+
// Enforce tabIndex value is not greater than zero
|
|
133
|
+
"eslint-plugin-styled-components-a11y/no-noninteractive-tabindex": "error",
|
|
134
|
+
|
|
135
|
+
// Enforce explicit role is not redundant
|
|
136
|
+
"eslint-plugin-styled-components-a11y/no-redundant-roles": "error",
|
|
137
|
+
|
|
138
|
+
// Enforce non-interactive visible elements with click handlers use the role attribute
|
|
139
|
+
"eslint-plugin-styled-components-a11y/no-static-element-interactions": "error",
|
|
140
|
+
|
|
141
|
+
// Enforce that elements with ARIA roles have all required attributes
|
|
142
|
+
"eslint-plugin-styled-components-a11y/role-has-required-aria-props": "error",
|
|
143
|
+
|
|
144
|
+
// Enforce that elements with roles support all aria-* properties for that role
|
|
145
|
+
"eslint-plugin-styled-components-a11y/role-supports-aria-props": "error",
|
|
146
|
+
|
|
147
|
+
// Enforce scope prop is only used on th elements
|
|
148
|
+
"eslint-plugin-styled-components-a11y/scope": "error",
|
|
149
|
+
|
|
150
|
+
// Enforce tabIndex value is not greater than zero
|
|
151
|
+
"eslint-plugin-styled-components-a11y/tabindex-no-positive": "error",
|
|
152
|
+
},
|
|
153
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
// All testing-library + jest-dom rules loaded via jsPlugins (no native oxlint support).
|
|
3
|
+
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
|
4
|
+
"jsPlugins": ["eslint-plugin-testing-library", "eslint-plugin-jest-dom"],
|
|
5
|
+
"categories": {},
|
|
6
|
+
"rules": {
|
|
7
|
+
// -- testing-library rules --
|
|
8
|
+
|
|
9
|
+
// Enforce async events to be awaited
|
|
10
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-events.md
|
|
11
|
+
"eslint-plugin-testing-library/await-async-events": "error",
|
|
12
|
+
|
|
13
|
+
// Enforce async queries to be awaited
|
|
14
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-queries.md
|
|
15
|
+
"eslint-plugin-testing-library/await-async-queries": "error",
|
|
16
|
+
|
|
17
|
+
// Enforce async utils to be awaited
|
|
18
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-utils.md
|
|
19
|
+
"eslint-plugin-testing-library/await-async-utils": "error",
|
|
20
|
+
|
|
21
|
+
// Enforce consistent data-testid usage
|
|
22
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/consistent-data-testid.md
|
|
23
|
+
"eslint-plugin-testing-library/consistent-data-testid": [
|
|
24
|
+
"error",
|
|
25
|
+
{ "testIdPattern": ".*", "testIdAttribute": ["data-testid"] },
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
// Disallow awaiting sync events
|
|
29
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-await-sync-events.md
|
|
30
|
+
"eslint-plugin-testing-library/no-await-sync-events": [
|
|
31
|
+
"error",
|
|
32
|
+
{ "eventModules": ["fire-event"] },
|
|
33
|
+
],
|
|
34
|
+
|
|
35
|
+
// Disallow awaiting sync queries
|
|
36
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-await-sync-queries.md
|
|
37
|
+
"eslint-plugin-testing-library/no-await-sync-queries": "error",
|
|
38
|
+
|
|
39
|
+
// Disallow the use of container methods
|
|
40
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-container.md
|
|
41
|
+
"eslint-plugin-testing-library/no-container": "error",
|
|
42
|
+
|
|
43
|
+
// Disallow the use of debugging utilities
|
|
44
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-debugging-utils.md
|
|
45
|
+
"eslint-plugin-testing-library/no-debugging-utils": "error",
|
|
46
|
+
|
|
47
|
+
// Disallow importing from DOM Testing Library
|
|
48
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-dom-import.md
|
|
49
|
+
"eslint-plugin-testing-library/no-dom-import": "error",
|
|
50
|
+
|
|
51
|
+
// Disallow the use of the global RegExp flag in queries
|
|
52
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-global-regexp-flag-in-query.md
|
|
53
|
+
"eslint-plugin-testing-library/no-global-regexp-flag-in-query": "error",
|
|
54
|
+
|
|
55
|
+
// Disallow the use of cleanup
|
|
56
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-manual-cleanup.md
|
|
57
|
+
"eslint-plugin-testing-library/no-manual-cleanup": "error",
|
|
58
|
+
|
|
59
|
+
// Disallow direct Node access
|
|
60
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-node-access.md
|
|
61
|
+
"eslint-plugin-testing-library/no-node-access": "error",
|
|
62
|
+
|
|
63
|
+
// Disallow the use of promises passed to a fireEvent method
|
|
64
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-promise-in-fire-event.md
|
|
65
|
+
"eslint-plugin-testing-library/no-promise-in-fire-event": "error",
|
|
66
|
+
|
|
67
|
+
// Disallow the use of render in testing frameworks setup files
|
|
68
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-render-in-lifecycle.md
|
|
69
|
+
"eslint-plugin-testing-library/no-render-in-lifecycle": "error",
|
|
70
|
+
|
|
71
|
+
// Disallow the use of data-testid queries
|
|
72
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-test-id-queries.md
|
|
73
|
+
"eslint-plugin-testing-library/no-test-id-queries": "error",
|
|
74
|
+
|
|
75
|
+
// Disallow unnecessary act wrapping
|
|
76
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-unnecessary-act.md
|
|
77
|
+
"eslint-plugin-testing-library/no-unnecessary-act": "error",
|
|
78
|
+
|
|
79
|
+
// Disallow the use of multiple expect inside waitFor
|
|
80
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-multiple-assertions.md
|
|
81
|
+
"eslint-plugin-testing-library/no-wait-for-multiple-assertions": "error",
|
|
82
|
+
|
|
83
|
+
// Disallow the use of side effects in waitFor
|
|
84
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-side-effects.md
|
|
85
|
+
"eslint-plugin-testing-library/no-wait-for-side-effects": "error",
|
|
86
|
+
|
|
87
|
+
// Disallow the use of snapshot inside waitFor
|
|
88
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-snapshot.md
|
|
89
|
+
"eslint-plugin-testing-library/no-wait-for-snapshot": "error",
|
|
90
|
+
|
|
91
|
+
// Suggest using explicit assertions rather than standalone queries
|
|
92
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-explicit-assert.md
|
|
93
|
+
"eslint-plugin-testing-library/prefer-explicit-assert": "error",
|
|
94
|
+
|
|
95
|
+
// Suggest using find* queries instead of waitFor + get* queries
|
|
96
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-find-by.md
|
|
97
|
+
"eslint-plugin-testing-library/prefer-find-by": "error",
|
|
98
|
+
|
|
99
|
+
// Ensure appropriate get*/query* queries are used with their respective matchers
|
|
100
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-presence-queries.md
|
|
101
|
+
"eslint-plugin-testing-library/prefer-presence-queries": "error",
|
|
102
|
+
|
|
103
|
+
// Suggest using queryBy* queries when waiting for disappearance
|
|
104
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-query-by-disappearance.md
|
|
105
|
+
"eslint-plugin-testing-library/prefer-query-by-disappearance": "error",
|
|
106
|
+
|
|
107
|
+
// Ensure the configured get*/query* query is used with the corresponding matchers
|
|
108
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-query-matchers.md
|
|
109
|
+
"eslint-plugin-testing-library/prefer-query-matchers": "error",
|
|
110
|
+
|
|
111
|
+
// Suggest using screen while querying
|
|
112
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md
|
|
113
|
+
"eslint-plugin-testing-library/prefer-screen-queries": "error",
|
|
114
|
+
|
|
115
|
+
// Suggest using userEvent over fireEvent
|
|
116
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-user-event.md
|
|
117
|
+
"eslint-plugin-testing-library/prefer-user-event": "error",
|
|
118
|
+
|
|
119
|
+
// Suggest using userEvent.setup
|
|
120
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-user-event-setup.md
|
|
121
|
+
"eslint-plugin-testing-library/prefer-user-event-setup": "error",
|
|
122
|
+
|
|
123
|
+
// Enforce a valid naming for return value of render
|
|
124
|
+
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/render-result-naming-convention.md
|
|
125
|
+
"eslint-plugin-testing-library/render-result-naming-convention": "error",
|
|
126
|
+
|
|
127
|
+
// -- jest-dom rules --
|
|
128
|
+
|
|
129
|
+
// Prefer toBeChecked over checking attributes
|
|
130
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-checked.md
|
|
131
|
+
"eslint-plugin-jest-dom/prefer-checked": "error",
|
|
132
|
+
|
|
133
|
+
// Prefer toBeEmptyDOMElement over checking innerHTML
|
|
134
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-empty.md
|
|
135
|
+
"eslint-plugin-jest-dom/prefer-empty": "error",
|
|
136
|
+
|
|
137
|
+
// Prefer toBeEnabled/toBeDisabled over checking attributes
|
|
138
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-enabled-disabled.md
|
|
139
|
+
"eslint-plugin-jest-dom/prefer-enabled-disabled": "error",
|
|
140
|
+
|
|
141
|
+
// Prefer toHaveFocus over checking document.activeElement
|
|
142
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-focus.md
|
|
143
|
+
"eslint-plugin-jest-dom/prefer-focus": "error",
|
|
144
|
+
|
|
145
|
+
// Prefer toBeInTheDocument over checking for null/truthy
|
|
146
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-in-document.md
|
|
147
|
+
"eslint-plugin-jest-dom/prefer-in-document": "error",
|
|
148
|
+
|
|
149
|
+
// Prefer toBeRequired over checking attributes
|
|
150
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-required.md
|
|
151
|
+
"eslint-plugin-jest-dom/prefer-required": "error",
|
|
152
|
+
|
|
153
|
+
// Prefer toHaveAttribute over checking getAttribute
|
|
154
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-attribute.md
|
|
155
|
+
"eslint-plugin-jest-dom/prefer-to-have-attribute": "error",
|
|
156
|
+
|
|
157
|
+
// Prefer toHaveClass over checking className
|
|
158
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-class.md
|
|
159
|
+
"eslint-plugin-jest-dom/prefer-to-have-class": "error",
|
|
160
|
+
|
|
161
|
+
// Prefer toHaveStyle over checking style attribute
|
|
162
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-style.md
|
|
163
|
+
"eslint-plugin-jest-dom/prefer-to-have-style": "error",
|
|
164
|
+
|
|
165
|
+
// Prefer toHaveTextContent over checking textContent
|
|
166
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-text-content.md
|
|
167
|
+
"eslint-plugin-jest-dom/prefer-to-have-text-content": "error",
|
|
168
|
+
|
|
169
|
+
// Prefer toHaveValue over checking value property
|
|
170
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-value.md
|
|
171
|
+
"eslint-plugin-jest-dom/prefer-to-have-value": "error",
|
|
172
|
+
},
|
|
173
|
+
}
|