Skip to content

Commit

Permalink
Enable import/named rule for JavaScript (xojs#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch authored and devinrhode2 committed Oct 8, 2021
1 parent 47dd820 commit 5ae64a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 2 additions & 3 deletions config/plugins.cjs
Expand Up @@ -200,9 +200,8 @@ module.exports = {
],
'import/first': 'error',

// Disabled as it doesn't work with TypeScript.
// This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341
// 'import/named': 'error',
// Enabled, but disabled on TypeScript (https://github.com/xojs/xo/issues/576)
'import/named': 'error',

'import/namespace': [
'error',
Expand Down
4 changes: 4 additions & 0 deletions lib/options-manager.js
Expand Up @@ -413,6 +413,10 @@ const buildXOConfig = options => config => {

// Does not work when the TS definition exports a default const.
config.baseConfig.rules['import/default'] = 'off';

// Disabled as it doesn't work with TypeScript.
// This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341
config.baseConfig.rules['import/named'] = 'off';
}

config.baseConfig.settings['import/resolver'] = gatherImportResolvers(options);
Expand Down
1 change: 1 addition & 0 deletions test/options-manager.js
Expand Up @@ -437,6 +437,7 @@ test('buildConfig: typescript', t => {
project: './tsconfig.json',
projectFolderIgnoreList: [/\/node_modules\/(?!.*\.cache\/xo-linter)/],
});
t.is(config.baseConfig.rules['import/named'], 'off');
});

test('buildConfig: typescript with parserOption', t => {
Expand Down

0 comments on commit 5ae64a9

Please sign in to comment.