Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIMS-1557: Update eslint from version 8.57.0 to 9.9.0 in react-app #2649

Merged
merged 7 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions react-app/.eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions react-app/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
module.exports = {
semi: true,
trailingComma: 'all',
Expand Down
73 changes: 73 additions & 0 deletions react-app/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import prettierPlugin from 'eslint-plugin-prettier';
import tseslint from 'typescript-eslint';
import eslint from '@eslint/js';
import reactPlugin from 'react-plugin';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
// Specify the parser for TypeScript
languageOptions: {
parser: tseslint.parser,
},
/* globals: {
module: 'readonly',
},
env: {
node: true,
},
extends: [
// By extending from a plugin config, we can get recommended rules without having to add them manually.
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
// This disables the formatting rules in ESLint that Prettier is going to be responsible for handling.
// Make sure it's always the last config, so it gets the chance to override other configs.
'eslint-config-prettier',
],*/
plugins: {
'typescript-eslint': tseslint,
prettier: prettierPlugin,
react: reactPlugin,
},
settings: {
react: {
// Tells eslint-plugin-react to automatically detect the version of React to use.
version: 'detect',
},
// Tells eslint how to resolve imports.
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
// Override ones from the extended configs.
'prettier/prettier': 'warn',
'no-extra-boolean-cast': 'off',
'no-unsafe-optional-chaining': 'off',
'no-prototype-builtins': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'no-console': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-inferrable-types': 'off', // ie. const val: number = 4;
'@typescript-eslint/no-empty-function': 'off', // ie. {}
'@typescript-eslint/no-non-null-assertion': 'off', // Allow use of non-null assertion operator (!).
'@typescript-eslint/no-explicit-any': 'off', // Warn if 'any' type is used.
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-restricted-types': 'error',
},

// Override settings for specific file types
files: ['**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx'],
},
{
// Ignore specific files and directories
ignores: ['node_modules/', 'package-lock.json', 'dist/', '/coverage'],
},
);
8 changes: 4 additions & 4 deletions react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint ./ --ext .jsx,.js,.ts,.tsx --max-warnings 0",
"lint": "eslint",
"lint:fix": "npm run lint -- --fix",
"format": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,json,css,scss}\"",
"check": "prettier --check \"./src/**/*.{js,jsx,ts,tsx,css,scss}\"",
Expand All @@ -33,8 +33,10 @@
"react-error-boundary": "4.0.12",
"react-hook-form": "7.52.0",
"react-leaflet": "4.2.1",
"react-plugin": "3.0.0-alpha.4",
"react-router-dom": "6.26.0",
"supercluster": "8.0.1",
"typescript-eslint": "8.4.0",
"use-supercluster": "1.2.0"
},
"devDependencies": {
Expand All @@ -47,10 +49,8 @@
"@types/leaflet": "1.9.9",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "8.1.0",
"@typescript-eslint/parser": "8.1.0",
"@vitejs/plugin-react": "4.3.0",
"eslint": "8.57.0",
"eslint": "9.9.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.35.0",
Expand Down
1 change: 0 additions & 1 deletion react-app/src/contexts/snackbarContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const initialState: MessageState = {
*/
const initialContext = {
messageState: initialState,
// eslint-disable-next-line @typescript-eslint/no-empty-function
setMessageState: (() => {}) as Dispatch<SetStateAction<MessageState>>,
styles: {
success: {},
Expand Down
1 change: 0 additions & 1 deletion react-app/src/pages/DevZone.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
//Simple component testing area.
import useDataLoader from '@/hooks/useDataLoader';
import usePimsApi from '@/hooks/usePimsApi';
Expand Down
Loading