Skip to content

Commit d7fddc8

Browse files
chore: updating eslint config for node-jet template
1 parent 5c81499 commit d7fddc8

File tree

3 files changed

+73
-9
lines changed

3 files changed

+73
-9
lines changed

Diff for: templates/node-jet/eslint.config.mjs

+68-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,72 @@
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
*/
77

8-
import eslint from "@eslint/js";
9-
import tseslint from "typescript-eslint";
8+
import globals from "globals";
9+
import js from "@eslint/js";
10+
import nodePlugin from "eslint-plugin-n";
11+
import tseslintPlugin from "@typescript-eslint/eslint-plugin";
12+
import tseslintParser from "@typescript-eslint/parser";
1013

11-
export default tseslint.config(
12-
eslint.configs.recommended,
13-
...tseslint.configs.recommended
14-
);
14+
export default [
15+
{
16+
files: ["src/**/*.ts", "src/**/*.tsx"],
17+
languageOptions: {
18+
ecmaVersion: 2022,
19+
sourceType: "module",
20+
parser: tseslintParser,
21+
parserOptions: {
22+
ecmaFeatures: {
23+
modules: true
24+
},
25+
ecmaVersion: "2022",
26+
project: "./tsconfig.json",
27+
},
28+
globals: {
29+
...globals.browser,
30+
}
31+
},
32+
plugins: {
33+
"@typescript-eslint": tseslintPlugin
34+
},
35+
rules: {
36+
...js.configs.recommended.rules,
37+
...tseslintPlugin.configs["eslint-recommended"].overrides[0].rules,
38+
...tseslintPlugin.configs["recommended"].rules,
39+
"@typescript-eslint/no-require-imports": "off",
40+
"@typescript-eslint/no-unused-vars": "warn",
41+
"prefer-const": "warn",
42+
}
43+
},
44+
{
45+
files: ["src/**/*.js"],
46+
languageOptions: {
47+
ecmaVersion: 2022,
48+
sourceType: "module",
49+
globals: {
50+
...globals.browser,
51+
...globals.amd
52+
}
53+
},
54+
rules: {
55+
...js.configs.recommended.rules,
56+
"no-undef": "warn"
57+
}
58+
},
59+
{
60+
files: ["server/**/*.js", "server/**/*.cjs"],
61+
languageOptions: {
62+
ecmaVersion: 2022,
63+
sourceType: "module",
64+
globals: {
65+
...globals.node,
66+
}
67+
},
68+
plugins: {
69+
n: nodePlugin
70+
},
71+
rules: {
72+
...js.configs.recommended.rules,
73+
...nodePlugin.configs["flat/recommended-script"].rules
74+
}
75+
}
76+
];

Diff for: templates/node-jet/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "An Oracle JavaScript Extension Toolkit(JET) web app",
55
"scripts": {
66
"dev": "concurrently --names server,client --prefix-colors blue,yellow --success all --kill-others 'node ./server/index.cjs' 'ojet serve --server-only'",
7-
"lint": "eslint src/ --max-warnings 0"
7+
"lint": "eslint --report-unused-disable-directives"
88
},
99
"dependencies": {
1010
"@oracle/oraclejet": "~17.1.0",
@@ -28,7 +28,10 @@
2828
"concurrently": "^9.1.2",
2929
"eslint": "^9.18.0",
3030
"@eslint/js": "^9.18.0",
31-
"typescript-eslint": "8.20.0"
31+
"eslint-plugin-n": "^17.15.1",
32+
"@typescript-eslint/eslint-plugin": "^8.21.0",
33+
"@typescript-eslint/parser": "^8.21.0",
34+
"globals": "15.14.0"
3235
},
3336
"engines": {
3437
"node": ">=16.0.0"

Diff for: templates/node-jet/src/components/content/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ async function updateDatabaseStatus() {
1717

1818
return 'Database is working!';
1919
} catch ( error ) {
20-
// eslint-disable-next-line no-console
2120
console.error( 'Error fetching connection status:', error );
2221
return 'Something is wrong with the database!';
2322
}

0 commit comments

Comments
 (0)