Skip to content

Commit

Permalink
[Tests] configure ESLint overrides to parse arbitrary module namespac…
Browse files Browse the repository at this point in the history
…e names
  • Loading branch information
sosukesuzuki committed Jan 22, 2022
1 parent 675326a commit fff8786
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions tests/files/.eslintrc → tests/files/.eslintrc.js
@@ -1,4 +1,9 @@
{
const eslintPkg = require('eslint/package.json');
const semver = require('semver');

const supportsArbitraryModuleNamespaceIdentifierNames = semver.satisfies(eslintPkg.version, '>= 8.7');

const config = {
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
Expand Down Expand Up @@ -281,5 +286,36 @@
"import/no-duplicates": 0,
"import/no-extraneous-dependencies": 0,
"import/unambiguous": 0
}
},
ignorePatterns: [
"default-export-namespace-string.js",
"default-export-string.js",
"export-default-string-and-named.js",
"no-unused-modules/arbitrary-module-namespace-identifier-name-a.js",
"no-unused-modules/arbitrary-module-namespace-identifier-name-b.js",
"no-unused-modules/arbitrary-module-namespace-identifier-name-c.js"
],
}

if (supportsArbitraryModuleNamespaceIdentifierNames) {
config.ignorePatterns = [];
config.overrides = [
// For parsing arbitrary module namespace names
{
"files": [
"default-export-namespace-string.js",
"default-export-string.js",
"export-default-string-and-named.js",
"no-unused-modules/arbitrary-module-namespace-identifier-name-a.js",
"no-unused-modules/arbitrary-module-namespace-identifier-name-b.js",
"no-unused-modules/arbitrary-module-namespace-identifier-name-c.js"
],
"parser": "espree",
"parserOptions": {
"ecmaVersion": 2022
}
}
];
}

module.exports = config;

0 comments on commit fff8786

Please sign in to comment.