Skip to content

Commit 2efbab5

Browse files
authored
chore: use github-actions to lint pull-requests (#3)
1 parent cb0e68a commit 2efbab5

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

.github/workflows/lint.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
env:
8+
NODE_VERSION: "12.x"
9+
10+
jobs:
11+
eslint:
12+
name: Eslint
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: actions/setup-node@v1
21+
with:
22+
node-version: "${{ env.NODE_VERSION }}"
23+
24+
- name: Cache node modules
25+
uses: actions/cache@v1
26+
with:
27+
path: node_modules
28+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
29+
30+
- name: Install Dependencies
31+
if: steps.cache.outputs.cache-hit != 'true'
32+
run: npm ci
33+
34+
- name: Fetch all branches
35+
run: |
36+
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
37+
38+
- name: ESLint
39+
run: npm run ci:lint -- $(git diff --diff-filter d --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.tsx')

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"start": "parcel index.html --open",
88
"build": "parcel build index.html --no-cache",
99
"lint": "eslint 'src/**/*.js' --quiet --fix",
10-
"clean": "rimraf ./dist ./.cache"
10+
"clean": "rimraf ./dist ./.cache",
11+
"ci:lint": "eslint 'src/**/*.js' -c ./.eslintrc.js"
1112
},
1213
"dependencies": {
1314
"codemirror": "5.53.2",

0 commit comments

Comments
 (0)