Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable import/named rule for JavaScript #601

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -350,6 +350,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