Skip to content

Commit be1764c

Browse files
committed
chore: prevent native node functions from leaking to js
1 parent 0587b36 commit be1764c

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

.eslintrc.js

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,10 @@ module.exports = {
1414
],
1515
plugins: ['@typescript-eslint', 'prettier', 'import', 'promise', 'unused-imports'],
1616
rules: {
17-
'prettier/prettier': [
18-
'warn',
19-
{
20-
singleQuote: true,
21-
trailingComma: 'all',
22-
printWidth: 100,
23-
},
24-
],
17+
'@typescript-eslint/no-explicit-any': 'off',
2518
'import/named': 'off',
2619
'import/no-unresolved': 'off',
27-
'unused-imports/no-unused-imports': 'error',
28-
'@typescript-eslint/no-explicit-any': 'off',
20+
'import/no-dynamic-require': 'error',
2921
'import/order': [
3022
'warn',
3123
{
@@ -44,5 +36,43 @@ module.exports = {
4436
},
4537
},
4638
],
39+
'no-restricted-globals': [
40+
'error',
41+
{
42+
name: '__dirname',
43+
message: 'Not available in JavaScript',
44+
},
45+
{
46+
name: '__filename',
47+
message: 'Not available in JavaScript',
48+
},
49+
{
50+
name: 'Buffer',
51+
message:
52+
"'Buffer' unavailable in JavaScript. Use 'Uint8Array' instead. For Base64, use helpers in src/obfuscation.ts",
53+
},
54+
{
55+
name: 'clearImmediate',
56+
message: "'clearImmediate' unavailable in JavaScript. Use 'setTimeout(fn, 0)' instead",
57+
},
58+
{
59+
name: 'process',
60+
message:
61+
"'process' unavailable in JavaScript. If this is already defined in webpack.config.js, you can safely disable the error for this line.",
62+
},
63+
{
64+
name: 'setImmediate',
65+
message: 'Not available in JavaScript.',
66+
},
67+
],
68+
'prettier/prettier': [
69+
'warn',
70+
{
71+
singleQuote: true,
72+
trailingComma: 'all',
73+
printWidth: 100,
74+
},
75+
],
76+
'unused-imports/no-unused-imports': 'error',
4777
},
4878
};

0 commit comments

Comments
 (0)