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

feat(plugin-layout): 支持配置 403、404 的 navigation #224

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
71 changes: 29 additions & 42 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
{
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],
// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml"
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml"
],

"pair-diff.patterns": [
{
"source": "./fixtures/output/**/*.*",
"target": "./fixtures/input/<base>"
}
]
"pair-diff.patterns": [
{
"source": "./fixtures/output/**/*.*",
"target": "./fixtures/input/<base>"
}
]
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段代码补丁主要是针对编辑器配置文件(可能是VS Code)进行的修改。以下是对代码进行的简要审查:

  1. 没有明显的错误或潜在风险。

  2. 改进建议:

    • 代码缩进:系统中大部分行都使用了两个空格进行缩进,但是存在一些混乱的缩进和对齐方式。建议统一使用一致的缩进规则,例如使用四个空格或制表符作为缩进。
    • 注释:建议在注释前添加一个空格以提高可读性,并保持注释的规范格式。
    • 对象属性之间的换行:在对象属性之间添加换行可以提高代码的可读性和维护性。示例中的 "eslint.rules.customizations" 和 "pair-diff.patterns" 可以考虑将每个属性放在单独的一行上。

请注意,以上只是一些改进建议,具体应该根据项目需求和团队规范进行调整。

21 changes: 19 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,36 @@
import antfu from '@antfu/eslint-config';

export default await antfu({
files: ['**/*.js', '**/*.jsx', '**/*.vue', '**/*.ts'],
// TODO: 使用 ignore 代替 cli 命令中的配置
stylistic: {
indent: 4, // 4, or 'tab'
quotes: 'single', // or 'double'
indent: 4,
quotes: 'single',
semi: 'always',
},
typescript: true,
vue: true,
rules: {
'curly': ['error', 'multi-line'],
'vue/block-order': [
'error',
{
order: ['template', 'script', 'style'],
},
],
'style/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
multilineDetection: 'brackets',
},
],
},
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段代码是一个eslint配置文件的补丁。以下是对此代码的简要代码审查:

  1. 在整体配置对象中添加了一个新的属性files,用于指定需要进行eslint检查的文件类型。可以按照需要进一步细化该配置。

  2. stylistic部分增加了对缩进(indent)和引号(quotes)的配置。缩进设置为4个空格,引号使用单引号。

  3. 添加了对分号(semi)的规则配置,要求在语句末尾始终使用分号。

  4. 开启了TypeScript和Vue的eslint规则检查。

  5. 修改了vue/block-order的规则配置,指定了模板、脚本和样式的顺序。

  6. 添加了针对curly规则的配置,要求在多行语句中使用大括号。

  7. 添加了对成员分隔符风格的规则配置,多行情况下要求分隔符带有分号并且最后一个元素后没有分隔符,单行情况下不要求分隔符,并且检测多行的方式是通过大括号。

改进建议:

  • 尽量统一团队的代码风格,避免个别文件的特殊配置。
  • 建议添加更多详细的注释,解释每个规则的作用和原因。
  • 注意代码质量和可维护性,包括命名规范、函数的职责划分等。

37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"name": "fes.js",
"type": "module",
"version": "3.1.1",
"private": true,
"description": "一个好用的前端管理台快速开发框架",
"preferGlobal": true,
"private": true,
"workspaces": [
"packages/*"
],
"type": "module",
"license": "MIT",
"keywords": [
"管理端",
"fes",
"fast",
"easy",
"strong"
],
"scripts": {
"bootstrap": "pnpm i",
"dev": "node scripts/build.mjs --watch",
Expand All @@ -18,17 +26,10 @@
"docs:build": "vitepress build docs",
"docs:build-pages": "BASE=fes.js vitepress build docs",
"test": "fes test",
"lint": "eslint -c ./.eslintrc.js --ignore-pattern='templates' --ext .js,.jsx,.vue,.ts",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
"lint": "eslint --ignore-pattern='templates'",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"hooks:sync": "simple-git-hooks"
},
"license": "MIT",
"keywords": [
"管理端",
"fes",
"fast",
"easy",
"strong"
],
"dependencies": {
"chalk": "^5.0.1",
"conventional-changelog-cli": "^4.1.0",
Expand All @@ -38,14 +39,14 @@
"semver": "^7.3.6"
},
"devDependencies": {
"@antfu/eslint-config": "^2.1.1",
"@antfu/eslint-config": "^2.6.2",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"chokidar": "^3.5.3",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"deepmerge": "^4.2.2",
"eslint": "^8.54.0",
"eslint": "^8.56.0",
"fs-extra": "^11.1.1",
"lint-staged": "^13.2.0",
"simple-git-hooks": "^2.9.0",
Expand All @@ -54,15 +55,15 @@
"vue": "^3.3.4",
"yargs-parser": "^21.1.1"
},
"simple-git-hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint"
},
"lint-staged": {
"*.{js,jsx,vue,ts}": [
"npm run lint"
]
},
"simple-git-hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此代码补丁主要包含以下更改:

  1. 添加了"type"和"private"字段。
  2. 在"scripts"字段中添加了"hooks:sync"命令。
  3. 更新了一些依赖项的版本。
  4. 将lint脚本从".eslintrc.js"更改为"--ignore-pattern='templates'"选项。
  5. 更改了"changelog"脚本中的"-i CHANGELOG.md -s"参数。
  6. 添加了"simple-git-hooks"、"lint-staged"和"config"字段。

可能的问题和改进建议:

  • "type"字段已经添加,但在修改前的代码中未显示。确保这是所需的配置。
  • 更新的依赖项版本可能会引入新的bug或兼容性问题。请确保更新的版本与项目的其他部分兼容,并进行全面的测试。
  • "scripts"部分可以进一步优化和组织,例如通过安装npm-run-all将多个命令组合为一个单独的命令。
  • 可以根据您的实际需要添加更多的脚本命令,如构建、打包和部署等。

请注意,由于限制,这里提供的是基于代码差异的高层分析。实际的代码质量评估应该是基于整个项目的上下文和需求进行的。

Expand Down
Loading