Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-operation-4
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
达摩4.0重构
haoban-operation-4
Commits
be67b6e1
Commit
be67b6e1
authored
Aug 17, 2020
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 配置eslint,实现强制控制变量名称使用小驼峰命名、缩进、空格、分号、JSDoc注释规范等
parent
8883d0ac
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
14 deletions
+59
-14
.eslintignore
.eslintignore
+1
-1
.eslintrc.js
.eslintrc.js
+58
-13
No files found.
.eslintignore
View file @
be67b6e1
!/src
!/src
/src/
imag
es
/src/
styl
es
/dist/
/dist/
/*.js
/*.js
src/assets
src/assets
...
...
.eslintrc.js
View file @
be67b6e1
...
@@ -143,26 +143,24 @@ module.exports = {
...
@@ -143,26 +143,24 @@ module.exports = {
// ----------------------------------------------------代码规范----------------------------------------------------------
// ----------------------------------------------------代码规范----------------------------------------------------------
/**
/**
* 代码规范
* 代码规范
* 有关【空格】、【链式换行】、【缩进】、【=、{}、()、首位空格】规范没有添加,怕大家一时间接受不了,目前所挑选的规则都是:保障我们的代码可读性、可维护性的
* */
* */
// 变量名必须是 camelcase 驼峰风格的
// 变量名必须是 camelcase 驼峰风格的
// @off 【涉及到 很多 api 或文件名可能都不是 camelcase 先关闭】
camelcase
:
[
2
,
{
"properties"
:
"always"
}],
camelcase
:
0
,
// @fixable 禁止在行首写逗号
// @fixable 禁止在行首写逗号
"comma-style"
:
[
2
,
"last"
],
"comma-style"
:
[
2
,
"last"
],
// @fixable 一个缩进必须用两个空格替代
// @fixable 一个缩进必须用两个空格替代
// @off 【不限制大家,为了关闭eslint默认值,所以手动关闭,off不可去掉】 讨论
// @off 【不限制大家,为了关闭eslint默认值,所以手动关闭,off不可去掉】 讨论
indent
:
[
2
,
2
,{
"SwitchCase"
:
1
}],
indent
:
[
2
,
2
,{
"SwitchCase"
:
1
}],
//@off 手动关闭//前面需要
回车的规则
注释
//@off 手动关闭//前面需要
空格
注释
"spaced-comment"
:
0
,
"spaced-comment"
:
2
,
//@off 手动关闭: 禁用行尾空白
//@off 手动关闭: 禁用行尾空白
"no-trailing-spaces"
:
2
,
"no-trailing-spaces"
:
2
,
//@off 手动关闭: 不允许多行回车
//@off 手动关闭: 不允许多行回车
"no-multiple-empty-lines"
:
1
,
"no-multiple-empty-lines"
:
1
,
//@off 手动关闭: 逗号前必须加空格
//@off 手动关闭: 逗号前必须加空格
"comma-spacing"
:
0
,
"comma-spacing"
:
2
,
//@off 手动关闭: 冒号后必须加空格
//@off 手动关闭: 冒号后必须加空格
"key-spacing"
:
1
,
"key-spacing"
:
2
,
// @fixable 结尾禁止使用分号
// @fixable 结尾禁止使用分号
//@off [vue官方推荐无分号,不知道大家是否可以接受?先手动off掉] 讨论
//@off [vue官方推荐无分号,不知道大家是否可以接受?先手动off掉] 讨论
// "semi": [2,"never"],
// "semi": [2,"never"],
...
@@ -200,6 +198,57 @@ module.exports = {
...
@@ -200,6 +198,57 @@ module.exports = {
eqeqeq
:
0
,
eqeqeq
:
0
,
//this别名
//this别名
"consistent-this"
:
[
2
,
"that"
],
"consistent-this"
:
[
2
,
"that"
],
//强制使用一致的反勾号、双引号或单引号 (quotes) 关闭
quotes
:
[
2
,
"single"
],
"array-bracket-spacing"
:
[
2
,
"always"
],
//[后 ]前必须有一个空格
"object-curly-spacing"
:
[
2
,
"always"
],
//{后 }前必须有一个空格
"space-before-function-paren"
:
[
2
,
"never"
],
//函数圆括号之前无空格
"space-infix-ops"
:
2
,
"semi"
:
[
2
,
"always"
],
//语句强制分号结尾
"valid-jsdoc"
:
[
"error"
,
{
"requireReturn"
:
false
,
"requireParamDescription"
:
false
,
"requireReturnDescription"
:
false
}],
//强制JSDoc注释
"vue/order-in-components"
:
[
"error"
,
{
"order"
:
[
"el"
,
"name"
,
"key"
,
"parent"
,
"functional"
,
[
"delimiters"
,
"comments"
],
[
"components"
,
"directives"
],
"extends"
,
"mixins"
,
[
"provide"
,
"inject"
],
"ROUTER_GUARDS"
,
"layout"
,
"middleware"
,
"validate"
,
"scrollToTop"
,
"transition"
,
"loading"
,
"inheritAttrs"
,
"model"
,
[
"props"
,
"propsData"
],
"emits"
,
"setup"
,
"asyncData"
,
"data"
,
"fetch"
,
"head"
,
"watchQuery"
,
"LIFECYCLE_HOOKS"
,
"methods"
,
"filters"
,
"computed"
,
"watch"
,
[
"template"
,
"render"
],
"renderError"
]
}],
// -----------------------------ECMAScript 6-------------------------------------
// -----------------------------ECMAScript 6-------------------------------------
/**
/**
* ECMAScript 6
* ECMAScript 6
...
@@ -215,15 +264,11 @@ module.exports = {
...
@@ -215,15 +264,11 @@ module.exports = {
"no-dupe-class-members"
:
2
,
"no-dupe-class-members"
:
2
,
// 禁止重复 import 模块
// 禁止重复 import 模块
"no-duplicate-imports"
:
2
,
"no-duplicate-imports"
:
2
,
//@off
以后可能会开启
禁止 var
//@off 禁止 var
"no-var"
:
0
,
"no-var"
:
2
,
// ---------------------------------被关闭的规则-----------------------
// ---------------------------------被关闭的规则-----------------------
// parseInt必须指定第二个参数 parseInt("071",10);
// parseInt必须指定第二个参数 parseInt("071",10);
radix
:
0
,
radix
:
0
,
//强制使用一致的反勾号、双引号或单引号 (quotes) 关闭
quotes
:
[
1
,
"single"
],
//要求或禁止函数圆括号之前有一个空格
"space-before-function-paren"
:
[
0
,
"always"
],
//禁止或强制圆括号内的空格
//禁止或强制圆括号内的空格
"space-in-parens"
:
[
0
,
"never"
],
"space-in-parens"
:
[
0
,
"never"
],
//关键字后面是否要空一格
//关键字后面是否要空一格
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment