Skip to content

Commit fe770e6

Browse files
authored
Merge pull request #201 from oracle/bump-react-todo-19.0
bump node-react-todo template to react v19.0 and eslint v9
2 parents ce16d2c + 41a9438 commit fe770e6

File tree

10 files changed

+91
-91
lines changed

10 files changed

+91
-91
lines changed

templates/node-react-todo/.eslintrc.cjs

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
**
3+
** Copyright (c) 2024, Oracle and/or its affiliates.
4+
** All rights reserved
5+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6+
*/
7+
import globals from "globals";
8+
import js from "@eslint/js";
9+
import nodePlugin from "eslint-plugin-n";
10+
import reactPlugin from "eslint-plugin-react";
11+
import reactHooksPlugin from "eslint-plugin-react-hooks";
12+
import reactRefreshPlugin from "eslint-plugin-react-refresh";
13+
14+
export default [
15+
{
16+
files: ["src/**/*.js","src/**/*.jsx"],
17+
languageOptions: {
18+
ecmaVersion: 2022,
19+
sourceType: "module",
20+
parserOptions: {
21+
ecmaFeatures: {
22+
jsx: true
23+
}
24+
},
25+
globals: {
26+
...globals.browser,
27+
}
28+
},
29+
plugins: {
30+
react: reactPlugin,
31+
"react-hooks": reactHooksPlugin,
32+
"react-refresh": reactRefreshPlugin
33+
},
34+
settings: {
35+
react: { version: 'detect' }
36+
},
37+
rules: {
38+
...js.configs.recommended.rules,
39+
...reactPlugin.configs.flat.recommended.rules,
40+
...reactPlugin.configs.flat["jsx-runtime"].rules,
41+
...reactHooksPlugin.configs.recommended.rules,
42+
...reactRefreshPlugin.configs.vite.rules,
43+
// The rule recommends migrating to TS or using propTypes (deprecated in React v15.5.0 https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops)
44+
"react/prop-types": "off"
45+
}
46+
},
47+
{
48+
files: ["server/**/*.js", "server/**/*.cjs"],
49+
languageOptions: {
50+
ecmaVersion: 2022,
51+
sourceType: "module",
52+
globals: {
53+
...globals.node,
54+
}
55+
},
56+
plugins: {
57+
n: nodePlugin
58+
},
59+
rules: {
60+
...js.configs.recommended.rules,
61+
...nodePlugin.configs["flat/recommended-script"].rules
62+
}
63+
}
64+
];

templates/node-react-todo/eslintrc.cjs

Lines changed: 0 additions & 20 deletions
This file was deleted.

templates/node-react-todo/package.json

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,32 @@
55
"scripts": {
66
"dev": "concurrently --names server,client --prefix-colors blue,yellow --success all --kill-others 'node ./server/index.cjs' 'vite'",
77
"build": "vite build",
8-
"lint": "eslint . --ext js,jsx --report-unused-disable-directives",
8+
"lint": "eslint --report-unused-disable-directives",
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"body-parser": "^1.20.2",
12+
"body-parser": "^1.20.3",
1313
"cors": "^2.8.5",
14-
"dotenv": "^16.3.1",
15-
"express": "^4.18.2",
14+
"dotenv": "^16.4.7",
15+
"express": "^4.21.2",
1616
"morgan": "^1.10.0",
17-
"oracledb": "^6.2.0",
18-
"react": "^18.2.0",
19-
"react-dom": "^18.2.0",
20-
"react-toastify": "^9.1.3"
17+
"oracledb": "^6.7.1",
18+
"react": "^19.0.0",
19+
"react-dom": "^19.0.0",
20+
"react-toastify": "^11.0.3"
2121
},
2222
"devDependencies": {
23-
"@types/react": "^18.2.43",
24-
"@types/react-dom": "^18.2.17",
25-
"@vitejs/plugin-react": "^4.2.1",
26-
"concurrently": "^8.2.2",
27-
"eslint": "^8.55.0",
28-
"eslint-plugin-node": "^11.1.0",
29-
"eslint-plugin-react": "^7.34.0",
30-
"eslint-plugin-react-hooks": "^4.6.0",
31-
"eslint-plugin-react-refresh": "^0.4.5",
32-
"vite": "^5.0.8"
23+
"@types/react": "^19.0.7",
24+
"@types/react-dom": "^19.0.3",
25+
"@vitejs/plugin-react": "^4.3.4",
26+
"concurrently": "^9.1.2",
27+
"eslint": "^9.18.0",
28+
"@eslint/js": "^9.18.0",
29+
"eslint-plugin-n": "^17.15.1",
30+
"eslint-plugin-react": "^7.37.4",
31+
"eslint-plugin-react-hooks": "^5.1.0",
32+
"eslint-plugin-react-refresh": "^0.4.18",
33+
"globals": "15.14.0",
34+
"vite": "^6.0.7"
3335
}
3436
}

