Skip to content

Commit f4f6b39

Browse files
committed
Add auto-fix for fixing file extensions in imports
Fixes #386 (comment)
1 parent 32bd3b8 commit f4f6b39

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

config/plugins.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,20 @@ module.exports = {
180180
'promise/prefer-await-to-then': 'error',
181181
'import/default': 'error',
182182
'import/export': 'error',
183-
'import/extensions': [
184-
'error',
185-
'always',
186-
{
187-
ignorePackages: true,
188-
// TypeScript doesn't yet support using extensions and fails with error TS2691.
189-
pattern: {
190-
ts: 'never',
191-
tsx: 'never'
192-
}
193-
}
194-
],
183+
184+
// Disabled as we use `node/file-extension-in-import` instead as it has an auto-fix.
185+
// 'import/extensions': [
186+
// 'error',
187+
// 'always',
188+
// {
189+
// ignorePackages: true,
190+
// // TypeScript doesn't yet support using extensions and fails with error TS2691.
191+
// pattern: {
192+
// ts: 'never',
193+
// tsx: 'never'
194+
// }
195+
// }
196+
// ],
195197

196198
// Disabled as it causes problems with TypeScript when you use mixed ESM and CommonJS.
197199
// TODO: Enable again when I target only ESM.
@@ -275,6 +277,15 @@ module.exports = {
275277
// 'node/no-missing-require': 'error',
276278

277279
'node/no-unpublished-bin': 'error',
280+
'node/file-extension-in-import': [
281+
'error',
282+
'always',
283+
{
284+
// TypeScript doesn't yet support using extensions and fails with error TS2691.
285+
'.ts': 'never',
286+
'.tsx': 'never'
287+
}
288+
],
278289
'node/no-mixed-requires': [
279290
'error',
280291
{

0 commit comments

Comments
 (0)