-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.ts
61 lines (57 loc) · 1.84 KB
/
eslint.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import baseConfig from "@acdh-oeaw/eslint-config";
import nodeConfig from "@acdh-oeaw/eslint-config-node";
import nuxtConfig from "@acdh-oeaw/eslint-config-nuxt";
import playwrightConfig from "@acdh-oeaw/eslint-config-playwright";
// import tailwindcssConfig from "@acdh-oeaw/eslint-config-tailwindcss";
import vueConfig from "@acdh-oeaw/eslint-config-vue";
import gitignore from "eslint-config-flat-gitignore";
// @ts-expect-error Missing type declaration.
import checkFilePlugin from "eslint-plugin-check-file";
import type { Config } from "typescript-eslint";
import { withNuxt } from "./.nuxt/eslint.config.mjs";
const KEBAB_CASE = "+([a-z])*([a-z0-9])*(-+([a-z0-9]))";
const CAMEL_CASE = "+([a-z])*([a-z0-9])*([A-Z]*([a-z0-9]))";
const DYNAMIC_SEGMENTS = `\\[?(\\[)${CAMEL_CASE}\\]?(\\[)`;
const CATCH_ALL_SEGMENTS = `\\[...${CAMEL_CASE}\\]`;
const MIDDLE_EXTENSION = "*(.+([a-z0-9]))";
const config: Config = [
gitignore({ strict: false }),
...baseConfig,
...vueConfig,
...nuxtConfig,
// ...tailwindcssConfig,
...playwrightConfig,
{
rules: {
"vue/attributes-order": ["warn", { alphabetical: true }],
},
},
...nodeConfig.map((config) => {
return {
files: ["server/**/*.ts"],
...config,
};
}),
{
plugins: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
"check-file": checkFilePlugin,
},
rules: {
"check-file/filename-naming-convention": [
"error",
{
"**/*": `@(${KEBAB_CASE}${MIDDLE_EXTENSION}|${DYNAMIC_SEGMENTS}${MIDDLE_EXTENSION}|${CATCH_ALL_SEGMENTS}${MIDDLE_EXTENSION})`,
},
],
"check-file/folder-naming-convention": [
"error",
{
"**/": `@(${KEBAB_CASE}|${DYNAMIC_SEGMENTS}|${CATCH_ALL_SEGMENTS})`,
},
],
},
},
];
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
export default withNuxt(config as any);