From 8952e947bfcd0fd745779d355f48d9ad0f2c4caa Mon Sep 17 00:00:00 2001 From: vince Date: Wed, 10 Jul 2024 22:30:39 +0800 Subject: [PATCH] feat: add eslint-plugin-turbo --- .../lint-configs/eslint-config/package.json | 1 + .../eslint-config/src/configs/index.ts | 1 + .../eslint-config/src/configs/turbo.ts | 16 +++++++ .../lint-configs/eslint-config/src/index.ts | 2 + internal/node-utils/package.json | 2 +- package.json | 3 +- pnpm-lock.yaml | 44 +++++++++++++------ scripts/vsh/src/lint/index.ts | 2 +- 8 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 internal/lint-configs/eslint-config/src/configs/turbo.ts diff --git a/internal/lint-configs/eslint-config/package.json b/internal/lint-configs/eslint-config/package.json index fba2fbae..a1d0b2b7 100644 --- a/internal/lint-configs/eslint-config/package.json +++ b/internal/lint-configs/eslint-config/package.json @@ -27,6 +27,7 @@ } }, "dependencies": { + "eslint-config-turbo": "^2.0.6", "eslint-plugin-command": "^0.2.3" }, "devDependencies": { diff --git a/internal/lint-configs/eslint-config/src/configs/index.ts b/internal/lint-configs/eslint-config/src/configs/index.ts index 982997a2..c0284efb 100644 --- a/internal/lint-configs/eslint-config/src/configs/index.ts +++ b/internal/lint-configs/eslint-config/src/configs/index.ts @@ -11,6 +11,7 @@ export * from './perfectionist'; export * from './prettier'; export * from './regexp'; export * from './test'; +export * from './turbo'; export * from './typescript'; export * from './unicorn'; export * from './vue'; diff --git a/internal/lint-configs/eslint-config/src/configs/turbo.ts b/internal/lint-configs/eslint-config/src/configs/turbo.ts new file mode 100644 index 00000000..5efb4c9c --- /dev/null +++ b/internal/lint-configs/eslint-config/src/configs/turbo.ts @@ -0,0 +1,16 @@ +import type { Linter } from 'eslint'; + +export async function turbo(): Promise { + const [pluginTurbo] = await Promise.all([ + // @ts-expect-error - no types + import('eslint-config-turbo'), + ] as const); + + return [ + { + plugins: { + turbo: pluginTurbo, + }, + }, + ]; +} diff --git a/internal/lint-configs/eslint-config/src/index.ts b/internal/lint-configs/eslint-config/src/index.ts index 33c6b44b..023c5806 100644 --- a/internal/lint-configs/eslint-config/src/index.ts +++ b/internal/lint-configs/eslint-config/src/index.ts @@ -14,6 +14,7 @@ import { prettier, regexp, test, + turbo, typescript, unicorn, vue, @@ -46,6 +47,7 @@ async function defineConfig(config: FlatConfig[] = []) { test(), regexp(), command(), + turbo(), ...customConfig, ...config, ]; diff --git a/internal/node-utils/package.json b/internal/node-utils/package.json index e3b57c51..6e3a6078 100644 --- a/internal/node-utils/package.json +++ b/internal/node-utils/package.json @@ -37,6 +37,6 @@ "pkg-types": "^1.1.3", "prettier": "^3.3.2", "rimraf": "^6.0.0", - "zx": "^8.1.4" + "zx": "^7.2.3" } } diff --git a/package.json b/package.json index 80c3062e..0054583c 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,8 @@ ], "updateConfig": { "ignoreDependencies": [ - "eslint" + "eslint", + "zx" ] } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4279d212..4a6ed86a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -261,6 +261,9 @@ importers: internal/lint-configs/eslint-config: dependencies: + eslint-config-turbo: + specifier: ^2.0.6 + version: 2.0.6(eslint@8.57.0) eslint-plugin-command: specifier: ^0.2.3 version: 0.2.3(eslint@8.57.0) @@ -423,8 +426,8 @@ importers: specifier: ^6.0.0 version: 6.0.0 zx: - specifier: ^8.1.4 - version: 8.1.4 + specifier: ^7.2.3 + version: 7.2.3 internal/tailwind-config: dependencies: @@ -3019,7 +3022,6 @@ packages: '@ls-lint/ls-lint@2.2.3': resolution: {integrity: sha512-ekM12jNm/7O2I/hsRv9HvYkRdfrHpiV1epVuI2NP+eTIcEgdIdKkKCs9KgQydu/8R5YXTov9aHdOgplmCHLupw==} - cpu: [x64, arm64, s390x] os: [darwin, linux, win32] hasBin: true @@ -4987,6 +4989,10 @@ packages: resolution: {integrity: sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg==} engines: {node: '>=12'} + dotenv@16.0.3: + resolution: {integrity: sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==} + engines: {node: '>=12'} + dotenv@16.4.5: resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} engines: {node: '>=12'} @@ -5152,6 +5158,11 @@ packages: peerDependencies: eslint: '>=7.0.0' + eslint-config-turbo@2.0.6: + resolution: {integrity: sha512-PkRjFnZUZWPcrYT4Xoi5OWOUtnn6xVGh88I6TsayiH4AQZuLs/MDmzfJRK+PiWIrI7Q7sbsVEQP+nUyyRE3uAw==} + peerDependencies: + eslint: '>6.6.0' + eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} @@ -5259,6 +5270,11 @@ packages: peerDependencies: eslint: '>=8.44.0' + eslint-plugin-turbo@2.0.6: + resolution: {integrity: sha512-yGnpMvyBxI09ZrF5bGpaniBz57MiExTCsRnNxP+JnbMFD+xU3jG3ukRzehVol8LYNdC/G7E4HoH+x7OEpoSGAQ==} + peerDependencies: + eslint: '>6.6.0' + eslint-plugin-unicorn@54.0.0: resolution: {integrity: sha512-XxYLRiYtAWiAjPv6z4JREby1TAE2byBC7wlh0V4vWDCpccOSU1KovWV//jqPXF6bq3WKxqX9rdjoRQ1EhdmNdQ==} engines: {node: '>=18.18'} @@ -9427,11 +9443,6 @@ packages: engines: {node: '>= 16.0.0'} hasBin: true - zx@8.1.4: - resolution: {integrity: sha512-QFDYYpnzdpRiJ3dL2102Cw26FpXpWshW4QLTGxiYfIcwdAqg084jRCkK/kuP/NOSkxOjydRwNFG81qzA5r1a6w==} - engines: {node: '>= 12.17.0'} - hasBin: true - snapshots: '@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.24.0)(algoliasearch@4.24.0)(search-insights@2.15.0)': @@ -13960,6 +13971,8 @@ snapshots: dotenv-expand@8.0.3: {} + dotenv@16.0.3: {} + dotenv@16.4.5: {} dotenv@8.6.0: {} @@ -14213,6 +14226,11 @@ snapshots: dependencies: eslint: 8.57.0 + eslint-config-turbo@2.0.6(eslint@8.57.0): + dependencies: + eslint: 8.57.0 + eslint-plugin-turbo: 2.0.6(eslint@8.57.0) + eslint-import-resolver-node@0.3.9: dependencies: debug: 3.2.7 @@ -14340,6 +14358,11 @@ snapshots: regexp-ast-analysis: 0.7.1 scslre: 0.3.0 + eslint-plugin-turbo@2.0.6(eslint@8.57.0): + dependencies: + dotenv: 16.0.3 + eslint: 8.57.0 + eslint-plugin-unicorn@54.0.0(eslint@8.57.0): dependencies: '@babel/helper-validator-identifier': 7.24.7 @@ -18897,8 +18920,3 @@ snapshots: webpod: 0.0.2 which: 3.0.1 yaml: 2.4.5 - - zx@8.1.4: - optionalDependencies: - '@types/fs-extra': 11.0.4 - '@types/node': 20.14.10 diff --git a/scripts/vsh/src/lint/index.ts b/scripts/vsh/src/lint/index.ts index 1c96ee06..92964607 100644 --- a/scripts/vsh/src/lint/index.ts +++ b/scripts/vsh/src/lint/index.ts @@ -14,7 +14,7 @@ async function runLint({ format }: LintCommandOptions) { if (format) { await $`stylelint "**/*.{vue,css,less.scss}" --cache --fix`; await $`eslint . --cache --fix`; - await $`prettier . --write --cache`; + await $`prettier . --write --cache --log-level warn`; return; }