Skip to content

Commit a7b886d

Browse files
committed
fix: lint
Signed-off-by: Innei <[email protected]>
1 parent d199e15 commit a7b886d

File tree

249 files changed

+7950
-5978
lines changed

Some content is hidden

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

249 files changed

+7950
-5978
lines changed

.github/workflows/build-storybook.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-node@v4
2626
with:
2727
node-version: ${{ matrix.node-version }}
28-
cache: 'pnpm'
28+
cache: "pnpm"
2929

3030
- name: Install dependencies
3131
run: pnpm install

.prettierrc.mjs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import config from '@innei/prettier'
2-
31
export default {
4-
...config,
5-
// printWidth: 120,
2+
semi: false,
3+
singleQuote: false,
4+
printWidth: 100,
5+
tabWidth: 2,
6+
trailingComma: "all",
7+
objectWrap: "preserve",
8+
plugins: ["prettier-plugin-tailwindcss"],
69
}

eslint.config.mjs

+38-38
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
// @ts-check
2-
import { defineConfig } from 'eslint-config-hyoban'
2+
import { defineConfig } from "eslint-config-hyoban"
33

44
export default defineConfig(
55
{
66
formatting: false,
77
lessOpinionated: true,
88
ignores: [],
99
preferESM: false,
10-
react: 'next',
10+
react: "next",
1111
tailwindCSS: true,
1212
},
1313
{
1414
settings: {
1515
tailwindcss: {
16-
whitelist: ['center'],
16+
whitelist: ["center"],
1717
},
1818
},
1919
rules: {
20-
'package-json/valid-package-def': 'off',
21-
'@eslint-react/no-missing-key': 'warn',
22-
'no-restricted-syntax': 'off',
23-
'import/no-anonymous-default-export': 'off',
24-
eqeqeq: 'warn',
25-
'no-console': 'warn',
26-
'@eslint-react/dom/no-missing-button-type': 0,
27-
'unicorn/prefer-math-trunc': 'off',
28-
'unicorn/prefer-dom-node-remove': 'off',
29-
'@typescript-eslint/no-unsafe-function-type': 'off',
30-
'no-empty': 'off',
31-
'@typescript-eslint/no-empty-object-type': 'warn',
32-
'unicorn/prefer-query-selector': 0,
33-
'regexp/no-super-linear-backtracking': 0,
34-
'regexp/no-useless-assertions': 0,
35-
'unicorn/no-new-array': 0,
36-
'@typescript-eslint/method-signature-style': 0,
37-
'unicorn/prefer-code-point': 'warn',
38-
'unicorn/no-object-as-default-parameter': 'warn',
39-
'unused-imports/no-unused-vars': 'warn',
40-
'@eslint-react/no-unstable-default-props': 'warn',
41-
'unicorn/prefer-regexp-test': 'warn',
42-
'no-unsafe-optional-chaining': 'warn',
43-
'unicorn/prefer-logical-operator-over-ternary': 'warn',
44-
'arrow-body-style': 0,
45-
'unicorn/no-array-callback-reference': 0,
46-
'prefer-regex-literals': 0,
47-
'regexp/optimal-quantifier-concatenation': 'warn',
48-
'unicorn/prefer-string-slice': 0,
49-
'array-callback-return': 0,
50-
'regexp/no-unused-capturing-group': 1,
51-
'unicorn/no-anonymous-default-export': 0,
52-
'unicorn/no-magic-array-flat-depth': 1,
53-
'react-refresh/only-export-components': 0,
54-
'@eslint-react/no-clone-element': 0,
20+
"package-json/valid-package-def": "off",
21+
"@eslint-react/no-missing-key": "warn",
22+
"no-restricted-syntax": "off",
23+
"import/no-anonymous-default-export": "off",
24+
eqeqeq: "warn",
25+
"no-console": "warn",
26+
"@eslint-react/dom/no-missing-button-type": 0,
27+
"unicorn/prefer-math-trunc": "off",
28+
"unicorn/prefer-dom-node-remove": "off",
29+
"@typescript-eslint/no-unsafe-function-type": "off",
30+
"no-empty": "off",
31+
"@typescript-eslint/no-empty-object-type": "warn",
32+
"unicorn/prefer-query-selector": 0,
33+
"regexp/no-super-linear-backtracking": 0,
34+
"regexp/no-useless-assertions": 0,
35+
"unicorn/no-new-array": 0,
36+
"@typescript-eslint/method-signature-style": 0,
37+
"unicorn/prefer-code-point": "warn",
38+
"unicorn/no-object-as-default-parameter": "warn",
39+
"unused-imports/no-unused-vars": "warn",
40+
"@eslint-react/no-unstable-default-props": "warn",
41+
"unicorn/prefer-regexp-test": "warn",
42+
"no-unsafe-optional-chaining": "warn",
43+
"unicorn/prefer-logical-operator-over-ternary": "warn",
44+
"arrow-body-style": 0,
45+
"unicorn/no-array-callback-reference": 0,
46+
"prefer-regex-literals": 0,
47+
"regexp/optimal-quantifier-concatenation": "warn",
48+
"unicorn/prefer-string-slice": 0,
49+
"array-callback-return": 0,
50+
"regexp/no-unused-capturing-group": 1,
51+
"unicorn/no-anonymous-default-export": 0,
52+
"unicorn/no-magic-array-flat-depth": 1,
53+
"react-refresh/only-export-components": 0,
54+
"@eslint-react/no-clone-element": 0,
5555
},
5656
},
5757
)

