@sarj/eslint-plugin 18.3.1 → 19.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,17 +1,46 @@
1
1
  {
2
2
  "name": "@sarj/eslint-plugin",
3
- "version": "18.3.1",
3
+ "version": "19.0.1",
4
4
  "packageManager": "npm@12.2.1",
5
- "description": "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
5
+ "description": "Custom Oxlint rules for hypermodern TypeScript / React / Next.js projects",
6
6
  "type": "module",
7
- "main": "./dist/index.cjs",
8
- "module": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
7
+ "main": "./dist/index.js",
10
8
  "exports": {
11
9
  ".": {
12
- "types": "./dist/index.d.ts",
13
- "import": "./dist/index.js",
14
- "require": "./dist/index.cjs"
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./unicorn": {
13
+ "import": "./dist/unicorn-js.js"
14
+ },
15
+ "./jsdoc": {
16
+ "import": "./dist/jsdoc-js.js"
17
+ },
18
+ "./react": {
19
+ "import": "./dist/react-js.js"
20
+ },
21
+ "./regexp": {
22
+ "import": "./dist/regexp.js"
23
+ },
24
+ "./security": {
25
+ "import": "./dist/security.js"
26
+ },
27
+ "./query": {
28
+ "import": "./dist/query.js"
29
+ },
30
+ "./effects": {
31
+ "import": "./dist/effects.js"
32
+ },
33
+ "./node-test": {
34
+ "import": "./dist/node-test.js"
35
+ },
36
+ "./testing-library": {
37
+ "import": "./dist/testing-library.js"
38
+ },
39
+ "./playwright": {
40
+ "import": "./dist/playwright.js"
41
+ },
42
+ "./react-correctness": {
43
+ "import": "./dist/react-correctness.js"
15
44
  }
16
45
  },
17
46
  "files": [
@@ -28,24 +57,21 @@
28
57
  "url": "git+https://github.com/sarj-ai/code-standards.git",
29
58
  "directory": "packages/typescript"
30
59
  },
31
- "homepage": "https://code-standards.sarj.ai/rules/eslint/",
60
+ "homepage": "https://code-standards.sarj.ai/rules/oxlint/",
32
61
  "bugs": {
33
62
  "url": "https://github.com/sarj-ai/code-standards/issues"
34
63
  },
35
64
  "scripts": {
36
- "build": "tsup",
37
- "dogfood": "npm run build && npm run dogfood:built",
38
- "lint": "node ../standards/src/sarj_standards/configs/eslint-selected-rules.mts \"{\\\"full\\\":true,\\\"config\\\":null,\\\"rules\\\":[],\\\"consoleOutput\\\":true,\\\"failOnWarnings\\\":true}\" -- . ../../.github/scripts ../standards/src ../standards/eslint.config.mts",
65
+ "build": "tsup && node scripts/oxlint/build-upstream.ts",
66
+ "lint": "(test -f dist/index.js || tsup) && export OXLINT_TSGOLINT_PATH=\"$PWD/node_modules/.bin/tsrs-lint\" && oxlint && cd ../standards && oxlint && cd ../../.github/scripts && oxlint",
39
67
  "prepack": "npm run build && npm run verify-package",
40
68
  "test": "vitest run",
41
- "typecheck": "tsc --noEmit && tsc --project tsconfig.tools.json",
42
- "verify-package": "node -e \"const fs=require('node:fs'),p=require('./package.json'),walk=x=>typeof x==='string'?[x]:x&&typeof x==='object'?Object.values(x).flatMap(walk):[];for(const file of new Set([p.main,p.module,p.types,...walk(p.exports)].filter(Boolean).map(x=>x.startsWith('./')?x.slice(2):x))){if(!file.startsWith('dist/'))throw new Error('export must live under dist: '+file);const stat=fs.statSync(file);if(!stat.isFile()||stat.size===0)throw new Error('missing or empty export: '+file)}\"",
43
- "dogfood:built": "eslint --config eslint.dogfood.config.ts src tests scripts eslint-rule-setting.ts eslint.config.ts eslint.dogfood.config.ts module-constant-naming-options.ts tsup.config.ts vitest.config.ts --max-warnings 0 && node -e \"import('./dist/index.js').then(({default:p}) => console.log('dogfood: '+Object.keys(p.rules).length+' TypeScript rules, 0 diagnostics'))\""
69
+ "typecheck": "tsrs --noEmit && tsrs --project tsconfig.tools.json",
70
+ "verify-package": "node -e \"const fs=require('node:fs'),p=require('./package.json'),walk=x=>typeof x==='string'?[x]:x&&typeof x==='object'?Object.values(x).flatMap(walk):[];for(const file of new Set([p.main,p.module,p.types,...walk(p.exports)].filter(Boolean).map(x=>x.startsWith('./')?x.slice(2):x))){if(!file.startsWith('dist/'))throw new Error('export must live under dist: '+file);const stat=fs.statSync(file);if(!stat.isFile()||stat.size===0)throw new Error('missing or empty export: '+file)}\""
44
71
  },
45
72
  "keywords": [
46
- "eslint",
47
- "eslintplugin",
48
- "eslint-plugin",
73
+ "oxlint",
74
+ "oxlint-plugin",
49
75
  "sarj",
50
76
  "react",
51
77
  "nextjs",
@@ -54,57 +80,32 @@
54
80
  "author": "sarj-ai",
55
81
  "license": "MIT",
56
82
  "dependencies": {
57
- "@eslint/core": "1.2.1",
58
- "@typescript-eslint/typescript-estree": "^8.72.1",
59
- "@typescript-eslint/utils": "^8.72.1",
60
- "jsonc-parser": "^3.3.1",
61
- "ts-api-utils": "2.5.0"
83
+ "@eslint/css-tree": "4.1.2",
84
+ "change-case": "5.4.4",
85
+ "oxc-parser": "0.148.0"
62
86
  },
63
87
  "devDependencies": {
64
- "@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
65
- "@eslint/compat": "^2.1.1",
66
- "@eslint/js": "10.0.1",
67
- "@shadcn/lint": "0.2.5",
68
- "@types/eslint-plugin-no-unsanitized": "4.1.0",
88
+ "@oxlint/plugins": "1.91.0",
69
89
  "@types/node": "26.6.5",
70
- "@typescript-eslint/parser": "8.72.1",
71
- "@typescript-eslint/rule-tester": "8.72.1",
72
- "@typescript-eslint/utils": "8.72.1",
73
- "@typescript/native": "npm:typescript@7.0.2",
74
- "@vitest/eslint-plugin": "1.6.28",
75
- "eslint": "10.14.0",
76
- "eslint-node-test": "1.0.1",
77
- "eslint-plugin-eslint-plugin": "7.6.2",
78
- "eslint-plugin-better-tailwindcss": "^4.10.0",
79
- "eslint-plugin-jest": "29.17.0",
80
- "eslint-plugin-jsdoc": "65.4.4",
81
- "eslint-plugin-n": "^18.5.0",
82
- "eslint-plugin-perfectionist": "5.13.0",
83
- "eslint-plugin-playwright": "2.12.2",
84
- "eslint-plugin-promise": "^7.3.0",
85
- "eslint-plugin-react": "^7.37.5",
86
- "eslint-plugin-react-hooks": "^7.1.1",
87
- "eslint-plugin-regexp": "3.3.3",
88
- "eslint-plugin-security": "4.2.1",
89
- "eslint-plugin-no-unsanitized": "4.1.5",
90
- "eslint-plugin-simple-import-sort": "^14.0.0",
91
- "eslint-plugin-testing-library": "7.16.2",
92
- "eslint-plugin-unicorn": "^79.0.0",
90
+ "esbuild": "0.28.2",
93
91
  "eslint-plugin-zod": "^5.2.2",
94
- "globals": "17.13.0",
95
- "jiti": "2.7.0",
92
+ "jsonc-parser": "3.3.1",
93
+ "oxfmt": "0.76.0",
94
+ "oxlint": "1.91.0",
95
+ "oxlint-plugin-eslint": "1.91.0",
96
+ "oxlint-plugin-react-doctor": "0.9.22",
96
97
  "prettier": "3.9.10",
97
- "tsup": "9.0.0",
98
98
  "syncpack": "15.3.3",
99
+ "tsrs": "0.23.0-ts7.1.0-beta",
100
+ "tsup": "9.0.0",
99
101
  "typescript": "npm:@typescript/typescript6@6.0.2",
100
- "typescript-eslint": "^8.72.1",
101
102
  "uuid": "13.0.0",
102
103
  "vitest": "5.0.5",
103
104
  "zod": "4.6.7"
104
105
  },
105
106
  "peerDependencies": {
106
- "eslint": ">=10.13.0",
107
- "typescript": ">=5.0.0"
107
+ "tsrs": ">=0.23.0-ts7.1.0-beta",
108
+ "typescript": ">=5.6.0 <7"
108
109
  },
109
110
  "engines": {
110
111
  "node": "^22.22.2 || >=24.15.0"
@@ -113,17 +114,14 @@
113
114
  "esbuild@0.28.2": true,
114
115
  "fsevents@2.3.3": true
115
116
  },
116
- "peerDependenciesMeta": {
117
- "typescript": {
118
- "optional": true
119
- }
120
- },
121
117
  "overrides": {
122
118
  "brace-expansion@^5.0.0": "5.0.12",
123
119
  "esbuild": "0.28.2",
124
- "eslint-plugin-react": {
125
- "eslint": "$eslint"
126
- },
127
120
  "nanoid@<3.3.20": "3.3.20"
121
+ },
122
+ "peerDependenciesMeta": {
123
+ "typescript": {
124
+ "optional": true
125
+ }
128
126
  }
129
127
  }
@@ -1,170 +0,0 @@
1
- import { ESLintUtils, JSONSchema, TSESLint, TSESTree } from '@typescript-eslint/utils';
2
- import { Linter, JSRuleDefinition } from 'eslint';
3
- import { RuleDefinition, RuleVisitor } from '@eslint/core';
4
-
5
- /** @fileoverview _eslint-rule — native TypeScript rule contexts and owned option metadata. */
6
-
7
- type NativeJavaScriptSource = Parameters<JSRuleDefinition["create"]>[0]["sourceCode"];
8
- type TypeScriptSourceCode = Pick<TSESLint.SourceCode, Exclude<Extract<keyof TSESLint.SourceCode, keyof NativeJavaScriptSource>, "visitorKeys">> & Pick<NativeJavaScriptSource, "visitorKeys"> & Pick<NativeJavaScriptSource, Exclude<keyof NativeJavaScriptSource, keyof TSESLint.SourceCode>>;
9
- type NativeRuleListener = {
10
- [Selector in keyof TSESLint.RuleListener as string extends Selector ? never : number extends Selector ? never : Selector]: TSESLint.RuleListener[Selector];
11
- } & RuleVisitor;
12
- type Definition<Options extends readonly unknown[], MessageIds extends string> = RuleDefinition<{
13
- LangOptions: Linter.LanguageOptions;
14
- ExtRuleDocs: Record<string, unknown>;
15
- RuleOptions: [...Options];
16
- MessageIds: MessageIds;
17
- Code: TypeScriptSourceCode;
18
- Node: TSESTree.Node | TSESTree.Token;
19
- Visitor: NativeRuleListener;
20
- }>;
21
- type EngineRuleContext<MessageIds extends string, Options extends readonly unknown[]> = Parameters<Definition<Options, MessageIds>["create"]>[0];
22
- type OwnedMetadata<Options extends readonly unknown[], MessageIds extends string> = Omit<ESLintUtils.RuleWithMetaAndName<Options, MessageIds>["meta"], "schema" | "defaultOptions" | "docs"> & {
23
- docs: ESLintUtils.RuleWithMetaAndName<Options, MessageIds>["meta"]["docs"] & {
24
- url: string;
25
- };
26
- schema: JSONSchema.JSONSchema4 | JSONSchema.JSONSchema4[];
27
- defaultOptions?: [...Options];
28
- };
29
- interface NativeRule<Options extends readonly unknown[], MessageIds extends string> {
30
- name: string;
31
- defaultOptions: Readonly<Options> | undefined;
32
- meta: OwnedMetadata<Options, MessageIds>;
33
- create(context: EngineRuleContext<MessageIds, Options>): NativeRuleListener;
34
- }
35
-
36
- /**
37
- * @fileoverview _trackable-rule — observe rule prerequisites and completed native execution without altering diagnostics.
38
- */
39
-
40
- type RuleExecutionState = "ran" | "skipped" | "untracked" | "failed";
41
- interface RuleExecution {
42
- readonly ruleId: string;
43
- readonly filePath: string;
44
- readonly execution: RuleExecutionState;
45
- readonly requiresTypeInformation: boolean | null;
46
- readonly reason?: string;
47
- }
48
- interface RuleExecutionTracker {
49
- finish(): readonly RuleExecution[];
50
- }
51
- /** Tracking is opt-in and bound to the exact rule instance used by the engine. */
52
- declare function trackableRule<Options extends readonly unknown[], MessageIds extends string>(rule: NativeRule<Options, MessageIds>, requiresTypeInformation: boolean | null): NativeRule<Options, MessageIds> & {
53
- trackExecution(): RuleExecutionTracker;
54
- };
55
-
56
- /**
57
- * @fileoverview _docs — typed source-owned rule documentation and executable examples.
58
- *
59
- */
60
-
61
- type RuleCategory = "architecture" | "correctness" | "maintainability" | "performance" | "security" | "style" | "testing";
62
- type AutofixPolicy = "none" | "safe" | "suggestion";
63
- type DefaultLevel = "error" | "warning";
64
- type ExampleOutcome = "match" | "no-match";
65
- interface ExampleFile {
66
- readonly path: string;
67
- readonly source: string;
68
- }
69
- interface ExamplePoint {
70
- readonly line: number;
71
- readonly column: number;
72
- }
73
- interface ExampleLocation extends ExamplePoint {
74
- readonly end?: ExamplePoint;
75
- }
76
- interface SuggestionExpectation {
77
- readonly messageId: string;
78
- readonly output: string;
79
- }
80
- interface DiagnosticExpectation {
81
- readonly messageId: string;
82
- readonly message: string;
83
- readonly location: ExampleLocation;
84
- readonly automaticFix: boolean;
85
- readonly suggestions: readonly SuggestionExpectation[];
86
- }
87
- /** A reviewed example. It remains private unless `public: true` is explicit. */
88
- interface RuleExample<Options extends readonly unknown[] = readonly unknown[]> {
89
- readonly ruleOptions?: Readonly<Options>;
90
- readonly installedDependencies?: readonly {
91
- readonly module: string;
92
- readonly version: string;
93
- }[];
94
- readonly id: string;
95
- readonly scenarioId?: string;
96
- readonly title: string;
97
- readonly outcome: ExampleOutcome;
98
- readonly files: readonly ExampleFile[];
99
- readonly focusPath: string;
100
- readonly expectedCount: number;
101
- readonly expectedDiagnostics?: readonly DiagnosticExpectation[];
102
- readonly public?: boolean;
103
- readonly fixedFiles?: readonly ExampleFile[];
104
- }
105
- type PublicRuleExample = Omit<RuleExample, "expectedDiagnostics">;
106
- /** Human-authored fields that cannot be derived from the ESLint rule module. */
107
- interface RuleDocumentation<Options extends readonly unknown[] = readonly unknown[]> {
108
- readonly summary: string;
109
- readonly rationale: string;
110
- readonly remediation: string;
111
- readonly category: RuleCategory;
112
- /** Omission/null preserves undeclared prerequisites rather than assuming a syntax-only detector. */
113
- readonly requiresTypeInformation?: boolean | null;
114
- /** Source package roots whose imported APIs establish provenance; these are not plugin dependencies. */
115
- readonly runtimeImports?: readonly string[];
116
- readonly defaultLevel?: DefaultLevel;
117
- readonly languages?: readonly "typescript"[];
118
- readonly autofix?: AutofixPolicy;
119
- readonly aliases?: readonly string[];
120
- readonly limitations?: readonly string[];
121
- readonly filePatterns?: readonly string[];
122
- readonly references?: readonly string[];
123
- readonly since?: string;
124
- readonly examples?: readonly RuleExample<Options>[];
125
- }
126
- /** Complete native record exposed to catalog generation without changing ESLint metadata. */
127
- interface NativeRuleSpec extends Required<Omit<RuleDocumentation, "since">> {
128
- readonly engine: "eslint";
129
- readonly ruleId: string;
130
- readonly code: null;
131
- readonly messageIds: readonly string[];
132
- readonly optionsSchema: object | null;
133
- readonly since: string | null;
134
- readonly key: string;
135
- readonly publicExamples: readonly RuleExample[];
136
- }
137
- /** The explicit allowlist projection consumed by generated public documentation. */
138
- interface PublicRuleSpec {
139
- readonly engine: "eslint";
140
- readonly ruleId: string;
141
- readonly code: null;
142
- readonly summary: string;
143
- readonly rationale: string;
144
- readonly remediation: string;
145
- readonly category: RuleCategory;
146
- readonly requiresTypeInformation: boolean | null;
147
- readonly runtimeImports: readonly string[];
148
- readonly defaultLevel: DefaultLevel;
149
- readonly languages: readonly "typescript"[];
150
- readonly autofix: AutofixPolicy;
151
- readonly aliases: readonly string[];
152
- readonly limitations: readonly string[];
153
- readonly filePatterns: readonly string[];
154
- readonly references: readonly string[];
155
- readonly since: string | null;
156
- readonly messageIds: readonly string[];
157
- readonly optionsSchema: object | null;
158
- readonly examples: readonly PublicRuleExample[];
159
- }
160
- type DocumentedRule<Options extends readonly unknown[], MessageIds extends string> = ReturnType<typeof trackableRule<Options, MessageIds>> & {
161
- /** Non-enumerable so the public ESLint rule shape remains unchanged. */
162
- readonly documentation?: NativeRuleSpec;
163
- };
164
- /** Serialize only reviewed fields; test-only examples never cross this boundary. */
165
- declare function publicDocumentation(rules: Readonly<Record<string, {
166
- readonly documentation?: NativeRuleSpec;
167
- }>>): readonly PublicRuleSpec[];
168
-
169
- export { publicDocumentation as p };
170
- export type { DocumentedRule as D, ExampleFile as E, RuleExample as R };
@@ -1,170 +0,0 @@
1
- import { ESLintUtils, JSONSchema, TSESLint, TSESTree } from '@typescript-eslint/utils';
2
- import { Linter, JSRuleDefinition } from 'eslint';
3
- import { RuleDefinition, RuleVisitor } from '@eslint/core';
4
-
5
- /** @fileoverview _eslint-rule — native TypeScript rule contexts and owned option metadata. */
6
-
7
- type NativeJavaScriptSource = Parameters<JSRuleDefinition["create"]>[0]["sourceCode"];
8
- type TypeScriptSourceCode = Pick<TSESLint.SourceCode, Exclude<Extract<keyof TSESLint.SourceCode, keyof NativeJavaScriptSource>, "visitorKeys">> & Pick<NativeJavaScriptSource, "visitorKeys"> & Pick<NativeJavaScriptSource, Exclude<keyof NativeJavaScriptSource, keyof TSESLint.SourceCode>>;
9
- type NativeRuleListener = {
10
- [Selector in keyof TSESLint.RuleListener as string extends Selector ? never : number extends Selector ? never : Selector]: TSESLint.RuleListener[Selector];
11
- } & RuleVisitor;
12
- type Definition<Options extends readonly unknown[], MessageIds extends string> = RuleDefinition<{
13
- LangOptions: Linter.LanguageOptions;
14
- ExtRuleDocs: Record<string, unknown>;
15
- RuleOptions: [...Options];
16
- MessageIds: MessageIds;
17
- Code: TypeScriptSourceCode;
18
- Node: TSESTree.Node | TSESTree.Token;
19
- Visitor: NativeRuleListener;
20
- }>;
21
- type EngineRuleContext<MessageIds extends string, Options extends readonly unknown[]> = Parameters<Definition<Options, MessageIds>["create"]>[0];
22
- type OwnedMetadata<Options extends readonly unknown[], MessageIds extends string> = Omit<ESLintUtils.RuleWithMetaAndName<Options, MessageIds>["meta"], "schema" | "defaultOptions" | "docs"> & {
23
- docs: ESLintUtils.RuleWithMetaAndName<Options, MessageIds>["meta"]["docs"] & {
24
- url: string;
25
- };
26
- schema: JSONSchema.JSONSchema4 | JSONSchema.JSONSchema4[];
27
- defaultOptions?: [...Options];
28
- };
29
- interface NativeRule<Options extends readonly unknown[], MessageIds extends string> {
30
- name: string;
31
- defaultOptions: Readonly<Options> | undefined;
32
- meta: OwnedMetadata<Options, MessageIds>;
33
- create(context: EngineRuleContext<MessageIds, Options>): NativeRuleListener;
34
- }
35
-
36
- /**
37
- * @fileoverview _trackable-rule — observe rule prerequisites and completed native execution without altering diagnostics.
38
- */
39
-
40
- type RuleExecutionState = "ran" | "skipped" | "untracked" | "failed";
41
- interface RuleExecution {
42
- readonly ruleId: string;
43
- readonly filePath: string;
44
- readonly execution: RuleExecutionState;
45
- readonly requiresTypeInformation: boolean | null;
46
- readonly reason?: string;
47
- }
48
- interface RuleExecutionTracker {
49
- finish(): readonly RuleExecution[];
50
- }
51
- /** Tracking is opt-in and bound to the exact rule instance used by the engine. */
52
- declare function trackableRule<Options extends readonly unknown[], MessageIds extends string>(rule: NativeRule<Options, MessageIds>, requiresTypeInformation: boolean | null): NativeRule<Options, MessageIds> & {
53
- trackExecution(): RuleExecutionTracker;
54
- };
55
-
56
- /**
57
- * @fileoverview _docs — typed source-owned rule documentation and executable examples.
58
- *
59
- */
60
-
61
- type RuleCategory = "architecture" | "correctness" | "maintainability" | "performance" | "security" | "style" | "testing";
62
- type AutofixPolicy = "none" | "safe" | "suggestion";
63
- type DefaultLevel = "error" | "warning";
64
- type ExampleOutcome = "match" | "no-match";
65
- interface ExampleFile {
66
- readonly path: string;
67
- readonly source: string;
68
- }
69
- interface ExamplePoint {
70
- readonly line: number;
71
- readonly column: number;
72
- }
73
- interface ExampleLocation extends ExamplePoint {
74
- readonly end?: ExamplePoint;
75
- }
76
- interface SuggestionExpectation {
77
- readonly messageId: string;
78
- readonly output: string;
79
- }
80
- interface DiagnosticExpectation {
81
- readonly messageId: string;
82
- readonly message: string;
83
- readonly location: ExampleLocation;
84
- readonly automaticFix: boolean;
85
- readonly suggestions: readonly SuggestionExpectation[];
86
- }
87
- /** A reviewed example. It remains private unless `public: true` is explicit. */
88
- interface RuleExample<Options extends readonly unknown[] = readonly unknown[]> {
89
- readonly ruleOptions?: Readonly<Options>;
90
- readonly installedDependencies?: readonly {
91
- readonly module: string;
92
- readonly version: string;
93
- }[];
94
- readonly id: string;
95
- readonly scenarioId?: string;
96
- readonly title: string;
97
- readonly outcome: ExampleOutcome;
98
- readonly files: readonly ExampleFile[];
99
- readonly focusPath: string;
100
- readonly expectedCount: number;
101
- readonly expectedDiagnostics?: readonly DiagnosticExpectation[];
102
- readonly public?: boolean;
103
- readonly fixedFiles?: readonly ExampleFile[];
104
- }
105
- type PublicRuleExample = Omit<RuleExample, "expectedDiagnostics">;
106
- /** Human-authored fields that cannot be derived from the ESLint rule module. */
107
- interface RuleDocumentation<Options extends readonly unknown[] = readonly unknown[]> {
108
- readonly summary: string;
109
- readonly rationale: string;
110
- readonly remediation: string;
111
- readonly category: RuleCategory;
112
- /** Omission/null preserves undeclared prerequisites rather than assuming a syntax-only detector. */
113
- readonly requiresTypeInformation?: boolean | null;
114
- /** Source package roots whose imported APIs establish provenance; these are not plugin dependencies. */
115
- readonly runtimeImports?: readonly string[];
116
- readonly defaultLevel?: DefaultLevel;
117
- readonly languages?: readonly "typescript"[];
118
- readonly autofix?: AutofixPolicy;
119
- readonly aliases?: readonly string[];
120
- readonly limitations?: readonly string[];
121
- readonly filePatterns?: readonly string[];
122
- readonly references?: readonly string[];
123
- readonly since?: string;
124
- readonly examples?: readonly RuleExample<Options>[];
125
- }
126
- /** Complete native record exposed to catalog generation without changing ESLint metadata. */
127
- interface NativeRuleSpec extends Required<Omit<RuleDocumentation, "since">> {
128
- readonly engine: "eslint";
129
- readonly ruleId: string;
130
- readonly code: null;
131
- readonly messageIds: readonly string[];
132
- readonly optionsSchema: object | null;
133
- readonly since: string | null;
134
- readonly key: string;
135
- readonly publicExamples: readonly RuleExample[];
136
- }
137
- /** The explicit allowlist projection consumed by generated public documentation. */
138
- interface PublicRuleSpec {
139
- readonly engine: "eslint";
140
- readonly ruleId: string;
141
- readonly code: null;
142
- readonly summary: string;
143
- readonly rationale: string;
144
- readonly remediation: string;
145
- readonly category: RuleCategory;
146
- readonly requiresTypeInformation: boolean | null;
147
- readonly runtimeImports: readonly string[];
148
- readonly defaultLevel: DefaultLevel;
149
- readonly languages: readonly "typescript"[];
150
- readonly autofix: AutofixPolicy;
151
- readonly aliases: readonly string[];
152
- readonly limitations: readonly string[];
153
- readonly filePatterns: readonly string[];
154
- readonly references: readonly string[];
155
- readonly since: string | null;
156
- readonly messageIds: readonly string[];
157
- readonly optionsSchema: object | null;
158
- readonly examples: readonly PublicRuleExample[];
159
- }
160
- type DocumentedRule<Options extends readonly unknown[], MessageIds extends string> = ReturnType<typeof trackableRule<Options, MessageIds>> & {
161
- /** Non-enumerable so the public ESLint rule shape remains unchanged. */
162
- readonly documentation?: NativeRuleSpec;
163
- };
164
- /** Serialize only reviewed fields; test-only examples never cross this boundary. */
165
- declare function publicDocumentation(rules: Readonly<Record<string, {
166
- readonly documentation?: NativeRuleSpec;
167
- }>>): readonly PublicRuleSpec[];
168
-
169
- export { publicDocumentation as p };
170
- export type { DocumentedRule as D, ExampleFile as E, RuleExample as R };