ESLint plugin with rules for module interoperability
npm install eslint-plugin-module-interopeslint-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.
``bash`
npm install --save-dev eslint eslint-plugin-module-interop
#### New Config (eslint.config.js)
Use eslint.config.js file to configure rules. See also:
Example eslint.config.js:
`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.
#### Legacy Config (.eslintrc)
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) | | |{type: "json"}
| module-interop/prefer-json-modules | enforce json imports to have the 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).