Skip to content

Commit bbf0589

Browse files
committed
Configure import/extensions for ESM
1 parent 0809532 commit bbf0589

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

docs/javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Refer to [setup instructions in README](../README.md#🏗️-setup).
191191
| [![@typescript-eslint](./icons/material/typescript.png)](https://typescript-eslint.io/) | [prefer-function-type](https://typescript-eslint.io/rules/prefer-function-type)<br />Enforce using function types instead of interfaces with call signatures | | 🔧 | |
192192
| [![functional](./icons/icons8/lambda.png)](https://github.com/eslint-functional/eslint-plugin-functional#readme) | [no-let](https://github.com/eslint-functional/eslint-plugin-functional/blob/v7.0.0/docs/rules/no-let.md)<br />Disallow mutable variables. | | | 🧪🚫 |
193193
| [![functional](./icons/icons8/lambda.png)](https://github.com/eslint-functional/eslint-plugin-functional#readme) | [no-loop-statements](https://github.com/eslint-functional/eslint-plugin-functional/blob/v7.0.0/docs/rules/no-loop-statements.md)<br />Disallow imperative loops. | | | |
194-
| [![import](./icons/icons8/import.png)](https://github.com/import-js/eslint-plugin-import#readme) | [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/extensions.md)<br />Ensure consistent use of file extension within the import path. | <details><summary>never, json: always</summary><pre lang="json"><code>[&#13; "never",&#13; {&#13; "json": "always"&#13; }&#13;]</code></pre></details> | | |
194+
| [![import](./icons/icons8/import.png)](https://github.com/import-js/eslint-plugin-import#readme) | [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/extensions.md)<br />Ensure consistent use of file extension within the import path. | <details><summary>always, ignorePackages: tru...</summary><pre lang="json"><code>[&#13; "always",&#13; {&#13; "ignorePackages": true,&#13; "checkTypeImports": true&#13; }&#13;]</code></pre></details> | | |
195195
| [![import](./icons/icons8/import.png)](https://github.com/import-js/eslint-plugin-import#readme) | [max-dependencies](https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/max-dependencies.md)<br />Enforce the maximum number of dependencies a module can have. | <details><summary>ignoreTypeImports: true</summary><pre lang="json"><code>{&#13; "ignoreTypeImports": true&#13;}</code></pre></details> | | |
196196
| [![import](./icons/icons8/import.png)](https://github.com/import-js/eslint-plugin-import#readme) | [no-anonymous-default-export](https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/no-anonymous-default-export.md)<br />Forbid anonymous values as default exports. | | | |
197197
| [![import](./icons/icons8/import.png)](https://github.com/import-js/eslint-plugin-import#readme) | [no-duplicates](https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/no-duplicates.md)<br />Forbid repeated import of the same module in multiple places. | | 🔧 | |

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import vitest from './src/configs/vitest.js';
77
export default tseslint.config(...node, ...vitest, {
88
rules: {
99
'@typescript-eslint/no-magic-numbers': 'off',
10-
'import/extensions': ['error', { js: 'always', json: 'never' }],
1110
},
1211
settings: {
1312
'import/resolver': {

src/configs/javascript.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ export default tseslint.config(
160160
'@typescript-eslint/no-shadow': 'warn',
161161

162162
// https://github.com/import-js/eslint-plugin-import#rules
163-
'import/extensions': ['warn', 'never', { json: 'always' }],
163+
'import/extensions': [
164+
'warn',
165+
'always',
166+
{ ignorePackages: true, checkTypeImports: true },
167+
],
164168
'import/max-dependencies': ['warn', { ignoreTypeImports: true }],
165169
'import/no-absolute-path': 'error',
166170
'import/no-amd': 'error',

0 commit comments

Comments
 (0)