Skip to content

Commit

Permalink
Merge pull request #178 from legumeinfo/feature/prettier-eslint
Browse files Browse the repository at this point in the history
Feature/prettier eslint
  • Loading branch information
ctcncgr authored Sep 18, 2023
2 parents d7bf6bc + d623738 commit fb6b237
Show file tree
Hide file tree
Showing 23 changed files with 1,800 additions and 838 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/eslint-prettier-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# workflow to enforce style and linting on PR
name: eslint-prettier
on:
pull_request:
branches:
- main
jobs:
format-and-lint:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# Setup npm environment to run tests
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run lint:eslint-config-prettier
- run: npm run format
- run: npm run lint
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply prettier formatting changes and check with eslint
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.ts": ["eslint-config-prettier", "prettier --write", "prettier --check", "eslint"],
}
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"tabWidth": 2,
"singleQuote": true,
"bracketSpacing": false,
"arrowParens": "always"
"arrowParens": "always",
"trailingComma": "all"
}
Loading

0 comments on commit fb6b237

Please sign in to comment.