Fix ESLint configuration and parsing errors

- Fix .eslintrc.json format (remove comments and invalid JSON syntax)
- Simplify environment.jsx to fix parsing error
- Add proper ESLint rules for React project
- Enable react-hooks plugin and configure settings
This commit is contained in:
tuanOts 2025-05-25 02:15:41 +07:00
parent 37f11dc23a
commit 1e9bab5d07
2 changed files with 22 additions and 46 deletions

View File

@ -1,43 +1,14 @@
// module.exports = {
// "env": {
// "browser": true,
// "es2021": true,
// "jest": true
// },
// "extends": [
// "eslint:recommended",
// "plugin:react/recommended"
// ],
// "overrides": [
// {
// "env": {
// "node": true
// },
// "files": [
// ".eslintrc.{js,cjs,jsx}"
// ],
// "parserOptions": {
// "sourceType": "script"
// }
// }
// ],
// "parserOptions": {
// "ecmaVersion": "latest",
// "sourceType": "module"
// },
// "plugins": [
// "react"
// ],
// "rules": {
// "react/react-in-jsx-scope": "off"
// }
// }
{
"env": {
"browser": true,
"es2021": true
"es2021": true,
"jest": true
},
"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:react-hooks/recommended"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module",
@ -45,8 +16,14 @@
"jsx": true
}
},
// "plugins": ["react", "react-hooks"],
"plugins": ["react", "react-hooks"],
"rules": {
//add customize rules here as per your project's needs
"react/react-in-jsx-scope": "off",
"react/prop-types": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}

View File

@ -1,6 +1,5 @@
// For development environment
const publicUrl = process.env.PUBLIC_URL || "/";
export const base_path = publicUrl.endsWith('/') ? publicUrl : publicUrl + '/';
export const base_path = process.env.PUBLIC_URL || "/";
// For production with a subdirectory (uncomment and modify as needed)
// export const base_path = "/react/";