eslint-config-airbnb-extended 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,4 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const recommended_1 = __importDefault(require("../base/recommended"));
7
7
  const react_1 = __importDefault(require("../react"));
8
- exports.default = [...recommended_1.default, ...Object.values(react_1.default)];
8
+ const utils_1 = require("../utils");
9
+ exports.default = [
10
+ ...recommended_1.default,
11
+ ...Object.values(react_1.default),
12
+ {
13
+ name: 'airbnb/config/react-settings',
14
+ settings: {
15
+ 'import-x/resolver': {
16
+ node: {
17
+ extensions: utils_1.jsExtensionsWithReact,
18
+ },
19
+ },
20
+ },
21
+ },
22
+ ];
package/dist/rules/es6.js CHANGED
@@ -57,7 +57,7 @@ exports.default = {
57
57
  'no-dupe-class-members': 'error',
58
58
  // disallow importing from the same path more than once
59
59
  // https://eslint.org/docs/rules/no-duplicate-imports
60
- // replaced by https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
60
+ // replaced by https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
61
61
  'no-duplicate-imports': 'off',
62
62
  // disallow symbol constructor
63
63
  // https://eslint.org/docs/rules/no-new-symbol
@@ -1,4 +1,5 @@
1
- export declare const importConfig: {
1
+ import type { Linter } from 'eslint';
2
+ declare const _default: {
2
3
  name: string;
3
4
  languageOptions: {
4
5
  globals: {
@@ -60,98 +61,91 @@ export declare const importConfig: {
60
61
  };
61
62
  };
62
63
  settings: {
63
- 'import/resolver': {
64
+ 'import-x/resolver': {
64
65
  node: {
65
66
  extensions: string[];
66
67
  };
67
68
  };
68
- 'import/extensions': string[];
69
- 'import/core-modules': never[];
70
- 'import/ignore': string[];
69
+ 'import-x/extensions': string[];
70
+ 'import-x/core-modules': never[];
71
+ 'import-x/ignore': string[];
71
72
  };
72
73
  rules: {
73
- 'import/no-unresolved': ["error", {
74
- commonjs: boolean;
75
- caseSensitive: boolean;
74
+ 'import-x/consistent-type-specifier-style': "off";
75
+ 'import-x/default': "error";
76
+ 'import-x/dynamic-import-chunkname': "off";
77
+ 'import-x/export': "error";
78
+ 'import-x/exports-last': "off";
79
+ 'import-x/extensions': ["error", string, {
80
+ [k: string]: string;
76
81
  }];
77
- 'import/named': "error";
78
- 'import/default': "off";
79
- 'import/namespace': "off";
80
- 'import/export': "error";
81
- 'import/no-named-as-default': "error";
82
- 'import/no-named-as-default-member': "error";
83
- 'import/no-deprecated': "off";
84
- 'import/no-extraneous-dependencies': ["error", {
82
+ 'import-x/first': "error";
83
+ 'import-x/group-exports': "off";
84
+ 'import-x/imports-first': "off";
85
+ 'import-x/max-dependencies': "off";
86
+ 'import-x/named': "error";
87
+ 'import-x/namespaces': "error";
88
+ 'import-x/newline-after-import': "error";
89
+ 'import-x/no-absolute-path': "error";
90
+ 'import-x/no-amd': "error";
91
+ 'import-x/no-anonymous-default-export': "off";
92
+ 'import-x/no-commonjs': "off";
93
+ 'import-x/no-cycle': ["error", {
94
+ maxDepth: string;
95
+ }];
96
+ 'import-x/no-default-export': "off";
97
+ 'import-x/no-deprecated': "off";
98
+ 'import-x/no-duplicates': "error";
99
+ 'import-x/no-dynamic-require': "error";
100
+ 'import-x/no-empty-named-blocks': "error";
101
+ 'import-x/no-extraneous-dependencies': ["error", {
85
102
  devDependencies: string[];
86
103
  optionalDependencies: boolean;
104
+ peerDependencies: boolean;
105
+ bundledDependencies: boolean;
87
106
  }];
88
- 'import/no-mutable-exports': "error";
89
- 'import/no-commonjs': "off";
90
- 'import/no-amd': "error";
91
- 'import/no-nodejs-modules': "off";
92
- 'import/first': "error";
93
- 'import/imports-first': "off";
94
- 'import/no-duplicates': "error";
95
- 'import/no-namespace': "off";
96
- 'import/extensions': ["error", string, {
97
- js: string;
98
- mjs: string;
99
- jsx: string;
100
- }];
101
- 'import/order': ["error", {
102
- groups: string[][];
103
- }];
104
- 'import/newline-after-import': "error";
105
- 'import/prefer-default-export': "error";
106
- 'import/no-restricted-paths': "off";
107
- 'import/max-dependencies': ["off", {
108
- max: number;
109
- }];
110
- 'import/no-absolute-path': "error";
111
- 'import/no-dynamic-require': "error";
112
- 'import/no-internal-modules': ["off", {
113
- allow: never[];
114
- }];
115
- 'import/unambiguous': "off";
116
- 'import/no-webpack-loader-syntax': "error";
117
- 'import/no-unassigned-import': "off";
118
- 'import/no-named-default': "error";
119
- 'import/no-anonymous-default-export': ["off", {
120
- allowArray: boolean;
121
- allowArrowFunction: boolean;
122
- allowAnonymousClass: boolean;
123
- allowAnonymousFunction: boolean;
124
- allowLiteral: boolean;
125
- allowObject: boolean;
126
- }];
127
- 'import/exports-last': "off";
128
- 'import/group-exports': "off";
129
- 'import/no-default-export': "off";
130
- 'import/no-named-export': "off";
131
- 'import/no-self-import': "error";
132
- 'import/no-cycle': ["error", {
133
- maxDepth: string;
107
+ 'import-x/no-import-module-exports': ["error", {
108
+ exceptions: never[];
134
109
  }];
135
- 'import/no-useless-path-segments': ["error", {
110
+ 'import-x/no-internal-modules': "off";
111
+ 'import-x/no-mutable-exports': "error";
112
+ 'import-x/no-named-as-default-member': "error";
113
+ 'import-x/no-named-as-default': "error";
114
+ 'import-x/no-named-default': "error";
115
+ 'import-x/no-named-export': "off";
116
+ 'import-x/no-namespace': "off";
117
+ 'import-x/no-nodejs-modules': "off";
118
+ 'import-x/no-relative-packages': "error";
119
+ 'import-x/no-relative-parent-imports': "off";
120
+ 'import-x/no-rename-default': "warn";
121
+ 'import-x/no-restricted-paths': "off";
122
+ 'import-x/no-self-import': "error";
123
+ 'import-x/no-unassigned-import': "off";
124
+ 'import-x/no-unresolved': ["error", {
136
125
  commonjs: boolean;
126
+ caseSensitive: boolean;
137
127
  }];
138
- 'import/dynamic-import-chunkname': ["off", {
139
- importFunctions: never[];
140
- webpackChunknameFormat: string;
141
- }];
142
- 'import/no-relative-parent-imports': "off";
143
- 'import/no-unused-modules': ["off", {
128
+ 'import-x/no-unused-modules': ["off", {
144
129
  ignoreExports: never[];
145
130
  missingExports: boolean;
146
131
  unusedExports: boolean;
147
132
  }];
148
- 'import/no-import-module-exports': ["error", {
149
- exceptions: never[];
133
+ 'import-x/no-useless-path-segments': ["error", {
134
+ noUselessIndex: boolean;
135
+ commonjs: boolean;
136
+ }];
137
+ 'import-x/no-webpack-loader-syntax': "error";
138
+ 'import-x/order': ["error", {
139
+ groups: string[][];
150
140
  }];
151
- 'import/no-relative-packages': "error";
152
- 'import/consistent-type-specifier-style': ["off", string];
153
- 'import/no-empty-named-blocks': "off";
141
+ 'import-x/prefer-default-export': "error";
142
+ 'import-x/unambiguous': "off";
154
143
  };
144
+ files?: Array<string | string[]>;
145
+ ignores?: string[];
146
+ language?: string;
147
+ linterOptions?: Linter.LinterOptions;
148
+ processor?: string | Linter.Processor;
149
+ plugins?: Record<string, import("eslint").ESLint.Plugin>;
155
150
  };
156
- declare const _default: any;
157
151
  export default _default;
@@ -3,228 +3,172 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.importConfig = void 0;
6
+ const utils_1 = require("../utils");
7
+ const eslint_plugin_import_x_1 = require("eslint-plugin-import-x");
7
8
  const globals_1 = __importDefault(require("globals"));
8
- // @ts-expect-error eslint-plugin-import not working in import
9
- // eslint-disable-next-line @typescript-eslint/no-require-imports,unicorn/prefer-module
10
- const EsLintPluginImport = require('eslint-plugin-import');
11
- exports.importConfig = {
12
- name: 'airbnb/config/imports',
13
- languageOptions: {
9
+ const getDevDepsList_1 = require("../helpers/getDevDepsList");
10
+ exports.default = Object.assign(Object.assign({}, eslint_plugin_import_x_1.flatConfigs.recommended), { name: 'airbnb/config/imports', languageOptions: {
14
11
  globals: Object.assign({}, globals_1.default.es2015),
15
12
  parserOptions: {
16
13
  ecmaVersion: 6,
17
14
  sourceType: 'module',
18
15
  },
19
- },
20
- settings: {
21
- 'import/resolver': {
16
+ }, settings: {
17
+ 'import-x/resolver': {
22
18
  node: {
23
- extensions: ['.js', '.cjs', '.mjs', '.json'],
19
+ extensions: utils_1.jsExtensionsResolver,
24
20
  },
25
21
  },
26
- 'import/extensions': ['.js', '.cjs', '.mjs', '.jsx'],
27
- 'import/core-modules': [],
28
- 'import/ignore': ['node_modules', String.raw `\.(coffee|scss|css|less|hbs|svg|json)$`],
29
- },
30
- rules: {
31
- // Static analysis:
32
- // ensure imports point to files/modules that can be resolved
33
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
34
- 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
35
- // ensure named imports coupled with named exports
36
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
37
- 'import/named': 'error',
22
+ 'import-x/extensions': utils_1.jsExtensionsWithReact,
23
+ 'import-x/core-modules': [],
24
+ 'import-x/ignore': ['node_modules', String.raw `\.(coffee|scss|css|less|hbs|svg|json)$`],
25
+ }, rules: {
26
+ // enforce a consistent style for type specifiers (inline or top-level)
27
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
28
+ 'import-x/consistent-type-specifier-style': 'off',
38
29
  // ensure default import coupled with default export
39
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
40
- 'import/default': 'off',
41
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/namespace.md
42
- 'import/namespace': 'off',
43
- // Helpful warnings:
30
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/default.md#when-not-to-use-it
31
+ 'import-x/default': 'error',
32
+ // dynamic imports require a leading comment with a webpackChunkName
33
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/dynamic-import-chunkname.md
34
+ 'import-x/dynamic-import-chunkname': 'off',
44
35
  // disallow invalid exports, e.g. multiple defaults
45
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/export.md
46
- 'import/export': 'error',
47
- // do not allow a default import name to match a named export
48
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
49
- 'import/no-named-as-default': 'error',
50
- // warn on accessing default export property names that are also named exports
51
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
52
- 'import/no-named-as-default-member': 'error',
36
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/export.md
37
+ 'import-x/export': 'error',
38
+ // This rule enforces that all exports are declared at the bottom of the file.
39
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/exports-last.md
40
+ 'import-x/exports-last': 'off',
41
+ // Ensure consistent use of file extension within the import path
42
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
43
+ 'import-x/extensions': ['error', 'ignorePackages', utils_1.jsExtensionsRule],
44
+ // disallow non-import statements appearing before import statements
45
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/first.md
46
+ 'import-x/first': 'error',
47
+ // Reports when named exports are not grouped together in a single export declaration
48
+ // or when multiple assignments to CommonJS module.exports or exports object are present
49
+ // in a single file.
50
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/group-exports.md
51
+ 'import-x/group-exports': 'off',
52
+ // disallow non-import statements appearing before import statements
53
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/imports-first.md
54
+ // @deprecated: use `import-x/first`
55
+ 'import-x/imports-first': 'off',
56
+ // Forbid modules to have too many dependencies
57
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
58
+ 'import-x/max-dependencies': 'off',
59
+ // ensure named imports coupled with named exports
60
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/named.md#when-not-to-use-it
61
+ 'import-x/named': 'error',
62
+ // Enforces names exist at the time they are dereferenced
63
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/namespace.md
64
+ 'import-x/namespaces': 'error',
65
+ // Require a newline after the last import/require in a group
66
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/newline-after-import.md
67
+ 'import-x/newline-after-import': 'error',
68
+ // Forbid import of modules using absolute paths
69
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-absolute-path.md
70
+ 'import-x/no-absolute-path': 'error',
71
+ // disallow AMD require/define
72
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-amd.md
73
+ 'import-x/no-amd': 'error',
74
+ // Reports if a module's default export is unnamed
75
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-anonymous-default-export.md
76
+ 'import-x/no-anonymous-default-export': 'off',
77
+ // disallow require()
78
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-commonjs.md
79
+ 'import-x/no-commonjs': 'off',
80
+ // Forbid cyclical dependencies between modules
81
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-cycle.md
82
+ 'import-x/no-cycle': ['error', { maxDepth: '∞' }],
83
+ // Prohibit default exports
84
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-default-export.md
85
+ 'import-x/no-default-export': 'off',
53
86
  // disallow use of jsdoc-marked-deprecated imports
54
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
55
- 'import/no-deprecated': 'off',
87
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-deprecated.md
88
+ 'import-x/no-deprecated': 'off',
89
+ // disallow duplicate imports
90
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
91
+ 'import-x/no-duplicates': 'error',
92
+ // Forbid require() calls with expressions
93
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-dynamic-require.md
94
+ 'import-x/no-dynamic-require': 'error',
95
+ // Reports the use of empty named import blocks.
96
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-empty-named-blocks.md
97
+ 'import-x/no-empty-named-blocks': 'error',
56
98
  // Forbid the use of extraneous packages
57
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
58
- // paths are treated both as absolute paths, and relative to process.cwd()
59
- 'import/no-extraneous-dependencies': [
99
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
100
+ 'import-x/no-extraneous-dependencies': [
60
101
  'error',
61
102
  {
62
- devDependencies: [
63
- 'test/**', // tape, common npm pattern
64
- 'tests/**', // also common npm pattern
65
- 'spec/**', // mocha, rspec-like pattern
66
- '**/__tests__/**', // jest pattern
67
- '**/__mocks__/**', // jest pattern
68
- 'test.{js,jsx}', // repos with a single test file
69
- 'test-*.{js,jsx}', // repos with multiple top-level test files
70
- '**/*{.,_}{test,spec}.{js,jsx}', // tests where the extension or filename suffix denotes that it is a test
71
- '**/jest.config.js', // jest config
72
- '**/jest.setup.js', // jest setup
73
- '**/vue.config.js', // vue-cli config
74
- '**/webpack.config.js', // webpack config
75
- '**/webpack.config.*.js', // webpack config
76
- '**/rollup.config.js', // rollup config
77
- '**/rollup.config.*.js', // rollup config
78
- '**/gulpfile.js', // gulp config
79
- '**/gulpfile.*.js', // gulp config
80
- '**/Gruntfile{,.js}', // grunt config
81
- '**/protractor.conf.js', // protractor config
82
- '**/protractor.conf.*.js', // protractor config
83
- '**/karma.conf.js', // karma config
84
- '**/.eslintrc.js', // eslint config
85
- ],
103
+ devDependencies: (0, getDevDepsList_1.getDevDepsList)(utils_1.jsExtensions.join(',')),
86
104
  optionalDependencies: false,
105
+ peerDependencies: true,
106
+ bundledDependencies: true,
87
107
  },
88
108
  ],
89
- // Forbid mutable exports
90
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
91
- 'import/no-mutable-exports': 'error',
92
- // Module systems:
93
- // disallow require()
94
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
95
- 'import/no-commonjs': 'off',
96
- // disallow AMD require/define
97
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md
98
- 'import/no-amd': 'error',
99
- // No Node.js builtin modules
100
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
101
- // TODO: enable?
102
- 'import/no-nodejs-modules': 'off',
103
- // Style guide:
104
- // disallow non-import statements appearing before import statements
105
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
106
- 'import/first': 'error',
107
- // disallow non-import statements appearing before import statements
108
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/imports-first.md
109
- // deprecated: use `import/first`
110
- 'import/imports-first': 'off',
111
- // disallow duplicate imports
112
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
113
- 'import/no-duplicates': 'error',
114
- // disallow namespace imports
115
- // TODO: enable?
116
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
117
- 'import/no-namespace': 'off',
118
- // Ensure consistent use of file extension within the import path
119
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md
120
- 'import/extensions': [
109
+ // Reports the use of import declarations with CommonJS exports in any module except for the main module.
110
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-import-module-exports.md
111
+ 'import-x/no-import-module-exports': [
121
112
  'error',
122
- 'ignorePackages',
123
113
  {
124
- js: 'never',
125
- mjs: 'never',
126
- jsx: 'never',
114
+ exceptions: [],
127
115
  },
128
116
  ],
129
- // ensure absolute imports are above relative imports and that unassigned imports are ignored
130
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
131
- // TODO: enforce a stricter convention in module import order?
132
- 'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
133
- // Require a newline after the last import/require in a group
134
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
135
- 'import/newline-after-import': 'error',
136
- // Require modules with a single export to use a default export
137
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
138
- 'import/prefer-default-export': 'error',
139
- // Restrict which files can be imported in a given folder
140
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
141
- 'import/no-restricted-paths': 'off',
142
- // Forbid modules to have too many dependencies
143
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
144
- 'import/max-dependencies': ['off', { max: 10 }],
145
- // Forbid import of modules using absolute paths
146
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
147
- 'import/no-absolute-path': 'error',
148
- // Forbid require() calls with expressions
149
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
150
- 'import/no-dynamic-require': 'error',
151
117
  // prevent importing the submodules of other modules
152
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
153
- 'import/no-internal-modules': [
154
- 'off',
155
- {
156
- allow: [],
157
- },
158
- ],
159
- // Warn if a module could be mistakenly parsed as a script by a consumer
160
- // leveraging Unambiguous JavaScript Grammar
161
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
162
- // this should not be enabled until this proposal has at least been *presented* to TC39.
163
- // At the moment, it's not a thing.
164
- 'import/unambiguous': 'off',
165
- // Forbid Webpack loader syntax in imports
166
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
167
- 'import/no-webpack-loader-syntax': 'error',
168
- // Prevent unassigned imports
169
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
170
- // importing for side effects is perfectly acceptable, if you need side effects.
171
- 'import/no-unassigned-import': 'off',
118
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-internal-modules.md
119
+ 'import-x/no-internal-modules': 'off',
120
+ // Forbid mutable exports
121
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-mutable-exports.md
122
+ 'import-x/no-mutable-exports': 'error',
123
+ // warn on accessing default export property names that are also named exports
124
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default-member.md
125
+ 'import-x/no-named-as-default-member': 'error',
126
+ // do not allow a default import name to match a named export
127
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-as-default.md
128
+ 'import-x/no-named-as-default': 'error',
172
129
  // Prevent importing the default as if it were named
173
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
174
- 'import/no-named-default': 'error',
175
- // Reports if a module's default export is unnamed
176
- // https://github.com/import-js/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
177
- 'import/no-anonymous-default-export': [
178
- 'off',
179
- {
180
- allowArray: false,
181
- allowArrowFunction: false,
182
- allowAnonymousClass: false,
183
- allowAnonymousFunction: false,
184
- allowLiteral: false,
185
- allowObject: false,
186
- },
187
- ],
188
- // This rule enforces that all exports are declared at the bottom of the file.
189
- // https://github.com/import-js/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
190
- // TODO: enable?
191
- 'import/exports-last': 'off',
192
- // Reports when named exports are not grouped together in a single export declaration
193
- // or when multiple assignments to CommonJS module.exports or exports object are present
194
- // in a single file.
195
- // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
196
- 'import/group-exports': 'off',
197
- // forbid default exports. this is a terrible rule, do not use it.
198
- // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
199
- 'import/no-default-export': 'off',
130
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-default.md
131
+ 'import-x/no-named-default': 'error',
200
132
  // Prohibit named exports. this is a terrible rule, do not use it.
201
- // https://github.com/import-js/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
202
- 'import/no-named-export': 'off',
133
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-named-export.md
134
+ 'import-x/no-named-export': 'off',
135
+ // disallow namespace imports
136
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-namespace.md
137
+ 'import-x/no-namespace': 'off',
138
+ // No Node.js builtin modules
139
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-nodejs-modules.md
140
+ 'import-x/no-nodejs-modules': 'off',
141
+ // Use this rule to prevent importing packages through relative paths.
142
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-packages.md
143
+ 'import-x/no-relative-packages': 'error',
144
+ // Use this rule to prevent imports to folders in relative parent paths.
145
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-relative-parent-imports.md
146
+ 'import-x/no-relative-parent-imports': 'off',
147
+ // Prohibit importing a default export by another name.
148
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-rename-default.md
149
+ 'import-x/no-rename-default': 'warn',
150
+ // Restrict which files can be imported in a given folder
151
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-restricted-paths.md
152
+ 'import-x/no-restricted-paths': 'off',
203
153
  // Forbid a module from importing itself
204
- // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
205
- 'import/no-self-import': 'error',
206
- // Forbid cyclical dependencies between modules
207
- // https://github.com/import-js/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
208
- 'import/no-cycle': ['error', { maxDepth: '∞' }],
209
- // Ensures that there are no useless path segments
210
- // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
211
- 'import/no-useless-path-segments': ['error', { commonjs: true }],
212
- // dynamic imports require a leading comment with a webpackChunkName
213
- // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
214
- 'import/dynamic-import-chunkname': [
215
- 'off',
154
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-self-import.md
155
+ 'import-x/no-self-import': 'error',
156
+ // Prevent unassigned imports
157
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unassigned-import.md
158
+ // importing for side effects is perfectly acceptable, if you need side effects.
159
+ 'import-x/no-unassigned-import': 'off',
160
+ // ensure imports point to files/modules that can be resolved
161
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
162
+ 'import-x/no-unresolved': [
163
+ 'error',
216
164
  {
217
- importFunctions: [],
218
- webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
165
+ commonjs: true,
166
+ caseSensitive: true,
219
167
  },
220
168
  ],
221
- // Use this rule to prevent imports to folders in relative parent paths.
222
- // https://github.com/import-js/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
223
- 'import/no-relative-parent-imports': 'off',
224
169
  // Reports modules without any exports, or with unused exports
225
- // https://github.com/import-js/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
226
- // TODO: enable once it supports CJS
227
- 'import/no-unused-modules': [
170
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unused-modules.md
171
+ 'import-x/no-unused-modules': [
228
172
  'off',
229
173
  {
230
174
  ignoreExports: [],
@@ -232,25 +176,28 @@ exports.importConfig = {
232
176
  unusedExports: true,
233
177
  },
234
178
  ],
235
- // Reports the use of import declarations with CommonJS exports in any module except for the main module.
236
- // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md
237
- 'import/no-import-module-exports': [
179
+ // Ensures that there are no useless path segments
180
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-useless-path-segments.md
181
+ 'import-x/no-useless-path-segments': [
238
182
  'error',
239
183
  {
240
- exceptions: [],
184
+ noUselessIndex: true,
185
+ commonjs: true,
241
186
  },
242
187
  ],
243
- // Use this rule to prevent importing packages through relative paths.
244
- // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md
245
- 'import/no-relative-packages': 'error',
246
- // enforce a consistent style for type specifiers (inline or top-level)
247
- // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md
248
- // TODO, semver-major: enable (just in case)
249
- 'import/consistent-type-specifier-style': ['off', 'prefer-inline'],
250
- // Reports the use of empty named import blocks.
251
- // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md
252
- // TODO, semver-minor: enable
253
- 'import/no-empty-named-blocks': 'off',
254
- },
255
- };
256
- exports.default = Object.assign(Object.assign({}, EsLintPluginImport.flatConfigs.recommended), exports.importConfig);
188
+ // Forbid Webpack loader syntax in imports
189
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-webpack-loader-syntax.md
190
+ 'import-x/no-webpack-loader-syntax': 'error',
191
+ // ensure absolute imports are above relative imports and that unassigned imports are ignored
192
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/order.md
193
+ 'import-x/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
194
+ // Require modules with a single export to use a default export
195
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/prefer-default-export.md
196
+ 'import-x/prefer-default-export': 'error',
197
+ // Warn if a module could be mistakenly parsed as a script by a consumer
198
+ // leveraging Unambiguous JavaScript Grammar
199
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/unambiguous.md
200
+ // this should not be enabled until this proposal has at least been *presented* to TC39.
201
+ // At the moment, it's not a thing.
202
+ 'import-x/unambiguous': 'off',
203
+ } });