-
Notifications
You must be signed in to change notification settings - Fork 14
/
eslint.config.js
142 lines (139 loc) · 3.88 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
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
134
135
136
137
138
139
140
141
142
const js = require("@eslint/js");
const pluginVue = require("eslint-plugin-vue");
const vueTsEslintConfig = require("@vue/eslint-config-typescript");
const schulcloud = require("./lib/eslint-plugin-schulcloud");
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
const globals = require("globals");
module.exports = [
...pluginVue.configs["flat/essential"],
js.configs.recommended,
...vueTsEslintConfig({
extends: ["recommended"],
supportedScriptLangs: {
ts: true,
// [!DISCOURAGED]
// Set to `true` to allow plain `<script>` or `<script setup>` blocks.
// This might result-in false positive or negatives in some rules for `.vue` files.
// Note you also need to configure `allowJs: true` and `checkJs: true`
// in corresponding `tsconfig.json` files.
js: true,
},
}),
eslintPluginPrettierRecommended,
{
ignores: [
".vscode/**",
"node_modules/**",
"**/dist/**",
"src/serverApi/**",
"src/fileStorageApi/**",
"src/h5pEditorApi/**",
],
},
{
languageOptions: {
ecmaVersion: "latest",
globals: {
...globals.node,
},
},
plugins: {
schulcloud,
},
rules: {
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-object-type": [
"error",
{ allowInterfaces: "with-single-extends" },
],
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-restricted-imports": [
"warn",
{
patterns: [
{
group: [
"@data-*/*",
"@feature-*/*",
"@page-*/*",
"@ui-*/*",
"@util-*/*",
],
message: "Do not deep import into a module",
},
{
group: ["@/modules/data/*", "*/../data/*", "../**/data/*"],
message:
"Data-Modules have to be imported using the pattern '@data-<name>'",
},
{
group: [
"@/modules/feature/*",
"*/../feature/*",
"../**/feature/*",
],
message:
"Feature-Modules have to be imported using the pattern '@feature-<name>'",
},
{
group: ["@/modules/page/*", "*/../page/*", "../**/page/*/*"],
message:
"Page-Modules have to be imported using the pattern '@page-<name>'",
},
{
group: ["@/modules/ui/*", "*/../ui/*", "../**/ui/*/*"],
message:
"Ui-Modules have to be imported using the pattern '@ui-<name>'",
},
{
group: ["@/modules/util/*", "*/../util/*", "../**/util/*/*"],
message:
"Util-Modules have to be imported using the pattern '@util-<name>'",
},
],
},
],
"@typescript-eslint/no-unused-vars": "warn",
"no-console": process.env.NODE_ENV === "production" ? "off" : "warn",
"no-debugger": process.env.NODE_ENV === "production" ? "off" : "warn",
"no-empty": "error",
"no-irregular-whitespace": "error",
"no-prototype-builtins": "error",
"no-undef": "warn",
"no-unused-vars": "off", // disable the base rule for @typescript-eslint/no-unused-vars
"no-useless-escape": "error",
"no-var": "error",
"prefer-const": "error",
"prettier/prettier": "error",
"schulcloud/material-icon-imports": "error",
"vue/html-self-closing": [
"error",
{
html: {
void: "always",
},
},
],
"vue/multi-word-component-names": "off", // TODO - make a final decision about this rule
"vue/no-mutating-props": "error",
"vue/no-setup-props-reactivity-loss": "error",
"vue/no-useless-template-attributes": "error",
"vue/no-v-html": "error",
"vue/no-v-text-v-html-on-component": "error",
},
},
{
files: ["**/*.unit.{j,t}s?(x)", "tests/**"],
languageOptions: {
globals: {
...globals.jest,
mount: "readonly",
shallowMount: "readonly",
fail: "readonly",
},
},
},
];