1.1.1 • Published 3 years ago
eslint-plugin-code-isolation v1.1.1
Code Isolation plugin for ESLint
This plugin contains rules to help isolate one part of the project from another.
Demo project: eslint-plugin-code-isolation-demo
Installation
npm install --save-dev eslint-plugin-code-isolation
eslintrc.js:
module.exports = {
plugins: ["code-isolation"]
};
Rules
disallow-by-regexp
eslintrc.js:
"code-isolation/disallow-by-regexp": [
"error",
{
allow: Array<string | RegExp>,
base: __dirname,
disallow: Array<string | RegExp>,
strings: Array<string | RegExp>
},
...
]
allow - Allowed locations, paths relative to base
disallow - Disallowed locations, paths relative to base
strings - Disallowed strings in source code
disallow-identifier
eslintrc.js:
"code-isolation/disallow-identifier": [
"error",
{
allow: Array<string | RegExp>,
base: __dirname,
disallow: Array<string | RegExp>,
ids: Array<string>
},
...
]
ids - Disallowed identifiers
disallow-import
eslintrc.js:
"code-isolation/disallow-import": [
"error",
{
allow: Array<string | RegExp>,
allowSources: Array<string | RegExp>,
base: __dirname,
disallow: Array<string | RegExp>,
disallowSources: Array<string | RegExp>
},
...
]
allowSources - Allowed import sources
disallowSources - Disallowed import sources