chore(ci): add JS & TS linter check (#3394)

This commit is contained in:
Krzysztof Moch 2023-12-01 08:51:11 +01:00 committed by GitHub
parent 472820123a
commit 4d9334b477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 13 deletions

62
.github/workflows/check-js.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: Check JS
on:
push:
branches:
- master
paths:
- '.github/workflows/check-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.jsx'
- '*.ts'
- '*.tsx'
- '*.lock'
pull_request:
paths:
- '.github/workflows/check-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.jsx'
- '*.ts'
- '*.tsx'
- '*.lock'
jobs:
TypeScript-Check:
name: Check TS (tsc)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node_modules
uses: ./.github/actions/setup-node
- name: Install reviewdog
uses: reviewdog/action-setup@v1
- name: Check TypeScript
run: |
yarn tsc | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JS-Lint:
name: Lint JS (eslint, prettier)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node_modules
uses: ./.github/actions/setup-node
- name: Run ESLint
run: yarn lint -f @jamesacarr/github-actions
- name: Run ESLint with auto-fix
run: yarn lint --fix
- name: Verify no files have changed after auto-fix
run: git diff --exit-code HEAD

View File

@ -1,13 +0,0 @@
name: ci
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: yarn --no-lockfile
- run: yarn lint

View File

@ -16,6 +16,7 @@
"@types/react": "~18.0.0"
},
"devDependencies": {
"@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
"@react-native/eslint-config": "^0.72.2",
"@release-it/conventional-changelog": "^7.0.2",
"@types/jest": "^28.1.2",