diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..7bf5a239 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,32 @@ +module.exports = { + env: { + browser: true, + es2021: true, + node: true, + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@next/next/recommended', + ], + overrides: [ + { + env: { + node: true, + }, + files: ['.eslintrc.{js,cjs}'], + parserOptions: { + sourceType: 'script', + }, + }, + ], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: ['@typescript-eslint', 'react'], + rules: { + '@next/next/no-html-link-for-pages': ['error', 'packages/app'], + }, +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82e33055..97563d01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,7 @@ jobs: AISWEB_API_PASSWORD: ${{ secrets.aisweb_api_password }} RPL_DATE: ${{ github.event.inputs.date }} - run: pnpm test + - run: pnpm lint - run: npx semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index d2cb4c93..fd7006f2 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,15 @@ "@types/node": "^20.6.0", "@types/react": "^18.2.21", "@types/react-dom": "^18.2.7", + "@typescript-eslint/eslint-plugin": "^6.7.0", + "@typescript-eslint/parser": "^6.7.0", "autoprefixer": "^10.4.15", "conventional-changelog-conventionalcommits": "^7.0.2", "drizzle-kit": "^0.19.13", "esbuild": "^0.19.3", + "eslint": "^8.49.0", + "eslint-config-next": "^13.4.19", + "eslint-plugin-react": "^7.33.2", "nx": "16.8.1", "pg-hstore": "^2.3.3", "postcss": "^8.4.29", @@ -45,6 +50,7 @@ "scripts": { "serve": "nx run @mach/app:dev", "build": "nx run-many --target=build", + "lint": "eslint .", "test": "vitest" }, "workspaces": { diff --git a/packages/app/package.json b/packages/app/package.json index a3634ba5..112c82c9 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -12,12 +12,6 @@ "build": "next build", "start": "next start" }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, "browserslist": { "production": [ ">0.2%", diff --git a/packages/app/src/components/SelectInput/index.tsx b/packages/app/src/components/SelectInput/index.tsx index fcc6a696..756b1088 100644 --- a/packages/app/src/components/SelectInput/index.tsx +++ b/packages/app/src/components/SelectInput/index.tsx @@ -1,12 +1,14 @@ import Select from 'react-select' -export function SelectInput