mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Apply deno lint
This commit is contained in:
parent
f041515403
commit
72cf89a317
2 changed files with 44 additions and 2 deletions
35
README.md
35
README.md
|
|
@ -126,3 +126,38 @@ https://github-profile-trophy.vercel.app/?username=ryo-ma&row=2&column=3
|
|||
```
|
||||
<img width="330" src="https://user-images.githubusercontent.com/6661165/91659474-c07f7400-eb0a-11ea-84f2-eb6b42547829.png">
|
||||
|
||||
|
||||
# Contribution Guide
|
||||
|
||||
## Environment
|
||||
|
||||
* Deno >= v1.3.0
|
||||
* typescript >= 3.9.7
|
||||
* 
|
||||
* GitHub API v4
|
||||
|
||||
## Local Run
|
||||
|
||||
Create `.env` file to project root directory, and write your GitHub token to the `.env` file.
|
||||
|
||||
```
|
||||
GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
```
|
||||
|
||||
Run local server.
|
||||
|
||||
```
|
||||
deno run --allow-net --allow-read --allow-env debug.ts
|
||||
```
|
||||
|
||||
## Editor config
|
||||
|
||||
Read the 
|
||||
|
||||
## Run deno lint
|
||||
|
||||
If you want to contribute to my project, you should check the lint with the following command.
|
||||
|
||||
```
|
||||
deno lint --unstable
|
||||
```
|
||||
|
|
@ -14,6 +14,13 @@ export class UserInfo {
|
|||
) {
|
||||
}
|
||||
}
|
||||
type Language = { name: string };
|
||||
type Stargazers = { totalCount: number };
|
||||
|
||||
type Repository = {
|
||||
languages: { nodes: Language[] };
|
||||
stargazers: Stargazers;
|
||||
};
|
||||
|
||||
export class GithubAPIClient {
|
||||
constructor() {
|
||||
|
|
@ -75,14 +82,14 @@ export class GithubAPIClient {
|
|||
userData.contributionsCollection.restrictedContributionsCount +
|
||||
userData.contributionsCollection.totalCommitContributions;
|
||||
const totalStargazers = userData.repositories.nodes.reduce(
|
||||
(prev: number, node: any) => {
|
||||
(prev: number, node: Repository) => {
|
||||
return prev + node.stargazers.totalCount;
|
||||
},
|
||||
0,
|
||||
);
|
||||
|
||||
const languages = new Set<string>();
|
||||
userData.repositories.nodes.forEach((node: any) => {
|
||||
userData.repositories.nodes.forEach((node: Repository) => {
|
||||
if (node.languages.nodes[0] != undefined) {
|
||||
languages.add(node.languages.nodes[0].name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue