@curev/eslint-config 0.3.0 → 0.3.1
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/chunk-TMQW6NVO.js +69 -0
- package/dist/dist-QAUNCL3U.js +226708 -0
- package/dist/index.cjs +228976 -0
- package/dist/index.d.cts +516 -0
- package/dist/index.d.ts +516 -0
- package/dist/index.js +2153 -0
- package/package.json +5 -2
- package/.eslintignore +0 -1
- package/.github/workflows/release.yml +0 -37
- package/.vscode/settings.json +0 -36
- package/CHANGELOG.md +0 -740
- package/eslint.config.ts +0 -3
- package/fixtures/input/css.css +0 -10
- package/fixtures/input/html.html +0 -17
- package/fixtures/input/javascript.js +0 -69
- package/fixtures/input/jsx.jsx +0 -27
- package/fixtures/input/markdown.md +0 -34
- package/fixtures/input/svelte.svelte +0 -8
- package/fixtures/input/toml.toml +0 -23
- package/fixtures/input/tsx.tsx +0 -32
- package/fixtures/input/typescript.ts +0 -84
- package/fixtures/input/vue-ts.vue +0 -35
- package/fixtures/input/vue.vue +0 -27
- package/fixtures/output/all/javascript.js +0 -72
- package/fixtures/output/all/jsx.jsx +0 -26
- package/fixtures/output/all/markdown.md +0 -33
- package/fixtures/output/all/svelte.svelte +0 -8
- package/fixtures/output/all/toml.toml +0 -23
- package/fixtures/output/all/tsx.tsx +0 -32
- package/fixtures/output/all/typescript.ts +0 -83
- package/fixtures/output/all/vue-ts.vue +0 -35
- package/fixtures/output/all/vue.vue +0 -24
- package/fixtures/output/js/javascript.js +0 -72
- package/fixtures/output/js/markdown.md +0 -33
- package/fixtures/output/js/toml.toml +0 -23
- package/fixtures/output/no-markdown-with-formatters/javascript.js +0 -72
- package/fixtures/output/no-markdown-with-formatters/jsx.jsx +0 -24
- package/fixtures/output/no-markdown-with-formatters/markdown.md +0 -33
- package/fixtures/output/no-markdown-with-formatters/toml.toml +0 -23
- package/fixtures/output/no-markdown-with-formatters/tsx.tsx +0 -23
- package/fixtures/output/no-markdown-with-formatters/typescript.ts +0 -83
- package/fixtures/output/no-style/javascript.js +0 -72
- package/fixtures/output/no-style/jsx.jsx +0 -21
- package/fixtures/output/no-style/toml.toml +0 -23
- package/fixtures/output/no-style/typescript.ts +0 -80
- package/fixtures/output/no-style/vue-ts.vue +0 -35
- package/fixtures/output/no-style/vue.vue +0 -24
- package/fixtures/output/tab-double-quotes/javascript.js +0 -72
- package/fixtures/output/tab-double-quotes/jsx.jsx +0 -26
- package/fixtures/output/tab-double-quotes/markdown.md +0 -33
- package/fixtures/output/tab-double-quotes/toml.toml +0 -23
- package/fixtures/output/tab-double-quotes/tsx.tsx +0 -32
- package/fixtures/output/tab-double-quotes/typescript.ts +0 -83
- package/fixtures/output/tab-double-quotes/vue-ts.vue +0 -35
- package/fixtures/output/tab-double-quotes/vue.vue +0 -24
- package/fixtures/output/ts-override/javascript.js +0 -72
- package/fixtures/output/ts-override/jsx.jsx +0 -26
- package/fixtures/output/ts-override/markdown.md +0 -33
- package/fixtures/output/ts-override/toml.toml +0 -23
- package/fixtures/output/ts-override/tsx.tsx +0 -32
- package/fixtures/output/ts-override/typescript.ts +0 -83
- package/fixtures/output/ts-override/vue-ts.vue +0 -35
- package/fixtures/output/ts-override/vue.vue +0 -24
- package/fixtures/output/with-formatters/css.css +0 -11
- package/fixtures/output/with-formatters/html.html +0 -28
- package/fixtures/output/with-formatters/javascript.js +0 -72
- package/fixtures/output/with-formatters/jsx.jsx +0 -26
- package/fixtures/output/with-formatters/markdown.md +0 -34
- package/fixtures/output/with-formatters/toml.toml +0 -23
- package/fixtures/output/with-formatters/tsx.tsx +0 -32
- package/fixtures/output/with-formatters/typescript.ts +0 -83
- package/fixtures/output/with-formatters/vue-ts.vue +0 -38
- package/fixtures/output/with-formatters/vue.vue +0 -24
- package/src/configs/comments.ts +0 -19
- package/src/configs/formatters.ts +0 -187
- package/src/configs/ignores.ts +0 -10
- package/src/configs/imports.ts +0 -46
- package/src/configs/index.ts +0 -21
- package/src/configs/javascript.ts +0 -277
- package/src/configs/jsdoc.ts +0 -41
- package/src/configs/jsonc.ts +0 -86
- package/src/configs/markdown.ts +0 -110
- package/src/configs/node.ts +0 -24
- package/src/configs/perfectionist.ts +0 -18
- package/src/configs/react.ts +0 -111
- package/src/configs/sort.ts +0 -223
- package/src/configs/stylistic.ts +0 -52
- package/src/configs/svelte.ts +0 -107
- package/src/configs/test.ts +0 -54
- package/src/configs/toml.ts +0 -72
- package/src/configs/typescript.ts +0 -171
- package/src/configs/unicorn.ts +0 -41
- package/src/configs/unocss.ts +0 -43
- package/src/configs/vue.ts +0 -170
- package/src/configs/yaml.ts +0 -72
- package/src/factory.ts +0 -255
- package/src/globs.ts +0 -81
- package/src/index.ts +0 -9
- package/src/plugins.ts +0 -10
- package/src/stub.d.ts +0 -3
- package/src/types.ts +0 -364
- package/src/utils.ts +0 -76
- package/src/vender/prettier-types.ts +0 -136
- package/test/cli.spec.ts +0 -90
- package/test/fixtures.test.ts +0 -127
- package/tsconfig.json +0 -17
- package/tsup.config.ts +0 -8
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import globals from "globals";
|
|
2
|
-
import type { FlatConfigItem, OptionsIsInEditor, OptionsOverrides } from "../types";
|
|
3
|
-
import { pluginAntfu, pluginUnusedImports } from "../plugins";
|
|
4
|
-
import { GLOB_SRC, GLOB_SRC_EXT } from "../globs";
|
|
5
|
-
|
|
6
|
-
export async function javascript(
|
|
7
|
-
options: OptionsIsInEditor & OptionsOverrides = {}
|
|
8
|
-
): Promise<FlatConfigItem[]> {
|
|
9
|
-
const {
|
|
10
|
-
isInEditor = false,
|
|
11
|
-
overrides = {}
|
|
12
|
-
} = options;
|
|
13
|
-
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
languageOptions: {
|
|
17
|
-
ecmaVersion: 2022,
|
|
18
|
-
globals: {
|
|
19
|
-
...globals.browser,
|
|
20
|
-
...globals.es2021,
|
|
21
|
-
...globals.node,
|
|
22
|
-
document: "readonly",
|
|
23
|
-
navigator: "readonly",
|
|
24
|
-
window: "readonly"
|
|
25
|
-
},
|
|
26
|
-
parserOptions: {
|
|
27
|
-
ecmaFeatures: {
|
|
28
|
-
jsx: true
|
|
29
|
-
},
|
|
30
|
-
ecmaVersion: 2022,
|
|
31
|
-
sourceType: "module"
|
|
32
|
-
},
|
|
33
|
-
sourceType: "module"
|
|
34
|
-
},
|
|
35
|
-
linterOptions: {
|
|
36
|
-
reportUnusedDisableDirectives: true
|
|
37
|
-
},
|
|
38
|
-
name: "curev:javascript",
|
|
39
|
-
plugins: {
|
|
40
|
-
"antfu": pluginAntfu,
|
|
41
|
-
"unused-imports": pluginUnusedImports
|
|
42
|
-
},
|
|
43
|
-
rules: {
|
|
44
|
-
"no-var": "warn",
|
|
45
|
-
"object-shorthand": ["warn", "properties"],
|
|
46
|
-
|
|
47
|
-
"accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
|
|
48
|
-
"array-callback-return": ["error", {
|
|
49
|
-
allowImplicit: false,
|
|
50
|
-
checkForEach: false
|
|
51
|
-
}],
|
|
52
|
-
"camelcase": ["error", {
|
|
53
|
-
allow: ["^UNSAFE_"],
|
|
54
|
-
properties: "never",
|
|
55
|
-
ignoreGlobals: true,
|
|
56
|
-
ignoreImports: true
|
|
57
|
-
}],
|
|
58
|
-
"constructor-super": "error",
|
|
59
|
-
"default-case-last": "error",
|
|
60
|
-
"eol-last": "error",
|
|
61
|
-
"eqeqeq": ["error", "always", { null: "ignore" }],
|
|
62
|
-
"func-call-spacing": ["error", "never"],
|
|
63
|
-
"generator-star-spacing": ["error", { before: true, after: true }],
|
|
64
|
-
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
65
|
-
"multiline-ternary": ["error", "always-multiline"],
|
|
66
|
-
"new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
|
|
67
|
-
"new-parens": "error",
|
|
68
|
-
"no-array-constructor": "error",
|
|
69
|
-
"no-async-promise-executor": "error",
|
|
70
|
-
"no-caller": "error",
|
|
71
|
-
"no-case-declarations": "error",
|
|
72
|
-
"no-class-assign": "error",
|
|
73
|
-
"no-compare-neg-zero": "error",
|
|
74
|
-
"no-cond-assign": "error",
|
|
75
|
-
"no-const-assign": "error",
|
|
76
|
-
"no-constant-condition": ["error", { checkLoops: false }],
|
|
77
|
-
"no-control-regex": "error",
|
|
78
|
-
"no-debugger": "error",
|
|
79
|
-
"no-delete-var": "error",
|
|
80
|
-
"no-dupe-args": "error",
|
|
81
|
-
"no-dupe-class-members": "error",
|
|
82
|
-
"no-dupe-keys": "error",
|
|
83
|
-
"no-duplicate-case": "error",
|
|
84
|
-
"no-useless-backreference": "error",
|
|
85
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
86
|
-
"no-empty-character-class": "error",
|
|
87
|
-
"no-empty-pattern": "error",
|
|
88
|
-
"no-eval": "error",
|
|
89
|
-
"no-ex-assign": "error",
|
|
90
|
-
"no-extend-native": "error",
|
|
91
|
-
"no-extra-bind": "error",
|
|
92
|
-
"no-extra-boolean-cast": "error",
|
|
93
|
-
"no-extra-parens": ["error", "functions"],
|
|
94
|
-
"no-fallthrough": "error",
|
|
95
|
-
"no-floating-decimal": "error",
|
|
96
|
-
"no-func-assign": "error",
|
|
97
|
-
"no-global-assign": "error",
|
|
98
|
-
"no-implied-eval": "error",
|
|
99
|
-
"no-import-assign": "error",
|
|
100
|
-
"no-invalid-regexp": "error",
|
|
101
|
-
"no-irregular-whitespace": "error",
|
|
102
|
-
"no-iterator": "error",
|
|
103
|
-
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
104
|
-
"no-lone-blocks": "error",
|
|
105
|
-
"no-loss-of-precision": "error",
|
|
106
|
-
"no-misleading-character-class": "error",
|
|
107
|
-
"no-prototype-builtins": "error",
|
|
108
|
-
"no-useless-catch": "error",
|
|
109
|
-
"no-mixed-operators": ["error", {
|
|
110
|
-
groups: [
|
|
111
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
112
|
-
["&&", "||"],
|
|
113
|
-
["in", "instanceof"]
|
|
114
|
-
],
|
|
115
|
-
allowSamePrecedence: true
|
|
116
|
-
}],
|
|
117
|
-
"no-mixed-spaces-and-tabs": "error",
|
|
118
|
-
"no-multi-spaces": "error",
|
|
119
|
-
"no-multi-str": "error",
|
|
120
|
-
"no-new": "error",
|
|
121
|
-
"no-new-func": "error",
|
|
122
|
-
"no-new-object": "error",
|
|
123
|
-
"no-new-symbol": "error",
|
|
124
|
-
"no-new-wrappers": "error",
|
|
125
|
-
"no-obj-calls": "error",
|
|
126
|
-
"no-octal": "error",
|
|
127
|
-
"no-octal-escape": "error",
|
|
128
|
-
"no-proto": "error",
|
|
129
|
-
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
130
|
-
"no-regex-spaces": "error",
|
|
131
|
-
"no-return-assign": ["error", "except-parens"],
|
|
132
|
-
"no-self-assign": ["error", { props: true }],
|
|
133
|
-
"no-self-compare": "error",
|
|
134
|
-
"no-sequences": "error",
|
|
135
|
-
"no-shadow-restricted-names": "error",
|
|
136
|
-
"no-sparse-arrays": "error",
|
|
137
|
-
"no-tabs": "error",
|
|
138
|
-
"no-template-curly-in-string": "error",
|
|
139
|
-
"no-this-before-super": "error",
|
|
140
|
-
"no-throw-literal": "error",
|
|
141
|
-
"no-trailing-spaces": [
|
|
142
|
-
"error",
|
|
143
|
-
{
|
|
144
|
-
skipBlankLines: true
|
|
145
|
-
}
|
|
146
|
-
],
|
|
147
|
-
"no-multiple-empty-lines": [
|
|
148
|
-
"error",
|
|
149
|
-
{
|
|
150
|
-
max: 3,
|
|
151
|
-
maxBOF: 0,
|
|
152
|
-
maxEOF: 1
|
|
153
|
-
}
|
|
154
|
-
],
|
|
155
|
-
"no-undef": "error",
|
|
156
|
-
"no-undef-init": "error",
|
|
157
|
-
"no-unexpected-multiline": "error",
|
|
158
|
-
"no-unmodified-loop-condition": "error",
|
|
159
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
160
|
-
"no-unreachable": "error",
|
|
161
|
-
"no-unreachable-loop": "error",
|
|
162
|
-
"no-unsafe-finally": "error",
|
|
163
|
-
"no-unsafe-negation": "error",
|
|
164
|
-
"no-unused-expressions": ["error", {
|
|
165
|
-
allowShortCircuit: true,
|
|
166
|
-
allowTernary: true,
|
|
167
|
-
allowTaggedTemplates: true
|
|
168
|
-
}],
|
|
169
|
-
"no-unused-vars": ["error", {
|
|
170
|
-
args: "none",
|
|
171
|
-
caughtErrors: "none",
|
|
172
|
-
ignoreRestSiblings: true,
|
|
173
|
-
vars: "all"
|
|
174
|
-
}],
|
|
175
|
-
"no-use-before-define": ["error", { functions: false, classes: false, variables: false }],
|
|
176
|
-
"no-useless-call": "error",
|
|
177
|
-
"no-useless-computed-key": "error",
|
|
178
|
-
"no-useless-constructor": "error",
|
|
179
|
-
"no-useless-escape": "error",
|
|
180
|
-
"no-useless-rename": "error",
|
|
181
|
-
"no-useless-return": "error",
|
|
182
|
-
"no-void": "error",
|
|
183
|
-
"no-with": "error",
|
|
184
|
-
"object-curly-newline": ["error", { multiline: true, consistent: true }],
|
|
185
|
-
"object-curly-spacing": ["error", "always"],
|
|
186
|
-
"object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
187
|
-
"one-var": ["error", { initialized: "never" }],
|
|
188
|
-
"padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
|
|
189
|
-
"prefer-const": ["error", { destructuring: "all" }],
|
|
190
|
-
"prefer-promise-reject-errors": "error",
|
|
191
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
192
|
-
"rest-spread-spacing": ["error", "never"],
|
|
193
|
-
"symbol-description": "error",
|
|
194
|
-
"template-curly-spacing": ["error", "never"],
|
|
195
|
-
"template-tag-spacing": ["error", "never"],
|
|
196
|
-
"unicode-bom": ["error", "never"],
|
|
197
|
-
"use-isnan": ["error", {
|
|
198
|
-
enforceForSwitchCase: true,
|
|
199
|
-
enforceForIndexOf: true
|
|
200
|
-
}],
|
|
201
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
202
|
-
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
203
|
-
"yield-star-spacing": ["error", "both"],
|
|
204
|
-
"yoda": ["error", "never"],
|
|
205
|
-
|
|
206
|
-
"import/export": "error",
|
|
207
|
-
"import/first": "error",
|
|
208
|
-
"import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
|
|
209
|
-
"import/no-duplicates": "error",
|
|
210
|
-
"import/no-named-default": "error",
|
|
211
|
-
"import/no-webpack-loader-syntax": "error",
|
|
212
|
-
|
|
213
|
-
"block-scoped-var": "error",
|
|
214
|
-
"no-alert": "error",
|
|
215
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
216
|
-
"no-restricted-globals": [
|
|
217
|
-
"error",
|
|
218
|
-
{ message: "Use `globalThis` instead.", name: "global" },
|
|
219
|
-
{ message: "Use `globalThis` instead.", name: "self" }
|
|
220
|
-
],
|
|
221
|
-
"no-restricted-properties": [
|
|
222
|
-
"error",
|
|
223
|
-
{ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
|
|
224
|
-
{ message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
|
|
225
|
-
{ message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
|
|
226
|
-
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
|
|
227
|
-
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
|
|
228
|
-
],
|
|
229
|
-
"no-restricted-syntax": [
|
|
230
|
-
"error",
|
|
231
|
-
"DebuggerStatement",
|
|
232
|
-
"LabeledStatement",
|
|
233
|
-
"WithStatement",
|
|
234
|
-
"TSEnumDeclaration[const=true]",
|
|
235
|
-
"TSExportAssignment"
|
|
236
|
-
],
|
|
237
|
-
"prefer-arrow-callback": [
|
|
238
|
-
"error",
|
|
239
|
-
{
|
|
240
|
-
allowNamedFunctions: false,
|
|
241
|
-
allowUnboundThis: true
|
|
242
|
-
}
|
|
243
|
-
],
|
|
244
|
-
"prefer-exponentiation-operator": "error",
|
|
245
|
-
"prefer-rest-params": "error",
|
|
246
|
-
"prefer-spread": "error",
|
|
247
|
-
"prefer-template": "error",
|
|
248
|
-
"sort-imports": [
|
|
249
|
-
"error",
|
|
250
|
-
{
|
|
251
|
-
allowSeparatedGroups: false,
|
|
252
|
-
ignoreCase: false,
|
|
253
|
-
ignoreDeclarationSort: true,
|
|
254
|
-
ignoreMemberSort: false,
|
|
255
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
256
|
-
}
|
|
257
|
-
],
|
|
258
|
-
|
|
259
|
-
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
260
|
-
|
|
261
|
-
"unused-imports/no-unused-vars": [
|
|
262
|
-
"error",
|
|
263
|
-
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
264
|
-
],
|
|
265
|
-
"vars-on-top": "error",
|
|
266
|
-
...overrides
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
271
|
-
name: "curev:scripts-overrides",
|
|
272
|
-
rules: {
|
|
273
|
-
"no-console": "off"
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
];
|
|
277
|
-
}
|
package/src/configs/jsdoc.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { interopDefault } from "../utils";
|
|
2
|
-
import type { FlatConfigItem, OptionsStylistic } from "../types";
|
|
3
|
-
|
|
4
|
-
export async function jsdoc(options: OptionsStylistic = {}): Promise<FlatConfigItem[]> {
|
|
5
|
-
const {
|
|
6
|
-
stylistic = true
|
|
7
|
-
} = options;
|
|
8
|
-
|
|
9
|
-
return [
|
|
10
|
-
{
|
|
11
|
-
name: "curev:jsdoc",
|
|
12
|
-
plugins: {
|
|
13
|
-
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
"jsdoc/check-access": "warn",
|
|
17
|
-
"jsdoc/check-param-names": "warn",
|
|
18
|
-
"jsdoc/check-property-names": "warn",
|
|
19
|
-
"jsdoc/check-types": "warn",
|
|
20
|
-
"jsdoc/empty-tags": "warn",
|
|
21
|
-
"jsdoc/implements-on-classes": "warn",
|
|
22
|
-
"jsdoc/no-defaults": "warn",
|
|
23
|
-
"jsdoc/no-multi-asterisks": "warn",
|
|
24
|
-
"jsdoc/require-param-name": "warn",
|
|
25
|
-
"jsdoc/require-property": "warn",
|
|
26
|
-
"jsdoc/require-property-description": "warn",
|
|
27
|
-
"jsdoc/require-property-name": "warn",
|
|
28
|
-
"jsdoc/require-returns-check": "warn",
|
|
29
|
-
"jsdoc/require-returns-description": "warn",
|
|
30
|
-
"jsdoc/require-yields-check": "warn",
|
|
31
|
-
|
|
32
|
-
...stylistic
|
|
33
|
-
? {
|
|
34
|
-
"jsdoc/check-alignment": "warn",
|
|
35
|
-
"jsdoc/multiline-blocks": "warn"
|
|
36
|
-
}
|
|
37
|
-
: {}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
}
|
package/src/configs/jsonc.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { FlatConfigItem, OptionsFiles, OptionsOverrides, OptionsStylistic } from "../types";
|
|
2
|
-
import { GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from "../globs";
|
|
3
|
-
import { interopDefault } from "../utils";
|
|
4
|
-
|
|
5
|
-
export async function jsonc(
|
|
6
|
-
options: OptionsFiles & OptionsStylistic & OptionsOverrides = {}
|
|
7
|
-
): Promise<FlatConfigItem[]> {
|
|
8
|
-
const {
|
|
9
|
-
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
10
|
-
overrides = {},
|
|
11
|
-
stylistic = true
|
|
12
|
-
} = options;
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
indent = 2
|
|
16
|
-
} = typeof stylistic === "boolean" ? {} : stylistic;
|
|
17
|
-
|
|
18
|
-
const [
|
|
19
|
-
pluginJsonc,
|
|
20
|
-
parserJsonc
|
|
21
|
-
] = await Promise.all([
|
|
22
|
-
interopDefault(import("eslint-plugin-jsonc")),
|
|
23
|
-
interopDefault(import("jsonc-eslint-parser"))
|
|
24
|
-
] as const);
|
|
25
|
-
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
name: "curev:jsonc:setup",
|
|
29
|
-
plugins: {
|
|
30
|
-
jsonc: pluginJsonc as any
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
files,
|
|
35
|
-
languageOptions: {
|
|
36
|
-
parser: parserJsonc
|
|
37
|
-
},
|
|
38
|
-
name: "curev:jsonc:rules",
|
|
39
|
-
rules: {
|
|
40
|
-
"jsonc/no-bigint-literals": "error",
|
|
41
|
-
"jsonc/no-binary-expression": "error",
|
|
42
|
-
"jsonc/no-binary-numeric-literals": "error",
|
|
43
|
-
"jsonc/no-dupe-keys": "error",
|
|
44
|
-
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
45
|
-
"jsonc/no-floating-decimal": "error",
|
|
46
|
-
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
47
|
-
"jsonc/no-infinity": "error",
|
|
48
|
-
"jsonc/no-multi-str": "error",
|
|
49
|
-
"jsonc/no-nan": "error",
|
|
50
|
-
"jsonc/no-number-props": "error",
|
|
51
|
-
"jsonc/no-numeric-separators": "error",
|
|
52
|
-
"jsonc/no-octal": "error",
|
|
53
|
-
"jsonc/no-octal-escape": "error",
|
|
54
|
-
"jsonc/no-octal-numeric-literals": "error",
|
|
55
|
-
"jsonc/no-parenthesized": "error",
|
|
56
|
-
"jsonc/no-plus-sign": "error",
|
|
57
|
-
"jsonc/no-regexp-literals": "error",
|
|
58
|
-
"jsonc/no-sparse-arrays": "error",
|
|
59
|
-
"jsonc/no-template-literals": "error",
|
|
60
|
-
"jsonc/no-undefined-value": "error",
|
|
61
|
-
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
62
|
-
"jsonc/no-useless-escape": "error",
|
|
63
|
-
"jsonc/space-unary-ops": "error",
|
|
64
|
-
"jsonc/valid-json-number": "error",
|
|
65
|
-
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
66
|
-
|
|
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
|
-
|
|
82
|
-
...overrides
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
];
|
|
86
|
-
}
|
package/src/configs/markdown.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
2
|
-
import type { FlatConfigItem, OptionsComponentExts, OptionsFiles, OptionsOverrides } from "../types";
|
|
3
|
-
import { GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN } from "../globs";
|
|
4
|
-
import { interopDefault, parserPlain } from "../utils";
|
|
5
|
-
|
|
6
|
-
export async function markdown(
|
|
7
|
-
options: OptionsFiles & OptionsComponentExts & OptionsOverrides = {}
|
|
8
|
-
): Promise<FlatConfigItem[]> {
|
|
9
|
-
const {
|
|
10
|
-
componentExts = [],
|
|
11
|
-
files = [GLOB_MARKDOWN],
|
|
12
|
-
overrides = {}
|
|
13
|
-
} = options;
|
|
14
|
-
|
|
15
|
-
// @ts-expect-error missing types
|
|
16
|
-
const markdown = await interopDefault(import("eslint-plugin-markdown"));
|
|
17
|
-
|
|
18
|
-
return [
|
|
19
|
-
{
|
|
20
|
-
name: "curev:markdown:setup",
|
|
21
|
-
plugins: {
|
|
22
|
-
markdown
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
files,
|
|
27
|
-
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
28
|
-
name: "curev:markdown:processor",
|
|
29
|
-
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
30
|
-
// but not the markdown file itself. We use `eslint-merge-processors` to
|
|
31
|
-
// add a pass-through processor for the markdown file itself.
|
|
32
|
-
processor: mergeProcessors([
|
|
33
|
-
markdown.processors.markdown,
|
|
34
|
-
processorPassThrough
|
|
35
|
-
])
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
files,
|
|
39
|
-
languageOptions: {
|
|
40
|
-
parser: parserPlain
|
|
41
|
-
},
|
|
42
|
-
name: "curev:markdown:parser"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
files: [
|
|
46
|
-
GLOB_MARKDOWN_CODE,
|
|
47
|
-
...componentExts.map(ext => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
48
|
-
],
|
|
49
|
-
languageOptions: {
|
|
50
|
-
parserOptions: {
|
|
51
|
-
ecmaFeatures: {
|
|
52
|
-
impliedStrict: true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
name: "curev:markdown:disables",
|
|
57
|
-
rules: {
|
|
58
|
-
"import/newline-after-import": "off",
|
|
59
|
-
|
|
60
|
-
"no-alert": "off",
|
|
61
|
-
"no-console": "off",
|
|
62
|
-
"no-labels": "off",
|
|
63
|
-
"no-lone-blocks": "off",
|
|
64
|
-
"no-restricted-syntax": "off",
|
|
65
|
-
"no-undef": "off",
|
|
66
|
-
"no-unused-expressions": "off",
|
|
67
|
-
"no-unused-labels": "off",
|
|
68
|
-
"no-unused-vars": "off",
|
|
69
|
-
|
|
70
|
-
"node/prefer-global/process": "off",
|
|
71
|
-
"style/comma-dangle": "off",
|
|
72
|
-
|
|
73
|
-
"style/eol-last": "off",
|
|
74
|
-
"ts/consistent-type-imports": "off",
|
|
75
|
-
"ts/no-namespace": "off",
|
|
76
|
-
"ts/no-redeclare": "off",
|
|
77
|
-
"ts/no-require-imports": "off",
|
|
78
|
-
"ts/no-unused-vars": "off",
|
|
79
|
-
"ts/no-use-before-define": "off",
|
|
80
|
-
"ts/no-var-requires": "off",
|
|
81
|
-
|
|
82
|
-
"unicode-bom": "off",
|
|
83
|
-
"unused-imports/no-unused-imports": "off",
|
|
84
|
-
"unused-imports/no-unused-vars": "off",
|
|
85
|
-
|
|
86
|
-
// Type aware rules
|
|
87
|
-
...{
|
|
88
|
-
"ts/await-thenable": "off",
|
|
89
|
-
"ts/dot-notation": "off",
|
|
90
|
-
"ts/no-floating-promises": "off",
|
|
91
|
-
"ts/no-for-in-array": "off",
|
|
92
|
-
"ts/no-implied-eval": "off",
|
|
93
|
-
"ts/no-misused-promises": "off",
|
|
94
|
-
"ts/no-throw-literal": "off",
|
|
95
|
-
"ts/no-unnecessary-type-assertion": "off",
|
|
96
|
-
"ts/no-unsafe-argument": "off",
|
|
97
|
-
"ts/no-unsafe-assignment": "off",
|
|
98
|
-
"ts/no-unsafe-call": "off",
|
|
99
|
-
"ts/no-unsafe-member-access": "off",
|
|
100
|
-
"ts/no-unsafe-return": "off",
|
|
101
|
-
"ts/restrict-plus-operands": "off",
|
|
102
|
-
"ts/restrict-template-expressions": "off",
|
|
103
|
-
"ts/unbound-method": "off"
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
...overrides
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
];
|
|
110
|
-
}
|
package/src/configs/node.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { FlatConfigItem } from "../types";
|
|
2
|
-
import { pluginNode } from "../plugins";
|
|
3
|
-
|
|
4
|
-
export async function node(): Promise<FlatConfigItem[]> {
|
|
5
|
-
return [
|
|
6
|
-
{
|
|
7
|
-
name: "curev:node",
|
|
8
|
-
plugins: {
|
|
9
|
-
node: pluginNode
|
|
10
|
-
},
|
|
11
|
-
rules: {
|
|
12
|
-
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
13
|
-
"node/no-deprecated-api": "error",
|
|
14
|
-
"node/no-exports-assign": "error",
|
|
15
|
-
"node/no-new-require": "error",
|
|
16
|
-
"node/no-path-concat": "error",
|
|
17
|
-
"node/prefer-global/buffer": ["error", "never"],
|
|
18
|
-
"node/prefer-global/process": ["error", "never"],
|
|
19
|
-
"node/process-exit-as-throw": "error",
|
|
20
|
-
"node/no-callback-literal": "error"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
];
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { FlatConfigItem } from "../types";
|
|
2
|
-
import { pluginPerfectionist } from "../plugins";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Optional perfectionist plugin for props and items sorting.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
8
|
-
*/
|
|
9
|
-
export async function perfectionist(): Promise<FlatConfigItem[]> {
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
name: "curev:perfectionist",
|
|
13
|
-
plugins: {
|
|
14
|
-
perfectionist: pluginPerfectionist
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
];
|
|
18
|
-
}
|
package/src/configs/react.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { isPackageExists } from "local-pkg";
|
|
2
|
-
import { ensurePackages, interopDefault } from "../utils";
|
|
3
|
-
import type { FlatConfigItem, OptionsFiles, OptionsHasTypeScript, OptionsOverrides } from "../types";
|
|
4
|
-
import { GLOB_JSX, GLOB_TSX } from "../globs";
|
|
5
|
-
|
|
6
|
-
// react refresh
|
|
7
|
-
const ReactRefreshAllowConstantExportPackages = [
|
|
8
|
-
"vite"
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
export async function react(
|
|
12
|
-
options: OptionsHasTypeScript & OptionsOverrides & OptionsFiles = {}
|
|
13
|
-
): Promise<FlatConfigItem[]> {
|
|
14
|
-
const {
|
|
15
|
-
files = [GLOB_JSX, GLOB_TSX],
|
|
16
|
-
overrides = {},
|
|
17
|
-
typescript = true
|
|
18
|
-
} = options;
|
|
19
|
-
|
|
20
|
-
await ensurePackages([
|
|
21
|
-
"eslint-plugin-react",
|
|
22
|
-
"eslint-plugin-react-hooks",
|
|
23
|
-
"eslint-plugin-react-refresh"
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
const [
|
|
27
|
-
pluginReact,
|
|
28
|
-
pluginReactHooks,
|
|
29
|
-
pluginReactRefresh
|
|
30
|
-
] = await Promise.all([
|
|
31
|
-
interopDefault(import("eslint-plugin-react")),
|
|
32
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
33
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
34
|
-
] as const);
|
|
35
|
-
|
|
36
|
-
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
37
|
-
i => isPackageExists(i)
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
return [
|
|
41
|
-
{
|
|
42
|
-
name: "curev:react:setup",
|
|
43
|
-
plugins: {
|
|
44
|
-
"react": pluginReact,
|
|
45
|
-
"react-hooks": pluginReactHooks,
|
|
46
|
-
"react-refresh": pluginReactRefresh
|
|
47
|
-
},
|
|
48
|
-
settings: {
|
|
49
|
-
react: {
|
|
50
|
-
version: "detect"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
files,
|
|
56
|
-
languageOptions: {
|
|
57
|
-
parserOptions: {
|
|
58
|
-
ecmaFeatures: {
|
|
59
|
-
jsx: true
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
name: "curev:react:rules",
|
|
64
|
-
rules: {
|
|
65
|
-
// recommended rules react-hooks
|
|
66
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
67
|
-
"react-hooks/rules-of-hooks": "error",
|
|
68
|
-
|
|
69
|
-
// react refresh
|
|
70
|
-
"react-refresh/only-export-components": [
|
|
71
|
-
"warn",
|
|
72
|
-
{ allowConstantExport: isAllowConstantExport }
|
|
73
|
-
],
|
|
74
|
-
|
|
75
|
-
// recommended rules react
|
|
76
|
-
"react/display-name": "error",
|
|
77
|
-
"react/jsx-key": "error",
|
|
78
|
-
"react/jsx-no-comment-textnodes": "error",
|
|
79
|
-
"react/jsx-no-duplicate-props": "error",
|
|
80
|
-
"react/jsx-no-target-blank": "error",
|
|
81
|
-
"react/jsx-no-undef": "error",
|
|
82
|
-
"react/jsx-uses-react": "error",
|
|
83
|
-
"react/jsx-uses-vars": "error",
|
|
84
|
-
"react/no-children-prop": "error",
|
|
85
|
-
"react/no-danger-with-children": "error",
|
|
86
|
-
"react/no-deprecated": "error",
|
|
87
|
-
"react/no-direct-mutation-state": "error",
|
|
88
|
-
"react/no-find-dom-node": "error",
|
|
89
|
-
"react/no-is-mounted": "error",
|
|
90
|
-
"react/no-render-return-value": "error",
|
|
91
|
-
"react/no-string-refs": "error",
|
|
92
|
-
"react/no-unescaped-entities": "error",
|
|
93
|
-
"react/no-unknown-property": "error",
|
|
94
|
-
"react/no-unsafe": "off",
|
|
95
|
-
"react/prop-types": "error",
|
|
96
|
-
"react/react-in-jsx-scope": "off",
|
|
97
|
-
"react/require-render-return": "error",
|
|
98
|
-
|
|
99
|
-
...typescript
|
|
100
|
-
? {
|
|
101
|
-
"react/jsx-no-undef": "off",
|
|
102
|
-
"react/prop-type": "off"
|
|
103
|
-
}
|
|
104
|
-
: {},
|
|
105
|
-
|
|
106
|
-
// overrides
|
|
107
|
-
...overrides
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
];
|
|
111
|
-
}
|