@wistia/oxlint-config 0.7.2 → 0.7.4
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 +4 -4
- package/package.json +1 -1
- package/rules/base.mjs +184 -0
- package/rules/import.mjs +48 -0
- package/rules/node.mjs +8 -0
- package/rules/react-a11y.mjs +8 -0
- package/rules/react.mjs +32 -0
- package/rules/typescript.mjs +32 -0
- package/rules/vitest.mjs +153 -150
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ yarn add -D @wistia/oxlint-config oxlint
|
|
|
19
19
|
|
|
20
20
|
Create an `oxlint.config.ts` in your project root:
|
|
21
21
|
|
|
22
|
-
**TypeScript project** (most common):
|
|
22
|
+
**TypeScript & React project** (most common):
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
import { defineConfig } from 'oxlint';
|
|
@@ -58,11 +58,11 @@ Feature configs wrap their rules in `overrides` with default file patterns, so t
|
|
|
58
58
|
| ------------------------ | ----------------------------------------- | ------------------------------------- |
|
|
59
59
|
| `reactConfig` | all files (global) | React component + accessibility rules |
|
|
60
60
|
| `styledComponentsConfig` | all files (global) | Styled Components accessibility rules |
|
|
61
|
-
| `vitestConfig` | `**/*.{test,spec,vitest}.{ts,tsx,js,jsx}` | Vitest testing rules |
|
|
62
|
-
| `testingLibraryConfig` | `**/*.{test,spec,vitest}.{ts,tsx,js,jsx}` | Testing Library + jest-dom rules |
|
|
63
|
-
| `storybookConfig` | `**/*.stories.{ts,tsx,js,jsx}` | Storybook story conventions |
|
|
64
61
|
| `nodeConfig` | `**/*.{mts,mjs,cjs}` | Node.js-specific rules |
|
|
62
|
+
| `vitestConfig` | `**/*.{test,vitest}.{ts,tsx,js,jsx}` | Vitest testing rules |
|
|
63
|
+
| `testingLibraryConfig` | `**/*.{test,vitest}.{ts,tsx,js,jsx}` | Testing Library + jest-dom rules |
|
|
65
64
|
| `playwrightConfig` | `**/*.spec.{ts,tsx,js}`, `**/e2e/**/*.ts` | Playwright E2E testing rules |
|
|
65
|
+
| `storybookConfig` | `**/*.stories.{ts,tsx,js,jsx}` | Storybook story conventions |
|
|
66
66
|
|
|
67
67
|
**Composing configs:**
|
|
68
68
|
|
package/package.json
CHANGED
package/rules/base.mjs
CHANGED
|
@@ -655,6 +655,138 @@ export const baseRules = {
|
|
|
655
655
|
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/yoda.html
|
|
656
656
|
'eslint/yoda': 'error',
|
|
657
657
|
|
|
658
|
+
// Enforce or disallow capitalization of the first letter of a comment
|
|
659
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/capitalized-comments.html
|
|
660
|
+
'eslint/capitalized-comments': 'off',
|
|
661
|
+
|
|
662
|
+
// Enforce a maximum cyclomatic complexity allowed in a program
|
|
663
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/complexity.html
|
|
664
|
+
'eslint/complexity': 'off',
|
|
665
|
+
|
|
666
|
+
// Require following curly brace conventions
|
|
667
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/curly.html
|
|
668
|
+
'eslint/curly': 'off',
|
|
669
|
+
|
|
670
|
+
// Require function names to match the name of the variable or property to which they are assigned
|
|
671
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/func-name-matching.html
|
|
672
|
+
'eslint/func-name-matching': 'off',
|
|
673
|
+
|
|
674
|
+
// Require or disallow initialization in variable declarations
|
|
675
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/init-declarations.html
|
|
676
|
+
'eslint/init-declarations': 'off',
|
|
677
|
+
|
|
678
|
+
// Require or disallow logical assignment operator shorthand
|
|
679
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/logical-assignment-operators.html
|
|
680
|
+
'eslint/logical-assignment-operators': 'off',
|
|
681
|
+
|
|
682
|
+
// Enforce a maximum depth that blocks can be nested
|
|
683
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-depth.html
|
|
684
|
+
'eslint/max-depth': 'off',
|
|
685
|
+
|
|
686
|
+
// Enforce a maximum number of lines per file
|
|
687
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-lines.html
|
|
688
|
+
'eslint/max-lines': 'off',
|
|
689
|
+
|
|
690
|
+
// Enforce a maximum number of lines of code in a function
|
|
691
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-lines-per-function.html
|
|
692
|
+
'eslint/max-lines-per-function': 'off',
|
|
693
|
+
|
|
694
|
+
// Enforce a maximum depth that callbacks can be nested
|
|
695
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-nested-callbacks.html
|
|
696
|
+
'eslint/max-nested-callbacks': 'off',
|
|
697
|
+
|
|
698
|
+
// Enforce a maximum number of parameters in function definitions
|
|
699
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-params.html
|
|
700
|
+
'eslint/max-params': 'off',
|
|
701
|
+
|
|
702
|
+
// Enforce a maximum number of statements allowed in function blocks
|
|
703
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-statements.html
|
|
704
|
+
'eslint/max-statements': 'off',
|
|
705
|
+
|
|
706
|
+
// Require regex literals to escape division operators
|
|
707
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-div-regex.html
|
|
708
|
+
'eslint/no-div-regex': 'off',
|
|
709
|
+
|
|
710
|
+
// Disallow duplicate module imports
|
|
711
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-duplicate-imports.html
|
|
712
|
+
'eslint/no-duplicate-imports': 'off',
|
|
713
|
+
|
|
714
|
+
// Disallow null comparisons without type-checking operators
|
|
715
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-eq-null.html
|
|
716
|
+
'eslint/no-eq-null': 'off',
|
|
717
|
+
|
|
718
|
+
// Disallow inline comments after code
|
|
719
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-inline-comments.html
|
|
720
|
+
'eslint/no-inline-comments': 'off',
|
|
721
|
+
|
|
722
|
+
// Disallow negated conditions
|
|
723
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-negated-condition.html
|
|
724
|
+
'eslint/no-negated-condition': 'off',
|
|
725
|
+
|
|
726
|
+
// Disallow specified names in exports
|
|
727
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-exports.html
|
|
728
|
+
'eslint/no-restricted-exports': 'off',
|
|
729
|
+
|
|
730
|
+
// Disallow certain properties on certain objects
|
|
731
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-properties.html
|
|
732
|
+
'eslint/no-restricted-properties': 'off',
|
|
733
|
+
|
|
734
|
+
// Disallow ternary operators
|
|
735
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-ternary.html
|
|
736
|
+
'eslint/no-ternary': 'off',
|
|
737
|
+
|
|
738
|
+
// Disallow the use of undeclared variables unless mentioned in global comments
|
|
739
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-undef.html
|
|
740
|
+
'eslint/no-undef': 'off',
|
|
741
|
+
|
|
742
|
+
// Disallow the use of undefined as an identifier
|
|
743
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-undefined.html
|
|
744
|
+
'eslint/no-undefined': 'off',
|
|
745
|
+
|
|
746
|
+
// Disallow dangling underscores in identifiers
|
|
747
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-underscore-dangle.html
|
|
748
|
+
'eslint/no-underscore-dangle': 'off',
|
|
749
|
+
|
|
750
|
+
// Disallow confusing multiline expressions
|
|
751
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unexpected-multiline.html
|
|
752
|
+
'eslint/no-unexpected-multiline': 'off',
|
|
753
|
+
|
|
754
|
+
// Disallow assignments that are never used
|
|
755
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-assignment.html
|
|
756
|
+
'eslint/no-useless-assignment': 'off',
|
|
757
|
+
|
|
758
|
+
// Disallow unnecessary calls to .call() and .apply()
|
|
759
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-call.html
|
|
760
|
+
'eslint/no-useless-call': 'off',
|
|
761
|
+
|
|
762
|
+
// Disallow specified warning terms in comments
|
|
763
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-warning-comments.html
|
|
764
|
+
'eslint/no-warning-comments': 'off',
|
|
765
|
+
|
|
766
|
+
// Require or disallow method and property shorthand syntax for object literals
|
|
767
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/object-shorthand.html
|
|
768
|
+
'eslint/object-shorthand': 'off',
|
|
769
|
+
|
|
770
|
+
// Disallow use of Object.create(null) in favor of using regex literals
|
|
771
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-regex-literals.html
|
|
772
|
+
'eslint/prefer-regex-literals': 'off',
|
|
773
|
+
|
|
774
|
+
// Enforce the use of u or v flag on regular expressions
|
|
775
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/require-unicode-regexp.html
|
|
776
|
+
'eslint/require-unicode-regexp': 'off',
|
|
777
|
+
|
|
778
|
+
// Enforce sorted import declarations within modules
|
|
779
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/sort-imports.html
|
|
780
|
+
'eslint/sort-imports': 'off',
|
|
781
|
+
|
|
782
|
+
// Require object keys to be sorted
|
|
783
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/sort-keys.html
|
|
784
|
+
'eslint/sort-keys': 'off',
|
|
785
|
+
|
|
786
|
+
// Require variables within the same declaration block to be sorted
|
|
787
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/sort-vars.html
|
|
788
|
+
'eslint/sort-vars': 'off',
|
|
789
|
+
|
|
658
790
|
//oxc rules - these are bug-catchers that oxlint can detect natively.
|
|
659
791
|
|
|
660
792
|
// Disallow calling array methods on arguments (it's array-like, not an array)
|
|
@@ -708,5 +840,57 @@ export const baseRules = {
|
|
|
708
840
|
// Disallow passing functions to array methods when signatures don't match
|
|
709
841
|
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/uninvoked-array-callback.html
|
|
710
842
|
'oxc/uninvoked-array-callback': 'error',
|
|
843
|
+
|
|
844
|
+
// Disallow use of approximate mathematical constants
|
|
845
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/approx-constant.html
|
|
846
|
+
'oxc/approx-constant': 'error',
|
|
847
|
+
|
|
848
|
+
// Disallow incorrect use of bitwise operators where logical operators were intended
|
|
849
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/bad-bitwise-operator.html
|
|
850
|
+
'oxc/bad-bitwise-operator': 'error',
|
|
851
|
+
|
|
852
|
+
// Disallow branches in if/else that share identical code
|
|
853
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/branches-sharing-code.html
|
|
854
|
+
'oxc/branches-sharing-code': 'off',
|
|
855
|
+
|
|
856
|
+
// Disallow misrefactored compound assignment operators
|
|
857
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/misrefactored-assign-op.html
|
|
858
|
+
'oxc/misrefactored-assign-op': 'error',
|
|
859
|
+
|
|
860
|
+
// Disallow spread in accumulator of Array.reduce (O(n^2) complexity)
|
|
861
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-accumulating-spread.html
|
|
862
|
+
'oxc/no-accumulating-spread': 'error',
|
|
863
|
+
|
|
864
|
+
// Disallow use of async/await syntax
|
|
865
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-async-await.html
|
|
866
|
+
'oxc/no-async-await': 'off',
|
|
867
|
+
|
|
868
|
+
// Disallow use of async functions as Express endpoint handlers without error handling
|
|
869
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-async-endpoint-handlers.html
|
|
870
|
+
'oxc/no-async-endpoint-handlers': 'off',
|
|
871
|
+
|
|
872
|
+
// Disallow barrel files (index files that re-export from other modules)
|
|
873
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-barrel-file.html
|
|
874
|
+
'oxc/no-barrel-file': 'off',
|
|
875
|
+
|
|
876
|
+
// Disallow TypeScript const enums
|
|
877
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-const-enum.html
|
|
878
|
+
'oxc/no-const-enum': 'off',
|
|
879
|
+
|
|
880
|
+
// Disallow spreading keys from a map-like object into an object literal
|
|
881
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-map-spread.html
|
|
882
|
+
'oxc/no-map-spread': 'error',
|
|
883
|
+
|
|
884
|
+
// Disallow use of optional chaining
|
|
885
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-optional-chaining.html
|
|
886
|
+
'oxc/no-optional-chaining': 'off',
|
|
887
|
+
|
|
888
|
+
// Disallow use of rest and spread properties
|
|
889
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-rest-spread-properties.html
|
|
890
|
+
'oxc/no-rest-spread-properties': 'off',
|
|
891
|
+
|
|
892
|
+
// Disallow use of this in exported functions
|
|
893
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-this-in-exported-function.html
|
|
894
|
+
'oxc/no-this-in-exported-function': 'off',
|
|
711
895
|
},
|
|
712
896
|
};
|
package/rules/import.mjs
CHANGED
|
@@ -91,6 +91,54 @@ export const importRules = {
|
|
|
91
91
|
// https://oxc.rs/docs/guide/usage/linter/rules/import/extensions.html
|
|
92
92
|
'import/extensions': 'error',
|
|
93
93
|
|
|
94
|
+
// Enforce consistent type specifier style (inline vs top-level)
|
|
95
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/consistent-type-specifier-style.html
|
|
96
|
+
'import/consistent-type-specifier-style': 'off',
|
|
97
|
+
|
|
98
|
+
// Disallow invalid exports, e.g. multiple defaults
|
|
99
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/export.html
|
|
100
|
+
'import/export': 'off',
|
|
101
|
+
|
|
102
|
+
// Require exports to be placed at the end of the file
|
|
103
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/exports-last.html
|
|
104
|
+
'import/exports-last': 'off',
|
|
105
|
+
|
|
106
|
+
// Prefer named exports to be grouped together in a single export declaration
|
|
107
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/group-exports.html
|
|
108
|
+
'import/group-exports': 'off',
|
|
109
|
+
|
|
110
|
+
// Enforce a maximum number of dependencies per module
|
|
111
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/max-dependencies.html
|
|
112
|
+
'import/max-dependencies': 'off',
|
|
113
|
+
|
|
114
|
+
// Ensure named imports coupled with named exports
|
|
115
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/named.html
|
|
116
|
+
'import/named': 'off',
|
|
117
|
+
|
|
118
|
+
// Forbid named exports
|
|
119
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/no-named-export.html
|
|
120
|
+
'import/no-named-export': 'off',
|
|
121
|
+
|
|
122
|
+
// Disallow namespace (a.k.a. "wildcard" *) imports
|
|
123
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/no-namespace.html
|
|
124
|
+
'import/no-namespace': 'off',
|
|
125
|
+
|
|
126
|
+
// Disallow Node.js builtin modules
|
|
127
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/no-nodejs-modules.html
|
|
128
|
+
'import/no-nodejs-modules': 'off',
|
|
129
|
+
|
|
130
|
+
// Forbid importing modules from parent directories
|
|
131
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/no-relative-parent-imports.html
|
|
132
|
+
'import/no-relative-parent-imports': 'off',
|
|
133
|
+
|
|
134
|
+
// Forbid unassigned imports (side-effect imports)
|
|
135
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/no-unassigned-import.html
|
|
136
|
+
'import/no-unassigned-import': 'off',
|
|
137
|
+
|
|
138
|
+
// Report potentially ambiguous parse goal
|
|
139
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/import/unambiguous.html
|
|
140
|
+
'import/unambiguous': 'off',
|
|
141
|
+
|
|
94
142
|
// Require modules with a single export to use a default export
|
|
95
143
|
// https://oxc.rs/docs/guide/usage/linter/rules/import/prefer-default-export.html
|
|
96
144
|
// decision: conflicts with no-default-export, which is enabled
|
package/rules/node.mjs
CHANGED
|
@@ -20,6 +20,14 @@ export const nodeRules = {
|
|
|
20
20
|
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-path-concat.html
|
|
21
21
|
'node/no-path-concat': 'error',
|
|
22
22
|
|
|
23
|
+
// Disallow the use of process.env
|
|
24
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/no-process-env.html
|
|
25
|
+
'node/no-process-env': 'off',
|
|
26
|
+
|
|
27
|
+
// Require require() to be called in the top-level module scope
|
|
28
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/node/global-require.html
|
|
29
|
+
'node/global-require': 'off',
|
|
30
|
+
|
|
23
31
|
//eslint-plugin-n rules via jsPlugins
|
|
24
32
|
|
|
25
33
|
// Disallow deprecated APIs
|
package/rules/react-a11y.mjs
CHANGED
|
@@ -113,6 +113,14 @@ export const reactA11yRules = {
|
|
|
113
113
|
// https://oxc.rs/docs/guide/usage/linter/rules/jsx-a11y/tabindex-no-positive.html
|
|
114
114
|
'jsx_a11y/tabindex-no-positive': 'error',
|
|
115
115
|
|
|
116
|
+
// Elements with an interactive role and interaction handlers must be focusable
|
|
117
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/interactive-supports-focus.html
|
|
118
|
+
'jsx_a11y/interactive-supports-focus': 'error',
|
|
119
|
+
|
|
120
|
+
// WAI-ARIA roles should not be used to convert a non-interactive element to interactive
|
|
121
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/no-noninteractive-element-to-interactive-role.html
|
|
122
|
+
'jsx_a11y/no-noninteractive-element-to-interactive-role': 'error',
|
|
123
|
+
|
|
116
124
|
// Ensure interactive elements are not assigned non-interactive roles
|
|
117
125
|
// https://oxc.rs/docs/guide/usage/linter/rules/jsx-a11y/no-noninteractive-tabindex.html
|
|
118
126
|
'jsx_a11y/no-noninteractive-tabindex': [
|
package/rules/react.mjs
CHANGED
|
@@ -234,6 +234,38 @@ export const reactRules = {
|
|
|
234
234
|
// decision: stylistic choice best left for formatter
|
|
235
235
|
'react/jsx-handler-names': 'off',
|
|
236
236
|
|
|
237
|
+
// Forbid certain props on components
|
|
238
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/forbid-component-props.html
|
|
239
|
+
'react/forbid-component-props': 'off',
|
|
240
|
+
|
|
241
|
+
// Forbid certain props on DOM elements
|
|
242
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/forbid-dom-props.html
|
|
243
|
+
'react/forbid-dom-props': 'off',
|
|
244
|
+
|
|
245
|
+
// Forbid certain elements
|
|
246
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/forbid-elements.html
|
|
247
|
+
'react/forbid-elements': 'off',
|
|
248
|
+
|
|
249
|
+
// Enforce destructuring assignment of useState hook
|
|
250
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/hook-use-state.html
|
|
251
|
+
'react/hook-use-state': 'off',
|
|
252
|
+
|
|
253
|
+
// Disallow usage of setState in componentDidUpdate (deprecated lifecycle)
|
|
254
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-did-update-set-state.html
|
|
255
|
+
'react/no-did-update-set-state': 'off',
|
|
256
|
+
|
|
257
|
+
// Prefer function components over class components
|
|
258
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/prefer-function-component.html
|
|
259
|
+
'react/prefer-function-component': 'off',
|
|
260
|
+
|
|
261
|
+
// Disallow missing React when using JSX (not needed with modern React)
|
|
262
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/react-in-jsx-scope.html
|
|
263
|
+
'react/react-in-jsx-scope': 'off',
|
|
264
|
+
|
|
265
|
+
// Enforce state initialization in constructor
|
|
266
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/state-in-constructor.html
|
|
267
|
+
'react/state-in-constructor': 'off',
|
|
268
|
+
|
|
237
269
|
//rules via jsPlugins (@eslint-react/eslint-plugin)
|
|
238
270
|
|
|
239
271
|
// Validates usage of Error Boundaries instead of try/catch for child errors
|
package/rules/typescript.mjs
CHANGED
|
@@ -441,5 +441,37 @@ export const typescriptRules = {
|
|
|
441
441
|
// Enforce typing arguments in .catch() callbacks as unknown
|
|
442
442
|
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/use-unknown-in-catch-callback-variable.html
|
|
443
443
|
'typescript/use-unknown-in-catch-callback-variable': 'error',
|
|
444
|
+
|
|
445
|
+
// Disallow certain types (deprecated rule)
|
|
446
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/ban-types.html
|
|
447
|
+
'typescript/ban-types': 'off',
|
|
448
|
+
|
|
449
|
+
// Require explicit return types on functions and class methods
|
|
450
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/explicit-function-return-type.html
|
|
451
|
+
'typescript/explicit-function-return-type': 'off',
|
|
452
|
+
|
|
453
|
+
// Require explicit accessibility modifiers on class properties and methods
|
|
454
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/explicit-member-accessibility.html
|
|
455
|
+
'typescript/explicit-member-accessibility': 'off',
|
|
456
|
+
|
|
457
|
+
// Disallow empty interfaces (deprecated rule)
|
|
458
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-empty-interface.html
|
|
459
|
+
'typescript/no-empty-interface': 'off',
|
|
460
|
+
|
|
461
|
+
// Disallow require statements except in import statements (deprecated rule)
|
|
462
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-var-requires.html
|
|
463
|
+
'typescript/no-var-requires': 'off',
|
|
464
|
+
|
|
465
|
+
// Require function parameters to be typed as readonly
|
|
466
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/prefer-readonly-parameter-types.html
|
|
467
|
+
'typescript/prefer-readonly-parameter-types': 'off',
|
|
468
|
+
|
|
469
|
+
// Enforce using @ts-expect-error over @ts-ignore (deprecated rule)
|
|
470
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/prefer-ts-expect-error.html
|
|
471
|
+
'typescript/prefer-ts-expect-error': 'off',
|
|
472
|
+
|
|
473
|
+
// Enforce void return type for functions that don't return a value
|
|
474
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/typescript/strict-void-return.html
|
|
475
|
+
'typescript/strict-void-return': 'off',
|
|
444
476
|
},
|
|
445
477
|
};
|
package/rules/vitest.mjs
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
//
|
|
2
|
-
// - "vitest/" for rules that are vitest-specific (no Jest equivalent)
|
|
3
|
-
// - "jest/" for rules that originated in eslint-plugin-jest and are shared with vitest
|
|
4
|
-
// Both namespaces are used here for VITEST projects only. Despite the "jest/" prefix,
|
|
5
|
-
// these rules apply to vitest code. This is an oxlint naming convention, not a dependency on Jest.
|
|
1
|
+
// Native oxlint vitest rules + jsPlugin rules from @vitest/eslint-plugin and eslint-plugin-no-only-tests
|
|
6
2
|
export const vitestRules = {
|
|
7
|
-
plugins: ['vitest'
|
|
3
|
+
plugins: ['vitest'],
|
|
8
4
|
jsPlugins: [
|
|
9
5
|
{ name: 'vitest-js', specifier: '@vitest/eslint-plugin' },
|
|
10
6
|
'eslint-plugin-no-only-tests',
|
|
@@ -40,7 +36,7 @@ export const vitestRules = {
|
|
|
40
36
|
|
|
41
37
|
// Prefer toHaveBeenCalledOnce() over toHaveBeenCalledTimes(1)
|
|
42
38
|
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-called-once.html
|
|
43
|
-
// decision: conflicts with prefer-called-times (
|
|
39
|
+
// decision: conflicts with prefer-called-times (vitest plugin), which is enabled
|
|
44
40
|
'vitest/prefer-called-once': 'off',
|
|
45
41
|
|
|
46
42
|
// Prefer toHaveBeenCalledTimes over multiple assertions
|
|
@@ -110,197 +106,200 @@ export const vitestRules = {
|
|
|
110
106
|
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-snapshot-hint.html
|
|
111
107
|
'vitest/prefer-snapshot-hint': 'error',
|
|
112
108
|
|
|
113
|
-
//
|
|
109
|
+
// Disallow importing vitest globals
|
|
110
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-importing-vitest-globals.html
|
|
111
|
+
// decision: prefer-importing-vitest-globals is already enabled, which serves opposite purpose
|
|
112
|
+
'vitest/no-importing-vitest-globals': 'off',
|
|
113
|
+
|
|
114
|
+
// Suggest using expect.assertions
|
|
115
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-expect-assertions.html
|
|
116
|
+
// decision: too strict for general use, matching vitest-js/prefer-expect-assertions
|
|
117
|
+
'vitest/prefer-expect-assertions': 'off',
|
|
118
|
+
|
|
119
|
+
// Prefer toHaveBeenCalledTimes over multiple assertions
|
|
120
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-have-been-called-times.html
|
|
121
|
+
'vitest/prefer-to-have-been-called-times': 'error',
|
|
122
|
+
|
|
123
|
+
// Require test timeout
|
|
124
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-test-timeout.html
|
|
125
|
+
// decision: too strict for general use, matching vitest-js/require-test-timeout
|
|
126
|
+
'vitest/require-test-timeout': 'off',
|
|
127
|
+
|
|
128
|
+
// Enforce valid expect in promise
|
|
129
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/valid-expect-in-promise.html
|
|
130
|
+
// decision: too strict for general use, matching vitest-js/valid-expect-in-promise
|
|
131
|
+
'vitest/valid-expect-in-promise': 'off',
|
|
114
132
|
|
|
115
133
|
// Prefer test or it but not both
|
|
116
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
117
|
-
'
|
|
134
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/consistent-test-it.html
|
|
135
|
+
'vitest/consistent-test-it': 'error',
|
|
118
136
|
|
|
119
137
|
// Enforce having expectation in test body
|
|
120
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
121
|
-
'
|
|
138
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/expect-expect.html
|
|
139
|
+
'vitest/expect-expect': 'error',
|
|
122
140
|
|
|
123
141
|
// Enforce a maximum number of expect per test
|
|
124
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
125
|
-
'
|
|
126
|
-
'error',
|
|
127
|
-
{
|
|
128
|
-
max: 15,
|
|
129
|
-
},
|
|
130
|
-
],
|
|
142
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/max-expects.html
|
|
143
|
+
'vitest/max-expects': ['error', { max: 15 }],
|
|
131
144
|
|
|
132
145
|
// Nested describe block should be less than set max value or default value
|
|
133
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
134
|
-
'
|
|
146
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/max-nested-describe.html
|
|
147
|
+
'vitest/max-nested-describe': 'error',
|
|
135
148
|
|
|
136
149
|
// Disallow alias methods
|
|
137
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
138
|
-
'
|
|
150
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-alias-methods.html
|
|
151
|
+
'vitest/no-alias-methods': 'error',
|
|
139
152
|
|
|
140
153
|
// Disallow commented out tests
|
|
141
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
142
|
-
'
|
|
154
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-commented-out-tests.html
|
|
155
|
+
'vitest/no-commented-out-tests': 'error',
|
|
143
156
|
|
|
144
157
|
// Disallow conditional expects
|
|
145
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
146
|
-
'
|
|
158
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-conditional-expect.html
|
|
159
|
+
'vitest/no-conditional-expect': 'error',
|
|
147
160
|
|
|
148
161
|
// Disallow disabled tests
|
|
149
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
162
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-disabled-tests.html
|
|
150
163
|
// decision: it is often useful to be allowed to add a .skip
|
|
151
|
-
'
|
|
164
|
+
'vitest/no-disabled-tests': 'off',
|
|
152
165
|
|
|
153
166
|
// Disallow duplicate hooks and teardown hooks
|
|
154
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
155
|
-
'
|
|
167
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-duplicate-hooks.html
|
|
168
|
+
'vitest/no-duplicate-hooks': 'error',
|
|
156
169
|
|
|
157
170
|
// Disallow focused tests
|
|
158
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
159
|
-
'
|
|
171
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-focused-tests.html
|
|
172
|
+
'vitest/no-focused-tests': 'error',
|
|
160
173
|
|
|
161
174
|
// Disallow setup and teardown hooks
|
|
162
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
163
|
-
'
|
|
175
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-hooks.html
|
|
176
|
+
'vitest/no-hooks': 'off',
|
|
164
177
|
|
|
165
178
|
// Disallow identical titles
|
|
166
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
167
|
-
'
|
|
179
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-identical-title.html
|
|
180
|
+
'vitest/no-identical-title': 'error',
|
|
168
181
|
|
|
169
182
|
// Disallow string interpolation in snapshots
|
|
170
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
171
|
-
'
|
|
183
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-interpolation-in-snapshots.html
|
|
184
|
+
'vitest/no-interpolation-in-snapshots': 'error',
|
|
172
185
|
|
|
173
186
|
// Disallow large snapshots
|
|
174
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
175
|
-
'
|
|
176
|
-
'error',
|
|
177
|
-
{
|
|
178
|
-
maxSize: 500,
|
|
179
|
-
},
|
|
180
|
-
],
|
|
187
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-large-snapshots.html
|
|
188
|
+
'vitest/no-large-snapshots': ['error', { maxSize: 500 }],
|
|
181
189
|
|
|
182
190
|
// Disallow importing from mocks directory
|
|
183
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
184
|
-
'
|
|
191
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-mocks-import.html
|
|
192
|
+
'vitest/no-mocks-import': 'error',
|
|
185
193
|
|
|
186
194
|
// Disallow the use of certain matchers
|
|
187
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
188
|
-
'
|
|
195
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-restricted-matchers.html
|
|
196
|
+
'vitest/no-restricted-matchers': 'error',
|
|
189
197
|
|
|
190
198
|
// Disallow using expect outside of it or test blocks
|
|
191
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
192
|
-
'
|
|
199
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-standalone-expect.html
|
|
200
|
+
'vitest/no-standalone-expect': 'error',
|
|
193
201
|
|
|
194
202
|
// Disallow using test as a prefix
|
|
195
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
196
|
-
'
|
|
203
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-test-prefixes.html
|
|
204
|
+
'vitest/no-test-prefixes': 'error',
|
|
197
205
|
|
|
198
206
|
// Disallow return statements in tests
|
|
199
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
200
|
-
'
|
|
207
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-test-return-statement.html
|
|
208
|
+
'vitest/no-test-return-statement': 'error',
|
|
201
209
|
|
|
202
210
|
// Disallow unnecessary async in expect functions
|
|
203
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
204
|
-
'
|
|
205
|
-
|
|
206
|
-
// Enforce padding around test blocks
|
|
207
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/jest/padding-around-test-blocks.html
|
|
208
|
-
'jest/padding-around-test-blocks': 'error',
|
|
211
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-unneeded-async-expect-function.html
|
|
212
|
+
'vitest/no-unneeded-async-expect-function': 'error',
|
|
209
213
|
|
|
210
214
|
// Suggest using toBeCalledWith() or toHaveBeenCalledWith()
|
|
211
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
212
|
-
'
|
|
215
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-called-with.html
|
|
216
|
+
'vitest/prefer-called-with': 'error',
|
|
213
217
|
|
|
214
218
|
// Suggest using the built-in comparison matchers
|
|
215
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
216
|
-
'
|
|
219
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-comparison-matcher.html
|
|
220
|
+
'vitest/prefer-comparison-matcher': 'error',
|
|
217
221
|
|
|
218
222
|
// Prefer each rather than manual loops
|
|
219
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
220
|
-
'
|
|
223
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-each.html
|
|
224
|
+
'vitest/prefer-each': 'error',
|
|
221
225
|
|
|
222
226
|
// Suggest using the built-in equality matchers
|
|
223
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
224
|
-
'
|
|
227
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-equality-matcher.html
|
|
228
|
+
'vitest/prefer-equality-matcher': 'error',
|
|
225
229
|
|
|
226
230
|
// Suggest using expect().resolves over expect(await ...) syntax
|
|
227
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
228
|
-
'
|
|
231
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-expect-resolves.html
|
|
232
|
+
'vitest/prefer-expect-resolves': 'error',
|
|
229
233
|
|
|
230
234
|
// Prefer having hooks in consistent order
|
|
231
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
232
|
-
'
|
|
235
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-hooks-in-order.html
|
|
236
|
+
'vitest/prefer-hooks-in-order': 'error',
|
|
233
237
|
|
|
234
238
|
// Suggest having hooks before any test cases
|
|
235
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
236
|
-
'
|
|
239
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-hooks-on-top.html
|
|
240
|
+
'vitest/prefer-hooks-on-top': 'error',
|
|
237
241
|
|
|
238
242
|
// Enforce lowercase titles
|
|
239
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
243
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-lowercase-title.html
|
|
240
244
|
'vitest/prefer-lowercase-title': 'off',
|
|
241
245
|
|
|
242
246
|
// Prefer mock resolved/rejected shorthands for promises
|
|
243
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
244
|
-
'
|
|
247
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-mock-promise-shorthand.html
|
|
248
|
+
'vitest/prefer-mock-promise-shorthand': 'error',
|
|
245
249
|
|
|
246
250
|
// Prefer mock return shorthands
|
|
247
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
248
|
-
'
|
|
251
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-mock-return-shorthand.html
|
|
252
|
+
'vitest/prefer-mock-return-shorthand': 'error',
|
|
249
253
|
|
|
250
254
|
// Suggest using vi.spyOn
|
|
251
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
252
|
-
'
|
|
255
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-spy-on.html
|
|
256
|
+
'vitest/prefer-spy-on': 'error',
|
|
253
257
|
|
|
254
258
|
// Prefer strict equal over equal
|
|
255
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
256
|
-
'
|
|
259
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-strict-equal.html
|
|
260
|
+
'vitest/prefer-strict-equal': 'error',
|
|
257
261
|
|
|
258
262
|
// Suggest using toBe()
|
|
259
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
260
|
-
'
|
|
263
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-be.html
|
|
264
|
+
'vitest/prefer-to-be': 'error',
|
|
261
265
|
|
|
262
266
|
// Prefer using toContain()
|
|
263
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
264
|
-
'
|
|
267
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-contain.html
|
|
268
|
+
'vitest/prefer-to-contain': 'error',
|
|
265
269
|
|
|
266
270
|
// Suggest using toHaveLength()
|
|
267
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
268
|
-
'
|
|
271
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-to-have-length.html
|
|
272
|
+
'vitest/prefer-to-have-length': 'error',
|
|
269
273
|
|
|
270
274
|
// Suggest using test.todo
|
|
271
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
272
|
-
'
|
|
275
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-todo.html
|
|
276
|
+
'vitest/prefer-todo': 'error',
|
|
273
277
|
|
|
274
278
|
// Require setup and teardown to be within a hook
|
|
275
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
276
|
-
'
|
|
279
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-hook.html
|
|
280
|
+
'vitest/require-hook': 'error',
|
|
277
281
|
|
|
278
282
|
// Require toThrow() to be called with an error message
|
|
279
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
280
|
-
'
|
|
283
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-to-throw-message.html
|
|
284
|
+
'vitest/require-to-throw-message': 'error',
|
|
281
285
|
|
|
282
286
|
// Enforce that all tests are in a top-level describe
|
|
283
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
284
|
-
'
|
|
287
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/require-top-level-describe.html
|
|
288
|
+
'vitest/require-top-level-describe': 'error',
|
|
285
289
|
|
|
286
290
|
// Enforce valid describe callback
|
|
287
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
288
|
-
'
|
|
291
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/valid-describe-callback.html
|
|
292
|
+
'vitest/valid-describe-callback': 'error',
|
|
289
293
|
|
|
290
294
|
// Enforce valid expect() usage
|
|
291
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/
|
|
292
|
-
'
|
|
295
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/valid-expect.html
|
|
296
|
+
'vitest/valid-expect': 'error',
|
|
293
297
|
|
|
294
|
-
// Enforce valid titles
|
|
298
|
+
// Enforce valid titles
|
|
295
299
|
// https://oxc.rs/docs/guide/usage/linter/rules/vitest/valid-title.html
|
|
296
300
|
// decision: `allowArguments` avoids conflict with `prefer-describe-function-title` rule, which is enabled
|
|
297
301
|
'vitest/valid-title': ['error', { allowArguments: true }],
|
|
298
302
|
|
|
299
|
-
// Enforce valid titles (jest-specific duplicate of vitest/valid-title)
|
|
300
|
-
// https://oxc.rs/docs/guide/usage/linter/rules/jest/valid-title.html
|
|
301
|
-
// decision: this is covered by `vitest/valid-title`
|
|
302
|
-
'jest/valid-title': 'off',
|
|
303
|
-
|
|
304
303
|
//rules via jsPlugins (@vitest/eslint-plugin + no-only-tests)
|
|
305
304
|
|
|
306
305
|
// Disallow .only tests
|
|
@@ -363,7 +362,7 @@ export const vitestRules = {
|
|
|
363
362
|
|
|
364
363
|
// Prefer test or it but not both
|
|
365
364
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
|
|
366
|
-
// decision: handled by native
|
|
365
|
+
// decision: handled by native vitest/consistent-test-it
|
|
367
366
|
'vitest-js/consistent-test-it': 'off',
|
|
368
367
|
|
|
369
368
|
// Enforce consistent usage of vi vs vitest
|
|
@@ -373,7 +372,7 @@ export const vitestRules = {
|
|
|
373
372
|
|
|
374
373
|
// Enforce having expectation in test body
|
|
375
374
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
|
|
376
|
-
// decision: handled by native
|
|
375
|
+
// decision: handled by native vitest/expect-expect
|
|
377
376
|
'vitest-js/expect-expect': 'off',
|
|
378
377
|
|
|
379
378
|
// Ensure hoisted APIs (vi.mock, vi.hoisted, etc.) are at the top
|
|
@@ -383,27 +382,27 @@ export const vitestRules = {
|
|
|
383
382
|
|
|
384
383
|
// Enforce a maximum number of expect per test
|
|
385
384
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
|
|
386
|
-
// decision: handled by native
|
|
385
|
+
// decision: handled by native vitest/max-expects
|
|
387
386
|
'vitest-js/max-expects': 'off',
|
|
388
387
|
|
|
389
388
|
// Nested describe block should be less than set max value or default value
|
|
390
389
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
|
|
391
|
-
// decision: handled by native
|
|
390
|
+
// decision: handled by native vitest/max-nested-describe
|
|
392
391
|
'vitest-js/max-nested-describe': 'off',
|
|
393
392
|
|
|
394
393
|
// Disallow alias methods
|
|
395
394
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
|
|
396
|
-
// decision: handled by native
|
|
395
|
+
// decision: handled by native vitest/no-alias-methods
|
|
397
396
|
'vitest-js/no-alias-methods': 'off',
|
|
398
397
|
|
|
399
398
|
// Disallow commented out tests
|
|
400
399
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
|
|
401
|
-
// decision: handled by native
|
|
400
|
+
// decision: handled by native vitest/no-commented-out-tests
|
|
402
401
|
'vitest-js/no-commented-out-tests': 'off',
|
|
403
402
|
|
|
404
403
|
// Disallow conditional expects
|
|
405
404
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
|
|
406
|
-
// decision: handled by native
|
|
405
|
+
// decision: handled by native vitest/no-conditional-expect
|
|
407
406
|
'vitest-js/no-conditional-expect': 'off',
|
|
408
407
|
|
|
409
408
|
// Disallow conditional tests
|
|
@@ -418,27 +417,31 @@ export const vitestRules = {
|
|
|
418
417
|
|
|
419
418
|
// Disallow disabled tests
|
|
420
419
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
|
|
421
|
-
// decision: handled by native
|
|
420
|
+
// decision: handled by native vitest/no-disabled-tests
|
|
422
421
|
'vitest-js/no-disabled-tests': 'off',
|
|
423
422
|
|
|
423
|
+
// Disallow done callbacks in tests
|
|
424
|
+
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-done-callback.md
|
|
425
|
+
'vitest-js/no-done-callback': 'error',
|
|
426
|
+
|
|
424
427
|
// Disallow duplicate hooks and teardown hooks
|
|
425
428
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
|
|
426
|
-
// decision: handled by native
|
|
429
|
+
// decision: handled by native vitest/no-duplicate-hooks
|
|
427
430
|
'vitest-js/no-duplicate-hooks': 'off',
|
|
428
431
|
|
|
429
432
|
// Disallow focused tests
|
|
430
433
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
|
|
431
|
-
// decision: handled by native
|
|
434
|
+
// decision: handled by native vitest/no-focused-tests
|
|
432
435
|
'vitest-js/no-focused-tests': 'off',
|
|
433
436
|
|
|
434
437
|
// Disallow setup and teardown hooks
|
|
435
438
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
|
436
|
-
// decision: handled by native
|
|
439
|
+
// decision: handled by native vitest/no-hooks
|
|
437
440
|
'vitest-js/no-hooks': 'off',
|
|
438
441
|
|
|
439
442
|
// Disallow identical titles
|
|
440
443
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
|
|
441
|
-
// decision: handled by native
|
|
444
|
+
// decision: handled by native vitest/no-identical-title
|
|
442
445
|
'vitest-js/no-identical-title': 'off',
|
|
443
446
|
|
|
444
447
|
// Disallow importing node:test
|
|
@@ -453,42 +456,42 @@ export const vitestRules = {
|
|
|
453
456
|
|
|
454
457
|
// Disallow string interpolation in snapshots
|
|
455
458
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
|
|
456
|
-
// decision: handled by native
|
|
459
|
+
// decision: handled by native vitest/no-interpolation-in-snapshots
|
|
457
460
|
'vitest-js/no-interpolation-in-snapshots': 'off',
|
|
458
461
|
|
|
459
462
|
// Disallow large snapshots
|
|
460
463
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
|
|
461
|
-
// decision: handled by native
|
|
464
|
+
// decision: handled by native vitest/no-large-snapshots
|
|
462
465
|
'vitest-js/no-large-snapshots': 'off',
|
|
463
466
|
|
|
464
467
|
// Disallow importing from mocks directory
|
|
465
468
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
|
|
466
|
-
// decision: handled by native
|
|
469
|
+
// decision: handled by native vitest/no-mocks-import
|
|
467
470
|
'vitest-js/no-mocks-import': 'off',
|
|
468
471
|
|
|
469
472
|
// Disallow the use of certain matchers
|
|
470
473
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
|
|
471
|
-
// decision: handled by native
|
|
474
|
+
// decision: handled by native vitest/no-restricted-matchers
|
|
472
475
|
'vitest-js/no-restricted-matchers': 'off',
|
|
473
476
|
|
|
474
477
|
// Disallow using expect outside of it or test blocks
|
|
475
478
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
|
|
476
|
-
// decision: handled by native
|
|
479
|
+
// decision: handled by native vitest/no-standalone-expect
|
|
477
480
|
'vitest-js/no-standalone-expect': 'off',
|
|
478
481
|
|
|
479
482
|
// Disallow using test as a prefix
|
|
480
483
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
|
|
481
|
-
// decision: handled by native
|
|
484
|
+
// decision: handled by native vitest/no-test-prefixes
|
|
482
485
|
'vitest-js/no-test-prefixes': 'off',
|
|
483
486
|
|
|
484
487
|
// Disallow return statements in tests
|
|
485
488
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
|
|
486
|
-
// decision: handled by native
|
|
489
|
+
// decision: handled by native vitest/no-test-return-statement
|
|
487
490
|
'vitest-js/no-test-return-statement': 'off',
|
|
488
491
|
|
|
489
492
|
// Disallow unnecessary async in expect functions
|
|
490
493
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-unneeded-async-expect-function.md
|
|
491
|
-
// decision: handled by native
|
|
494
|
+
// decision: handled by native vitest/no-unneeded-async-expect-function
|
|
492
495
|
'vitest-js/no-unneeded-async-expect-function': 'off',
|
|
493
496
|
|
|
494
497
|
// Enforce padding around all blocks
|
|
@@ -498,7 +501,7 @@ export const vitestRules = {
|
|
|
498
501
|
|
|
499
502
|
// Enforce padding around test blocks
|
|
500
503
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-test-blocks.md
|
|
501
|
-
// decision: handled by native
|
|
504
|
+
// decision: handled by native vitest/padding-around-test-blocks
|
|
502
505
|
'vitest-js/padding-around-test-blocks': 'off',
|
|
503
506
|
|
|
504
507
|
// Prefer toHaveBeenCalledOnce() over toHaveBeenCalledTimes(1)
|
|
@@ -513,12 +516,12 @@ export const vitestRules = {
|
|
|
513
516
|
|
|
514
517
|
// Suggest using toBeCalledWith() or toHaveBeenCalledWith()
|
|
515
518
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
|
|
516
|
-
// decision: handled by native
|
|
519
|
+
// decision: handled by native vitest/prefer-called-with
|
|
517
520
|
'vitest-js/prefer-called-with': 'off',
|
|
518
521
|
|
|
519
522
|
// Suggest using the built-in comparison matchers
|
|
520
523
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
|
|
521
|
-
// decision: handled by native
|
|
524
|
+
// decision: handled by native vitest/prefer-comparison-matcher
|
|
522
525
|
'vitest-js/prefer-comparison-matcher': 'off',
|
|
523
526
|
|
|
524
527
|
// Enforce describe titles to match function names
|
|
@@ -528,12 +531,12 @@ export const vitestRules = {
|
|
|
528
531
|
|
|
529
532
|
// Prefer each rather than manual loops
|
|
530
533
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
|
|
531
|
-
// decision: handled by native
|
|
534
|
+
// decision: handled by native vitest/prefer-each
|
|
532
535
|
'vitest-js/prefer-each': 'off',
|
|
533
536
|
|
|
534
537
|
// Suggest using the built-in equality matchers
|
|
535
538
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
|
|
536
|
-
// decision: handled by native
|
|
539
|
+
// decision: handled by native vitest/prefer-equality-matcher
|
|
537
540
|
'vitest-js/prefer-equality-matcher': 'off',
|
|
538
541
|
|
|
539
542
|
// Suggest using expect.assertions
|
|
@@ -543,7 +546,7 @@ export const vitestRules = {
|
|
|
543
546
|
|
|
544
547
|
// Suggest using expect().resolves over expect(await ...) syntax
|
|
545
548
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
|
|
546
|
-
// decision: handled by native
|
|
549
|
+
// decision: handled by native vitest/prefer-expect-resolves
|
|
547
550
|
'vitest-js/prefer-expect-resolves': 'off',
|
|
548
551
|
|
|
549
552
|
// Prefer expect.typeOf() usage
|
|
@@ -553,12 +556,12 @@ export const vitestRules = {
|
|
|
553
556
|
|
|
554
557
|
// Prefer having hooks in consistent order
|
|
555
558
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
|
|
556
|
-
// decision: handled by native
|
|
559
|
+
// decision: handled by native vitest/prefer-hooks-in-order
|
|
557
560
|
'vitest-js/prefer-hooks-in-order': 'off',
|
|
558
561
|
|
|
559
562
|
// Suggest having hooks before any test cases
|
|
560
563
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
|
|
561
|
-
// decision: handled by native
|
|
564
|
+
// decision: handled by native vitest/prefer-hooks-on-top
|
|
562
565
|
'vitest-js/prefer-hooks-on-top': 'off',
|
|
563
566
|
|
|
564
567
|
// Prefer vi.importActual/vi.importMock in vi.mock factories
|
|
@@ -573,12 +576,12 @@ export const vitestRules = {
|
|
|
573
576
|
|
|
574
577
|
// Prefer mock resolved/rejected shorthands for promises
|
|
575
578
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
|
|
576
|
-
// decision: handled by native
|
|
579
|
+
// decision: handled by native vitest/prefer-mock-promise-shorthand
|
|
577
580
|
'vitest-js/prefer-mock-promise-shorthand': 'off',
|
|
578
581
|
|
|
579
582
|
// Suggest using vi.spyOn
|
|
580
583
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
|
|
581
|
-
// decision: handled by native
|
|
584
|
+
// decision: handled by native vitest/prefer-spy-on
|
|
582
585
|
'vitest-js/prefer-spy-on': 'off',
|
|
583
586
|
|
|
584
587
|
// Prefer strict boolean matchers (toBe(true) over toBeTruthy())
|
|
@@ -588,12 +591,12 @@ export const vitestRules = {
|
|
|
588
591
|
|
|
589
592
|
// Prefer strict equal over equal
|
|
590
593
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
|
|
591
|
-
// decision: handled by native
|
|
594
|
+
// decision: handled by native vitest/prefer-strict-equal
|
|
592
595
|
'vitest-js/prefer-strict-equal': 'off',
|
|
593
596
|
|
|
594
597
|
// Suggest using toBe()
|
|
595
598
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
|
|
596
|
-
// decision: handled by native
|
|
599
|
+
// decision: handled by native vitest/prefer-to-be
|
|
597
600
|
'vitest-js/prefer-to-be': 'off',
|
|
598
601
|
|
|
599
602
|
// Suggest using toBeFalsy()
|
|
@@ -613,7 +616,7 @@ export const vitestRules = {
|
|
|
613
616
|
|
|
614
617
|
// Prefer using toContain()
|
|
615
618
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
|
|
616
|
-
// decision: handled by native
|
|
619
|
+
// decision: handled by native vitest/prefer-to-contain
|
|
617
620
|
'vitest-js/prefer-to-contain': 'off',
|
|
618
621
|
|
|
619
622
|
// Prefer toHaveBeenCalledTimes over multiple assertions
|
|
@@ -623,12 +626,12 @@ export const vitestRules = {
|
|
|
623
626
|
|
|
624
627
|
// Suggest using toHaveLength()
|
|
625
628
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
|
|
626
|
-
// decision: handled by native
|
|
629
|
+
// decision: handled by native vitest/prefer-to-have-length
|
|
627
630
|
'vitest-js/prefer-to-have-length': 'off',
|
|
628
631
|
|
|
629
632
|
// Suggest using test.todo
|
|
630
633
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
|
|
631
|
-
// decision: handled by native
|
|
634
|
+
// decision: handled by native vitest/prefer-todo
|
|
632
635
|
'vitest-js/prefer-todo': 'off',
|
|
633
636
|
|
|
634
637
|
// Prefer vi.mocked() over type casting
|
|
@@ -642,7 +645,7 @@ export const vitestRules = {
|
|
|
642
645
|
|
|
643
646
|
// Require setup and teardown to be within a hook
|
|
644
647
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
645
|
-
// decision: handled by native
|
|
648
|
+
// decision: handled by native vitest/require-hook
|
|
646
649
|
'vitest-js/require-hook': 'off',
|
|
647
650
|
|
|
648
651
|
// Require local Test Context for concurrent snapshot tests
|
|
@@ -662,12 +665,12 @@ export const vitestRules = {
|
|
|
662
665
|
|
|
663
666
|
// Require toThrow() to be called with an error message
|
|
664
667
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md
|
|
665
|
-
// decision: handled by native
|
|
668
|
+
// decision: handled by native vitest/require-to-throw-message
|
|
666
669
|
'vitest-js/require-to-throw-message': 'off',
|
|
667
670
|
|
|
668
671
|
// Enforce that all tests are in a top-level describe
|
|
669
672
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
|
670
|
-
// decision: handled by native
|
|
673
|
+
// decision: handled by native vitest/require-top-level-describe
|
|
671
674
|
'vitest-js/require-top-level-describe': 'off',
|
|
672
675
|
|
|
673
676
|
// Enforce unbound methods are called with their expected scope
|
|
@@ -677,12 +680,12 @@ export const vitestRules = {
|
|
|
677
680
|
|
|
678
681
|
// Enforce valid describe callback
|
|
679
682
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
|
|
680
|
-
// decision: handled by native
|
|
683
|
+
// decision: handled by native vitest/valid-describe-callback
|
|
681
684
|
'vitest-js/valid-describe-callback': 'off',
|
|
682
685
|
|
|
683
686
|
// Enforce valid expect() usage
|
|
684
687
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
|
|
685
|
-
// decision: handled by native
|
|
688
|
+
// decision: handled by native vitest/valid-expect
|
|
686
689
|
'vitest-js/valid-expect': 'off',
|
|
687
690
|
|
|
688
691
|
// Enforce valid expect in promise
|
|
@@ -692,7 +695,7 @@ export const vitestRules = {
|
|
|
692
695
|
|
|
693
696
|
// Enforce valid titles
|
|
694
697
|
// https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
|
695
|
-
// decision: handled by native
|
|
698
|
+
// decision: handled by native vitest/valid-title
|
|
696
699
|
'vitest-js/valid-title': 'off',
|
|
697
700
|
},
|
|
698
701
|
};
|