Skip to content

Commit

Permalink
Add auto-fix for fixing file extensions in imports
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 20, 2021
1 parent 32bd3b8 commit f4f6b39
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions config/plugins.js
Expand Up @@ -180,18 +180,20 @@ module.exports = {
'promise/prefer-await-to-then': 'error',
'import/default': 'error',
'import/export': 'error',
'import/extensions': [
'error',
'always',
{
ignorePackages: true,
// TypeScript doesn't yet support using extensions and fails with error TS2691.
pattern: {
ts: 'never',
tsx: 'never'
}
}
],

// Disabled as we use `node/file-extension-in-import` instead as it has an auto-fix.
// 'import/extensions': [
// 'error',
// 'always',
// {
// ignorePackages: true,
// // TypeScript doesn't yet support using extensions and fails with error TS2691.
// pattern: {
// ts: 'never',
// tsx: 'never'
// }
// }
// ],

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

'node/no-unpublished-bin': 'error',
'node/file-extension-in-import': [
'error',
'always',
{
// TypeScript doesn't yet support using extensions and fails with error TS2691.
'.ts': 'never',
'.tsx': 'never'
}
],
'node/no-mixed-requires': [
'error',
{
Expand Down

0 comments on commit f4f6b39

Please sign in to comment.