@wistia/eslint-config 1.0.1 → 1.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/CHANGELOG.md +12 -0
- package/package.json +4 -1
- package/src/configs/javascript.mjs +5 -1
- package/src/configs/playwright.mjs +19 -0
- package/src/configs/storybook.mjs +9 -0
- package/src/configs/typescript.mjs +5 -1
- package/src/rules/barrel-files.mjs +20 -0
- package/src/rules/playwright.mjs +216 -0
- package/src/rules/storybook.mjs +0 -10
- package/test/__snapshots__/javascript.mjs.snap +14 -1
- package/test/__snapshots__/playwright.mjs.snap +256 -0
- package/test/__snapshots__/typescript.mjs.snap +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @wistia/eslint-config
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#399](https://github.com/wistia/eslint-config/pull/399) [`14247d1`](https://github.com/wistia/eslint-config/commit/14247d13443a3d6ba4a2754feda887766ff573a5) Thanks [@okize](https://github.com/okize)! - feat: add rules & config for playwright
|
|
8
|
+
|
|
9
|
+
## 1.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#397](https://github.com/wistia/eslint-config/pull/397) [`92ddfaa`](https://github.com/wistia/eslint-config/commit/92ddfaaf2085586ddcee24fe98063f2c826d1f15) Thanks [@okize](https://github.com/okize)! - feat: add rules relating to barrel-file management
|
|
14
|
+
|
|
3
15
|
## 1.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"packageManager": "yarn@4.9.2",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"./javascript": "./src/configs/javascript.mjs",
|
|
15
15
|
"./jest": "./src/configs/jest.mjs",
|
|
16
16
|
"./node": "./src/configs/node.mjs",
|
|
17
|
+
"./playwright": "./src/configs/playwright.mjs",
|
|
17
18
|
"./react": "./src/configs/react.mjs",
|
|
18
19
|
"./react-ssr-compatibility": "./src/configs/react-ssr-compatibility.mjs",
|
|
19
20
|
"./storybook": "./src/configs/storybook.mjs",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"@typescript-eslint/parser": "^8.48.1",
|
|
48
49
|
"confusing-browser-globals": "^1.0.11",
|
|
49
50
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
51
|
+
"eslint-plugin-barrel-files": "^3.0.1",
|
|
50
52
|
"eslint-plugin-filenames": "^1.3.2",
|
|
51
53
|
"eslint-plugin-import": "^2.32.0",
|
|
52
54
|
"eslint-plugin-jest": "^29.2.1",
|
|
@@ -56,6 +58,7 @@
|
|
|
56
58
|
"eslint-plugin-n": "^17.23.1",
|
|
57
59
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
58
60
|
"eslint-plugin-no-typeof-window-undefined": "^0.0.2",
|
|
61
|
+
"eslint-plugin-playwright": "^2.4.0",
|
|
59
62
|
"eslint-plugin-prettier": "^5.5.4",
|
|
60
63
|
"eslint-plugin-promise": "^7.2.1",
|
|
61
64
|
"eslint-plugin-react": "^7.37.5",
|
|
@@ -5,6 +5,7 @@ import jsPlugin from '@eslint/js';
|
|
|
5
5
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
6
6
|
import filenamesPlugin from 'eslint-plugin-filenames';
|
|
7
7
|
import importPlugin from 'eslint-plugin-import';
|
|
8
|
+
import barrelFilesPlugin from 'eslint-plugin-barrel-files';
|
|
8
9
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
9
10
|
import promisePlugin from 'eslint-plugin-promise';
|
|
10
11
|
import baseRules from '../rules/base.mjs';
|
|
@@ -12,6 +13,7 @@ import stylisticRules from '../rules/stylistic.mjs';
|
|
|
12
13
|
import promiseRules from '../rules/promise.mjs';
|
|
13
14
|
import filenameRules from '../rules/filenames.mjs';
|
|
14
15
|
import importRules from '../rules/import.mjs';
|
|
16
|
+
import barrelFilesRules from '../rules/barrel-files.mjs';
|
|
15
17
|
|
|
16
18
|
export default [
|
|
17
19
|
{
|
|
@@ -33,16 +35,18 @@ export default [
|
|
|
33
35
|
'import/extensions': ['.js', '.jsx', '.mjs', '.cjs'],
|
|
34
36
|
},
|
|
35
37
|
plugins: {
|
|
36
|
-
js: jsPlugin,
|
|
37
38
|
'@stylistic': stylisticPlugin,
|
|
39
|
+
'barrel-files': barrelFilesPlugin,
|
|
38
40
|
filenames: fixupPluginRules(filenamesPlugin),
|
|
39
41
|
import: importPlugin,
|
|
42
|
+
js: jsPlugin,
|
|
40
43
|
prettier: prettierPlugin,
|
|
41
44
|
promise: promisePlugin,
|
|
42
45
|
},
|
|
43
46
|
rules: {
|
|
44
47
|
...baseRules,
|
|
45
48
|
...stylisticRules,
|
|
49
|
+
...barrelFilesRules,
|
|
46
50
|
...filenameRules,
|
|
47
51
|
...importRules,
|
|
48
52
|
...promiseRules,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import playwrightPlugin from 'eslint-plugin-playwright';
|
|
2
|
+
import playwrightRules from '../rules/playwright.mjs';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
languageOptions: {
|
|
7
|
+
globals: playwrightPlugin.configs['flat/recommended'].languageOptions.globals,
|
|
8
|
+
},
|
|
9
|
+
plugins: {
|
|
10
|
+
playwright: playwrightPlugin,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
...playwrightRules,
|
|
14
|
+
|
|
15
|
+
// see: https://github.com/mskelton/eslint-plugin-playwright/pull/26
|
|
16
|
+
'no-empty-pattern': 'off',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
@@ -13,6 +13,15 @@ export default [
|
|
|
13
13
|
},
|
|
14
14
|
rules: {
|
|
15
15
|
...storybookRules,
|
|
16
|
+
// storybook >7 requires default exports in stories
|
|
17
|
+
'import/no-anonymous-default-export': 'off',
|
|
18
|
+
'import/no-default-export': 'off',
|
|
19
|
+
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
|
20
|
+
'import/prefer-default-export': 'error',
|
|
21
|
+
|
|
22
|
+
// the default export is always called `meta` so the filenames
|
|
23
|
+
// will never match the exported name
|
|
24
|
+
'filenames/match-exported': 'off',
|
|
16
25
|
},
|
|
17
26
|
},
|
|
18
27
|
];
|
|
@@ -5,6 +5,7 @@ import { fixupPluginRules } from '@eslint/compat';
|
|
|
5
5
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
6
6
|
import filenamesPlugin from 'eslint-plugin-filenames';
|
|
7
7
|
import importPlugin from 'eslint-plugin-import';
|
|
8
|
+
import barrelFilesPlugin from 'eslint-plugin-barrel-files';
|
|
8
9
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
9
10
|
import promisePlugin from 'eslint-plugin-promise';
|
|
10
11
|
import baseRules from '../rules/base.mjs';
|
|
@@ -13,6 +14,7 @@ import promiseRules from '../rules/promise.mjs';
|
|
|
13
14
|
import filenameRules from '../rules/filenames.mjs';
|
|
14
15
|
import importRules from '../rules/import.mjs';
|
|
15
16
|
import typescriptRules from '../rules/typescript.mjs';
|
|
17
|
+
import barrelFilesRules from '../rules/barrel-files.mjs';
|
|
16
18
|
|
|
17
19
|
export default [
|
|
18
20
|
{
|
|
@@ -31,8 +33,9 @@ export default [
|
|
|
31
33
|
},
|
|
32
34
|
},
|
|
33
35
|
plugins: {
|
|
34
|
-
'@typescript-eslint': typescriptPlugin,
|
|
35
36
|
'@stylistic': stylisticPlugin,
|
|
37
|
+
'@typescript-eslint': typescriptPlugin,
|
|
38
|
+
'barrel-files': barrelFilesPlugin,
|
|
36
39
|
filenames: fixupPluginRules(filenamesPlugin),
|
|
37
40
|
import: importPlugin,
|
|
38
41
|
prettier: prettierPlugin,
|
|
@@ -67,6 +70,7 @@ export default [
|
|
|
67
70
|
rules: {
|
|
68
71
|
...baseRules,
|
|
69
72
|
...stylisticRules,
|
|
73
|
+
...barrelFilesRules,
|
|
70
74
|
...filenameRules,
|
|
71
75
|
...importRules,
|
|
72
76
|
...promiseRules,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// only add rules related to barrel files
|
|
2
|
+
// see: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7/
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
// Avoid barrel files
|
|
6
|
+
// https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-barrel-files.md
|
|
7
|
+
'barrel-files/avoid-barrel-files': 'off',
|
|
8
|
+
|
|
9
|
+
// Avoid importing barrel files
|
|
10
|
+
// https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-importing-barrel-files.md
|
|
11
|
+
'barrel-files/avoid-importing-barrel-files': 'off',
|
|
12
|
+
|
|
13
|
+
// Avoid namespace imports from barrel files
|
|
14
|
+
// https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-namespace-import.md
|
|
15
|
+
'barrel-files/avoid-namespace-import': 'off',
|
|
16
|
+
|
|
17
|
+
// Avoid re-export all from barrel files
|
|
18
|
+
// https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-re-export-all.md
|
|
19
|
+
'barrel-files/avoid-re-export-all': 'error',
|
|
20
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// Playwright-specific ESLint rules
|
|
2
|
+
// see: https://github.com/playwright-community/eslint-plugin-playwright#rules
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
// Prevent focused tests (.only)
|
|
6
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-focused-test.md
|
|
7
|
+
'playwright/no-focused-test': 'error',
|
|
8
|
+
|
|
9
|
+
// Enforce assertion to be made in a test body
|
|
10
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/expect-expect.md
|
|
11
|
+
'playwright/expect-expect': 'error',
|
|
12
|
+
|
|
13
|
+
// Enforce Playwright APIs to be awaited
|
|
14
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/missing-playwright-await.md
|
|
15
|
+
'playwright/missing-playwright-await': 'error',
|
|
16
|
+
|
|
17
|
+
// Enforces a maximum depth to nested describe calls
|
|
18
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/max-nested-describe.md
|
|
19
|
+
'playwright/max-nested-describe': 'error',
|
|
20
|
+
|
|
21
|
+
// Prevent calling `expect` conditionally
|
|
22
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-conditional-expect.md
|
|
23
|
+
'playwright/no-conditional-expect': 'error',
|
|
24
|
+
|
|
25
|
+
// Disallow conditional logic in tests
|
|
26
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-conditional-in-test.md
|
|
27
|
+
'playwright/no-conditional-in-test': 'error',
|
|
28
|
+
|
|
29
|
+
// Disallow commented out tests
|
|
30
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-commented-out-tests.md
|
|
31
|
+
'playwright/no-commented-out-tests': 'error',
|
|
32
|
+
|
|
33
|
+
// Disallow duplicate setup and teardown hooks
|
|
34
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-duplicate-hooks.md
|
|
35
|
+
'playwright/no-duplicate-hooks': 'error',
|
|
36
|
+
|
|
37
|
+
// Disallow usage of element handles (prefer locators)
|
|
38
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-element-handle.md
|
|
39
|
+
'playwright/no-element-handle': 'error',
|
|
40
|
+
|
|
41
|
+
// Disallow usage of `page.$eval()` and `page.$$eval()`
|
|
42
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-eval.md
|
|
43
|
+
'playwright/no-eval': 'error',
|
|
44
|
+
|
|
45
|
+
// Disallow usage of the `{ force: true }` option
|
|
46
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-force-option.md
|
|
47
|
+
'playwright/no-force-option': 'error',
|
|
48
|
+
|
|
49
|
+
// Disallow using `getByTitle()`
|
|
50
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-get-by-title.md
|
|
51
|
+
'playwright/no-get-by-title': 'error',
|
|
52
|
+
|
|
53
|
+
// Disallow setup and teardown hooks
|
|
54
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-hooks.md
|
|
55
|
+
// decision: hooks are useful for setup and teardown, similar to Jest configuration
|
|
56
|
+
'playwright/no-hooks': 'off',
|
|
57
|
+
|
|
58
|
+
// Disallow nested `test.step()` methods
|
|
59
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-nested-step.md
|
|
60
|
+
'playwright/no-nested-step': 'error',
|
|
61
|
+
|
|
62
|
+
// Disallow usage of the `networkidle` option
|
|
63
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-networkidle.md
|
|
64
|
+
'playwright/no-networkidle': 'error',
|
|
65
|
+
|
|
66
|
+
// Disallow using `page.pause()`
|
|
67
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-page-pause.md
|
|
68
|
+
'playwright/no-page-pause': 'error',
|
|
69
|
+
|
|
70
|
+
// Disallow using raw locators
|
|
71
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-raw-locators.md
|
|
72
|
+
'playwright/no-raw-locators': 'error',
|
|
73
|
+
|
|
74
|
+
// Disallow usage of the `.skip` annotation
|
|
75
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-skipped-test.md
|
|
76
|
+
// decision: it is often useful to be allowed to add a .skip, similar to Jest configuration
|
|
77
|
+
'playwright/no-skipped-test': 'off',
|
|
78
|
+
|
|
79
|
+
// Disallow using expect outside of `test` blocks
|
|
80
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-standalone-expect.md
|
|
81
|
+
'playwright/no-standalone-expect': 'error',
|
|
82
|
+
|
|
83
|
+
// Prevent unsafe variable references in `page.evaluate()`
|
|
84
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-unsafe-references.md
|
|
85
|
+
'playwright/no-unsafe-references': 'error',
|
|
86
|
+
|
|
87
|
+
// Disallow usage of page locators that are not used
|
|
88
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-unused-locators.md
|
|
89
|
+
'playwright/no-unused-locators': 'error',
|
|
90
|
+
|
|
91
|
+
// Disallow unnecessary `await`s for Playwright methods
|
|
92
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-useless-await.md
|
|
93
|
+
'playwright/no-useless-await': 'error',
|
|
94
|
+
|
|
95
|
+
// Disallow usage of `not` matchers when a specific matcher exists
|
|
96
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-useless-not.md
|
|
97
|
+
'playwright/no-useless-not': 'error',
|
|
98
|
+
|
|
99
|
+
// Disallow usage of `page.waitForNavigation()`
|
|
100
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-wait-for-navigation.md
|
|
101
|
+
'playwright/no-wait-for-navigation': 'error',
|
|
102
|
+
|
|
103
|
+
// Disallow usage of `page.waitForSelector()`
|
|
104
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-wait-for-selector.md
|
|
105
|
+
'playwright/no-wait-for-selector': 'error',
|
|
106
|
+
|
|
107
|
+
// Disallow usage of `page.waitForTimeout()`
|
|
108
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-wait-for-timeout.md
|
|
109
|
+
'playwright/no-wait-for-timeout': 'error',
|
|
110
|
+
|
|
111
|
+
// Suggest built-in locators over `page.locator()`
|
|
112
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-native-locators.md
|
|
113
|
+
'playwright/prefer-native-locators': 'error',
|
|
114
|
+
|
|
115
|
+
// Enforce lowercase test names
|
|
116
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
|
|
117
|
+
// decision: descriptions are often named after React components which are capitalized, similar to Jest
|
|
118
|
+
'playwright/prefer-lowercase-title': 'off',
|
|
119
|
+
|
|
120
|
+
// Suggest using web first assertions
|
|
121
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-web-first-assertions.md
|
|
122
|
+
'playwright/prefer-web-first-assertions': 'error',
|
|
123
|
+
|
|
124
|
+
// Require setup and teardown code to be within a hook
|
|
125
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/require-hook.md
|
|
126
|
+
'playwright/require-hook': 'error',
|
|
127
|
+
|
|
128
|
+
// Enforce valid `describe()` callback
|
|
129
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/valid-describe-callback.md
|
|
130
|
+
'playwright/valid-describe-callback': 'error',
|
|
131
|
+
|
|
132
|
+
// Enforce valid `expect()` usage
|
|
133
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/valid-expect.md
|
|
134
|
+
'playwright/valid-expect': 'error',
|
|
135
|
+
|
|
136
|
+
// Enforce valid titles
|
|
137
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/valid-title.md
|
|
138
|
+
'playwright/valid-title': 'error',
|
|
139
|
+
|
|
140
|
+
// Enforces a maximum number of expects in a test
|
|
141
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/max-expects.md
|
|
142
|
+
'playwright/max-expects': 'error',
|
|
143
|
+
|
|
144
|
+
// Enforce valid `expect()` usage in promises
|
|
145
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/valid-expect-in-promise.md
|
|
146
|
+
'playwright/valid-expect-in-promise': 'error',
|
|
147
|
+
|
|
148
|
+
// Require test cases and hooks to be inside a `describe` block
|
|
149
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/require-top-level-describe.md
|
|
150
|
+
'playwright/require-top-level-describe': 'error',
|
|
151
|
+
|
|
152
|
+
// Enforce valid test tags
|
|
153
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/valid-test-tags.md
|
|
154
|
+
'playwright/valid-test-tags': 'error',
|
|
155
|
+
|
|
156
|
+
// Disallow usage of the `.slow()` annotation
|
|
157
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-slowed-test.md
|
|
158
|
+
'playwright/no-slowed-test': 'error',
|
|
159
|
+
|
|
160
|
+
// Disallow usage of nth methods
|
|
161
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-nth-methods.md
|
|
162
|
+
'playwright/no-nth-methods': 'error',
|
|
163
|
+
|
|
164
|
+
// Disallow specific matchers
|
|
165
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-restricted-matchers.md
|
|
166
|
+
'playwright/no-restricted-matchers': 'off', // off by default, can be configured per project
|
|
167
|
+
|
|
168
|
+
// Suggest using comparison matchers
|
|
169
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-comparison-matcher.md
|
|
170
|
+
'playwright/prefer-comparison-matcher': 'error',
|
|
171
|
+
|
|
172
|
+
// Suggest using equality matchers
|
|
173
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-equality-matcher.md
|
|
174
|
+
'playwright/prefer-equality-matcher': 'error',
|
|
175
|
+
|
|
176
|
+
// Enforce hook ordering
|
|
177
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-hooks-in-order.md
|
|
178
|
+
'playwright/prefer-hooks-in-order': 'error',
|
|
179
|
+
|
|
180
|
+
// Enforce hooks to be at the top of tests
|
|
181
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-hooks-on-top.md
|
|
182
|
+
'playwright/prefer-hooks-on-top': 'error',
|
|
183
|
+
|
|
184
|
+
// Suggest using `locator()` over other locator methods
|
|
185
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-locator.md
|
|
186
|
+
'playwright/prefer-locator': 'error',
|
|
187
|
+
|
|
188
|
+
// Suggest using `toStrictEqual()` over `toEqual()`
|
|
189
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-strict-equal.md
|
|
190
|
+
'playwright/prefer-strict-equal': 'error',
|
|
191
|
+
|
|
192
|
+
// Suggest using `toBe()` for primitive literals
|
|
193
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-to-be.md
|
|
194
|
+
'playwright/prefer-to-be': 'error',
|
|
195
|
+
|
|
196
|
+
// Suggest using `toContain()`
|
|
197
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-to-contain.md
|
|
198
|
+
'playwright/prefer-to-contain': 'error',
|
|
199
|
+
|
|
200
|
+
// Suggest using `toHaveCount()`
|
|
201
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-to-have-count.md
|
|
202
|
+
'playwright/prefer-to-have-count': 'error',
|
|
203
|
+
|
|
204
|
+
// Suggest using `toHaveLength()`
|
|
205
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-to-have-length.md
|
|
206
|
+
'playwright/prefer-to-have-length': 'error',
|
|
207
|
+
|
|
208
|
+
// Require soft assertions
|
|
209
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/require-soft-assertions.md
|
|
210
|
+
// decision: off by default as it's project-specific
|
|
211
|
+
'playwright/require-soft-assertions': 'off',
|
|
212
|
+
|
|
213
|
+
// Require `toThrow()` to have a message
|
|
214
|
+
// https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/require-to-throw-message.md
|
|
215
|
+
'playwright/require-to-throw-message': 'error',
|
|
216
|
+
};
|
package/src/rules/storybook.mjs
CHANGED
|
@@ -2,16 +2,6 @@
|
|
|
2
2
|
// see: https://github.com/storybookjs/eslint-plugin-storybook#supported-rules-and-configurations
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
// storybook >7 requires default exports in stories
|
|
6
|
-
'import/no-anonymous-default-export': 'off',
|
|
7
|
-
'import/no-default-export': 'off',
|
|
8
|
-
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
|
9
|
-
'import/prefer-default-export': 'error',
|
|
10
|
-
|
|
11
|
-
// ...and the default export is always called `meta` so the filenames
|
|
12
|
-
// will never match the exported name
|
|
13
|
-
'filenames/match-exported': 'off',
|
|
14
|
-
|
|
15
5
|
// Interactions should be awaited
|
|
16
6
|
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/await-interactions.md
|
|
17
7
|
'storybook/await-interactions': 'error',
|
|
@@ -75,10 +75,11 @@
|
|
|
75
75
|
},
|
|
76
76
|
"plugins": [
|
|
77
77
|
"@",
|
|
78
|
-
"js:@eslint/js@9.39.1",
|
|
79
78
|
"@stylistic",
|
|
79
|
+
"barrel-files:eslint-plugin-barrel-files@3.0.1",
|
|
80
80
|
"filenames",
|
|
81
81
|
"import",
|
|
82
|
+
"js:@eslint/js@9.39.1",
|
|
82
83
|
"prettier:eslint-plugin-prettier@5.5.4",
|
|
83
84
|
"promise",
|
|
84
85
|
],
|
|
@@ -421,6 +422,18 @@
|
|
|
421
422
|
0,
|
|
422
423
|
"as-needed",
|
|
423
424
|
],
|
|
425
|
+
"barrel-files/avoid-barrel-files": [
|
|
426
|
+
0,
|
|
427
|
+
],
|
|
428
|
+
"barrel-files/avoid-importing-barrel-files": [
|
|
429
|
+
0,
|
|
430
|
+
],
|
|
431
|
+
"barrel-files/avoid-namespace-import": [
|
|
432
|
+
0,
|
|
433
|
+
],
|
|
434
|
+
"barrel-files/avoid-re-export-all": [
|
|
435
|
+
2,
|
|
436
|
+
],
|
|
424
437
|
"block-scoped-var": [
|
|
425
438
|
2,
|
|
426
439
|
],
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
{
|
|
2
|
+
"language": "@/js",
|
|
3
|
+
"languageOptions": {
|
|
4
|
+
"ecmaVersion": 2026,
|
|
5
|
+
"globals": {
|
|
6
|
+
"AbortController": false,
|
|
7
|
+
"AbortSignal": false,
|
|
8
|
+
"AsyncDisposableStack": false,
|
|
9
|
+
"Blob": false,
|
|
10
|
+
"BroadcastChannel": false,
|
|
11
|
+
"ByteLengthQueuingStrategy": false,
|
|
12
|
+
"CloseEvent": false,
|
|
13
|
+
"CompressionStream": false,
|
|
14
|
+
"CountQueuingStrategy": false,
|
|
15
|
+
"Crypto": false,
|
|
16
|
+
"CryptoKey": false,
|
|
17
|
+
"CustomEvent": false,
|
|
18
|
+
"DOMException": false,
|
|
19
|
+
"DecompressionStream": false,
|
|
20
|
+
"DisposableStack": false,
|
|
21
|
+
"ErrorEvent": false,
|
|
22
|
+
"Event": false,
|
|
23
|
+
"EventTarget": false,
|
|
24
|
+
"File": false,
|
|
25
|
+
"FormData": false,
|
|
26
|
+
"Headers": false,
|
|
27
|
+
"MessageChannel": false,
|
|
28
|
+
"MessageEvent": false,
|
|
29
|
+
"MessagePort": false,
|
|
30
|
+
"Navigator": false,
|
|
31
|
+
"Performance": false,
|
|
32
|
+
"PerformanceEntry": false,
|
|
33
|
+
"PerformanceMark": false,
|
|
34
|
+
"PerformanceMeasure": false,
|
|
35
|
+
"PerformanceObserver": false,
|
|
36
|
+
"PerformanceObserverEntryList": false,
|
|
37
|
+
"PerformanceResourceTiming": false,
|
|
38
|
+
"ReadableByteStreamController": false,
|
|
39
|
+
"ReadableStream": false,
|
|
40
|
+
"ReadableStreamBYOBReader": false,
|
|
41
|
+
"ReadableStreamBYOBRequest": false,
|
|
42
|
+
"ReadableStreamDefaultController": false,
|
|
43
|
+
"ReadableStreamDefaultReader": false,
|
|
44
|
+
"Request": false,
|
|
45
|
+
"Response": false,
|
|
46
|
+
"Storage": false,
|
|
47
|
+
"SubtleCrypto": false,
|
|
48
|
+
"SuppressedError": false,
|
|
49
|
+
"TextDecoder": false,
|
|
50
|
+
"TextDecoderStream": false,
|
|
51
|
+
"TextEncoder": false,
|
|
52
|
+
"TextEncoderStream": false,
|
|
53
|
+
"TransformStream": false,
|
|
54
|
+
"TransformStreamDefaultController": false,
|
|
55
|
+
"URL": false,
|
|
56
|
+
"URLPattern": false,
|
|
57
|
+
"URLSearchParams": false,
|
|
58
|
+
"WebAssembly": false,
|
|
59
|
+
"WebSocket": false,
|
|
60
|
+
"WritableStream": false,
|
|
61
|
+
"WritableStreamDefaultController": false,
|
|
62
|
+
"WritableStreamDefaultWriter": false,
|
|
63
|
+
"atob": false,
|
|
64
|
+
"btoa": false,
|
|
65
|
+
"clearInterval": false,
|
|
66
|
+
"clearTimeout": false,
|
|
67
|
+
"console": false,
|
|
68
|
+
"crypto": false,
|
|
69
|
+
"fetch": false,
|
|
70
|
+
"localStorage": false,
|
|
71
|
+
"navigator": false,
|
|
72
|
+
"performance": false,
|
|
73
|
+
"queueMicrotask": false,
|
|
74
|
+
"sessionStorage": false,
|
|
75
|
+
"setInterval": false,
|
|
76
|
+
"setTimeout": false,
|
|
77
|
+
"structuredClone": false,
|
|
78
|
+
},
|
|
79
|
+
"parser": "espree@10.4.0",
|
|
80
|
+
"parserOptions": {
|
|
81
|
+
"sourceType": "module",
|
|
82
|
+
},
|
|
83
|
+
"sourceType": "module",
|
|
84
|
+
},
|
|
85
|
+
"linterOptions": {
|
|
86
|
+
"reportUnusedDisableDirectives": 1,
|
|
87
|
+
},
|
|
88
|
+
"plugins": [
|
|
89
|
+
"@",
|
|
90
|
+
"playwright",
|
|
91
|
+
],
|
|
92
|
+
"rules": {
|
|
93
|
+
"no-empty-pattern": [
|
|
94
|
+
0,
|
|
95
|
+
{
|
|
96
|
+
"allowObjectPatternsAsParameters": false,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
"playwright/expect-expect": [
|
|
100
|
+
2,
|
|
101
|
+
],
|
|
102
|
+
"playwright/max-expects": [
|
|
103
|
+
2,
|
|
104
|
+
],
|
|
105
|
+
"playwright/max-nested-describe": [
|
|
106
|
+
2,
|
|
107
|
+
],
|
|
108
|
+
"playwright/missing-playwright-await": [
|
|
109
|
+
2,
|
|
110
|
+
],
|
|
111
|
+
"playwright/no-commented-out-tests": [
|
|
112
|
+
2,
|
|
113
|
+
],
|
|
114
|
+
"playwright/no-conditional-expect": [
|
|
115
|
+
2,
|
|
116
|
+
],
|
|
117
|
+
"playwright/no-conditional-in-test": [
|
|
118
|
+
2,
|
|
119
|
+
],
|
|
120
|
+
"playwright/no-duplicate-hooks": [
|
|
121
|
+
2,
|
|
122
|
+
],
|
|
123
|
+
"playwright/no-element-handle": [
|
|
124
|
+
2,
|
|
125
|
+
],
|
|
126
|
+
"playwright/no-eval": [
|
|
127
|
+
2,
|
|
128
|
+
],
|
|
129
|
+
"playwright/no-focused-test": [
|
|
130
|
+
2,
|
|
131
|
+
],
|
|
132
|
+
"playwright/no-force-option": [
|
|
133
|
+
2,
|
|
134
|
+
],
|
|
135
|
+
"playwright/no-get-by-title": [
|
|
136
|
+
2,
|
|
137
|
+
],
|
|
138
|
+
"playwright/no-hooks": [
|
|
139
|
+
0,
|
|
140
|
+
],
|
|
141
|
+
"playwright/no-nested-step": [
|
|
142
|
+
2,
|
|
143
|
+
],
|
|
144
|
+
"playwright/no-networkidle": [
|
|
145
|
+
2,
|
|
146
|
+
],
|
|
147
|
+
"playwright/no-nth-methods": [
|
|
148
|
+
2,
|
|
149
|
+
],
|
|
150
|
+
"playwright/no-page-pause": [
|
|
151
|
+
2,
|
|
152
|
+
],
|
|
153
|
+
"playwright/no-raw-locators": [
|
|
154
|
+
2,
|
|
155
|
+
],
|
|
156
|
+
"playwright/no-restricted-matchers": [
|
|
157
|
+
0,
|
|
158
|
+
],
|
|
159
|
+
"playwright/no-skipped-test": [
|
|
160
|
+
0,
|
|
161
|
+
],
|
|
162
|
+
"playwright/no-slowed-test": [
|
|
163
|
+
2,
|
|
164
|
+
],
|
|
165
|
+
"playwright/no-standalone-expect": [
|
|
166
|
+
2,
|
|
167
|
+
],
|
|
168
|
+
"playwright/no-unsafe-references": [
|
|
169
|
+
2,
|
|
170
|
+
],
|
|
171
|
+
"playwright/no-unused-locators": [
|
|
172
|
+
2,
|
|
173
|
+
],
|
|
174
|
+
"playwright/no-useless-await": [
|
|
175
|
+
2,
|
|
176
|
+
],
|
|
177
|
+
"playwright/no-useless-not": [
|
|
178
|
+
2,
|
|
179
|
+
],
|
|
180
|
+
"playwright/no-wait-for-navigation": [
|
|
181
|
+
2,
|
|
182
|
+
],
|
|
183
|
+
"playwright/no-wait-for-selector": [
|
|
184
|
+
2,
|
|
185
|
+
],
|
|
186
|
+
"playwright/no-wait-for-timeout": [
|
|
187
|
+
2,
|
|
188
|
+
],
|
|
189
|
+
"playwright/prefer-comparison-matcher": [
|
|
190
|
+
2,
|
|
191
|
+
],
|
|
192
|
+
"playwright/prefer-equality-matcher": [
|
|
193
|
+
2,
|
|
194
|
+
],
|
|
195
|
+
"playwright/prefer-hooks-in-order": [
|
|
196
|
+
2,
|
|
197
|
+
],
|
|
198
|
+
"playwright/prefer-hooks-on-top": [
|
|
199
|
+
2,
|
|
200
|
+
],
|
|
201
|
+
"playwright/prefer-locator": [
|
|
202
|
+
2,
|
|
203
|
+
],
|
|
204
|
+
"playwright/prefer-lowercase-title": [
|
|
205
|
+
0,
|
|
206
|
+
],
|
|
207
|
+
"playwright/prefer-native-locators": [
|
|
208
|
+
2,
|
|
209
|
+
],
|
|
210
|
+
"playwright/prefer-strict-equal": [
|
|
211
|
+
2,
|
|
212
|
+
],
|
|
213
|
+
"playwright/prefer-to-be": [
|
|
214
|
+
2,
|
|
215
|
+
],
|
|
216
|
+
"playwright/prefer-to-contain": [
|
|
217
|
+
2,
|
|
218
|
+
],
|
|
219
|
+
"playwright/prefer-to-have-count": [
|
|
220
|
+
2,
|
|
221
|
+
],
|
|
222
|
+
"playwright/prefer-to-have-length": [
|
|
223
|
+
2,
|
|
224
|
+
],
|
|
225
|
+
"playwright/prefer-web-first-assertions": [
|
|
226
|
+
2,
|
|
227
|
+
],
|
|
228
|
+
"playwright/require-hook": [
|
|
229
|
+
2,
|
|
230
|
+
],
|
|
231
|
+
"playwright/require-soft-assertions": [
|
|
232
|
+
0,
|
|
233
|
+
],
|
|
234
|
+
"playwright/require-to-throw-message": [
|
|
235
|
+
2,
|
|
236
|
+
],
|
|
237
|
+
"playwright/require-top-level-describe": [
|
|
238
|
+
2,
|
|
239
|
+
],
|
|
240
|
+
"playwright/valid-describe-callback": [
|
|
241
|
+
2,
|
|
242
|
+
],
|
|
243
|
+
"playwright/valid-expect": [
|
|
244
|
+
2,
|
|
245
|
+
],
|
|
246
|
+
"playwright/valid-expect-in-promise": [
|
|
247
|
+
2,
|
|
248
|
+
],
|
|
249
|
+
"playwright/valid-test-tags": [
|
|
250
|
+
2,
|
|
251
|
+
],
|
|
252
|
+
"playwright/valid-title": [
|
|
253
|
+
2,
|
|
254
|
+
],
|
|
255
|
+
},
|
|
256
|
+
}
|
|
@@ -77,8 +77,9 @@
|
|
|
77
77
|
},
|
|
78
78
|
"plugins": [
|
|
79
79
|
"@",
|
|
80
|
-
"@typescript-eslint:@typescript-eslint/eslint-plugin@8.48.1",
|
|
81
80
|
"@stylistic",
|
|
81
|
+
"@typescript-eslint:@typescript-eslint/eslint-plugin@8.48.1",
|
|
82
|
+
"barrel-files:eslint-plugin-barrel-files@3.0.1",
|
|
82
83
|
"filenames",
|
|
83
84
|
"import",
|
|
84
85
|
"prettier:eslint-plugin-prettier@5.5.4",
|
|
@@ -893,6 +894,18 @@
|
|
|
893
894
|
0,
|
|
894
895
|
"as-needed",
|
|
895
896
|
],
|
|
897
|
+
"barrel-files/avoid-barrel-files": [
|
|
898
|
+
0,
|
|
899
|
+
],
|
|
900
|
+
"barrel-files/avoid-importing-barrel-files": [
|
|
901
|
+
0,
|
|
902
|
+
],
|
|
903
|
+
"barrel-files/avoid-namespace-import": [
|
|
904
|
+
0,
|
|
905
|
+
],
|
|
906
|
+
"barrel-files/avoid-re-export-all": [
|
|
907
|
+
2,
|
|
908
|
+
],
|
|
896
909
|
"block-scoped-var": [
|
|
897
910
|
2,
|
|
898
911
|
],
|