Skip to content

Commit f37e702

Browse files
committed
Linting and highlighting config
1 parent 85dac19 commit f37e702

6 files changed

+1185
-45
lines changed

.eslintrc.json

-43
This file was deleted.

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
build/*
2-
1+
node_modules
2+
build

eslint.config.mjs

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import globals from "globals";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all
13+
});
14+
15+
export default [...compat.extends("eslint:recommended"), {
16+
languageOptions: {
17+
globals: {
18+
...globals.browser,
19+
...globals.webextensions,
20+
...globals.jquery,
21+
},
22+
},
23+
24+
files: ["source/js/*.js"],
25+
26+
rules: {
27+
"no-console": "off",
28+
29+
indent: ["warn", 2, {
30+
SwitchCase: 1,
31+
}],
32+
33+
"no-trailing-spaces": "warn",
34+
"eol-last": "warn",
35+
"no-multiple-empty-lines": "warn",
36+
37+
"space-unary-ops": ["warn", {
38+
words: true,
39+
nonwords: false,
40+
}],
41+
42+
"space-infix-ops": "warn",
43+
"keyword-spacing": "warn",
44+
"space-before-blocks": ["warn", "always"],
45+
"operator-linebreak": "warn",
46+
"space-before-function-paren": ["warn", "never"],
47+
"space-in-parens": ["warn", "never"],
48+
"array-bracket-spacing": ["warn", "never"],
49+
"no-spaced-func": "warn",
50+
51+
"no-unused-vars": ["error", { "caughtErrors": "none" }],
52+
53+
"key-spacing": ["warn", {
54+
beforeColon: false,
55+
afterColon: true,
56+
}],
57+
58+
"quote-props": ["warn", "as-needed"],
59+
60+
"brace-style": ["warn", "1tbs", {
61+
allowSingleLine: true,
62+
}],
63+
64+
curly: ["warn", "multi-line"],
65+
"no-with": "warn",
66+
"dot-notation": "warn",
67+
semi: ["warn", "always"],
68+
"no-var": "warn",
69+
},
70+
}];

jsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2023"
4+
},
5+
"typeAcquisition": {
6+
"enable": true,
7+
"include": ["firefox-webext-browser", "chrome", "jquery"]
8+
}
9+
}

0 commit comments

Comments
 (0)