Gathering detailed insights and metrics for eslint-plugin-disable
Gathering detailed insights and metrics for eslint-plugin-disable
Gathering detailed insights and metrics for eslint-plugin-disable
Gathering detailed insights and metrics for eslint-plugin-disable
npm install eslint-plugin-disable
Typescript
Module System
Node Version
NPM Version
80.3
Supply Chain
94
Quality
74.1
Maintenance
100
Vulnerability
98.6
License
JavaScript (100%)
Total Downloads
4,134,029
Last Day
433
Last Week
11,404
Last Month
83,900
Last Year
966,341
56 Stars
86 Commits
3 Forks
4 Watching
5 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
2.0.3
Package Id
eslint-plugin-disable@2.0.3
Unpacked Size
64.90 kB
Size
12.73 kB
File Count
30
NPM Version
8.1.3
Node Version
12.22.7
Publised On
15 Nov 2021
Cumulative downloads
Total Downloads
Last day
-89.3%
433
Compared to previous day
Last week
-40%
11,404
Compared to previous week
Last month
-19.8%
83,900
Compared to previous month
Last year
-6.3%
966,341
Compared to previous year
Disable ESLint plugins using file path patterns and inline comments
..which means all disabled plugins' errors and warnings won't appear in ESLint report.
Example: inline comments:
1/* eslint-plugin-disable react */ 2 3function greet(name) { 4 console.log('Hi, ' + name); 5}
Example: file path patterns (.eslintrc):
1{ 2 "plugins": ["react", "disable"], 3 "processor": "disable/disable", 4 "overrides": [ 5 { 6 "files": ["tests/**/*.test.js"], 7 "settings": { 8 "disable/plugins": ["react"] 9 } 10 } 11 ] 12}
1npm install eslint-plugin-disable --save-dev
Add plugin to a config file (.eslintrc) and make it default processor:
1{ 2 "plugins": ["disable"], 3 "processor": "disable/disable" 4}
Plugin adds a custom directive to use in files in a form of inline comment, which allows to disable entire plugins for this file. Plugin names have to be the same as in ESLint config file, separated by comma.
The following directive will disable "react" and "jsx-a11y" plugins for this particular file.
1/* eslint-plugin-disable react, jsx-a11y */ 2 3function greet(name) { 4 console.log('Hi, ' + name); 5}
If no any plugins provided - all plugins registered in ESLint config will be disabled:
1/* eslint-plugin-disable */ 2 3function greet(name) { 4 console.log('Hi, ' + name); 5}
Another custom option allows to disable all plugins except ones that are specified. It might be useful when there are a lot of plugins in the project and it is required to use one or two of them for particular files, usage of regular disable syntax might be cumbersome to maintain if there are plans to add new plugins to the project. Plugin names have to be the same as in ESLint config file, separated by comma.
The following directive will disable all plugins registered in ESLint config except "react" and "jsx-a11y".
1/* eslint-plugin-disable-all-except react, jsx-a11y */ 2 3function greet(name) { 4 console.log('Hi, ' + name); 5}
Notes:
To disable plugins for file paths use new ESLint 6+ Overrides feature in config (.eslintrc). It has many different configurations for glob path patterns, ignore patterns and it basically creates a nested config for a list of files (ESLint docs for more info). This list of files should be assigned with a "disable/disable" processor in order for plugin to work. You can have multiple "overrides" entries with different paths and different plugins to disable.
The following config will:
1{ 2 "plugins": ["import", "react", "jsx-a11y", "disable"], 3 "processor": "disable/disable", 4 "overrides": [ 5 { 6 "files": ["tests/**/*.test.js"], 7 "settings": { 8 "disable/plugins": ["import", "jsx-a11y"] 9 } 10 }, 11 { 12 "files": ["lib/*.js"], 13 "settings": { 14 "disable/plugins": ["react"] 15 } 16 } 17 ] 18}
To disable all registered plugins you can simply omit "disable/plugins" setting or use a star in place of plugin name:
1{ 2 "plugins": ["import", "react", "jsx-a11y", "disable"], 3 "processor": "disable/disable", 4 "overrides": [ 5 { 6 "files": ["tests/**/*.test.js"], 7 "settings": { 8 "disable/plugins": "*" 9 } 10 } 11 ] 12}
To disable all plugins except specified ones use "disableAllExcept" flag in config settings (.eslintrc).
The following config will disable all registered plugins except "react" for all files mathing "tests/**/*.test.js" glob pattern ("import" and "jsx-a11y" will be disabled).
1{ 2 "plugins": ["import", "react", "jsx-a11y", "disable"], 3 "processor": "disable/disable", 4 "overrides": [ 5 { 6 "files": ["tests/**/*.test.js"], 7 "settings": { 8 "disable/disableAllExcept": true, 9 "disable/plugins": ["react"] 10 } 11 } 12 ] 13}
Some ESLint plugins also use processors, which creates a conflict with this plugin, because ESLint does not allow to chain processors for the same source files without processing it and producing another files. There is a setting "externalProcessor", which accepts a processor identifier "pluginName/processorName" and makes this plugin to call other plugin's processor before disabling the rules.
One of the cases is "eslint-plugin-vue":
1{ 2 "plugins": ["vue", "disable"], 3 "processor": "disable/disable", 4 "settings": { 5 "disable/plugins": ["vue"], 6 "disable/externalProcessor": "vue/.vue" 7 } 8}
As a plugin might export multiple processors, the only way to find out what "processorName" to use, is to browse plugin's sources. If you don't know it, then you can just skip "processorName" in identifier and only leave "pluginName" - this way the first available processor will be auto-picked.
1{ 2 "plugins": ["vue", "disable"], 3 "processor": "disable/disable", 4 "settings": { 5 "disable/plugins": ["vue"], 6 "disable/externalProcessor": "vue" 7 } 8}
All the options are not merged together, there is a strict order in which they apply:
If first option applies, then only plugins mentioned in this option will be used to disable, the rest of the options down the list will be ignored. If first and second options do not apply (no inline comments in file), but third option does apply, then only plugins mentioned in third option will be used to disable, the rest will be ignored.
eslint | eslint-plugin-disable |
---|---|
>= 0.16.0 <6.0.0 | <=1.0.5 |
>=6.0.0 | >=2.0.0 |
Unfortunately this feature is not natively supported in ESLint yet, so this module may become a temporary workaround. Read the following issues for additional information:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More