From be02995528f0ae341ca7a3df3a7b79e8f59bbfa1 Mon Sep 17 00:00:00 2001 From: Oscar Lee-Vermeren Date: Tue, 9 Apr 2024 13:43:51 -0400 Subject: [PATCH 1/9] feat: add rule types --- package.json | 5 +- src/rule-types.d.ts | 579 +++++++++++++++++++++++++++++++++++++ tools/update-rule-types.ts | 22 ++ tools/update.ts | 1 + 4 files changed, 606 insertions(+), 1 deletion(-) create mode 100644 src/rule-types.d.ts create mode 100644 tools/update-rule-types.ts diff --git a/package.json b/package.json index 188ead549..6264bf6d7 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,10 @@ "sveltejs" ], "scripts": { - "build": "pnpm run build:meta && pnpm run build:ts", + "build": "pnpm run build:meta && pnpm run build:ts && pnpm run build:types", "build:meta": "pnpm run ts ./tools/update-meta.ts", "build:ts": "tsc --project ./tsconfig.build.json", + "build:types": "pnpm run ts ./tools/update-rule-types.ts && copyfiles -f ./src/rule-types.d.ts ./lib", "clean": "rimraf .nyc_output lib coverage build .svelte-kit svelte.config-dist.js", "cover": "nyc --reporter=lcov pnpm run test", "debug": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", @@ -120,6 +121,7 @@ "@typescript/vfs": "^1.5.0", "acorn": "^8.11.3", "assert": "^2.1.0", + "copyfiles": "^2.4.1", "cross-spawn": "^7.0.3", "env-cmd": "^10.1.0", "esbuild": "^0.20.2", @@ -141,6 +143,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", diff --git a/src/rule-types.d.ts b/src/rule-types.d.ts new file mode 100644 index 000000000..81085e525 --- /dev/null +++ b/src/rule-types.d.ts @@ -0,0 +1,579 @@ +// IMPORTANT! +// This file has been automatically generated, +// in order to update its content execute "pnpm run update" + +/* eslint-disable */ +/* prettier-ignore */ +import type { Linter } from 'eslint' + +declare module 'eslint' { + namespace Linter { + interface RulesRecord extends RuleOptions {} + } +} + +export interface RuleOptions { + /** + * disallow conditionals where the type is always truthy or always falsy + * @see https://sveltejs.github.io/eslint-plugin-svelte/rules/@typescript-eslint/no-unnecessary-condition/ + * @deprecated + */ + 'svelte/@typescript-eslint/no-unnecessary-condition'?: Linter.RuleEntry; + /** + * disallows the use of languages other than those specified in the configuration for the lang attribute of `