feat: 新增.stylelintignore、新增prettier-vscode格式化代码配置
This commit is contained in:
parent
221194eecc
commit
2f70379463
@ -37,6 +37,8 @@ module.exports = {
|
|||||||
* "error" 或 2 ==> 规则作为一个错误(代码不能执行,界面报错)
|
* "error" 或 2 ==> 规则作为一个错误(代码不能执行,界面报错)
|
||||||
*/
|
*/
|
||||||
rules: {
|
rules: {
|
||||||
|
// 3. 注意要加上这一句,开启 prettier 自动修复的功能
|
||||||
|
"prettier/prettier": "error",
|
||||||
// 配置:
|
// 配置:
|
||||||
// eslint (http://eslint.cn/docs/rules)
|
// eslint (http://eslint.cn/docs/rules)
|
||||||
"no-var": "error", // 要求使用 let 或 const 而不是 var
|
"no-var": "error", // 要求使用 let 或 const 而不是 var
|
||||||
@ -44,9 +46,6 @@ module.exports = {
|
|||||||
"prefer-const": "off", // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
|
"prefer-const": "off", // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
|
||||||
"no-use-before-define": "off", // 禁止在 函数/类/变量 定义之前使用它们
|
"no-use-before-define": "off", // 禁止在 函数/类/变量 定义之前使用它们
|
||||||
|
|
||||||
// 3. 注意要加上这一句,开启 prettier 自动修复的功能
|
|
||||||
"prettier/prettier": "error",
|
|
||||||
|
|
||||||
// typeScript (https://typescript-eslint.io/rules)
|
// typeScript (https://typescript-eslint.io/rules)
|
||||||
"@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量
|
"@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量
|
||||||
"@typescript-eslint/no-empty-function": "error", // 禁止空函数
|
"@typescript-eslint/no-empty-function": "error", // 禁止空函数
|
||||||
|
|||||||
@ -12,29 +12,29 @@ module.exports = {
|
|||||||
// 使用单引号 (true:单引号,false:双引号)
|
// 使用单引号 (true:单引号,false:双引号)
|
||||||
singleQuote: false,
|
singleQuote: false,
|
||||||
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
|
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
|
||||||
quoteProps: "as-needed",
|
quoteProps: 'as-needed',
|
||||||
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
|
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
|
||||||
jsxSingleQuote: false,
|
jsxSingleQuote: false,
|
||||||
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
|
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
|
||||||
trailingComma: "none",
|
trailingComma: 'none',
|
||||||
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
|
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
|
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
|
||||||
bracketSameLine: false,
|
bracketSameLine: false,
|
||||||
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
|
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
|
||||||
arrowParens: "avoid",
|
arrowParens: 'avoid',
|
||||||
// 指定要使用的解析器,不需要写文件开头的 @prettier
|
// 指定要使用的解析器,不需要写文件开头的 @prettier
|
||||||
requirePragma: false,
|
requirePragma: false,
|
||||||
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
|
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
|
||||||
insertPragma: false,
|
insertPragma: false,
|
||||||
// 用于控制文本是否应该被换行以及如何进行换行
|
// 用于控制文本是否应该被换行以及如何进行换行
|
||||||
proseWrap: "preserve",
|
proseWrap: 'preserve',
|
||||||
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
|
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
|
||||||
htmlWhitespaceSensitivity: "css",
|
htmlWhitespaceSensitivity: 'css',
|
||||||
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
|
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
|
||||||
vueIndentScriptAndStyle: false,
|
vueIndentScriptAndStyle: false,
|
||||||
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
|
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
|
||||||
endOfLine: "auto",
|
endOfLine: 'auto',
|
||||||
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
|
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
|
||||||
rangeStart: 0,
|
rangeStart: 0,
|
||||||
rangeEnd: Infinity
|
rangeEnd: Infinity
|
||||||
|
|||||||
4
.stylelintignore
Normal file
4
.stylelintignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/dist/*
|
||||||
|
/public/*
|
||||||
|
public/*
|
||||||
|
stats.html
|
||||||
2
.vscode/extensions.json
vendored
2
.vscode/extensions.json
vendored
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"recommendations": ["Vue.volar"]
|
"recommendations": ["vue.volar"]
|
||||||
}
|
}
|
||||||
|
|||||||
34
.vscode/settings.json
vendored
34
.vscode/settings.json
vendored
@ -1,10 +1,40 @@
|
|||||||
{
|
{
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.stylelint": true
|
"source.fixAll.stylelint": "explicit"
|
||||||
},
|
},
|
||||||
"stylelint.enable": true,
|
"stylelint.enable": true,
|
||||||
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass", "html"],
|
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass", "html"],
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
"marscode.chatLanguage": "cn"
|
"marscode.chatLanguage": "cn",
|
||||||
|
"[vue]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[json]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[jsonc]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[typescriptreact]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[scss]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[html]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[markdown]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[less]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user