Skip to content

Commit 7a54ee2

Browse files
committed
feat: add lint
1 parent 1853807 commit 7a54ee2

File tree

5 files changed

+128
-0
lines changed

5 files changed

+128
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 规划内容
2+
3+
* typescript
4+
5+
* node
6+
7+
* webpack
8+
9+
* react
10+
11+
* CI/CD
12+
13+
* leetcode

leetcode/Arry&Link/maxArea.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @param {number[]} height
3+
* @return {number}
4+
*/
5+
var maxArea = function(height) {
6+
let num = -Infinity
7+
return num
8+
};

leetcode/readme.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# vscode 刷题 https://juejin.cn/post/6844904105782018055
2+
3+
# 1. 数组、链表、跳表
4+
5+
* Array
6+
7+
• https://leetcode-cn.com/problems/container-with-most-water/
8+
• https://leetcode-cn.com/problems/move-zeroes/
9+
• https://leetcode.com/problems/climbing-stairs/
10+
• https://leetcode-cn.com/problems/3sum/
11+
12+
* Linked List
13+
14+
• https://leetcode.com/problems/reverse-linked-list/
15+
• https://leetcode.com/problems/swap-nodes-in-pairs
16+
• https://leetcode.com/problems/linked-list-cycle
17+
• https://leetcode.com/problems/linked-list-cycle-ii
18+
• https://leetcode.com/problems/reverse-nodes-in-k-group/
19+
20+
* test
21+
22+
• https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
23+
• https://leetcode-cn.com/problems/rotate-array/
24+
• https://leetcode-cn.com/problems/merge-two-sorted-lists/
25+
• https://leetcode-cn.com/problems/merge-sorted-array/
26+
• https://leetcode-cn.com/problems/two-sum/
27+
• https://leetcode-cn.com/problems/move-zeroes/
28+
• https://leetcode-cn.com/problems/plus-one/

lint/readme.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# eslint
2+
3+
## 功能
4+
5+
eslint(包括其他一些 lint 工具)的主要功能包含代码格式的校验,代码质量的校验
6+
7+
## 使用方式
8+
9+
1. 编译器
10+
2. webpack
11+
3. 命令行
12+
13+
* rc配置
14+
- parser 指定解析器
15+
- ESLint 默认使用Espree作为其解析器
16+
* rc 的配置可以来源于三处,按优先级排列
17+
18+
- 项目rc
19+
- package.json
20+
- 根目录rc
21+
22+
* 编译器
23+
1. 安装插件
24+
2. 该扩展使用安装在打开的工作区文件夹中的 ESLint 库 & eslintrc
25+
3. Visual Studio Code Settings
26+
- eslint.validate(默认只校验js)
27+
- 错误修复 editor.codeActionsOnSave
28+
- 状态栏中显示eslint "eslint.alwaysShowStatus": true
29+
- 状态栏不显示警告信息 "eslint.quiet": true
30+
31+
<!-- https://github.com/microsoft/vscode-eslint#settings-migration -->
32+
33+
# 集成Prettier
34+
35+
## 功能
36+
37+
只是代码格式的校验(并格式化代码),不会对代码质量进行校验
38+
39+
* Prettier 的配置可以来源于三处,按优先级排列
40+
1. Prettier configuration file
41+
2. editorconfig
42+
3. Visual Studio Code Settings
43+
* 集成方式
44+
1. prettier 规则对 eslint 规则的进行覆盖
45+
46+
```
47+
48+
``` JS
49+
// JavaScript
50+
{
51+
"extends": [
52+
...,
53+
"已经配置的规则",
54+
"plugin:prettier/recommended"
55+
]
56+
}
57+
```
58+
59+
# 限制提交
60+
61+
1. husky - 对所有提交对内容进行校验
62+
2. lint-staged - 对修改对内容
63+
64+
```
65+
// package.json
66+
67+
"husky": {
68+
"hooks": {
69+
"pre-commit": "lint-staged"
70+
}
71+
},
72+
"lint-staged": {
73+
// src 目录下任意文件有改动,都使用 prettier --write 格式化之后再提交
74+
"src/**/*.*": [
75+
"prettier --write",
76+
"git add"
77+
]
78+
}
79+
```

spa/README.md

Whitespace-only changes.

0 commit comments

Comments
 (0)