Skip to content

Commit ebaf5b7

Browse files
lint
1 parent c413c94 commit ebaf5b7

File tree

6 files changed

+32
-4
lines changed

6 files changed

+32
-4
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

77
<!-- begin auto-generated rules list -->
88

9+
⚠️ Configurations set to warn in.\
10+
✅ Set in the `recommended` configuration.\
911
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
1012

11-
| Name | Description | 💡 |
12-
| :------------------------------- | :--------------------- | :-- |
13-
| [my-rule](docs/rules/my-rule.md) | An example ESLint rule | 💡 |
13+
| Name | Description | ⚠️ | 💡 |
14+
| :------------------------------- | :--------------------- | :-- | :-- |
15+
| [my-rule](docs/rules/my-rule.md) | An example ESLint rule | | 💡 |
1416

1517
<!-- end auto-generated rules list -->
1618

docs/rules/my-rule.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# An example ESLint rule
22

3+
⚠️ This rule _warns_ in the ✅ `recommended` config.
4+
35
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
46

57
<!-- end auto-generated rule header -->

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import path from "node:path";
22
import { fileURLToPath } from "node:url";
33

44
import pluginJs from "@eslint/js";
5+
import eslintPlugin from "eslint-plugin-eslint-plugin";
56
import importPlugin from "eslint-plugin-import";
67
import simpleImportSort from "eslint-plugin-simple-import-sort";
78
import eslintPluginUnicorn from "eslint-plugin-unicorn";
@@ -22,6 +23,7 @@ export default [
2223
},
2324
pluginJs.configs.recommended,
2425
...tseslint.configs.recommended,
26+
eslintPlugin.configs.recommended,
2527
{
2628
plugins: {
2729
import: importPlugin,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"@typescript-eslint/rule-tester": "^8.37.0",
6868
"eslint": "^9.31.0",
6969
"eslint-doc-generator": "^2.2.2",
70+
"eslint-plugin-eslint-plugin": "^7.0.0",
7071
"eslint-plugin-import": "^2.31.0",
7172
"eslint-plugin-simple-import-sort": "^12.1.1",
7273
"eslint-plugin-unicorn": "^56.0.1",

pnpm-lock.yaml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rules/my-rule.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint-disable eslint-plugin/no-meta-schema-default */
2+
// Meta schema `default` is read by the `eslint-doc-generator`
3+
14
import { RuleCreator } from "@typescript-eslint/utils/eslint-utils";
25

36
import type { PluginSharedSettings } from "../types";
@@ -20,6 +23,8 @@ type Options = [
2023
// The parameter passed into RuleCreator is a URL generator function.
2124
export const createRule = RuleCreator(urlCreator);
2225

26+
const defaultOptions = { someBool: true, someEnum: "always" };
27+
2328
export const myRule = createRule<Options, MessageIds>({
2429
name: RULE_NAME,
2530
meta: {
@@ -51,6 +56,7 @@ export const myRule = createRule<Options, MessageIds>({
5156
additionalProperties: false,
5257
},
5358
],
59+
defaultOptions: [defaultOptions],
5460
type: "suggestion",
5561
},
5662
/**
@@ -60,7 +66,7 @@ export const myRule = createRule<Options, MessageIds>({
6066
* - If some configuration is provided as the second argument, it is ignored, not merged
6167
* - In other words, the `defaultOptions` is only used when the rule is used without configuration
6268
*/
63-
defaultOptions: [{ someBool: false, someEnum: "always" }],
69+
defaultOptions: [defaultOptions],
6470
create: (context, options) => {
6571
return {
6672
VariableDeclaration: (node) => {

0 commit comments

Comments
 (0)