Skip to content

Commit

Permalink
feat: upgrade eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
xcatliu committed Jun 27, 2022
1 parent fa5611d commit 0cfc621
Show file tree
Hide file tree
Showing 76 changed files with 5,875 additions and 16,362 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.DS_Store
.idea
.editorconfig
package-lock.json
pnpm-lock.yaml
.npmrc

# Ignored suffix
Expand Down
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"octref.vetur",
"streetsidesoftware.code-spell-checker"
]
}
27 changes: 26 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,30 @@
},
"vetur.format.enable": false,
"vetur.validation.template": false,
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"cSpell.words": [
"alloyteam",
"copyfiles",
"eslintconfig",
"heyli",
"iframe",
"kenve",
"mobi",
"pnpm",
"Revelt",
"ryoliu",
"styleguide",
"sunhui",
"xcatliu",
"Xuing",
"zoubingwu"
],
"cSpell.ignorePaths": [
"pnpm-lock.yaml",
"node_modules",
"vscode-extension",
".git/objects",
".vscode",
".vscode-insiders"
]
}
36 changes: 26 additions & 10 deletions base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@
* 贡献者:
* xcatliu <xcatliu@gmail.com>
* heyli <lcxfs1991@gmail.com>
* Swan <noreply@github.com>
* Xuing <admin@xuing.cn>
* Dash Chen <dc3671@users.noreply.github.com>
* DiamondYuan <admin@diamondyuan.com>
* Dash Chen <noreply@github.com>
* Roy Revelt <roy@codsen.com>
* Swan <1021808625@qq.com>
* kenve <zwei.xie@gmail.com>
* lzw <mingxin2014@gmail.com>
* ryoliu <sfesh@163.com>
* sunhui04 <sunhui04@meituan.com>
* zoubingwu <zoubingwu@gmail.com>
*
* 依赖版本:
* eslint ^7.32.0
* @babel/eslint-parser ^7.17.0
* @babel/preset-react ^7.16.7
* eslint-plugin-react ^7.28.0
* vue-eslint-parser ^8.2.0
* eslint-plugin-vue ^8.4.1
* @typescript-eslint/parser ^5.12.0
* @typescript-eslint/eslint-plugin ^5.12.0
* eslint ^8.18.0
* @babel/eslint-parser ^7.18.2
* @babel/preset-react ^7.17.12
* eslint-plugin-react ^7.30.1
* vue-eslint-parser ^9.0.3
* eslint-plugin-vue ^9.1.1
* @typescript-eslint/parser ^5.29.0
* @typescript-eslint/eslint-plugin ^5.29.0
*
* 此文件是由脚本 scripts/build.ts 自动生成
*/
Expand Down Expand Up @@ -292,6 +296,10 @@ module.exports = {
* 禁止对使用 const 定义的常量重新赋值
*/
'no-const-assign': 'error',
/**
* 禁止出现不影响值的表达式
*/
'no-constant-binary-expression': 'error',
/**
* 禁止将常量作为分支条件判断中的测试表达式,但允许作为循环条件判断中的测试表达式
*/
Expand Down Expand Up @@ -744,6 +752,10 @@ module.exports = {
* @reason 已经禁止使用 label 了
*/
'no-unused-labels': 'off',
/**
* 禁止类出现未使用的私有成员
*/
'no-unused-private-class-members': 'error',
/**
* 已定义的变量必须使用
*/
Expand Down Expand Up @@ -865,6 +877,10 @@ module.exports = {
* 必须使用 0b11111011 而不是 parseInt()
*/
'prefer-numeric-literals': 'off',
/**
* 使用 Object.hasOwn() 而不是 Object.prototype.hasOwnProperty.call()
*/
'prefer-object-has-own': 'error',
/**
* 必须使用 ... 而不是 Object.assign,除非 Object.assign 的第一个参数是一个变量
*/
Expand Down
22 changes: 21 additions & 1 deletion config/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -626,5 +626,25 @@
"禁止使用未定义的属性": "Disallow undefined properties",
"禁止在组件中使用 v-text v-html": "Disallow v-text / v-html on component",
"在模版中必须用单独的 class 属性表达静态类的名字": "Require static class names in template to be in a separate `class` attribute",
"一致的类型导出语法": "Enforces consistent usage of type exports"
"一致的类型导出语法": "Enforces consistent usage of type exports",
"禁止出现不影响值的表达式": "disallow expressions where the operation doesn't affect the value",
"禁止类出现未使用的私有成员": "disallow unused private class members",
"使用 Object.hasOwn() 而不是 Object.prototype.hasOwnProperty.call()": "disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`",
"hook 的返回值必须与 useState 的解构对应": "Ensure symmetric naming of useState hook value and setter variables",
"iframe 组件必须添加 sandbox 属性": "Enforce sandbox attribute on iframe elements",
"使用 && 渲染组件时,禁止条件是 0 '' 或 NaN": "Prevent problematic leaked values from being rendered",
"必须按规则排序 defineEmits 和 defineProps": "enforce order of `defineEmits` and `defineProps` compiler macros",
"导出的组件名称必须保持一致性": "require the registered component name to match the imported component name",
"禁止使用指定的元素": "disallow specific HTML elements",
"必须导入 vue 而不是 @vue/*": "enforce import from 'vue' instead of import from '@vue/*'",
"Boolean 必须是组件 prop 的第一个参数": "enforce `Boolean` comes first in component prop types",
"v-bind 值为 true 时,必须省略显示声明": "require shorthand form attribute when `v-bind` value is `true`",
"属性名必须合法": "require valid attribute names",
"model 的属性名必须合法": "require valid keys in model option",
"使用 Map 或 Set 时,必须在构造函数上用泛型定义类型": "Enforce specifying generic type arguments on type annotation or constructor name of a constructor call",
"禁止枚举类型存在两个相同的值": "Disallow duplicate enum member values",
"禁止无用的联合类型或交叉类型": "Disallow members of unions and intersections that do nothing or override type information",
"禁止导出空对象": "Disallow empty exports that don't change anything in a module file",
"类的构造函数参数作为类属性时,必须加上可访问性修饰符": "Require or disallow parameter properties in class constructors",
"自定义事件名必须用 camelCase 风格": "自定义事件名必须用 camelCase 风格"
}

0 comments on commit 0cfc621

Please sign in to comment.