chore: add nodejs globals

Added nodejs globals to the project for better development.
This will be changed and a config to change the globals will be
added.
This commit is contained in:
Guz013
2023-07-13 19:05:00 -03:00
parent e7b4a7b280
commit 67b20e96d8
3 changed files with 10 additions and 0 deletions

View File

@@ -29,6 +29,7 @@
"@eslint/eslintrc": "^2.1.0", "@eslint/eslintrc": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0", "@typescript-eslint/parser": "^5.45.0",
"globals": "^13.20.0",
"typescript": "^5.0.0" "typescript": "^5.0.0"
} }
} }

View File

@@ -3,6 +3,7 @@ import tsEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser'; import tsParser from '@typescript-eslint/parser';
import js from '@eslint/js'; import js from '@eslint/js';
import * as configs from './configs/index.js'; import * as configs from './configs/index.js';
import globals from 'globals';
import { getUserRules } from './userOptions.js'; import { getUserRules } from './userOptions.js';
/** /**
@@ -37,6 +38,11 @@ export function defineConfig(userConfig) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
tsconfigRootDir: process.cwd(), tsconfigRootDir: process.cwd(),
}, },
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
globals: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
...globals.nodeBuiltin,
},
}, },
// @ts-expect-error The `@typescript-eslint/eslint-plugin` package doesn't export // @ts-expect-error The `@typescript-eslint/eslint-plugin` package doesn't export
// rules as `RulesRecord` type. // rules as `RulesRecord` type.

3
pnpm-lock.yaml generated
View File

@@ -84,6 +84,9 @@ importers:
'@typescript-eslint/parser': '@typescript-eslint/parser':
specifier: ^5.45.0 specifier: ^5.45.0
version: 5.45.0(eslint@8.44.0)(typescript@5.1.6) version: 5.45.0(eslint@8.44.0)(typescript@5.1.6)
globals:
specifier: ^13.20.0
version: 13.20.0
typescript: typescript:
specifier: ^5.0.0 specifier: ^5.0.0
version: 5.1.6 version: 5.1.6