From 72874f2fd2ea6c00a4fdb184231f031b01e62e5a Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Sun, 10 Jul 2022 18:15:48 +1000 Subject: [PATCH] add Eslint action and update travis CI (#931) * refactor: eliminate eslint errors as many as I can * refactor: fix more eslint errors in the record module * LINT: fix @typescript-eslint/unbound-method * LINT: fix all eslint errors in source code * LINT: fix as many eslint warnings as possible * CI: add a github action to check ESLINT status * CI: update github action * build: update travis CI and github action * CI: update github action * CI: update job name * CI: restore test command from turbo to lerna * Merge branch master into eslint-action Co-authored-by: Justin Halsall --- .github/workflows/eslint.yml | 36 ++++++++++++++++++++++++++++++++++++ .travis.yml | 4 ++-- package.json | 3 ++- turbo.json | 16 ++++++---------- 4 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/eslint.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 00000000..91676387 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,36 @@ +name: Eslint Check + +on: [pull_request] + +jobs: + eslint_check_upload: + runs-on: ubuntu-latest + name: ESLint Check and Report Upload + + steps: + - uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' + - name: Install Dependencies + run: yarn + - name: Build Packages + run: yarn build:all + - name: Test Code Linting + run: yarn turbo run lint + - name: Save Code Linting Report JSON + run: yarn lint:report + # Continue to the next step even if this fails + continue-on-error: true + - name: Annotate Code Linting Results + uses: ataylorme/eslint-annotate-action@v2 + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' + report-json: 'eslint_report.json' + - name: Upload ESLint report + uses: actions/upload-artifact@v2 + with: + name: eslint_report.json + path: eslint_report.json diff --git a/.travis.yml b/.travis.yml index 9ecba610..89d0ef2b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,6 @@ install: - yarn script: - - yarn lerna run prepublish - - yarn lerna run check-types + - yarn build:all + - yarn turbo run check-types - xvfb-run --server-args="-screen 0 1920x1080x24" yarn lerna run test diff --git a/package.json b/package.json index 18d5cae5..9fbd3b7c 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "test:watch": "yarn turbo run test:watch", "dev": "yarn turbo run dev", "repl": "cd packages/rrweb && npm run repl", - "lint": "yarn run concurrently --success=all -r -m=1 'yarn run markdownlint docs' 'yarn eslint packages/*/src --ext .ts,.tsx,.js,.jsx,.svelte'" + "lint": "yarn run concurrently --success=all -r -m=1 'yarn run markdownlint docs' 'yarn eslint packages/*/src --ext .ts,.tsx,.js,.jsx,.svelte'", + "lint:report": "yarn eslint --output-file eslint_report.json --format json packages/*/src --ext .ts,.tsx,.js,.jsx" }, "resolutions": { "**/jsdom/cssom": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz" diff --git a/turbo.json b/turbo.json index 5d1a5823..cf58a139 100644 --- a/turbo.json +++ b/turbo.json @@ -3,17 +3,13 @@ "baseBranch": "origin/master", "pipeline": { "prepublish": { - "dependsOn": [ - "^prepublish" - ], - "outputs": [ - "lib/**", - "es/**", - "dist/**" - ] + "dependsOn": ["^prepublish"], + "outputs": ["lib/**", "es/**", "dist/**"] }, "test": {}, "test:watch": {}, - "dev": {} + "dev": {}, + "lint": {}, + "check-types": {} } -} \ No newline at end of file +}