Skip to content

feat: add TypeScript IntelliSense support with eslint-typegen #2770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ yarn-error.log
/docs/.vitepress/.temp
/docs/.vitepress/cache
typings/eslint/lib/rules
eslint-typegen.d.ts
32 changes: 19 additions & 13 deletions eslint.config.js → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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
/// <reference path="./eslint-typegen.d.ts" />
import typegen from 'eslint-typegen'

module.exports = [
export default typegen([
{
ignores: [
'.nyc_output',
Expand All @@ -34,9 +40,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
}
}
}
Expand Down Expand Up @@ -214,7 +220,7 @@ module.exports = [
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parser: require('vue-eslint-parser')
parser: vueEslintParser
}
},
{
Expand Down Expand Up @@ -242,4 +248,4 @@ module.exports = [
'prettier/prettier': 'off'
}
}
]
])
1 change: 1 addition & 0 deletions package.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update to ESLint v9 in the dev dependencies, so we don't need to use --legacy-peer-deps. This would also fix the Netlify deployment that is currently failing due to that peer dependency mismatch.

Updating that version is irrelevant for users of this package, as ESLint v8 is still supported as a peer dependency. We also run the tests in the CI with ESLint v8, so everything is well tested.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback :)

I initially anticipated that ESLint v9 would be a blocker for this issue, so I created a separate issue for the ESLint v9 upgrade.
However, I received advice that eslint-typegen doesn't strictly require ESLint v9, and I was able to confirm it works locally with the current setup using --legacy-peer-deps.

From a project perspective, which approach would you prefer ?

  • ESLint v9 as blocker
    Update ESLint v9 in (Upgrade ESLint from v8 to v9 #2756), then integrate eslint-typegen without --legacy-peer-deps
  • Proceed with ESLint v8
    Keep the current ESLint v8 setup and use --legacy-peer-deps for eslint-typegen integration

I'm happy to proceed with whichever approach aligns 😄

Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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": "^9.6.1",
"events": "^3.3.0",
Expand Down
Loading