Skip to content

Commit 8cc079e

Browse files
committed
259 Add eslint
1 parent 4cc94ac commit 8cc079e

8 files changed

Lines changed: 1579 additions & 12 deletions

File tree

client/eslint.config.mjs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import pluginReact from "eslint-plugin-react";
4+
import reactHooks from 'eslint-plugin-react-hooks';
5+
import { defineConfig } from "eslint/config";
6+
7+
export default defineConfig([
8+
{
9+
files: ["**/*.{js,mjs,cjs,jsx}"],
10+
plugins: {
11+
js ,
12+
'react-hooks': reactHooks
13+
},
14+
extends: ["js/recommended"],
15+
languageOptions: { globals: globals.browser }
16+
},
17+
pluginReact.configs.flat.recommended, // React config first
18+
reactHooks.configs.flat.recommended,
19+
{
20+
rules: {
21+
// ToDo check rules that are off and warn
22+
"react/prop-types": "off",
23+
"react/no-children-prop": "off",
24+
'react-hooks/exhaustive-deps': 'warn',
25+
"react/react-in-jsx-scope" : "off",
26+
"react-hooks/set-state-in-effect": "off",
27+
"react-hooks/immutability":"off"
28+
},
29+
},
30+
31+
]);

client/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@
3434
},
3535
"devDependencies": {
3636
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
37+
"@eslint/js": "^9.39.1",
3738
"@testing-library/jest-dom": "^6.7.0",
3839
"@testing-library/react": "^16.3.0",
3940
"@testing-library/user-event": "^14.6.1",
41+
"eslint": "^9.39.1",
42+
"eslint-plugin-react": "^7.37.5",
43+
"eslint-plugin-react-hooks": "^7.0.1",
44+
"globals": "^16.5.0",
4045
"http-proxy-middleware": "^3.0.5",
4146
"nth-check": "^2.1.1",
4247
"react-json-view-lite": "^2.4.2",

client/src/pages/Login.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Login = () => {
2222
if (buttonRef && buttonRef.current) {
2323
buttonRef.current.focus();
2424
}
25-
}, []) // eslint-disable-line react-hooks/exhaustive-deps
25+
}, [])
2626

2727

2828
const doLogin = () => {

client/src/pages/UserTokens.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const UserTokens = () => {
1616
]
1717
});
1818

19-
}, []);// eslint-disable-line react-hooks/exhaustive-deps
19+
}, []);
2020

2121
return (
2222
<div className="mod-tokens">

client/src/tabs/Roles.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const Roles = () => {
5252
setRoles(newRoles);
5353
setSearching(false);
5454
}
55-
}, [user, paginationQueryParams]);// eslint-disable-line react-hooks/exhaustive-deps
55+
}, [user, paginationQueryParams]);
5656

5757
const openRole = (e, role) => {
5858
const id = role.isUserRole ? role.role.id : role.id;

client/src/tabs/Users.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const Users = () => {
3535
setSearching(false);
3636
});
3737
},
38-
[paginationQueryParams]);// eslint-disable-line react-hooks/exhaustive-deps
38+
[paginationQueryParams]);
3939

4040
const openUser = (e, user) => {
4141
const path = `/profile/${user.id}`

client/src/utils/Utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function isEmpty(obj) {
1818
return obj.trim().length === 0;
1919
}
2020
if (obj && obj.getTime) {
21-
// eslint-disable-next-line
21+
2222
return obj.getTime() !== obj.getTime();
2323
}
2424
if (typeof obj === "object") {

0 commit comments

Comments
 (0)