Skip to content

Commit 6218917

Browse files
committed
style: update code style
1 parent 58b2a06 commit 6218917

File tree

303 files changed

+4094
-4085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+4094
-4085
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ export default tseslint.config({
4949
extends: [
5050
eslintJs.configs.recommended,
5151
tseslint.configs.recommended,
52-
eslintReact.configs.recommended,
52+
eslintReact.configs.recommended
5353
],
5454
languageOptions: {
5555
parser: tseslint.parser,
5656
parserOptions: {
57-
projectService: true,
58-
},
57+
projectService: true
58+
}
5959
},
6060
rules: {
6161
// Put rules you want to override here
62-
"@eslint-react/prefer-shorthand-boolean": "warn",
63-
},
62+
"@eslint-react/prefer-shorthand-boolean": "warn"
63+
}
6464
});
6565
```
6666

dprint.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"indentWidth": 2,
55
"quoteStyle": "preferDouble",
66
"quoteProps": "asNeeded",
7+
"bracePosition": "maintain",
8+
"trailingCommas": "never",
79
"importDeclaration.sortNamedImports": "maintain",
810
"exportDeclaration.sortNamedExports": "maintain",
911
"module.sortImportDeclarations": "maintain",

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as importx from "importx";
55
const mod = await importx.import("./eslint.config.ts", {
66
cache: true,
77
loader: "native",
8-
parentURL: import.meta.url,
8+
parentURL: import.meta.url
99
});
1010

1111
export default mod.default;

eslint.config.ts

Lines changed: 68 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const GLOB_TEST = [
2626
"**/*.spec.{ts,tsx,cts,mts}",
2727
"**/*.test.{ts,tsx,cts,mts}",
2828
"**/spec.{ts,tsx,cts,mts}",
29-
"**/test.{ts,tsx,cts,mts}",
29+
"**/test.{ts,tsx,cts,mts}"
3030
];
3131
// const GLOB_YAML = ["*.{yaml,yml}", "**/*.{yaml,yml}"];
3232
const GLOB_CONFIG = ["*.config.{ts,tsx,cts,mts}", "**/*.config.{ts,tsx,cts,mts}"];
@@ -37,21 +37,21 @@ const templateIndentAnnotations = [
3737
"dedent",
3838
"html",
3939
"tsx",
40-
"ts",
40+
"ts"
4141
];
4242

4343
const packagesTsConfigs = [
4444
"packages/*/tsconfig.json",
45-
"packages/*/*/tsconfig.json",
45+
"packages/*/*/tsconfig.json"
4646
];
4747

4848
const rootTsConfigs = [
49-
"tsconfig.json",
49+
"tsconfig.json"
5050
];
5151

5252
const p11tOptions = {
5353
type: "natural",
54-
ignoreCase: false,
54+
ignoreCase: false
5555
};
5656

5757
const p11tGroups = {
@@ -62,17 +62,17 @@ const p11tGroups = {
6262
"^name$",
6363
"^meta$",
6464
"^title$",
65-
"^description$",
65+
"^description$"
6666
],
6767
alias: ["^alias$", "^as$"],
68-
rules: ["^node$", "^messageId$"],
68+
rules: ["^node$", "^messageId$"]
6969
},
70-
groups: ["id", "type", "meta", "alias", "rules", "unknown"],
70+
groups: ["id", "type", "meta", "alias", "rules", "unknown"]
7171
};
7272

7373
const enableTypeCheckedRules = {
7474
...tseslint.configs.strictTypeCheckedOnly
75-
.map(x => x.rules)
75+
.map((x) => x.rules)
7676
.reduce((a, b) => ({ ...a, ...b }), {}),
7777
...eslintPluginSafeTypeScript.configs.recommended.rules,
7878
"@susisu/safe-typescript/no-unsafe-object-property-check": "off",
@@ -86,37 +86,37 @@ const enableTypeCheckedRules = {
8686
allowNullableObject: false,
8787
allowNullableString: false,
8888
allowNumber: true,
89-
allowString: false,
90-
}],
89+
allowString: false
90+
}]
9191
} as const;
9292

93-
const disableTypeCheckedRules = Object.fromEntries(Object.keys(enableTypeCheckedRules).map(x => [x, "off"]));
93+
const disableTypeCheckedRules = Object.fromEntries(Object.keys(enableTypeCheckedRules).map((x) => [x, "off"]));
9494

9595
export default tseslint.config(
9696
eslintConfigFlatGitignore(),
9797
{
9898
extends: [
9999
// @ts-expect-error - TODO: make types compatible
100-
eslintMarkdown.configs.recommended,
100+
eslintMarkdown.configs.recommended
101101
],
102102
files: GLOB_MD,
103103
ignores: [
104-
"packages/**/docs/**/*.md",
104+
"packages/**/docs/**/*.md"
105105
],
106106
language: "markdown/gfm",
107107
rules: {
108108
"markdown/no-html": "error",
109-
"markdown/no-missing-label-refs": "off",
110-
},
109+
"markdown/no-missing-label-refs": "off"
110+
}
111111
},
112112
{
113113
name: "global-ignores",
114114
ignores: [
115115
"docs",
116116
"examples",
117117
"website",
118-
"test",
119-
],
118+
"test"
119+
]
120120
},
121121
{
122122
files: [...GLOB_JS, ...GLOB_TS],
@@ -128,7 +128,7 @@ export default tseslint.config(
128128
eslintPluginPerfectionist.configs["recommended-natural"],
129129
eslintPluginRegexp.configs["flat/recommended"],
130130
eslintPluginJsdoc.configs["flat/recommended-typescript-error"],
131-
eslintPluginEslintPlugin.configs["flat/all-type-checked"],
131+
eslintPluginEslintPlugin.configs["flat/all-type-checked"]
132132
],
133133
languageOptions: {
134134
parser: tseslint.parser,
@@ -137,16 +137,16 @@ export default tseslint.config(
137137
project: packagesTsConfigs,
138138
projectService: true,
139139
tsconfigRootDir: dirname,
140-
warnOnUnsupportedTypeScriptVersion: false,
141-
},
140+
warnOnUnsupportedTypeScriptVersion: false
141+
}
142142
},
143143
plugins: {
144144
["@stylistic"]: eslintStylistic,
145145
["@susisu/safe-typescript"]: eslintPluginSafeTypeScript,
146146
["local"]: eslintPluginLocal,
147147
["simple-import-sort"]: eslintPluginSimpleImportSort,
148-
["unicorn"]: eslintPluginUnicorn,
149-
},
148+
["unicorn"]: eslintPluginUnicorn
149+
}
150150
},
151151
{
152152
files: [...GLOB_JS, ...GLOB_TS],
@@ -167,8 +167,8 @@ export default tseslint.config(
167167
"error",
168168
{
169169
message: "no optional",
170-
selector: "TSPropertySignature[optional=true]",
171-
},
170+
selector: "TSPropertySignature[optional=true]"
171+
}
172172
],
173173
// Part: typescript-eslint rules
174174
"@typescript-eslint/ban-ts-comment": [
@@ -178,8 +178,8 @@ export default tseslint.config(
178178
"ts-check": false,
179179
"ts-expect-error": "allow-with-description",
180180
"ts-ignore": true,
181-
"ts-nocheck": true,
182-
},
181+
"ts-nocheck": true
182+
}
183183
],
184184
"@typescript-eslint/ban-types": "off",
185185
"@typescript-eslint/consistent-type-imports": "error",
@@ -192,8 +192,8 @@ export default tseslint.config(
192192
{
193193
argsIgnorePattern: "^_",
194194
caughtErrors: "all",
195-
varsIgnorePattern: "^_",
196-
},
195+
varsIgnorePattern: "^_"
196+
}
197197
],
198198
...enableTypeCheckedRules,
199199
// Part: jsdoc rules
@@ -211,16 +211,24 @@ export default tseslint.config(
211211
"simple-import-sort/exports": "warn",
212212
"simple-import-sort/imports": "warn",
213213
// Part: stylistic rules
214+
"@stylistic/arrow-parens": ["warn", "always"],
215+
"@stylistic/comma-dangle": ["warn", "never"],
214216
"@stylistic/curly-newline": ["warn", "always"],
217+
"@stylistic/no-multi-spaces": ["warn"],
218+
"@stylistic/operator-linebreak": [
219+
"warn",
220+
"before"
221+
],
222+
"@stylistic/quote-props": ["error", "as-needed"],
215223
// Part: perfectionist rules
216224
"perfectionist/sort-exports": "off",
217225
"perfectionist/sort-imports": "off",
218226
"perfectionist/sort-interfaces": [
219227
"warn",
220228
{
221229
...p11tOptions,
222-
...p11tGroups,
223-
},
230+
...p11tGroups
231+
}
224232
],
225233
"perfectionist/sort-intersection-types": "off",
226234
"perfectionist/sort-modules": "off",
@@ -230,16 +238,16 @@ export default tseslint.config(
230238
"warn",
231239
{
232240
...p11tOptions,
233-
...p11tGroups,
234-
},
241+
...p11tGroups
242+
}
235243
],
236244
"perfectionist/sort-objects": [
237245
"warn",
238246
{
239247
...p11tOptions,
240248
...p11tGroups,
241-
partitionByComment: "^Part:.*",
242-
},
249+
partitionByComment: "^Part:.*"
250+
}
243251
],
244252
"perfectionist/sort-switch-case": "off",
245253
"perfectionist/sort-union-types": "warn",
@@ -248,8 +256,8 @@ export default tseslint.config(
248256
"warn",
249257
{
250258
comments: templateIndentAnnotations,
251-
tags: templateIndentAnnotations,
252-
},
259+
tags: templateIndentAnnotations
260+
}
253261
],
254262
// Part: eslint-plugin rules
255263
"eslint-plugin/meta-property-ordering": "off",
@@ -258,53 +266,53 @@ export default tseslint.config(
258266
"eslint-plugin/require-meta-docs-url": "off",
259267
// Part: local rules
260268
"local/avoid-multiline-template-expression": "warn",
261-
"local/prefer-eqeq-nullish-comparison": "warn",
269+
"local/prefer-eqeq-nullish-comparison": "warn"
262270
},
263271
settings: {
264272
"import-x/parsers": {
265-
"@typescript-eslint/parser": GLOB_TS,
273+
"@typescript-eslint/parser": GLOB_TS
266274
},
267-
"import-x/resolver": "oxc",
268-
},
275+
"import-x/resolver": "oxc"
276+
}
269277
},
270278
{
271279
files: GLOB_JS,
272280
languageOptions: {
273281
parserOptions: {
274282
project: false,
275-
projectService: false,
276-
},
283+
projectService: false
284+
}
277285
},
278286
rules: {
279287
...disableTypeCheckedRules,
280-
"@typescript-eslint/no-var-requires": "off",
281-
},
288+
"@typescript-eslint/no-var-requires": "off"
289+
}
282290
},
283291
{
284292
files: GLOB_TEST,
285293
languageOptions: {
286294
globals: {
287-
...eslintPluginVitest.environments.env.globals,
295+
...eslintPluginVitest.environments.env.globals
288296
},
289297
parser: tseslint.parser,
290298
parserOptions: {
291299
allowAutomaticSingleRunInference: true,
292300
project: rootTsConfigs,
293301
projectService: true,
294302
tsconfigRootDir: dirname,
295-
warnOnUnsupportedTypeScriptVersion: false,
296-
},
303+
warnOnUnsupportedTypeScriptVersion: false
304+
}
297305
},
298306
plugins: {
299-
vitest: eslintPluginVitest,
307+
vitest: eslintPluginVitest
300308
},
301309
rules: {
302310
...disableTypeCheckedRules,
303311
...eslintPluginVitest.configs.recommended.rules,
304312
"@typescript-eslint/no-empty-function": ["error", { allow: ["arrowFunctions"] }],
305313
"import-x/no-extraneous-dependencies": "off",
306-
"local/avoid-multiline-template-expression": "off",
307-
},
314+
"local/avoid-multiline-template-expression": "off"
315+
}
308316
},
309317
{
310318
files: GLOB_SCRIPT,
@@ -315,12 +323,12 @@ export default tseslint.config(
315323
project: rootTsConfigs,
316324
projectService: true,
317325
tsconfigRootDir: dirname,
318-
warnOnUnsupportedTypeScriptVersion: false,
319-
},
326+
warnOnUnsupportedTypeScriptVersion: false
327+
}
320328
},
321329
rules: {
322-
"no-console": "off",
323-
},
330+
"no-console": "off"
331+
}
324332
},
325333
{
326334
files: GLOB_CONFIG,
@@ -329,12 +337,12 @@ export default tseslint.config(
329337
parserOptions: {
330338
allowAutomaticSingleRunInference: true,
331339
project: false,
332-
projectService: false,
333-
},
340+
projectService: false
341+
}
334342
},
335343
rules: {
336344
...disableTypeCheckedRules,
337-
"import-x/no-extraneous-dependencies": "off",
338-
},
339-
},
345+
"import-x/no-extraneous-dependencies": "off"
346+
}
347+
}
340348
);

0 commit comments

Comments
 (0)