From ede448d506b124d058c215e0b699631f50116d33 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Thu, 21 Nov 2024 17:46:19 +0100 Subject: [PATCH] chore: use eslint-plugin-eslint-plugin (#64) --- eslint.config.js | 42 ++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 43 insertions(+) diff --git a/eslint.config.js b/eslint.config.js index 25b797d..f6c3356 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,6 +8,7 @@ //----------------------------------------------------------------------------- import eslintConfigESLint from "eslint-config-eslint"; +import eslintPlugin from "eslint-plugin-eslint-plugin"; import json from "./src/index.js"; //----------------------------------------------------------------------------- @@ -18,6 +19,11 @@ const eslintPluginJSDoc = eslintConfigESLint.find( config => config.plugins?.jsdoc, ).plugins.jsdoc; +const eslintPluginRulesRecommendedConfig = + eslintPlugin.configs["flat/rules-recommended"]; +const eslintPluginTestsRecommendedConfig = + eslintPlugin.configs["flat/tests-recommended"]; + //----------------------------------------------------------------------------- // Configuration //----------------------------------------------------------------------------- @@ -67,4 +73,40 @@ export default [ }, }, }, + { + files: ["src/rules/*.js"], + ...eslintPluginRulesRecommendedConfig, + rules: { + ...eslintPluginRulesRecommendedConfig.rules, + "eslint-plugin/require-meta-schema": "off", // `schema` defaults to [] + "eslint-plugin/prefer-placeholders": "error", + "eslint-plugin/prefer-replace-text": "error", + "eslint-plugin/report-message-format": ["error", "[^a-z].*\\.$"], + "eslint-plugin/require-meta-docs-description": [ + "error", + { pattern: "^(Enforce|Require|Disallow) .+[^. ]$" }, + ], + }, + }, + { + files: ["tests/rules/*.test.js"], + ...eslintPluginTestsRecommendedConfig, + rules: { + ...eslintPluginTestsRecommendedConfig.rules, + "eslint-plugin/test-case-property-ordering": [ + "error", + [ + "name", + "filename", + "code", + "output", + "language", + "options", + "languageOptions", + "errors", + ], + ], + "eslint-plugin/test-case-shorthand-strings": "error", + }, + }, ]; diff --git a/package.json b/package.json index d6f030b..e4b46ad 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "dedent": "^1.5.3", "eslint": "^9.11.1", "eslint-config-eslint": "^11.0.0", + "eslint-plugin-eslint-plugin": "^6.3.2", "got": "^14.4.2", "lint-staged": "^15.2.7", "mocha": "^10.4.0",