Skip to content

Commit b510084

Browse files
committed
chore: 删除不再使用的 Prettier 配置文件,更新 ESLint 配置以简化忽略规则,调整 TypeScript 和 React 的 ESLint 规则,新增 TypeScript 严格模式配置。
1 parent 4c2e91e commit b510084

25 files changed

+136
-115
lines changed

.prettierrc.cjs

Lines changed: 0 additions & 1 deletion
This file was deleted.

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export default [
44
...base,
55

66
{
7-
ignores: ['src/eslint-legacy/**', 'examples/**'],
7+
ignores: ['examples/**'],
88
},
99
]

examples/green-wall/.prettierrc.cjs

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/green-wall/eslint.config.mjs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import { TYPESCRIPT_FILES } from 'prefer-code-style/constants'
2-
import nextConfig from 'prefer-code-style/eslint/preset/next'
1+
import nextPreset from 'prefer-code-style/eslint/preset/next'
32

43
export default [
5-
...nextConfig,
6-
4+
...nextPreset,
75
{
8-
files: TYPESCRIPT_FILES,
9-
rules: {
10-
'import/no-unresolved': [2, { ignore: ['^\\~/'] }],
11-
},
6+
ignores: ['plugins/*.js'],
127
},
138
]

examples/green-wall/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"version": "0.0.1",
23
"name": "green-wall",
34
"private": true,
45
"description": "GitHub contribution graph generator. Review all the contributions you've made to GitHub over the years.",

examples/green-wall/plugins/script.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ if (isProfile) {
101101
}
102102

103103
const createGraph = (
104-
params: Calendar
104+
params: Calendar,
105105
): {
106106
graphItem: HTMLDivElement
107107
} => {
@@ -189,7 +189,7 @@ if (isProfile) {
189189
'Overlay--motion-scaleFadeOverlay',
190190
'Overlay-whenNarrow',
191191
'Overlay--size-medium-portrait',
192-
'Overlay--motion-scaleFade'
192+
'Overlay--motion-scaleFade',
193193
)
194194
dialog.style.minWidth = '720px'
195195
dialog.style.maxHeight = 'calc(100vh - 50px)'
@@ -262,7 +262,7 @@ if (isProfile) {
262262
dialogFooter.classList.add(
263263
'Overlay-footer',
264264
'Overlay-footer--alignEnd',
265-
'Overlay-footer--divided'
265+
'Overlay-footer--divided',
266266
)
267267
const openExtrnalBtn = document.createElement('button')
268268
const btnContent = document.createElement('span')
@@ -307,7 +307,7 @@ if (isProfile) {
307307
'mt-3',
308308
'clearfix',
309309
'hide-sm',
310-
'hide-md'
310+
'hide-md',
311311
)
312312

313313
const title = document.createElement('h2')
@@ -366,7 +366,7 @@ if (isProfile) {
366366
try {
367367
dialogContent.innerHTML = ''
368368

369-
const data: Data = JSON.parse(response.responseText)
369+
const data = JSON.parse(response.responseText) as Data
370370
const xData = produceData(data)
371371

372372
xData.contributionCalendars.forEach((calendar) => {

examples/green-wall/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const isDev: boolean = process.env.NODE_ENV === 'development'
88

99
export function trackEvent(
1010
event: string,
11-
data?: Record<string, string | number | boolean | undefined | null>
11+
data?: Record<string, string | number | boolean | undefined | null>,
1212
): void {
1313
if (isDev) {
1414
return

examples/green-wall/src/services.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function fetchGitHubUser(username: string): Promise<ContributionBas
6161

6262
export async function fetchContributionsCollection(
6363
username: string,
64-
year: ContributionYear
64+
year: ContributionYear,
6565
): Promise<ContributionCalendar> {
6666
if (!GAT) {
6767
throw new Error('Require GITHUB ACCESS TOKEN.')
@@ -74,7 +74,7 @@ export async function fetchContributionsCollection(
7474
{
7575
user(login: "${username}") {
7676
contributionsCollection(from: "${new Date(
77-
`${year}-01-01`
77+
`${year}-01-01`,
7878
).toISOString()}", to: "${new Date(`${year}-12-31`).toISOString()}") {
7979
contributionCalendar {
8080
total: totalContributions

examples/green-wall/src/useGraphRequest.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function useGraphRequest(config: { onError?: () => void } = {}) {
2020
setLoading(true)
2121

2222
const res = await fetch(`/api/contribution/${username}`)
23-
const resJson: ResponseData = await res.json()
23+
const resJson = await res.json() as ResponseData
2424

2525
if (res.ok) {
2626
return resJson.data
@@ -40,7 +40,7 @@ export function useGraphRequest(config: { onError?: () => void } = {}) {
4040
setLoading(false)
4141
}
4242
},
43-
[onError]
43+
[onError],
4444
)
4545

4646
return {

examples/green-wall/tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
"include": [
1818
"next-env.d.ts",
1919
"src/**/*",
20-
"plugins/**/*",
20+
"plugins/**/*.ts",
2121
".next/types/**/*.ts",
22-
"./tailwind.config.ts",
23-
"./eslint.config.mjs"
22+
"./tailwind.config.ts"
2423
],
2524

2625
"exclude": ["node_modules"]

0 commit comments

Comments
 (0)