update linting

This commit is contained in:
Jelle van Snik 2022-12-27 15:08:03 +01:00
parent 02e912a760
commit 4731f350d9
7 changed files with 51 additions and 62 deletions

View File

@ -1,29 +0,0 @@
name: Linting
on:
push:
branches:
- master
- dev
pull_request:
types: [opened, reopened, synchronize]
jobs:
linting:
name: Run linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Yarn packages
run: yarn install
- name: Run linters
run: yarn lint:strict

40
.github/workflows/linting_testing.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Linting and Testing
on:
push:
branches:
- master
- dev
pull_request:
types: [opened, reopened, synchronize]
jobs:
linting:
name: Run Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Yarn packages
run: yarn install
- name: Run ESLint Report
run: yarn lint:report
# continue on error, so it still reports it in the next step
continue-on-error: true
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
report-json: "eslint_report.json"
- name: Build Project
run: npm run build

View File

@ -1,30 +0,0 @@
name: Testing
on:
push:
branches:
- dev
pull_request:
types: [opened, reopened, synchronize]
permissions: read-all
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Yarn packages
run: yarn install
- name: Build project
run: yarn build

6
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig"
]
}

View File

@ -1,6 +1,7 @@
{ {
"files.eol": "\n", "files.eol": "\n",
"editor.detectIndentation": false, "editor.detectIndentation": false,
"editor.tabSize": 2,
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.tabSize": 2 "editor.defaultFormatter": "dbaeumer.vscode-eslint",
} }

View File

@ -25,7 +25,8 @@
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint --ext .tsx,.ts src", "lint": "eslint --ext .tsx,.ts src",
"lint:strict": "eslint --ext .tsx,.ts --max-warnings 0 src" "lint:strict": "eslint --ext .tsx,.ts --max-warnings 0 src",
"lint:report": "eslint --ext .tsx,.ts --output-file eslint_report.json --format json src"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [

View File

@ -12,7 +12,7 @@ function App() {
<WatchedContextProvider> <WatchedContextProvider>
<BookmarkContextProvider> <BookmarkContextProvider>
<Switch> <Switch>
<Route exact path="/"> <Route exact={true} path="/">
<Redirect to={`/search/${MWMediaType.MOVIE}`} /> <Redirect to={`/search/${MWMediaType.MOVIE}`} />
</Route> </Route>
<Route exact path="/media/movie/:media" component={MediaView} /> <Route exact path="/media/movie/:media" component={MediaView} />