forked from uswds/uswds
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
76 lines (69 loc) · 1.89 KB
/
eslint.config.mjs
File metadata and controls
76 lines (69 loc) · 1.89 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
import eslint from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import prettier from "eslint-config-prettier";
import importPlugin from "eslint-plugin-import";
import noUnsanitized from "eslint-plugin-no-unsanitized";
import path from "path";
import { fileURLToPath } from "url";
import { configs as litConfigs } from "eslint-plugin-lit";
import globals from "globals";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const airbnbConfig = compat.config({
extends: ["airbnb-base"],
});
const customConfig = {
plugins: {
import: importPlugin,
"no-unsanitized": noUnsanitized,
},
rules: {
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
"no-unsanitized/method": "error",
"no-unsanitized/property": "error",
"no-underscore-dangle": "warn", // Allow _ in variable names, but discourage it
"import/no-unresolved": [2, { ignore: ["\\.(s?)css\\?inline$"] }],
},
languageOptions: {
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
globals: {
...globals.node,
...globals.es6,
...globals.mocha,
// Use globals from eslint where possible, but globals.browser breaks stuff for some reason
window: true,
document: true,
navigator: true,
console: true,
module: true,
setTimeout: true,
clearTimeout: true,
setInterval: true,
clearInterval: true,
FileReader: "readonly",
getComputedStyle: true,
customElements: true,
},
},
};
const testConfig = {
files: ["**/*.spec.js"],
rules: {
"no-unsanitized/method": "off",
"no-unsanitized/property": "off",
},
};
export default [
litConfigs["flat/recommended"],
eslint.configs.recommended,
...airbnbConfig,
customConfig,
testConfig,
prettier,
];