From bff526533393a8d72cc3d7081dc20ce280c33100 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 11 Nov 2024 20:59:12 +0800 Subject: [PATCH] Fix broken lint on CI (#5507) * fix broken lint i'm currently getting errors with yarn lint locally, but CI is succeeding. meaning i always have to bypass commit hooks Unable to resolve path to module '@uppy/...' import/no-unresolved * use built in cache * skip corepack check * disable no-unresolved rule i don't think it's very necessary now that we have typescript * revert * remove remnants of refactor https://github.com/transloadit/uppy/commit/c8d16f6a55fd1a5928f36e04defb8915693e3ad4 * use built in cache for the other lint too --- .eslintrc.js | 6 +----- .github/workflows/linters.yml | 26 +++----------------------- package.json | 2 +- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index b6dcece1e8..77e5fbe8fd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -54,11 +54,7 @@ module.exports = { ignore: svgPresentationAttributes, }], - // Special rules for CI: - ...(process.env.CI && { - // Some imports are available only after a full build, which we don't do on CI. - 'import/no-unresolved': 'off', - }), + 'import/no-unresolved': 'off', // rules we want to enforce 'array-callback-return': 'error', diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 214796b1b6..12a96650b7 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -17,6 +17,7 @@ on: env: YARN_ENABLE_GLOBAL_CACHE: false + SKIP_YARN_COREPACK_CHECK: true jobs: lint_js: @@ -25,22 +26,12 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: - echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - name: Install Node.js uses: actions/setup-node@v4 with: node-version: lts/* + cache: yarn - name: Install dependencies # List all projects that use a custom ESLint config: run: @@ -57,22 +48,11 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: - echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v4 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - name: Install Node.js uses: actions/setup-node@v4 with: node-version: lts/* + cache: yarn - name: Install dependencies run: corepack yarn workspaces focus @uppy-dev/build - name: Run linter diff --git a/package.json b/package.json index 39d067e66a..b1fa51fec6 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "build:angular": "yarn workspace angular build", "build:js:typeless": "npm-run-all build:lib build:companion build:svelte", "build:js": "npm-run-all build:js:typeless build:locale-pack build:angular build:bundle", - "build:ts": "yarn workspaces list --no-private --json | yarn tsc -b && yarn workspace @uppy/svelte check", + "build:ts": "yarn tsc -b && yarn workspace @uppy/svelte check", "build:lib": "yarn node ./bin/build-lib.js", "build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && eslint packages/@uppy/locales/src/en_US.ts --fix && yarn workspace @uppy-dev/locale-pack test unused", "build": "npm-run-all --serial build:ts --parallel build:js build:css --serial size",