Skip to content

Commit f5232f7

Browse files
committed
chore: cleanup monorepo eslint config
1 parent b3d120d commit f5232f7

File tree

3 files changed

+165
-181
lines changed

3 files changed

+165
-181
lines changed

.pkgs/configs/eslint.js

Lines changed: 41 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ import pluginSimpleImportSort from "eslint-plugin-simple-import-sort";
88
import pluginUnicorn from "eslint-plugin-unicorn";
99
import tseslint from "typescript-eslint";
1010
const GLOB_TS = ["*.{ts,tsx,cts,mts}", "**/*.{ts,tsx,cts,mts}"];
11-
const templateIndentAnnotations = [
12-
"outdent",
13-
"dedent",
14-
"html",
15-
"tsx",
11+
const templateIndentTags = [
1612
"ts",
13+
"tsx",
14+
"html",
15+
"dedent",
16+
"outdent",
1717
];
1818
const p11tOptions = {
1919
type: "natural",
2020
ignoreCase: false,
21+
partitionByComment: "^Part:.*",
22+
partitionByNewLine: true,
2123
};
2224
const p11tGroups = {
2325
customGroups: {
@@ -38,17 +40,8 @@ export const typescript = tseslint.config({
3840
extends: [
3941
js.configs.recommended,
4042
...tseslint.configs.strict,
41-
pluginDeMorgan.configs.recommended,
42-
pluginJsdoc.configs["flat/recommended-typescript-error"],
43-
pluginRegexp.configs["flat/recommended"],
44-
pluginPerfectionist.configs["recommended-natural"],
4543
],
4644
files: GLOB_TS,
47-
plugins: {
48-
["@stylistic"]: stylistic,
49-
["simple-import-sort"]: pluginSimpleImportSort,
50-
["unicorn"]: pluginUnicorn,
51-
},
5245
rules: {
5346
eqeqeq: ["error", "smart"],
5447
"no-console": "error",
@@ -58,19 +51,16 @@ export const typescript = tseslint.config({
5851
"no-mixed-operators": "warn",
5952
"no-undef": "off",
6053
"prefer-object-has-own": "error",
61-
// Part: custom rules
6254
"no-restricted-syntax": [
6355
"error",
6456
{
6557
message: "no optional",
6658
selector: "TSPropertySignature[optional=true]",
6759
},
6860
],
69-
// Part: typescript-eslint rules
7061
"@typescript-eslint/ban-ts-comment": [
7162
"error",
7263
{
73-
minimumDescriptionLength: 5,
7464
"ts-check": false,
7565
"ts-expect-error": "allow-with-description",
7666
"ts-ignore": true,
@@ -82,7 +72,7 @@ export const typescript = tseslint.config({
8272
"@typescript-eslint/consistent-type-imports": "error",
8373
"@typescript-eslint/explicit-function-return-type": "off",
8474
"@typescript-eslint/no-empty-object-type": "off",
85-
"@typescript-eslint/no-misused-promises": "off",
75+
"@typescript-eslint/no-misused-promises": "warn",
8676
"@typescript-eslint/no-namespace": "off",
8777
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "warn",
8878
"@typescript-eslint/no-unused-vars": ["warn", { caughtErrors: "all" }],
@@ -96,65 +86,62 @@ export const typescript = tseslint.config({
9686
allowNumber: true,
9787
allowString: false,
9888
}],
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
89+
},
90+
}, {
91+
extends: [
92+
pluginDeMorgan.configs.recommended,
93+
pluginJsdoc.configs["flat/recommended-typescript-error"],
94+
pluginRegexp.configs["flat/recommended"],
95+
pluginPerfectionist.configs["recommended-natural"],
96+
],
97+
files: GLOB_TS,
98+
plugins: {
99+
["@stylistic"]: stylistic,
100+
["simple-import-sort"]: pluginSimpleImportSort,
101+
["unicorn"]: pluginUnicorn,
102+
},
103+
rules: {
114104
"@stylistic/arrow-parens": ["warn", "always"],
115105
"@stylistic/no-multi-spaces": ["warn"],
116-
"@stylistic/operator-linebreak": [
117-
"warn",
118-
"before",
119-
],
106+
"@stylistic/operator-linebreak": ["warn", "before"],
120107
"@stylistic/quote-props": ["error", "as-needed"],
121-
// Part: perfectionist rules
108+
"simple-import-sort/exports": "warn",
109+
"simple-import-sort/imports": "warn",
122110
"perfectionist/sort-exports": "off",
123111
"perfectionist/sort-imports": "off",
124112
"perfectionist/sort-interfaces": [
125113
"warn",
126-
{
127-
...p11tOptions,
128-
...p11tGroups,
129-
},
114+
{ ...p11tOptions, ...p11tGroups },
130115
],
131116
"perfectionist/sort-intersection-types": "off",
132117
"perfectionist/sort-modules": "off",
133118
"perfectionist/sort-named-exports": "off",
134119
"perfectionist/sort-named-imports": "off",
135120
"perfectionist/sort-object-types": [
136121
"warn",
137-
{
138-
...p11tOptions,
139-
...p11tGroups,
140-
},
122+
{ ...p11tOptions, ...p11tGroups },
141123
],
142124
"perfectionist/sort-objects": [
143125
"warn",
144-
{
145-
...p11tOptions,
146-
...p11tGroups,
147-
partitionByComment: "^Part:.*",
148-
},
126+
{ ...p11tOptions, ...p11tGroups },
149127
],
150128
"perfectionist/sort-switch-case": "off",
151129
"perfectionist/sort-union-types": "off",
152-
// Part: unicorn rules
130+
"jsdoc/check-param-names": "warn",
131+
"jsdoc/check-tag-names": "warn",
132+
"jsdoc/informative-docs": "off",
133+
"jsdoc/lines-before-block": "off",
134+
"jsdoc/require-jsdoc": "off",
135+
"jsdoc/require-param": "warn",
136+
"jsdoc/require-param-description": "warn",
137+
"jsdoc/require-returns": "off",
138+
"jsdoc/require-yields": "warn",
139+
"jsdoc/tag-lines": "off",
153140
"unicorn/template-indent": [
154141
"warn",
155142
{
156-
comments: templateIndentAnnotations,
157-
tags: templateIndentAnnotations,
143+
comments: templateIndentTags,
144+
tags: templateIndentTags,
158145
},
159146
],
160147
},

0 commit comments

Comments
 (0)