@@ -7,17 +7,20 @@ import pluginRegexp from "eslint-plugin-regexp";
77import pluginSimpleImportSort from "eslint-plugin-simple-import-sort" ;
88import pluginUnicorn from "eslint-plugin-unicorn" ;
99import tseslint from "typescript-eslint" ;
10+ const GLOB_JS = [ "*.{js,jsx,cjs,mjs}" , "**/*.{js,jsx,cjs,mjs}" ] ;
1011const GLOB_TS = [ "*.{ts,tsx,cts,mts}" , "**/*.{ts,tsx,cts,mts}" ] ;
11- const templateIndentAnnotations = [
12- "outdent" ,
13- "dedent" ,
14- "html" ,
15- "tsx" ,
12+ const templateIndentTags = [
1613 "ts" ,
14+ "tsx" ,
15+ "html" ,
16+ "dedent" ,
17+ "outdent" ,
1718] ;
1819const p11tOptions = {
1920 type : "natural" ,
2021 ignoreCase : false ,
22+ partitionByComment : "^Part:.*" ,
23+ partitionByNewLine : true ,
2124} ;
2225const p11tGroups = {
2326 customGroups : {
@@ -35,20 +38,13 @@ const p11tGroups = {
3538 groups : [ "id" , "type" , "meta" , "alias" , "rules" , "unknown" ] ,
3639} ;
3740export const typescript = tseslint . config ( {
41+ ignores : GLOB_JS ,
42+ } , {
3843 extends : [
3944 js . configs . recommended ,
4045 ...tseslint . configs . strict ,
41- pluginDeMorgan . configs . recommended ,
42- pluginJsdoc . configs [ "flat/recommended-typescript-error" ] ,
43- pluginRegexp . configs [ "flat/recommended" ] ,
44- pluginPerfectionist . configs [ "recommended-natural" ] ,
4546 ] ,
4647 files : GLOB_TS ,
47- plugins : {
48- [ "@stylistic" ] : stylistic ,
49- [ "simple-import-sort" ] : pluginSimpleImportSort ,
50- [ "unicorn" ] : pluginUnicorn ,
51- } ,
5248 rules : {
5349 eqeqeq : [ "error" , "smart" ] ,
5450 "no-console" : "error" ,
@@ -58,19 +54,16 @@ export const typescript = tseslint.config({
5854 "no-mixed-operators" : "warn" ,
5955 "no-undef" : "off" ,
6056 "prefer-object-has-own" : "error" ,
61- // Part: custom rules
6257 "no-restricted-syntax" : [
6358 "error" ,
6459 {
6560 message : "no optional" ,
6661 selector : "TSPropertySignature[optional=true]" ,
6762 } ,
6863 ] ,
69- // Part: typescript-eslint rules
7064 "@typescript-eslint/ban-ts-comment" : [
7165 "error" ,
7266 {
73- minimumDescriptionLength : 5 ,
7467 "ts-check" : false ,
7568 "ts-expect-error" : "allow-with-description" ,
7669 "ts-ignore" : true ,
@@ -82,7 +75,7 @@ export const typescript = tseslint.config({
8275 "@typescript-eslint/consistent-type-imports" : "error" ,
8376 "@typescript-eslint/explicit-function-return-type" : "off" ,
8477 "@typescript-eslint/no-empty-object-type" : "off" ,
85- "@typescript-eslint/no-misused-promises" : "off " ,
78+ "@typescript-eslint/no-misused-promises" : "warn " ,
8679 "@typescript-eslint/no-namespace" : "off" ,
8780 "@typescript-eslint/no-unnecessary-parameter-property-assignment" : "warn" ,
8881 "@typescript-eslint/no-unused-vars" : [ "warn" , { caughtErrors : "all" } ] ,
@@ -96,65 +89,62 @@ export const typescript = tseslint.config({
9689 allowNumber : true ,
9790 allowString : false ,
9891 } ] ,
99- // Part: jsdoc rules
100- "jsdoc/check-param-names" : "warn" ,
101- "jsdoc/check-tag-names" : "warn" ,
102- "jsdoc/informative-docs" : "off" ,
103- "jsdoc/lines-before-block" : "off" ,
104- "jsdoc/require-jsdoc" : "off" ,
105- "jsdoc/require-param" : "warn" ,
106- "jsdoc/require-param-description" : "warn" ,
107- "jsdoc/require-returns" : "off" ,
108- "jsdoc/require-yields" : "warn" ,
109- "jsdoc/tag-lines" : "off" ,
110- // Part: simple-import-sort rules
111- "simple-import-sort/exports" : "warn" ,
112- "simple-import-sort/imports" : "warn" ,
113- // Part: stylistic rules
92+ } ,
93+ } , {
94+ extends : [
95+ pluginDeMorgan . configs . recommended ,
96+ pluginJsdoc . configs [ "flat/recommended-typescript-error" ] ,
97+ pluginRegexp . configs [ "flat/recommended" ] ,
98+ pluginPerfectionist . configs [ "recommended-natural" ] ,
99+ ] ,
100+ files : GLOB_TS ,
101+ plugins : {
102+ [ "@stylistic" ] : stylistic ,
103+ [ " simple-import-sort" ] : pluginSimpleImportSort ,
104+ [ "unicorn" ] : pluginUnicorn ,
105+ } ,
106+ rules : {
114107 "@stylistic/arrow-parens" : [ "warn" , "always" ] ,
115108 "@stylistic/no-multi-spaces" : [ "warn" ] ,
116- "@stylistic/operator-linebreak" : [
117- "warn" ,
118- "before" ,
119- ] ,
109+ "@stylistic/operator-linebreak" : [ "warn" , "before" ] ,
120110 "@stylistic/quote-props" : [ "error" , "as-needed" ] ,
121- // Part: perfectionist rules
111+ "simple-import-sort/exports" : "warn" ,
112+ "simple-import-sort/imports" : "warn" ,
122113 "perfectionist/sort-exports" : "off" ,
123114 "perfectionist/sort-imports" : "off" ,
124115 "perfectionist/sort-interfaces" : [
125116 "warn" ,
126- {
127- ...p11tOptions ,
128- ...p11tGroups ,
129- } ,
117+ { ...p11tOptions , ...p11tGroups } ,
130118 ] ,
131119 "perfectionist/sort-intersection-types" : "off" ,
132120 "perfectionist/sort-modules" : "off" ,
133121 "perfectionist/sort-named-exports" : "off" ,
134122 "perfectionist/sort-named-imports" : "off" ,
135123 "perfectionist/sort-object-types" : [
136124 "warn" ,
137- {
138- ...p11tOptions ,
139- ...p11tGroups ,
140- } ,
125+ { ...p11tOptions , ...p11tGroups } ,
141126 ] ,
142127 "perfectionist/sort-objects" : [
143128 "warn" ,
144- {
145- ...p11tOptions ,
146- ...p11tGroups ,
147- partitionByComment : "^Part:.*" ,
148- } ,
129+ { ...p11tOptions , ...p11tGroups } ,
149130 ] ,
150131 "perfectionist/sort-switch-case" : "off" ,
151132 "perfectionist/sort-union-types" : "off" ,
152- // Part: unicorn rules
133+ "jsdoc/check-param-names" : "warn" ,
134+ "jsdoc/check-tag-names" : "warn" ,
135+ "jsdoc/informative-docs" : "off" ,
136+ "jsdoc/lines-before-block" : "off" ,
137+ "jsdoc/require-jsdoc" : "off" ,
138+ "jsdoc/require-param" : "warn" ,
139+ "jsdoc/require-param-description" : "warn" ,
140+ "jsdoc/require-returns" : "off" ,
141+ "jsdoc/require-yields" : "warn" ,
142+ "jsdoc/tag-lines" : "off" ,
153143 "unicorn/template-indent" : [
154144 "warn" ,
155145 {
156- comments : templateIndentAnnotations ,
157- tags : templateIndentAnnotations ,
146+ comments : templateIndentTags ,
147+ tags : templateIndentTags ,
158148 } ,
159149 ] ,
160150 } ,
0 commit comments