Skip to content

Commit c9b5c0b

Browse files
committed
Removing rule exceptions from eslint and corresponding changes
1 parent d424245 commit c9b5c0b

File tree

12 files changed

+67
-25
lines changed

12 files changed

+67
-25
lines changed

.eslintrc.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ module.exports = {
2121
sourceType: 'module',
2222
},
2323
plugins: ['react', 'react-hooks', 'prettier'],
24-
rules: {
25-
'react/prop-types': 'off', // keeping off for first phase
26-
'no-unused-vars': 'off', // Getting a lot of Error for: '_' is assigned a value but never used no-unused-vars. For now disabling this because need to understand more about the use '_'.
27-
},
24+
rules: {},
2825
settings: {
2926
'import/resolver': {
3027
node: {

src/components/atoms/EditableTextItem.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { PropTypes } from 'prop-types';
23
import { EditText } from 'react-edit-text';
34
import 'react-edit-text/dist/index.css';
45

@@ -7,4 +8,9 @@ const EditableTextItem = ({ initialText }) => {
78
return <EditText name='editText' className='text-xl' defaultValue={initialText} placeholder={initialText} />;
89
};
910

11+
// https://legacy.reactjs.org/docs/typechecking-with-proptypes.html
12+
EditableTextItem.propTypes = {
13+
initialText: PropTypes.string.isRequired,
14+
};
15+
1016
export default EditableTextItem;

src/components/atoms/FlowTab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const FlowTab = () => {
1010
const activeTabStyles =
1111
'before:absolute before:h-[0.25rem] before:w-full before:bg-slate-300 before:content-[""] before:bottom-0 before:left-0';
1212
const tabCommonStyles =
13-
'tab flex items-center gap-x-2 border-r border-neutral-300 bg-transparent pr-0 tracking-wider transition duration-500 ease-in';
13+
'tab flex items-center gap-x-2 border-r border-neutral-300 bg-transparent pr-0 tracking-[0.15em] transition duration-500 ease-in text-sm';
1414
return (
1515
<div role='tablist' className='tabs tabs-lg'>
1616
{tabs.map((tab, index) => {

src/components/atoms/common/Button.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { PropTypes } from 'prop-types';
23

34
// ToDo: can be more generalized
45
const Button = ({ children, btnType, isDisabled, onClickHandle, fullWidth }) => {
@@ -32,4 +33,11 @@ const Button = ({ children, btnType, isDisabled, onClickHandle, fullWidth }) =>
3233
);
3334
};
3435

36+
Button.propTypes = {
37+
children: PropTypes.node.isRequired,
38+
btnType: PropTypes.string.isRequired,
39+
isDisabled: PropTypes.boolean.isRequired,
40+
onClickHandle: PropTypes.func,
41+
fullWidth: PropTypes.boolean,
42+
};
3543
export default Button;

src/components/molecules/modals/ImportCollectionModal.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Fragment, useRef } from 'react';
2+
import { PropTypes } from 'prop-types';
23
import { Dialog, Transition } from '@headlessui/react';
34
import { DocumentArrowUpIcon } from '@heroicons/react/24/outline';
45
import ImportCollectionTypes from 'constants/ImportCollectionTypes';
@@ -63,7 +64,7 @@ const ImportCollectionModal = ({ closeFn = () => null, open = false }) => {
6364
</Transition.Child>
6465

6566
<div className='fixed inset-0 overflow-y-auto'>
66-
<div className='flex items-center justify-center min-h-full p-4 text-center'>
67+
<div className='flex min-h-full items-center justify-center p-4 text-center'>
6768
<Transition.Child
6869
as={Fragment}
6970
enter='ease-out duration-300'
@@ -73,21 +74,21 @@ const ImportCollectionModal = ({ closeFn = () => null, open = false }) => {
7374
leaveFrom='opacity-100 scale-100'
7475
leaveTo='opacity-0 scale-95'
7576
>
76-
<Dialog.Panel className='w-full max-w-md p-6 overflow-hidden text-left align-middle transition-all transform bg-white shadow-xl rounded-2xl'>
77+
<Dialog.Panel className='w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all'>
7778
<Dialog.Title
7879
as='h3'
79-
className='pb-4 text-lg font-semibold text-center text-gray-900 border-b border-neutral-300'
80+
className='border-b border-neutral-300 pb-4 text-center text-lg font-semibold text-gray-900'
8081
>
8182
Collections
8283
</Dialog.Title>
8384
<div className='mt-4'>
8485
<ul className='text-sm font-medium'>
8586
<li
86-
className='flex items-center justify-start gap-2 p-2 border border-transparent rounded-md cursor-pointer hover:bg-slate-100'
87+
className='flex cursor-pointer items-center justify-start gap-2 rounded-md border border-transparent p-2 hover:bg-slate-100'
8788
onClick={handleImportCollectionClick}
8889
data-import-type='yaml'
8990
>
90-
<DocumentArrowUpIcon className='w-4 h-4' />
91+
<DocumentArrowUpIcon className='h-4 w-4' />
9192
Import a YAML file
9293
{/* Ref: https://stackoverflow.com/questions/37457128/react-open-file-browser-on-click-a-div */}
9394
<div className='hidden'>
@@ -134,4 +135,9 @@ const ImportCollectionModal = ({ closeFn = () => null, open = false }) => {
134135
);
135136
};
136137

138+
ImportCollectionModal.propTypes = {
139+
closeFn: PropTypes.func.isRequired,
140+
open: PropTypes.boolean.isRequired,
141+
};
142+
137143
export default ImportCollectionModal;

src/components/molecules/modals/create/NewCollectionModal.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Fragment } from 'react';
22
import { Dialog, Transition } from '@headlessui/react';
33
import Button from 'components/atoms/common/Button';
44
import { BUTTON_TYPES } from 'constants/Common';
5+
import { PropTypes } from 'prop-types';
56

67
const NewCollectionModal = ({ closeFn = () => null, open = false }) => {
78
// ToDo: Save the file with the given file name
@@ -25,7 +26,7 @@ const NewCollectionModal = ({ closeFn = () => null, open = false }) => {
2526
</Transition.Child>
2627

2728
<div className='fixed inset-0 overflow-y-auto'>
28-
<div className='flex items-center justify-center min-h-full p-4 text-center'>
29+
<div className='flex min-h-full items-center justify-center p-4 text-center'>
2930
<Transition.Child
3031
as={Fragment}
3132
enter='ease-out duration-300'
@@ -35,22 +36,22 @@ const NewCollectionModal = ({ closeFn = () => null, open = false }) => {
3536
leaveFrom='opacity-100 scale-100'
3637
leaveTo='opacity-0 scale-95'
3738
>
38-
<Dialog.Panel className='w-full max-w-md p-6 overflow-hidden text-left align-middle transition-all transform bg-white shadow-xl rounded-2xl'>
39+
<Dialog.Panel className='w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all'>
3940
<Dialog.Title
4041
as='h3'
41-
className='pb-4 text-lg font-semibold text-center text-gray-900 border-b border-neutral-300'
42+
className='border-b border-neutral-300 pb-4 text-center text-lg font-semibold text-gray-900'
4243
>
4344
Create a new collection
4445
</Dialog.Title>
4546
<div className='mt-6'>
4647
<input
4748
type='text'
48-
className='w-full rounded input input-bordered'
49+
className='input input-bordered w-full rounded'
4950
placeholder='Collection name'
5051
required
5152
/>
5253
</div>
53-
<div className='flex items-center gap-2 mt-6'>
54+
<div className='mt-6 flex items-center gap-2'>
5455
<Button btnType={BUTTON_TYPES.error} isDisabled={false} onClickHandle={closeFn} fullWidth={true}>
5556
Cancel
5657
</Button>
@@ -67,4 +68,9 @@ const NewCollectionModal = ({ closeFn = () => null, open = false }) => {
6768
);
6869
};
6970

71+
NewCollectionModal.propTypes = {
72+
closeFn: PropTypes.func.isRequired,
73+
open: PropTypes.boolean.isRequired,
74+
};
75+
7076
export default NewCollectionModal;

src/components/molecules/modals/workspaceDirectory/NewLabelModal.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Fragment, useState } from 'react';
2+
import { PropTypes } from 'prop-types';
23
import { Dialog, Transition } from '@headlessui/react';
34
import { createFolder, createFlowTest } from 'service/collection';
45

@@ -94,4 +95,12 @@ const NewLabelModal = ({ closeFn = () => null, open = false, pathName, collectio
9495
);
9596
};
9697

98+
NewLabelModal.propTypes = {
99+
closeFn: PropTypes.func.isRequired,
100+
open: PropTypes.boolean.isRequired,
101+
pathName: PropTypes.string.isRequired,
102+
collectionId: PropTypes.string.isRequired,
103+
menuOption: PropTypes.string.isRequired,
104+
};
105+
97106
export default NewLabelModal;

src/components/molecules/workspaceDirectory/Directories.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from 'react';
2+
import { PropTypes } from 'prop-types';
23
import Directory from 'components/molecules/workspaceDirectory/Directory';
34
import { DirectoryOptionsActions } from 'constants/WorkspaceDirectory';
45
import NewLabelModal from '../modals/workspaceDirectory/NewLabelModal';
@@ -82,4 +83,8 @@ const Directories = ({ directoriesData }) => {
8283
);
8384
};
8485

86+
Directories.propTypes = {
87+
directoriesData: PropTypes.object.isRequired,
88+
};
89+
8590
export default Directories;

src/components/molecules/workspaceDirectory/Directory.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from 'react';
2+
import { PropTypes } from 'prop-types';
23
import { FLOW_FILE_SUFFIX_REGEX } from 'constants/Common';
34
import { ArchiveBoxIcon, FolderIcon, DocumentIcon } from '@heroicons/react/24/outline';
45
import OptionsMenu from './OptionsMenu';
@@ -103,4 +104,9 @@ const Directory = ({ directory, depth }) => {
103104
);
104105
};
105106

107+
Directory.propTypes = {
108+
directory: PropTypes.object.isRequired,
109+
depth: PropTypes.number.isRequired,
110+
};
111+
106112
export default Directory;

src/components/molecules/workspaceDirectory/OptionsMenu.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { PropTypes } from 'prop-types';
23
import { Menu, Transition } from '@headlessui/react';
34
import { Fragment } from 'react';
45
import { FolderPlusIcon, PencilSquareIcon, TrashIcon } from '@heroicons/react/24/outline';
@@ -96,4 +97,9 @@ const OptionsMenu = ({ directory, itemType }) => {
9697
);
9798
};
9899

100+
OptionsMenu.propTypes = {
101+
directory: PropTypes.object.isRequired,
102+
itemType: PropTypes.string.isRequired,
103+
};
104+
99105
export default OptionsMenu;

0 commit comments

Comments
 (0)