From 0de6b5341749d67055cb53aa86754377f19004d0 Mon Sep 17 00:00:00 2001 From: Julian Meinking <12785972+DrJume@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:11:34 +0200 Subject: [PATCH] fix: set eslint-plugin-unicorn ourself when enabled --- package.json | 5 ---- packages/eslint-config/index.js | 53 ++++++++++++++++++--------------- pnpm-lock.yaml | 35 ++++++++++++++++++---- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 08d0d7f..1ad67ea 100644 --- a/package.json +++ b/package.json @@ -22,11 +22,6 @@ "rimraf": "^5.0.7", "typescript": "^5.4.5" }, - "pnpm": { - "overrides": { - "eslint-plugin-unicorn": "^54.0.0" - } - }, "changelogithub": { "extends": "gh:falcondev-it/configs/changelogithub" } diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index d58542d..a34a37a 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -49,32 +49,37 @@ export function eslintConfig({ nuxt = false, tsconfigPath, unicorn = false, conf }) .prepend(github) .append(nuxt ? nuxtRules : []) + .override('antfu/unicorn/rules', (config) => { + if (unicorn) delete config.plugins + return config + }) + .insertBefore('antfu/unicorn/rules', unicorn && eslintPluginUnicorn.configs['flat/recommended']) .append( - (async () => { - if (!unicorn) return - - /** @type import('eslint').Linter.FlatConfig */ - const unicornConfig = eslintPluginUnicorn.configs['flat/recommended'] - delete unicornConfig.plugins - - return unicornConfig - })(), - ) - .append({ - name: 'falcondev/unicorn/rules', - rules: { - 'unicorn/filename-case': [ - 'error', - { - cases: { - kebabCase: true, - pascalCase: true, - }, - ignore: [/^README\./], + unicorn && [ + { + name: 'falcondev/unicorn/rules', + rules: { + 'unicorn/filename-case': [ + 'error', + { + cases: { + kebabCase: true, + pascalCase: true, + }, + ignore: [/^README\./], + }, + ], }, - ], - }, - }) + }, + { + name: 'falcondev/unicorn/ignore', + files: ['.github/**/*'], + rules: { + 'unicorn/filename-case': 'off', + }, + }, + ], + ) .append({ name: 'falcondev/rules', rules: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3b86d29..661dcbf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,9 +4,6 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -overrides: - eslint-plugin-unicorn: ^54.0.0 - importers: .: @@ -1324,6 +1321,12 @@ packages: peerDependencies: eslint: '>=6.0.0' + eslint-plugin-unicorn@53.0.0: + resolution: {integrity: sha512-kuTcNo9IwwUCfyHGwQFOK/HjJAYzbODHN3wP0PgqbW+jbXqpNWxNVpVhj2tO9SixBwuAdmal8rVcWKBxwFnGuw==} + engines: {node: '>=18.18'} + peerDependencies: + eslint: '>=8.56.0' + eslint-plugin-unicorn@54.0.0: resolution: {integrity: sha512-XxYLRiYtAWiAjPv6z4JREby1TAE2byBC7wlh0V4vWDCpccOSU1KovWV//jqPXF6bq3WKxqX9rdjoRQ1EhdmNdQ==} engines: {node: '>=18.18'} @@ -2937,7 +2940,7 @@ snapshots: eslint-plugin-perfectionist: 2.11.0(eslint@8.57.0)(typescript@5.4.5)(vue-eslint-parser@9.4.3(eslint@8.57.0)) eslint-plugin-regexp: 2.6.0(eslint@8.57.0) eslint-plugin-toml: 0.11.1(eslint@8.57.0) - eslint-plugin-unicorn: 54.0.0(eslint@8.57.0) + eslint-plugin-unicorn: 53.0.0(eslint@8.57.0) eslint-plugin-unused-imports: 3.2.0(@typescript-eslint/eslint-plugin@7.14.1(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0) eslint-plugin-vitest: 0.5.4(@typescript-eslint/eslint-plugin@7.14.1(@typescript-eslint/parser@7.14.1(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5) eslint-plugin-vue: 9.26.0(eslint@8.57.0) @@ -3363,7 +3366,7 @@ snapshots: eslint-plugin-import-x: 0.5.2(eslint@8.57.0)(typescript@5.4.5) eslint-plugin-jsdoc: 48.5.0(eslint@8.57.0) eslint-plugin-regexp: 2.6.0(eslint@8.57.0) - eslint-plugin-unicorn: 54.0.0(eslint@8.57.0) + eslint-plugin-unicorn: 53.0.0(eslint@8.57.0) eslint-plugin-vue: 9.26.0(eslint@8.57.0) globals: 15.6.0 pathe: 1.1.2 @@ -4576,6 +4579,28 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-plugin-unicorn@53.0.0(eslint@8.57.0): + dependencies: + '@babel/helper-validator-identifier': 7.24.7 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@eslint/eslintrc': 3.1.0 + ci-info: 4.0.0 + clean-regexp: 1.0.0 + core-js-compat: 3.37.1 + eslint: 8.57.0 + esquery: 1.5.0 + indent-string: 4.0.0 + is-builtin-module: 3.2.1 + jsesc: 3.0.2 + pluralize: 8.0.0 + read-pkg-up: 7.0.1 + regexp-tree: 0.1.27 + regjsparser: 0.10.0 + semver: 7.6.2 + strip-indent: 3.0.0 + transitivePeerDependencies: + - supports-color + eslint-plugin-unicorn@54.0.0(eslint@8.57.0): dependencies: '@babel/helper-validator-identifier': 7.24.7