Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Prettier and StandardJS #579

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions webpack/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path')

Check failure on line 1 in webpack/webpack.common.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

ESLint

ESLint: Install the 'eslint' package
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin')
Expand All @@ -16,7 +16,7 @@
const UNABLE_ANALYZE = 0
const USE_ANALYZE = process.env.USE_ANALYZE || UNABLE_ANALYZE

let dotEnv = ''

Check warning on line 19 in webpack/webpack.common.js

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused assignment

Variable initializer is redundant
switch (process.env.BUILD_GOAL) {
case 'development':
dotEnv = '.env.development'
Expand All @@ -36,7 +36,7 @@

const config = {
entry: {
app: `${paths.src}/index.tsx`,
app: `${paths.src}/index.tsx`
},
output: {
path: paths.build,
Expand All @@ -46,7 +46,7 @@
// library: '',
// libraryTarget: 'umd',
// chunkLoadingGlobal: '',
clean: true,
clean: true
// contentBase: path.join(__dirname, "public"), // 配置额外的静态文件内容的访问路径
},
resolve: {
Expand All @@ -61,13 +61,13 @@
'@pages': path.resolve('./src/pages'),
'@routers': path.resolve('./src/routers'),
'@utils': path.resolve('./src/utils'),
'@theme': path.resolve('./src/theme'),
'@theme': path.resolve('./src/theme')
},
symlinks: false,
symlinks: false
},
plugins: [
new Dotenv({
path: path.resolve(__dirname, '..', dotEnv),
path: path.resolve(__dirname, '..', dotEnv)
}),
new HtmlWebpackPlugin({
title: isDev ? 'Pro React Dev' : 'Pro React Admin',
Expand All @@ -91,8 +91,8 @@
minifyCSS: true,
minifyJS: true,
minifyURLs: true,
useShortDoctype: true,
},
useShortDoctype: true
}
}),
new AntdDayjsWebpackPlugin(),
new CaseSensitivePathsPlugin(),
Expand All @@ -115,16 +115,16 @@
exclude: 'node_modules', // 默认值
cache: true, // 开启缓存
// 缓存目录
cacheLocation: path.resolve(__dirname, '../node_modules/.cache/.eslintcache'),
}),
cacheLocation: path.resolve(__dirname, '../node_modules/.cache/.eslintcache')
})
],
module: {
// 将缺失的导出提示成错误而不是警告
strictExportPresence: true,
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader'],
use: ['style-loader', 'css-loader', 'postcss-loader']
},
{
test: /\.less$/i,
Expand All @@ -141,10 +141,10 @@
localIdentName: isDev ? '[path][name]__[local]--[hash:base64:5]' : '[local]--[hash:base64:5]',
localIdentContext: paths.src,
namedExport: false,
exportLocalsConvention: 'camelCase',
exportLocalsConvention: 'camelCase'
},
importLoaders: 2,
},
importLoaders: 2
}
},
{
loader: require.resolve('postcss-loader'),
Expand All @@ -158,18 +158,18 @@
'postcss-preset-env',
{
autoprefixer: {
flexbox: 'no-2009',
flexbox: 'no-2009'
},
stage: 3,
},
stage: 3
}
],
'postcss-normalize',
],
'postcss-normalize'
]
},
sourceMap: true,
},
},
],
sourceMap: true
}
}
]
},
{
test: /\.(js|jsx|ts|tsx)$/,
Expand All @@ -179,56 +179,56 @@
loader: 'esbuild-loader',
options: {
// loader: 'tsx',
target: 'es2020',
},
target: 'es2020'
}
},
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['@babel/plugin-transform-object-rest-spread', '@babel/plugin-transform-runtime'],
},
},
],
plugins: ['@babel/plugin-transform-object-rest-spread', '@babel/plugin-transform-runtime']
}
}
]
},
{
test: /\.(png|jpe?g|gif|webp|eot|ttf|woff|woff2|mp4|pdf)$/i,
type: 'asset',
parser: {
// Conditions for converting to base64
dataUrlCondition: {
maxSize: 25 * 1024, // 25kb
},
maxSize: 25 * 1024 // 25kb
}
},
generator: {
filename: 'images/[contenthash][ext][query]',
},
filename: 'images/[contenthash][ext][query]'
}
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'babel-loader',
loader: 'babel-loader'
},
{
loader: '@svgr/webpack',
options: {
babel: false,
icon: true,
},
},
],
},
],
icon: true
}
}
]
}
]
},
stats: {
all: false,
errors: true,
warnings: true,
errorDetails: true,
moduleTrace: true, // 打印模块追踪信息,与--trace - warnings类似
excludeAssets: /node_modules/,
},
excludeAssets: /node_modules/
}
}

if (USE_ANALYZE) {
Expand Down
Loading