Skip to content

Commit

Permalink
Merge pull request #20 from mailchimp/feature/12-eslint-workflow
Browse files Browse the repository at this point in the history
Add the `eslint` GitHub Action Workflow
  • Loading branch information
jeffpaul authored May 31, 2024
2 parents cc5527b + aa19229 commit 25ebed4
Show file tree
Hide file tree
Showing 7 changed files with 21,294 additions and 2,574 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[{*.json,*.yml,.babelrc,.bowerrc,.browserslistrc,.postcssrc}]
indent_style = space
indent_size = 2

[*.txt,wp-config-sample.php]
end_of_line = crlf
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
js/i18n
js/datepicker.js
js/scrollTo.js
tests
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@10up/eslint-config/wordpress'],
};
42 changes: 42 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: JS Linting

on:
push:
branches:
- develop
- main
paths:
- '**.js'
pull_request:
branches:
- develop
paths:
- '**.js'

jobs:
eslint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node and npm cache
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Install Node dependencies
run: npm ci --omit=optional

- name: Get updated JS files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
**/*.js
- name: Run JS linting
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
run: ./node_modules/.bin/10up-toolkit lint-js ${{ steps.changed-files.outputs.all_changed_files }}
Loading

0 comments on commit 25ebed4

Please sign in to comment.