-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove unused code and add linting and pre-commit hooks (#503)
* chore: remove unused code * run prettier * remove unused plugins * build: adjusting eslint rules for local development and adding precommit hooks * build: adjusting eslint rules for local development and adding precommit hooks * test eslint config * test eslint config * making eslint config warn for local development but error for pre-commit hooks * chore: cleaning up code and fixing lint warnings * chore: cleaning up code and fixing lint warnings * run prettier and adjusting configs * update lint-staged config * updating configs * fix eslint config * update prettier to run for any js,jsx,ts,tsx file * style: refactor and adding comment * fix: eslint errors * remove accidental committed code
- Loading branch information
1 parent
98b06a2
commit 1c0c3e2
Showing
39 changed files
with
439 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// The env is development during local development, so it overrides all the rules to "warn" | ||
// The env will be undefined for GH actions or when yarn lint-staged gets fired during pre-commit hooks, | ||
// so we can still catch any violations there | ||
const env = process.env.NODE_ENV; | ||
|
||
module.exports = { | ||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
extends: ['react-app', 'react-app/jest', 'eslint:recommended'], | ||
rules: { | ||
'react/react-in-jsx-scope': 'off', | ||
'import/no-unused-modules': 'off', | ||
'@typescript-eslint/no-unused-vars': | ||
env === 'development' ? 'warn' : 'error', | ||
'no-unused-vars': env === 'development' ? 'warn' : 'error', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
rules: { | ||
'@typescript-eslint/no-unused-vars': [ | ||
env === 'development' ? 'warn' : 'error', | ||
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true }, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.js', '**/*.jsx'], | ||
rules: { | ||
'no-unused-vars': [ | ||
env === 'development' ? 'warn' : 'error', | ||
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true }, | ||
], | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm run pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: detect-private-key | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- repo: local | ||
hooks: | ||
- id: lint-staged | ||
name: lint-staged | ||
entry: > | ||
bash -c ' | ||
cd client/src || exit 1 | ||
yarn lint-staged | ||
' | ||
language: system | ||
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
client/src/components/About/InteractionClaimTypes/TypesTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
client/src/components/Drug/DrugSearchResults/DrugSearchResults.scss
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
client/src/components/Drug/DrugSearchResults/DrugSearchResults.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
client/src/components/Gene/GeneSearchResults/GeneSearchResults.scss
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
client/src/components/Gene/GeneSearchResults/GeneSearchResults.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.