@wistia/eslint-config 1.6.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.json +26 -26
- package/src/configs/javascript.mjs +3 -3
- package/src/configs/node.mjs +2 -2
- package/src/configs/storybook.mjs +6 -6
- package/src/configs/typescript.mjs +8 -8
- package/src/configs/vitest.mjs +1 -1
- package/src/rules/base.mjs +1 -1
- package/src/rules/import.mjs +99 -95
- package/src/rules/node.mjs +1 -1
- package/src/rules/vitest.mjs +53 -53
- package/test/__snapshots__/javascript.mjs.snap +318 -57
- package/test/__snapshots__/jest.mjs.snap +2 -2
- package/test/__snapshots__/node.mjs.snap +4 -4
- package/test/__snapshots__/playwright.mjs.snap +1 -1
- package/test/__snapshots__/react-ssr-compatibility.mjs.snap +1 -1
- package/test/__snapshots__/react.mjs.snap +7 -1
- package/test/__snapshots__/storybook.mjs.snap +6 -6
- package/test/__snapshots__/styled-components.mjs.snap +1 -1
- package/test/__snapshots__/testing-library.mjs.snap +2 -2
- package/test/__snapshots__/typescript.mjs.snap +321 -60
- package/test/__snapshots__/vitest.mjs.snap +65 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @wistia/eslint-config
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#436](https://github.com/wistia/eslint-config/pull/436) [`8a5b5ac`](https://github.com/wistia/eslint-config/commit/8a5b5acac52b08919ccf2f9467fa9b53c7951cc1) Thanks [@okize](https://github.com/okize)! - feat: migrate from `eslint-plugin-import` to `eslint-plugin-import-x`
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#435](https://github.com/wistia/eslint-config/pull/435) [`40f6fb3`](https://github.com/wistia/eslint-config/commit/40f6fb3473a990c7f8ce7ab153d5a33c1fa092c3) Thanks [@okize](https://github.com/okize)! - feat!: upgrade to eslint v10
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#433](https://github.com/wistia/eslint-config/pull/433) [`2d98694`](https://github.com/wistia/eslint-config/commit/2d9869488b18d007f386e12754db7a0e71a7d5d8) Thanks [@okize](https://github.com/okize)! - feat: switch to the official vitest plugin
|
|
18
|
+
|
|
3
19
|
## 1.6.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"packageManager": "yarn@4.12.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,24 +39,25 @@
|
|
|
39
39
|
"test:export": "check-export-map"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@eslint/compat": "^2.0.
|
|
43
|
-
"@eslint/js": "^
|
|
44
|
-
"@stylistic/eslint-plugin": "^5.
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
46
|
-
"@typescript-eslint/parser": "^8.
|
|
42
|
+
"@eslint/compat": "^2.0.3",
|
|
43
|
+
"@eslint/js": "^10.0.1",
|
|
44
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
46
|
+
"@typescript-eslint/parser": "^8.57.1",
|
|
47
|
+
"@vitest/eslint-plugin": "^1.6.13",
|
|
47
48
|
"confusing-browser-globals": "^1.0.11",
|
|
48
49
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
49
50
|
"eslint-plugin-barrel-files": "^3.0.1",
|
|
50
51
|
"eslint-plugin-filenames": "^1.3.2",
|
|
51
|
-
"eslint-plugin-import": "^
|
|
52
|
-
"eslint-plugin-jest": "^29.
|
|
52
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
53
|
+
"eslint-plugin-jest": "^29.15.0",
|
|
53
54
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
54
55
|
"eslint-plugin-jest-formatting": "^3.1.0",
|
|
55
56
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
56
|
-
"eslint-plugin-n": "^17.
|
|
57
|
+
"eslint-plugin-n": "^17.24.0",
|
|
57
58
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
58
59
|
"eslint-plugin-no-typeof-window-undefined": "^0.0.2",
|
|
59
|
-
"eslint-plugin-playwright": "^2.
|
|
60
|
+
"eslint-plugin-playwright": "^2.10.1",
|
|
60
61
|
"eslint-plugin-prettier": "^5.5.5",
|
|
61
62
|
"eslint-plugin-promise": "^7.2.1",
|
|
62
63
|
"eslint-plugin-react": "^7.37.5",
|
|
@@ -64,30 +65,29 @@
|
|
|
64
65
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
65
66
|
"eslint-plugin-react-hooks-ssr": "^0.1.5",
|
|
66
67
|
"eslint-plugin-ssr-friendly": "^1.3.0",
|
|
67
|
-
"eslint-plugin-storybook": "^10.
|
|
68
|
+
"eslint-plugin-storybook": "^10.3.3",
|
|
68
69
|
"eslint-plugin-styled-components-a11y": "^2.2.1",
|
|
69
|
-
"eslint-plugin-testing-library": "^7.
|
|
70
|
-
"
|
|
71
|
-
"globals": "^
|
|
72
|
-
"globals-vitest": "^4.0.15"
|
|
70
|
+
"eslint-plugin-testing-library": "^7.16.1",
|
|
71
|
+
"globals": "^17.4.0",
|
|
72
|
+
"globals-vitest": "^4.1.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@changesets/changelog-github": "^0.
|
|
76
|
-
"@changesets/cli": "^2.
|
|
77
|
-
"@commitlint/cli": "^20.
|
|
78
|
-
"@commitlint/config-conventional": "^20.
|
|
75
|
+
"@changesets/changelog-github": "^0.6.0",
|
|
76
|
+
"@changesets/cli": "^2.30.0",
|
|
77
|
+
"@commitlint/cli": "^20.5.0",
|
|
78
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
79
79
|
"check-export-map": "^1.3.1",
|
|
80
|
-
"eslint": "^
|
|
81
|
-
"glob": "^13.0.
|
|
80
|
+
"eslint": "^10.1.0",
|
|
81
|
+
"glob": "^13.0.6",
|
|
82
82
|
"husky": "^9.1.7",
|
|
83
|
-
"prettier": "^3.8.
|
|
84
|
-
"storybook": "^10.
|
|
83
|
+
"prettier": "^3.8.1",
|
|
84
|
+
"storybook": "^10.3.3",
|
|
85
85
|
"typescript": "^5.9.3",
|
|
86
|
-
"vitest": "^4.
|
|
86
|
+
"vitest": "^4.1.1"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"eslint": ">=
|
|
90
|
-
"storybook": ">=
|
|
89
|
+
"eslint": ">= 10",
|
|
90
|
+
"storybook": ">= 9",
|
|
91
91
|
"typescript": ">= 5"
|
|
92
92
|
},
|
|
93
93
|
"peerDependenciesMeta": {
|
|
@@ -4,7 +4,7 @@ import typescriptParser from '@typescript-eslint/parser';
|
|
|
4
4
|
import jsPlugin from '@eslint/js';
|
|
5
5
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
6
6
|
import filenamesPlugin from 'eslint-plugin-filenames';
|
|
7
|
-
import importPlugin from 'eslint-plugin-import';
|
|
7
|
+
import { importX as importPlugin } from 'eslint-plugin-import-x';
|
|
8
8
|
import barrelFilesPlugin from 'eslint-plugin-barrel-files';
|
|
9
9
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
10
10
|
import promisePlugin from 'eslint-plugin-promise';
|
|
@@ -32,13 +32,13 @@ export default [
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
settings: {
|
|
35
|
-
'import/extensions': ['.js', '.jsx', '.mjs', '.cjs'],
|
|
35
|
+
'import-x/extensions': ['.js', '.jsx', '.mjs', '.cjs'],
|
|
36
36
|
},
|
|
37
37
|
plugins: {
|
|
38
38
|
'@stylistic': stylisticPlugin,
|
|
39
39
|
'barrel-files': barrelFilesPlugin,
|
|
40
40
|
filenames: fixupPluginRules(filenamesPlugin),
|
|
41
|
-
import: importPlugin,
|
|
41
|
+
'import-x': importPlugin,
|
|
42
42
|
js: jsPlugin,
|
|
43
43
|
prettier: prettierPlugin,
|
|
44
44
|
promise: promisePlugin,
|
package/src/configs/node.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import globals from 'globals';
|
|
2
2
|
import nodePlugin from 'eslint-plugin-n';
|
|
3
|
-
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
import { importX as importPlugin } from 'eslint-plugin-import-x';
|
|
4
4
|
import nodeRules from '../rules/node.mjs';
|
|
5
5
|
|
|
6
6
|
export default [
|
|
@@ -12,7 +12,7 @@ export default [
|
|
|
12
12
|
},
|
|
13
13
|
plugins: {
|
|
14
14
|
n: nodePlugin,
|
|
15
|
-
import: importPlugin,
|
|
15
|
+
'import-x': importPlugin,
|
|
16
16
|
},
|
|
17
17
|
rules: {
|
|
18
18
|
...nodeRules,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fixupPluginRules } from '@eslint/compat';
|
|
2
2
|
import storybookPlugin from 'eslint-plugin-storybook';
|
|
3
3
|
import filenamesPlugin from 'eslint-plugin-filenames';
|
|
4
|
-
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import { importX as importPlugin } from 'eslint-plugin-import-x';
|
|
5
5
|
import storybookRules from '../rules/storybook.mjs';
|
|
6
6
|
|
|
7
7
|
export default [
|
|
@@ -9,15 +9,15 @@ export default [
|
|
|
9
9
|
plugins: {
|
|
10
10
|
storybook: storybookPlugin,
|
|
11
11
|
filenames: fixupPluginRules(filenamesPlugin),
|
|
12
|
-
import: importPlugin,
|
|
12
|
+
'import-x': importPlugin,
|
|
13
13
|
},
|
|
14
14
|
rules: {
|
|
15
15
|
...storybookRules,
|
|
16
16
|
// storybook >7 requires default exports in stories
|
|
17
|
-
'import/no-anonymous-default-export': 'off',
|
|
18
|
-
'import/no-default-export': 'off',
|
|
19
|
-
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
|
20
|
-
'import/prefer-default-export': 'error',
|
|
17
|
+
'import-x/no-anonymous-default-export': 'off',
|
|
18
|
+
'import-x/no-default-export': 'off',
|
|
19
|
+
'import-x/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
|
20
|
+
'import-x/prefer-default-export': 'error',
|
|
21
21
|
|
|
22
22
|
// the default export is always called `meta` so the filenames
|
|
23
23
|
// will never match the exported name
|
|
@@ -4,7 +4,7 @@ import typescriptPlugin from '@typescript-eslint/eslint-plugin';
|
|
|
4
4
|
import { fixupPluginRules } from '@eslint/compat';
|
|
5
5
|
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
6
6
|
import filenamesPlugin from 'eslint-plugin-filenames';
|
|
7
|
-
import importPlugin from 'eslint-plugin-import';
|
|
7
|
+
import { importX as importPlugin } from 'eslint-plugin-import-x';
|
|
8
8
|
import barrelFilesPlugin from 'eslint-plugin-barrel-files';
|
|
9
9
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
10
10
|
import promisePlugin from 'eslint-plugin-promise';
|
|
@@ -37,23 +37,23 @@ export default [
|
|
|
37
37
|
'@typescript-eslint': typescriptPlugin,
|
|
38
38
|
'barrel-files': barrelFilesPlugin,
|
|
39
39
|
filenames: fixupPluginRules(filenamesPlugin),
|
|
40
|
-
import: importPlugin,
|
|
40
|
+
'import-x': importPlugin,
|
|
41
41
|
prettier: prettierPlugin,
|
|
42
42
|
promise: promisePlugin,
|
|
43
43
|
},
|
|
44
44
|
settings: {
|
|
45
|
-
'import/extensions': ['.ts', '.cts', '.mts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
|
|
45
|
+
'import-x/extensions': ['.ts', '.cts', '.mts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
|
|
46
46
|
|
|
47
|
-
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
47
|
+
'import-x/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
48
48
|
|
|
49
|
-
'import/parsers': {
|
|
49
|
+
'import-x/parsers': {
|
|
50
50
|
// omit `.d.ts` because
|
|
51
51
|
// 1) TypeScript compilation already confirms that types are resolved, and
|
|
52
52
|
// 2) it would mask an unresolved `.ts`/`.tsx`/`.js`/`.jsx` implementation.
|
|
53
53
|
'@typescript-eslint/parser': ['.ts', '.cts', '.mts', '.tsx'],
|
|
54
54
|
},
|
|
55
55
|
|
|
56
|
-
'import/resolver': {
|
|
56
|
+
'import-x/resolver': {
|
|
57
57
|
typescript: {
|
|
58
58
|
node: {
|
|
59
59
|
extensions: ['.ts', '.cts', '.mts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
|
|
@@ -76,8 +76,8 @@ export default [
|
|
|
76
76
|
...promiseRules,
|
|
77
77
|
...typescriptRules,
|
|
78
78
|
|
|
79
|
-
'import/named': 'off', // conflicts with TS's type system
|
|
80
|
-
'import/no-unused-modules': 'off', // false positives
|
|
79
|
+
'import-x/named': 'off', // conflicts with TS's type system
|
|
80
|
+
'import-x/no-unused-modules': 'off', // false positives
|
|
81
81
|
'prettier/prettier': 'error',
|
|
82
82
|
},
|
|
83
83
|
},
|
package/src/configs/vitest.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import globalsVitest from 'globals-vitest';
|
|
2
|
-
import vitestPlugin from 'eslint-plugin
|
|
2
|
+
import vitestPlugin from '@vitest/eslint-plugin';
|
|
3
3
|
import jestFormattingPlugin from 'eslint-plugin-jest-formatting';
|
|
4
4
|
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
|
|
5
5
|
import vitestRules from '../rules/vitest.mjs';
|
package/src/rules/base.mjs
CHANGED
|
@@ -85,7 +85,7 @@ export default {
|
|
|
85
85
|
|
|
86
86
|
// Disallow duplicate module imports
|
|
87
87
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
88
|
-
// replaced by https://github.com/
|
|
88
|
+
// replaced by https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
|
|
89
89
|
'no-duplicate-imports': 'off',
|
|
90
90
|
|
|
91
91
|
// Disallow empty character classes in regular expressions
|
package/src/rules/import.mjs
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
// ensure named imports coupled with named exports
|
|
3
|
-
// https://github.com/
|
|
4
|
-
'import/named': 'error',
|
|
3
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/named.md
|
|
4
|
+
'import-x/named': 'error',
|
|
5
5
|
|
|
6
6
|
// Forbid cyclical dependencies between modules
|
|
7
|
-
// https://github.com/
|
|
8
|
-
'import/no-cycle': ['error', { maxDepth: '∞' }],
|
|
7
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-cycle.md
|
|
8
|
+
'import-x/no-cycle': ['error', { maxDepth: '∞' }],
|
|
9
9
|
|
|
10
10
|
// ensure imports point to files/modules that can be resolved
|
|
11
|
-
// https://github.com/
|
|
12
|
-
'import/no-unresolved': ['error', { caseSensitive: true }],
|
|
11
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
|
|
12
|
+
'import-x/no-unresolved': ['error', { caseSensitive: true }],
|
|
13
13
|
|
|
14
14
|
// ensure default import coupled with default export
|
|
15
|
-
// https://github.com/
|
|
16
|
-
'import/default': 'error',
|
|
15
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/default.md
|
|
16
|
+
'import-x/default': 'error',
|
|
17
17
|
|
|
18
|
-
// https://github.com/
|
|
19
|
-
'import/namespace': 'error',
|
|
18
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/namespace.md
|
|
19
|
+
'import-x/namespace': 'error',
|
|
20
20
|
|
|
21
21
|
// Helpful warnings:
|
|
22
22
|
|
|
23
23
|
// disallow invalid exports, e.g. multiple defaults
|
|
24
|
-
// https://github.com/
|
|
25
|
-
'import/export': 'error',
|
|
24
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/export.md
|
|
25
|
+
'import-x/export': 'error',
|
|
26
26
|
|
|
27
27
|
// do not allow a default import name to match a named export
|
|
28
|
-
// https://github.com/
|
|
29
|
-
'import/no-named-as-default': 'error',
|
|
28
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default.md
|
|
29
|
+
'import-x/no-named-as-default': 'error',
|
|
30
30
|
|
|
31
31
|
// warn on accessing default export property names that are also named exports
|
|
32
|
-
// https://github.com/
|
|
33
|
-
'import/no-named-as-default-member': 'error',
|
|
32
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default-member.md
|
|
33
|
+
'import-x/no-named-as-default-member': 'error',
|
|
34
34
|
|
|
35
35
|
// disallow use of jsdoc-marked-deprecated imports
|
|
36
|
-
// https://github.com/
|
|
37
|
-
'import/no-deprecated': 'off',
|
|
36
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-deprecated.md
|
|
37
|
+
'import-x/no-deprecated': 'off',
|
|
38
38
|
|
|
39
39
|
// Forbid the use of extraneous packages
|
|
40
|
-
// https://github.com/
|
|
40
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
41
41
|
// paths are treated both as absolute paths, and relative to process.cwd()
|
|
42
|
-
'import/no-extraneous-dependencies': [
|
|
42
|
+
'import-x/no-extraneous-dependencies': [
|
|
43
43
|
'error',
|
|
44
44
|
{
|
|
45
45
|
devDependencies: [
|
|
@@ -64,45 +64,49 @@ export default {
|
|
|
64
64
|
],
|
|
65
65
|
|
|
66
66
|
// Forbid mutable exports
|
|
67
|
-
// https://github.com/
|
|
68
|
-
'import/no-mutable-exports': 'error',
|
|
67
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-mutable-exports.md
|
|
68
|
+
'import-x/no-mutable-exports': 'error',
|
|
69
|
+
|
|
70
|
+
// Reports if a default export is renamed during import
|
|
71
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-rename-default.md
|
|
72
|
+
'import-x/no-rename-default': 'error',
|
|
69
73
|
|
|
70
74
|
// Module systems:
|
|
71
75
|
|
|
72
76
|
// disallow require()
|
|
73
|
-
// https://github.com/
|
|
74
|
-
'import/no-commonjs': 'error',
|
|
77
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-commonjs.md
|
|
78
|
+
'import-x/no-commonjs': 'error',
|
|
75
79
|
|
|
76
80
|
// disallow AMD require/define
|
|
77
|
-
// https://github.com/
|
|
78
|
-
'import/no-amd': 'error',
|
|
81
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-amd.md
|
|
82
|
+
'import-x/no-amd': 'error',
|
|
79
83
|
|
|
80
84
|
// No Node.js builtin modules
|
|
81
|
-
// https://github.com/
|
|
82
|
-
'import/no-nodejs-modules': 'off',
|
|
85
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-nodejs-modules.md
|
|
86
|
+
'import-x/no-nodejs-modules': 'off',
|
|
83
87
|
|
|
84
88
|
// Style guide:
|
|
85
89
|
|
|
86
90
|
// disallow non-import statements appearing before import statements
|
|
87
|
-
// https://github.com/
|
|
88
|
-
'import/first': 'error',
|
|
91
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/first.md
|
|
92
|
+
'import-x/first': 'error',
|
|
89
93
|
|
|
90
94
|
// disallow non-import statements appearing before import statements
|
|
91
|
-
// https://github.com/
|
|
92
|
-
// deprecated: use `import/first`
|
|
93
|
-
// 'import/imports-first': 'off',
|
|
95
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/imports-first.md
|
|
96
|
+
// deprecated: use `import-x/first`
|
|
97
|
+
// 'import-x/imports-first': 'off',
|
|
94
98
|
|
|
95
99
|
// disallow duplicate imports
|
|
96
|
-
// https://github.com/
|
|
97
|
-
'import/no-duplicates': 'error',
|
|
100
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
|
|
101
|
+
'import-x/no-duplicates': 'error',
|
|
98
102
|
|
|
99
103
|
// disallow namespace imports
|
|
100
|
-
// https://github.com/
|
|
101
|
-
'import/no-namespace': 'off',
|
|
104
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-namespace.md
|
|
105
|
+
'import-x/no-namespace': 'off',
|
|
102
106
|
|
|
103
107
|
// Ensure consistent use of file extension within the import path
|
|
104
|
-
// https://github.com/
|
|
105
|
-
'import/extensions': [
|
|
108
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
|
|
109
|
+
'import-x/extensions': [
|
|
106
110
|
'error',
|
|
107
111
|
'ignorePackages',
|
|
108
112
|
{
|
|
@@ -115,8 +119,8 @@ export default {
|
|
|
115
119
|
],
|
|
116
120
|
|
|
117
121
|
// ensure absolute imports are above relative imports and that unassigned imports are ignored
|
|
118
|
-
// https://github.com/
|
|
119
|
-
'import/order': [
|
|
122
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
|
|
123
|
+
'import-x/order': [
|
|
120
124
|
'error',
|
|
121
125
|
{
|
|
122
126
|
groups: [['builtin', 'external', 'internal'], 'index', ['parent', 'sibling']],
|
|
@@ -125,36 +129,32 @@ export default {
|
|
|
125
129
|
],
|
|
126
130
|
|
|
127
131
|
// Require a newline after the last import/require in a group
|
|
128
|
-
// https://github.com/
|
|
129
|
-
'import/newline-after-import': 'error',
|
|
132
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/newline-after-import.md
|
|
133
|
+
'import-x/newline-after-import': 'error',
|
|
130
134
|
|
|
131
135
|
// Require modules with a single export to use a default export
|
|
132
|
-
// https://github.com/
|
|
133
|
-
'import/prefer-default-export': 'off',
|
|
136
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-default-export.md
|
|
137
|
+
'import-x/prefer-default-export': 'off',
|
|
134
138
|
|
|
135
139
|
// Restrict which files can be imported in a given folder
|
|
136
|
-
// https://github.com/
|
|
137
|
-
'import/no-restricted-paths': 'off',
|
|
140
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-restricted-paths.md
|
|
141
|
+
'import-x/no-restricted-paths': 'off',
|
|
138
142
|
|
|
139
143
|
// Forbid modules to have too many dependencies
|
|
140
|
-
// https://github.com/
|
|
141
|
-
'import/max-dependencies': ['off', { max: 10 }],
|
|
144
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
|
|
145
|
+
'import-x/max-dependencies': ['off', { max: 10 }],
|
|
142
146
|
|
|
143
147
|
// Forbid import of modules using absolute paths
|
|
144
|
-
// https://github.com/
|
|
145
|
-
'import/no-absolute-path': 'error',
|
|
148
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-absolute-path.md
|
|
149
|
+
'import-x/no-absolute-path': 'error',
|
|
146
150
|
|
|
147
151
|
// Forbid require() calls with expressions
|
|
148
|
-
// https://github.com/
|
|
149
|
-
'import/no-dynamic-require': 'error',
|
|
150
|
-
|
|
151
|
-
// Enforce either using, or omitting, the node: protocol when importing Node.js builtin modules
|
|
152
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/enforce-node-protocol-usage.md
|
|
153
|
-
'import/enforce-node-protocol-usage': ['error', 'always'],
|
|
152
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-dynamic-require.md
|
|
153
|
+
'import-x/no-dynamic-require': 'error',
|
|
154
154
|
|
|
155
155
|
// prevent importing the submodules of other modules
|
|
156
|
-
// https://github.com/
|
|
157
|
-
'import/no-internal-modules': [
|
|
156
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-internal-modules.md
|
|
157
|
+
'import-x/no-internal-modules': [
|
|
158
158
|
'off',
|
|
159
159
|
{
|
|
160
160
|
allow: [],
|
|
@@ -163,28 +163,28 @@ export default {
|
|
|
163
163
|
|
|
164
164
|
// Warn if a module could be mistakenly parsed as a script by a consumer
|
|
165
165
|
// leveraging Unambiguous JavaScript Grammar
|
|
166
|
-
// https://github.com/
|
|
166
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/unambiguous.md
|
|
167
167
|
// this should not be enabled until this proposal has at least been *presented* to TC39.
|
|
168
168
|
// At the moment, it's not a thing.
|
|
169
|
-
'import/unambiguous': 'off',
|
|
169
|
+
'import-x/unambiguous': 'off',
|
|
170
170
|
|
|
171
171
|
// Forbid Webpack loader syntax in imports
|
|
172
|
-
// https://github.com/
|
|
173
|
-
'import/no-webpack-loader-syntax': 'error',
|
|
172
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-webpack-loader-syntax.md
|
|
173
|
+
'import-x/no-webpack-loader-syntax': 'error',
|
|
174
174
|
|
|
175
175
|
// Prevent unassigned imports
|
|
176
|
-
// https://github.com/
|
|
176
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unassigned-import.md
|
|
177
177
|
// importing for side effects is perfectly acceptable, if you need side effects.
|
|
178
|
-
'import/no-unassigned-import': 'off',
|
|
178
|
+
'import-x/no-unassigned-import': 'off',
|
|
179
179
|
|
|
180
180
|
// Prevent importing the default as if it were named
|
|
181
|
-
// https://github.com/
|
|
182
|
-
'import/no-named-default': 'error',
|
|
181
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-default.md
|
|
182
|
+
'import-x/no-named-default': 'error',
|
|
183
183
|
|
|
184
184
|
// Reports if a module's default export is unnamed
|
|
185
185
|
// (anonymous exports make grepping code from Dev Tools component tree more difficult)
|
|
186
|
-
// https://github.com/
|
|
187
|
-
'import/no-anonymous-default-export': [
|
|
186
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-anonymous-default-export.md
|
|
187
|
+
'import-x/no-anonymous-default-export': [
|
|
188
188
|
'error',
|
|
189
189
|
{
|
|
190
190
|
allowArray: false,
|
|
@@ -198,34 +198,34 @@ export default {
|
|
|
198
198
|
],
|
|
199
199
|
|
|
200
200
|
// This rule enforces that all exports are declared at the bottom of the file.
|
|
201
|
-
// https://github.com/
|
|
202
|
-
'import/exports-last': 'off',
|
|
201
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/exports-last.md
|
|
202
|
+
'import-x/exports-last': 'off',
|
|
203
203
|
|
|
204
204
|
// Reports when named exports are not grouped together in a single export declaration
|
|
205
205
|
// or when multiple assignments to CommonJS module.exports or exports object are present
|
|
206
206
|
// in a single file.
|
|
207
|
-
// https://github.com/
|
|
208
|
-
'import/group-exports': 'off',
|
|
207
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/group-exports.md
|
|
208
|
+
'import-x/group-exports': 'off',
|
|
209
209
|
|
|
210
210
|
// forbid default exports
|
|
211
|
-
// https://github.com/
|
|
212
|
-
'import/no-default-export': 'error',
|
|
211
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-default-export.md
|
|
212
|
+
'import-x/no-default-export': 'error',
|
|
213
213
|
|
|
214
214
|
// Prohibit named exports. this is a terrible rule, do not use it.
|
|
215
|
-
// https://github.com/
|
|
216
|
-
'import/no-named-export': 'off',
|
|
215
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-export.md
|
|
216
|
+
'import-x/no-named-export': 'off',
|
|
217
217
|
|
|
218
218
|
// Forbid a module from importing itself
|
|
219
|
-
// https://github.com/
|
|
220
|
-
'import/no-self-import': 'error',
|
|
219
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-self-import.md
|
|
220
|
+
'import-x/no-self-import': 'error',
|
|
221
221
|
|
|
222
222
|
// Ensures that there are no useless path segments
|
|
223
|
-
// https://github.com/
|
|
224
|
-
'import/no-useless-path-segments': ['error', { commonjs: true }],
|
|
223
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
|
|
224
|
+
'import-x/no-useless-path-segments': ['error', { commonjs: true }],
|
|
225
225
|
|
|
226
226
|
// dynamic imports require a leading comment with a webpackChunkName
|
|
227
|
-
// https://github.com/
|
|
228
|
-
'import/dynamic-import-chunkname': [
|
|
227
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/dynamic-import-chunkname.md
|
|
228
|
+
'import-x/dynamic-import-chunkname': [
|
|
229
229
|
'off',
|
|
230
230
|
{
|
|
231
231
|
importFunctions: [],
|
|
@@ -234,17 +234,17 @@ export default {
|
|
|
234
234
|
],
|
|
235
235
|
|
|
236
236
|
// Use this rule to prevent imports to folders in relative parent paths.
|
|
237
|
-
// https://github.com/
|
|
238
|
-
'import/no-relative-parent-imports': 'off',
|
|
237
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-parent-imports.md
|
|
238
|
+
'import-x/no-relative-parent-imports': 'off',
|
|
239
239
|
|
|
240
240
|
// Reports modules without any exports, or with unused exports
|
|
241
|
-
// https://github.com/
|
|
241
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unused-modules.md
|
|
242
242
|
// note: there are better tools to detect unused exports
|
|
243
|
-
'import/no-unused-modules': 'off',
|
|
243
|
+
'import-x/no-unused-modules': 'off',
|
|
244
244
|
|
|
245
245
|
// Reports the use of import declarations with CommonJS exports in any module except for the main module.
|
|
246
|
-
// https://github.com/
|
|
247
|
-
'import/no-import-module-exports': [
|
|
246
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-import-module-exports.md
|
|
247
|
+
'import-x/no-import-module-exports': [
|
|
248
248
|
'error',
|
|
249
249
|
{
|
|
250
250
|
exceptions: [],
|
|
@@ -252,15 +252,19 @@ export default {
|
|
|
252
252
|
],
|
|
253
253
|
|
|
254
254
|
// Use this rule to prevent importing packages through relative paths.
|
|
255
|
-
// https://github.com/
|
|
256
|
-
'import/no-relative-packages': 'error',
|
|
255
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-packages.md
|
|
256
|
+
'import-x/no-relative-packages': 'error',
|
|
257
257
|
|
|
258
258
|
// Forbid empty named import blocks
|
|
259
|
-
// https://github.com/
|
|
260
|
-
'import/no-empty-named-blocks': 'error',
|
|
259
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-empty-named-blocks.md
|
|
260
|
+
'import-x/no-empty-named-blocks': 'error',
|
|
261
261
|
|
|
262
262
|
// Enforce a convention in type specifier style for imports
|
|
263
|
-
// https://github.com/
|
|
263
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
|
|
264
264
|
// note: this rule is better handled by @typescript-eslint/consistent-type-imports
|
|
265
|
-
'import/consistent-type-specifier-style': 'off',
|
|
265
|
+
'import-x/consistent-type-specifier-style': 'off',
|
|
266
|
+
|
|
267
|
+
// Enforce namespace imports for specified modules
|
|
268
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-namespace-import.md
|
|
269
|
+
'import-x/prefer-namespace-import': 'off',
|
|
266
270
|
};
|