Skip to content

Commit 96cc72e

Browse files
committed
update eslint
1 parent 32e3b27 commit 96cc72e

File tree

3 files changed

+293
-229
lines changed

3 files changed

+293
-229
lines changed

eslint.config.mjs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import security from "eslint-plugin-security";
2+
import cypress from "eslint-plugin-cypress";
3+
import globals from "globals";
4+
import path from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
import js from "@eslint/js";
7+
import { FlatCompat } from "@eslint/eslintrc";
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all
15+
});
16+
17+
export default [...compat.extends(
18+
"eslint:recommended",
19+
"plugin:security/recommended-legacy",
20+
"plugin:react/recommended",
21+
"plugin:cypress/recommended",
22+
), {
23+
plugins: {
24+
security,
25+
cypress,
26+
},
27+
28+
languageOptions: {
29+
globals: {
30+
...globals.browser,
31+
...globals.amd,
32+
...globals.jquery,
33+
},
34+
35+
ecmaVersion: 2018,
36+
sourceType: "module",
37+
38+
parserOptions: {
39+
ecmaFeatures: {
40+
jsx: true,
41+
},
42+
},
43+
},
44+
45+
settings: {
46+
react: {
47+
version: "detect",
48+
},
49+
},
50+
51+
rules: {
52+
indent: ["error", 4],
53+
"linebreak-style": ["error", "unix"],
54+
55+
"no-unused-vars": ["error", {
56+
vars: "all",
57+
args: "none",
58+
}],
59+
60+
quotes: ["error", "single"],
61+
semi: ["error", "always"],
62+
63+
"max-len": [2, {
64+
code: 80,
65+
tabWidth: 4,
66+
ignoreUrls: true,
67+
}],
68+
69+
"space-before-function-paren": ["error", "never"],
70+
"space-in-parens": ["error", "never"],
71+
"no-trailing-spaces": ["error"],
72+
73+
"key-spacing": ["error", {
74+
beforeColon: false,
75+
}],
76+
77+
"func-call-spacing": ["error", "never"],
78+
"security/detect-buffer-noassert": 1,
79+
"security/detect-child-process": 1,
80+
"security/detect-disable-mustache-escape": 1,
81+
"security/detect-eval-with-expression": 1,
82+
"security/detect-new-buffer": 1,
83+
"security/detect-no-csrf-before-method-override": 1,
84+
"security/detect-non-literal-fs-filename": 1,
85+
"security/detect-non-literal-regexp": 1,
86+
"security/detect-non-literal-require": 0,
87+
"security/detect-object-injection": 0,
88+
"security/detect-possible-timing-attacks": 1,
89+
"security/detect-pseudoRandomBytes": 1,
90+
"security/detect-unsafe-regex": 1,
91+
},
92+
}];

0 commit comments

Comments
 (0)