Skip to content

Commit 33f0de2

Browse files
authored
feat: add rule types (#735)
1 parent f8b5e90 commit 33f0de2

8 files changed

+508
-4
lines changed

.changeset/late-mirrors-drop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-svelte": minor
3+
---
4+
5+
feat: add rule types

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
/docs-svelte-kit/src/routes/*.md
3030
/docs-svelte-kit/src/routes/**/*.md
3131
/docs-svelte-kit/src/app.html
32+
/src/rule-types.ts
3233

3334
# JSONSchema bug?
3435
/.devcontainer/devcontainer.json

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"eslint-plugin-svelte": "^2.35.1",
142142
"eslint-plugin-yml": "^1.14.0",
143143
"eslint-scope": "^8.0.1",
144+
"eslint-typegen": "^0.2.1",
144145
"eslint-visitor-keys": "^4.0.0",
145146
"espree": "^10.0.1",
146147
"estree-walker": "^3.0.3",

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import './rule-types';
12
import type { RuleModule } from './types';
23
import { rules as ruleList } from './utils/rules';
34
import base from './configs/base';

src/rule-types.ts

+477
Large diffs are not rendered by default.

tools/update-rule-types.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import fs from 'fs';
2+
import path from 'path';
3+
import plugin from '../src/index';
4+
5+
void main();
6+
7+
async function main() {
8+
const { pluginsToRulesDTS } = await import('eslint-typegen/core');
9+
10+
// @ts-expect-error - types are a bit strict here
11+
const ruleTypes = await pluginsToRulesDTS({ svelte: plugin });
12+
13+
void fs.writeFileSync(
14+
path.join(__dirname, '../src/rule-types.ts'),
15+
`// IMPORTANT!
16+
// This file has been automatically generated,
17+
// in order to update its content execute "pnpm run update"
18+
19+
${ruleTypes}`
20+
);
21+
}

tools/update.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ import './update-readme';
55
import './update-docs-rules-index';
66
import './update-types-for-node';
77
import './update-meta';
8+
import './update-rule-types';

tsconfig.build.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,5 @@
66
"typings/**/*",
77
"vite.config.mts",
88
"docs-svelte-kit/**/*.mts"
9-
],
10-
"compilerOptions": {
11-
"removeComments": true /* Do not emit comments to output. */
12-
}
9+
]
1310
}

0 commit comments

Comments
 (0)