Skip to content

Commit

Permalink
feat: add rule types (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiBread committed Apr 11, 2024
1 parent f8b5e90 commit 33f0de2
Show file tree
Hide file tree
Showing 8 changed files with 508 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-mirrors-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-svelte": minor
---

feat: add rule types
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/docs-svelte-kit/src/routes/*.md
/docs-svelte-kit/src/routes/**/*.md
/docs-svelte-kit/src/app.html
/src/rule-types.ts

# JSONSchema bug?
/.devcontainer/devcontainer.json
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"eslint-plugin-svelte": "^2.35.1",
"eslint-plugin-yml": "^1.14.0",
"eslint-scope": "^8.0.1",
"eslint-typegen": "^0.2.1",
"eslint-visitor-keys": "^4.0.0",
"espree": "^10.0.1",
"estree-walker": "^3.0.3",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './rule-types';
import type { RuleModule } from './types';
import { rules as ruleList } from './utils/rules';
import base from './configs/base';
Expand Down
477 changes: 477 additions & 0 deletions src/rule-types.ts

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions tools/update-rule-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import fs from 'fs';
import path from 'path';
import plugin from '../src/index';

void main();

async function main() {
const { pluginsToRulesDTS } = await import('eslint-typegen/core');

// @ts-expect-error - types are a bit strict here
const ruleTypes = await pluginsToRulesDTS({ svelte: plugin });

void fs.writeFileSync(
path.join(__dirname, '../src/rule-types.ts'),
`// IMPORTANT!
// This file has been automatically generated,
// in order to update its content execute "pnpm run update"
${ruleTypes}`
);
}
1 change: 1 addition & 0 deletions tools/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ import './update-readme';
import './update-docs-rules-index';
import './update-types-for-node';
import './update-meta';
import './update-rule-types';
5 changes: 1 addition & 4 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@
"typings/**/*",
"vite.config.mts",
"docs-svelte-kit/**/*.mts"
],
"compilerOptions": {
"removeComments": true /* Do not emit comments to output. */
}
]
}

0 comments on commit 33f0de2

Please sign in to comment.