eslint-config-zls
Advanced tools
Comparing version 0.0.1 to 0.1.0
17
base.js
@@ -5,3 +5,2 @@ /** | ||
* babel-eslint ^10.1.0 | ||
* eslint-plugin-react ^7.21.4 | ||
* vue-eslint-parser ^7.1.1 | ||
@@ -40,2 +39,16 @@ * eslint-plugin-vue ^6.2.2 | ||
/** | ||
* 分号结尾 | ||
*/ | ||
'semi': [2, 'always'], | ||
/** | ||
* 字符串使用单引号或反引号 | ||
*/ | ||
'quotes': [ | ||
2, | ||
'single', | ||
{ | ||
'allowTemplateLiterals': true | ||
} | ||
], | ||
/** | ||
* setter 必须有对应的 getter,getter 可以没有对应的 setter | ||
@@ -818,3 +831,3 @@ */ | ||
*/ | ||
'prefer-const': 'off', | ||
'prefer-const': 'warn', | ||
/** | ||
@@ -821,0 +834,0 @@ * 必须使用解构赋值 |
{ | ||
"name": "eslint-config-zls", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# eslint-config | ||
## 使用方法 | ||
```bash | ||
npm install --save-dev eslint babel-eslint vue-eslint-parser eslint-plugin-vue eslint-config-zls | ||
``` | ||
在你的项目的根目录下创建一个 `.eslintrc.js` 文件,并将以下内容复制进去: | ||
```js | ||
module.exports = { | ||
extends: [ | ||
'zls', | ||
'zls/vue', | ||
], | ||
rules: { | ||
// 自定义规则 | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', | ||
}, | ||
}; | ||
``` |
32
vue.js
@@ -5,3 +5,2 @@ /** | ||
* babel-eslint ^10.1.0 | ||
* eslint-plugin-react ^7.21.4 | ||
* vue-eslint-parser ^7.1.1 | ||
@@ -36,9 +35,32 @@ * eslint-plugin-vue ^6.2.2 | ||
/** | ||
* HTML 属性的引号样式 | ||
*/ | ||
"vue/html-quotes": ["error", "double", { "avoidEscape": true }], | ||
/** | ||
* 限制组件名的风格 | ||
*/ | ||
"vue/component-name-in-template-casing": ["error", "kebab-case", { | ||
"registeredComponentsOnly": false, | ||
"ignores": [] | ||
}], | ||
/** | ||
* 强制执行自闭式 | ||
*/ | ||
"vue/html-self-closing": ["error", { | ||
"html": { | ||
"void": "never", | ||
"normal": "always", | ||
"component": "always" | ||
}, | ||
"svg": "always", | ||
"math": "always" | ||
}], | ||
/** | ||
* 限制自定义组件的属性风格 | ||
*/ | ||
'vue/attribute-hyphenation': 'off', | ||
'vue/attribute-hyphenation': 'warn', | ||
/** | ||
* 标签属性必须按规则排序 | ||
*/ | ||
'vue/attributes-order': 'error', | ||
'vue/attributes-order': 'warn', | ||
/** | ||
@@ -59,6 +81,2 @@ * 变量名必须是 camelcase 风格的 | ||
/** | ||
* 限制组件名的风格 | ||
*/ | ||
'vue/component-name-in-template-casing': 'off', | ||
/** | ||
* 组件中必须按照 <script>, <template>, <style> 排序 | ||
@@ -65,0 +83,0 @@ * @reason 这是官方建议的顺序 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53583
1888
24