Skip to content

Commit 67276f1

Browse files
committed
update: packages/eslint
1 parent f6d3f93 commit 67276f1

File tree

7 files changed

+47
-50
lines changed

7 files changed

+47
-50
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"es6": true,
66
"mocha": true
77
},
8-
"parser": "babel-eslint",
8+
"parser": "@babel/eslint-parser",
99
"parserOptions": {
1010
"ecmaVersion": 9,
1111
"ecmaFeatures": {

package.json

+30-30
Original file line numberDiff line numberDiff line change
@@ -24,63 +24,63 @@
2424
},
2525
"dependencies": {
2626
"@rematch/core": "^2.2.0",
27-
"antd": "^4.17.3",
28-
"axios": "^0.24.0",
29-
"core-js": "^3.19.3",
30-
"eslint": "^7.32.0",
27+
"antd": "^4.18.5",
28+
"axios": "^0.25.0",
29+
"core-js": "^3.21.0",
3130
"lodash": "^4.17.21",
3231
"react": "^17.0.2",
3332
"react-dom": "^17.0.2",
3433
"react-loadable": "^5.5.0",
3534
"react-redux": "^7.2.6",
36-
"react-router-dom": "^6.1.1",
35+
"react-router-dom": "^6.2.1",
3736
"redux": "^4.1.2"
3837
},
3938
"devDependencies": {
40-
"@babel/core": "^7.16.5",
41-
"@babel/plugin-proposal-class-properties": "^7.16.5",
42-
"@babel/plugin-proposal-decorators": "^7.16.5",
43-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5",
44-
"@babel/plugin-proposal-object-rest-spread": "^7.16.5",
45-
"@babel/plugin-proposal-optional-chaining": "^7.16.5",
39+
"@babel/core": "^7.17.0",
40+
"@babel/eslint-parser": "^7.17.0",
41+
"@babel/plugin-proposal-class-properties": "^7.16.7",
42+
"@babel/plugin-proposal-decorators": "^7.17.0",
43+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
44+
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
45+
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
4646
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
47-
"@babel/plugin-transform-runtime": "^7.16.5",
48-
"@babel/preset-env": "^7.16.5",
49-
"@babel/preset-react": "^7.16.5",
50-
"@babel/runtime": "^7.16.5",
47+
"@babel/plugin-transform-runtime": "^7.17.0",
48+
"@babel/preset-env": "^7.16.11",
49+
"@babel/preset-react": "^7.16.7",
50+
"@babel/runtime": "^7.17.0",
5151
"antd-dayjs-webpack-plugin": "^1.0.6",
52-
"autoprefixer": "^10.4.0",
53-
"babel-eslint": "^10.1.0",
52+
"autoprefixer": "^10.4.2",
5453
"babel-loader": "^8.2.3",
5554
"babel-plugin-import": "^1.13.3",
5655
"clean-webpack-plugin": "^4.0.0",
57-
"copy-webpack-plugin": "^10.1.0",
58-
"css-loader": "^6.5.1",
59-
"css-minimizer-webpack-plugin": "^3.2.0",
56+
"copy-webpack-plugin": "^10.2.4",
57+
"css-loader": "^6.6.0",
58+
"css-minimizer-webpack-plugin": "^3.4.1",
6059
"dayjs": "^1.10.7",
61-
"eslint-loader": "^4.0.2",
60+
"eslint": "^8.8.0",
6261
"eslint-plugin-prettier": "^4.0.0",
63-
"eslint-plugin-react": "^7.27.1",
62+
"eslint-plugin-react": "^7.28.0",
6463
"eslint-plugin-react-hooks": "^4.3.0",
65-
"express": "^4.17.1",
64+
"eslint-webpack-plugin": "^3.0.1",
65+
"express": "^4.17.2",
6666
"favicons": "^6.2.2",
6767
"favicons-webpack-plugin": "^5.0.2",
6868
"happypack": "^5.0.1",
6969
"html-webpack-plugin": "^5.5.0",
7070
"less": "^4.1.2",
7171
"less-loader": "^10.2.0",
72-
"mini-css-extract-plugin": "^2.4.5",
72+
"mini-css-extract-plugin": "^2.5.3",
7373
"mockjs": "^1.1.0",
74-
"postcss": "^8.4.5",
74+
"postcss": "^8.4.6",
7575
"postcss-loader": "^6.2.1",
7676
"prettier": "^2.5.1",
7777
"style-loader": "^3.3.1",
7878
"sw-precache-webpack-plugin": "^1.0.0",
79-
"terser-webpack-plugin": "^5.2.5",
80-
"webpack": "^5.65.0",
79+
"terser-webpack-plugin": "^5.3.1",
80+
"webpack": "^5.68.0",
8181
"webpack-bundle-analyzer": "^4.5.0",
82-
"webpack-cli": "^4.9.1",
83-
"webpack-dev-middleware": "^5.2.2",
82+
"webpack-cli": "^4.9.2",
83+
"webpack-dev-middleware": "^5.3.1",
8484
"webpack-hot-middleware": "^2.25.1",
8585
"webpackbar": "^5.0.2",
8686
"workbox-webpack-plugin": "^6.4.2",
@@ -93,4 +93,4 @@
9393
"not dead",
9494
"not op_mini all"
9595
]
96-
}
96+
}

