chore(lint): add lint
This commit is contained in:
parent
a25c956424
commit
af8f0487cb
|
@ -0,0 +1,12 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
|
@ -0,0 +1,39 @@
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2021: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
extends: ['eslint:recommended', '@vue/eslint-config-prettier'],
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2021,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
uni: 'readonly',
|
||||||
|
wx: 'readonly',
|
||||||
|
plus: 'readonly',
|
||||||
|
getCurrentPages: 'readonly',
|
||||||
|
getApp: 'readonly',
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// Vue规则
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
'vue/no-unused-vars': 'error',
|
||||||
|
'vue/valid-v-for': 'error',
|
||||||
|
'vue/require-v-for-key': 'error',
|
||||||
|
'vue/no-deprecated-filter': 'error',
|
||||||
|
|
||||||
|
// JavaScript规则
|
||||||
|
'no-unused-vars': 'warn',
|
||||||
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
|
|
||||||
|
// 代码风格
|
||||||
|
semi: ['error', 'never'],
|
||||||
|
quotes: ['error', 'single'],
|
||||||
|
'comma-dangle': ['error', 'only-multiline'],
|
||||||
|
indent: ['error', 2],
|
||||||
|
'eol-last': ['error', 'always'],
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": true,
|
||||||
|
"source.organizeImports": true
|
||||||
|
},
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"[vue]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[json]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"eslint.validate": ["javascript", "vue"],
|
||||||
|
"prettier.requireConfig": true,
|
||||||
|
"editor.tabSize": 2,
|
||||||
|
"editor.insertSpaces": true,
|
||||||
|
"files.eol": "\n",
|
||||||
|
"files.insertFinalNewline": true,
|
||||||
|
"files.trimTrailingWhitespace": true
|
||||||
|
}
|
Loading…
Reference in New Issue