Skip to content

Commit 24a1a84

Browse files
committed
Catch undef vars
1 parent 8fe74e3 commit 24a1a84

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

.oxlintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"settings": {},
1010
"rules": {
1111
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
12-
"@typescript-eslint/no-misused-new": ["error"],
12+
"@typescript-eslint/no-misused-new": "error",
1313
"@typescript-eslint/no-this-alias": [
1414
"error",
1515
{ "allowDestructuring": true }
@@ -20,6 +20,7 @@
2020
"no-control-regex": "off",
2121
"no-new": "off",
2222
"no-self-assign": "off",
23+
"no-undef": "off",
2324
"no-unused-vars": "off"
2425
}
2526
}

eslint.config.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const importXPlugin = require('eslint-plugin-import-x')
1313
const nodePlugin = require('eslint-plugin-n')
1414
const sortDestructureKeysPlugin = require('eslint-plugin-sort-destructure-keys')
1515
const unicornPlugin = require('eslint-plugin-unicorn')
16+
const globals = require('globals')
1617
const tsEslint = require('typescript-eslint')
1718

1819
const constants = require('@socketsecurity/registry/lib/constants')
@@ -34,15 +35,16 @@ const sharedPlugins = {
3435
}
3536

3637
const sharedRules = {
37-
'no-await-in-loop': ['error'],
38-
'no-control-regex': ['error'],
38+
'no-await-in-loop': 'error',
39+
'no-control-regex': 'error',
3940
'no-empty': ['error', { allowEmptyCatch: true }],
40-
'no-new': ['error'],
41-
'no-proto': ['error'],
41+
'no-new': 'error',
42+
'no-proto': 'error',
43+
'no-undef': 'error',
4244
'no-warning-comments': ['warn', { terms: ['fixme'] }],
43-
'sort-destructure-keys/sort-destructure-keys': ['error'],
45+
'sort-destructure-keys/sort-destructure-keys': 'error',
4446
'sort-imports': ['error', { ignoreDeclarationSort: true }],
45-
'unicorn/consistent-function-scoping': ['error']
47+
'unicorn/consistent-function-scoping': 'error'
4648
}
4749

4850
const sharedRulesForImportX = {
@@ -141,6 +143,14 @@ module.exports = [
141143
{
142144
files: ['src/**/*.ts', 'test/**/*.ts'],
143145
languageOptions: {
146+
globals: {
147+
BufferConstructor: 'readonly',
148+
BufferEncoding: 'readonly',
149+
NodeJS: 'readonly',
150+
...Object.fromEntries(
151+
Object.entries(globals.node).map(([k]) => [k, 'readonly'])
152+
)
153+
},
144154
parser: tsParser,
145155
parserOptions: {
146156
projectService: {
@@ -160,7 +170,7 @@ module.exports = [
160170
rules: {
161171
...sharedRules,
162172
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
163-
'@typescript-eslint/no-misused-new': ['error'],
173+
'@typescript-eslint/no-misused-new': 'error',
164174
'@typescript-eslint/no-this-alias': [
165175
'error',
166176
{ allowDestructuring: true }

0 commit comments

Comments
 (0)