Skip to content

Commit 9494c7b

Browse files
committed
fix
Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
1 parent c9c60db commit 9494c7b

10 files changed

Lines changed: 186 additions & 102 deletions

File tree

.eslintrc

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

eslint.config.js

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
const reactPlugin = require('eslint-plugin-react');
2+
const reactHooksPlugin = require('eslint-plugin-react-hooks');
3+
const jsxA11yPlugin = require('eslint-plugin-jsx-a11y');
4+
const importPlugin = require('eslint-plugin-import');
5+
const filenamesPlugin = require('eslint-plugin-filenames');
6+
7+
const browserGlobals = {
8+
window: 'readonly',
9+
document: 'readonly',
10+
navigator: 'readonly',
11+
location: 'readonly',
12+
history: 'readonly',
13+
self: 'readonly',
14+
globalThis: 'readonly',
15+
console: 'readonly',
16+
alert: 'readonly',
17+
confirm: 'readonly',
18+
prompt: 'readonly',
19+
setTimeout: 'readonly',
20+
setInterval: 'readonly',
21+
clearTimeout: 'readonly',
22+
clearInterval: 'readonly',
23+
requestAnimationFrame: 'readonly',
24+
cancelAnimationFrame: 'readonly',
25+
fetch: 'readonly',
26+
XMLHttpRequest: 'readonly',
27+
localStorage: 'readonly',
28+
sessionStorage: 'readonly',
29+
URL: 'readonly',
30+
URLSearchParams: 'readonly',
31+
Blob: 'readonly',
32+
File: 'readonly',
33+
FileReader: 'readonly',
34+
FormData: 'readonly',
35+
event: 'readonly',
36+
Event: 'readonly',
37+
EventTarget: 'readonly',
38+
CustomEvent: 'readonly',
39+
MouseEvent: 'readonly',
40+
KeyboardEvent: 'readonly',
41+
HTMLElement: 'readonly',
42+
HTMLInputElement: 'readonly',
43+
HTMLSelectElement: 'readonly',
44+
Element: 'readonly',
45+
Node: 'readonly',
46+
MutationObserver: 'readonly',
47+
IntersectionObserver: 'readonly',
48+
ResizeObserver: 'readonly',
49+
Worker: 'readonly',
50+
CSS: 'readonly',
51+
performance: 'readonly',
52+
crypto: 'readonly',
53+
atob: 'readonly',
54+
btoa: 'readonly',
55+
getComputedStyle: 'readonly',
56+
};
57+
58+
const nodeGlobals = {
59+
process: 'readonly',
60+
require: 'readonly',
61+
module: 'writable',
62+
exports: 'writable',
63+
__dirname: 'readonly',
64+
__filename: 'readonly',
65+
global: 'readonly',
66+
Buffer: 'readonly',
67+
setImmediate: 'readonly',
68+
clearImmediate: 'readonly',
69+
queueMicrotask: 'readonly',
70+
};
71+
72+
const es6Globals = {
73+
Promise: 'readonly',
74+
Symbol: 'readonly',
75+
Map: 'readonly',
76+
Set: 'readonly',
77+
WeakMap: 'readonly',
78+
WeakSet: 'readonly',
79+
WeakRef: 'readonly',
80+
Proxy: 'readonly',
81+
Reflect: 'readonly',
82+
ArrayBuffer: 'readonly',
83+
DataView: 'readonly',
84+
SharedArrayBuffer: 'readonly',
85+
Atomics: 'readonly',
86+
BigInt: 'readonly',
87+
Int8Array: 'readonly',
88+
Uint8Array: 'readonly',
89+
Uint8ClampedArray: 'readonly',
90+
Int16Array: 'readonly',
91+
Uint16Array: 'readonly',
92+
Int32Array: 'readonly',
93+
Uint32Array: 'readonly',
94+
Float32Array: 'readonly',
95+
Float64Array: 'readonly',
96+
BigInt64Array: 'readonly',
97+
BigUint64Array: 'readonly',
98+
};
99+
100+
const mochaGlobals = {
101+
describe: 'readonly',
102+
it: 'readonly',
103+
before: 'readonly',
104+
after: 'readonly',
105+
beforeEach: 'readonly',
106+
afterEach: 'readonly',
107+
context: 'readonly',
108+
specify: 'readonly',
109+
suite: 'readonly',
110+
test: 'readonly',
111+
suiteSetup: 'readonly',
112+
suiteTeardown: 'readonly',
113+
setup: 'readonly',
114+
teardown: 'readonly',
115+
run: 'readonly',
116+
mocha: 'readonly',
117+
};
118+
119+
module.exports = [
120+
{
121+
files: ['**/*.js', '**/*.jsx'],
122+
plugins: {
123+
react: reactPlugin,
124+
'react-hooks': reactHooksPlugin,
125+
'jsx-a11y': jsxA11yPlugin,
126+
import: importPlugin,
127+
filenames: filenamesPlugin,
128+
},
129+
languageOptions: {
130+
ecmaVersion: 2022,
131+
sourceType: 'module',
132+
parserOptions: {
133+
allowImportExportEverywhere: true,
134+
ecmaFeatures: {
135+
jsx: true,
136+
},
137+
},
138+
globals: {
139+
...browserGlobals,
140+
...nodeGlobals,
141+
...es6Globals,
142+
...mochaGlobals,
143+
},
144+
},
145+
settings: {
146+
react: {
147+
version: 'detect',
148+
},
149+
'import/extensions': ['.js'],
150+
'import/resolver': {
151+
node: {
152+
extensions: ['.js'],
153+
},
154+
webpack: {
155+
config: 'webpack.config.js',
156+
},
157+
},
158+
},
159+
rules: {
160+
...jsxA11yPlugin.flatConfigs.recommended.rules,
161+
'jsx-a11y/no-autofocus': [2, { ignoreNonDOM: true }],
162+
'no-console': 'off',
163+
semi: 2,
164+
'no-undef': 2,
165+
'no-undef-init': 2,
166+
'no-tabs': 2,
167+
'react/self-closing-comp': 2,
168+
'react/jsx-no-duplicate-props': 'warn',
169+
'react-hooks/rules-of-hooks': 'error',
170+
'react-hooks/exhaustive-deps': 'warn',
171+
},
172+
},
173+
];

