Skip to content

Commit 0e8aab5

Browse files
authored
Merge pull request #52 from ccagml/main
重构
2 parents 9c19a55 + cf65db6 commit 0e8aab5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+12070
-9410
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/*

.eslintrc.js

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
module.exports = {
2+
'env': {
3+
'browser': true,
4+
'es2020': true,
5+
'node': true
6+
},
7+
'extends': [
8+
'eslint:recommended',
9+
'plugin:@typescript-eslint/recommended'
10+
],
11+
'parser': '@typescript-eslint/parser',
12+
'parserOptions': {
13+
'ecmaVersion': 6,
14+
'sourceType': 'module'
15+
// 'project': './tsconfig.json',
16+
},
17+
'plugins': [
18+
'@typescript-eslint'
19+
],
20+
21+
/**
22+
* 规则写法
23+
* 1、'quotes': 0; -- 0关闭,1警告,2错误
24+
* 2、'quotes': 'off'; -- off关闭,warn警告,error错误
25+
* 3、'quotes': ['error', 'single']; 'error'是提示类型,'single'是参数。参数不止一个的时候写成{}
26+
*/
27+
'rules': {
28+
// 是否检查变量已申明但未使用:警告。
29+
'@typescript-eslint/no-unused-vars': ['warn'],
30+
// 强制单引号:开启,自动修正
31+
'quotes': 0,
32+
// 强制分号:js 关闭,ts 强制分号。
33+
'semi': ['off'],
34+
// 'semi': ['off'],
35+
// 定义变量时自动类型推断:关闭
36+
'@typescript-eslint/no-inferrable-types': ['off'],
37+
// 强制const:关闭
38+
'prefer-const': ['off'],
39+
// 不允许空函数:关闭
40+
'@typescript-eslint/no-empty-function': ['off'],
41+
// 禁止特定类型:关闭。 PS:如果打开 Function 类型会报错
42+
'@typescript-eslint/ban-types': ['off'],
43+
// 禁止多余的分号:关闭。 PS:打开后,某些大括号结束加分号会报错
44+
'@typescript-eslint/no-extra-semi': ['off'],
45+
// 检查函数是否有返回值:警告。 PS:有些老代码没有返回值,历史包袱重,暂时不强制报错
46+
'@typescript-eslint/explicit-module-boundary-types': ['warn'],
47+
// 禁止给变量赋值为 this:关闭。
48+
'@typescript-eslint/no-this-alias': ['off'],
49+
// 禁止使用 requires:关闭。
50+
'@typescript-eslint/no-var-requires': ['off'],
51+
// 检测无法访问的代码:关闭。 PS:有时候需要用 return 注释掉后面的代码
52+
'no-unreachable': ['off'],
53+
/**
54+
* 是否可以直接调用对象方法:关闭。
55+
* PS:暂时关闭。目前写法:myObject.hasOwnProperty('name') ,推荐写法:Object.prototype.hasOwnProperty.call(foo, "bar")
56+
*/
57+
'no-prototype-builtins': ['off'],
58+
// 是否允许函数内定义函数:关闭。
59+
'no-inner-declarations': ['off'],
60+
// 不允许判断条件写死:关闭。 PS:打开后,if(false){} 这种判断语句会报错
61+
'no-constant-condition': ['off'],
62+
// get 和 set 是否必须放在一起:关闭。
63+
'@typescript-eslint/adjacent-overload-signatures': ['off'],
64+
"no-async-promise-executor": ['off']
65+
},
66+
// 如果有 js 和 ts 需要分开指定的规则,就 js 写 rules 里,ts 写 overrides 里
67+
'overrides': [{
68+
// enable the rule specifically for TypeScript files
69+
'files': ['*.ts', '*.tsx'],
70+
'rules': {
71+
// 强制分号:开启,自动修正
72+
'semi': ['error', 'always'],
73+
// '@typescript-eslint/explicit-module-boundary-types': ['error']
74+
}
75+
}],
76+
// 定义全局变量
77+
'globals': {
78+
'Global': true
79+
}
80+
};

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## version 2.0.0
2+
- 重构
3+
- 现在会从[zerotrac.github.io](https://zerotrac.github.io/leetcode_problem_rating/data.json)获取数据进行缓存
4+
- 登录选择优化
15
## version 1.1.10
26
- 更新数据
37

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-present ccagml
3+
Copyright (c) 2022-present ccagml
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
- 增加剑指Offer、面试金典相关内容
2020
- 增加一键提交全部题目测试用例功能
2121
- 尝试不需要额外安装node环境,使用vscode自带的node版本
22+
-[zerotrac.github.io](https://zerotrac.github.io/leetcode_problem_rating/data.json)获取数据进行缓存,数据更新时,可以尝试使用deleteAllCache,重新获取数据
2223

2324
# 关于本项目
2425
- [项目地址:https://github.com/ccagml/vscode-leetcode-problem-rating/](https://github.com/ccagml/vscode-leetcode-problem-rating/)
2526
- [报告问题](https://github.com/ccagml/vscode-leetcode-problem-rating/issues)
2627
- [疑难解答](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/%E7%96%91%E9%9A%BE%E8%A7%A3%E7%AD%94)
2728
- [常见问题](https://github.com/LeetCode-OpenSource/vscode-leetcode/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
2829
- 趁着现在只有<img src="https://img.shields.io/github/stars/ccagml/vscode-leetcode-problem-rating" alt="">提交一个PR就能成为项目元老了
29-
- 每周当[zerotrac](https://github.com/zerotrac/leetcode_problem_rating/)项目更新数据data.json,可以将新数据放到本项目的resources/data.json即可提交PR
30-
- 为什么不改成自动获取data.json,因为上一点
3130

3231
## 快速开始
3332
![quickstart](https://www.ccagml.com/wp-content/uploads/2022/10/quickstart.gif)
@@ -37,6 +36,17 @@
3736
![search](https://www.ccagml.com/wp-content/uploads/2022/10/search.gif)
3837

3938

39+
<!-- ## TODO 看到一些可能会用得上的功能
40+
- 在文件里面插入一些测试用例? 提交答案与期望答案不同的地方?
41+
- 做题目计时
42+
- 不是中文站点,直接隐藏账号密码登录的方式
43+
- 默认的工作目录修改 不再是.leetcode
44+
- Test按钮应该不在需要 case 和 allcase 只要留下输入的功能
45+
- 备忘录功能(数据直接放设置的工作目录?用github同步?)
46+
- 获取提交历史(直接找官方的提交数据)
47+
- 想做一个可以根据计算下次回顾本题的功能?(需要在设置的工作目录中存放多个文件?)
48+
- 还没出分前周赛题目显示 未评分(需要官网获取最新几期的题目编号) -->
49+
4050
## ❗️ 注意 ❗️- 无法登录 LeetCode 节点的临时解决办法
4151
> 注意:如果使用的是 `leetcode.cn` 账户,可以跳过此段落。
4252

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
theme: jekyll-theme-cayman
1+
theme: jekyll-theme-cayman

delete.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rm -rf ~/.lc
1+
rm -rf ~/.lcpr
22
rm -rf ~/.vscode-server/extensions/ccagml*

0 commit comments

Comments
 (0)