Skip to content

Commit dff0f86

Browse files
authored
update eslint | fix lint errors (#715)
1 parent 39f8840 commit dff0f86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+402
-361
lines changed

.eslintrc.js

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
module.exports = {
2-
parser: 'babel-eslint',
3-
extends: ['airbnb', 'plugin:jsx-a11y/recommended'],
4-
plugins: ['jest', 'react-hooks', 'jsx-a11y'],
5-
rules: {
6-
'max-len': 0,
7-
'react/forbid-prop-types': 0,
8-
'import/no-extraneous-dependencies': 0,
9-
'no-confusing-arrow': ['error', {'allowParens': true}],
10-
'arrow-parens': ['error', 'as-needed'],
11-
'react/jsx-filename-extension': [1, { 'extensions': ['.js', '.jsx'] }],
12-
'import/prefer-default-export': 0,
13-
'object-curly-newline': ['error', { 'consistent': true }],
14-
'implicit-arrow-linebreak': 0,
15-
'operator-linebreak': 0,
16-
'linebreak-style': 0,
17-
'arrow-body-style': 0,
18-
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
19-
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
20-
'react/jsx-props-no-spreading': 0
2+
parser: 'babel-eslint',
3+
extends: ['airbnb', 'plugin:jsx-a11y/recommended'],
4+
plugins: ['jest', 'react-hooks', 'jsx-a11y'],
5+
rules: {
6+
'max-len': 0,
7+
'react/forbid-prop-types': 0,
8+
'import/no-extraneous-dependencies': 0,
9+
'no-confusing-arrow': ['error', { allowParens: true }],
10+
'arrow-parens': ['error', 'as-needed'],
11+
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
12+
'import/prefer-default-export': 0,
13+
'object-curly-newline': ['error', { consistent: true }],
14+
'implicit-arrow-linebreak': 0,
15+
'operator-linebreak': 0,
16+
'linebreak-style': 0,
17+
'arrow-body-style': 0,
18+
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
19+
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
20+
'react/jsx-props-no-spreading': 0,
21+
},
22+
env: {
23+
'jest/globals': true,
24+
browser: true,
25+
},
26+
settings: {
27+
'import/resolver': {
28+
'babel-module': {},
2129
},
22-
env: {
23-
'jest/globals': true,
24-
'browser': true
30+
},
31+
overrides: [
32+
{
33+
files: ['**/*.ts', '**/*.tsx'],
34+
env: { browser: true, es6: true, node: true },
35+
extends: [
36+
'eslint:recommended',
37+
'plugin:react/recommended',
38+
'plugin:@typescript-eslint/eslint-recommended',
39+
'plugin:@typescript-eslint/recommended',
40+
],
41+
globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
42+
parser: '@typescript-eslint/parser',
43+
parserOptions: {
44+
ecmaFeatures: { jsx: true },
45+
ecmaVersion: 2018,
46+
sourceType: 'module',
47+
},
48+
plugins: ['react', '@typescript-eslint'],
49+
rules: {
50+
indent: ['error', 2, { SwitchCase: 1 }],
51+
'linebreak-style': ['error', 'unix'],
52+
quotes: ['error', 'single'],
53+
'comma-dangle': ['error', 'always-multiline'],
54+
'@typescript-eslint/no-explicit-any': 0,
55+
'@typescript-eslint/interface-name-prefix': 0,
56+
},
57+
settings: { react: { version: 'detect' } },
2558
},
26-
settings: {
27-
'import/resolver': {
28-
'babel-module': {}
29-
}
30-
},
31-
overrides: [
32-
{
33-
files: ['**/*.ts', '**/*.tsx'],
34-
env: { 'browser': true, 'es6': true, 'node': true },
35-
extends: [
36-
'eslint:recommended',
37-
'plugin:react/recommended',
38-
'plugin:@typescript-eslint/eslint-recommended',
39-
'plugin:@typescript-eslint/recommended'
40-
],
41-
globals: { 'Atomics': 'readonly', 'SharedArrayBuffer': 'readonly' },
42-
parser: '@typescript-eslint/parser',
43-
parserOptions: {
44-
ecmaFeatures: { 'jsx': true },
45-
ecmaVersion: 2018,
46-
sourceType: 'module',
47-
},
48-
plugins: ['react', '@typescript-eslint'],
49-
rules: {
50-
indent: ['error', 2, { 'SwitchCase': 1 }],
51-
'linebreak-style': ['error', 'unix'],
52-
quotes: ['error', 'single'],
53-
'comma-dangle': ['error', 'always-multiline'],
54-
'@typescript-eslint/no-explicit-any': 0,
55-
'@typescript-eslint/interface-name-prefix': 0,
56-
},
57-
settings: { 'react': { 'version': 'detect' } }
58-
}
59-
]
60-
}
59+
],
60+
};

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ dist: trusty
33
language: node_js
44

55
node_js:
6-
- "14"
6+
- 14
77

88
cache:
99
yarn: true

index.d.ts

Lines changed: 102 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,9 @@
11
import * as React from 'react';
22
import { CSSProperties } from 'styled-components';
33

4-
export interface IDataTableProps<T = any> {
5-
title?: React.ReactNode;
6-
columns: IDataTableColumn<T>[];
7-
data: T[];
8-
keyField?: string;
9-
striped?: boolean;
10-
highlightOnHover?: boolean;
11-
pointerOnHover?: boolean;
12-
noDataComponent?: React.ReactNode;
13-
className?: string;
14-
style?: CSSProperties;
15-
responsive?: boolean;
16-
disabled?: boolean;
17-
onRowClicked?: (row: T, e: MouseEvent) => void;
18-
onRowDoubleClicked?: (row: T, e: MouseEvent) => void;
19-
overflowY?: boolean;
20-
overflowYOffset?: string;
21-
dense?: boolean;
22-
noTableHead?: boolean;
23-
defaultSortField?: string;
24-
defaultSortAsc?: boolean;
25-
sortIcon?: React.ReactNode;
26-
onSort?: (
27-
column: IDataTableColumn<T>,
28-
sortDirection: 'asc' | 'desc'
29-
) => void;
30-
sortFunction?: (
31-
rows: T[],
32-
field: string,
33-
sortDirection: 'asc' | 'desc'
34-
) => T[];
35-
sortServer?: boolean;
36-
pagination?: boolean;
37-
paginationServer?: boolean;
38-
paginationServerOptions?: {
39-
persistSelectedOnSort?: boolean;
40-
persistSelectedOnPageChange?: boolean;
41-
};
42-
paginationDefaultPage?: number;
43-
paginationResetDefaultPage?: boolean;
44-
paginationTotalRows?: number;
45-
paginationPerPage?: number;
46-
paginationRowsPerPageOptions?: number[];
47-
paginationComponentOptions?: IDataTablePaginationOptions;
48-
onChangeRowsPerPage?: (
49-
currentRowsPerPage: number,
50-
currentPage: number
51-
) => void;
52-
onChangePage?: (page: number, totalRows: number) => void;
53-
paginationComponent?: React.ReactNode;
54-
paginationIconFirstPage?: React.ReactNode;
55-
paginationIconLastPage?: React.ReactNode;
56-
paginationIconNext?: React.ReactNode;
57-
paginationIconPrevious?: React.ReactNode;
58-
progressPending?: boolean;
59-
persistTableHead?: boolean;
60-
progressComponent?: React.ReactNode;
61-
expandableRows?: boolean;
62-
expandableRowsComponent?: React.ReactNode;
63-
expandOnRowClicked?: boolean;
64-
expandOnRowDoubleClicked?: boolean;
65-
expandableRowsHideExpander?: boolean;
66-
onRowExpandToggled?: (expanded: boolean, row: T) => void;
67-
expandableRowExpanded?: (row: T) => boolean;
68-
expandableRowDisabled?: (row: T) => boolean;
69-
expandableIcon?: IExpandableIcon;
70-
expandableInheritConditionalStyles?: boolean;
71-
selectableRows?: boolean;
72-
selectableRowsComponent?: React.ReactNode;
73-
selectableRowsComponentProps?: {};
74-
selectableRowsHighlight?: boolean;
75-
selectableRowsVisibleOnly?: boolean;
76-
selectableRowSelected?: (row: T) => boolean;
77-
selectableRowDisabled?: (row: T) => boolean;
78-
selectableRowsNoSelectAll?: boolean;
79-
clearSelectedRows?: boolean;
80-
onSelectedRowsChange?: (selectedRowState: {
81-
allSelected: boolean;
82-
selectedCount: number;
83-
selectedRows: T[];
84-
}) => void;
85-
actions?: React.ReactNode | React.ReactNode[];
86-
noContextMenu?: boolean;
87-
contextMessage?: IContextMessage;
88-
contextActions?: React.ReactNode | React.ReactNode[];
89-
contextComponent?: React.ReactNode;
90-
noHeader?: boolean;
91-
fixedHeader?: boolean;
92-
fixedHeaderScrollHeight?: string;
93-
subHeader?: React.ReactNode | React.ReactNode[];
94-
subHeaderAlign?: string;
95-
subHeaderWrap?: boolean;
96-
subHeaderComponent?: React.ReactNode | React.ReactNode[];
97-
customStyles?: IDataTableStyles;
98-
theme?: string;
99-
conditionalRowStyles?: IDataTableConditionalRowStyles<T>[];
100-
direction?: 'ltr' | 'rtl' | 'auto';
4+
export interface IDataTableConditionalCellStyles<T = any> {
5+
when: (row: T) => boolean;
6+
style: CSSProperties;
1017
}
1028

1039
export interface IDataTableColumn<T = any> {
@@ -185,11 +91,6 @@ export interface IDataTableStyles {
18591
};
18692
}
18793

188-
export interface IDataTableConditionalCellStyles<T = any> {
189-
when: (row: T) => boolean;
190-
style: CSSProperties;
191-
}
192-
19394
export interface IDataTableConditionalRowStyles<T = any> {
19495
when: (row: T) => boolean;
19596
style: CSSProperties;
@@ -214,6 +115,105 @@ export interface IContextMessage {
214115
message: string;
215116
}
216117

118+
export interface IDataTableProps<T = any> {
119+
title?: React.ReactNode;
120+
columns: IDataTableColumn<T>[];
121+
data: T[];
122+
keyField?: string;
123+
striped?: boolean;
124+
highlightOnHover?: boolean;
125+
pointerOnHover?: boolean;
126+
noDataComponent?: React.ReactNode;
127+
className?: string;
128+
style?: CSSProperties;
129+
responsive?: boolean;
130+
disabled?: boolean;
131+
onRowClicked?: (row: T, e: MouseEvent) => void;
132+
onRowDoubleClicked?: (row: T, e: MouseEvent) => void;
133+
overflowY?: boolean;
134+
overflowYOffset?: string;
135+
dense?: boolean;
136+
noTableHead?: boolean;
137+
defaultSortField?: string;
138+
defaultSortAsc?: boolean;
139+
sortIcon?: React.ReactNode;
140+
onSort?: (
141+
column: IDataTableColumn<T>,
142+
sortDirection: 'asc' | 'desc'
143+
) => void;
144+
sortFunction?: (
145+
rows: T[],
146+
field: string,
147+
sortDirection: 'asc' | 'desc'
148+
) => T[];
149+
sortServer?: boolean;
150+
pagination?: boolean;
151+
paginationServer?: boolean;
152+
paginationServerOptions?: {
153+
persistSelectedOnSort?: boolean;
154+
persistSelectedOnPageChange?: boolean;
155+
};
156+
paginationDefaultPage?: number;
157+
paginationResetDefaultPage?: boolean;
158+
paginationTotalRows?: number;
159+
paginationPerPage?: number;
160+
paginationRowsPerPageOptions?: number[];
161+
paginationComponentOptions?: IDataTablePaginationOptions;
162+
onChangeRowsPerPage?: (
163+
currentRowsPerPage: number,
164+
currentPage: number
165+
) => void;
166+
onChangePage?: (page: number, totalRows: number) => void;
167+
paginationComponent?: React.ReactNode;
168+
paginationIconFirstPage?: React.ReactNode;
169+
paginationIconLastPage?: React.ReactNode;
170+
paginationIconNext?: React.ReactNode;
171+
paginationIconPrevious?: React.ReactNode;
172+
progressPending?: boolean;
173+
persistTableHead?: boolean;
174+
progressComponent?: React.ReactNode;
175+
expandableRows?: boolean;
176+
expandableRowsComponent?: React.ReactNode;
177+
expandOnRowClicked?: boolean;
178+
expandOnRowDoubleClicked?: boolean;
179+
expandableRowsHideExpander?: boolean;
180+
onRowExpandToggled?: (expanded: boolean, row: T) => void;
181+
expandableRowExpanded?: (row: T) => boolean;
182+
expandableRowDisabled?: (row: T) => boolean;
183+
expandableIcon?: IExpandableIcon;
184+
expandableInheritConditionalStyles?: boolean;
185+
selectableRows?: boolean;
186+
selectableRowsComponent?: React.ReactNode;
187+
selectableRowsComponentProps?: any;
188+
selectableRowsHighlight?: boolean;
189+
selectableRowsVisibleOnly?: boolean;
190+
selectableRowSelected?: (row: T) => boolean;
191+
selectableRowDisabled?: (row: T) => boolean;
192+
selectableRowsNoSelectAll?: boolean;
193+
clearSelectedRows?: boolean;
194+
onSelectedRowsChange?: (selectedRowState: {
195+
allSelected: boolean;
196+
selectedCount: number;
197+
selectedRows: T[];
198+
}) => void;
199+
actions?: React.ReactNode | React.ReactNode[];
200+
noContextMenu?: boolean;
201+
contextMessage?: IContextMessage;
202+
contextActions?: React.ReactNode | React.ReactNode[];
203+
contextComponent?: React.ReactNode;
204+
noHeader?: boolean;
205+
fixedHeader?: boolean;
206+
fixedHeaderScrollHeight?: string;
207+
subHeader?: React.ReactNode | React.ReactNode[];
208+
subHeaderAlign?: string;
209+
subHeaderWrap?: boolean;
210+
subHeaderComponent?: React.ReactNode | React.ReactNode[];
211+
customStyles?: IDataTableStyles;
212+
theme?: string;
213+
conditionalRowStyles?: IDataTableConditionalRowStyles<T>[];
214+
direction?: 'ltr' | 'rtl' | 'auto';
215+
}
216+
217217
export interface ITheme {
218218
text: {
219219
primary: string;

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"@storybook/addon-storysource": "^6.0.27",
6666
"@storybook/react": "^6.0.27",
6767
"@testing-library/react": "^10.0.4",
68-
"@typescript-eslint/eslint-plugin": "^2.30.0",
69-
"@typescript-eslint/parser": "^2.30.0",
68+
"@typescript-eslint/eslint-plugin": "^4.7.0",
69+
"@typescript-eslint/parser": "^4.7.0",
7070
"axios": "^0.19.2",
7171
"babel-eslint": "^10.1.0",
7272
"babel-jest": "^25.5.1",
@@ -75,15 +75,15 @@
7575
"babel-plugin-styled-components": "^1.11.1",
7676
"codecov": "^3.6.5",
7777
"cross-env": "^7.0.2",
78-
"eslint": "^6.8.0",
79-
"eslint-config-airbnb": "^18.1.0",
80-
"eslint-config-react-app": "^5.2.1",
81-
"eslint-import-resolver-babel-module": "^5.1.2",
82-
"eslint-plugin-import": "^2.20.2",
83-
"eslint-plugin-jest": "^23.8.2",
84-
"eslint-plugin-jsx-a11y": "^6.2.3",
85-
"eslint-plugin-react": "^7.19.0",
86-
"eslint-plugin-react-hooks": "^3.0.0",
78+
"eslint": "^7.13.0",
79+
"eslint-config-airbnb": "^18.2.1",
80+
"eslint-config-react-app": "^6.0.0",
81+
"eslint-import-resolver-babel-module": "^5.2.0",
82+
"eslint-plugin-import": "^2.22.1",
83+
"eslint-plugin-jest": "^24.1.0",
84+
"eslint-plugin-jsx-a11y": "^6.4.1",
85+
"eslint-plugin-react": "^7.21.5",
86+
"eslint-plugin-react-hooks": "^4.2.0",
8787
"faker": "^4.1.0",
8888
"jest": "^25.5.3",
8989
"jest-styled-components": "^7.0.2",

src/DataTable/TableCol.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const ColumnSortable = styled.div`
4848
}
4949
`;
5050

51-
5251
const TableCol = memo(({
5352
column,
5453
sortIcon,

0 commit comments

Comments
 (0)