examples/Router/ExamplesGrid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class ExamplesGrid extends React.Component {
3535

3636
state = {
3737
searchVal: ''
38-
}
38+
};
3939

4040
setSearchVal = (val) => {
4141
this.setState({
4242
searchVal: val
4343
});
44-
}
44+
};
4545

4646
render() {
4747
const {classes} = this.props;

examples/column-options-update/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,22 @@ class Example extends React.Component {
4646
["Gabby Strickland", "Business Process Consultant", "Scottsdale", 26, 45000],
4747
["Mason Ray", "Computer Scientist", "San Francisco", 39, 142000]
4848
]
49-
}
49+
};
5050

5151
handleFilterNameChange = (event) => {
5252
let string = prompt("Write a semicolon-separated string to change filter names in the first column!");
5353
if (string) this.setState({ filterOptions: string.split(';') });
54-
}
54+
};
5555

5656
handleAddData = (event) => {
5757
const string = prompt("Write a semicolon-separated string with values for 'Name', 'Title', 'Location', 'Age' and 'Salary' to add a new row of data!");
5858
if (string) this.setState({ data: [string.split(';'), ...this.state.data] });
59-
}
59+
};
6060

6161
handleChangeDisplay = (event) => {
6262
const string = prompt("Write a semicolon-separated string of display options for each of the 5 columns. Options are either 'true', 'false', or 'excluded'");
6363
if (string) this.setState({ display: string.split(';') });
64-
}
64+
};
6565

6666
render() {
6767
const { data, filterList, filterOptions } = this.state;

examples/customize-toolbar/CustomToolbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CustomToolbar extends React.Component {
1111

1212
handleClick = () => {
1313
console.log("clicked on icon!");
14-
}
14+
};
1515

1616
render() {
1717
const { classes } = this.props;

examples/data-as-objects/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ class Example extends React.Component {
1212
{ name: "Jaden Collins", title: "Attorney", location: "Santa Ana", age: 27, salary: "$500,000", phone: { home: '867-5311', cell: '123-4569' } },
1313
{ name: "Franky Rees", title: "Business Analyst", location: "St. Petersburg", age: 22, salary: "$50,000", phone: { home: '867-5312', cell: '123-4569' } }
1414
]
15-
}
15+
};
1616

1717
rerender = () => {
1818
this.setState((prevState, props) => ({
1919
counter: prevState.counter + 1
2020
}));
21-
}
21+
};
2222

2323
render() {
2424

examples/selectable-rows/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Example extends React.Component {
4646
this.setState({
4747
selectableRowsHideCheckboxes: event.target.checked
4848
});
49-
}
49+
};
5050

5151
render() {
5252

examples/serverside-filters/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Example extends React.Component {
7777
2000
7878
);
7979
});
80-
}
80+
};
8181

8282
handleFilterSubmit = applyFilters => {
8383
let filterList = applyFilters();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dist"
88
],
99
"scripts": {
10-
"dev": "cross-env NODE_ENV=development webpack-dev-server -d --progress --colors",
10+
"dev": "cross-env NODE_ENV=development webpack-dev-server --progress --color",
1111
"test": "cross-env NODE_ENV=test mocha --require ./test/babel-register.js --extensions js,jsx test/**/*.test.js",
1212
"docs:dev": "next docs",
1313
"docs:build": "cross-env NODE_ENV=production next build docs",

webpack.config.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const path = require('path');
21
const webpack = require('webpack');
3-
const HtmlWebpackPlugin = require('html-webpack-plugin');
42
const ESLintPlugin = require('eslint-webpack-plugin');
53

64
module.exports = {
@@ -17,12 +15,10 @@ module.exports = {
1715
mainFields: ['browser', 'module', 'main'],
1816
},
1917
devServer: {
20-
disableHostCheck: true,
18+
allowedHosts: 'all',
2119
host: 'localhost',
2220
hot: true,
23-
inline: true,
2421
port: process.env.PORT || 5050,
25-
stats: 'errors-warnings',
2622
},
2723
module: {
2824
rules: [
@@ -31,23 +27,6 @@ module.exports = {
3127
exclude: /node_modules/,
3228
use: ['babel-loader'],
3329
},
34-
{
35-
test: /\.(js|jsx)$/,
36-
include: /node_modules\/(@mui|@emotion)\//,
37-
use: {
38-
loader: 'babel-loader',
39-
options: {
40-
presets: [
41-
['@babel/preset-env', { modules: 'commonjs' }],
42-
'@babel/preset-react',
43-
],
44-
plugins: [
45-
'@babel/plugin-transform-optional-chaining',
46-
'@babel/plugin-transform-nullish-coalescing-operator',
47-
],
48-
},
49-
},
50-
},
5130
{
5231
test: /\.css$/i,
5332
use: ['style-loader', 'css-loader'],
@@ -56,8 +35,6 @@ module.exports = {
5635
},
5736
plugins: [
5837
new ESLintPlugin({ extensions: ['js', 'jsx'] }),
59-
new webpack.HotModuleReplacementPlugin(),
60-
new webpack.NamedModulesPlugin(),
6138
new webpack.DefinePlugin({
6239
'process.env': {
6340
NODE_ENV: JSON.stringify('development'),

0 commit comments

Comments
 (0)