@wistia/oxlint-config 0.2.0 → 0.3.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/configs/javascript.ts +13 -0
- package/configs/node.ts +8 -0
- package/configs/playwright.ts +7 -0
- package/configs/react.ts +11 -0
- package/configs/storybook.ts +7 -0
- package/configs/styled-components.ts +7 -0
- package/configs/testing-library.ts +7 -0
- package/configs/typescript.ts +20 -0
- package/configs/vitest.ts +8 -0
- package/index.ts +27 -0
- package/package.json +15 -18
- package/rules/{base.jsonc → base.ts} +181 -184
- package/rules/{import.jsonc → import.ts} +32 -32
- package/rules/{node.jsonc → node.ts} +39 -39
- package/rules/{playwright.jsonc → playwright.ts} +54 -54
- package/rules/{promise.jsonc → promise.ts} +22 -22
- package/rules/{react-a11y.jsonc → react-a11y.ts} +50 -50
- package/rules/{react.jsonc → react.ts} +57 -57
- package/rules/{storybook.jsonc → storybook.ts} +22 -22
- package/rules/styled-components.ts +153 -0
- package/rules/{testing-library.jsonc → testing-library.ts} +50 -50
- package/rules/{typescript.jsonc → typescript.ts} +136 -136
- package/rules/{vitest.jsonc → vitest.ts} +89 -89
- package/types.ts +24 -0
- package/configs/javascript.jsonc +0 -4
- package/configs/node.jsonc +0 -4
- package/configs/playwright.jsonc +0 -4
- package/configs/react.jsonc +0 -4
- package/configs/storybook.jsonc +0 -4
- package/configs/styled-components.jsonc +0 -4
- package/configs/testing-library.jsonc +0 -4
- package/configs/typescript.jsonc +0 -4
- package/configs/vitest.jsonc +0 -4
- package/jsoncLoader.d.mts +0 -10
- package/jsoncLoader.mjs +0 -27
- package/rules/styled-components.jsonc +0 -153
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { RuleFile } from '../types.ts';
|
|
2
|
+
|
|
3
|
+
// All storybook rules loaded via jsPlugins (no native oxlint support).
|
|
4
|
+
export const storybookRules = {
|
|
5
|
+
jsPlugins: ['eslint-plugin-storybook'],
|
|
6
|
+
rules: {
|
|
7
7
|
// Interactions should be awaited
|
|
8
8
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/await-interactions.md
|
|
9
|
-
|
|
9
|
+
'eslint-plugin-storybook/await-interactions': 'error',
|
|
10
10
|
|
|
11
11
|
// Pass a context when invoking play function of another story
|
|
12
12
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/context-in-play-function.md
|
|
13
|
-
|
|
13
|
+
'eslint-plugin-storybook/context-in-play-function': 'error',
|
|
14
14
|
|
|
15
15
|
// The component property should be set
|
|
16
16
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/csf-component.md
|
|
17
|
-
|
|
17
|
+
'eslint-plugin-storybook/csf-component': 'error',
|
|
18
18
|
|
|
19
19
|
// Story files should have a default export
|
|
20
20
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/default-exports.md
|
|
21
|
-
|
|
21
|
+
'eslint-plugin-storybook/default-exports': 'error',
|
|
22
22
|
|
|
23
23
|
// Deprecated hierarchy separator in title property
|
|
24
24
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/hierarchy-separator.md
|
|
25
|
-
|
|
25
|
+
'eslint-plugin-storybook/hierarchy-separator': 'error',
|
|
26
26
|
|
|
27
27
|
// Meta should only have inline properties
|
|
28
28
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/meta-inline-properties.md
|
|
29
|
-
|
|
29
|
+
'eslint-plugin-storybook/meta-inline-properties': 'error',
|
|
30
30
|
|
|
31
31
|
// Meta should use satisfies operator for type safety
|
|
32
32
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/meta-satisfies-type.md
|
|
33
|
-
|
|
33
|
+
'eslint-plugin-storybook/meta-satisfies-type': 'error',
|
|
34
34
|
|
|
35
35
|
// A story should not have a redundant name property
|
|
36
36
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-redundant-story-name.md
|
|
37
|
-
|
|
37
|
+
'eslint-plugin-storybook/no-redundant-story-name': 'error',
|
|
38
38
|
|
|
39
39
|
// storiesOf is deprecated and should not be used
|
|
40
40
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-stories-of.md
|
|
41
|
-
|
|
41
|
+
'eslint-plugin-storybook/no-stories-of': 'error',
|
|
42
42
|
|
|
43
43
|
// Do not step out of the Storybook renderer package
|
|
44
44
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-renderer-packages.md
|
|
45
|
-
|
|
45
|
+
'eslint-plugin-storybook/no-renderer-packages': 'error',
|
|
46
46
|
|
|
47
47
|
// No uninstalled addons
|
|
48
48
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-uninstalled-addons.md
|
|
49
|
-
|
|
49
|
+
'eslint-plugin-storybook/no-uninstalled-addons': 'error',
|
|
50
50
|
|
|
51
51
|
// Stories should use PascalCase
|
|
52
52
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/prefer-pascal-case.md
|
|
53
|
-
|
|
53
|
+
'eslint-plugin-storybook/prefer-pascal-case': 'error',
|
|
54
54
|
|
|
55
55
|
// A story file must contain at least one story export
|
|
56
56
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/story-exports.md
|
|
57
|
-
|
|
57
|
+
'eslint-plugin-storybook/story-exports': 'error',
|
|
58
58
|
|
|
59
59
|
// Use @storybook/expect instead of plain expect
|
|
60
60
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-expect.md
|
|
61
|
-
|
|
61
|
+
'eslint-plugin-storybook/use-storybook-expect': 'error',
|
|
62
62
|
|
|
63
63
|
// Use @storybook/testing-library instead of plain testing-library
|
|
64
64
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-testing-library.md
|
|
65
|
-
|
|
65
|
+
'eslint-plugin-storybook/use-storybook-testing-library': 'error',
|
|
66
66
|
},
|
|
67
|
-
}
|
|
67
|
+
} satisfies RuleFile;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { RuleFile } from '../types.ts';
|
|
2
|
+
|
|
3
|
+
// All styled-components-a11y rules loaded via jsPlugins (no native oxlint support).
|
|
4
|
+
export const styledComponentsRules = {
|
|
5
|
+
jsPlugins: ['eslint-plugin-styled-components-a11y'],
|
|
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
|
+
} satisfies RuleFile;
|
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { RuleFile } from '../types.ts';
|
|
2
|
+
|
|
3
|
+
// All testing-library + jest-dom rules loaded via jsPlugins (no native oxlint support).
|
|
4
|
+
export const testingLibraryRules = {
|
|
5
|
+
jsPlugins: ['eslint-plugin-testing-library', 'eslint-plugin-jest-dom'],
|
|
6
|
+
rules: {
|
|
7
7
|
// -- testing-library rules --
|
|
8
8
|
|
|
9
9
|
// Enforce async events to be awaited
|
|
10
10
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-events.md
|
|
11
|
-
|
|
11
|
+
'eslint-plugin-testing-library/await-async-events': 'error',
|
|
12
12
|
|
|
13
13
|
// Enforce async queries to be awaited
|
|
14
14
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-queries.md
|
|
15
|
-
|
|
15
|
+
'eslint-plugin-testing-library/await-async-queries': 'error',
|
|
16
16
|
|
|
17
17
|
// Enforce async utils to be awaited
|
|
18
18
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-utils.md
|
|
19
|
-
|
|
19
|
+
'eslint-plugin-testing-library/await-async-utils': 'error',
|
|
20
20
|
|
|
21
21
|
// Enforce consistent data-testid usage
|
|
22
22
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/consistent-data-testid.md
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{
|
|
23
|
+
'eslint-plugin-testing-library/consistent-data-testid': [
|
|
24
|
+
'error',
|
|
25
|
+
{ testIdPattern: '.*', testIdAttribute: ['data-testid'] },
|
|
26
26
|
],
|
|
27
27
|
|
|
28
28
|
// Disallow awaiting sync events
|
|
29
29
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-await-sync-events.md
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
30
|
+
'eslint-plugin-testing-library/no-await-sync-events': [
|
|
31
|
+
'error',
|
|
32
|
+
{ eventModules: ['fire-event'] },
|
|
33
33
|
],
|
|
34
34
|
|
|
35
35
|
// Disallow awaiting sync queries
|
|
36
36
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-await-sync-queries.md
|
|
37
|
-
|
|
37
|
+
'eslint-plugin-testing-library/no-await-sync-queries': 'error',
|
|
38
38
|
|
|
39
39
|
// Disallow the use of container methods
|
|
40
40
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-container.md
|
|
41
|
-
|
|
41
|
+
'eslint-plugin-testing-library/no-container': 'error',
|
|
42
42
|
|
|
43
43
|
// Disallow the use of debugging utilities
|
|
44
44
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-debugging-utils.md
|
|
45
|
-
|
|
45
|
+
'eslint-plugin-testing-library/no-debugging-utils': 'error',
|
|
46
46
|
|
|
47
47
|
// Disallow importing from DOM Testing Library
|
|
48
48
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-dom-import.md
|
|
49
|
-
|
|
49
|
+
'eslint-plugin-testing-library/no-dom-import': 'error',
|
|
50
50
|
|
|
51
51
|
// Disallow the use of the global RegExp flag in queries
|
|
52
52
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-global-regexp-flag-in-query.md
|
|
53
|
-
|
|
53
|
+
'eslint-plugin-testing-library/no-global-regexp-flag-in-query': 'error',
|
|
54
54
|
|
|
55
55
|
// Disallow the use of cleanup
|
|
56
56
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-manual-cleanup.md
|
|
57
|
-
|
|
57
|
+
'eslint-plugin-testing-library/no-manual-cleanup': 'error',
|
|
58
58
|
|
|
59
59
|
// Disallow direct Node access
|
|
60
60
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-node-access.md
|
|
61
|
-
|
|
61
|
+
'eslint-plugin-testing-library/no-node-access': 'error',
|
|
62
62
|
|
|
63
63
|
// Disallow the use of promises passed to a fireEvent method
|
|
64
64
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-promise-in-fire-event.md
|
|
65
|
-
|
|
65
|
+
'eslint-plugin-testing-library/no-promise-in-fire-event': 'error',
|
|
66
66
|
|
|
67
67
|
// Disallow the use of render in testing frameworks setup files
|
|
68
68
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-render-in-lifecycle.md
|
|
69
|
-
|
|
69
|
+
'eslint-plugin-testing-library/no-render-in-lifecycle': 'error',
|
|
70
70
|
|
|
71
71
|
// Disallow the use of data-testid queries
|
|
72
72
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-test-id-queries.md
|
|
73
|
-
|
|
73
|
+
'eslint-plugin-testing-library/no-test-id-queries': 'error',
|
|
74
74
|
|
|
75
75
|
// Disallow unnecessary act wrapping
|
|
76
76
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-unnecessary-act.md
|
|
77
|
-
|
|
77
|
+
'eslint-plugin-testing-library/no-unnecessary-act': 'error',
|
|
78
78
|
|
|
79
79
|
// Disallow the use of multiple expect inside waitFor
|
|
80
80
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-multiple-assertions.md
|
|
81
|
-
|
|
81
|
+
'eslint-plugin-testing-library/no-wait-for-multiple-assertions': 'error',
|
|
82
82
|
|
|
83
83
|
// Disallow the use of side effects in waitFor
|
|
84
84
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-side-effects.md
|
|
85
|
-
|
|
85
|
+
'eslint-plugin-testing-library/no-wait-for-side-effects': 'error',
|
|
86
86
|
|
|
87
87
|
// Disallow the use of snapshot inside waitFor
|
|
88
88
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-snapshot.md
|
|
89
|
-
|
|
89
|
+
'eslint-plugin-testing-library/no-wait-for-snapshot': 'error',
|
|
90
90
|
|
|
91
91
|
// Suggest using explicit assertions rather than standalone queries
|
|
92
92
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-explicit-assert.md
|
|
93
|
-
|
|
93
|
+
'eslint-plugin-testing-library/prefer-explicit-assert': 'error',
|
|
94
94
|
|
|
95
95
|
// Suggest using find* queries instead of waitFor + get* queries
|
|
96
96
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-find-by.md
|
|
97
|
-
|
|
97
|
+
'eslint-plugin-testing-library/prefer-find-by': 'error',
|
|
98
98
|
|
|
99
99
|
// Ensure appropriate get*/query* queries are used with their respective matchers
|
|
100
100
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-presence-queries.md
|
|
101
|
-
|
|
101
|
+
'eslint-plugin-testing-library/prefer-presence-queries': 'error',
|
|
102
102
|
|
|
103
103
|
// Suggest using queryBy* queries when waiting for disappearance
|
|
104
104
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-query-by-disappearance.md
|
|
105
|
-
|
|
105
|
+
'eslint-plugin-testing-library/prefer-query-by-disappearance': 'error',
|
|
106
106
|
|
|
107
107
|
// Ensure the configured get*/query* query is used with the corresponding matchers
|
|
108
108
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-query-matchers.md
|
|
109
|
-
|
|
109
|
+
'eslint-plugin-testing-library/prefer-query-matchers': 'error',
|
|
110
110
|
|
|
111
111
|
// Suggest using screen while querying
|
|
112
112
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md
|
|
113
|
-
|
|
113
|
+
'eslint-plugin-testing-library/prefer-screen-queries': 'error',
|
|
114
114
|
|
|
115
115
|
// Suggest using userEvent over fireEvent
|
|
116
116
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-user-event.md
|
|
117
|
-
|
|
117
|
+
'eslint-plugin-testing-library/prefer-user-event': 'error',
|
|
118
118
|
|
|
119
119
|
// Suggest using userEvent.setup
|
|
120
120
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-user-event-setup.md
|
|
121
|
-
|
|
121
|
+
'eslint-plugin-testing-library/prefer-user-event-setup': 'error',
|
|
122
122
|
|
|
123
123
|
// Enforce a valid naming for return value of render
|
|
124
124
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/render-result-naming-convention.md
|
|
125
|
-
|
|
125
|
+
'eslint-plugin-testing-library/render-result-naming-convention': 'error',
|
|
126
126
|
|
|
127
127
|
// -- jest-dom rules --
|
|
128
128
|
|
|
129
129
|
// Prefer toBeChecked over checking attributes
|
|
130
130
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-checked.md
|
|
131
|
-
|
|
131
|
+
'eslint-plugin-jest-dom/prefer-checked': 'error',
|
|
132
132
|
|
|
133
133
|
// Prefer toBeEmptyDOMElement over checking innerHTML
|
|
134
134
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-empty.md
|
|
135
|
-
|
|
135
|
+
'eslint-plugin-jest-dom/prefer-empty': 'error',
|
|
136
136
|
|
|
137
137
|
// Prefer toBeEnabled/toBeDisabled over checking attributes
|
|
138
138
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-enabled-disabled.md
|
|
139
|
-
|
|
139
|
+
'eslint-plugin-jest-dom/prefer-enabled-disabled': 'error',
|
|
140
140
|
|
|
141
141
|
// Prefer toHaveFocus over checking document.activeElement
|
|
142
142
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-focus.md
|
|
143
|
-
|
|
143
|
+
'eslint-plugin-jest-dom/prefer-focus': 'error',
|
|
144
144
|
|
|
145
145
|
// Prefer toBeInTheDocument over checking for null/truthy
|
|
146
146
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-in-document.md
|
|
147
|
-
|
|
147
|
+
'eslint-plugin-jest-dom/prefer-in-document': 'error',
|
|
148
148
|
|
|
149
149
|
// Prefer toBeRequired over checking attributes
|
|
150
150
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-required.md
|
|
151
|
-
|
|
151
|
+
'eslint-plugin-jest-dom/prefer-required': 'error',
|
|
152
152
|
|
|
153
153
|
// Prefer toHaveAttribute over checking getAttribute
|
|
154
154
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-attribute.md
|
|
155
|
-
|
|
155
|
+
'eslint-plugin-jest-dom/prefer-to-have-attribute': 'error',
|
|
156
156
|
|
|
157
157
|
// Prefer toHaveClass over checking className
|
|
158
158
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-class.md
|
|
159
|
-
|
|
159
|
+
'eslint-plugin-jest-dom/prefer-to-have-class': 'error',
|
|
160
160
|
|
|
161
161
|
// Prefer toHaveStyle over checking style attribute
|
|
162
162
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-style.md
|
|
163
|
-
|
|
163
|
+
'eslint-plugin-jest-dom/prefer-to-have-style': 'error',
|
|
164
164
|
|
|
165
165
|
// Prefer toHaveTextContent over checking textContent
|
|
166
166
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-text-content.md
|
|
167
|
-
|
|
167
|
+
'eslint-plugin-jest-dom/prefer-to-have-text-content': 'error',
|
|
168
168
|
|
|
169
169
|
// Prefer toHaveValue over checking value property
|
|
170
170
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-value.md
|
|
171
|
-
|
|
171
|
+
'eslint-plugin-jest-dom/prefer-to-have-value': 'error',
|
|
172
172
|
},
|
|
173
|
-
}
|
|
173
|
+
} satisfies RuleFile;
|