Custom ESLint Rules for ZOWE Explorer
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-zowe-explorer
:
$ npm install eslint-plugin-zowe-explorer --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-zowe-explorer
globally.
Add zowe-explorer
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["zowe-explorer"]
}
Then configure the rules you want to use under the rules section.
For example to disallow the use of unmocked fs
module in unit tests
(whose file name contains .unit.test.
) specify this rule config
{
"rules": {
"zowe-explorer/no-unmocked-core-modules": ["error", { "coreModuleNames": ["fs"], "filePathPattern": ".*\\.unit\\.test\\..*" }]
}
}
- no-unmocked-core-modules