src/component/menu/index.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,17 @@ export default function Menu() {
2020
</Link>
2121
|
2222
<span
23+
class="link"
2324
onClick={() => goToTest()}
2425
to={{
2526
pathname: "/test",
2627
search: "?a=123&b=abc",
2728
}}
28-
state={{ c: 456, d: "ABC" }}
29-
>
29+
state={{ c: 456, d: "ABC" }}>
3030
测试:api跳转
3131
</span>
3232
|
33-
<a
34-
href="https://github.com/javaLuo/react-luo"
35-
target="_blank"
36-
rel="noopener noreferrer"
37-
>
33+
<a href="https://github.com/javaLuo/react-luo" target="_blank" rel="noopener noreferrer">
3834
GitHub
3935
</a>
4036
</div>

src/component/menu/index.less

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
.active {
66
color: #67daf9;
77
}
8-
a {
8+
a,
9+
.link {
910
padding: 0 5px;
1011
color: #0066cc;
1112
text-decoration: none;
13+
cursor: pointer;
1214
&:hover {
1315
text-decoration: underline;
1416
}

src/container/features/index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ export default function FeaturesPageContainer(props) {
3939
</div>
4040
<div className="list">
4141
<h2>HMR局部热更新</h2>
42-
<div>
43-
使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新
44-
</div>
42+
<div>使用webpack-dev-middleware 和 webpack-hot-middleware设置了热更新</div>
4543
</div>
4644
<div className="list">
4745
<h2>代码分割</h2>
4846
<div>react-loadable实现的代码分割</div>
4947
<div>src/container/root/index.js中能查看例子</div>
5048
</div>
5149
<div className="list">
52-
<h2>webpack4.x</h2>
50+
<h2>webpack5.x</h2>
5351
<div>使用了最新版本的webpack,编译速度更快</div>
5452
</div>
5553
</div>

webpack.dev.config.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin");
77
const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public中的文件到打包的最终文件夹中
88
const HappyPack = require("happypack"); // 多线程编译
99
const webpackbar = require("webpackbar");
10+
const ESLintPlugin = require("eslint-webpack-plugin"); // eslint插件,代替原来的eslint-loader
1011
const PUBLIC_PATH = "/"; // 基础路径
1112

1213
module.exports = {
@@ -29,13 +30,6 @@ module.exports = {
2930
},
3031
module: {
3132
rules: [
32-
{
33-
// 编译前通过eslint检查代码 (注释掉即可取消eslint检测)
34-
test: /\.js?$/,
35-
enforce: "pre",
36-
use: ["eslint-loader"],
37-
include: path.resolve(__dirname, "src"),
38-
},
3933
{
4034
// .js .jsx用babel解析
4135
test: /\.js?$/,
@@ -88,6 +82,9 @@ module.exports = {
8882
},
8983
plugins: [
9084
new webpackbar(),
85+
new ESLintPlugin({
86+
context: path.resolve(__dirname, "src"),
87+
}),
9188
new webpack.HotModuleReplacementPlugin(), // 热更新插件
9289
new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs
9390
new webpack.DefinePlugin({

webpack.production.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const CopyPlugin = require("copy-webpack-plugin"); // 用于直接复制public
1212
const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标 webpack5 wating up
1313
const TerserPlugin = require("terser-webpack-plugin"); // 对js进行压缩
1414
const webpackbar = require("webpackbar"); // 进度条
15+
const ESLintPlugin = require("eslint-webpack-plugin"); // eslint插件,代替原来的eslint-loader
1516
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; // 分析打包后各个包的大小
1617
/**
1718
* 基础路径
@@ -113,6 +114,9 @@ module.exports = {
113114
* **/
114115
new CleanWebpackPlugin(),
115116
new webpackbar(), // 打包时美化进度条
117+
new ESLintPlugin({
118+
context: path.resolve(__dirname, "src"),
119+
}),
116120
new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs
117121
/**
118122
* 在window环境中注入全局变量,虽然暂时没用上,不过在真实开发中应该会用到

0 commit comments

Comments
 (0)