Skip to content

Commit

Permalink
chore: upgrade eslint, add lintWebapp command in build.gradle.kts and…
Browse files Browse the repository at this point in the history
… fix eslint errors
  • Loading branch information
ericenns committed Nov 9, 2024
1 parent ef0204a commit 0eb37fa
Show file tree
Hide file tree
Showing 21 changed files with 802 additions and 672 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Run eslint on changed files
uses: tj-actions/eslint-changed-files@v18
with:
config_path: "src/main/webapp/.eslintrc.js"
config_path: "src/main/webapp/eslint.confg.mjs"
extra_args: "--max-warnings=0"
file_extensions: |
src/main/webapp/resources/js/**/*.ts
Expand All @@ -63,4 +63,4 @@ jobs:
reporter: github-pr-review
fail_on_error: true
level: error
checkstyle_config: './checkstyle.xml'
checkstyle_config: './checkstyle.xml'
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ tasks.named<PnpmTask>("pnpmInstall") {
finalizedBy(":pnpmCachePrune")
}

tasks.register<PnpmTask>("lintWebapp") {
dependsOn(":pnpmInstall")
pnpmCommand.set(listOf("lint"))
}

tasks.register<PnpmTask>("cleanWebapp") {
dependsOn(":pnpmInstall")
pnpmCommand.set(listOf("clean"))
Expand Down
52 changes: 0 additions & 52 deletions src/main/webapp/.eslintrc.js

This file was deleted.

35 changes: 35 additions & 0 deletions src/main/webapp/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{
languageOptions: {
globals: {
...globals.browser,
...globals.jest,
i18n: true,
__webpack_public_path__: true,
},
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
"react/prop-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-unused-vars": "off",
},
settings: {
react: {
version: "detect",
},
},
},
];
15 changes: 7 additions & 8 deletions src/main/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "run-z --then rm -rf dist/ pages/templates/i18n/",
"test": "run-z --then jest resources/js/**/*.test.js",
"test_watch": "run-z --then jest --watch resources/js/**/*.test.js",
"lint": "run-z --then eslint --ext resources/js/**/*.{js,jsx,ts,tsx}"
"lint": "run-z --then eslint resources/js/**/*.{js,jsx,ts,tsx}"
},
"browserslist": [
"last 2 Chrome versions",
Expand Down Expand Up @@ -70,6 +70,7 @@
"redux-saga": "1.1.3",
"styled-components": "5.3.5",
"tslib": "2.3.1",
"typescript-eslint": "8.13.0",
"uniqolor": "1.0.2",
"uuid": "8.3.2",
"xlsx": "0.18.5"
Expand All @@ -90,20 +91,17 @@
"@types/react-virtualized-auto-sizer": "1.0.1",
"@types/react-window": "1.8.5",
"@types/styled-components": "5.1.25",
"@typescript-eslint/eslint-plugin": "5.27.0",
"@typescript-eslint/parser": "5.27.0",
"@typescript-eslint/eslint-plugin": "8.13.0",
"@typescript-eslint/parser": "8.13.0",
"autoprefixer": "10.4.4",
"babel-loader": "8.2.4",
"babel-plugin-import": "1.13.5",
"browserslist": "4.20.2",
"css-loader": "6.7.1",
"css-minimizer-webpack-plugin": "3.4.1",
"eslint": "8.13.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint": "9.14.0",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "7.29.4",
"eslint-plugin-react-hooks": "4.4.0",
"eslint-plugin-react": "7.37.2",
"expose-loader": "3.1.0",
"jest": "27.5.1",
"less": "4.1.2",
Expand All @@ -126,6 +124,7 @@
},
"resolutions": {
"fstream": "1.0.12",
"globals": "^15.0.0",
"ini": "3.0.0",
"jquery": "3.5.1",
"path-parse": "1.0.7",
Expand Down
Loading

0 comments on commit 0eb37fa

Please sign in to comment.