Skip to content

Commit 2a998b3

Browse files
authored
Warn on unused ESLint disable directives in base config (#829)
1 parent d6bac22 commit 2a998b3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ Install alongside ESLint via yarn (or npm):
1818
yarn add --dev eslint eslint-plugin-square npm-run-all
1919
```
2020

21-
Edit your `.eslintrc.js` configuration file to extend one of the available configurations from this plugin and [detect unused disable directives](https://eslint.org/docs/latest/user-guide/configuring/rules#report-unused-eslint-disable-comments):
21+
Edit your `.eslintrc.js` configuration file to extend one of the available configurations from this plugin:
2222

2323
```js
2424
module.exports = {
25-
reportUnusedDisableDirectives: true,
2625
extends: ['plugin:square/base'], // Or other configuration.
2726
};
2827
```
2928

30-
Add the relevant lint scripts in `package.json` with [npm-run-all](https://github.com/mysticatea/npm-run-all):
29+
Add the relevant lint scripts in `package.json` with [npm-run-all](https://github.com/mysticatea/npm-run-all) and include detection for [unused disable directives](https://eslint.org/docs/latest/user-guide/command-line-interface#--report-unused-disable-directives):
3130

3231
```json
3332
{

lib/config/base.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// This configuration is intended for use with JavaScript applications.
44

55
module.exports = {
6+
reportUnusedDisableDirectives: true, // Warn on unused disable directives: https://eslint.org/docs/latest/user-guide/configuring/rules#report-unused-eslint-disable-comments
67
extends: [
78
'eslint:recommended',
89
'plugin:eslint-comments/recommended',

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"lint": "npm-run-all --continue-on-error --aggregate-output --parallel lint:*",
2929
"lint:docs": "markdownlint \"**/*.md\"",
3030
"lint:eslint-docs": "npm-run-all \"update:eslint-docs -- --check\"",
31-
"lint:js": "eslint --cache .",
31+
"lint:js": "eslint --report-unused-disable-directives --cache .",
3232
"lint:package-json": "npmPkgJsonLint .",
3333
"lint:package-json-sorting": "sort-package-json --check",
3434
"lint:package-json-sorting:fix": "sort-package-json package.json",

0 commit comments

Comments
 (0)