-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
133 lines (126 loc) · 3.63 KB
/
eslint.config.ts
File metadata and controls
133 lines (126 loc) · 3.63 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import js from "@eslint/js";
import prettierConfig from "eslint-config-prettier";
import importPlugin from "eslint-plugin-import";
import prettierPlugin from "eslint-plugin-prettier";
import vuePlugin from "eslint-plugin-vue";
import * as tseslint from "typescript-eslint";
// eslint-disable-next-line import/order
import vueParser from "vue-eslint-parser";
const isProduction = import.meta.env?.PROD || process.env.NODE_ENV === "production";
export default [
{
ignores: ["src/graphql/codegen/generated.ts"],
},
js.configs.recommended,
...tseslint.configs.recommended,
importPlugin.flatConfigs.recommended,
// Import plugin
{
files: ["**/*.{js,ts,vue}"],
settings: {
"import/internal-regex": "^package/",
"import/resolver": {
typescript: true,
node: true,
},
},
rules: {
// Import sorting configuration
"import/order": [
"error",
{
distinctGroup: false,
groups: [
"builtin", // Node.js built-in modules
"external", // Packages from node_modules
"internal", // From the project using aliases (@/...)
"parent", // From parent directories (../)
"sibling", // From the same directory (./)
"index", // From the same file
],
pathGroups: [
{
pattern: "fast-check",
group: "external",
position: "after",
},
{
pattern: "vitest",
group: "external",
position: "before",
},
{
pattern: "vue",
group: "external",
position: "before",
},
{
pattern: "@/**",
group: "internal",
},
],
// Set `pathGroupsExcludedImportTypes` to `[]` to remove the default value of
// ['builtin', 'external', 'internal'] so that `pathGroups` work on `external`.
// https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/order.md
pathGroupsExcludedImportTypes: [],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
"newlines-between": "always",
},
],
// Separate type imports
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
},
},
// Vue configuration
{
files: ["**/*.vue"],
plugins: {
vue: vuePlugin,
},
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
ecmaVersion: 2022,
extraFileExtensions: [".vue"],
sourceType: "module",
},
},
rules: {
...vuePlugin.configs.recommended.rules,
"vue/multi-word-component-names": "off",
"vue/script-setup-uses-vars": "warn",
"vue/no-unused-components": "off",
},
},
// Global configuration
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
plugins: {
prettier: prettierPlugin,
},
rules: {
"no-console": isProduction ? "warn" : "off",
"no-debugger": isProduction ? "warn" : "off",
"no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/ban-ts-comment": "off",
"prettier/prettier": ["warn", { printWidth: 88 }],
},
},
prettierConfig, // Turn off rules that conflict with prettier
];