katon-labs-eslint-config 0.0.2
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/README.md +15 -0
- package/dist/index.cjs +595 -0
- package/dist/index.d.cts +8371 -0
- package/dist/index.d.ts +8371 -0
- package/dist/index.js +520 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# eslint-config
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun install
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun run index.ts
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This project was created using `bun init` in bun v1.1.27. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
|
+
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
35
|
+
GLOB_ASTRO_TS: () => GLOB_ASTRO_TS,
|
|
36
|
+
GLOB_CSS: () => GLOB_CSS,
|
|
37
|
+
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
38
|
+
GLOB_GRAPHQL: () => GLOB_GRAPHQL,
|
|
39
|
+
GLOB_HTML: () => GLOB_HTML,
|
|
40
|
+
GLOB_JS: () => GLOB_JS,
|
|
41
|
+
GLOB_JSON: () => GLOB_JSON,
|
|
42
|
+
GLOB_JSON5: () => GLOB_JSON5,
|
|
43
|
+
GLOB_JSONC: () => GLOB_JSONC,
|
|
44
|
+
GLOB_JSX: () => GLOB_JSX,
|
|
45
|
+
GLOB_LESS: () => GLOB_LESS,
|
|
46
|
+
GLOB_MARKDOWN: () => GLOB_MARKDOWN,
|
|
47
|
+
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
48
|
+
GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
|
|
49
|
+
GLOB_POSTCSS: () => GLOB_POSTCSS,
|
|
50
|
+
GLOB_SCSS: () => GLOB_SCSS,
|
|
51
|
+
GLOB_SRC: () => GLOB_SRC,
|
|
52
|
+
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
53
|
+
GLOB_STYLE: () => GLOB_STYLE,
|
|
54
|
+
GLOB_SVELTE: () => GLOB_SVELTE,
|
|
55
|
+
GLOB_SVG: () => GLOB_SVG,
|
|
56
|
+
GLOB_TESTS: () => GLOB_TESTS,
|
|
57
|
+
GLOB_TOML: () => GLOB_TOML,
|
|
58
|
+
GLOB_TS: () => GLOB_TS,
|
|
59
|
+
GLOB_TSX: () => GLOB_TSX,
|
|
60
|
+
GLOB_VUE: () => GLOB_VUE,
|
|
61
|
+
GLOB_XML: () => GLOB_XML,
|
|
62
|
+
GLOB_YAML: () => GLOB_YAML,
|
|
63
|
+
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
64
|
+
default: () => src_default,
|
|
65
|
+
imports: () => imports,
|
|
66
|
+
katonlabs: () => katonlabs,
|
|
67
|
+
node: () => node,
|
|
68
|
+
perfectionist: () => perfectionist,
|
|
69
|
+
stylistic: () => stylistic,
|
|
70
|
+
typescript: () => typescript,
|
|
71
|
+
unicorn: () => unicorn,
|
|
72
|
+
vue: () => vue
|
|
73
|
+
});
|
|
74
|
+
module.exports = __toCommonJS(src_exports);
|
|
75
|
+
|
|
76
|
+
// src/factory.ts
|
|
77
|
+
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
78
|
+
|
|
79
|
+
// src/configs/typescript.ts
|
|
80
|
+
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
81
|
+
var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
|
|
82
|
+
|
|
83
|
+
// src/globs.ts
|
|
84
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
85
|
+
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
86
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
87
|
+
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
88
|
+
var GLOB_TS = "**/*.?([cm])ts";
|
|
89
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
90
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
91
|
+
var GLOB_CSS = "**/*.css";
|
|
92
|
+
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
93
|
+
var GLOB_LESS = "**/*.less";
|
|
94
|
+
var GLOB_SCSS = "**/*.scss";
|
|
95
|
+
var GLOB_JSON = "**/*.json";
|
|
96
|
+
var GLOB_JSON5 = "**/*.json5";
|
|
97
|
+
var GLOB_JSONC = "**/*.jsonc";
|
|
98
|
+
var GLOB_MARKDOWN = "**/*.md";
|
|
99
|
+
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
100
|
+
var GLOB_SVELTE = "**/*.svelte";
|
|
101
|
+
var GLOB_VUE = "**/*.vue";
|
|
102
|
+
var GLOB_YAML = "**/*.y?(a)ml";
|
|
103
|
+
var GLOB_TOML = "**/*.toml";
|
|
104
|
+
var GLOB_XML = "**/*.xml";
|
|
105
|
+
var GLOB_SVG = "**/*.svg";
|
|
106
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
107
|
+
var GLOB_ASTRO = "**/*.astro";
|
|
108
|
+
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
109
|
+
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
110
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
111
|
+
var GLOB_TESTS = [
|
|
112
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
113
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
114
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
115
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
116
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
117
|
+
];
|
|
118
|
+
var GLOB_ALL_SRC = [
|
|
119
|
+
GLOB_SRC,
|
|
120
|
+
GLOB_STYLE,
|
|
121
|
+
GLOB_JSON,
|
|
122
|
+
GLOB_JSON5,
|
|
123
|
+
GLOB_MARKDOWN,
|
|
124
|
+
GLOB_SVELTE,
|
|
125
|
+
GLOB_VUE,
|
|
126
|
+
GLOB_YAML,
|
|
127
|
+
GLOB_XML,
|
|
128
|
+
GLOB_HTML
|
|
129
|
+
];
|
|
130
|
+
var GLOB_EXCLUDE = [
|
|
131
|
+
"**/node_modules",
|
|
132
|
+
"**/dist",
|
|
133
|
+
"**/package-lock.json",
|
|
134
|
+
"**/yarn.lock",
|
|
135
|
+
"**/pnpm-lock.yaml",
|
|
136
|
+
"**/bun.lockb",
|
|
137
|
+
"**/output",
|
|
138
|
+
"**/coverage",
|
|
139
|
+
"**/temp",
|
|
140
|
+
"**/.temp",
|
|
141
|
+
"**/tmp",
|
|
142
|
+
"**/.tmp",
|
|
143
|
+
"**/.history",
|
|
144
|
+
"**/.vitepress/cache",
|
|
145
|
+
"**/.nuxt",
|
|
146
|
+
"**/.next",
|
|
147
|
+
"**/.svelte-kit",
|
|
148
|
+
"**/.vercel",
|
|
149
|
+
"**/.changeset",
|
|
150
|
+
"**/.idea",
|
|
151
|
+
"**/.cache",
|
|
152
|
+
"**/.output",
|
|
153
|
+
"**/.vite-inspect",
|
|
154
|
+
"**/.yarn",
|
|
155
|
+
"**/vite.config.*.timestamp-*",
|
|
156
|
+
"**/CHANGELOG*.md",
|
|
157
|
+
"**/*.min.*",
|
|
158
|
+
"**/LICENSE*",
|
|
159
|
+
"**/__snapshots__",
|
|
160
|
+
"**/auto-import?(s).d.ts",
|
|
161
|
+
"**/components.d.ts"
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
// src/configs/typescript.ts
|
|
165
|
+
function typescript(options) {
|
|
166
|
+
const files = [GLOB_TS, GLOB_TSX, GLOB_VUE];
|
|
167
|
+
const fileTypeAware = options?.fileTypeAware ?? [GLOB_TS, GLOB_TSX, GLOB_VUE];
|
|
168
|
+
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
169
|
+
const isTypeAware = !!tsconfigPath;
|
|
170
|
+
const typeAwareRules = {
|
|
171
|
+
"@typescript-eslint/await-thenable": "error",
|
|
172
|
+
"@typescript-eslint/return-await": ["error", "in-try-catch"],
|
|
173
|
+
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
174
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
175
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
176
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
177
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
178
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
179
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
180
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
181
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
182
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
183
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
184
|
+
"@typescript-eslint/promise-function-async": "error",
|
|
185
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
186
|
+
"@typescript-eslint/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }]
|
|
187
|
+
};
|
|
188
|
+
function makeParser(typeAware, files2, ignores) {
|
|
189
|
+
return {
|
|
190
|
+
files: files2,
|
|
191
|
+
...ignores ? { ignores } : {},
|
|
192
|
+
languageOptions: {
|
|
193
|
+
parser: import_parser.default,
|
|
194
|
+
parserOptions: {
|
|
195
|
+
extraFileExtensions: [".vue"],
|
|
196
|
+
sourceType: "module",
|
|
197
|
+
...typeAware ? {
|
|
198
|
+
projectService: {
|
|
199
|
+
allowDefaultProject: ["./*.js"],
|
|
200
|
+
defaultProject: tsconfigPath
|
|
201
|
+
},
|
|
202
|
+
tsconfigRootDir: process.cwd()
|
|
203
|
+
} : {}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
name: `katon-labs/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return [
|
|
210
|
+
{
|
|
211
|
+
// Install the plugins without globs, so they can be configured separately.
|
|
212
|
+
name: "katon-labs/typescript/setup",
|
|
213
|
+
plugins: {
|
|
214
|
+
"@typescript-eslint": import_eslint_plugin.default
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
218
|
+
...isTypeAware ? [
|
|
219
|
+
makeParser(false, files),
|
|
220
|
+
makeParser(true, fileTypeAware)
|
|
221
|
+
] : [
|
|
222
|
+
makeParser(false, files)
|
|
223
|
+
],
|
|
224
|
+
{
|
|
225
|
+
files,
|
|
226
|
+
name: "katon-labs/typescript/rules",
|
|
227
|
+
rules: {
|
|
228
|
+
...import_eslint_plugin.default.configs["eslint-recommended"].overrides[0].rules,
|
|
229
|
+
...import_eslint_plugin.default.configs.strict.rules,
|
|
230
|
+
"no-dupe-class-members": "off",
|
|
231
|
+
"no-redeclare": "off",
|
|
232
|
+
"no-use-before-define": "off",
|
|
233
|
+
"no-useless-constructor": "off",
|
|
234
|
+
"@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
235
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
236
|
+
"@typescript-eslint/consistent-type-imports": ["error", { disallowTypeAnnotations: true, prefer: "type-imports" }],
|
|
237
|
+
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
238
|
+
"@typescript-eslint/no-dynamic-delete": "off",
|
|
239
|
+
"@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "always" }],
|
|
240
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
241
|
+
"@typescript-eslint/no-duplicate-type-constituents": "error"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
...isTypeAware ? [{
|
|
245
|
+
files: fileTypeAware,
|
|
246
|
+
name: "katon-labs/typescript/typeaware-rules",
|
|
247
|
+
rules: {
|
|
248
|
+
...typeAwareRules
|
|
249
|
+
}
|
|
250
|
+
}] : []
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/configs/vue.ts
|
|
255
|
+
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
256
|
+
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
257
|
+
var import_parser2 = __toESM(require("@typescript-eslint/parser"), 1);
|
|
258
|
+
function vue() {
|
|
259
|
+
const files = [GLOB_VUE];
|
|
260
|
+
const indent = 2;
|
|
261
|
+
return [
|
|
262
|
+
{
|
|
263
|
+
name: "katon-labs/vue/setup",
|
|
264
|
+
plugins: {
|
|
265
|
+
"vue": import_eslint_plugin_vue.default
|
|
266
|
+
},
|
|
267
|
+
// This allows Vue plugin to work with auto imports
|
|
268
|
+
// https://github.com/vuejs/eslint-plugin-vue/pull/2422
|
|
269
|
+
languageOptions: {
|
|
270
|
+
globals: {
|
|
271
|
+
computed: "readonly",
|
|
272
|
+
defineEmits: "readonly",
|
|
273
|
+
defineExpose: "readonly",
|
|
274
|
+
defineProps: "readonly",
|
|
275
|
+
onMounted: "readonly",
|
|
276
|
+
onUnmounted: "readonly",
|
|
277
|
+
reactive: "readonly",
|
|
278
|
+
ref: "readonly",
|
|
279
|
+
shallowReactive: "readonly",
|
|
280
|
+
shallowRef: "readonly",
|
|
281
|
+
toRef: "readonly",
|
|
282
|
+
toRefs: "readonly",
|
|
283
|
+
watch: "readonly",
|
|
284
|
+
watchEffect: "readonly"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
files,
|
|
290
|
+
name: "katon-labs/vue/rules",
|
|
291
|
+
languageOptions: {
|
|
292
|
+
parser: import_vue_eslint_parser.default,
|
|
293
|
+
parserOptions: {
|
|
294
|
+
ecmaFeatures: {
|
|
295
|
+
jsx: true
|
|
296
|
+
},
|
|
297
|
+
extraFileExtensions: [".vue"],
|
|
298
|
+
parser: import_parser2.default,
|
|
299
|
+
sourceType: "module"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
303
|
+
rules: {
|
|
304
|
+
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
305
|
+
...import_eslint_plugin_vue.default.configs.essential.rules,
|
|
306
|
+
...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules,
|
|
307
|
+
...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
|
|
308
|
+
...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
|
|
309
|
+
"vue/block-order": ["error", {
|
|
310
|
+
order: ["script", "template", "style"]
|
|
311
|
+
}],
|
|
312
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
313
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
314
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
315
|
+
"vue/define-macros-order": ["error", {
|
|
316
|
+
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
|
|
317
|
+
}],
|
|
318
|
+
"vue/dot-location": ["error", "property"],
|
|
319
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
320
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
321
|
+
"vue/html-indent": ["error", indent],
|
|
322
|
+
"vue/html-quotes": ["error", "double"],
|
|
323
|
+
"vue/max-attributes-per-line": ["error", { singleline: 2 }],
|
|
324
|
+
"vue/multi-word-component-names": "off",
|
|
325
|
+
"vue/no-dupe-keys": "error",
|
|
326
|
+
"vue/no-empty-pattern": "error",
|
|
327
|
+
"vue/no-irregular-whitespace": "error",
|
|
328
|
+
"vue/no-loss-of-precision": "error",
|
|
329
|
+
"vue/no-restricted-syntax": [
|
|
330
|
+
"error",
|
|
331
|
+
"DebuggerStatement",
|
|
332
|
+
"LabeledStatement",
|
|
333
|
+
"WithStatement"
|
|
334
|
+
],
|
|
335
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
336
|
+
"vue/no-sparse-arrays": "error",
|
|
337
|
+
"vue/no-unused-refs": "error",
|
|
338
|
+
"vue/no-useless-v-bind": "error",
|
|
339
|
+
"vue/no-v-html": "off",
|
|
340
|
+
"vue/object-shorthand": [
|
|
341
|
+
"error",
|
|
342
|
+
"always",
|
|
343
|
+
{
|
|
344
|
+
avoidQuotes: true,
|
|
345
|
+
ignoreConstructors: false
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
"vue/prefer-separate-static-class": "error",
|
|
349
|
+
"vue/prefer-template": "error",
|
|
350
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
351
|
+
"vue/no-root-v-if": "error",
|
|
352
|
+
"vue/no-multiple-template-root": "warn",
|
|
353
|
+
// this is deprecated
|
|
354
|
+
"vue/component-tags-order": "off",
|
|
355
|
+
// stylistic
|
|
356
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
357
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
358
|
+
"vue/block-spacing": ["error", "always"],
|
|
359
|
+
"vue/block-tag-newline": [
|
|
360
|
+
"error",
|
|
361
|
+
{
|
|
362
|
+
singleline: "always",
|
|
363
|
+
multiline: "always"
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
367
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
368
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
369
|
+
"vue/comma-style": ["error", "last"],
|
|
370
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
371
|
+
exceptions: ["-"]
|
|
372
|
+
}],
|
|
373
|
+
"vue/key-spacing": [
|
|
374
|
+
"error",
|
|
375
|
+
{
|
|
376
|
+
align: {
|
|
377
|
+
beforeColon: false,
|
|
378
|
+
afterColon: true,
|
|
379
|
+
on: "value"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
384
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
385
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
386
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
387
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
388
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
389
|
+
"vue/space-in-parens": ["error", "never"],
|
|
390
|
+
"vue/template-curly-spacing": "error"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
];
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// src/configs/imports.ts
|
|
397
|
+
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
398
|
+
function imports() {
|
|
399
|
+
return [
|
|
400
|
+
{
|
|
401
|
+
name: "katon-labs/imports/rules",
|
|
402
|
+
plugins: {
|
|
403
|
+
import: import_eslint_plugin_import_x.default
|
|
404
|
+
},
|
|
405
|
+
rules: {
|
|
406
|
+
"import/first": "error",
|
|
407
|
+
"import/no-duplicates": "error",
|
|
408
|
+
"import/no-mutable-exports": "error",
|
|
409
|
+
"import/no-named-default": "error",
|
|
410
|
+
"import/no-self-import": "error",
|
|
411
|
+
"import/no-webpack-loader-syntax": "error",
|
|
412
|
+
// stylistic
|
|
413
|
+
"import/newline-after-import": ["error", { count: 1 }]
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// src/configs/unicorn.ts
|
|
420
|
+
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
421
|
+
function unicorn() {
|
|
422
|
+
return [
|
|
423
|
+
{
|
|
424
|
+
name: "katon-labs/unicorn/rules",
|
|
425
|
+
plugins: {
|
|
426
|
+
unicorn: import_eslint_plugin_unicorn.default
|
|
427
|
+
},
|
|
428
|
+
rules: {
|
|
429
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
430
|
+
"unicorn/error-message": "error",
|
|
431
|
+
"unicorn/escape-case": "error",
|
|
432
|
+
"unicorn/new-for-builtins": "error",
|
|
433
|
+
"unicorn/no-instanceof-array": "error",
|
|
434
|
+
"unicorn/no-new-array": "error",
|
|
435
|
+
"unicorn/prefer-includes": "error",
|
|
436
|
+
"unicorn/prefer-node-protocol": "error",
|
|
437
|
+
"unicorn/prefer-number-properties": "error",
|
|
438
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
439
|
+
"unicorn/prefer-type-error": "error",
|
|
440
|
+
"unicorn/throw-new-error": "error"
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
];
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// src/configs/perfectionist.ts
|
|
447
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
448
|
+
function perfectionist() {
|
|
449
|
+
return [
|
|
450
|
+
{
|
|
451
|
+
name: "katon-labs/perfectionist/rules",
|
|
452
|
+
plugins: {
|
|
453
|
+
"perfectionist": import_eslint_plugin_perfectionist.default
|
|
454
|
+
},
|
|
455
|
+
rules: {
|
|
456
|
+
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
457
|
+
"perfectionist/sort-imports": ["error", {
|
|
458
|
+
groups: [
|
|
459
|
+
"type",
|
|
460
|
+
["parent-type", "sibling-type", "index-type"],
|
|
461
|
+
"builtin",
|
|
462
|
+
"external",
|
|
463
|
+
["internal", "internal-type"],
|
|
464
|
+
["parent", "sibling", "index"],
|
|
465
|
+
"side-effect",
|
|
466
|
+
"object",
|
|
467
|
+
"unknown"
|
|
468
|
+
],
|
|
469
|
+
newlinesBetween: "ignore",
|
|
470
|
+
order: "asc",
|
|
471
|
+
type: "natural"
|
|
472
|
+
}],
|
|
473
|
+
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
474
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
];
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// src/configs/node.ts
|
|
481
|
+
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
482
|
+
function node() {
|
|
483
|
+
return [
|
|
484
|
+
{
|
|
485
|
+
name: "katon-labs/node/rules",
|
|
486
|
+
plugins: {
|
|
487
|
+
"node": import_eslint_plugin_n.default
|
|
488
|
+
},
|
|
489
|
+
rules: {
|
|
490
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
491
|
+
"node/no-deprecated-api": "error",
|
|
492
|
+
"node/no-exports-assign": "error",
|
|
493
|
+
"node/no-new-require": "error",
|
|
494
|
+
"node/no-path-concat": "error",
|
|
495
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
496
|
+
"node/prefer-global/process": ["error", "never"]
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
];
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// src/configs/stylistic.ts
|
|
503
|
+
var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
504
|
+
var StylisticConfigDefaults = {
|
|
505
|
+
indent: 2,
|
|
506
|
+
jsx: true,
|
|
507
|
+
quotes: "single",
|
|
508
|
+
semi: false
|
|
509
|
+
};
|
|
510
|
+
function stylistic() {
|
|
511
|
+
const {
|
|
512
|
+
indent,
|
|
513
|
+
jsx,
|
|
514
|
+
quotes,
|
|
515
|
+
semi
|
|
516
|
+
} = StylisticConfigDefaults;
|
|
517
|
+
const config = import_eslint_plugin2.default.configs.customize({
|
|
518
|
+
indent,
|
|
519
|
+
jsx,
|
|
520
|
+
quotes,
|
|
521
|
+
semi
|
|
522
|
+
});
|
|
523
|
+
return [
|
|
524
|
+
{
|
|
525
|
+
name: "katon-labs/stylistic/rules",
|
|
526
|
+
plugins: {
|
|
527
|
+
"@stylistic": import_eslint_plugin2.default
|
|
528
|
+
},
|
|
529
|
+
rules: {
|
|
530
|
+
...config.rules
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
];
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// src/factory.ts
|
|
537
|
+
function katonlabs(options = {}) {
|
|
538
|
+
const { ts } = options;
|
|
539
|
+
const configs = [];
|
|
540
|
+
configs.push(typescript(ts));
|
|
541
|
+
configs.push(vue());
|
|
542
|
+
configs.push(imports());
|
|
543
|
+
configs.push(unicorn());
|
|
544
|
+
configs.push(perfectionist());
|
|
545
|
+
configs.push(node());
|
|
546
|
+
configs.push(stylistic());
|
|
547
|
+
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
548
|
+
composer.append(...configs);
|
|
549
|
+
return composer;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// src/index.ts
|
|
553
|
+
var src_default = katonlabs;
|
|
554
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
555
|
+
0 && (module.exports = {
|
|
556
|
+
GLOB_ALL_SRC,
|
|
557
|
+
GLOB_ASTRO,
|
|
558
|
+
GLOB_ASTRO_TS,
|
|
559
|
+
GLOB_CSS,
|
|
560
|
+
GLOB_EXCLUDE,
|
|
561
|
+
GLOB_GRAPHQL,
|
|
562
|
+
GLOB_HTML,
|
|
563
|
+
GLOB_JS,
|
|
564
|
+
GLOB_JSON,
|
|
565
|
+
GLOB_JSON5,
|
|
566
|
+
GLOB_JSONC,
|
|
567
|
+
GLOB_JSX,
|
|
568
|
+
GLOB_LESS,
|
|
569
|
+
GLOB_MARKDOWN,
|
|
570
|
+
GLOB_MARKDOWN_CODE,
|
|
571
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
572
|
+
GLOB_POSTCSS,
|
|
573
|
+
GLOB_SCSS,
|
|
574
|
+
GLOB_SRC,
|
|
575
|
+
GLOB_SRC_EXT,
|
|
576
|
+
GLOB_STYLE,
|
|
577
|
+
GLOB_SVELTE,
|
|
578
|
+
GLOB_SVG,
|
|
579
|
+
GLOB_TESTS,
|
|
580
|
+
GLOB_TOML,
|
|
581
|
+
GLOB_TS,
|
|
582
|
+
GLOB_TSX,
|
|
583
|
+
GLOB_VUE,
|
|
584
|
+
GLOB_XML,
|
|
585
|
+
GLOB_YAML,
|
|
586
|
+
StylisticConfigDefaults,
|
|
587
|
+
imports,
|
|
588
|
+
katonlabs,
|
|
589
|
+
node,
|
|
590
|
+
perfectionist,
|
|
591
|
+
stylistic,
|
|
592
|
+
typescript,
|
|
593
|
+
unicorn,
|
|
594
|
+
vue
|
|
595
|
+
});
|