global.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FC, PropsWithChildren } from 'react'
1+
import type { FC, PropsWithChildren } from "react"
22

33
declare global {
44
export type NextErrorProps = {
@@ -31,17 +31,17 @@ declare global {
3131
}
3232
}
3333

34-
declare module 'react' {
34+
declare module "react" {
3535
export interface AriaAttributes {
36-
'data-hide-print'?: boolean
37-
'data-event'?: string
38-
'data-testid'?: string
36+
"data-hide-print"?: boolean
37+
"data-event"?: string
38+
"data-testid"?: string
3939
}
4040
}
4141

4242
export {}
4343

44-
declare module '@mx-space/api-client' {
44+
declare module "@mx-space/api-client" {
4545
export interface PostMeta {
4646
style?: string
4747
cover?: string

markdown/sections/usage/custom-component.md

+23-23
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
你可以在 `src/markdown-components/index.tsx` 添加任何你的组件,例如
88

99
```tsx filename="src/markdown-components/index.tsx"
10-
import type { MarkdownToJSX } from 'markdown-to-jsx'
10+
import type { MarkdownToJSX } from "markdown-to-jsx"
1111

12-
import { Divider } from '~/components/divider'
12+
import { Divider } from "~/components/divider"
1313

1414
export const markdownComponents: MarkdownToJSX.Overrides = {
15-
Demo: () => (
16-
<div className="rounded-md bg-cyan-400 p-2">This is a demo component</div>
17-
),
15+
Demo: () => <div className="rounded-md bg-cyan-400 p-2">This is a demo component</div>,
1816
}
19-
2017
```
2118

2219
使用这个组件。
@@ -45,6 +42,7 @@ export const markdownComponents: MarkdownToJSX.Overrides = {
4542
)
4643
}
4744
```
45+
4846
</Tab>
4947
<Tab label="action.tsx">
5048
```tsx filename="app/server-action/action.tsx"
@@ -56,39 +54,41 @@ export const markdownComponents: MarkdownToJSX.Overrides = {
5654
revalidatePath('/server-action')
5755
}
5856
```
57+
5958
</Tab>
6059
</Tabs>
6160

6261
代码为:
6362

6463
````mdx
65-
```md
66-
64+
````md
6765
<Tabs>
6866
<Tab label="layout.tsx">
6967
```tsx filename="app/server-action/layout.tsx"
7068
import type { PropsWithChildren } from 'react'
7169

72-
export default async ({ children }: PropsWithChildren) => {
73-
return (
74-
<div className="m-auto mt-12 max-w-[800px]">
75-
<div>Layout Render At: {Date.now()}</div>
76-
{children}
77-
</div>
78-
)
79-
}
80-
```
70+
export default async ({ children }: PropsWithChildren) => {
71+
return (
72+
<div className="m-auto mt-12 max-w-[800px]">
73+
<div>Layout Render At: {Date.now()}</div>
74+
{children}
75+
</div>
76+
)
77+
}
78+
````
79+
8180
</Tab>
8281
<Tab label="action.tsx">
8382
```tsx filename="app/server-action/action.tsx"
8483
'use server'
8584

86-
import { revalidatePath } from 'next/cache'
85+
import { revalidatePath } from 'next/cache'
86+
87+
export const actionRevalidate = async () => {
88+
revalidatePath('/server-action')
89+
}
8790

88-
export const actionRevalidate = async () => {
89-
revalidatePath('/server-action')
90-
}
91-
```
91+
```
9292
</Tab>
9393
</Tabs>
9494

@@ -105,4 +105,4 @@ export const markdownComponents: MarkdownToJSX.Overrides = {
105105
```
106106
````
107107

108-
<Wip />
108+
<Wip />

markdown/sections/usage/highlight.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,41 +43,41 @@
4343
## 高亮
4444

4545
```tsx {1}
46-
const Hi = 'Hi'
46+
const Hi = "Hi"
4747
```
4848

4949
```tsx
50-
const Hi = 'Hi' // [!code highlight]
50+
const Hi = "Hi" // [!code highlight]
5151
```
5252

5353
上面的两种用法为:
5454

5555
````md
5656
```tsx {1}
57-
const Hi = 'Hi'
57+
const Hi = "Hi"
5858
```
5959

6060
```tsx
61-
const Hi = 'Hi' // [!code highlight]
61+
const Hi = "Hi" // [!code highlight]
6262
```
6363
````
6464

6565
## Diff
6666

6767
```tsx
68-
const Hi = 'Hi' // [!code ++]
68+
const Hi = "Hi" // [!code ++]
6969

70-
const Foo = 'bar' // [!code --]
70+
const Foo = "bar" // [!code --]
7171
```
7272

7373
上面的用法为:
7474

7575
````md
7676
```tsx
77-
const Hi = 'Hi' // [!code ++]
77+
const Hi = "Hi" // [!code ++]
7878

79-
const Foo = 'bar' // [!code --]
79+
const Foo = "bar" // [!code --]
8080
```
8181
````
8282

83-
更多信息,请参阅 [Shiki transformers](https://shiki.style/packages/transformers)
83+
更多信息,请参阅 [Shiki transformers](https://shiki.style/packages/transformers)

markdown/sections/usage/markdown.md

-9
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
Markdown 语法在 GFM 中进行了其他扩展。
44

5-
65
## Alert
76

87
此语法是 GFM 的新增的。
98

10-
119
```md
1210
> [!NOTE]
1311
> Highlights information that users should take into account, even when skimming.
@@ -30,7 +28,6 @@ Markdown 语法在 GFM 中进行了其他扩展。
3028
3129
## Notice
3230

33-
3431
```md
3532
::: warning
3633
_here be dragons_
@@ -43,7 +40,6 @@ _here be dragons_
4340
::: banner {note}
4441
_here be dragons_
4542
:::
46-
4743
```
4844

4945
::: warning
@@ -58,8 +54,6 @@ _here be dragons_
5854
_here be dragons_
5955
:::
6056

61-
62-
6357
## Rich Link
6458

6559
对于单独成行的链接,会有做出不用的渲染。
@@ -130,7 +124,6 @@ https://trpc.io/docs/client/react/useInfiniteQuery
130124

131125
[TRPC](https://trpc.io/docs/client/react/useInfiniteQuery)
132126

133-
134127
## Inline Link Parser
135128

136129
对于内联链接,会根据内置解析增加 Favicon。
@@ -179,7 +172,6 @@ Hi, this is ||Spoiler||
179172

180173
Hi, this is ||Spoiler||
181174

182-
183175
## KateX
184176

185177
```
@@ -214,4 +206,3 @@ P\left(U,T\right)=100\left.\left(0.6\min\left(1,\frac{U-0.70}{0.90-0.70}\right)+
214206
215207
216208
$$
217-

next.config.mjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { bootstarp } from './plugins/json-watcher.mjs'
1+
import { bootstarp } from "./plugins/json-watcher.mjs"
22

3-
if (process.env.NODE_ENV === 'development') {
3+
if (process.env.NODE_ENV === "development") {
44
bootstarp()
55
}
66

77
/** @type {import('next').NextConfig} */
88
const nextConfig = {
9-
output: process.env.NODE_ENV === 'production' ? 'export' : 'standalone',
9+
output: process.env.NODE_ENV === "production" ? "export" : "standalone",
1010
eslint: {
1111
ignoreDuringBuilds: true,
1212
},
@@ -20,7 +20,7 @@ const nextConfig = {
2020
config.module.rules.push({
2121
test: /\.md$/i,
2222
// use: 'raw-loader',
23-
type: 'asset/source',
23+
type: "asset/source",
2424
})
2525
return config
2626
},

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"scripts": {
1212
"build": "next build",
1313
"dev": "next dev -p 9988",
14+
"format": "prettier --write .",
1415
"lint": "eslint --fix",
1516
"prepare": "pnpm exec simple-git-hooks",
1617
"start": "next start"
@@ -73,6 +74,7 @@
7374
"postcss-preset-env": "10.1.5",
7475
"postcss-prune-var": "1.1.2",
7576
"prettier": "3.5.3",
77+
"prettier-plugin-tailwindcss": "0.6.11",
7678
"rimraf": "6.0.1",
7779
"simple-git-hooks": "2.12.1",
7880
"tailwind-scrollbar": "4.0.1",
@@ -96,4 +98,4 @@
9698
],
9799
"changelog": true
98100
}
99-
}
101+
}

0 commit comments

Comments
 (0)