Skip to content

Commit 41a9438

Browse files
style: fix linting rules
1 parent 9212a81 commit 41a9438

7 files changed

Lines changed: 10 additions & 13 deletions

File tree

templates/node-react-todo/eslint.config.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export default [
3939
...reactPlugin.configs.flat.recommended.rules,
4040
...reactPlugin.configs.flat["jsx-runtime"].rules,
4141
...reactHooksPlugin.configs.recommended.rules,
42-
...reactRefreshPlugin.configs.vite.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"
4345
}
4446
},
4547
{

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)