Add linting to CI (#74)

- Prettier
 - ESLint
This commit is contained in:
Eric Eastwood 2022-09-27 22:21:00 -05:00 committed by GitHub
parent be837515fe
commit b39d7caf31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 3 deletions

40
.github/workflows/linting.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Linting
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint-eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run eslint -- "**/*.js"
lint-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run Prettier
run: npm run prettier -- --check "**/*.{js,css,md}"

View File

@ -110,6 +110,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci

2
.prettierignore Normal file
View File

@ -0,0 +1,2 @@
node_modules/
dist/

View File

@ -28,8 +28,8 @@ class NotEnoughEventsFromDaySummaryTileView extends TemplateView {
}, },
[ [
t.if( t.if(
(vm) => !!daySummaryMessage, (/*vm*/) => !!daySummaryMessage,
(t, vm) => (t /*, vm*/) =>
t.p( t.p(
{ {
className: 'NotEnoughEventsFromDaySummaryTileView_summaryMessage', className: 'NotEnoughEventsFromDaySummaryTileView_summaryMessage',

View File

@ -48,7 +48,7 @@ class RoomCardView extends TemplateView {
t.view(new AvatarView(avatarViewModel, 24)), t.view(new AvatarView(avatarViewModel, 24)),
t.if( t.if(
(vm) => vm.name, (vm) => vm.name,
(t, vm) => (t /*, vm*/) =>
t.h4( t.h4(
{ {
className: 'RoomCardView_headerTitle', className: 'RoomCardView_headerTitle',