|
| 1 | +const vitestPlugin = require('@vitest/eslint-plugin'); |
1 | 2 | const restrictedSyntax = ['WithStatement', 'ForInStatement', 'LabeledStatement', 'SequenceExpression']; |
2 | 3 |
|
3 | 4 | module.exports = { |
@@ -37,15 +38,20 @@ module.exports = { |
37 | 38 | 'eslint-plugin-regexp', |
38 | 39 | 'eslint-plugin-sonarjs', |
39 | 40 | 'eslint-plugin-unicorn', |
40 | | - 'eslint-plugin-vitest', |
41 | | - 'eslint-plugin-vitest-globals', |
42 | 41 | 'eslint-plugin-wc', |
43 | 42 | ], |
44 | 43 | env: { |
45 | 44 | es2024: true, |
46 | 45 | node: true, |
47 | 46 | }, |
48 | 47 | overrides: [ |
| 48 | + { |
| 49 | + files: ['**/*.cjs'], |
| 50 | + rules: { |
| 51 | + 'import-x/no-commonjs': [0], |
| 52 | + '@typescript-eslint/no-require-imports': [0], |
| 53 | + }, |
| 54 | + }, |
49 | 55 | { |
50 | 56 | files: ['web_src/**/*'], |
51 | 57 | globals: { |
@@ -82,59 +88,58 @@ module.exports = { |
82 | 88 | }, |
83 | 89 | { |
84 | 90 | files: ['**/*.test.*', 'web_src/js/test/setup.ts'], |
85 | | - env: { |
86 | | - 'vitest-globals/env': true, |
87 | | - }, |
| 91 | + plugins: ['@vitest/eslint-plugin'], |
| 92 | + globals: vitestPlugin.environments.env.globals, |
88 | 93 | rules: { |
89 | | - 'vitest/consistent-test-filename': [0], |
90 | | - 'vitest/consistent-test-it': [0], |
91 | | - 'vitest/expect-expect': [0], |
92 | | - 'vitest/max-expects': [0], |
93 | | - 'vitest/max-nested-describe': [0], |
94 | | - 'vitest/no-alias-methods': [0], |
95 | | - 'vitest/no-commented-out-tests': [0], |
96 | | - 'vitest/no-conditional-expect': [0], |
97 | | - 'vitest/no-conditional-in-test': [0], |
98 | | - 'vitest/no-conditional-tests': [0], |
99 | | - 'vitest/no-disabled-tests': [0], |
100 | | - 'vitest/no-done-callback': [0], |
101 | | - 'vitest/no-duplicate-hooks': [0], |
102 | | - 'vitest/no-focused-tests': [0], |
103 | | - 'vitest/no-hooks': [0], |
104 | | - 'vitest/no-identical-title': [2], |
105 | | - 'vitest/no-interpolation-in-snapshots': [0], |
106 | | - 'vitest/no-large-snapshots': [0], |
107 | | - 'vitest/no-mocks-import': [0], |
108 | | - 'vitest/no-restricted-matchers': [0], |
109 | | - 'vitest/no-restricted-vi-methods': [0], |
110 | | - 'vitest/no-standalone-expect': [0], |
111 | | - 'vitest/no-test-prefixes': [0], |
112 | | - 'vitest/no-test-return-statement': [0], |
113 | | - 'vitest/prefer-called-with': [0], |
114 | | - 'vitest/prefer-comparison-matcher': [0], |
115 | | - 'vitest/prefer-each': [0], |
116 | | - 'vitest/prefer-equality-matcher': [0], |
117 | | - 'vitest/prefer-expect-resolves': [0], |
118 | | - 'vitest/prefer-hooks-in-order': [0], |
119 | | - 'vitest/prefer-hooks-on-top': [2], |
120 | | - 'vitest/prefer-lowercase-title': [0], |
121 | | - 'vitest/prefer-mock-promise-shorthand': [0], |
122 | | - 'vitest/prefer-snapshot-hint': [0], |
123 | | - 'vitest/prefer-spy-on': [0], |
124 | | - 'vitest/prefer-strict-equal': [0], |
125 | | - 'vitest/prefer-to-be': [0], |
126 | | - 'vitest/prefer-to-be-falsy': [0], |
127 | | - 'vitest/prefer-to-be-object': [0], |
128 | | - 'vitest/prefer-to-be-truthy': [0], |
129 | | - 'vitest/prefer-to-contain': [0], |
130 | | - 'vitest/prefer-to-have-length': [0], |
131 | | - 'vitest/prefer-todo': [0], |
132 | | - 'vitest/require-hook': [0], |
133 | | - 'vitest/require-to-throw-message': [0], |
134 | | - 'vitest/require-top-level-describe': [0], |
135 | | - 'vitest/valid-describe-callback': [2], |
136 | | - 'vitest/valid-expect': [2], |
137 | | - 'vitest/valid-title': [2], |
| 94 | + '@vitest/consistent-test-filename': [0], |
| 95 | + '@vitest/consistent-test-it': [0], |
| 96 | + '@vitest/expect-expect': [0], |
| 97 | + '@vitest/max-expects': [0], |
| 98 | + '@vitest/max-nested-describe': [0], |
| 99 | + '@vitest/no-alias-methods': [0], |
| 100 | + '@vitest/no-commented-out-tests': [0], |
| 101 | + '@vitest/no-conditional-expect': [0], |
| 102 | + '@vitest/no-conditional-in-test': [0], |
| 103 | + '@vitest/no-conditional-tests': [0], |
| 104 | + '@vitest/no-disabled-tests': [0], |
| 105 | + '@vitest/no-done-callback': [0], |
| 106 | + '@vitest/no-duplicate-hooks': [0], |
| 107 | + '@vitest/no-focused-tests': [0], |
| 108 | + '@vitest/no-hooks': [0], |
| 109 | + '@vitest/no-identical-title': [2], |
| 110 | + '@vitest/no-interpolation-in-snapshots': [0], |
| 111 | + '@vitest/no-large-snapshots': [0], |
| 112 | + '@vitest/no-mocks-import': [0], |
| 113 | + '@vitest/no-restricted-matchers': [0], |
| 114 | + '@vitest/no-restricted-vi-methods': [0], |
| 115 | + '@vitest/no-standalone-expect': [0], |
| 116 | + '@vitest/no-test-prefixes': [0], |
| 117 | + '@vitest/no-test-return-statement': [0], |
| 118 | + '@vitest/prefer-called-with': [0], |
| 119 | + '@vitest/prefer-comparison-matcher': [0], |
| 120 | + '@vitest/prefer-each': [0], |
| 121 | + '@vitest/prefer-equality-matcher': [0], |
| 122 | + '@vitest/prefer-expect-resolves': [0], |
| 123 | + '@vitest/prefer-hooks-in-order': [0], |
| 124 | + '@vitest/prefer-hooks-on-top': [2], |
| 125 | + '@vitest/prefer-lowercase-title': [0], |
| 126 | + '@vitest/prefer-mock-promise-shorthand': [0], |
| 127 | + '@vitest/prefer-snapshot-hint': [0], |
| 128 | + '@vitest/prefer-spy-on': [0], |
| 129 | + '@vitest/prefer-strict-equal': [0], |
| 130 | + '@vitest/prefer-to-be': [0], |
| 131 | + '@vitest/prefer-to-be-falsy': [0], |
| 132 | + '@vitest/prefer-to-be-object': [0], |
| 133 | + '@vitest/prefer-to-be-truthy': [0], |
| 134 | + '@vitest/prefer-to-contain': [0], |
| 135 | + '@vitest/prefer-to-have-length': [0], |
| 136 | + '@vitest/prefer-todo': [0], |
| 137 | + '@vitest/require-hook': [0], |
| 138 | + '@vitest/require-to-throw-message': [0], |
| 139 | + '@vitest/require-top-level-describe': [0], |
| 140 | + '@vitest/valid-describe-callback': [2], |
| 141 | + '@vitest/valid-expect': [2], |
| 142 | + '@vitest/valid-title': [2], |
138 | 143 | }, |
139 | 144 | }, |
140 | 145 | { |
@@ -163,7 +168,7 @@ module.exports = { |
163 | 168 | { |
164 | 169 | files: ['tests/e2e/**'], |
165 | 170 | plugins: [ |
166 | | - 'eslint-plugin-playwright' |
| 171 | + 'eslint-plugin-playwright', |
167 | 172 | ], |
168 | 173 | extends: [ |
169 | 174 | 'plugin:playwright/recommended', |
@@ -403,7 +408,7 @@ module.exports = { |
403 | 408 | 'github/a11y-svg-has-accessible-name': [0], |
404 | 409 | 'github/array-foreach': [0], |
405 | 410 | 'github/async-currenttarget': [2], |
406 | | - 'github/async-preventdefault': [2], |
| 411 | + 'github/async-preventdefault': [0], // https://github.com/github/eslint-plugin-github/issues/599 |
407 | 412 | 'github/authenticity-token': [0], |
408 | 413 | 'github/get-attribute': [0], |
409 | 414 | 'github/js-class-name': [0], |
@@ -674,7 +679,7 @@ module.exports = { |
674 | 679 | 'no-this-before-super': [2], |
675 | 680 | 'no-throw-literal': [2], |
676 | 681 | 'no-undef-init': [2], |
677 | | - 'no-undef': [0], |
| 682 | + 'no-undef': [2], // it is still needed by eslint & IDE to prompt undefined names in real time |
678 | 683 | 'no-undefined': [0], |
679 | 684 | 'no-underscore-dangle': [0], |
680 | 685 | 'no-unexpected-multiline': [2], |
|
0 commit comments