diff --git a/eslint.config.mjs b/eslint.config.mjs index 1e844fb6..8c957dc3 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,6 +3,7 @@ import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; +import globals from 'globals'; export default tseslint.config( // replacement of legacy `.eslintignore` @@ -13,8 +14,16 @@ export default tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommended, eslintPluginPrettierRecommended, + // base config { - files: ['*.js'], + languageOptions: { + globals: { + ...globals.node, + }, + }, + }, + { + files: ['**/*.js'], rules: { '@typescript-eslint/no-require-imports': 'off', '@typescript-eslint/no-var-requires': 'off', diff --git a/package.json b/package.json index 93c15a45..120b5f39 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "install:all": "yarn && (cd examples && yarn)", "lint": "yarn prettier && yarn eslint", "lint:fix": "yarn prettier:fix && yarn eslint:fix", - "eslint": "eslint '{src,test}/**/*.ts' --cache", + "eslint": "eslint '{src,test,examples}/**/*.{js,ts}' --cache", "eslint:fix": "yarn eslint --fix", "prettier": "prettier --list-different \"**/*.{js,ts,md,yml,json,html}\"", "prettier:fix": "prettier --write \"**/*.{js,ts,md,yml,json,html}\"", @@ -75,6 +75,7 @@ "eslint-plugin-prettier": "5.2.1", "express": "4.19.2", "get-port": "5.1.1", + "globals": "15.9.0", "husky": "9.1.5", "jest": "29.7.0", "lint-staged": "15.2.9", diff --git a/yarn.lock b/yarn.lock index 01951b58..d77e2204 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2663,6 +2663,11 @@ global-directory@^4.0.1: dependencies: ini "4.1.1" +globals@15.9.0: + version "15.9.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-15.9.0.tgz#e9de01771091ffbc37db5714dab484f9f69ff399" + integrity sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA== + globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"