mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix ESLint config around files w/ CommonJS imports (#14380)
The `parserOptions.sourceType` config option in `.eslintrc.js` is used to distinguish files that use ESM imports vs. files that do not. The `import` plugin, specifically the `import/ambiguous` rule behaves differently depending on this value. If a file is marked with `sourceType` of `"module"`, then this rule will attempt to ensure that the file does indeed have ESM imports and/or exports; otherwise it does nothing. In other words, files that use CJS imports are *not* "modules" according to this setting, and therefore should not be marked with a `sourceType` of `"module"`. This means we do not have to turn off the `import/ambiguous` rule, as it will no longer trip up on these types of files.
This commit is contained in:
parent
095cc94ed0
commit
c25c0432ed
@ -44,14 +44,6 @@ module.exports = {
|
|||||||
path.resolve(__dirname, '.eslintrc.babel.js'),
|
path.resolve(__dirname, '.eslintrc.babel.js'),
|
||||||
path.resolve(__dirname, '.eslintrc.typescript-compat.js'),
|
path.resolve(__dirname, '.eslintrc.typescript-compat.js'),
|
||||||
],
|
],
|
||||||
parserOptions: {
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// This rule does not work with CommonJS modules. We will just have to
|
|
||||||
// trust that all of the files specified above are indeed modules.
|
|
||||||
'import/unambiguous': 'off',
|
|
||||||
},
|
|
||||||
settings: {
|
settings: {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
// When determining the location of a `require()` call, use Node's
|
// When determining the location of a `require()` call, use Node's
|
||||||
|
Loading…
x
Reference in New Issue
Block a user