-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy patheslint.config.mjs
More file actions
86 lines (85 loc) · 2.43 KB
/
eslint.config.mjs
File metadata and controls
86 lines (85 loc) · 2.43 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
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import security from "eslint-plugin-security";
/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: globals.browser } },
{
files: ["packages/core/scripts/**/*.{js,cjs,mjs}"],
languageOptions: { globals: globals.node },
},
{
files: [
"packages/server-v3/scripts/**/*.{js,cjs,mjs,ts}",
"packages/server-v4/scripts/**/*.{js,cjs,mjs,ts}",
],
languageOptions: { globals: globals.node },
},
{
files: ["packages/cli/**/*.{js,cjs,mjs,ts}"],
languageOptions: { globals: globals.node },
},
{
ignores: [
"**/dist/**",
"**/node_modules/**",
"packages/core/lib/dom/build/**",
"packages/core/lib/v3/dom/build/**",
"packages/core/lib/v4/dom/build/**",
"packages/core/scripts/prepare.js",
"**/*.config.js",
"**/*.config.mjs",
".browserbase/**",
"**/.browserbase/**",
"**/*.json",
"stainless.yml",
"packages/server-v3/openapi.v3.yaml",
"packages/server-v4/openapi.v4.yaml",
],
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
security,
},
rules: {
"no-eval": "error",
"no-implied-eval": "error",
"no-new-func": "error",
"security/detect-eval-with-expression": "error",
"preserve-caught-error": "error",
"no-restricted-syntax": [
"error",
{
selector: "CallExpression[callee.name='Function']",
message: "Dynamic function construction is prohibited.",
},
{
selector: "NewExpression[callee.name='Function']",
message: "Dynamic function construction is prohibited.",
},
{
selector:
"CallExpression[callee.object.name='window'][callee.property.name='Function']",
message:
"Dynamic function construction via window.Function is prohibited.",
},
{
selector:
"CallExpression[callee.object.name='globalThis'][callee.property.name='Function']",
message:
"Dynamic function construction via globalThis.Function is prohibited.",
},
],
},
},
{
files: ["packages/cli/**/*.{js,cjs,mjs,ts}"],
rules: {
"no-empty": ["error", { allowEmptyCatch: true }],
},
},
];