Skip to content

Commit

Permalink
Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Feb 13, 2020
1 parent 0ace40e commit 127879a
Show file tree
Hide file tree
Showing 162 changed files with 6,472 additions and 7,052 deletions.
Empty file modified .editorconfig
100755 → 100644
Empty file.
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ static/*.js
.nuxt/*.js
.nuxt/*.vue

utils/underscore-simple.js
utils/scroll-to-anywhere.ts

plugins/ga.js
plugins/webrtc.js
plugins/copy-right.js
plugins/baidu-seo-push.js
106 changes: 47 additions & 59 deletions .eslintrc.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ module.exports = {
browser: true,
node: true
},
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'plugin:vue/recommended',
// 'plugin:prettier/recommended'
'@nuxtjs/eslint-config-typescript',
'prettier',
'prettier/vue',
'plugin:prettier/recommended',
'plugin:nuxt/recommended'
],
// https:// github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
plugins: [
'html',
'vue',
// 'prettier'
'prettier'
],
globals: {
Set: true,
Expand All @@ -37,19 +34,48 @@ module.exports = {
FaceDetector: true,
requestAnimFrame: true,
},
// add your custom rules here
rules: {
// Typescript eslint
'@typescript-eslint/no-unused-vars': 'off',

// prettier 配置
// 需要时再打开为 warn 吧
"prettier/prettier": ['off', {
"semi": false,
"arrowParens": "avoid",
"singleQuote": true,
"tabWidth": 2,
// 禁用代码长度检测
"preserve": "preserve",
"useTabs": false,
"vueIndentScriptAndStyle": true
}],

// "prettier/prettier": "error",
// import 语句顺序
'import/order': 'off',

// Vue 相关
'vue/no-unused-components': 'warn',
'vue/no-v-html': 'off',
'vue/require-default-prop': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/order-in-components': 'off',
'vue/html-self-closing': ["error",{
"html": {
"void": "never",
"normal": "any",
"component": "any"
},
"svg": "always",
"math": "always"
}],

/*Possible Errors*/

// 数组和对象键值对最后一个逗号,

// never参数:不能带末尾的逗号,

// always参数:必须带末尾的逗号,

// always-multiline:多行模式必须带逗号,单行模式不能带逗号
"comma-dangle": [0, "never"],

