From 5c69086b721f46cc1a12a4fad687b8b4c42eb886 Mon Sep 17 00:00:00 2001 From: 2nofa11 Date: Thu, 26 Jun 2025 21:23:42 +0900 Subject: [PATCH 1/6] feat: add TypeScript IntelliSense support with eslint-typegen close #2757 --- .gitignore | 1 + eslint.config.js => eslint.config.mjs | 32 ++++++++++++++++----------- package.json | 1 + 3 files changed, 21 insertions(+), 13 deletions(-) rename eslint.config.js => eslint.config.mjs (87%) diff --git a/.gitignore b/.gitignore index 0458765cd..d6fadf92c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ yarn-error.log /docs/.vitepress/.temp /docs/.vitepress/cache typings/eslint/lib/rules +eslint-typegen.d.ts diff --git a/eslint.config.js b/eslint.config.mjs similarity index 87% rename from eslint.config.js rename to eslint.config.mjs index 4ed1e816e..9cd54f623 100644 --- a/eslint.config.js +++ b/eslint.config.mjs @@ -1,13 +1,19 @@ -'use strict' +import globals from 'globals' +import eslintPluginEslintPlugin from 'eslint-plugin-eslint-plugin/configs/all' +import eslintPluginJsonc from 'eslint-plugin-jsonc' +import eslintPluginNodeDependencies from 'eslint-plugin-node-dependencies' +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' +import eslintPluginUnicorn from 'eslint-plugin-unicorn' +import vueEslintParser from 'vue-eslint-parser' +import noInvalidMeta from './eslint-internal-rules/no-invalid-meta.js' +import noInvalidMetaDocsCategories from './eslint-internal-rules/no-invalid-meta-docs-categories.js' +import requireEslintCommunity from './eslint-internal-rules/require-eslint-community.js' -const globals = require('globals') -const eslintPluginEslintPlugin = require('eslint-plugin-eslint-plugin/configs/all') -const eslintPluginJsonc = require('eslint-plugin-jsonc') -const eslintPluginNodeDependencies = require('eslint-plugin-node-dependencies') -const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended') -const eslintPluginUnicorn = require('eslint-plugin-unicorn') +// @ts-check +/// +import typegen from 'eslint-typegen' -module.exports = [ +export default typegen([ { ignores: [ '.nyc_output', @@ -33,9 +39,9 @@ module.exports = [ plugins: { internal: { rules: { - 'no-invalid-meta': require('./eslint-internal-rules/no-invalid-meta'), - 'no-invalid-meta-docs-categories': require('./eslint-internal-rules/no-invalid-meta-docs-categories'), - 'require-eslint-community': require('./eslint-internal-rules/require-eslint-community') + 'no-invalid-meta': noInvalidMeta, + 'no-invalid-meta-docs-categories': noInvalidMetaDocsCategories, + 'require-eslint-community': requireEslintCommunity } } } @@ -213,7 +219,7 @@ module.exports = [ languageOptions: { ecmaVersion: 'latest', sourceType: 'module', - parser: require('vue-eslint-parser') + parser: vueEslintParser } }, { @@ -241,4 +247,4 @@ module.exports = [ 'prettier/prettier': 'off' } } -] +]) diff --git a/package.json b/package.json index dac23e65e..e552a9b56 100644 --- a/package.json +++ b/package.json @@ -98,6 +98,7 @@ "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-unicorn": "^56.0.0", "eslint-plugin-vue": "file:.", + "eslint-typegen": "^2.2.0", "eslint-visitor-keys": "^4.2.0", "espree": "^10.4.0", "events": "^3.3.0", From 2647596c0f52969aa03eb4eb1e9dafe172b52e72 Mon Sep 17 00:00:00 2001 From: 2nofa11 Date: Sat, 28 Jun 2025 11:26:14 +0900 Subject: [PATCH 2/6] fix: add provide rule types using the low-level API --- package.json | 1 + tools/generate-typegen.mjs | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 tools/generate-typegen.mjs diff --git a/package.json b/package.json index e552a9b56..e84585855 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "version": "npm run generate:version && git add .", "update": "node ./tools/update.js", "update-resources": "node ./tools/update-resources.js", + "typegen": "node ./tools/generate-typegen.mjs", "docs:watch": "vitepress dev docs", "predocs:build": "npm run update", "docs:build": "vitepress build docs", diff --git a/tools/generate-typegen.mjs b/tools/generate-typegen.mjs new file mode 100644 index 000000000..5bcb325a5 --- /dev/null +++ b/tools/generate-typegen.mjs @@ -0,0 +1,9 @@ +import fs from 'node:fs/promises' +import { pluginsToRulesDTS } from 'eslint-typegen/core' +import plugin from '../lib/index.js' + +const dts = await pluginsToRulesDTS({ + vue: plugin +}) + +await fs.writeFile('lib/eslint-typegen.d.ts', dts) From 2ee7b0e98fdb7f8a592939a44b3e6211589e198b Mon Sep 17 00:00:00 2001 From: 2nofa11 Date: Mon, 30 Jun 2025 20:45:20 +0900 Subject: [PATCH 3/6] fix: update publish command to include type generation --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e84585855..31bba2216 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "docs:build": "vitepress build docs", "generate:version": "env-cmd -e version npm run update && npm run lint -- --fix", "changeset:version": "changeset version && npm run generate:version && git add --all", - "changeset:publish": "changeset publish" + "changeset:publish": "npm run typegen && changeset publish" }, "files": [ "lib" From 557d8e750c67fc26696349da57322a238f462d2d Mon Sep 17 00:00:00 2001 From: 2nofa11 Date: Mon, 30 Jun 2025 21:32:48 +0900 Subject: [PATCH 4/6] fix: add reference eslint-typegen to index.d.ts --- lib/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/index.d.ts b/lib/index.d.ts index 8cbff659f..b6d658852 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1,3 +1,4 @@ +/// import type { Linter } from 'eslint' declare const vue: { From a8661baddfcd7b09597a5b7d919af2d5e49b5979 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Wed, 2 Jul 2025 18:15:03 +0900 Subject: [PATCH 5/6] Create neat-swans-argue.md --- .changeset/neat-swans-argue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/neat-swans-argue.md diff --git a/.changeset/neat-swans-argue.md b/.changeset/neat-swans-argue.md new file mode 100644 index 000000000..95daf8b54 --- /dev/null +++ b/.changeset/neat-swans-argue.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": minor +--- + +Add TypeScript IntelliSense support with eslint-typegen From 9e53387e1126cce967a7498cc644b588ba70f32b Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Wed, 2 Jul 2025 11:51:33 +0200 Subject: [PATCH 6/6] Link eslint-typescript in changeset --- .changeset/neat-swans-argue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/neat-swans-argue.md b/.changeset/neat-swans-argue.md index 95daf8b54..62099d99a 100644 --- a/.changeset/neat-swans-argue.md +++ b/.changeset/neat-swans-argue.md @@ -2,4 +2,4 @@ "eslint-plugin-vue": minor --- -Add TypeScript IntelliSense support with eslint-typegen +Add TypeScript IntelliSense support via [eslint-typegen](https://github.com/antfu/eslint-typegen) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy