@@ -7,6 +7,8 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
77import eslintPluginUnicorn from 'eslint-plugin-unicorn'
88import eslintMarkdown from '@eslint/markdown'
99import eslintPluginMarkdownPreferences from 'eslint-plugin-markdown-preferences'
10+ import eslintPluginTs from '@typescript-eslint/eslint-plugin'
11+ import tsEslintParser from '@typescript-eslint/parser'
1012import vueEslintParser from 'vue-eslint-parser'
1113import noInvalidMeta from './eslint-internal-rules/no-invalid-meta.js'
1214import noInvalidMetaDocsCategories from './eslint-internal-rules/no-invalid-meta-docs-categories.js'
@@ -46,10 +48,13 @@ const MD_LINKS_FOR_DOCS = {
4648 ...MD_BASE_LINKS
4749}
4850
51+ const GLOB_TS = '**/*.?([cm])ts'
52+
4953export default typegen ( [
5054 {
5155 ignores : [
5256 '.nyc_output' ,
57+ 'eslint-typegen.d.ts' ,
5358 'coverage' ,
5459 'node_modules' ,
5560 '.changeset/**/*.md' ,
@@ -78,7 +83,7 @@ export default typegen([
7883 }
7984 } ,
8085 ...defineConfig ( {
81- files : [ '**/*.js ' ] ,
86+ files : [ '**/*.?([cm])[jt]s ' ] ,
8287 extends : [
8388 eslintPluginEslintPlugin ,
8489 eslintPluginUnicorn . configs [ 'flat/recommended' ]
@@ -105,7 +110,21 @@ export default typegen([
105110 } ) ,
106111
107112 {
108- files : [ '**/*.js' ] ,
113+ name : 'typescript/setup' ,
114+ files : [ GLOB_TS ] ,
115+ languageOptions : {
116+ parser : tsEslintParser ,
117+ parserOptions : {
118+ sourceType : 'module'
119+ }
120+ } ,
121+ plugins : {
122+ ts : eslintPluginTs
123+ }
124+ } ,
125+
126+ {
127+ files : [ '**/*.?([cm])[jt]s' ] ,
109128 languageOptions : {
110129 ecmaVersion : 'latest' ,
111130 sourceType : 'commonjs' ,
@@ -249,6 +268,25 @@ export default typegen([
249268 'internal/require-eslint-community' : [ 'error' ]
250269 }
251270 } ,
271+
272+ {
273+ files : [ '**/*.mjs' ] ,
274+ languageOptions : {
275+ sourceType : 'module'
276+ }
277+ } ,
278+
279+ {
280+ files : [ GLOB_TS ] ,
281+ rules : {
282+ 'no-undef' : 'off' , // https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
283+ 'no-unused-vars' : 'off' ,
284+ 'ts/no-unused-vars' : 'error' ,
285+ 'no-redeclare' : 'off' ,
286+ 'ts/no-redeclare' : 'error'
287+ }
288+ } ,
289+
252290 {
253291 files : [ './**/*.vue' ] ,
254292 languageOptions : {
0 commit comments