eslint-plugin-module-interop is ESLint plugin with rules for module interoperability.
ESLint plugin with rules for module interoperability.
You can check on the Online DEMO.
See documents.
npm install --save-dev eslint eslint-plugin-module-interop
Use eslint.config.js
file to configure rules. See also: https://eslint.org/docs/latest/use/configure/configuration-files-new.
Example eslint.config.js:
import moduleInterop from 'eslint-plugin-module-interop';
export default [
// add more generic rule sets here, such as:
// js.configs.recommended,
moduleInterop.configs.recommended,
{
rules: {
// override/add rules settings here, such as:
// 'module-interop/no-import-cjs': 'error'
}
}
];
This plugin provides configs:
-
*.configs.recommended
... Recommended config provided by the plugin.
See the rule list to get the rules
that this plugin provides.
Is not supported.
The --fix
option on the command line automatically fixes problems reported by rules which have a wrench 🔧 below.
The rules with the following star ⭐ are included in the configs.
Rule ID | Description | Fixable | RECOMMENDED |
---|---|---|---|
module-interop/no-import-cjs | disallow importing CommonJS modules | ||
module-interop/no-require-esm | disallow require(esm)
|
||
module-interop/prefer-json-modules | enforce json imports to have the {type: "json"} attribute. |
⭐ |
Welcome contributing!
Please use GitHub's Issues/PRs.
-
npm test
runs tests and measures coverage. -
npm run update
runs in order to update readme and recommended configuration.
See the LICENSE file for license rights and limitations (MIT).