Expand Down Expand Up @@ -154,42 +180,28 @@ module.exports = {
"consistent-return": 0,

// if else while for do后面的代码块是否需要{ }包围,参数:

// multi 只有块中有多行语句时才需要{ }包围

// multi-line 只有块中有多行语句时才需要{ }包围, 但是块中的执行语句只有一行时,块中的语句只能跟和if语句在同一行。

// if (foo) foo++; else doSomething();

// multi-or-nest 只有块中有多行语句时才需要{ }包围, 如果块中的执行语句只有一行,执行语句可以另起一行也可以跟在if语句后面

// [2, "multi", "consistent"] 保持前后语句的{ }一致

// default: [2, "all"] 全都需要{ }包围
"curly": 0,

// 所有的switch语句都必须要有一个default分支
"default-case": 2,

// 在书写对象的属性或方法时,新的一行代码可以以. 开头,也可以以. 结束。

// 强制统一object.key中 . 的位置,参数:

// property,'.'号应与属性在同一行

// object, '.' 号应与对象名在同一行
"dot-location": [2, "property"],

// 强制使用.号取属性

// 参数: allowKeywords:true 使用保留字做属性名时,只能使用.方式取属性

// false 使用保留字做属性名时, 只能使用[]方式取属性

// e.g [2, {"allowKeywords": false}]

// allowPattern: 当属性名匹配提供的正则表达式时,允许使用[]方式取值,否则只能用.号取值

// e.g [2, {"allowPattern": "^[a-z]+(_[a-z]+)+$"}]
"dot-notation": [2, { "allowKeywords": true }],

Expand Down Expand Up @@ -370,7 +382,6 @@ module.exports = {
// 默认的规则要求,变量写在左边而字面量写在右边
"yoda": 2,


/*Strict Mode*/

// 使用严格模式
Expand All @@ -396,13 +407,13 @@ module.exports = {
// 禁止声明外部作用域中已定义的变量
"no-shadow": 0,

// 声明变量时禁止覆盖JavaScript中的一些保留关键字,比如NaN、Infinity、undefined、eval、arguments等。
// 声明变量时禁止覆盖 JavaScript 中的一些保留关键字,比如NaN、Infinity、undefined、eval、arguments等。
"no-shadow-restricted-names": 2,

// 禁止使用未被定义的变量,除非已在配置文件的global中进行了说明。
"no-undef": 2,

// 禁止初始化变量为undefined
// 禁止初始化变量为 undefined
"no-undef-init": 2,

// 禁止把undefined作为变量名
Expand All @@ -416,7 +427,6 @@ module.exports = {


/*Node.js and CommonJS*/

// 强制回调后return,避免多次调用回调
"callback-return": 0,

Expand Down Expand Up @@ -451,16 +461,12 @@ module.exports = {
/*Stylistic Issues*/

// 用数组字面量定义数组时数组元素前后是否加空格,

// never参数: 数组元素前后不能带空格,

// always参数:数组元素前后必须留空格
"array-bracket-spacing": [0, "never"],

// 在单行代码块中,代码块前后是否需要留空格

// always参数:默认,前后必须留空格

// never参数: 前后不能带空格
"block-spacing": [2, "always"],

Expand Down Expand Up @@ -493,17 +499,11 @@ module.exports = {
"func-names": 0,

// 在JavaScript中有两种方式定义函数:函数声明和函数表达式。

// 函数声明就是把function关键词写在最前面,后面跟一个函数名。我们可以在函数申明代码前调用函数

// 函数表达式是通过var等声明变量的关键字开头,然后跟函数名,再后面是function本身。在使用函数表达式定义函数前调用函数会报错

// 统一定义函数是所采用的方式,参数:

// declaration: 强制使用方法声明的方式,function f(){} e.g [2, "declaration"]

// expression:强制使用方法表达式的方式,默认方式,var f = function() {} e.g [2, "expression"]

// allowArrowFunctions: declaration风格中允许箭头函数。 e.g [2, "declaration", {"allowArrowFunctions":true}]
"func-style": [2, "expression"],

Expand Down Expand Up @@ -628,7 +628,8 @@ module.exports = {
"operator-assignment": [2, "always"],

// 在换行时操作符应该放在行首还是行尾。还可对某些操作符进行重写。
"operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }],
// "operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }],
"operator-linebreak": 0,

// 在代码块中,代码块的开始和结尾是否应该留一个空行
"padded-blocks": 0,
Expand All @@ -641,25 +642,16 @@ module.exports = {

// 注释格式要求JSDoc格式
"require-jsdoc": [0, {

"require": {

"FunctionDeclaration": true,

"MethodDefinition": false,

"ClassDeclaration": false

}

}],

// JavaScript不要求在每行末尾加上分号,这是因为JavaScript引擎会决定是否需要在行末加上分号,然后自动帮我们在行末加上分号,这一特性被成为ASI(automatic semicolon insertion),也是JavaScript语言最富争议的特性之一

// 尽管ASI允许我们使用更加自由的代码风格,但是它也可能使得你的代码并不是按你期许的方式运行

// 两个可选参数,always 和never

// 默认配置always,要求在行末加上分号。
"semi": [0, "always"],

Expand Down Expand Up @@ -700,13 +692,13 @@ module.exports = {

/*ECMAScript 6*/

// 箭头函数中,如果函数体里只有一句代码时可以省略大括号
"prefer-promise-reject-errors": 0,

// 箭头函数中,如果函数体里只有一句代码时可以省略大括号
// 规定是否可以省略大括号
"arrow-body-style": 0,

// 箭头函数中,只有一个参数时可以省略圆括号

// 规定了参数是否需要圆括号包围
"arrow-parens": [0, "always"],

Expand Down Expand Up @@ -736,9 +728,7 @@ module.exports = {

// 该规则可以定义不允许在应用中导入的模块
"no-restricted-imports": [0,

"assert", "buffer", "child_process", "cluster", "crypto", "dgram", "dns", "domain", "events", "freelist", "fs", "http", "https", "module", "net", "os", "path", "punycode", "querystring", "readline", "repl", "smalloc", "stream", "string_decoder", "sys", "timers", "tls", "tracing", "tty", "url", "util", "vm", "zlib"

"assert", "buffer", "child_process", "cluster", "crypto", "dgram", "dns", "domain", "events", "freelist", "fs", "http", "https", "module", "net", "os", "path", "punycode", "querystring", "readline", "repl", "smalloc", "stream", "string_decoder", "sys", "timers", "tls", "tracing", "tty", "url", "util", "vm", "zlib"
],

// 在构造函数中,禁止在super()调用前使用this/super对象
Expand All @@ -754,7 +744,6 @@ module.exports = {
"object-shorthand": 0,

// 函数作为函数的参数传入时,传入的函数需要是箭头函数

// 箭头函数中的this对象直接绑定到了其外面包围的函数的this对象。
"prefer-arrow-callback": 0,

Expand All @@ -781,6 +770,5 @@ module.exports = {

// yield*表达式中的*号前后是否留空格,默认after,比如yield* other()
"yield-star-spacing": [2, "after"],

}
}
3 changes: 3 additions & 0 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,6 @@ data/barrages.json
# analytics
static/scripts/analytics.js
/static/scripts/analytics.js

# Redis
dump.rdb
4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@

## CHANGELOG

### v2.5.0
- TypeScript
- Improve styles
- Improve About page
- Improve emoji-rain component
- Improve relink transformer
- Add QR Code service
- Add MyMap module
- Remove RTC module
- Remove ColorBlock component
- Refactoring Music service
- Refactoring Theme to dark mode

### v2.4.9
- Update FUNDING.yml
- Update README.md
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

## Screenshot

![](https://raw.githubusercontent.com/surmon-china/surmon.me/master/screenshots/pc-dark.png)
![](https://raw.githubusercontent.com/surmon-china/surmon.me/master/screenshots/pc.png)

## Development Setup

Expand Down
Loading

0 comments on commit 127879a

Please sign in to comment.