-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This PR creates a GitHub Action to run linting tasks on pull requests submitted to the repository. As part of the ticket, I took the opportunity to update the ESlint rules on the project. These updates have raised a number of linting issues, but **won't block** the merging of pull requests. While I've addressed some of the smaller items (and any error ones), I expect that these will be addressed in the normal course of feature development so that we can eventually require linting checks to pass in order to merge PRs. Here's a summary of what changed: ## Conflicting ESLint configurations There are currently two ESLint configurations in the project: - An `eslintConfig` property in the `package.json` file - A `.eslintrc` file [ESLint documentation](https://eslint.org/docs/latest/use/configure/configuration-files) says that only one of these is read, and the `.eslintrc` takes precedence. Thus, I've removed the ignored configuration since it wasn't being used. ## Prettier Code Formatting Prettier has been configured in the project as the code formatter of choice, but it is currently conflicting with a number of code formatting ESLint rules. The prettier ESLint plugin disables these rules if it is placed as an inherited configuration at the end of the `extends` array, so I have made this change. The prettier ESLint plugin also enables Prettier as an ESLint rule, so that code formatting issues become errors. This should be okay, since Prettier fixes them for you. In addition, I've disabled/removed some other code formatting related rules that aren't explicitly handled by the Prettier plugin. These include: - `padding-line-between-statements` - `no-extra-semi` - `jsx-quotes` - I've moved this one to the Prettier config with `jsxSingleQuote` ## Opinionated changes There are a number of other changes I've made that I think will allow for improved code quality. These are: - Turning on the `react-hooks/exhaustive-deps` rule - Adding the `unused-imports` ESLint plugin - Turning on the `@typescript-eslint/no-non-null-assertion` rule
- Loading branch information
1 parent
bf45cea
commit 57051d6
Showing
33 changed files
with
205 additions
and
112 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,54 @@ | ||
name: CI | ||
on: [pull_request] | ||
|
||
env: | ||
NODE_VERSION: 18.19.0 | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/node_modules | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- run: npm ci | ||
|
||
- uses: wearerequired/lint-action@v2 | ||
with: | ||
eslint: true | ||
eslint_extensions: js,jsx,ts,tsx | ||
prettier: true | ||
prettier_extensions: js,jsx,ts,tsx | ||
continue_on_error: false | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Install deps | ||
run: npm ci | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/node_modules | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Running tests | ||
env: | ||
REACT_APP_API_DOMAIN: http://localhost:8080 | ||
run: npm run test:nowatch |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
18.19.0 |
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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "all", | ||
"arrowParens": "always", | ||
"bracketSameLine": false, | ||
"bracketSpacing": true, | ||
"singleQuote": true, | ||
"printWidth": 100 | ||
"jsxSingleQuote": false, | ||
"trailingComma": "all", | ||
"semi": true, | ||
"printWidth": 100, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"endOfLine": "lf" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.