Skip to content

Commit 6313724

Browse files
committed
fix: what if enable stylistic by default and remove all config
1 parent 43d2830 commit 6313724

File tree

12 files changed

+91
-254
lines changed

12 files changed

+91
-254
lines changed

scripts/typegen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
regexp,
1717
solid,
1818
sortPackageJson,
19-
stylistic,
2019
svelte,
2120
test,
2221
toml,
@@ -48,7 +47,6 @@ const configs = await combine(
4847
regexp(),
4948
solid(),
5049
sortPackageJson(),
51-
stylistic(),
5250
svelte(),
5351
test(),
5452
toml(),

src/configs/astro.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import type { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from '../types'
1+
import type { OptionsFiles, OptionsOverrides, TypedFlatConfigItem } from '../types'
22
import { GLOB_ASTRO } from '../globs'
33
import { interopDefault } from '../utils'
44

55
export async function astro(
6-
options: OptionsOverrides & OptionsStylistic & OptionsFiles = {},
6+
options: OptionsOverrides & OptionsFiles = {},
77
): Promise<TypedFlatConfigItem[]> {
88
const {
99
files = [GLOB_ASTRO],
1010
overrides = {},
11-
stylistic = true,
1211
} = options
1312

1413
const [
@@ -42,15 +41,11 @@ export async function astro(
4241
'astro/no-set-html-directive': 'off',
4342
'astro/semi': 'off',
4443

45-
...stylistic
46-
? {
47-
'style/indent': 'off',
48-
'style/jsx-closing-tag-location': 'off',
49-
'style/jsx-indent': 'off',
50-
'style/jsx-one-expression-per-line': 'off',
51-
'style/no-multiple-empty-lines': 'off',
52-
}
53-
: {},
44+
'style/indent': 'off',
45+
'style/jsx-closing-tag-location': 'off',
46+
'style/jsx-indent': 'off',
47+
'style/jsx-one-expression-per-line': 'off',
48+
'style/no-multiple-empty-lines': 'off',
5449

5550
...overrides,
5651
},

src/configs/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export * from './node'
99
export * from './perfectionist'
1010
export * from './react'
1111
export * from './sort'
12-
export * from './stylistic'
1312
export * from './svelte'
1413
export * from './test'
1514
export * from './typescript'

src/configs/jsdoc.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { interopDefault } from '../utils'
2-
import type { OptionsStylistic, TypedFlatConfigItem } from '../types'
3-
4-
export async function jsdoc(options: OptionsStylistic = {}): Promise<TypedFlatConfigItem[]> {
5-
const {
6-
stylistic = true,
7-
} = options
2+
import type { TypedFlatConfigItem } from '../types'
83

4+
export async function jsdoc(): Promise<TypedFlatConfigItem[]> {
95
return [
106
{
117
name: 'jhqn/jsdoc/rules',
@@ -14,11 +10,13 @@ export async function jsdoc(options: OptionsStylistic = {}): Promise<TypedFlatCo
1410
},
1511
rules: {
1612
'jsdoc/check-access': 'warn',
13+
'jsdoc/check-alignment': 'warn',
1714
'jsdoc/check-param-names': 'warn',
1815
'jsdoc/check-property-names': 'warn',
1916
'jsdoc/check-types': 'warn',
2017
'jsdoc/empty-tags': 'warn',
2118
'jsdoc/implements-on-classes': 'warn',
19+
'jsdoc/multiline-blocks': 'warn',
2220
'jsdoc/no-defaults': 'warn',
2321
'jsdoc/no-multi-asterisks': 'warn',
2422
'jsdoc/require-param-name': 'warn',
@@ -28,13 +26,6 @@ export async function jsdoc(options: OptionsStylistic = {}): Promise<TypedFlatCo
2826
'jsdoc/require-returns-check': 'warn',
2927
'jsdoc/require-returns-description': 'warn',
3028
'jsdoc/require-yields-check': 'warn',
31-
32-
...stylistic
33-
? {
34-
'jsdoc/check-alignment': 'warn',
35-
'jsdoc/multiline-blocks': 'warn',
36-
}
37-
: {},
3829
},
3930
},
4031
]

src/configs/jsonc.ts

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import type { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from '../types'
1+
import type { OptionsFiles, OptionsOverrides, TypedFlatConfigItem } from '../types'
22
import { GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from '../globs'
33
import { interopDefault } from '../utils'
44

55
export async function jsonc(
6-
options: OptionsFiles & OptionsStylistic & OptionsOverrides = {},
6+
options: OptionsFiles & OptionsOverrides = {},
77
): Promise<TypedFlatConfigItem[]> {
88
const {
99
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1010
overrides = {},
11-
stylistic = true,
1211
} = options
1312

14-
const {
15-
indent = 2,
16-
} = typeof stylistic === 'boolean' ? {} : stylistic
17-
1813
const [
1914
pluginJsonc,
2015
parserJsonc,
@@ -37,6 +32,11 @@ export async function jsonc(
3732
},
3833
name: 'jhqn/jsonc/rules',
3934
rules: {
35+
'jsonc/array-bracket-spacing': ['error', 'never'],
36+
'jsonc/comma-dangle': ['error', 'never'],
37+
'jsonc/comma-style': ['error', 'last'],
38+
'jsonc/indent': ['error', 2],
39+
'jsonc/key-spacing': ['error', { afterColon: true, beforeColon: false }],
4040
'jsonc/no-bigint-literals': 'error',
4141
'jsonc/no-binary-expression': 'error',
4242
'jsonc/no-binary-numeric-literals': 'error',
@@ -60,25 +60,15 @@ export async function jsonc(
6060
'jsonc/no-undefined-value': 'error',
6161
'jsonc/no-unicode-codepoint-escapes': 'error',
6262
'jsonc/no-useless-escape': 'error',
63+
'jsonc/object-curly-newline': ['error', { consistent: true, multiline: true }],
64+
'jsonc/object-curly-spacing': ['error', 'always'],
65+
'jsonc/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
66+
'jsonc/quote-props': 'error',
67+
'jsonc/quotes': 'error',
6368
'jsonc/space-unary-ops': 'error',
6469
'jsonc/valid-json-number': 'error',
6570
'jsonc/vue-custom-block/no-parsing-error': 'error',
6671

67-
...stylistic
68-
? {
69-
'jsonc/array-bracket-spacing': ['error', 'never'],
70-
'jsonc/comma-dangle': ['error', 'never'],
71-
'jsonc/comma-style': ['error', 'last'],
72-
'jsonc/indent': ['error', indent],
73-
'jsonc/key-spacing': ['error', { afterColon: true, beforeColon: false }],
74-
'jsonc/object-curly-newline': ['error', { consistent: true, multiline: true }],
75-
'jsonc/object-curly-spacing': ['error', 'always'],
76-
'jsonc/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
77-
'jsonc/quote-props': 'error',
78-
'jsonc/quotes': 'error',
79-
}
80-
: {},
81-
8272
...overrides,
8373
},
8474
},

src/configs/stylistic.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/configs/svelte.ts

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
import { ensurePackages, interopDefault } from '../utils'
2-
import type { OptionsFiles, OptionsHasTypeScript, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from '../types'
2+
import type { OptionsFiles, OptionsHasTypeScript, OptionsOverrides, TypedFlatConfigItem } from '../types'
33
import { GLOB_SVELTE } from '../globs'
44

55
export async function svelte(
6-
options: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles = {},
6+
options: OptionsHasTypeScript & OptionsOverrides & OptionsFiles = {},
77
): Promise<TypedFlatConfigItem[]> {
88
const {
99
files = [GLOB_SVELTE],
1010
overrides = {},
11-
stylistic = true,
1211
} = options
1312

14-
const {
15-
indent = 2,
16-
quotes = 'single',
17-
} = typeof stylistic === 'boolean' ? {} : stylistic
18-
1913
await ensurePackages([
2014
'eslint-plugin-svelte',
2115
])
@@ -59,7 +53,14 @@ export async function svelte(
5953
varsIgnorePattern: '^\\$\\$Props$',
6054
}],
6155

56+
'style/indent': 'off', // superseded by svelte/indent
57+
'style/no-trailing-spaces': 'off', // superseded by svelte/no-trailing-spaces
6258
'svelte/comment-directive': 'error',
59+
'svelte/derived-has-same-inputs-outputs': 'error',
60+
'svelte/html-closing-bracket-spacing': 'error',
61+
'svelte/html-quotes': ['error', { prefer: 'single' }],
62+
'svelte/indent': ['error', { alignAttributesVertically: true, indent: 2 }],
63+
'svelte/mustache-spacing': 'error',
6364
'svelte/no-at-debug-tags': 'warn',
6465
'svelte/no-at-html-tags': 'error',
6566
'svelte/no-dupe-else-if-blocks': 'error',
@@ -73,10 +74,13 @@ export async function svelte(
7374
'svelte/no-reactive-functions': 'error',
7475
'svelte/no-reactive-literals': 'error',
7576
'svelte/no-shorthand-style-property-overrides': 'error',
77+
'svelte/no-spaces-around-equal-signs-in-attribute': 'error',
78+
'svelte/no-trailing-spaces': 'error',
7679
'svelte/no-unknown-style-directive-property': 'error',
7780
'svelte/no-unused-svelte-ignore': 'error',
7881
'svelte/no-useless-mustaches': 'error',
7982
'svelte/require-store-callbacks-use-set-param': 'error',
83+
'svelte/spaced-html-comment': 'error',
8084
'svelte/system': 'error',
8185
'svelte/valid-compile': 'error',
8286
'svelte/valid-each-key': 'error',
@@ -86,21 +90,6 @@ export async function svelte(
8690
{ args: 'after-used', argsIgnorePattern: '^_', vars: 'all', varsIgnorePattern: '^(_|\\$\\$Props$)' },
8791
],
8892

89-
...stylistic
90-
? {
91-
'style/indent': 'off', // superseded by svelte/indent
92-
'style/no-trailing-spaces': 'off', // superseded by svelte/no-trailing-spaces
93-
'svelte/derived-has-same-inputs-outputs': 'error',
94-
'svelte/html-closing-bracket-spacing': 'error',
95-
'svelte/html-quotes': ['error', { prefer: quotes }],
96-
'svelte/indent': ['error', { alignAttributesVertically: true, indent }],
97-
'svelte/mustache-spacing': 'error',
98-
'svelte/no-spaces-around-equal-signs-in-attribute': 'error',
99-
'svelte/no-trailing-spaces': 'error',
100-
'svelte/spaced-html-comment': 'error',
101-
}
102-
: {},
103-
10493
...overrides,
10594
},
10695
},

src/configs/toml.ts

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import type { OptionsFiles, OptionsOverrides, OptionsStylistic, TypedFlatConfigItem } from '../types'
1+
import type { OptionsFiles, OptionsOverrides, TypedFlatConfigItem } from '../types'
22
import { GLOB_TOML } from '../globs'
33
import { interopDefault } from '../utils'
44

55
export async function toml(
6-
options: OptionsOverrides & OptionsStylistic & OptionsFiles = {},
6+
options: OptionsOverrides & OptionsFiles = {},
77
): Promise<TypedFlatConfigItem[]> {
88
const {
99
files = [GLOB_TOML],
1010
overrides = {},
11-
stylistic = true,
1211
} = options
1312

14-
const {
15-
indent = 2,
16-
} = typeof stylistic === 'boolean' ? {} : stylistic
17-
1813
const [
1914
pluginToml,
2015
parserToml,
@@ -39,32 +34,26 @@ export async function toml(
3934
rules: {
4035
'style/spaced-comment': 'off',
4136

37+
'toml/array-bracket-newline': 'error',
38+
'toml/array-bracket-spacing': 'error',
39+
'toml/array-element-newline': 'error',
4240
'toml/comma-style': 'error',
41+
'toml/indent': ['error', 2],
42+
'toml/inline-table-curly-spacing': 'error',
43+
'toml/key-spacing': 'error',
4344
'toml/keys-order': 'error',
4445
'toml/no-space-dots': 'error',
4546
'toml/no-unreadable-number-separator': 'error',
47+
'toml/padding-line-between-pairs': 'error',
48+
'toml/padding-line-between-tables': 'error',
4649
'toml/precision-of-fractional-seconds': 'error',
4750
'toml/precision-of-integer': 'error',
51+
'toml/quoted-keys': 'error',
52+
'toml/spaced-comment': 'error',
53+
'toml/table-bracket-spacing': 'error',
4854
'toml/tables-order': 'error',
49-
5055
'toml/vue-custom-block/no-parsing-error': 'error',
5156

52-
...stylistic
53-
? {
54-
'toml/array-bracket-newline': 'error',
55-
'toml/array-bracket-spacing': 'error',
56-
'toml/array-element-newline': 'error',
57-
'toml/indent': ['error', indent === 'tab' ? 2 : indent],
58-
'toml/inline-table-curly-spacing': 'error',
59-
'toml/key-spacing': 'error',
60-
'toml/padding-line-between-pairs': 'error',
61-
'toml/padding-line-between-tables': 'error',
62-
'toml/quoted-keys': 'error',
63-
'toml/spaced-comment': 'error',
64-
'toml/table-bracket-spacing': 'error',
65-
}
66-
: {},
67-
6857
...overrides,
6958
},
7059
},

0 commit comments

Comments
 (0)