forked from Zettlr/Zettlr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
119 lines (117 loc) · 4.22 KB
/
.eslintrc.json
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
{
// Set up our environment
"env": {
"commonjs": true,
"es6": true,
"node": true
},
// Next on, we need the TypeScript ESLint parser
"plugins": ["@typescript-eslint"],
// ... however, we will use the Vue ESLint parser in order to properly read in
// .vue-files.
"parser": "vue-eslint-parser",
"parserOptions": {
// ... which will then be actually parsed with the TypeScript ESLint parser
"parser": "@typescript-eslint/parser",
"ecmaVersion": 2018,
"project": "./tsconfig.json",
"extraFileExtensions": [".vue"]
},
// We don't want to write all our stuff ourselves, but instead extend these
// rulesets
"extends": [
"standard-with-typescript",
"plugin:vue/vue3-recommended"
],
// The following overrides ensure that any pure JavaScript files are also
// linted with ESLint, but not type checked.
"overrides": [
{
"files": ["**/*.js"],
"extends": ["plugin:@typescript-eslint/disable-type-checked"]
}
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
// Now, overwrite any rules where we differ
"rules": {
"no-unused-vars": "off", // We need to turn off the vanilla option ...
// ... and turn on the TypeScript one. HOWEVER, we also need to use the
// appropriate option that allows us to declare variables as unused by
// prefixing it with an underscore.
"@typescript-eslint/no-unused-vars": "off",
// See https://typescript-eslint.io/rules/no-unused-vars/
"space-before-function-paren": [2, "always"],
// The following rule-changes to JSStandard Coding Style are tradition,
// as they were included with the default configuration of Atom's ESLint
// plugin, so we'll keep them here for the time being.
"prefer-const": "off",
// Sometimes, it makes sense to return a void to save a line of code, so we
// keep this rule off.
"@typescript-eslint/no-confusing-void-expression": "off",
"array-bracket-spacing": [
2,
"always",
{
"objectsInArrays": false,
"singleValue": false
}
],
// Here follow vue-styles. While the short form is recommended
// I tend to value verbose code. At least for now, discussion is
// well received.
"vue/v-bind-style": ["error", "longform"],
"vue/v-on-style": ["error", "longform"],
// Let the implementation decide if self-closing is wanted or not.
"vue/html-self-closing": [
"warn",
{
"html": {
"void": "any",
"normal": "any",
"component": "any"
},
"svg": "any",
"math": "any"
}
],
// Allow up to three attributes per line so that the contributor can
// decide if the attributes are too long for the 80 character column
"vue/max-attributes-per-line": [
"error",
{
"singleline": 3,
"multiline": 3
}
],
// We allow the use of v-html directives, because we sanitize any user
// provided HTML to only contain safe tags. The only stuff we currently
// put in there is translation strings, which we sanitise in the trans()
// function. NOTE to keep this on my mind!
"vue/no-v-html": "off",
// If we activate this rule, we have about 500 errors that there are no
// spaces around | operators. Hasn't been a problem until now, won't be
// one in the future.
"@typescript-eslint/space-infix-ops": "off",
"@typescript-eslint/no-base-to-string": [
"error",
{
"ignoredTypeNames": ["Text"]
}
],
"@typescript-eslint/no-non-null-assertion": "off",
// DEBUG: Turn a few errors into warnings after upgrading ESLint to >6.x
// This rule is difficult to disable right now; it interferes with the
// "no-null-assertion" rule, and it won't be an easy fix. We'll have to
// think about it.
"@typescript-eslint/non-nullable-type-assertion-style": 1,
// The following two rules conflict with each other in a few edge cases, so
// we'll keep both on "warning" severity for now.
"@typescript-eslint/no-unnecessary-boolean-literal-compare": 1,
"@typescript-eslint/strict-boolean-expressions": 1,
// The following rule basically disallows use of `any`
"@typescript-eslint/no-unsafe-argument": 1
}
}