@so1ve/eslint-config 4.1.7 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/astro.d.mts +8 -0
- package/dist/configs/astro.mjs +49 -0
- package/dist/configs/command.d.mts +6 -0
- package/dist/configs/command.mjs +10 -0
- package/dist/configs/comments.d.mts +6 -0
- package/dist/configs/comments.mjs +19 -0
- package/dist/configs/de-morgan.d.mts +6 -0
- package/dist/configs/de-morgan.mjs +10 -0
- package/dist/configs/formatting.d.mts +6 -0
- package/dist/configs/formatting.mjs +294 -0
- package/dist/configs/html.d.mts +6 -0
- package/dist/configs/html.mjs +37 -0
- package/dist/configs/ignores.d.mts +6 -0
- package/dist/configs/ignores.mjs +14 -0
- package/dist/configs/imports.d.mts +6 -0
- package/dist/configs/imports.mjs +75 -0
- package/dist/configs/index.d.mts +24 -0
- package/dist/configs/index.mjs +26 -0
- package/dist/configs/javascript.d.mts +8 -0
- package/dist/configs/javascript.mjs +326 -0
- package/dist/configs/jsonc.d.mts +6 -0
- package/dist/configs/jsonc.mjs +30 -0
- package/dist/configs/mdx.d.mts +9 -0
- package/dist/configs/mdx.mjs +43 -0
- package/dist/configs/node.d.mts +6 -0
- package/dist/configs/node.mjs +21 -0
- package/dist/configs/only-error.d.mts +6 -0
- package/dist/configs/only-error.mjs +10 -0
- package/dist/configs/perfectionist.d.mts +6 -0
- package/dist/configs/perfectionist.mjs +34 -0
- package/dist/configs/pnpm.d.mts +6 -0
- package/dist/configs/pnpm.mjs +106 -0
- package/dist/configs/promise.d.mts +6 -0
- package/dist/configs/promise.mjs +13 -0
- package/dist/configs/solid.d.mts +9 -0
- package/dist/configs/solid.mjs +24 -0
- package/dist/configs/sort-imports.d.mts +6 -0
- package/dist/configs/sort-imports.mjs +11 -0
- package/dist/configs/test.d.mts +8 -0
- package/dist/configs/test.mjs +46 -0
- package/dist/configs/toml.d.mts +8 -0
- package/dist/configs/toml.mjs +24 -0
- package/dist/configs/typescript.d.mts +10 -0
- package/dist/configs/typescript.mjs +232 -0
- package/dist/configs/unicorn.d.mts +6 -0
- package/dist/configs/unicorn.mjs +61 -0
- package/dist/configs/vue.d.mts +9 -0
- package/dist/configs/vue.mjs +194 -0
- package/dist/configs/yaml.d.mts +8 -0
- package/dist/configs/yaml.mjs +25 -0
- package/dist/factory.d.mts +21 -0
- package/dist/factory.mjs +114 -0
- package/dist/globs.d.mts +31 -0
- package/dist/globs.mjs +80 -0
- package/dist/index.d.mts +30 -16646
- package/dist/index.mjs +28 -2298
- package/dist/plugins.mjs +15 -0
- package/dist/typegen.d.mts +16308 -0
- package/dist/types.d.mts +175 -0
- package/dist/utils.d.mts +30 -0
- package/dist/utils.mjs +32 -0
- package/package.json +4 -6
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GLOB_TESTS } from "../globs.mjs";
|
|
2
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/test.ts
|
|
5
|
+
async function test({ overrides } = {}) {
|
|
6
|
+
const [pluginNoOnlyTests, pluginVitest, pluginJestFormatting] = await Promise.all([
|
|
7
|
+
interopDefault(import("eslint-plugin-no-only-tests")),
|
|
8
|
+
interopDefault(import("@vitest/eslint-plugin")),
|
|
9
|
+
interopDefault(import("eslint-plugin-jest-formatting"))
|
|
10
|
+
]);
|
|
11
|
+
return [{
|
|
12
|
+
name: "so1ve/test/setup",
|
|
13
|
+
plugins: {
|
|
14
|
+
"jest-formatting": pluginJestFormatting,
|
|
15
|
+
"no-only-tests": pluginNoOnlyTests,
|
|
16
|
+
"vitest": pluginVitest
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
name: "so1ve/test/rules",
|
|
20
|
+
files: GLOB_TESTS,
|
|
21
|
+
rules: {
|
|
22
|
+
...pluginVitest.configs.recommended.rules,
|
|
23
|
+
"no-only-tests/no-only-tests": "error",
|
|
24
|
+
"vitest/expect-expect": "off",
|
|
25
|
+
"vitest/no-alias-methods": "error",
|
|
26
|
+
"vitest/no-interpolation-in-snapshots": "error",
|
|
27
|
+
"vitest/no-test-prefixes": "error",
|
|
28
|
+
"vitest/prefer-comparison-matcher": "error",
|
|
29
|
+
"vitest/prefer-expect-resolves": "error",
|
|
30
|
+
"vitest/prefer-mock-promise-shorthand": "error",
|
|
31
|
+
"vitest/prefer-spy-on": "error",
|
|
32
|
+
"vitest/prefer-to-be-falsy": "error",
|
|
33
|
+
"vitest/prefer-to-be-object": "error",
|
|
34
|
+
"vitest/prefer-to-be-truthy": "error",
|
|
35
|
+
"vitest/prefer-to-contain": "error",
|
|
36
|
+
"vitest/prefer-to-have-length": "error",
|
|
37
|
+
"vitest/prefer-todo": "error",
|
|
38
|
+
"vitest/valid-describe-callback": "off",
|
|
39
|
+
"vitest/valid-title": "off",
|
|
40
|
+
...overrides
|
|
41
|
+
}
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { test };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GLOB_TOML } from "../globs.mjs";
|
|
2
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/toml.ts
|
|
5
|
+
async function toml({ overrides } = {}) {
|
|
6
|
+
const [parserToml, pluginToml] = await Promise.all([interopDefault(import("toml-eslint-parser")), interopDefault(import("eslint-plugin-toml"))]);
|
|
7
|
+
return [{
|
|
8
|
+
name: "so1ve/toml/setup",
|
|
9
|
+
plugins: { toml: pluginToml }
|
|
10
|
+
}, {
|
|
11
|
+
name: "so1ve/toml/rules",
|
|
12
|
+
languageOptions: { parser: parserToml },
|
|
13
|
+
files: [GLOB_TOML],
|
|
14
|
+
rules: {
|
|
15
|
+
...pluginToml.configs.recommended.rules,
|
|
16
|
+
"no-irregular-whitespace": "off",
|
|
17
|
+
"style/spaced-comment": "off",
|
|
18
|
+
...overrides
|
|
19
|
+
}
|
|
20
|
+
}];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { toml };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OptionsComponentExts, OptionsOverrides, OptionsTypeScriptParserOptions, TypedFlatConfigItem } from "../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/typescript.d.ts
|
|
4
|
+
declare const typescript: ({
|
|
5
|
+
componentExts,
|
|
6
|
+
parserOptions,
|
|
7
|
+
overrides
|
|
8
|
+
}?: OptionsTypeScriptParserOptions & OptionsComponentExts & OptionsOverrides) => Promise<TypedFlatConfigItem[]>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { typescript };
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { GLOB_ASTRO_TS, GLOB_MARKDOWN_CODE, GLOB_TS, GLOB_TSX } from "../globs.mjs";
|
|
2
|
+
import { renameRules } from "../utils.mjs";
|
|
3
|
+
import { pluginImport } from "../plugins.mjs";
|
|
4
|
+
import tseslint from "typescript-eslint";
|
|
5
|
+
|
|
6
|
+
//#region src/configs/typescript.ts
|
|
7
|
+
const typescript = async ({ componentExts = [], parserOptions, overrides } = {}) => [
|
|
8
|
+
{
|
|
9
|
+
name: "so1ve/typescript/setup",
|
|
10
|
+
plugins: {
|
|
11
|
+
import: pluginImport,
|
|
12
|
+
ts: tseslint.plugin
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "so1ve/typescript/rules",
|
|
17
|
+
files: [
|
|
18
|
+
GLOB_TS,
|
|
19
|
+
GLOB_TSX,
|
|
20
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
21
|
+
],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
parser: tseslint.parser,
|
|
24
|
+
parserOptions: {
|
|
25
|
+
sourceType: "module",
|
|
26
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
27
|
+
...parserOptions
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
settings: { "import/resolver": {
|
|
31
|
+
node: { extensions: [
|
|
32
|
+
".js",
|
|
33
|
+
".jsx",
|
|
34
|
+
".mjs",
|
|
35
|
+
".ts",
|
|
36
|
+
".tsx",
|
|
37
|
+
".d.ts"
|
|
38
|
+
] },
|
|
39
|
+
typescript: { extensions: [
|
|
40
|
+
".js",
|
|
41
|
+
".jsx",
|
|
42
|
+
".mjs",
|
|
43
|
+
".ts",
|
|
44
|
+
".tsx",
|
|
45
|
+
".d.ts"
|
|
46
|
+
] }
|
|
47
|
+
} },
|
|
48
|
+
rules: {
|
|
49
|
+
...renameRules(tseslint.configs.eslintRecommended.rules, { "@typescript-eslint": "ts" }),
|
|
50
|
+
...renameRules(tseslint.configs.recommended.map((config) => config.rules).filter(Boolean).reduce((a, b) => ({
|
|
51
|
+
...a,
|
|
52
|
+
...b
|
|
53
|
+
}), {}), { "@typescript-eslint": "ts" }),
|
|
54
|
+
"import/named": "off",
|
|
55
|
+
"no-dupe-class-members": "off",
|
|
56
|
+
"no-invalid-this": "off",
|
|
57
|
+
"no-redeclare": "off",
|
|
58
|
+
"no-use-before-define": "off",
|
|
59
|
+
"no-useless-constructor": "off",
|
|
60
|
+
"object-curly-spacing": "off",
|
|
61
|
+
"so1ve/no-inline-type-modifier": "error",
|
|
62
|
+
"so1ve/prefer-ts-expect-error": "error",
|
|
63
|
+
"space-before-blocks": "off",
|
|
64
|
+
"space-before-function-paren": "off",
|
|
65
|
+
"ts/ban-ts-comment": ["error", { minimumDescriptionLength: 0 }],
|
|
66
|
+
"ts/ban-ts-ignore": "off",
|
|
67
|
+
"ts/brace-style": "off",
|
|
68
|
+
"ts/camelcase": "off",
|
|
69
|
+
"ts/comma-dangle": "off",
|
|
70
|
+
"ts/comma-spacing": "off",
|
|
71
|
+
"ts/consistent-indexed-object-style": ["error", "record"],
|
|
72
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
73
|
+
"ts/consistent-type-imports": ["error", {
|
|
74
|
+
disallowTypeAnnotations: false,
|
|
75
|
+
prefer: "type-imports"
|
|
76
|
+
}],
|
|
77
|
+
"ts/explicit-function-return-type": "off",
|
|
78
|
+
"ts/explicit-member-accessibility": ["error", {
|
|
79
|
+
accessibility: "explicit",
|
|
80
|
+
overrides: { constructors: "no-public" }
|
|
81
|
+
}],
|
|
82
|
+
"ts/explicit-module-boundary-types": "off",
|
|
83
|
+
"ts/func-call-spacing": "off",
|
|
84
|
+
"ts/indent": "off",
|
|
85
|
+
"ts/keyword-spacing": "off",
|
|
86
|
+
"ts/member-delimiter-style": "off",
|
|
87
|
+
"ts/method-signature-style": ["error", "property"],
|
|
88
|
+
"ts/no-dupe-class-members": "error",
|
|
89
|
+
"ts/no-duplicate-enum-values": "error",
|
|
90
|
+
"ts/no-empty-function": "off",
|
|
91
|
+
"ts/no-empty-interface": "off",
|
|
92
|
+
"ts/no-empty-object-type": "off",
|
|
93
|
+
"ts/no-explicit-any": "off",
|
|
94
|
+
"ts/no-extra-semi": "off",
|
|
95
|
+
"ts/no-invalid-this": "error",
|
|
96
|
+
"ts/no-non-null-asserted-nullish-coalescing": "error",
|
|
97
|
+
"ts/no-non-null-assertion": "off",
|
|
98
|
+
"ts/no-parameter-properties": "off",
|
|
99
|
+
"ts/no-redeclare": "error",
|
|
100
|
+
"ts/no-require-imports": "error",
|
|
101
|
+
"ts/no-restricted-types": ["error", { types: {
|
|
102
|
+
String: {
|
|
103
|
+
message: "Use `string` instead.",
|
|
104
|
+
fixWith: "string"
|
|
105
|
+
},
|
|
106
|
+
Number: {
|
|
107
|
+
message: "Use `number` instead.",
|
|
108
|
+
fixWith: "number"
|
|
109
|
+
},
|
|
110
|
+
Boolean: {
|
|
111
|
+
message: "Use `boolean` instead.",
|
|
112
|
+
fixWith: "boolean"
|
|
113
|
+
},
|
|
114
|
+
Symbol: {
|
|
115
|
+
message: "Use `symbol` instead.",
|
|
116
|
+
fixWith: "symbol"
|
|
117
|
+
},
|
|
118
|
+
BigInt: {
|
|
119
|
+
message: "Use `bigint` instead.",
|
|
120
|
+
fixWith: "bigint"
|
|
121
|
+
},
|
|
122
|
+
Function: {
|
|
123
|
+
message: "Use `(...args: any[]) => any` instead.",
|
|
124
|
+
fixWith: "(...args: any[]) => any"
|
|
125
|
+
}
|
|
126
|
+
} }],
|
|
127
|
+
"ts/no-unsafe-function-type": "error",
|
|
128
|
+
"ts/no-unused-vars": "off",
|
|
129
|
+
"ts/no-use-before-define": ["error", {
|
|
130
|
+
functions: false,
|
|
131
|
+
classes: false,
|
|
132
|
+
variables: true
|
|
133
|
+
}],
|
|
134
|
+
"ts/no-wrapper-object-types": "error",
|
|
135
|
+
"ts/prefer-for-of": "error",
|
|
136
|
+
"ts/quotes": "off",
|
|
137
|
+
"ts/semi": "off",
|
|
138
|
+
"ts/space-before-blocks": "off",
|
|
139
|
+
"ts/space-before-function-paren": "off",
|
|
140
|
+
"ts/triple-slash-reference": "off",
|
|
141
|
+
"ts/type-annotation-spacing": "off",
|
|
142
|
+
...overrides
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "so1ve/typescript/rules/type-aware",
|
|
147
|
+
files: [
|
|
148
|
+
GLOB_TS,
|
|
149
|
+
GLOB_TSX,
|
|
150
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
151
|
+
],
|
|
152
|
+
ignores: [GLOB_MARKDOWN_CODE, GLOB_ASTRO_TS],
|
|
153
|
+
languageOptions: {
|
|
154
|
+
parser: tseslint.parser,
|
|
155
|
+
parserOptions: {
|
|
156
|
+
sourceType: "module",
|
|
157
|
+
projectService: true,
|
|
158
|
+
tsconfigRootDir: process.cwd()
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
settings: { "import/resolver": {
|
|
162
|
+
node: { extensions: [
|
|
163
|
+
".js",
|
|
164
|
+
".jsx",
|
|
165
|
+
".mjs",
|
|
166
|
+
".ts",
|
|
167
|
+
".tsx",
|
|
168
|
+
".d.ts"
|
|
169
|
+
] },
|
|
170
|
+
typescript: { extensions: [
|
|
171
|
+
".js",
|
|
172
|
+
".jsx",
|
|
173
|
+
".mjs",
|
|
174
|
+
".ts",
|
|
175
|
+
".tsx",
|
|
176
|
+
".d.ts"
|
|
177
|
+
] }
|
|
178
|
+
} },
|
|
179
|
+
rules: {
|
|
180
|
+
"dot-notation": "off",
|
|
181
|
+
"no-implied-eval": "off",
|
|
182
|
+
"no-throw-literal": "off",
|
|
183
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
184
|
+
"ts/array-type": ["error", {
|
|
185
|
+
default: "array",
|
|
186
|
+
readonly: "array"
|
|
187
|
+
}],
|
|
188
|
+
"ts/await-thenable": "error",
|
|
189
|
+
"ts/consistent-generic-constructors": "error",
|
|
190
|
+
"ts/consistent-type-assertions": ["error", {
|
|
191
|
+
assertionStyle: "as",
|
|
192
|
+
objectLiteralTypeAssertions: "allow"
|
|
193
|
+
}],
|
|
194
|
+
"ts/consistent-type-exports": "error",
|
|
195
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
196
|
+
"ts/no-for-in-array": "error",
|
|
197
|
+
"ts/no-implied-eval": "error",
|
|
198
|
+
"ts/no-unnecessary-type-arguments": "error",
|
|
199
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
200
|
+
"ts/non-nullable-type-assertion-style": "error",
|
|
201
|
+
"ts/only-throw-error": "error",
|
|
202
|
+
"ts/prefer-nullish-coalescing": "error",
|
|
203
|
+
"ts/prefer-optional-chain": "error",
|
|
204
|
+
"ts/prefer-return-this-type": "error",
|
|
205
|
+
"ts/restrict-template-expressions": ["error", {
|
|
206
|
+
allowAny: true,
|
|
207
|
+
allowNumber: true,
|
|
208
|
+
allowBoolean: true
|
|
209
|
+
}]
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: "so1ve/typescript/rules/dts",
|
|
214
|
+
files: ["**/*.d.ts"],
|
|
215
|
+
rules: {
|
|
216
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
217
|
+
"import/no-duplicates": "off",
|
|
218
|
+
"unused-imports/no-unused-vars": "off"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "so1ve/typescript/rules/js",
|
|
223
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
224
|
+
rules: {
|
|
225
|
+
"ts/no-require-imports": "off",
|
|
226
|
+
"ts/no-var-requires": "off"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
//#endregion
|
|
232
|
+
export { typescript };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { pluginUnicorn } from "../plugins.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/unicorn.ts
|
|
4
|
+
const unicorn = () => [{
|
|
5
|
+
name: "so1ve/unicorn/setup",
|
|
6
|
+
plugins: { unicorn: pluginUnicorn }
|
|
7
|
+
}, {
|
|
8
|
+
name: "so1ve/unicorn/rules",
|
|
9
|
+
rules: {
|
|
10
|
+
"unicorn/consistent-assert": "error",
|
|
11
|
+
"unicorn/consistent-date-clone": "error",
|
|
12
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
13
|
+
"unicorn/consistent-existence-index-check": "error",
|
|
14
|
+
"unicorn/error-message": "error",
|
|
15
|
+
"unicorn/escape-case": "error",
|
|
16
|
+
"unicorn/explicit-length-check": "error",
|
|
17
|
+
"unicorn/new-for-builtins": "error",
|
|
18
|
+
"unicorn/no-array-for-each": "error",
|
|
19
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
20
|
+
"unicorn/no-for-loop": "error",
|
|
21
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
22
|
+
"unicorn/no-lonely-if": "error",
|
|
23
|
+
"unicorn/no-negated-condition": "error",
|
|
24
|
+
"unicorn/no-new-array": "error",
|
|
25
|
+
"unicorn/no-new-buffer": "error",
|
|
26
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
27
|
+
"unicorn/no-useless-spread": "error",
|
|
28
|
+
"unicorn/no-zero-fractions": "error",
|
|
29
|
+
"unicorn/numeric-separators-style": "error",
|
|
30
|
+
"unicorn/prefer-array-find": "error",
|
|
31
|
+
"unicorn/prefer-array-flat": "error",
|
|
32
|
+
"unicorn/prefer-array-index-of": "error",
|
|
33
|
+
"unicorn/prefer-array-some": "error",
|
|
34
|
+
"unicorn/prefer-class-fields": "error",
|
|
35
|
+
"unicorn/prefer-date-now": "error",
|
|
36
|
+
"unicorn/prefer-includes": "error",
|
|
37
|
+
"unicorn/prefer-json-parse-buffer": "error",
|
|
38
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
39
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
40
|
+
"unicorn/prefer-negative-index": "error",
|
|
41
|
+
"unicorn/prefer-node-protocol": "error",
|
|
42
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
43
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
44
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
45
|
+
"unicorn/prefer-query-selector": "error",
|
|
46
|
+
"unicorn/prefer-regexp-test": "error",
|
|
47
|
+
"unicorn/prefer-response-static-json": "error",
|
|
48
|
+
"unicorn/prefer-set-size": "error",
|
|
49
|
+
"unicorn/prefer-spread": "error",
|
|
50
|
+
"unicorn/prefer-string-slice": "error",
|
|
51
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
52
|
+
"unicorn/prefer-type-error": "error",
|
|
53
|
+
"unicorn/relative-url-style": ["error", "always"],
|
|
54
|
+
"unicorn/require-module-specifiers": "error",
|
|
55
|
+
"unicorn/switch-case-braces": "error",
|
|
56
|
+
"unicorn/throw-new-error": "error"
|
|
57
|
+
}
|
|
58
|
+
}];
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { unicorn };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OptionsHasTypeScript, OptionsOverrides, TypedFlatConfigItem } from "../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/vue.d.ts
|
|
4
|
+
declare function vue({
|
|
5
|
+
overrides,
|
|
6
|
+
typescript
|
|
7
|
+
}?: OptionsHasTypeScript & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { vue };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { GLOB_VUE } from "../globs.mjs";
|
|
2
|
+
import { interopDefault } from "../utils.mjs";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
|
|
5
|
+
//#region src/configs/vue.ts
|
|
6
|
+
async function vue({ overrides, typescript } = {}) {
|
|
7
|
+
const [parserVue, pluginVue] = await Promise.all([interopDefault(import("vue-eslint-parser")), interopDefault(import("eslint-plugin-vue"))]);
|
|
8
|
+
return [{
|
|
9
|
+
name: "so1ve/vue/setup",
|
|
10
|
+
plugins: { vue: pluginVue }
|
|
11
|
+
}, {
|
|
12
|
+
name: "so1ve/vue/rules",
|
|
13
|
+
files: [GLOB_VUE],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parser: parserVue,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaFeatures: { jsx: true },
|
|
18
|
+
extraFileExtensions: [".vue"],
|
|
19
|
+
parser: typescript ? tseslint.parser : null,
|
|
20
|
+
sourceType: "module"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
processor: pluginVue.processors[".vue"],
|
|
24
|
+
rules: {
|
|
25
|
+
...pluginVue.configs.base.rules,
|
|
26
|
+
...pluginVue.configs.essential.rules,
|
|
27
|
+
...pluginVue.configs["strongly-recommended"].rules,
|
|
28
|
+
...pluginVue.configs.recommended.rules,
|
|
29
|
+
"no-undef": "off",
|
|
30
|
+
"no-unused-vars": "off",
|
|
31
|
+
"so1ve/vue-root-element-sort-attributes": "error",
|
|
32
|
+
"ts/no-unused-vars": "off",
|
|
33
|
+
"vue/array-bracket-spacing": "off",
|
|
34
|
+
"vue/arrow-spacing": "off",
|
|
35
|
+
"vue/attributes-order": ["error", {
|
|
36
|
+
order: [
|
|
37
|
+
"DEFINITION",
|
|
38
|
+
"LIST_RENDERING",
|
|
39
|
+
"CONDITIONALS",
|
|
40
|
+
"RENDER_MODIFIERS",
|
|
41
|
+
"TWO_WAY_BINDING",
|
|
42
|
+
"OTHER_DIRECTIVES",
|
|
43
|
+
["UNIQUE", "SLOT"],
|
|
44
|
+
"GLOBAL",
|
|
45
|
+
"OTHER_ATTR",
|
|
46
|
+
"EVENTS",
|
|
47
|
+
"CONTENT"
|
|
48
|
+
],
|
|
49
|
+
alphabetical: true
|
|
50
|
+
}],
|
|
51
|
+
"vue/block-lang": ["error", {
|
|
52
|
+
script: { lang: ["js", "ts"] },
|
|
53
|
+
template: { lang: [
|
|
54
|
+
"html",
|
|
55
|
+
"jade",
|
|
56
|
+
"pug",
|
|
57
|
+
"ejs"
|
|
58
|
+
] },
|
|
59
|
+
style: { lang: [
|
|
60
|
+
"css",
|
|
61
|
+
"sass",
|
|
62
|
+
"scss",
|
|
63
|
+
"less",
|
|
64
|
+
"stylus",
|
|
65
|
+
"postcss"
|
|
66
|
+
] }
|
|
67
|
+
}],
|
|
68
|
+
"vue/block-order": ["error", { order: [
|
|
69
|
+
"script:not([setup])",
|
|
70
|
+
"script[setup]",
|
|
71
|
+
"template",
|
|
72
|
+
"style"
|
|
73
|
+
] }],
|
|
74
|
+
"vue/block-spacing": "off",
|
|
75
|
+
"vue/brace-style": "off",
|
|
76
|
+
"vue/comma-dangle": "off",
|
|
77
|
+
"vue/comma-spacing": "off",
|
|
78
|
+
"vue/comma-style": "off",
|
|
79
|
+
"vue/component-api-style": ["error", ["script-setup", "composition"]],
|
|
80
|
+
"vue/component-name-in-template-casing": [
|
|
81
|
+
"error",
|
|
82
|
+
"PascalCase",
|
|
83
|
+
{ registeredComponentsOnly: false }
|
|
84
|
+
],
|
|
85
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
86
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
87
|
+
"vue/define-macros-order": ["error", { order: [
|
|
88
|
+
"defineOptions",
|
|
89
|
+
"defineEmits",
|
|
90
|
+
"defineProps",
|
|
91
|
+
"defineSlots"
|
|
92
|
+
] }],
|
|
93
|
+
"vue/dot-location": ["error", "property"],
|
|
94
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
95
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
96
|
+
"vue/html-closing-bracket-spacing": "off",
|
|
97
|
+
"vue/html-comment-content-newline": ["error", {
|
|
98
|
+
singleline: "ignore",
|
|
99
|
+
multiline: "always"
|
|
100
|
+
}],
|
|
101
|
+
"vue/html-comment-content-spacing": [
|
|
102
|
+
"error",
|
|
103
|
+
"always",
|
|
104
|
+
{ exceptions: ["-"] }
|
|
105
|
+
],
|
|
106
|
+
"vue/html-comment-indent": ["error", "tab"],
|
|
107
|
+
"vue/html-indent": "off",
|
|
108
|
+
"vue/html-quotes": "off",
|
|
109
|
+
"vue/html-self-closing": ["error", {
|
|
110
|
+
html: {
|
|
111
|
+
void: "always",
|
|
112
|
+
normal: "always",
|
|
113
|
+
component: "always"
|
|
114
|
+
},
|
|
115
|
+
svg: "always",
|
|
116
|
+
math: "always"
|
|
117
|
+
}],
|
|
118
|
+
"vue/key-spacing": "off",
|
|
119
|
+
"vue/keyword-spacing": "off",
|
|
120
|
+
"vue/max-attributes-per-line": "off",
|
|
121
|
+
"vue/multi-word-component-names": "off",
|
|
122
|
+
"vue/multiline-html-element-content-newline": "off",
|
|
123
|
+
"vue/mustache-interpolation-spacing": "off",
|
|
124
|
+
"vue/no-console": ["error", { allow: [
|
|
125
|
+
"error",
|
|
126
|
+
"warn",
|
|
127
|
+
"table",
|
|
128
|
+
"time"
|
|
129
|
+
] }],
|
|
130
|
+
"vue/no-constant-condition": "error",
|
|
131
|
+
"vue/no-empty-pattern": "error",
|
|
132
|
+
"vue/no-irregular-whitespace": "error",
|
|
133
|
+
"vue/no-loss-of-precision": "error",
|
|
134
|
+
"vue/no-multi-spaces": "off",
|
|
135
|
+
"vue/no-multiple-template-root": "off",
|
|
136
|
+
"vue/no-restricted-syntax": [
|
|
137
|
+
"error",
|
|
138
|
+
"DebuggerStatement",
|
|
139
|
+
"LabeledStatement",
|
|
140
|
+
"WithStatement"
|
|
141
|
+
],
|
|
142
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
143
|
+
"vue/no-sparse-arrays": "error",
|
|
144
|
+
"vue/no-static-inline-styles": ["error", { allowBinding: true }],
|
|
145
|
+
"vue/no-unused-refs": "error",
|
|
146
|
+
"vue/no-useless-concat": "error",
|
|
147
|
+
"vue/no-useless-v-bind": ["error", { ignoreIncludesComment: true }],
|
|
148
|
+
"vue/no-v-html": "off",
|
|
149
|
+
"vue/no-v-text-v-html-on-component": "error",
|
|
150
|
+
"vue/object-curly-newline": ["error", {
|
|
151
|
+
multiline: true,
|
|
152
|
+
consistent: true
|
|
153
|
+
}],
|
|
154
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
155
|
+
"vue/object-shorthand": [
|
|
156
|
+
"error",
|
|
157
|
+
"always",
|
|
158
|
+
{
|
|
159
|
+
ignoreConstructors: false,
|
|
160
|
+
avoidQuotes: true
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"vue/operator-linebreak": "off",
|
|
164
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
165
|
+
"vue/prefer-define-options": "error",
|
|
166
|
+
"vue/prefer-separate-static-class": "error",
|
|
167
|
+
"vue/prefer-template": "error",
|
|
168
|
+
"vue/prefer-true-attribute-shorthand": "error",
|
|
169
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
170
|
+
"vue/require-default-prop": "off",
|
|
171
|
+
"vue/require-macro-variable-name": ["error", {
|
|
172
|
+
defineProps: "props",
|
|
173
|
+
defineEmits: "emit",
|
|
174
|
+
defineSlots: "slots",
|
|
175
|
+
useSlots: "slots",
|
|
176
|
+
useAttrs: "attrs"
|
|
177
|
+
}],
|
|
178
|
+
"vue/require-prop-types": "off",
|
|
179
|
+
"vue/require-typed-ref": "error",
|
|
180
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
181
|
+
"vue/template-curly-spacing": "off",
|
|
182
|
+
"vue/v-bind-style": [
|
|
183
|
+
"error",
|
|
184
|
+
"shorthand",
|
|
185
|
+
{ sameNameShorthand: "always" }
|
|
186
|
+
],
|
|
187
|
+
"vue/v-for-delimiter-style": ["error", "in"],
|
|
188
|
+
...overrides
|
|
189
|
+
}
|
|
190
|
+
}];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
//#endregion
|
|
194
|
+
export { vue };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GLOB_YAML } from "../globs.mjs";
|
|
2
|
+
import { interopDefault, renameRules } from "../utils.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/yaml.ts
|
|
5
|
+
async function yaml({ overrides } = {}) {
|
|
6
|
+
const [parserYaml, pluginYaml] = await Promise.all([interopDefault(import("yaml-eslint-parser")), interopDefault(import("eslint-plugin-yml"))]);
|
|
7
|
+
return [{
|
|
8
|
+
name: "so1ve/yaml/setup",
|
|
9
|
+
plugins: { yaml: pluginYaml }
|
|
10
|
+
}, {
|
|
11
|
+
name: "so1ve/yaml/rules",
|
|
12
|
+
languageOptions: { parser: parserYaml },
|
|
13
|
+
files: [GLOB_YAML],
|
|
14
|
+
rules: {
|
|
15
|
+
...renameRules(pluginYaml.configs.prettier.rules, { yml: "yaml" }),
|
|
16
|
+
...renameRules(pluginYaml.configs.recommended.rules, { yml: "yaml" }),
|
|
17
|
+
"style/spaced-comment": "off",
|
|
18
|
+
"yaml/no-empty-document": "off",
|
|
19
|
+
...overrides
|
|
20
|
+
}
|
|
21
|
+
}];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { yaml };
|