eslint-config-typed 3.3.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -26
- package/dist/configs/plugins.d.mts +1 -1
- package/dist/configs/plugins.d.mts.map +1 -1
- package/dist/configs/plugins.mjs +8 -4
- package/dist/configs/plugins.mjs.map +1 -1
- package/dist/configs/typescript-without-rules.mjs +1 -0
- package/dist/configs/typescript-without-rules.mjs.map +1 -1
- package/dist/configs/typescript.d.mts.map +1 -1
- package/dist/configs/typescript.mjs +2 -0
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/configs/vitest.d.mts.map +1 -1
- package/dist/configs/vitest.mjs +2 -1
- package/dist/configs/vitest.mjs.map +1 -1
- package/dist/entry-point.mjs +1 -0
- package/dist/entry-point.mjs.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/index.d.mts +1 -0
- package/dist/plugins/index.d.mts.map +1 -1
- package/dist/plugins/index.mjs +1 -0
- package/dist/plugins/index.mjs.map +1 -1
- package/dist/plugins/vitest-coding-style/index.d.mts +2 -0
- package/dist/plugins/vitest-coding-style/index.d.mts.map +1 -0
- package/dist/plugins/vitest-coding-style/index.mjs +2 -0
- package/dist/plugins/vitest-coding-style/index.mjs.map +1 -0
- package/dist/plugins/vitest-coding-style/plugin.d.mts +3 -0
- package/dist/plugins/vitest-coding-style/plugin.d.mts.map +1 -0
- package/dist/plugins/vitest-coding-style/plugin.mjs +8 -0
- package/dist/plugins/vitest-coding-style/plugin.mjs.map +1 -0
- package/dist/plugins/vitest-coding-style/rules/index.d.mts +2 -0
- package/dist/plugins/vitest-coding-style/rules/index.d.mts.map +1 -0
- package/dist/plugins/vitest-coding-style/rules/index.mjs +2 -0
- package/dist/plugins/vitest-coding-style/rules/index.mjs.map +1 -0
- package/dist/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.d.mts +5 -0
- package/dist/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.d.mts.map +1 -0
- package/dist/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.mjs +103 -0
- package/dist/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.mjs.map +1 -0
- package/dist/plugins/vitest-coding-style/rules/rules.d.mts +4 -0
- package/dist/plugins/vitest-coding-style/rules/rules.d.mts.map +1 -0
- package/dist/plugins/vitest-coding-style/rules/rules.mjs +8 -0
- package/dist/plugins/vitest-coding-style/rules/rules.mjs.map +1 -0
- package/dist/rules/eslint-stylistic-rules.d.mts +99 -0
- package/dist/rules/eslint-stylistic-rules.d.mts.map +1 -0
- package/dist/rules/eslint-stylistic-rules.mjs +105 -0
- package/dist/rules/eslint-stylistic-rules.mjs.map +1 -0
- package/dist/rules/eslint-vitest-coding-style-rules.d.mts +4 -0
- package/dist/rules/eslint-vitest-coding-style-rules.d.mts.map +1 -0
- package/dist/rules/eslint-vitest-coding-style-rules.mjs +6 -0
- package/dist/rules/eslint-vitest-coding-style-rules.mjs.map +1 -0
- package/dist/rules/index.d.mts +2 -0
- package/dist/rules/index.d.mts.map +1 -1
- package/dist/rules/index.mjs +2 -0
- package/dist/rules/index.mjs.map +1 -1
- package/dist/types/define-known-rules.d.mts +2 -2
- package/dist/types/define-known-rules.d.mts.map +1 -1
- package/dist/types/define-known-rules.mjs.map +1 -1
- package/dist/types/rules/eslint-stylistic-rules.d.mts +8927 -0
- package/dist/types/rules/eslint-stylistic-rules.d.mts.map +1 -0
- package/dist/types/rules/eslint-stylistic-rules.mjs +2 -0
- package/dist/types/rules/eslint-stylistic-rules.mjs.map +1 -0
- package/dist/types/rules/eslint-vitest-coding-style-rules.d.mts +20 -0
- package/dist/types/rules/eslint-vitest-coding-style-rules.d.mts.map +1 -0
- package/dist/types/rules/eslint-vitest-coding-style-rules.mjs +2 -0
- package/dist/types/rules/eslint-vitest-coding-style-rules.mjs.map +1 -0
- package/dist/types/rules/index.d.mts +2 -0
- package/dist/types/rules/index.d.mts.map +1 -1
- package/package.json +2 -1
- package/src/configs/plugins.mts +15 -9
- package/src/configs/typescript-without-rules.mts +2 -0
- package/src/configs/typescript.mts +2 -0
- package/src/configs/vitest.mts +5 -2
- package/src/plugins/index.mts +1 -0
- package/src/plugins/vitest-coding-style/index.mts +1 -0
- package/src/plugins/vitest-coding-style/plugin.mts +6 -0
- package/src/plugins/vitest-coding-style/rules/index.mts +1 -0
- package/src/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.mts +160 -0
- package/src/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.test.mts +48 -0
- package/src/plugins/vitest-coding-style/rules/rules.mts +6 -0
- package/src/rules/eslint-stylistic-rules.mts +106 -0
- package/src/rules/eslint-vitest-coding-style-rules.mts +5 -0
- package/src/rules/index.mts +2 -0
- package/src/types/define-known-rules.mts +2 -0
- package/src/types/rules/eslint-stylistic-rules.mts +9882 -0
- package/src/types/rules/eslint-vitest-coding-style-rules.mts +21 -0
- package/src/types/rules/index.mts +2 -0
package/README.md
CHANGED
|
@@ -426,6 +426,7 @@ Add the following to `.vscode/settings.json` for proper ESLint integration:
|
|
|
426
426
|
## Included plugins
|
|
427
427
|
|
|
428
428
|
- @typescript-eslint/eslint-plugin
|
|
429
|
+
- @stylistic/eslint-plugin
|
|
429
430
|
- eslint-plugin-unicorn
|
|
430
431
|
- eslint-plugin-functional
|
|
431
432
|
- eslint-plugin-total-functions (Reimplemented in this repository to support flat config)
|
|
@@ -484,32 +485,33 @@ These functions return (arrays of) ESLint flat configuration(s):
|
|
|
484
485
|
|
|
485
486
|
Pre-configured rule sets that can be imported and customized:
|
|
486
487
|
|
|
487
|
-
| Rule set | Plugin name | Description
|
|
488
|
-
| :----------------------------------------- | :------------------------------------- |
|
|
489
|
-
| **`eslintRules`** | (eslint) | Core ESLint rules
|
|
490
|
-
| **`typescriptEslintRules`** | `@typescript-eslint/eslint-plugin` | TypeScript-specific ESLint rules
|
|
491
|
-
| **`eslintFunctionalRules`** | `eslint-plugin-functional` | Functional programming style rules
|
|
492
|
-
| **`eslintTotalFunctionsRules`** | `eslint-plugin-total-functions` | Functional programming style rules
|
|
493
|
-
| **`eslintUnicornRules`** | `eslint-plugin-unicorn` | Unicorn plugin rules for better code
|
|
494
|
-
| **`eslintArrayFuncRules`** | `eslint-plugin-array-func` | Array function preference rules
|
|
495
|
-
| **`eslintPreferArrowFunctionRules`** | `eslint-plugin-prefer-arrow-functions` | Arrow function preference rules
|
|
496
|
-
| **`eslintPluginSortDestructureKeysRules`** | `eslint-plugin-sort-destructure-keys` | Object destructuring rules
|
|
497
|
-
| **`eslintPromiseRules`** | `eslint-plugin-promise` | Promise handling rules
|
|
498
|
-
| **`eslintImportsRules`** | `eslint-plugin-import-x` | Import/export rules
|
|
499
|
-
| **`eslintSecurityRules`** | `eslint-plugin-security` | Security best practices
|
|
500
|
-
| **`eslintTreeShakableRules`** | `eslint-plugin-tree-shakable` | Tree-shaking optimization rules
|
|
501
|
-
| **`eslintReactRules`** | `eslint-plugin-react` | React-specific rules
|
|
502
|
-
| **`eslintReactHooksRules`** | `eslint-plugin-react-hooks` | React Hooks rules
|
|
503
|
-
| **`eslintReactPerfRules`** | `eslint-plugin-react-perf` | React performance optimization rules
|
|
504
|
-
| **`eslintReactRefreshRules`** | `eslint-plugin-react-refresh` | React Refresh (HMR) rules
|
|
505
|
-
| **`eslintReactCodingStyleRules`** | `eslint-plugin-react-coding-style` | Opinionated React component style rules
|
|
506
|
-
| **`
|
|
507
|
-
| **`
|
|
508
|
-
| **`
|
|
509
|
-
| **`
|
|
510
|
-
| **`
|
|
511
|
-
| **`
|
|
512
|
-
| **`
|
|
488
|
+
| Rule set | Plugin name | Description |
|
|
489
|
+
| :----------------------------------------- | :------------------------------------- | :----------------------------------------------------- |
|
|
490
|
+
| **`eslintRules`** | (eslint) | Core ESLint rules |
|
|
491
|
+
| **`typescriptEslintRules`** | `@typescript-eslint/eslint-plugin` | TypeScript-specific ESLint rules |
|
|
492
|
+
| **`eslintFunctionalRules`** | `eslint-plugin-functional` | Functional programming style rules |
|
|
493
|
+
| **`eslintTotalFunctionsRules`** | `eslint-plugin-total-functions` | Functional programming style rules |
|
|
494
|
+
| **`eslintUnicornRules`** | `eslint-plugin-unicorn` | Unicorn plugin rules for better code |
|
|
495
|
+
| **`eslintArrayFuncRules`** | `eslint-plugin-array-func` | Array function preference rules |
|
|
496
|
+
| **`eslintPreferArrowFunctionRules`** | `eslint-plugin-prefer-arrow-functions` | Arrow function preference rules |
|
|
497
|
+
| **`eslintPluginSortDestructureKeysRules`** | `eslint-plugin-sort-destructure-keys` | Object destructuring rules |
|
|
498
|
+
| **`eslintPromiseRules`** | `eslint-plugin-promise` | Promise handling rules |
|
|
499
|
+
| **`eslintImportsRules`** | `eslint-plugin-import-x` | Import/export rules |
|
|
500
|
+
| **`eslintSecurityRules`** | `eslint-plugin-security` | Security best practices |
|
|
501
|
+
| **`eslintTreeShakableRules`** | `eslint-plugin-tree-shakable` | Tree-shaking optimization rules |
|
|
502
|
+
| **`eslintReactRules`** | `eslint-plugin-react` | React-specific rules |
|
|
503
|
+
| **`eslintReactHooksRules`** | `eslint-plugin-react-hooks` | React Hooks rules |
|
|
504
|
+
| **`eslintReactPerfRules`** | `eslint-plugin-react-perf` | React performance optimization rules |
|
|
505
|
+
| **`eslintReactRefreshRules`** | `eslint-plugin-react-refresh` | React Refresh (HMR) rules |
|
|
506
|
+
| **`eslintReactCodingStyleRules`** | `eslint-plugin-react-coding-style` | Opinionated React component style rules |
|
|
507
|
+
| **`eslintStylisticRules`** | `@stylistic/eslint-plugin` | Stylistic formatting rules disabled to mirror Prettier |
|
|
508
|
+
| **`eslintJsxA11yRules`** | `eslint-plugin-jsx-a11y` | Accessibility rules for JSX |
|
|
509
|
+
| **`eslintVitestRules`** | `eslint-plugin-vitest` | Vitest-specific rules |
|
|
510
|
+
| **`eslintJestRules`** | `eslint-plugin-jest` | Jest-specific rules |
|
|
511
|
+
| **`eslintTestingLibraryRules`** | `eslint-plugin-testing-library` | Testing Library rules |
|
|
512
|
+
| **`eslintPlaywrightRules`** | `eslint-plugin-playwright` | Playwright-specific rules |
|
|
513
|
+
| **`eslintCypressRules`** | `eslint-plugin-cypress` | Cypress-specific rules |
|
|
514
|
+
| **`eslintPluginRules`** | `eslint-plugin-eslint-plugin` | eslint-plugin development rules |
|
|
513
515
|
|
|
514
516
|
### Exported Pre-configured Rule Options
|
|
515
517
|
|
|
@@ -598,6 +600,7 @@ Each plugin provides typed rule definitions:
|
|
|
598
600
|
- **`EslintUnicornRules`** & **`EslintUnicornRulesOption`**
|
|
599
601
|
- **`EslintArrayFuncRules`** (no options)
|
|
600
602
|
- **`EslintPreferArrowFunctionRules`** & **`EslintPreferArrowFunctionRulesOption`**
|
|
603
|
+
- **`EslintStylisticRules`** & **`EslintStylisticRulesOption`**
|
|
601
604
|
- **`EslintPluginSortDestructureKeysRules`** & **`EslintPluginSortDestructureKeysRulesOption`**
|
|
602
605
|
- **`EslintPromiseRules`** & **`EslintPromiseRulesOption`**
|
|
603
606
|
- **`EslintImportsRules`** & **`EslintImportsRulesOption`**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ESLintPlugin } from '../types/index.mjs';
|
|
2
|
-
export declare const plugins: Record<'@typescript-eslint' | 'array-func' | 'cypress' | 'playwright' | 'functional' | 'import-x' | 'jest' | 'vitest' | 'jsx-a11y' | 'prefer-arrow-functions' | 'promise' | 'react' | 'react-hooks' | 'react-refresh' | 'react-perf' | '
|
|
2
|
+
export declare const plugins: Record<'@typescript-eslint' | '@stylistic' | 'array-func' | 'cypress' | 'playwright' | 'functional' | 'import-x' | 'jest' | 'vitest' | 'jsx-a11y' | 'prefer-arrow-functions' | 'promise' | 'react' | 'react-hooks' | 'react-refresh' | 'react-perf' | 'security' | 'testing-library' | 'unicorn' | 'sort-destructure-keys' | 'eslint-plugin' | 'tree-shakable' | 'total-functions' | 'strict-dependencies' | 'custom' | 'react-coding-style' | 'vitest-coding-style', Omit<ESLintPlugin, 'configs'>>;
|
|
3
3
|
//# sourceMappingURL=plugins.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.mts","sourceRoot":"","sources":["../../src/configs/plugins.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.d.mts","sourceRoot":"","sources":["../../src/configs/plugins.mts"],"names":[],"mappings":"AA4DA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,OAAO,EAAE,MAAM,CACxB,oBAAoB,GACpB,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,MAAM,GACN,QAAQ,GACR,UAAU,GACV,wBAAwB,GACxB,SAAS,GACT,OAAO,GACP,aAAa,GACb,eAAe,GACf,YAAY,GACZ,UAAU,GACV,iBAAiB,GACjB,SAAS,GACT,uBAAuB,GACvB,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,qBAAqB,GACrB,QAAQ,GACR,oBAAoB,GACpB,qBAAqB,EACvB,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAoCW,CAAC"}
|
package/dist/configs/plugins.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
1
2
|
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
2
3
|
import eslintPluginArrayFunc from 'eslint-plugin-array-func';
|
|
3
4
|
import eslintPluginFunctional from 'eslint-plugin-functional';
|
|
@@ -23,10 +24,12 @@ import { eslintPluginReactCodingStyle } from '../plugins/react-coding-style/plug
|
|
|
23
24
|
import { eslintPluginStrictDependencies } from '../plugins/strict-dependencies/plugin.mjs';
|
|
24
25
|
import { eslintPluginTotalFunctions } from '../plugins/total-functions/plugin.mjs';
|
|
25
26
|
import { eslintPluginTreeShakable } from '../plugins/tree-shakable/plugin.mjs';
|
|
27
|
+
import { eslintPluginVitestCodingStyle } from '../plugins/vitest-coding-style/plugin.mjs';
|
|
26
28
|
|
|
27
29
|
/* eslint-disable import-x/no-rename-default */
|
|
28
30
|
const plugins = {
|
|
29
31
|
'@typescript-eslint': typescriptEslint,
|
|
32
|
+
'@stylistic': stylistic,
|
|
30
33
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
31
34
|
'array-func': eslintPluginArrayFunc,
|
|
32
35
|
cypress: eslintPluginCypress,
|
|
@@ -48,16 +51,17 @@ const plugins = {
|
|
|
48
51
|
'react-refresh': eslintPluginReactRefresh,
|
|
49
52
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
50
53
|
'react-perf': eslintPluginReactPerf,
|
|
51
|
-
'react-coding-style': eslintPluginReactCodingStyle,
|
|
52
54
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
53
55
|
security: eslintPluginSecurity,
|
|
54
|
-
'strict-dependencies': eslintPluginStrictDependencies,
|
|
55
56
|
'testing-library': eslintPluginTestingLibrary,
|
|
56
|
-
'total-functions': eslintPluginTotalFunctions,
|
|
57
57
|
unicorn: eslintPluginUnicorn,
|
|
58
|
-
'tree-shakable': eslintPluginTreeShakable,
|
|
59
58
|
'eslint-plugin': eslintPluginEslintPlugin,
|
|
59
|
+
'tree-shakable': eslintPluginTreeShakable,
|
|
60
|
+
'total-functions': eslintPluginTotalFunctions,
|
|
61
|
+
'strict-dependencies': eslintPluginStrictDependencies,
|
|
60
62
|
custom: eslintPluginCustom,
|
|
63
|
+
'react-coding-style': eslintPluginReactCodingStyle,
|
|
64
|
+
'vitest-coding-style': eslintPluginVitestCodingStyle,
|
|
61
65
|
};
|
|
62
66
|
|
|
63
67
|
export { plugins };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","sources":["../../src/configs/plugins.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.mjs","sources":["../../src/configs/plugins.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA8DO,MAAM,OAAO,GA6BhB;AACF,IAAA,oBAAoB,EAAE,gBAAgB;AACtC,IAAA,YAAY,EAAE,SAAS;;AAEvB,IAAA,YAAY,EAAE,qBAAqB;AACnC,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,UAAU,EAAE,sBAAsB;AAClC,IAAA,UAAU,EAAE,sBAAsB;;AAElC,IAAA,uBAAuB,EAAE,+BAA+B;AACxD,IAAA,UAAU,EAAE,kBAAkB;AAC9B,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,MAAM,EAAE,kBAAkB;;AAE1B,IAAA,UAAU,EAAE,mBAAmB;AAC/B,IAAA,wBAAwB,EAAE,gCAAgC;;AAE1D,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,KAAK,EAAE,iBAAiB;;AAExB,IAAA,aAAa,EAAE,sBAAiD;AAChE,IAAA,eAAe,EAAE,wBAAwB;;AAEzC,IAAA,YAAY,EAAE,qBAAqB;;AAEnC,IAAA,QAAQ,EAAE,oBAAoB;AAC9B,IAAA,iBAAiB,EAAE,0BAA0B;AAC7C,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,eAAe,EAAE,wBAAwB;AACzC,IAAA,eAAe,EAAE,wBAAwB;AACzC,IAAA,iBAAiB,EAAE,0BAA0B;AAC7C,IAAA,qBAAqB,EAAE,8BAA8B;AACrD,IAAA,MAAM,EAAE,kBAAkB;AAC1B,IAAA,oBAAoB,EAAE,4BAA4B;AAClD,IAAA,qBAAqB,EAAE,6BAA6B;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-without-rules.mjs","sources":["../../src/configs/typescript-without-rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKO,MAAM,qCAAqC,GAAG,CAAC,EACpD,gBAAgB,EAChB,eAAe,GAIf,KACA;AACE,IAAA;AACE,QAAA,OAAO,EAAE;YACP,0CAA0C;YAC1C,4CAA4C;YAC5C,4CAA4C;YAC5C,iBAAiB;YACjB,SAAS;YACT,UAAU;YACV,aAAa;AACd,SAAA;AACF,KAAA;AACD,IAAA;AACE,QAAA,eAAe,EAAE;AACf,YAAA,WAAW,EAAE,QAAQ;AACrB,YAAA,MAAM,EAAE,sBAAsB;AAC9B,YAAA,aAAa,EAAE;AACb,gBAAA,OAAO,EAAE,gBAAgB;gBACzB,eAAe;AACf,gBAAA,WAAW,EAAE,QAAQ;AACrB,gBAAA,YAAY,EAAE;AACZ,oBAAA,OAAO,EAAE,IAAI;AACb,oBAAA,aAAa,EAAE,IAAI;AACnB,oBAAA,GAAG,EAAE,IAAI;AACV,iBAAA;gBACD,SAAS,EAAE,IAAI;AACf,gBAAA,UAAU,EAAE,QAAQ;AACrB,aAAA;AACD,YAAA,OAAO,EAAE;gBACP,GAAG,OAAO,CAAC,MAAM;AAClB,aAAA;AACF,SAAA;AACD,QAAA,aAAa,EAAE;AACb,YAAA,cAAc,EAAE,KAAK;AACrB,YAAA,6BAA6B,EAAE,IAAI;AACpC,SAAA;QACD,OAAO;AACP,QAAA,QAAQ,EAAE;AACR,YAAA,GAAG,2BAA2B;AAC/B,SAAA;AACF,KAAA;;AAGL;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU;AAErE,MAAM,aAAa,GAAG;AACpB,IAAA,GAAG,oBAAoB;IACvB,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;CACE;AAEV;;;;;AAKG;AACH,MAAM,2BAA2B,GAAG;AAClC,IAAA,qBAAqB,EAAE,aAAa;AACpC,IAAA,kCAAkC,EAAE,CAAC,cAAc,EAAE,qBAAqB,CAAC;AAC3E,IAAA,kBAAkB,EAAE;AAClB,QAAA,2BAA2B,EAAE,oBAAoB;AAClD,KAAA;AACD,IAAA,mBAAmB,EAAE;AACnB,QAAA,UAAU,EAAE,IAAI;;;;;;;;;;;;;;;;;;;AAoBjB,KAAA;CACO;;;;"}
|
|
1
|
+
{"version":3,"file":"typescript-without-rules.mjs","sources":["../../src/configs/typescript-without-rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKO,MAAM,qCAAqC,GAAG,CAAC,EACpD,gBAAgB,EAChB,eAAe,GAIf,KACA;AACE,IAAA;AACE,QAAA,OAAO,EAAE;YACP,0CAA0C;YAC1C,4CAA4C;YAC5C,4CAA4C;YAC5C,iBAAiB;YACjB,SAAS;YACT,UAAU;YACV,aAAa;AACd,SAAA;AACF,KAAA;AACD,IAAA;AACE,QAAA,eAAe,EAAE;AACf,YAAA,WAAW,EAAE,QAAQ;AACrB,YAAA,MAAM,EAAE,sBAAsB;AAC9B,YAAA,aAAa,EAAE;AACb,gBAAA,OAAO,EAAE,gBAAgB;gBACzB,eAAe;AACf,gBAAA,WAAW,EAAE,QAAQ;AACrB,gBAAA,YAAY,EAAE;AACZ,oBAAA,OAAO,EAAE,IAAI;AACb,oBAAA,aAAa,EAAE,IAAI;AACnB,oBAAA,GAAG,EAAE,IAAI;AACV,iBAAA;gBACD,SAAS,EAAE,IAAI;AACf,gBAAA,UAAU,EAAE,QAAQ;AACrB,aAAA;AACD,YAAA,OAAO,EAAE;gBACP,GAAG,OAAO,CAAC,MAAM;AAClB,aAAA;AACF,SAAA;AACD,QAAA,aAAa,EAAE;AACb,YAAA,cAAc,EAAE,KAAK;AACrB,YAAA,6BAA6B,EAAE,IAAI;AACpC,SAAA;QACD,OAAO;AACP,QAAA,QAAQ,EAAE;AACR,YAAA,GAAG,2BAA2B;AAC/B,SAAA;AACF,KAAA;;AAGL;AACA;AACA;AACA,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU;AAErE,MAAM,aAAa,GAAG;AACpB,IAAA,GAAG,oBAAoB;IACvB,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;CACE;AAEV;AAEA;;;;;AAKG;AACH,MAAM,2BAA2B,GAAG;AAClC,IAAA,qBAAqB,EAAE,aAAa;AACpC,IAAA,kCAAkC,EAAE,CAAC,cAAc,EAAE,qBAAqB,CAAC;AAC3E,IAAA,kBAAkB,EAAE;AAClB,QAAA,2BAA2B,EAAE,oBAAoB;AAClD,KAAA;AACD,IAAA,mBAAmB,EAAE;AACnB,QAAA,UAAU,EAAE,IAAI;;;;;;;;;;;;;;;;;;;AAoBjB,KAAA;CACO;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.mts","sourceRoot":"","sources":["../../src/configs/typescript.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.mts","sourceRoot":"","sources":["../../src/configs/typescript.mts"],"names":[],"mappings":"AAeA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGvE,eAAO,MAAM,yBAAyB,GAAI,8EAMvC,QAAQ,CAAC;IACV,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC,KAAG,SAAS,UAAU,EAiFZ,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { eslintPreferArrowFunctionRules } from '../rules/eslint-prefer-arrow-fun
|
|
|
7
7
|
import { eslintPromiseRules } from '../rules/eslint-promise-rules.mjs';
|
|
8
8
|
import { eslintRules } from '../rules/eslint-rules.mjs';
|
|
9
9
|
import { eslintSecurityRules } from '../rules/eslint-security-rules.mjs';
|
|
10
|
+
import { eslintStylisticRules } from '../rules/eslint-stylistic-rules.mjs';
|
|
10
11
|
import { eslintTotalFunctionsRules } from '../rules/eslint-total-functions-rules.mjs';
|
|
11
12
|
import { eslintTreeShakableRules } from '../rules/eslint-tree-shakable-rules.mjs';
|
|
12
13
|
import { eslintUnicornRules } from '../rules/eslint-unicorn-rules.mjs';
|
|
@@ -28,6 +29,7 @@ const eslintConfigForTypeScript = ({ files, packageDirs, tsconfigFileName, tscon
|
|
|
28
29
|
...eslintImportsRules,
|
|
29
30
|
...eslintPromiseRules,
|
|
30
31
|
...eslintRules,
|
|
32
|
+
...eslintStylisticRules,
|
|
31
33
|
...eslintSecurityRules,
|
|
32
34
|
...eslintUnicornRules,
|
|
33
35
|
...typescriptEslintRules,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.mjs","sources":["../../src/configs/typescript.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.mjs","sources":["../../src/configs/typescript.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBO,MAAM,yBAAyB,GAAG,CAAC,EACxC,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GAOhB,KACA;AACE,IAAA,GAAG,qCAAqC,CAAC;QACvC,gBAAgB;QAChB,eAAe;KAChB,CAAC;AACF,IAAA;AACE,QAAA,KAAK,EAAE,KAAK,IAAI,CAAC,sCAAsC,CAAC;QACxD,KAAK,EAAE,gBAAgB,CAAC;AACtB,YAAA,GAAG,oBAAoB;AACvB,YAAA,GAAG,8BAA8B;AACjC,YAAA,GAAG,qBAAqB;AACxB,YAAA,GAAG,yBAAyB;AAC5B,YAAA,GAAG,kBAAkB;AACrB,YAAA,GAAG,kBAAkB;AACrB,YAAA,GAAG,WAAW;AACd,YAAA,GAAG,oBAAoB;AACvB,YAAA,GAAG,mBAAmB;AACtB,YAAA,GAAG,kBAAkB;AACrB,YAAA,GAAG,qBAAqB;AACxB,YAAA,GAAG,uBAAuB;AAC1B,YAAA,GAAG,oCAAoC;AAEvC,YAAA,yCAAyC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;AAExD,YAAA,qCAAqC,EAAE;gBACrC,OAAO;AACP,gBAAA;AACE,oBAAA,UAAU,EAAE,WAAW;AACxB,iBAAA;AACF,aAAA;YACD,IAAI,gBAAgB,KAAK;AACvB,kBAAE;AACE,oBAAA,iDAAiD,EAAE,KAAK;AACxD,oBAAA,2DAA2D,EACzD,KAAK;AACR;kBACD,EAAE,CAAC;SACR,CAAC;AACH,KAAA;AACD,IAAA;QACE,KAAK,EAAE,CAAC,uBAAuB,CAAC;QAChC,KAAK,EAAE,gBAAgB,CAAC;AACtB,YAAA,kDAAkD,EAAE,KAAK;AACzD,YAAA,8BAA8B,EAAE,KAAK;SACtC,CAAC;AACH,KAAA;AACD,IAAA;QACE,KAAK,EAAE,CAAC,qBAAqB,CAAC;QAC9B,KAAK,EAAE,gBAAgB,CAAC;AACtB,YAAA,2CAA2C,EAAE,KAAK;AAClD,YAAA,sBAAsB,EAAE,KAAK;SAC9B,CAAC;AACH,KAAA;AACD,IAAA;AACE,QAAA,KAAK,EAAE;;;;;;;;YASL,qCAAqC;YAErC,uCAAuC;YAEvC,4CAA4C;YAC5C,gDAAgD;YAChD,qCAAqC;AACtC,SAAA;QACD,KAAK,EAAE,gBAAgB,CAAC;AACtB,YAAA,0CAA0C,EAAE,KAAK;AACjD,YAAA,4BAA4B,EAAE,KAAK;AACnC,YAAA,sCAAsC,EAAE,KAAK;AAC7C,YAAA,8BAA8B,EAAE,KAAK;AACrC,YAAA,8BAA8B,EAAE,KAAK;AACrC,YAAA,oBAAoB,EAAE,KAAK;SAC5B,CAAC;AACH,KAAA;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.mts","sourceRoot":"","sources":["../../src/configs/vitest.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.d.mts","sourceRoot":"","sources":["../../src/configs/vitest.mts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvE,eAAO,MAAM,qBAAqB,GAAI,QAAQ,SAAS,MAAM,EAAE,KAAG,UAarD,CAAC"}
|
package/dist/configs/vitest.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineKnownRules } from '../types/define-known-rules.mjs';
|
|
2
2
|
import '../rules/eslint-rules.mjs';
|
|
3
|
+
import { eslintVitestCodingStyleRules } from '../rules/eslint-vitest-coding-style-rules.mjs';
|
|
3
4
|
import { eslintVitestRules } from '../rules/eslint-vitest-rules.mjs';
|
|
4
5
|
|
|
5
|
-
// import vitest from 'eslint-plugin-vitest';
|
|
6
6
|
const eslintConfigForVitest = (files) => ({
|
|
7
7
|
...(files === undefined ? {} : { files }),
|
|
8
8
|
languageOptions: {
|
|
@@ -13,6 +13,7 @@ const eslintConfigForVitest = (files) => ({
|
|
|
13
13
|
},
|
|
14
14
|
rules: defineKnownRules({
|
|
15
15
|
...eslintVitestRules,
|
|
16
|
+
...eslintVitestCodingStyleRules,
|
|
16
17
|
}),
|
|
17
18
|
});
|
|
18
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.mjs","sources":["../../src/configs/vitest.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.mjs","sources":["../../src/configs/vitest.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAMa,qBAAqB,GAAG,CAAC,KAAyB,MAC5D;AACC,IAAA,IAAI,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AACzC,IAAA,eAAe,EAAE;;AAEf,QAAA,OAAO,EAAE;;AAER,SAAA;AACF,KAAA;IACD,KAAK,EAAE,gBAAgB,CAAC;AACtB,QAAA,GAAG,iBAAiB;AACpB,QAAA,GAAG,4BAA4B;KAChC,CAAC;AACH,CAAA;;;;"}
|
package/dist/entry-point.mjs
CHANGED
|
@@ -45,4 +45,5 @@ import 'ts-data-forge';
|
|
|
45
45
|
import 'typescript';
|
|
46
46
|
export { eslintPluginTotalFunctions } from './plugins/total-functions/plugin.mjs';
|
|
47
47
|
export { eslintPluginTreeShakable } from './plugins/tree-shakable/plugin.mjs';
|
|
48
|
+
import '@typescript-eslint/utils';
|
|
48
49
|
//# sourceMappingURL=entry-point.mjs.map
|
package/dist/entry-point.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-point.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entry-point.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ export { eslintPluginReactCodingStyle } from './plugins/react-coding-style/plugi
|
|
|
16
16
|
export { eslintPluginStrictDependencies } from './plugins/strict-dependencies/plugin.mjs';
|
|
17
17
|
export { eslintPluginTotalFunctions } from './plugins/total-functions/plugin.mjs';
|
|
18
18
|
export { eslintPluginTreeShakable } from './plugins/tree-shakable/plugin.mjs';
|
|
19
|
+
export { eslintPluginVitestCodingStyle } from './plugins/vitest-coding-style/plugin.mjs';
|
|
19
20
|
export { allExtensionsRegexUnionStr, allExtensionsStr } from './rules/all-extensions.mjs';
|
|
20
21
|
export { eslintArrayFuncRules } from './rules/eslint-array-func-rules.mjs';
|
|
21
22
|
export { eslintCypressRules } from './rules/eslint-cypress-rules.mjs';
|
|
@@ -35,10 +36,12 @@ export { eslintReactRefreshRules } from './rules/eslint-react-refresh-rules.mjs'
|
|
|
35
36
|
export { eslintReactRules } from './rules/eslint-react-rules.mjs';
|
|
36
37
|
export { eslintRules, restrictedGlobals, restrictedGlobalsForBrowser, restrictedSyntax } from './rules/eslint-rules.mjs';
|
|
37
38
|
export { eslintSecurityRules } from './rules/eslint-security-rules.mjs';
|
|
39
|
+
export { eslintStylisticRules } from './rules/eslint-stylistic-rules.mjs';
|
|
38
40
|
export { eslintTestingLibraryRules } from './rules/eslint-testing-library-rules.mjs';
|
|
39
41
|
export { eslintTotalFunctionsRules } from './rules/eslint-total-functions-rules.mjs';
|
|
40
42
|
export { eslintTreeShakableRules } from './rules/eslint-tree-shakable-rules.mjs';
|
|
41
43
|
export { eslintUnicornRules } from './rules/eslint-unicorn-rules.mjs';
|
|
44
|
+
export { eslintVitestCodingStyleRules } from './rules/eslint-vitest-coding-style-rules.mjs';
|
|
42
45
|
export { eslintVitestRules } from './rules/eslint-vitest-rules.mjs';
|
|
43
46
|
export { typescriptEslintRules } from './rules/typescript-eslint-rules.mjs';
|
|
44
47
|
export { defineConfig } from './types/define-config.mjs';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -3,4 +3,5 @@ export * from './react-coding-style/index.mjs';
|
|
|
3
3
|
export * from './strict-dependencies/index.mjs';
|
|
4
4
|
export * from './total-functions/index.mjs';
|
|
5
5
|
export * from './tree-shakable/index.mjs';
|
|
6
|
+
export * from './vitest-coding-style/index.mjs';
|
|
6
7
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/plugins/index.mts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/plugins/index.mts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC"}
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -3,4 +3,5 @@ export { eslintPluginReactCodingStyle } from './react-coding-style/plugin.mjs';
|
|
|
3
3
|
export { eslintPluginStrictDependencies } from './strict-dependencies/plugin.mjs';
|
|
4
4
|
export { eslintPluginTotalFunctions } from './total-functions/plugin.mjs';
|
|
5
5
|
export { eslintPluginTreeShakable } from './tree-shakable/plugin.mjs';
|
|
6
|
+
export { eslintPluginVitestCodingStyle } from './vitest-coding-style/plugin.mjs';
|
|
6
7
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/plugins/vitest-coding-style/index.mts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../../../src/plugins/vitest-coding-style/plugin.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,eAAO,MAAM,6BAA6B,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAE9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.mjs","sources":["../../../src/plugins/vitest-coding-style/plugin.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGO,MAAM,6BAA6B,GAAkC;AAC1E,IAAA,KAAK,EAAE,sBAAsB;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/plugins/vitest-coding-style/rules/index.mts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-expect-to-strict-equal.d.mts","sourceRoot":"","sources":["../../../../src/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAGlC,KAAK,UAAU,GAAG,WAAW,CAAC;AAO9B,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAmErE,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { isRecord, hasKey } from 'ts-data-forge';
|
|
3
|
+
|
|
4
|
+
const noExpectToStrictEqualRule = {
|
|
5
|
+
meta: {
|
|
6
|
+
type: 'suggestion',
|
|
7
|
+
docs: {
|
|
8
|
+
description: 'Disallow `expect().toStrictEqual()` in favor of `assert.deepStrictEqual()`.',
|
|
9
|
+
},
|
|
10
|
+
fixable: 'code',
|
|
11
|
+
schema: [],
|
|
12
|
+
messages: {
|
|
13
|
+
useAssert: 'Use `assert.deepStrictEqual()` instead of `expect().toStrictEqual()`.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultOptions: [],
|
|
17
|
+
create: (context) => {
|
|
18
|
+
const sourceCode = context.sourceCode;
|
|
19
|
+
return {
|
|
20
|
+
CallExpression: (node) => {
|
|
21
|
+
if (!isToStrictEqualInvocation(node)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const expectCall = node.callee.object;
|
|
25
|
+
if (!isExpectCall(expectCall)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (expectCall.arguments.length !== 1 ||
|
|
29
|
+
node.arguments.length !== 1 ||
|
|
30
|
+
expectCall.arguments[0]?.type === AST_NODE_TYPES.SpreadElement ||
|
|
31
|
+
node.arguments[0]?.type === AST_NODE_TYPES.SpreadElement) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const actualArgument = expectCall.arguments[0];
|
|
35
|
+
const expectedArgument = node.arguments[0];
|
|
36
|
+
if (actualArgument === undefined || expectedArgument === undefined) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const actualText = sourceCode.getText(actualArgument);
|
|
40
|
+
const expectedText = sourceCode.getText(expectedArgument);
|
|
41
|
+
const typeArgumentText = getTypeArgumentText(node, sourceCode);
|
|
42
|
+
const expectedWithCast = typeArgumentText === undefined
|
|
43
|
+
? expectedText
|
|
44
|
+
: `(${expectedText}) as ${typeArgumentText}`;
|
|
45
|
+
context.report({
|
|
46
|
+
node,
|
|
47
|
+
messageId: 'useAssert',
|
|
48
|
+
fix: (fixer) => fixer.replaceText(node, `assert.deepStrictEqual(${actualText}, ${expectedWithCast})`),
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const isToStrictEqualInvocation = (
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
56
|
+
node) => {
|
|
57
|
+
if (node.callee.type !== AST_NODE_TYPES.MemberExpression ||
|
|
58
|
+
node.optional ||
|
|
59
|
+
node.callee.optional ||
|
|
60
|
+
node.callee.computed) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return (node.callee.property.type === AST_NODE_TYPES.Identifier &&
|
|
64
|
+
node.callee.property.name === 'toStrictEqual' &&
|
|
65
|
+
node.callee.object.type === AST_NODE_TYPES.CallExpression);
|
|
66
|
+
};
|
|
67
|
+
const isExpectCall = (
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
69
|
+
node) => node.callee.type === AST_NODE_TYPES.Identifier &&
|
|
70
|
+
node.callee.name === 'expect';
|
|
71
|
+
const getTypeArgumentText = (
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
73
|
+
node,
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
75
|
+
sourceCode) => {
|
|
76
|
+
const typeArguments = getModernTypeArguments(node) ?? getLegacyTypeParameters(node);
|
|
77
|
+
if (typeArguments === undefined) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const rawText = sourceCode.getText(typeArguments).trim();
|
|
81
|
+
if (rawText.length < 2) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const withoutAngles = rawText
|
|
85
|
+
.replace(/^\s*</u, '')
|
|
86
|
+
.replace(/>\s*$/u, '')
|
|
87
|
+
.trim();
|
|
88
|
+
return withoutAngles.length === 0 ? undefined : withoutAngles;
|
|
89
|
+
};
|
|
90
|
+
const getModernTypeArguments = (
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
92
|
+
node) => isRecord(node) && hasKey(node, 'typeArguments')
|
|
93
|
+
? node.typeArguments
|
|
94
|
+
: undefined;
|
|
95
|
+
const getLegacyTypeParameters = (
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
97
|
+
node) => isRecord(node) && hasKey(node, 'typeParameters')
|
|
98
|
+
? // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
99
|
+
node.typeParameters
|
|
100
|
+
: undefined;
|
|
101
|
+
|
|
102
|
+
export { noExpectToStrictEqualRule };
|
|
103
|
+
//# sourceMappingURL=no-expect-to-strict-equal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-expect-to-strict-equal.mjs","sources":["../../../../src/plugins/vitest-coding-style/rules/no-expect-to-strict-equal.mts"],"sourcesContent":[null],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.mts","sourceRoot":"","sources":["../../../../src/plugins/vitest-coding-style/rules/rules.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB;;CAEO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.mjs","sources":["../../../../src/plugins/vitest-coding-style/rules/rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGO,MAAM,sBAAsB,GAAG;AACpC,IAAA,2BAA2B,EAAE,yBAAyB;;;;;"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export declare const eslintStylisticRules: {
|
|
2
|
+
readonly '@stylistic/lines-around-comment': "off";
|
|
3
|
+
readonly '@stylistic/max-len': "off";
|
|
4
|
+
readonly '@stylistic/no-confusing-arrow': "off";
|
|
5
|
+
readonly '@stylistic/no-mixed-operators': "off";
|
|
6
|
+
readonly '@stylistic/no-tabs': "off";
|
|
7
|
+
readonly '@stylistic/quotes': "off";
|
|
8
|
+
readonly '@stylistic/array-bracket-newline': "off";
|
|
9
|
+
readonly '@stylistic/array-bracket-spacing': "off";
|
|
10
|
+
readonly '@stylistic/array-element-newline': "off";
|
|
11
|
+
readonly '@stylistic/arrow-parens': "off";
|
|
12
|
+
readonly '@stylistic/arrow-spacing': "off";
|
|
13
|
+
readonly '@stylistic/block-spacing': "off";
|
|
14
|
+
readonly '@stylistic/brace-style': "off";
|
|
15
|
+
readonly '@stylistic/comma-dangle': "off";
|
|
16
|
+
readonly '@stylistic/comma-spacing': "off";
|
|
17
|
+
readonly '@stylistic/comma-style': "off";
|
|
18
|
+
readonly '@stylistic/computed-property-spacing': "off";
|
|
19
|
+
readonly '@stylistic/dot-location': "off";
|
|
20
|
+
readonly '@stylistic/eol-last': "off";
|
|
21
|
+
readonly '@stylistic/function-call-argument-newline': "off";
|
|
22
|
+
readonly '@stylistic/function-call-spacing': "off";
|
|
23
|
+
readonly '@stylistic/function-paren-newline': "off";
|
|
24
|
+
readonly '@stylistic/generator-star-spacing': "off";
|
|
25
|
+
readonly '@stylistic/implicit-arrow-linebreak': "off";
|
|
26
|
+
readonly '@stylistic/indent': "off";
|
|
27
|
+
readonly '@stylistic/jsx-quotes': "off";
|
|
28
|
+
readonly '@stylistic/key-spacing': "off";
|
|
29
|
+
readonly '@stylistic/keyword-spacing': "off";
|
|
30
|
+
readonly '@stylistic/linebreak-style': "off";
|
|
31
|
+
readonly '@stylistic/max-statements-per-line': "off";
|
|
32
|
+
readonly '@stylistic/multiline-ternary': "off";
|
|
33
|
+
readonly '@stylistic/new-parens': "off";
|
|
34
|
+
readonly '@stylistic/newline-per-chained-call': "off";
|
|
35
|
+
readonly '@stylistic/no-extra-parens': "off";
|
|
36
|
+
readonly '@stylistic/no-extra-semi': "off";
|
|
37
|
+
readonly '@stylistic/no-floating-decimal': "off";
|
|
38
|
+
readonly '@stylistic/no-mixed-spaces-and-tabs': "off";
|
|
39
|
+
readonly '@stylistic/no-multi-spaces': "off";
|
|
40
|
+
readonly '@stylistic/no-multiple-empty-lines': "off";
|
|
41
|
+
readonly '@stylistic/no-trailing-spaces': "off";
|
|
42
|
+
readonly '@stylistic/no-whitespace-before-property': "off";
|
|
43
|
+
readonly '@stylistic/nonblock-statement-body-position': "off";
|
|
44
|
+
readonly '@stylistic/object-curly-newline': "off";
|
|
45
|
+
readonly '@stylistic/object-curly-spacing': "off";
|
|
46
|
+
readonly '@stylistic/object-property-newline': "off";
|
|
47
|
+
readonly '@stylistic/one-var-declaration-per-line': "off";
|
|
48
|
+
readonly '@stylistic/operator-linebreak': "off";
|
|
49
|
+
readonly '@stylistic/padded-blocks': "off";
|
|
50
|
+
readonly '@stylistic/quote-props': "off";
|
|
51
|
+
readonly '@stylistic/rest-spread-spacing': "off";
|
|
52
|
+
readonly '@stylistic/semi': "off";
|
|
53
|
+
readonly '@stylistic/semi-spacing': "off";
|
|
54
|
+
readonly '@stylistic/semi-style': "off";
|
|
55
|
+
readonly '@stylistic/space-before-blocks': "off";
|
|
56
|
+
readonly '@stylistic/space-before-function-paren': "off";
|
|
57
|
+
readonly '@stylistic/space-in-parens': "off";
|
|
58
|
+
readonly '@stylistic/space-infix-ops': "off";
|
|
59
|
+
readonly '@stylistic/space-unary-ops': "off";
|
|
60
|
+
readonly '@stylistic/switch-colon-spacing': "off";
|
|
61
|
+
readonly '@stylistic/template-curly-spacing': "off";
|
|
62
|
+
readonly '@stylistic/template-tag-spacing': "off";
|
|
63
|
+
readonly '@stylistic/wrap-iife': "off";
|
|
64
|
+
readonly '@stylistic/wrap-regex': "off";
|
|
65
|
+
readonly '@stylistic/yield-star-spacing': "off";
|
|
66
|
+
readonly '@stylistic/member-delimiter-style': "off";
|
|
67
|
+
readonly '@stylistic/type-annotation-spacing': "off";
|
|
68
|
+
readonly '@stylistic/jsx-child-element-spacing': "off";
|
|
69
|
+
readonly '@stylistic/jsx-closing-bracket-location': "off";
|
|
70
|
+
readonly '@stylistic/jsx-closing-tag-location': "off";
|
|
71
|
+
readonly '@stylistic/jsx-curly-newline': "off";
|
|
72
|
+
readonly '@stylistic/jsx-curly-spacing': "off";
|
|
73
|
+
readonly '@stylistic/jsx-equals-spacing': "off";
|
|
74
|
+
readonly '@stylistic/jsx-first-prop-new-line': "off";
|
|
75
|
+
readonly '@stylistic/jsx-indent': 0;
|
|
76
|
+
readonly '@stylistic/jsx-indent-props': "off";
|
|
77
|
+
readonly '@stylistic/jsx-max-props-per-line': "off";
|
|
78
|
+
readonly '@stylistic/jsx-newline': "off";
|
|
79
|
+
readonly '@stylistic/jsx-one-expression-per-line': "off";
|
|
80
|
+
readonly '@stylistic/jsx-props-no-multi-spaces': 0;
|
|
81
|
+
readonly '@stylistic/jsx-tag-spacing': "off";
|
|
82
|
+
readonly '@stylistic/jsx-wrap-multilines': "off";
|
|
83
|
+
readonly '@stylistic/indent-binary-ops': "off";
|
|
84
|
+
readonly '@stylistic/type-generic-spacing': "off";
|
|
85
|
+
readonly '@stylistic/type-named-tuple-spacing': "off";
|
|
86
|
+
readonly '@stylistic/curly-newline': "off";
|
|
87
|
+
readonly '@stylistic/exp-list-style': "off";
|
|
88
|
+
readonly '@stylistic/jsx-curly-brace-presence': "off";
|
|
89
|
+
readonly '@stylistic/jsx-function-call-newline': "off";
|
|
90
|
+
readonly '@stylistic/jsx-pascal-case': "off";
|
|
91
|
+
readonly '@stylistic/jsx-self-closing-comp': "off";
|
|
92
|
+
readonly '@stylistic/jsx-sort-props': "off";
|
|
93
|
+
readonly '@stylistic/line-comment-position': "off";
|
|
94
|
+
readonly '@stylistic/lines-between-class-members': "off";
|
|
95
|
+
readonly '@stylistic/multiline-comment-style': "off";
|
|
96
|
+
readonly '@stylistic/padding-line-between-statements': "off";
|
|
97
|
+
readonly '@stylistic/spaced-comment': "off";
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=eslint-stylistic-rules.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-stylistic-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-stylistic-rules.mts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGQ,CAAC"}
|