Skip to content

Commit 005565e

Browse files
authored
chore: use eslint-plugin-eslint-plugin (#15)
1 parent 9b80bdd commit 005565e

7 files changed

+53
-10
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ export default [
5656

5757
<!-- Rule Table Start -->
5858

59-
| **Rule Name** | **Description** | **Recommended** |
60-
| :--------------------------------------------------------------- | :-------------------------------- | :-------------: |
61-
| [`no-duplicate-imports`](./docs/rules/no-duplicate-imports.md) | Disallow duplicate @import rules. | yes |
62-
| [`no-empty-blocks`](./docs/rules/no-empty-blocks.md) | Disallow empty blocks. | yes |
63-
| [`no-invalid-properties`](./docs/rules/no-invalid-properties.md) | Disallow invalid properties. | yes |
64-
| [`no-unknown-at-rules`](./docs/rules/no-unknown-at-rules.md) | Disallow unknown at-rules. | yes |
59+
| **Rule Name** | **Description** | **Recommended** |
60+
| :--------------------------------------------------------------- | :------------------------------- | :-------------: |
61+
| [`no-duplicate-imports`](./docs/rules/no-duplicate-imports.md) | Disallow duplicate @import rules | yes |
62+
| [`no-empty-blocks`](./docs/rules/no-empty-blocks.md) | Disallow empty blocks | yes |
63+
| [`no-invalid-properties`](./docs/rules/no-invalid-properties.md) | Disallow invalid properties | yes |
64+
| [`no-unknown-at-rules`](./docs/rules/no-unknown-at-rules.md) | Disallow unknown at-rules | yes |
6565

6666
<!-- Rule Table End -->
6767

eslint.config.js

+42
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//-----------------------------------------------------------------------------
99

1010
import eslintConfigESLint from "eslint-config-eslint";
11+
import eslintPlugin from "eslint-plugin-eslint-plugin";
1112
import json from "@eslint/json";
1213

1314
//-----------------------------------------------------------------------------
@@ -18,6 +19,11 @@ const eslintPluginJSDoc = eslintConfigESLint.find(
1819
config => config.plugins?.jsdoc,
1920
).plugins.jsdoc;
2021

22+
const eslintPluginRulesRecommendedConfig =
23+
eslintPlugin.configs["flat/rules-recommended"];
24+
const eslintPluginTestsRecommendedConfig =
25+
eslintPlugin.configs["flat/tests-recommended"];
26+
2127
//-----------------------------------------------------------------------------
2228
// Configuration
2329
//-----------------------------------------------------------------------------
@@ -68,4 +74,40 @@ export default [
6874
},
6975
},
7076
},
77+
{
78+
files: ["src/rules/*.js"],
79+
...eslintPluginRulesRecommendedConfig,
80+
rules: {
81+
...eslintPluginRulesRecommendedConfig.rules,
82+
"eslint-plugin/require-meta-schema": "off", // `schema` defaults to []
83+
"eslint-plugin/prefer-placeholders": "error",
84+
"eslint-plugin/prefer-replace-text": "error",
85+
"eslint-plugin/report-message-format": ["error", "[^a-z].*\\.$"],
86+
"eslint-plugin/require-meta-docs-description": [
87+
"error",
88+
{ pattern: "^(Enforce|Require|Disallow) .+[^. ]$" },
89+
],
90+
},
91+
},
92+
{
93+
files: ["tests/rules/*.test.js"],
94+
...eslintPluginTestsRecommendedConfig,
95+
rules: {
96+
...eslintPluginTestsRecommendedConfig.rules,
97+
"eslint-plugin/test-case-property-ordering": [
98+
"error",
99+
[
100+
"name",
101+
"filename",
102+
"code",
103+
"output",
104+
"language",
105+
"options",
106+
"languageOptions",
107+
"errors",
108+
],
109+
],
110+
"eslint-plugin/test-case-shorthand-strings": "error",
111+
},
112+
},
71113
];

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"dedent": "^1.5.3",
8080
"eslint": "^9.11.1",
8181
"eslint-config-eslint": "^11.0.0",
82+
"eslint-plugin-eslint-plugin": "^6.3.2",
8283
"got": "^14.4.2",
8384
"lint-staged": "^15.2.7",
8485
"mdast-util-from-markdown": "^2.0.2",

src/rules/no-duplicate-imports.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
type: "problem",
99

1010
docs: {
11-
description: "Disallow duplicate @import rules.",
11+
description: "Disallow duplicate @import rules",
1212
recommended: true,
1313
},
1414

src/rules/no-empty-blocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
type: "problem",
99

1010
docs: {
11-
description: "Disallow empty blocks.",
11+
description: "Disallow empty blocks",
1212
recommended: true,
1313
},
1414

src/rules/no-invalid-properties.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default {
3737
type: "problem",
3838

3939
docs: {
40-
description: "Disallow invalid properties.",
40+
description: "Disallow invalid properties",
4141
recommended: true,
4242
},
4343

src/rules/no-unknown-at-rules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
type: "problem",
2525

2626
docs: {
27-
description: "Disallow unknown at-rules.",
27+
description: "Disallow unknown at-rules",
2828
recommended: true,
2929
},
3030

0 commit comments

Comments
 (0)