1.4.1 • Published 3 years ago
@typelib/eslint-plugin-code-isolation v1.4.1
Code Isolation plugin for ESLint
ESLint rules that help isolate one part of the project from another.
Demo project: eslint-plugin-code-isolation-demo
Installation
npm install --save-dev @typelib/eslint-plugin-code-isolation
eslintrc.js:
module.exports = {
plugins: ["@typelib/code-isolation"]
};
Rules
disallow-by-regexp
eslintrc.js:
"@typelib/code-isolation/disallow-by-regexp": [
"error",
{
allow?: Array<string | RegExp>,
base?: __dirname,
disallow?: Array<string | RegExp>,
replacement?: string,
strings: Array<string | RegExp>
},
...
]
allow - Allowed locations, paths relative to base
disallow - Disallowed locations, paths relative to base
replacement - Replacement
strings - Disallowed strings in source code
disallow-identifier
eslintrc.js:
"@typelib/code-isolation/disallow-identifier": [
"error",
{
allow?: Array<string | RegExp>,
base?: __dirname,
disallow?: Array<string | RegExp>,
ids: Array<string>,
replacement?: string
},
...
]
ids - Disallowed identifiers
disallow-import
eslintrc.js:
"@typelib/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