Skip to content

Commit

Permalink
update:update eslint and prettier
Browse files Browse the repository at this point in the history
推送远端前请先运行“npm run lint”进行代码语法检查
  • Loading branch information
mason369 committed Dec 2, 2022
1 parent bb96c44 commit 7343c3e
Show file tree
Hide file tree
Showing 2,368 changed files with 4,239 additions and 3,979 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# /node_modules/* and /bower_components/* ignored by default

# Ignore built files except build/index.js
build/*
!build/index.js
90 changes: 90 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
module.exports = {
root: true,
env : {
browser: true,
node : true,
es2021 : true,
es6 : true
},
extends: ["plugin:vue/essential"],

plugins: ["@typescript-eslint"],

parserOptions: { parser: "babel-eslint" },
plugins : ["vue"],
// 在此处添加自定义规则
rules : {
eqeqeq: "off", // 要求使用 `===` 和 `!==`

curly: "error", // 强制所有控制语句使用一致的括号风格

quotes: ["error", "double"], // 引号

"arrow-parens": 0, // allow paren-less arrow functions

"generator-star-spacing": 0, // allow async-await

"no-unused-vars": "error", // disabled no ununsed var `V1.1`

"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", // no use debugger in production

indent: [2, 4, { SwitchCase: 1 }], // 4 space for tab for perttier

"space-before-function-paren": ["error", "never"], // no space in function name for perttier

// # Possible Errors
//
"no-constant-condition": ["warn"],

// 允许 if(...){带有花括号的空代码}
"no-empty": ["off"],

// 数组, 对象 逗号后面强制一空格
"comma-spacing": ["error", { after: true }],

// 对象单行 多行对齐模式
"key-spacing": [
"error",
{
singleLine: {},
multiLine : { align: "colon" }
}
],

// # Best Practices
// 对象换行策略 , 如果多行, `{`和`}` 前后不能跟值
"object-curly-newline" : ["error", { multiline: true }],
"array-bracket-newline": ["error", { multiline: true }],

// if后面强制花括号
curly: ["error", "all"],

// # Strict Mode
// # Variables
"no-unused-vars": ["warn"],

// # Stylistic Issues

quotes : ["error", "double"],
indent : ["error", "tab"],
"linebreak-style": ["error", "windows"],

// if else try catch 换行
"brace-style": ["error", "stroustrup", { allowSingleLine: false }],

// 操作符周围前后必须空格
"space-infix-ops": ["error"],

// 提醒尾逗号 , 微信浏览器 , uc浏览器的问题
"comma-dangle": ["warn", "never"]
// # ECMAScript 6
// # Deprecated
// # Removed
},
overrides: [
{
files: ["*.vue"],
rules: { "vue/multi-word-component-names": 0 }
}
]
};
2,379 changes: 2,374 additions & 5 deletions .idea/workspace.xml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/dist/*
.local
.output.js
/node_modules/**

**/*.svg
**/*.sh

/public/*
41 changes: 33 additions & 8 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
{
"semi": true,
"printWidth": 120,
"tabWidth": 4,
"singleQuote": false,
"arrowParens": "always",
"trailingComma": "all"
}
module.exports = {
"printWidth": 100, // 设置prettier单行输出(不折行)的(最大)长度

"tabWidth": 8, // 设置工具每一个水平缩进的空格数

"useTabs": true, // 使用tab(制表位)缩进而非空格

"semi": false, // 在语句末尾添加分号

"singleQuote": false, // 使用单引号而非双引号

"trailingComma": "none", // 在任何可能的多行中输入尾逗号

"bracketSpacing": true, // 在对象字面量声明所使用的的花括号后({)和前(})输出空格

"arrowParens": "avoid", // 为单行箭头函数的参数添加圆括号,参数个数为1时可以省略圆括号

// parser: 'babylon', // 指定使用哪一种解析器

"jsxBracketSameLine": true, // 在多行JSX元素最后一行的末尾添加 > 而使 > 单独一行(不适用于自闭和元素)

"rangeStart": 0, // 只格式化某个文件的一部分

"rangeEnd": "Infinity", // 只格式化某个文件的一部分

"filepath": "none", // 指定文件的输入路径,这将被用于解析器参照

"requirePragma": false, // (v1.7.0+) Prettier可以严格按照按照文件顶部的一些特殊的注释格式化代码,这些注释称为“require pragma”(必须杂注)

"insertPragma": false, // (v1.8.0+) Prettier可以在文件的顶部插入一个 @format的特殊注释,以表明改文件已经被Prettier格式化过了。

"proseWrap": "preserve", // (v1.8.2+)
};
20 changes: 10 additions & 10 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
plugins: [
[
"component",
{
libraryName: "element-ui",
styleLibraryName: "theme-chalk",
},
],
],
presets: ["@vue/cli-plugin-babel/preset"],
plugins: [
[
"component",
{
libraryName : "element-ui",
styleLibraryName: "theme-chalk"
}
]
]
};

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7343c3e

Please sign in to comment.