templates/node-react-todo/src/components/ToDoListFilter.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
import { toast } from 'react-toastify';
31
import completed from '../images/completed.png'
42
import uncompleted from '../images/uncompleted.png'
53
import all from '../images/all.png'

templates/node-react-todo/src/components/ToDoListInput.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
** All rights reserved
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
*/
7-
import React from 'react';
87
import { toast } from 'react-toastify';
98

109
import { createTask, updateTask } from '../api/rest-service.js';

templates/node-react-todo/src/components/TodoList.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
** All rights reserved
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
*/
7-
import React, { useState, useEffect } from 'react';
7+
import { useState, useEffect } from 'react';
88
import { ToastContainer, toast } from 'react-toastify';
99
import 'react-toastify/dist/ReactToastify.css';
1010
import './style.css';
11-
import { convertCharsToBooleans, convertBooleansToChars } from '../utils/utils';
12-
import { getTasks, createTask, updateTask, deleteTask } from '../api/rest-service';
11+
import { convertCharsToBooleans } from '../utils/utils';
12+
import { getTasks } from '../api/rest-service';
1313
import { TodoListInput } from './ToDoListInput';
1414
import { TodoListFilter } from './ToDoListFilter';
1515
import { TodoListItems } from './TodoListItems';

templates/node-react-todo/src/components/TodoListFooter.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
** All rights reserved
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
*/
7-
import React from 'react';
87
import { toast } from 'react-toastify';
98

109
import { updateTask, deleteTask } from '../api/rest-service';

templates/node-react-todo/src/components/TodoListItems.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
** All rights reserved
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
*/
7-
import React from 'react';
87
import { toast } from 'react-toastify';
98

109
import { updateTask, deleteTask } from '../api/rest-service';

templates/node-react-todo/src/utils/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const convertBooleansToChars = (data) => {
99
return data.map(item => {
1010
const convertedItem = {};
1111
for (const key in item) {
12-
if (item.hasOwnProperty(key) && typeof item[key] === 'boolean') {
12+
if (Object.prototype.hasOwnProperty.call(item, key) && typeof item[key] === 'boolean') {
1313
if (typeof item[key] === 'boolean') {
1414
convertedItem[key] = item[key] === true ? 'Y' : 'N';
1515
} else {
@@ -22,7 +22,7 @@ export const convertBooleansToChars = (data) => {
2222
} else {
2323
const convertedItem = {};
2424
for (const key in data) {
25-
if (data.hasOwnProperty(key)) {
25+
if (Object.prototype.hasOwnProperty.call(data, key)) {
2626
if (typeof data[key] === 'boolean') {
2727
convertedItem[key] = data[key] === true ? 'Y' : 'N';
2828
} else {
@@ -41,7 +41,7 @@ export const convertCharsToBooleans = (data) => {
4141
return data.map(item => {
4242
const convertedItem = {};
4343
for (const key in item) {
44-
if (item.hasOwnProperty(key)) {
44+
if (Object.prototype.hasOwnProperty.call(item, key)) {
4545
if (item[key] === 'Y') convertedItem[key] = true;
4646
else if (item[key] === 'N') convertedItem[key] = false;
4747
else convertedItem[key] = item[key];
@@ -54,7 +54,7 @@ export const convertCharsToBooleans = (data) => {
5454
else {
5555
const convertedItem = {};
5656
for (const key in data) {
57-
if (data.hasOwnProperty(key)) {
57+
if (Object.prototype.hasOwnProperty.call(data, key)) {
5858
if (data[key] === 'Y') convertedItem[key] = true;
5959
else if (data[key] === 'N') convertedItem[key] = false;
6060
else convertedItem[key] = data[key];

0 commit comments

Comments
 (0)