1- /* eslint-disable @typescript-eslint/no-deprecated */
21import js from "@eslint/js" ;
32import stylistic from "@stylistic/eslint-plugin" ;
43import pluginDeMorgan from "eslint-plugin-de-morgan" ;
@@ -7,9 +6,59 @@ import pluginJsdoc from "eslint-plugin-jsdoc";
76import pluginPerfectionist from "eslint-plugin-perfectionist" ;
87import pluginRegexp from "eslint-plugin-regexp" ;
98import pluginUnicorn from "eslint-plugin-unicorn" ;
9+ import { defineConfig } from "eslint/config" ;
1010import tseslint from "typescript-eslint" ;
11- const GLOB_JS = [ "*.{js,jsx,cjs,mjs}" , "**/*.{js,jsx,cjs,mjs}" ] ;
12- const GLOB_TS = [ "*.{ts,tsx,cts,mts}" , "**/*.{ts,tsx,cts,mts}" ] ;
11+ export const GLOB_JS = [ "**/*.{js,jsx,cjs,mjs}" ] ;
12+ export const GLOB_TS = [ "**/*.{ts,tsx,cts,mts}" ] ;
13+ export const GLOB_MD = [ "**/*.md" ] ;
14+ export const GLOB_TESTS = [
15+ "**/*{spec,test}.{ts,tsx,cts,mts}" ,
16+ "**/*(spec|test).{ts,tsx,cts,mts}" ,
17+ ] ;
18+ export const GLOB_CONFIGS = [ "**/*.config.{ts,tsx,cts,mts}" ] ;
19+ export const GLOB_SCRIPTS = [ "scripts/**/*.{ts,cts,mts}" ] ;
20+ export const GLOB_IGNORES = [
21+ "**/node_modules" ,
22+ "**/dist" ,
23+ "**/package-lock.json" ,
24+ "**/yarn.lock" ,
25+ "**/pnpm-lock.yaml" ,
26+ "**/bun.lockb" ,
27+ "**/output" ,
28+ "**/coverage" ,
29+ "**/temp" ,
30+ "**/.temp" ,
31+ "**/tmp" ,
32+ "**/.tmp" ,
33+ "**/.history" ,
34+ "**/.vitepress/cache" ,
35+ "**/.nuxt" ,
36+ "**/.next" ,
37+ "**/.vercel" ,
38+ "**/.changeset" ,
39+ "**/.idea" ,
40+ "**/.cache" ,
41+ "**/.output" ,
42+ "**/.vite-inspect" ,
43+ "**/.yarn" ,
44+ "**/storybook-static" ,
45+ "**/.eslint-config-inspector" ,
46+ "**/playwright-report" ,
47+ "**/.astro" ,
48+ "**/.vinxi" ,
49+ "**/app.config.timestamp_*.js" ,
50+ "**/.tanstack" ,
51+ "**/.nitro" ,
52+ "**/CHANGELOG*.md" ,
53+ "**/*.min.*" ,
54+ "**/LICENSE*" ,
55+ "**/__snapshots__" ,
56+ "**/auto-import?(s).d.ts" ,
57+ "**/components.d.ts" ,
58+ "**/vite.config.ts.*.mjs" ,
59+ "**/*.gen.*" ,
60+ "!.storybook" ,
61+ ] ;
1362const templateIndentTags = [
1463 "ts" ,
1564 "tsx" ,
@@ -39,123 +88,129 @@ const p11tGroups = {
3988 } ,
4089 groups : [ "id" , "type" , "meta" , "alias" , "rules" , "unknown" ] ,
4190} ;
42- export const typescript = tseslint . config ( {
43- ignores : GLOB_JS ,
44- } , {
45- extends : [
46- js . configs . recommended ,
47- ...tseslint . configs . strict ,
48- ] ,
49- files : GLOB_TS ,
50- rules : {
51- eqeqeq : [ "error" , "smart" ] ,
52- "no-console" : "error" ,
53- "no-else-return" : "error" ,
54- "no-fallthrough" : [ "error" , { commentPattern : ".*intentional fallthrough.*" } ] ,
55- "no-implicit-coercion" : [ "error" , { allow : [ "!!" ] } ] ,
56- "no-mixed-operators" : "warn" ,
57- "no-undef" : "off" ,
58- "prefer-object-has-own" : "error" ,
59- "no-restricted-syntax" : [
60- "error" ,
61- {
62- message : "no typescript named import" ,
63- selector : "ImportDeclaration[source.value='typescript'] ImportSpecifier" ,
64- } ,
65- ] ,
66- "@typescript-eslint/ban-ts-comment" : [
67- "error" ,
68- {
69- "ts-check" : false ,
70- "ts-expect-error" : "allow-with-description" ,
71- "ts-ignore" : true ,
72- "ts-nocheck" : true ,
73- } ,
74- ] ,
75- "@typescript-eslint/ban-types" : "off" ,
76- "@typescript-eslint/consistent-type-exports" : "error" ,
77- "@typescript-eslint/consistent-type-imports" : "error" ,
78- "@typescript-eslint/explicit-function-return-type" : "off" ,
79- "@typescript-eslint/no-confusing-void-expression" : "off" ,
80- "@typescript-eslint/no-empty-object-type" : "off" ,
81- "@typescript-eslint/no-misused-promises" : "warn" ,
82- "@typescript-eslint/no-namespace" : "off" ,
83- "@typescript-eslint/no-unnecessary-parameter-property-assignment" : "warn" ,
84- "@typescript-eslint/no-unused-vars" : [ "warn" , { caughtErrors : "all" } ] ,
85- "@typescript-eslint/strict-boolean-expressions" : [ "error" , {
86- allowAny : false ,
87- allowNullableBoolean : false ,
88- allowNullableEnum : false ,
89- allowNullableNumber : false ,
90- allowNullableObject : false ,
91- allowNullableString : false ,
92- allowNumber : true ,
93- allowString : false ,
94- } ] ,
95- } ,
96- } , {
97- extends : [
98- pluginDeMorgan . configs . recommended ,
99- pluginJsdoc . configs [ "flat/recommended-typescript-error" ] ,
100- pluginRegexp . configs [ "flat/recommended" ] ,
101- pluginPerfectionist . configs [ "recommended-natural" ] ,
102- ] , // TODO: Fix type error in plugin configs
103- files : GLOB_TS ,
104- plugins : {
105- [ "@stylistic" ] : stylistic ,
106- [ "function" ] : pluginFunction ,
107- [ "unicorn" ] : pluginUnicorn ,
91+ export const strictTypeChecked = defineConfig ( [
92+ {
93+ ignores : GLOB_JS ,
10894 } ,
109- rules : {
110- "function/function-return-boolean" : [ "error" , { pattern : "/^(is|has|can|should)/" } ] ,
111- "@stylistic/arrow-parens" : [ "warn" , "always" ] ,
112- "@stylistic/no-multi-spaces" : [ "warn" ] ,
113- "@stylistic/operator-linebreak" : "off" ,
114- "@stylistic/quote-props" : [ "error" , "as-needed" ] ,
115- "perfectionist/sort-exports" : "off" ,
116- "perfectionist/sort-imports" : "off" ,
117- "perfectionist/sort-interfaces" : [
118- "warn" ,
119- { ...p11tOptions , ...p11tGroups } ,
95+ {
96+ extends : [
97+ js . configs . recommended ,
98+ ...tseslint . configs . strict ,
12099 ] ,
121- "perfectionist/sort-intersection-types" : "off" ,
122- "perfectionist/sort-modules" : "off" ,
123- "perfectionist/sort-named-exports" : [ "warn" , { type : "natural" , order : "asc" } ] ,
124- "perfectionist/sort-named-imports" : [ "warn" , { type : "natural" , order : "asc" } ] ,
125- "perfectionist/sort-object-types" : [
126- "warn" ,
127- { ...p11tOptions , ...p11tGroups } ,
128- ] ,
129- "perfectionist/sort-objects" : [
130- "warn" ,
131- { ...p11tOptions , ...p11tGroups } ,
132- ] ,
133- "perfectionist/sort-switch-case" : "off" ,
134- "perfectionist/sort-union-types" : "off" ,
135- "jsdoc/check-param-names" : "warn" ,
136- "jsdoc/check-tag-names" : "warn" ,
137- "jsdoc/informative-docs" : "off" ,
138- "jsdoc/lines-before-block" : "off" ,
139- "jsdoc/require-jsdoc" : "off" ,
140- "jsdoc/require-param" : "warn" ,
141- "jsdoc/require-param-description" : "warn" ,
142- "jsdoc/require-returns" : "off" ,
143- "jsdoc/require-yields" : "warn" ,
144- "jsdoc/tag-lines" : "off" ,
145- "unicorn/template-indent" : [
146- "warn" ,
147- {
148- comments : templateIndentTags ,
149- tags : templateIndentTags ,
150- } ,
100+ files : GLOB_TS ,
101+ rules : {
102+ eqeqeq : [ "error" , "smart" ] ,
103+ "no-console" : "error" ,
104+ "no-else-return" : "error" ,
105+ "no-fallthrough" : [ "error" , { commentPattern : ".*intentional fallthrough.*" } ] ,
106+ "no-implicit-coercion" : [ "error" , { allow : [ "!!" ] } ] ,
107+ "no-mixed-operators" : "warn" ,
108+ "no-undef" : "off" ,
109+ "prefer-object-has-own" : "error" ,
110+ "no-restricted-syntax" : [
111+ "error" ,
112+ {
113+ message : "no typescript named import" ,
114+ selector : "ImportDeclaration[source.value='typescript'] ImportSpecifier" ,
115+ } ,
116+ ] ,
117+ "@typescript-eslint/ban-ts-comment" : [
118+ "error" ,
119+ {
120+ "ts-check" : false ,
121+ "ts-expect-error" : "allow-with-description" ,
122+ "ts-ignore" : true ,
123+ "ts-nocheck" : true ,
124+ } ,
125+ ] ,
126+ "@typescript-eslint/ban-types" : "off" ,
127+ "@typescript-eslint/consistent-type-exports" : "error" ,
128+ "@typescript-eslint/consistent-type-imports" : "error" ,
129+ "@typescript-eslint/explicit-function-return-type" : "off" ,
130+ "@typescript-eslint/no-confusing-void-expression" : "off" ,
131+ "@typescript-eslint/no-empty-object-type" : "off" ,
132+ "@typescript-eslint/no-misused-promises" : "warn" ,
133+ "@typescript-eslint/no-namespace" : "off" ,
134+ "@typescript-eslint/no-unnecessary-parameter-property-assignment" : "warn" ,
135+ "@typescript-eslint/no-unused-vars" : [ "warn" , { caughtErrors : "all" } ] ,
136+ "@typescript-eslint/strict-boolean-expressions" : [ "error" , {
137+ allowAny : false ,
138+ allowNullableBoolean : false ,
139+ allowNullableEnum : false ,
140+ allowNullableNumber : false ,
141+ allowNullableObject : false ,
142+ allowNullableString : false ,
143+ allowNumber : true ,
144+ allowString : false ,
145+ } ] ,
146+ } ,
147+ } ,
148+ {
149+ extends : [
150+ pluginDeMorgan . configs . recommended ,
151+ pluginJsdoc . configs [ "flat/recommended-typescript-error" ] ,
152+ pluginRegexp . configs [ "flat/recommended" ] ,
153+ pluginPerfectionist . configs [ "recommended-natural" ] ,
151154 ] ,
155+ files : GLOB_TS ,
156+ plugins : {
157+ [ "@stylistic" ] : stylistic ,
158+ [ "function" ] : pluginFunction ,
159+ [ "unicorn" ] : pluginUnicorn ,
160+ } ,
161+ rules : {
162+ "function/function-return-boolean" : [ "error" , { pattern : "/^(is|has|can|should)/" } ] ,
163+ "@stylistic/arrow-parens" : [ "warn" , "always" ] ,
164+ "@stylistic/no-multi-spaces" : [ "warn" ] ,
165+ "@stylistic/operator-linebreak" : "off" ,
166+ "@stylistic/quote-props" : [ "error" , "as-needed" ] ,
167+ "perfectionist/sort-exports" : "off" ,
168+ "perfectionist/sort-imports" : "off" ,
169+ "perfectionist/sort-interfaces" : [
170+ "warn" ,
171+ { ...p11tOptions , ...p11tGroups } ,
172+ ] ,
173+ "perfectionist/sort-intersection-types" : "off" ,
174+ "perfectionist/sort-modules" : "off" ,
175+ "perfectionist/sort-named-exports" : [ "warn" , { type : "natural" , order : "asc" } ] ,
176+ "perfectionist/sort-named-imports" : [ "warn" , { type : "natural" , order : "asc" } ] ,
177+ "perfectionist/sort-object-types" : [
178+ "warn" ,
179+ { ...p11tOptions , ...p11tGroups } ,
180+ ] ,
181+ "perfectionist/sort-objects" : [
182+ "warn" ,
183+ { ...p11tOptions , ...p11tGroups } ,
184+ ] ,
185+ "perfectionist/sort-switch-case" : "off" ,
186+ "perfectionist/sort-union-types" : "off" ,
187+ "jsdoc/check-param-names" : "warn" ,
188+ "jsdoc/check-tag-names" : "warn" ,
189+ "jsdoc/informative-docs" : "off" ,
190+ "jsdoc/lines-before-block" : "off" ,
191+ "jsdoc/require-jsdoc" : "off" ,
192+ "jsdoc/require-param" : "warn" ,
193+ "jsdoc/require-param-description" : "warn" ,
194+ "jsdoc/require-returns" : "off" ,
195+ "jsdoc/require-yields" : "warn" ,
196+ "jsdoc/tag-lines" : "off" ,
197+ "unicorn/template-indent" : [
198+ "warn" ,
199+ {
200+ comments : templateIndentTags ,
201+ tags : templateIndentTags ,
202+ } ,
203+ ] ,
204+ } ,
152205 } ,
153- } ) ;
154- export const disableTypeChecked = tseslint . config ( {
155- extends : [
156- tseslint . configs . disableTypeChecked ,
157- ] ,
158- rules : {
159- "function/function-return-boolean" : "off" ,
206+ ] ) ;
207+ export const disableTypeChecked = defineConfig ( [
208+ {
209+ extends : [
210+ tseslint . configs . disableTypeChecked ,
211+ ] ,
212+ rules : {
213+ "function/function-return-boolean" : "off" ,
214+ } ,
160215 } ,
161- } ) ;
216+ ] ) ;
0 commit comments