Skip to content

Commit 1d0ec12

Browse files
authored
chore: update eslint and webpack configurations (#525)
* chore: update eslint and webpack configurations * chore: update gitignore and fix test spec
1 parent 798be18 commit 1d0ec12

File tree

8 files changed

+373
-798
lines changed

8 files changed

+373
-798
lines changed

.eslintcache

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,34 @@ pids
88
*.pid
99
*.seed
1010

11-
# Directory for instrumented libs generated by jscoverage/JSCover
12-
lib-cov
13-
14-
# Coverage directory used by tools like istanbul
11+
# Coverage directory
1512
coverage
1613

17-
# nyc test coverage
18-
.nyc_output
19-
20-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21-
.grunt
22-
23-
# node-waf configuration
24-
.lock-wscript
25-
26-
# Compiled binary addons (http://nodejs.org/api/addons.html)
27-
build/Release
28-
2914
# Dependency directories
3015
node_modules
3116
jspm_packages
3217

33-
# Optional npm cache directory
34-
.npm
35-
36-
# Optional REPL history
37-
.node_repl_history
38-
.DS_Store
39-
18+
# Build outputs
4019
dist
4120
lib
4221
es
22+
23+
# IDE and editor files
4324
.vscode/
44-
assets
25+
26+
# OS generated files
27+
.DS_Store
28+
29+
# Package manager files
4530
yarn.lock
31+
32+
# Cache files
33+
.npm
34+
.eslintcache
35+
36+
# Miscellaneous
37+
.nyc_output
38+
.grunt
39+
.lock-wscript
40+
build/Release
41+
assets

eslint.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ export default [
3838
{
3939
// Test files
4040
files: ['**/test/*.{js,mjs,cjs,ts,jsx,tsx}'],
41+
languageOptions: {
42+
globals: {
43+
...globals.mocha,
44+
...globals.chai,
45+
expect: true,
46+
sinon: true
47+
}
48+
},
4149
rules: {
4250
'react/display-name': 'off'
4351
}

karma.conf.js

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,4 @@
1-
// eslint-disable-next-line @typescript-eslint/no-var-requires
2-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
3-
4-
const webpackConfig = {
5-
mode: 'development',
6-
output: {
7-
pathinfo: true
8-
},
9-
resolve: {
10-
extensions: ['.ts', '.tsx', '.js']
11-
},
12-
module: {
13-
rules: [
14-
{
15-
test: [/\.tsx?$/, /\.jsx?$/],
16-
use: ['babel-loader?babelrc'],
17-
exclude: /node_modules/
18-
},
19-
{
20-
test: /\.(less|css)$/,
21-
use: [
22-
MiniCssExtractPlugin.loader,
23-
{
24-
loader: 'css-loader'
25-
},
26-
{
27-
loader: 'less-loader',
28-
options: {
29-
sourceMap: true,
30-
lessOptions: {
31-
javascriptEnabled: true
32-
}
33-
}
34-
}
35-
]
36-
}
37-
]
38-
},
39-
plugins: [
40-
new MiniCssExtractPlugin({
41-
filename: '[name].css',
42-
chunkFilename: '[id].css'
43-
})
44-
],
45-
devtool: 'eval'
46-
};
1+
/* eslint-disable @typescript-eslint/no-require-imports */
472

483
module.exports = config => {
494
const { env } = process;
@@ -67,7 +22,7 @@ module.exports = config => {
6722
preprocessors: {
6823
'test/*.js': ['webpack']
6924
},
70-
webpack: webpackConfig,
25+
webpack: require('./webpack.karma.js'),
7126
webpackMiddleware: {
7227
noInfo: true
7328
},

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,29 @@
6767
"@commitlint/config-conventional": "^13.1.0",
6868
"@eslint/js": "^9.17.0",
6969
"@faker-js/faker": "^7.6.0",
70-
"@testing-library/react": "^13.4.0",
70+
"@testing-library/dom": "^10.4.0",
71+
"@testing-library/react": "^16.2.0",
7172
"@types/lodash": "^4.14.165",
7273
"@types/react": "^18.2.0",
7374
"@types/react-dom": "^18.2.0",
7475
"@types/react-is": "^18.2.4",
76+
"@types/karma": "^6.3.9",
77+
"@types/karma-mocha": "^1.3.1",
78+
"@types/karma-sinon-chai": "^2.0.0",
79+
"@types/karma-webpack": "^2.0.9",
7580
"autoprefixer": "^8.3.0",
7681
"babel-loader": "^8.2.2",
7782
"babel-plugin-date-fns": "^0.2.1",
7883
"babel-plugin-istanbul": "^4.1.4",
7984
"babel-plugin-lodash": "^3.3.4",
80-
"chai": "^4.1.0",
85+
"chai": "^4.3.5",
8186
"conventional-changelog-cli": "^2.1.1",
8287
"coveralls": "^3.1.0",
8388
"cross-env": "^5.2.1",
8489
"css-loader": "^0.23.1",
8590
"cssnano": "^4.1.10",
8691
"cz-conventional-changelog": "^3.3.0",
8792
"del": "^5.1.0",
88-
"dtslint": "^3.4.2",
8993
"eslint": "^9.17.0",
9094
"eslint-config-prettier": "^9.1.0",
9195
"eslint-plugin-react": "^7.37.3",
@@ -101,7 +105,7 @@
101105
"gulp-rtlcss": "^1.4.1",
102106
"gulp-sourcemaps": "^2.6.4",
103107
"html-webpack-plugin": "^5.3.2",
104-
"karma": "^6.4.0",
108+
"karma": "^6.3.14",
105109
"karma-chai-dom": "^1.1.0",
106110
"karma-chrome-launcher": "^3.1.0",
107111
"karma-cli": "^2.0.0",
@@ -115,15 +119,15 @@
115119
"less": "^4.1.3",
116120
"less-loader": "^11.0.0",
117121
"mini-css-extract-plugin": "^2.3.0",
118-
"mocha": "^9.0.2",
122+
"mocha": "^11.0.1",
119123
"prettier": "^2.3.2",
120124
"react": "^18.2.0",
121125
"react-code-view": "^2.2.1",
122126
"react-dnd": "^16.0.1",
123127
"react-dnd-html5-backend": "^16.0.1",
124128
"react-dom": "^18.2.0",
125129
"rsuite": "5.78.0",
126-
"sinon": "^11.1.2",
130+
"sinon": "^19.0.2",
127131
"sinon-chai": "^3.7.0",
128132
"style-loader": "^0.13.1",
129133
"ts-expect": "^1.3.0",

0 commit comments

Comments
 (0)