@shark-pepper/create-app 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-app-cli.js +4 -35
- package/package.json +1 -1
- package/templates/react-app/.commitlintrc.js +3 -0
- package/templates/react-app/.eslintrc.js +44 -0
- package/templates/react-app/.husky/commit-msg +4 -0
- package/templates/react-app/.husky/pre-commit +4 -0
- package/templates/react-app/package.base.json +12 -7
- package/templates/react-app/pnpm-lock.yaml +1969 -388
- package/templates/react-app/postcss.config.js +5 -0
- package/templates/react-app/webpack/webpack.dev.js +0 -2
- package/templates/react-app/webpack/webpack.prod.js +0 -2
- package/templates/react-app/eslint.config.js +0 -108
|
@@ -3,7 +3,6 @@ import { merge } from 'webpack-merge';
|
|
|
3
3
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
4
4
|
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
5
5
|
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
6
|
-
import ESLintPlugin from 'eslint-webpack-plugin';
|
|
7
6
|
import common from './webpack.common.js';
|
|
8
7
|
|
|
9
8
|
const __dirname = path.resolve();
|
|
@@ -65,7 +64,6 @@ export default merge(common, {
|
|
|
65
64
|
async: true,
|
|
66
65
|
typescript: { configFile: path.resolve(__dirname, './tsconfig.json') },
|
|
67
66
|
}),
|
|
68
|
-
new ESLintPlugin({ extensions: ['ts', 'tsx', 'js', 'jsx'], fix: true, emitWarning: true }),
|
|
69
67
|
].filter(Boolean),
|
|
70
68
|
|
|
71
69
|
devtool: 'cheap-module-source-map',
|
|
@@ -3,7 +3,6 @@ import { merge } from 'webpack-merge';
|
|
|
3
3
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
4
4
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
5
5
|
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
6
|
-
import ESLintPlugin from 'eslint-webpack-plugin';
|
|
7
6
|
import common from './webpack.common.js';
|
|
8
7
|
|
|
9
8
|
const __dirname = path.resolve();
|
|
@@ -77,7 +76,6 @@ export default merge(common, {
|
|
|
77
76
|
configFile: path.resolve(__dirname, './tsconfig.json'),
|
|
78
77
|
},
|
|
79
78
|
}),
|
|
80
|
-
new ESLintPlugin({ extensions: ['ts', 'tsx', 'js', 'jsx'], fix: true, emitWarning: false }),
|
|
81
79
|
].filter(Boolean),
|
|
82
80
|
|
|
83
81
|
devtool: 'source-map',
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
root: true, // 表示 ESLint 配置在此目录为根,不向上查找
|
|
3
|
-
env: {
|
|
4
|
-
browser: true,
|
|
5
|
-
es2022: true,
|
|
6
|
-
},
|
|
7
|
-
parser: "@typescript-eslint/parser", // 使用 TypeScript 解析器
|
|
8
|
-
parserOptions: {
|
|
9
|
-
ecmaVersion: 2022, // 支持最新 ECMAScript 语法
|
|
10
|
-
sourceType: "module", // 支持 ES Modules
|
|
11
|
-
ecmaFeatures: {
|
|
12
|
-
jsx: true, // 支持 JSX
|
|
13
|
-
},
|
|
14
|
-
project: "./tsconfig.json", // 类型检查,启用 rules 依赖类型信息
|
|
15
|
-
},
|
|
16
|
-
plugins: [
|
|
17
|
-
"@typescript-eslint",
|
|
18
|
-
"react",
|
|
19
|
-
"react-hooks",
|
|
20
|
-
"import",
|
|
21
|
-
"cspell", // 拼写检查
|
|
22
|
-
],
|
|
23
|
-
extends: [
|
|
24
|
-
"eslint:recommended", // ESLint 内置推荐规则
|
|
25
|
-
"plugin:@typescript-eslint/recommended", // TypeScript 推荐规则
|
|
26
|
-
"plugin:@typescript-eslint/recommended-requiring-type-checking", // 依赖类型信息的规则
|
|
27
|
-
"plugin:react/recommended", // React 推荐规则
|
|
28
|
-
"plugin:react-hooks/recommended", // React hooks 推荐规则
|
|
29
|
-
"plugin:import/errors",
|
|
30
|
-
"plugin:import/warnings",
|
|
31
|
-
"plugin:import/typescript",
|
|
32
|
-
"plugin:cspell/recommended", // 拼写检查规则
|
|
33
|
-
"prettier", // 关闭与 Prettier 冲突的规则
|
|
34
|
-
],
|
|
35
|
-
settings: {
|
|
36
|
-
react: {
|
|
37
|
-
version: "detect", // 自动检测 React 版本
|
|
38
|
-
},
|
|
39
|
-
"import/resolver": {
|
|
40
|
-
typescript: {}, // 支持路径别名解析
|
|
41
|
-
},
|
|
42
|
-
cspell: {
|
|
43
|
-
language: "en",
|
|
44
|
-
skipWords: ["React", "TypeScript", "Webpack", "eslint", "pnpm"],
|
|
45
|
-
ignorePaths: ["node_modules", "dist"],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
rules: {
|
|
49
|
-
// ✅ TypeScript 相关
|
|
50
|
-
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], // 未使用变量允许 _ 前缀
|
|
51
|
-
"@typescript-eslint/explicit-function-return-type": "off", // 不强制函数返回类型
|
|
52
|
-
"@typescript-eslint/no-explicit-any": "warn", // 尽量避免 any
|
|
53
|
-
"@typescript-eslint/strict-boolean-expressions": "warn", // 布尔表达式严格检查
|
|
54
|
-
|
|
55
|
-
// ✅ React 相关
|
|
56
|
-
"react/prop-types": "off", // TS 已经类型检查,不需要 prop-types
|
|
57
|
-
"react/react-in-jsx-scope": "off", // React 17+ 不需要显式 import React
|
|
58
|
-
|
|
59
|
-
// ✅ Hooks 相关
|
|
60
|
-
"react-hooks/rules-of-hooks": "error", // Hooks 调用规则
|
|
61
|
-
"react-hooks/exhaustive-deps": "warn", // effect 依赖检查
|
|
62
|
-
|
|
63
|
-
// ✅ Import 相关
|
|
64
|
-
"import/order": [
|
|
65
|
-
"warn",
|
|
66
|
-
{
|
|
67
|
-
groups: [
|
|
68
|
-
"builtin",
|
|
69
|
-
"external",
|
|
70
|
-
"internal",
|
|
71
|
-
"parent",
|
|
72
|
-
"sibling",
|
|
73
|
-
"index",
|
|
74
|
-
],
|
|
75
|
-
"newlines-between": "always",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
"import/no-unresolved": "error",
|
|
79
|
-
"import/no-cycle": ["error", { maxDepth: 1 }],
|
|
80
|
-
|
|
81
|
-
// ✅ 拼写检查
|
|
82
|
-
"cspell/spellchecker": [
|
|
83
|
-
"warn",
|
|
84
|
-
{
|
|
85
|
-
words: [
|
|
86
|
-
"frontend",
|
|
87
|
-
"backend",
|
|
88
|
-
"utils",
|
|
89
|
-
"eslint",
|
|
90
|
-
"webpack",
|
|
91
|
-
"typescript",
|
|
92
|
-
],
|
|
93
|
-
skipWords: ["React", "TSX", "JSX", "npm", "pnpm"],
|
|
94
|
-
ignorePaths: ["node_modules", "dist", "build"],
|
|
95
|
-
ignoreRegExpList: ["/^_/"], // 忽略下划线开头的标识符
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
|
|
99
|
-
// ✅ 其他风格
|
|
100
|
-
"no-console": ["warn", { allow: ["warn", "error"] }], // 允许 warn/error
|
|
101
|
-
"no-debugger": "warn",
|
|
102
|
-
"prefer-const": "warn",
|
|
103
|
-
"arrow-body-style": ["warn", "as-needed"],
|
|
104
|
-
"no-param-reassign": "warn",
|
|
105
|
-
"no-duplicate-imports": "warn",
|
|
106
|
-
},
|
|
107
|
-
ignorePatterns: ["node_modules/", "dist/", "build/", "*.config.js"],
|
|
108
|
-
};
|