From 47075c90d0f91526ac5a279a6335a07753dccbe6 Mon Sep 17 00:00:00 2001 From: Yannick Croissant Date: Wed, 9 Oct 2019 15:37:55 +0200 Subject: [PATCH] feat: add eslint-plugin-eslint-comments plugin (#117) fixes #112 --- README.md | 1 + base.js | 2 +- package.json | 1 + rules/base.js | 9 +++++++++ sample-project/package.json | 1 + sample-project/yarn.lock | 13 +++++++++++++ yarn.lock | 13 +++++++++++++ 7 files changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 688acad5..9a880284 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ yarn add \ eslint babel-eslint prettier \ eslint-config-algolia eslint-config-prettier \ eslint-plugin-import eslint-plugin-prettier \ +eslint-plugin-eslint-comments \ --dev ``` diff --git a/base.js b/base.js index ee9abf99..bc1cfe1f 100644 --- a/base.js +++ b/base.js @@ -20,7 +20,7 @@ module.exports = { './rules/base.js', 'prettier', ], - plugins: ['import', 'prettier'], + plugins: ['eslint-comments', 'import', 'prettier'], settings: { 'import/extensions': ['.js'], }, diff --git a/package.json b/package.json index a0e853c7..daed8e62 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "eslint": "5.16.0", "eslint-config-algolia": "10.1.0", "eslint-config-prettier": "6.4.0", + "eslint-plugin-eslint-comments": "3.1.2", "eslint-plugin-import": "2.18.2", "eslint-plugin-jest": "21.27.2", "eslint-plugin-prettier": "2.7.0", diff --git a/rules/base.js b/rules/base.js index 6f14098e..8f1ff09b 100644 --- a/rules/base.js +++ b/rules/base.js @@ -257,6 +257,15 @@ module.exports = { 'template-curly-spacing': ['error'], 'yield-star-spacing': ['error'], + // Comments + // https://mysticatea.github.io/eslint-plugin-eslint-comments + 'eslint-comments/disable-enable-pair': ['error'], + 'eslint-comments/no-aggregating-enable': ['error'], + 'eslint-comments/no-duplicate-disable': ['error'], + 'eslint-comments/no-unlimited-disable': ['error'], + 'eslint-comments/no-unused-disable': ['error'], + 'eslint-comments/no-unused-enable': ['error'], + // Import // https://github.com/benmosher/eslint-plugin-import 'import/no-amd': ['error'], diff --git a/sample-project/package.json b/sample-project/package.json index 28f60a9a..0ad85358 100644 --- a/sample-project/package.json +++ b/sample-project/package.json @@ -21,6 +21,7 @@ "eslint": "5.16.0", "eslint-config-algolia": "file:../", "eslint-config-prettier": "6.4.0", + "eslint-plugin-eslint-comments": "3.1.2", "eslint-plugin-import": "2.18.2", "eslint-plugin-jest": "21.27.2", "eslint-plugin-prettier": "2.7.0", diff --git a/sample-project/yarn.lock b/sample-project/yarn.lock index 4b0f854f..e9aa1c0c 100644 --- a/sample-project/yarn.lock +++ b/sample-project/yarn.lock @@ -433,6 +433,14 @@ eslint-module-utils@^2.4.0: debug "^2.6.8" pkg-dir "^2.0.0" +eslint-plugin-eslint-comments@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.2.tgz#4ef6c488dbe06aa1627fea107b3e5d059fc8a395" + integrity sha512-QexaqrNeteFfRTad96W+Vi4Zj1KFbkHHNMMaHZEYcovKav6gdomyGzaxSDSL3GoIyUOo078wRAdYlu1caiauIQ== + dependencies: + escape-string-regexp "^1.0.5" + ignore "^5.0.5" + eslint-plugin-import@2.18.2: version "2.18.2" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" @@ -792,6 +800,11 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== +ignore@^5.0.5: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== + import-fresh@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390" diff --git a/yarn.lock b/yarn.lock index a4a76c4d..a0be2b72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -908,6 +908,14 @@ eslint-module-utils@^2.4.0: debug "^2.6.8" pkg-dir "^2.0.0" +eslint-plugin-eslint-comments@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.2.tgz#4ef6c488dbe06aa1627fea107b3e5d059fc8a395" + integrity sha512-QexaqrNeteFfRTad96W+Vi4Zj1KFbkHHNMMaHZEYcovKav6gdomyGzaxSDSL3GoIyUOo078wRAdYlu1caiauIQ== + dependencies: + escape-string-regexp "^1.0.5" + ignore "^5.0.5" + eslint-plugin-import@2.18.2: version "2.18.2" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" @@ -1491,6 +1499,11 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== +ignore@^5.0.5: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== + import-fresh@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390"