From ec859e7fc6d15a9c2a0c9ea402eb6a66bdb2c80a Mon Sep 17 00:00:00 2001 From: Christophe Hurpeau <302891+christophehurpeau@users.noreply.github.com> Date: Fri, 27 Dec 2024 22:35:19 +0100 Subject: [PATCH] feat: add scripts override --- @pob/eslint-config/lib/index.js | 9 ++++++--- @pob/eslint-config/lib/overrides/scripts.js | 9 +++++++++ @pob/eslint-config/lib/plugins/unicorn.js | 6 ------ scripts/check-packages.js | 2 ++ 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 @pob/eslint-config/lib/overrides/scripts.js diff --git a/@pob/eslint-config/lib/index.js b/@pob/eslint-config/lib/index.js index e1b85e89d..2144faaa2 100644 --- a/@pob/eslint-config/lib/index.js +++ b/@pob/eslint-config/lib/index.js @@ -5,7 +5,8 @@ import baseCommonjsConfig from "./base/commonjs.js"; import baseModuleConfig from "./base/module.js"; import nodePluginCommonjsConfigs from "./node/commonjs.js"; import nodePluginModuleConfigs from "./node/module.js"; -import testConfig from "./overrides/test.js"; +import scriptsOverrideConfig from "./overrides/scripts.js"; +import testOverrideConfig from "./overrides/test.js"; import importPluginBaseConfigs from "./plugins/import/import-base.js"; import importPluginCommonjsConfig from "./plugins/import/import-commonjs.js"; import importPluginModuleConfig from "./plugins/import/import-module.js"; @@ -95,6 +96,7 @@ export default () => { ...importPluginBaseConfigs, importPluginCommonjsConfig, ...nodePluginCommonjsConfigs, + scriptsOverrideConfig, ...apply({ files: ["**/*.mjs"], @@ -107,7 +109,7 @@ export default () => { ...apply({ files: testFiles, - configs: [testConfig], + configs: [testOverrideConfig], }), ]; @@ -124,13 +126,14 @@ export default () => { ...apply({ files: testFiles, - configs: [testConfig], + configs: [testOverrideConfig], }), ]; const nodeModule = [ ...baseModule, ...nodePluginModuleConfigs, + scriptsOverrideConfig, ...apply({ files: ["**/*.cjs"], diff --git a/@pob/eslint-config/lib/overrides/scripts.js b/@pob/eslint-config/lib/overrides/scripts.js new file mode 100644 index 000000000..9c2efeacc --- /dev/null +++ b/@pob/eslint-config/lib/overrides/scripts.js @@ -0,0 +1,9 @@ +export default { + name: "@pob/eslint-config/overrides/scripts", + rules: { + "unicorn/no-process-exit": "off", + "n/hashbang": "off", + // allow dev dependencies + "import/no-extraneous-dependencies": ["error", { devDependencies: true }], + }, +}; diff --git a/@pob/eslint-config/lib/plugins/unicorn.js b/@pob/eslint-config/lib/plugins/unicorn.js index fbb0cc1e2..e13f6f051 100644 --- a/@pob/eslint-config/lib/plugins/unicorn.js +++ b/@pob/eslint-config/lib/plugins/unicorn.js @@ -347,10 +347,4 @@ export default [ "unicorn/consistent-existence-index-check": "error", }, }, - { - files: ["scripts/**"], - rules: { - "unicorn/no-process-exit": "off", - }, - }, ]; diff --git a/scripts/check-packages.js b/scripts/check-packages.js index a804bde32..5a7dcbaf1 100644 --- a/scripts/check-packages.js +++ b/scripts/check-packages.js @@ -1,3 +1,5 @@ +#!/usr/bin/env node + import { createCheckPackageWithWorkspaces } from "check-package-dependencies"; import semver from "semver";