-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
87 lines (86 loc) · 2.74 KB
/
eslint.config.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// @ts-check
import eslint from "@eslint/js";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import pluginVue from "eslint-plugin-vue";
import tseslint from "typescript-eslint";
export default tseslint.config(
{
files: ["**/*.vue", "**/*.js", "**/*.ts"],
ignores: ["./static/**"],
plugins: { "simple-import-sort": simpleImportSort },
rules: {
"simple-import-sort/exports": "error",
"quote-props": [2, "consistent-as-needed"],
"prettier/prettier": "warn",
"simple-import-sort/imports": [
"error",
{
"groups": [
// Type imports
["^[^\\.].+\\u0000$", "^.\\u0000$"],
// @libraries
["^@", "^\\w+"],
// Internal packages (@/, ../, ./)
["^@/", "^\\.\\.(?!/?$)", "^\\.\\./?$", "^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Components
["^primevue/.+", "\\.vue$"],
// Style imports
["^.+\\.s?css$"],
// Side effect imports
["^\\u0000"],
],
},
],
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...pluginVue.configs["flat/recommended"],
{
files: ["*.vue", "**/*.vue"],
plugins: {
"typescript-eslint": tseslint.plugin,
},
languageOptions: {
parserOptions: {
parser: tseslint.parser,
project: "./tsconfig.json",
extraFileExtensions: [".vue"],
sourceType: "module",
},
},
rules: {
"vue/component-api-style": ["error", ["script-setup"]],
"vue/define-props-declaration": "error",
"vue/block-order": ["error", { order: ["script[setup]", "template", "style[scoped]"] }],
"vue/block-lang": ["error", { script: { lang: "ts" } }],
"vue/define-macros-order": [
"error",
{
order: ["defineOptions", "defineModel", "defineProps", "defineEmits", "defineSlots"],
defineExposeLast: true,
},
],
"vue/html-self-closing": ["error", { "html": { "void": "always" } }],
"vue/singleline-html-element-content-newline": "off",
// PascalCase is only used because PrimeVue and Inertia like use standard component names which conflict with real elements
// And using PascalCase is essential to ensure these are correctly loaded.
"vue/component-name-in-template-casing": [
"error",
"PascalCase",
{
"registeredComponentsOnly": false,
globals: ["Button", "Image", "Menu", "Link"],
ignores: ["Link"],
},
],
},
},
eslintPluginPrettierRecommended,
{
rules: {
"prettier/prettier": "warn",
},
},
);