Skip to content

Commit

Permalink
[Tech] Update to ESLint 9 (#3885)
Browse files Browse the repository at this point in the history
  • Loading branch information
CommandMC authored Aug 10, 2024
1 parent 17fd9fb commit b279d61
Show file tree
Hide file tree
Showing 6 changed files with 685 additions and 529 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

77 changes: 0 additions & 77 deletions .eslintrc.json

This file was deleted.

69 changes: 69 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// @ts-check

import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import react from 'eslint-plugin-react'
import prettier from 'eslint-config-prettier'
import importPlugin from 'eslint-plugin-import-x'

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
react.configs.flat.recommended,
prettier,
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
// FIXME: All of these rules should be errors instead
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/no-base-to-string': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-for-in-array': 'warn',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/unbound-method': 'warn',

'react/no-unknown-property': [
'error',
{ ignore: ['partition', 'allowpopups', 'useragent'] }
],
'@typescript-eslint/no-misused-promises': [
'error',
{ checksVoidReturn: false }
],
'import/no-duplicates': 'error'
},

plugins: {
import: importPlugin
},
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname
}
},
settings: {
react: {
version: 'detect'
}
}
},
{
files: ['**/__tests__/**/*.ts', '**/__mocks__/**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'import/no-duplicates': 'off'
}
},
{
ignores: ['build/', '**/*.js', 'eslint.config.mjs']
}
)
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dist:mac": "export CSC_IDENTITY_AUTO_DISCOVERY=false && electron-vite build && electron-builder --mac",
"dist:win": "electron-vite build && electron-builder --win",
"dist:flatpak": "pnpm dist:linux appimage && pnpm flatpak:prepare && pnpm flatpak:build",
"lint": "eslint --cache --ext .tsx,ts .",
"lint": "eslint --cache .",
"lint-fix": "eslint --fix --ext .tsx,ts ./src",
"flatpak:build": "cd flatpak-build && flatpak-builder build com.heroicgameslauncher.hgl.yml --install --force-clean --user",
"flatpak:prepare": "node ./flatpak/prepareFlatpak.js",
Expand Down Expand Up @@ -105,44 +105,43 @@
},
"devDependencies": {
"@electron/notarize": "^2.3.2",
"@eslint/js": "^9.7.0",
"@playwright/test": "1.42.1",
"@testing-library/dom": "9.0.1",
"@testing-library/jest-dom": "5.16.4",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.1.1",
"@types/eslint__js": "^8.42.3",
"@types/fs-extra": "^11.0.4",
"@types/graceful-fs": "^4.1.9",
"@types/i18next-fs-backend": "1.1.4",
"@types/ini": "1.3.31",
"@types/jest": "29.4.0",
"@types/node": "20.14.14",
"@types/plist": "3.0.2",
"@types/react": "18.2.34",
"@types/react": "18.3.3",
"@types/react-beautiful-dnd": "13.1.4",
"@types/react-dom": "18.2.14",
"@types/react-router-dom": "5.3.3",
"@types/sanitize-html": "2.9.0",
"@types/semver": "^7.5.8",
"@types/source-map-support": "^0.5.10",
"@types/tmp": "0.2.3",
"@typescript-eslint/eslint-plugin": "5.47.1",
"@typescript-eslint/parser": "5.47.1",
"@vitejs/plugin-react-swc": "3.6.0",
"cross-env": "7.0.3",
"electron": "31.3.1",
"electron-builder": "24.13.3",
"electron-vite": "^2.0.0",
"eslint": "8.36.0",
"eslint-config-prettier": "8.7.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-react": "7.31.11",
"eslint": "9.7.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import-x": "^3.1.0",
"eslint-plugin-react": "7.35.0",
"fast-xml-parser": "^4.3.6",
"husky": "8.0.3",
"i18next-parser": "7.7.0",
"jest": "29.5.0",
"node-gyp": "^10.0.1",
"prettier": "3.0.3",
"pretty-quick": "3.1.3",
"react-devtools": "^5.0.2",
"sass": "1.59.2",
"tmp": "0.2.1",
Expand All @@ -151,6 +150,7 @@
"type-fest": "3.6.1",
"typed-emitter": "^2.1.0",
"typescript": "4.9.4",
"typescript-eslint": "^7.17.0",
"unimported": "1.26.0",
"vite": "5.2.8",
"vite-plugin-svgr": "4.2.0"
Expand Down
Loading

0 comments on commit b279d61

Please sign in to comment.