Skip to content

Commit 76597c7

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

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

.eslintrc.js

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,9 @@ 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',
2920
'import/order': [
3021
'warn',
3122
{
@@ -44,5 +35,43 @@ module.exports = {
4435
},
4536
},
4637
],
38+
'no-restricted-globals': [
39+
'error',
40+
{
41+
name: '__dirname',
42+
message: 'Not available in JavaScript',
43+
},
44+
{
45+
name: '__filename',
46+
message: 'Not available in JavaScript',
47+
},
48+
{
49+
name: 'Buffer',
50+
message:
51+
"'Buffer' unavailable in JavaScript. Use 'Uint8Array' instead. For Base64, use helpers in src/obfuscation.ts",
52+
},
53+
{
54+
name: 'clearImmediate',
55+
message: "'clearImmediate' unavailable in JavaScript. Use 'setTimeout(fn, 0)' instead",
56+
},
57+
{
58+
name: 'process',
59+
message:
60+
"'process' unavailable in JavaScript. If this is already defined in webpack.config.js, you can safely disable the error for this line.",
61+
},
62+
{
63+
name: 'setImmediate',
64+
message: 'Not available in JavaScript.',
65+
},
66+
],
67+
'prettier/prettier': [
68+
'warn',
69+
{
70+
singleQuote: true,
71+
trailingComma: 'all',
72+
printWidth: 100,
73+
},
74+
],
75+
'unused-imports/no-unused-imports': 'error',
4776
},
4877
};

0 commit comments

Comments
 (0)