Skip to content

Commit

Permalink
feat: add eslint to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
olavis authored and soofstad committed Aug 9, 2022
1 parent 23da6e5 commit 20c872d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
17 changes: 16 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
types: [python]
args: [--config=api/pyproject.toml]
files: ^api/.*\.py$

- repo: https://github.com/hadialqattan/pycln
rev: v1.3.5
hooks:
Expand All @@ -66,6 +66,21 @@ repos:
args:
["--config=web/.prettierrc.js", "--ignore-path=web/.prettierignore"]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v8.18.0'
hooks:
- id: eslint
additional_dependencies:
- eslint
- eslint-config-prettier # turns off all rules that might conflict with prettier
- eslint-plugin-jsx-a11y # checks accessibility rules on jsx elements
- eslint-plugin-prettier # runs prettier as an eslint rule
- eslint-plugin-react # react specific linting rules
- eslint-plugin-react-hooks # enforces the rules of hooks
files: ^web/src/.*\.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
types: [file]
args: ["--config=web/.eslintrc.json", "--ignore-path=web/.eslintignore"]

- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
Expand Down
4 changes: 4 additions & 0 deletions web/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/gen/*

build
coverage
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "2.7.1",
Expand Down
4 changes: 2 additions & 2 deletions web/src/api/TodoAPI.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Configuration, TodosApi } from './generated'

export class TodoAPI extends TodosApi {
constructor(token: string, basePath: string = 'http://localhost') {
constructor(token: string) {
const configuration = new Configuration({
basePath: basePath,
basePath: 'http://localhost',
accessToken: token,
})
super(configuration)
Expand Down
21 changes: 20 additions & 1 deletion web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4074,7 +4074,7 @@ eslint-plugin-jest@^25.3.0:

eslint-plugin-jsx-a11y@^6.5.1:
version "6.5.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.5.1.tgz#cdbf2df901040ca140b6ec14715c988889c2a6d8"
resolved "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.5.1.tgz"
integrity sha512-sVCFKX9fllURnXT2JwLN5Qgo24Ug5NF6dxhkmxsMEUZhXRcGg+X3e1JbJ84YePQKBl5E0ZjAH5Q4rkdcGY99+g==
dependencies:
"@babel/runtime" "^7.16.3"
Expand All @@ -4090,6 +4090,13 @@ eslint-plugin-jsx-a11y@^6.5.1:
language-tags "^1.0.5"
minimatch "^3.0.4"

eslint-plugin-prettier@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz"
integrity sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==
dependencies:
prettier-linter-helpers "^1.0.0"

eslint-plugin-react-hooks@^4.3.0, eslint-plugin-react-hooks@^4.6.0:
version "4.6.0"
resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz"
Expand Down Expand Up @@ -4342,6 +4349,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==

fast-diff@^1.1.2:
version "1.2.0"
resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==

fast-glob@^3.2.11, fast-glob@^3.2.9:
version "3.2.11"
resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz"
Expand Down Expand Up @@ -7189,6 +7201,13 @@ prelude-ls@~1.1.2:
resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz"
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==

prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz"
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
dependencies:
fast-diff "^1.1.2"

[email protected]:
version "2.7.1"
resolved "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz"
Expand Down

0 comments on commit 20c872d

Please sign in to comment.