-
-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy patheslint.config.mjs
More file actions
88 lines (83 loc) · 2.72 KB
/
eslint.config.mjs
File metadata and controls
88 lines (83 loc) · 2.72 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
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
import globals from "globals";
// Magical typing definition so rule intellisense works https://github.com/microsoft/vscode-eslint/issues/1122
/**
* @type {import('eslint').Linter.Config<import('eslint/rules').ESLintRules>}
*/
const config = {
files: ["**/*.js"],
ignores: ["public/js/vendor/*.js"],
plugins: {
js,
},
extends: ["js/recommended"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
...globals.jquery,
// LANraragi specific
// TODO rework all main scripts to no longer store data in the global scope, probably transition to ES modules
Backup: "readonly",
Batch: "readonly",
Category: "readonly",
Common: "readonly",
Config: "readonly",
Duplicates: "readonly",
Edit: "readonly",
I18N: "readonly",
Index: "readonly",
IndexTable: "readonly",
Logs: "readonly",
LRR: "readonly",
Plugins: "readonly",
Reader: "readonly",
Server: "readonly",
Stats: "readonly",
// external packages
Awesomplete: "readonly",
marked: "readonly",
Swiper: "readonly",
tagger: "readonly",
tippy: "readonly",
},
},
rules: {
"func-names": ["error", "never"],
"no-alert": "off",
"no-console": "warn",
"no-else-return": "off",
"no-implicit-globals": "error",
"no-multi-assign": ["error", {
"ignoreNonDeclaration": true,
}],
"no-param-reassign": ["error", {
props: false,
}],
"no-plusplus": ["error", {
"allowForLoopAfterthoughts": true,
}],
"no-unused-expressions": ["error", {
"allowShortCircuit": true,
"allowTernary": true,
}],
"no-unused-vars": ["warn", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
}],
"one-var": "off",
"prefer-destructuring": ["warn", {
object: true,
array: false,
}],
// TODO Deprecated ESLint rules that still work but will be fully removed in ESLint v10
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"indent": ["error", 4, { "SwitchCase": 1 }],
"one-var-declaration-per-line": ["error", "initializations"],
"quotes": ["error", "double", { "allowTemplateLiterals": true }],
},
};
export default defineConfig(config);