From 67b20e96d8e2bdc308a3c751f30f2ce365727f18 Mon Sep 17 00:00:00 2001 From: Guz013 <43732358+Guz013@users.noreply.github.com> Date: Thu, 13 Jul 2023 19:05:00 -0300 Subject: [PATCH] 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. --- packages/core/package.json | 1 + packages/core/src/index.js | 6 ++++++ pnpm-lock.yaml | 3 +++ 3 files changed, 10 insertions(+) diff --git a/packages/core/package.json b/packages/core/package.json index 7765405..74db16a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -29,6 +29,7 @@ "@eslint/eslintrc": "^2.1.0", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", + "globals": "^13.20.0", "typescript": "^5.0.0" } } diff --git a/packages/core/src/index.js b/packages/core/src/index.js index fb7eea9..3013a89 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -3,6 +3,7 @@ import tsEslint from '@typescript-eslint/eslint-plugin'; import tsParser from '@typescript-eslint/parser'; import js from '@eslint/js'; import * as configs from './configs/index.js'; +import globals from 'globals'; import { getUserRules } from './userOptions.js'; /** @@ -37,6 +38,11 @@ export function defineConfig(userConfig) { // eslint-disable-next-line no-undef 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 // rules as `RulesRecord` type. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef0adbd..2937b6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,6 +84,9 @@ importers: '@typescript-eslint/parser': specifier: ^5.45.0 version: 5.45.0(eslint@8.44.0)(typescript@5.1.6) + globals: + specifier: ^13.20.0 + version: 13.20.0 typescript: specifier: ^5.0.0 version: 5.1.6