@@ -2,7 +2,9 @@ import js from '@eslint/js';
22import tseslint , { ConfigArray } from "typescript-eslint"
33import { defineConfig } from "eslint/config"
44import globals from "globals"
5+ import css from "@eslint/css"
56import markdown from "@eslint/markdown"
7+ import json from "@eslint/json"
68
79const globalConfig = defineConfig ( [
810 {
@@ -13,59 +15,103 @@ const globalConfig = defineConfig([
1315 "build/**" ,
1416 "node_modules/**" ,
1517 ".claude/**" ,
16- "**/tsconfig.json" ,
17- "**/tsconfig.*.json" ,
1818 ] ,
1919 } ,
2020] )
2121
22+ const scriptFile = "*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"
23+ const jsFile = "*.{js,jsx,mjs,cjs}"
24+ const tsFile = "*.{ts,tsx,mts,cts}"
25+
2226const scriptConfig : ConfigArray = tseslint . config ( [
2327 {
24- files : [ "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ] ,
2528 ...js . configs . recommended ,
29+ files : [ `**/${ scriptFile } ` ] ,
2630 } ,
2731 {
28- files : [ "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ] ,
29- ... tseslint . configs . recommended [ 0 ] ,
32+ ... tseslint . configs . strictTypeChecked [ 0 ] ,
33+ files : [ `**/ ${ scriptFile } ` ] ,
3034 } ,
3135 {
32- ...tseslint . configs . recommended [ 1 ] ,
33- } ,
34- {
35- files : [ "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ] ,
36- ...tseslint . configs . recommended [ 2 ] ,
36+ ...tseslint . configs . strictTypeChecked [ 1 ] ,
37+ files : [ `**/${ tsFile } ` ] ,
3738 } ,
39+ {
40+ ...tseslint . configs . strictTypeChecked [ 2 ] ,
41+ files : [ `**/${ scriptFile } ` ] ,
42+ } ,
43+ {
44+ ...tseslint . configs . stylisticTypeChecked [ 2 ] ,
45+ files : [ `**/${ scriptFile } ` ] ,
46+ } ,
3847 {
3948 files : [
40- "*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ,
41- " config/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ,
42- " scripts/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ,
43- " test/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ,
44- " spec/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ,
45- " tools/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ,
49+ scriptFile ,
50+ ` config/**/${ scriptFile } ` ,
51+ ` scripts/**/${ scriptFile } ` ,
52+ ` test/**/${ scriptFile } ` ,
53+ ` spec/**/${ scriptFile } ` ,
54+ ` tools/**/${ scriptFile } ` ,
4655 ] ,
4756 languageOptions : {
4857 globals : globals . node
4958 }
5059 } ,
5160 {
52- files : [ " src/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}" ] ,
61+ files : [ ` src/**/${ scriptFile } ` ] ,
5362 languageOptions : {
5463 globals : globals . browser
5564 }
65+ } ,
66+ {
67+ files : [ `**/${ scriptFile } ` ] ,
68+ languageOptions : {
69+ parserOptions : {
70+ projectService : true ,
71+ tsconfigRootDir : import . meta. dirname ,
72+ } ,
73+ } ,
74+ } ,
75+ ] )
76+
77+ const cssConfig = defineConfig ( [
78+ {
79+ ...css . configs . recommended ,
80+ files : [ "**/*.css" ] ,
81+ language : "css/css" ,
5682 }
5783] )
5884
5985const markdownConfig = defineConfig ( [
60- markdown . configs . recommended ,
86+ {
87+ ...markdown . configs . recommended [ 0 ] ,
88+ language : "markdown/gfm" ,
89+ } ,
90+ ] )
91+
92+ const jsonConfig = defineConfig ( [
93+ {
94+ ...json . configs . recommended ,
95+ files : [ "**/*.json" ] ,
96+ ignores : [
97+ "**/tsconfig.json" ,
98+ "**/tsconfig.*.json" ,
99+ ] ,
100+ language : "json/json" ,
101+ } ,
102+ {
103+ ...json . configs . recommended ,
104+ files : [ "**/*.jsonc" , "**/*.json5" , "**/tsconfig.json" , "**/tsconfig.*.json" ] ,
105+ language : "json/jsonc" ,
106+ } ,
61107] )
62108
63109const config = [
64110 ...globalConfig ,
65111 ...scriptConfig ,
112+ ...cssConfig ,
66113 ...markdownConfig ,
114+ ...jsonConfig ,
67115]
68116
69- console . log ( config )
70-
71117export default config
0 commit comments