Skip to content

Commit c45a087

Browse files
微信公众号:储凡mmdapl
andauthored
feat: 升级@antfu/eslint-config到最新版本,新增lint相关命令,删除重复的lint脚本 (#159)
Co-authored-by: chufan <mmdapl@163.com>
1 parent 298d112 commit c45a087

File tree

10 files changed

+325
-495
lines changed

10 files changed

+325
-495
lines changed

.github/workflows/CI.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
6565
# - name: Code LintFix
6666
# run: |
67-
# ./scripts/lint
67+
# pnpm lint
6868

6969
- name: Build Site
7070
run: |

docs/.vuepress/styles/index.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
--code-ln-wrapper-width: 3.5rem;
6464

6565
// font vars
66-
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
67-
Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
66+
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans',
67+
'Droid Sans', 'Helvetica Neue', sans-serif;
6868
--font-family-code: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
6969

7070
// layout vars

docs/.vuepress/theme/headers.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ export const headers: HeadConfig[] = [
1414
[
1515
'script',
1616
{},
17-
`
18-
var _hmt = _hmt || [];
19-
(function() {
20-
var hm = document.createElement("script");
21-
hm.src = "https://hm.baidu.com/hm.js?613c9d7af9e1c9a7f9eef6a55aa2399d";
22-
var s = document.getElementsByTagName("script")[0];
23-
s.parentNode.insertBefore(hm, s);
24-
})();`,
17+
`var _hmt = _hmt || [];
18+
(function() {
19+
var hm = document.createElement("script");
20+
hm.src = "https://hm.baidu.com/hm.js?613c9d7af9e1c9a7f9eef6a55aa2399d";
21+
var s = document.getElementsByTagName("script")[0];
22+
s.parentNode.insertBefore(hm, s);
23+
})();`,
2524
],
2625
]

docs/read-books/cs-books/ES6标准入门.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ JavaScript 语言存在一个顶层对象,它提供全局环境(即全局作
540540
(typeof window !== 'undefined'
541541
? window
542542
: (typeof process === 'object'
543-
&& typeof require === 'function'
544-
&& typeof global === 'object')
543+
&& typeof require === 'function'
544+
&& typeof global === 'object')
545545
? global
546546
: this)
547547

@@ -1166,7 +1166,7 @@ $('#result').append(`
11661166
`In JavaScript '\n' is a line-feed.`
11671167

11681168
// 多行字符串
1169-
`In JavaScript this is
1169+
`In JavaScript this is
11701170
not legal.`
11711171

11721172
console.log(`string text line 1
@@ -1222,7 +1222,7 @@ const y = 2;
12221222
`${x} + ${y} = ${x + y}`
12231223
// "1 + 2 = 3"
12241224

1225-
`${x} + ${y * 2} = ${x + y * 2}`
1225+
`${x} + ${y * 2} = ${x + y * 2}`
12261226
// "1 + 4 = 5"
12271227

12281228
// 定义对象

docs/server-end/design-patterns/技巧型模式/简单模板模式.md

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ permalink: /server-end/design-patterns/simple-template-mode.html
119119
;(function () {
120120
const container = document.getElementById('root')
121121
const formatString = function (str, data) {
122-
return str.replace(/\{\{(\w+)\}\}/g, (match, key) =>
123-
data[key] === void 0 ? '' : data[key],
124-
)
122+
return str.replace(/\{\{(\w+)\}\}/g, (match, key) => (data[key] === void 0 ? '' : data[key]))
125123
}
126124
const list = [
127125
{
@@ -140,9 +138,7 @@ permalink: /server-end/design-patterns/simple-template-mode.html
140138
let template = ['<ul>']
141139
list.forEach((v) => {
142140
template.push('<li>')
143-
template.push(
144-
formatString('<a href="{{url}}" target="_blank" >{{name}}</a>', v),
145-
)
141+
template.push(formatString('<a href="{{url}}" target="_blank" >{{name}}</a>', v))
146142
template.push('</li>')
147143
})
148144
template.push('</ul>')
@@ -187,9 +183,7 @@ permalink: /server-end/design-patterns/simple-template-mode.html
187183
return value.replace('{{', '"+(').replace('}}', ')+"')
188184
})
189185
html = `var targetHTML = "${html}";return targetHTML;`
190-
var parsedHTML = new Function(...Object.keys(data), html)(
191-
...Object.values(data),
192-
)
186+
var parsedHTML = new Function(...Object.keys(data), html)(...Object.values(data))
193187
element.innerHTML = parsedHTML
194188
}
195189
@@ -233,18 +227,13 @@ permalink: /server-end/design-patterns/simple-template-mode.html
233227
if (root.nodeName === '#text') {
234228
node.type = 'text'
235229
node.tagName = 'text'
236-
node.content = root.textContent
237-
.replace(/\s+|\r|\t|\n/g, ' ')
238-
.replace(/"/g, '\\"')
230+
node.content = root.textContent.replace(/\s+|\r|\t|\n/g, ' ').replace(/"/g, '\\"')
239231
} else {
240232
node.type = 'tag'
241233
node.tagName = root.localName
242234
node.children = []
243235
node.attr = {}
244-
Array.prototype.forEach.call(
245-
root.attributes,
246-
(item) => (node.attr[item.nodeName] = item.nodeValue),
247-
)
236+
Array.prototype.forEach.call(root.attributes, (item) => (node.attr[item.nodeName] = item.nodeValue))
248237
}
249238
Array.prototype.forEach.call(root.childNodes, (element) => {
250239
var parsedNode = parseAST(element)
@@ -256,9 +245,7 @@ permalink: /server-end/design-patterns/simple-template-mode.html
256245
257246
function render(element, template, data) {
258247
html = `var targetHTML = "${template}";return targetHTML;`
259-
var parsedHTML = new Function(...Object.keys(data), html)(
260-
...Object.values(data),
261-
)
248+
var parsedHTML = new Function(...Object.keys(data), html)(...Object.values(data))
262249
element.innerHTML = parsedHTML
263250
}
264251
@@ -271,12 +258,9 @@ permalink: /server-end/design-patterns/simple-template-mode.html
271258
template += `</${node.tagName}>`
272259
} else {
273260
if (node.content.match(/\{\{(.)*?\}\}/)) {
274-
var expression = node.content.replace(
275-
/\{\{(.)*?\}\}/g,
276-
function (value) {
277-
return value.replace('{{', '"+(').replace('}}', ')+"')
278-
},
279-
)
261+
var expression = node.content.replace(/\{\{(.)*?\}\}/g, function (value) {
262+
return value.replace('{{', '"+(').replace('}}', ')+"')
263+
})
280264
template += expression
281265
} else {
282266
template += node.content

0 commit comments

Comments
 (0)