diff --git a/demo/.eslintrc.js b/demo/.eslintrc.js index c51f737..0063229 100644 --- a/demo/.eslintrc.js +++ b/demo/.eslintrc.js @@ -1,6 +1,5 @@ module.exports = { rules: { - 'bestpractices/no-eslint-disable': 'error', 'sonarjs/no-duplicated-branches': 'error', 'deprecate/function': ['error', { name: 'deprecatedFunction', use: 'function x from package y' }], 'deprecate/import': ['error', { name: 'path/to/legacyModule', use: 'module x' }], diff --git a/demo/example.js b/demo/example.js index b273698..f1a3365 100644 --- a/demo/example.js +++ b/demo/example.js @@ -5,7 +5,11 @@ /* * Since developers have the ability to disable linting in-line, we keep track of the times where this is done, because if done irresponsibly, this is a significant code smell. */ -// eslint-disable-next +// eslint-disable-next-line +let unusedVariableThatTriggersLintingRule + +// eslint-disable-next-line no-unused-vars -- A comment to remove the warning of "require-description" +let unusedVariableThatTriggersLintingRule2 // fixMe: Actually make this work // todo: Add documentation diff --git a/demo/test/snapshots/linting-config.test.js.md b/demo/test/snapshots/linting-config.test.js.md index 7239868..84605a4 100644 --- a/demo/test/snapshots/linting-config.test.js.md +++ b/demo/test/snapshots/linting-config.test.js.md @@ -46,12 +46,12 @@ Generated by [AVA](https://ava.li). "you-dont-need-lodash-underscore",␊ "cypress",␊ "prettier",␊ + "@eslint-community/eslint-comments",␊ "test-selectors",␊ "sonarjs",␊ "promise",␊ "html",␊ - "deprecate",␊ - "bestpractices"␊ + "deprecate"␊ ],␊ "rules": {␊ "@babel/no-unused-expressions": [␊ @@ -69,6 +69,24 @@ Generated by [AVA](https://ava.li). "@babel/semi": [␊ "off"␊ ],␊ + "@eslint-community/eslint-comments/disable-enable-pair": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-aggregating-enable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-duplicate-disable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-unlimited-disable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-unused-enable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/require-description": [␊ + "warn"␊ + ],␊ "@fs/zion/logical-over-directional": [␊ "warn"␊ ],␊ @@ -725,9 +743,6 @@ Generated by [AVA](https://ava.li). "babel/semi": [␊ "off"␊ ],␊ - "bestpractices/no-eslint-disable": [␊ - "warn"␊ - ],␊ "block-scoped-var": [␊ "error"␊ ],␊ @@ -4142,12 +4157,12 @@ Generated by [AVA](https://ava.li). "@typescript-eslint",␊ "cypress",␊ "prettier",␊ + "@eslint-community/eslint-comments",␊ "test-selectors",␊ "sonarjs",␊ "promise",␊ "html",␊ - "deprecate",␊ - "bestpractices"␊ + "deprecate"␊ ],␊ "rules": {␊ "@babel/no-unused-expressions": [␊ @@ -4165,6 +4180,24 @@ Generated by [AVA](https://ava.li). "@babel/semi": [␊ "off"␊ ],␊ + "@eslint-community/eslint-comments/disable-enable-pair": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-aggregating-enable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-duplicate-disable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-unlimited-disable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/no-unused-enable": [␊ + "error"␊ + ],␊ + "@eslint-community/eslint-comments/require-description": [␊ + "warn"␊ + ],␊ "@fs/zion/logical-over-directional": [␊ "warn"␊ ],␊ @@ -4941,9 +4974,6 @@ Generated by [AVA](https://ava.li). "babel/semi": [␊ "off"␊ ],␊ - "bestpractices/no-eslint-disable": [␊ - "warn"␊ - ],␊ "block-scoped-var": [␊ "error"␊ ],␊ @@ -8269,61 +8299,62 @@ Generated by [AVA](https://ava.li). `␊ example.js␊ - 8:0 error Found eslint-disable without " -- comment" bestpractices/no-eslint-disable␊ - 10:1 warning Unexpected 'FIXME' comment: 'fixMe: Actually make this work' no-warning-comments␊ - 11:1 warning Unexpected 'TODO' comment: 'todo: Add documentation' no-warning-comments␊ - 12:1 warning Unexpected 'HACK' comment: 'Hack: Note that these work, regardless...' no-warning-comments␊ - 19:10 error 'functionWithoutJSDocWarningsBecauseTheSectionWasCompletelyExcluded' is defined but never used no-unused-vars␊ - 24:1 warning Remove the @description tag to leave a plain block description or add additional description text above the @description line jsdoc/require-description␊ - 24:1 warning JSDoc @returns declaration present but return expression not available in function jsdoc/require-returns-check␊ - 24:1 warning JSDoc type missing brace valid-jsdoc␊ - 25:1 warning JSDoc description does not satisfy the regex pattern jsdoc/match-description␊ - 26:1 warning Expected @param names to be "params". Got "a, params, b" jsdoc/check-param-names␊ - 26:1 warning Missing JSDoc @param "a" description jsdoc/require-param-description␊ - 27:1 warning Missing JSDoc @param "params" description jsdoc/require-param-description␊ - 27:1 warning Missing JSDoc @param "params" type jsdoc/require-param-type␊ - 28:1 warning Missing JSDoc @param "b" description jsdoc/require-param-description␊ - 28:1 warning Missing JSDoc @param "b" type jsdoc/require-param-type␊ - 29:1 warning Missing JSDoc @returns description jsdoc/require-returns-description␊ - 29:1 warning Missing JSDoc @returns type jsdoc/require-returns-type␊ - 31:71 error 'params' is defined but never used no-unused-vars␊ - 36:1 warning Invalid JSDoc tag name "note" jsdoc/check-tag-names␊ - 38:1 warning Expected catch() or return promise/catch-or-return␊ - 38:17 error 'a' is defined but never used no-unused-vars␊ - 38:20 error Expected to return a value at the end of arrow function consistent-return␊ - 39:3 warning Each then() should return a value or throw promise/always-return␊ - 39:7 warning Unexpected constant condition no-constant-condition␊ - 40:5 warning Avoid wrapping return values in Promise.resolve promise/no-return-wrap␊ - 41:10 error Unnecessary 'else' after 'return' no-else-return␊ - 42:5 error 'forgotToDefine' is not defined no-undef␊ - 46:7 error 'variable' is assigned a value but never used no-unused-vars␊ - 46:18 warning This conditional operation returns the same value whether the condition is "true" or "false" sonarjs/no-all-duplicated-branches␊ - 46:18 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary␊ - 46:18 warning Unexpected constant condition no-constant-condition␊ - 49:7 warning Correct one of the identical sub-expressions on both sides of operator "&&" sonarjs/no-identical-expressions␊ - 49:55 error 'params' is not defined no-undef␊ - 50:5 warning This function expects 1 argument, but 2 were provided sonarjs/no-extra-arguments␊ - 51:30 error Module path/to/legacyModule is deprecated. Use module x instead deprecate/import␊ - 51:30 error Unexpected require() global-require␊ - 51:38 error Unable to resolve path to module 'path/to/legacyModule' import/no-unresolved␊ - 53:5 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function␊ - 53:5 error 'deprecatedFunction' is not defined no-undef␊ - 55:5 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression␊ - 55:5 error '$' is not defined no-undef␊ - 57:5 error Unexpected 'debugger' statement no-debugger␊ - 57:5 error Unreachable code no-unreachable␊ - 71:10 warning Update this function so that its implementation is not identical to the one on line 63 sonarjs/no-identical-functions␊ - 79:1 warning Remove this conditional structure or edit its code blocks so that they're not all the same sonarjs/no-all-duplicated-branches␊ - 79:5 warning This always evaluates to truthy. Consider refactoring this code sonarjs/no-gratuitous-expressions␊ - 79:5 warning Unexpected constant condition no-constant-condition␊ - 86:1 warning Reduce the number of non-empty switch cases from 16 to at most 15 sonarjs/max-switch-cases␊ - 91:5 error Expected a default case default-case␊ - 91:5 warning Refactor the code to eliminate this nested "switch" sonarjs/no-nested-switch␊ - 96:7 error This case's code block is the same as the block for the case on line 92 sonarjs/no-duplicated-branches␊ - 96:7 error Duplicate case label no-duplicate-case␊ - 96:12 warning This case duplicates the one on line 92 sonarjs/no-identical-conditions␊ - 102:3 error Duplicate case label no-duplicate-case␊ - 102:8 warning This case duplicates the one on line 90 sonarjs/no-identical-conditions␊ + 8:0 warning Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary @eslint-community/eslint-comments/require-description␊ + 8:0 error Unexpected unlimited 'eslint-disable-next-line' comment. Specify some rule names to disable @eslint-community/eslint-comments/no-unlimited-disable␊ + 14:1 warning Unexpected 'FIXME' comment: 'fixMe: Actually make this work' no-warning-comments␊ + 15:1 warning Unexpected 'TODO' comment: 'todo: Add documentation' no-warning-comments␊ + 16:1 warning Unexpected 'HACK' comment: 'Hack: Note that these work, regardless...' no-warning-comments␊ + 23:10 error 'functionWithoutJSDocWarningsBecauseTheSectionWasCompletelyExcluded' is defined but never used no-unused-vars␊ + 28:1 warning Remove the @description tag to leave a plain block description or add additional description text above the @description line jsdoc/require-description␊ + 28:1 warning JSDoc @returns declaration present but return expression not available in function jsdoc/require-returns-check␊ + 28:1 warning JSDoc type missing brace valid-jsdoc␊ + 29:1 warning JSDoc description does not satisfy the regex pattern jsdoc/match-description␊ + 30:1 warning Expected @param names to be "params". Got "a, params, b" jsdoc/check-param-names␊ + 30:1 warning Missing JSDoc @param "a" description jsdoc/require-param-description␊ + 31:1 warning Missing JSDoc @param "params" description jsdoc/require-param-description␊ + 31:1 warning Missing JSDoc @param "params" type jsdoc/require-param-type␊ + 32:1 warning Missing JSDoc @param "b" description jsdoc/require-param-description␊ + 32:1 warning Missing JSDoc @param "b" type jsdoc/require-param-type␊ + 33:1 warning Missing JSDoc @returns description jsdoc/require-returns-description␊ + 33:1 warning Missing JSDoc @returns type jsdoc/require-returns-type␊ + 35:71 error 'params' is defined but never used no-unused-vars␊ + 40:1 warning Invalid JSDoc tag name "note" jsdoc/check-tag-names␊ + 42:1 warning Expected catch() or return promise/catch-or-return␊ + 42:17 error 'a' is defined but never used no-unused-vars␊ + 42:20 error Expected to return a value at the end of arrow function consistent-return␊ + 43:3 warning Each then() should return a value or throw promise/always-return␊ + 43:7 warning Unexpected constant condition no-constant-condition␊ + 44:5 warning Avoid wrapping return values in Promise.resolve promise/no-return-wrap␊ + 45:10 error Unnecessary 'else' after 'return' no-else-return␊ + 46:5 error 'forgotToDefine' is not defined no-undef␊ + 50:7 error 'variable' is assigned a value but never used no-unused-vars␊ + 50:18 warning This conditional operation returns the same value whether the condition is "true" or "false" sonarjs/no-all-duplicated-branches␊ + 50:18 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary␊ + 50:18 warning Unexpected constant condition no-constant-condition␊ + 53:7 warning Correct one of the identical sub-expressions on both sides of operator "&&" sonarjs/no-identical-expressions␊ + 53:55 error 'params' is not defined no-undef␊ + 54:5 warning This function expects 1 argument, but 2 were provided sonarjs/no-extra-arguments␊ + 55:30 error Module path/to/legacyModule is deprecated. Use module x instead deprecate/import␊ + 55:30 error Unexpected require() global-require␊ + 55:38 error Unable to resolve path to module 'path/to/legacyModule' import/no-unresolved␊ + 57:5 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function␊ + 57:5 error 'deprecatedFunction' is not defined no-undef␊ + 59:5 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression␊ + 59:5 error '$' is not defined no-undef␊ + 61:5 error Unexpected 'debugger' statement no-debugger␊ + 61:5 error Unreachable code no-unreachable␊ + 75:10 warning Update this function so that its implementation is not identical to the one on line 67 sonarjs/no-identical-functions␊ + 83:1 warning Remove this conditional structure or edit its code blocks so that they're not all the same sonarjs/no-all-duplicated-branches␊ + 83:5 warning This always evaluates to truthy. Consider refactoring this code sonarjs/no-gratuitous-expressions␊ + 83:5 warning Unexpected constant condition no-constant-condition␊ + 90:1 warning Reduce the number of non-empty switch cases from 16 to at most 15 sonarjs/max-switch-cases␊ + 95:5 error Expected a default case default-case␊ + 95:5 warning Refactor the code to eliminate this nested "switch" sonarjs/no-nested-switch␊ + 100:7 error This case's code block is the same as the block for the case on line 96 sonarjs/no-duplicated-branches␊ + 100:7 error Duplicate case label no-duplicate-case␊ + 100:12 warning This case duplicates the one on line 96 sonarjs/no-identical-conditions␊ + 106:3 error Duplicate case label no-duplicate-case␊ + 106:8 warning This case duplicates the one on line 94 sonarjs/no-identical-conditions␊ ␊ example.json␊ 4:6 error Property keys must be doublequoted json/*␊ @@ -8357,6 +8388,6 @@ Generated by [AVA](https://ava.li). 7:7 error 'unusedVar' is assigned a value but never used @typescript-eslint/no-unused-vars␊ 9:6 error 'UnusedType' is defined but never used @typescript-eslint/no-unused-vars␊ ␊ - ✖ 81 problems (43 errors, 38 warnings)␊ + ✖ 82 problems (43 errors, 39 warnings)␊ 4 errors and 0 warnings potentially fixable with the `--fix` option.␊ ` diff --git a/demo/test/snapshots/linting-config.test.js.snap b/demo/test/snapshots/linting-config.test.js.snap index 8fcbfaf..bca931b 100644 Binary files a/demo/test/snapshots/linting-config.test.js.snap and b/demo/test/snapshots/linting-config.test.js.snap differ diff --git a/es6.js b/es6.js index 24756ec..4081604 100644 --- a/es6.js +++ b/es6.js @@ -15,20 +15,21 @@ module.exports = { '@fs/eslint-config-frontier-react/dont-need-lodash', '@fs/eslint-config-frontier-react/typescript', '@fs/eslint-config-frontier-react/cypress', + "plugin:@eslint-community/eslint-comments/recommended", '@fs/eslint-config-frontier-react/prettierSetup', // Always have prettier last so it can override format rules in the extends before it ], plugins: [ - 'eslint-plugin-bestpractices', 'eslint-plugin-deprecate', 'eslint-plugin-html', 'eslint-plugin-promise', 'eslint-plugin-sonarjs', 'eslint-plugin-test-selectors', + '@eslint-community/eslint-comments' ], rules: { 'no-console': ['warn', { allow: ['warn', 'error', 'trace', 'time'] }], // Allow warn on top of what eslint-config-frontier-react allows - 'bestpractices/no-eslint-disable': 'warn', + '@eslint-community/eslint-comments/require-description': 'warn', 'promise/always-return': 'warn', 'promise/no-return-wrap': 'warn', diff --git a/package.json b/package.json index b4054a1..558d308 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fs/eslint-config-tree", - "version": "6.3.1", + "version": "6.4.0", "description": "Shared Tree configuration that contains overrides and enhancements on top of the base frontier configuration.", "main": "index.js", "repository": { @@ -29,9 +29,9 @@ ], "dependencies": { "@babel/eslint-parser": "^7.28.4", - "@fs/eslint-config-frontier-react": "^11.4.0", + "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0", + "@fs/eslint-config-frontier-react": "^11.4.1", "eslint": "^8.57.1", - "eslint-plugin-bestpractices": "github:skye2k2/eslint-plugin-bestpractices", "eslint-plugin-deprecate": "^0.7.0", "eslint-plugin-promise": "^6.6.0", "eslint-plugin-sonarjs": "^0.22.0",