Skip to content

Commit 8436c86

Browse files
committed
Fixed error
1 parent a652c2e commit 8436c86

1 file changed

Lines changed: 60 additions & 48 deletions

File tree

docs/manual/lint.md

Lines changed: 60 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,25 @@ The plugin includes rules that check for:
3333

3434
::: code-group
3535

36-
```sh [Deno]
36+
~~~~sh [Deno]
3737
deno add jsr:@fedify/lint
38-
```
38+
~~~~
3939

40-
```sh [npm]
40+
~~~~sh [npm]
4141
npm add -D @fedify/lint
42-
```
42+
~~~~
4343

44-
```sh [pnpm]
44+
~~~~sh [pnpm]
4545
pnpm add -D @fedify/lint
46-
```
46+
~~~~
4747

48-
```sh [Yarn]
48+
~~~~sh [Yarn]
4949
yarn add -D @fedify/lint
50-
```
50+
~~~~
5151

52-
```sh [Bun]
52+
~~~~sh [Bun]
5353
bun add -D @fedify/lint
54-
```
54+
~~~~
5555

5656
:::
5757

@@ -61,21 +61,21 @@ bun add -D @fedify/lint
6161

6262
Add the plugin to your _deno.json_ configuration file:
6363

64-
```json
64+
~~~~json
6565
{
6666
"lint": {
6767
"plugins": ["jsr:@fedify/lint"]
6868
}
6969
}
70-
```
70+
~~~~
7171

7272
By default, this enables all recommended rules.
7373

7474
### Custom configuration
7575

7676
You can customize which rules to enable and their severity levels:
7777

78-
```json
78+
~~~~json
7979
{
8080
"lint": {
8181
"plugins": ["jsr:@fedify/lint"],
@@ -91,22 +91,22 @@ You can customize which rules to enable and their severity levels:
9191
}
9292
}
9393
}
94-
```
94+
~~~~
9595

9696
### Running Deno Lint
9797

9898
After setting up the configuration, run Deno's linter:
9999

100-
```sh
100+
~~~~sh
101101
deno lint
102-
```
102+
~~~~
103103

104104
You can also specify which files to lint:
105105

106-
```sh
106+
~~~~sh
107107
deno lint federation.ts
108108
deno lint src/federation/
109-
```
109+
~~~~
110110

111111
## ESLint
112112

@@ -115,24 +115,36 @@ deno lint src/federation/
115115
Add the plugin to your ESLint configuration file (e.g., _eslint.config.ts_ or
116116
_eslint.config.js_):
117117

118-
```typescript twoslash
118+
~~~~ typescript twoslash
119119
import fedifyLint from "@fedify/lint";
120120

121121
// If your `createFederation` code is in `federation.ts` or `federation/**.ts`
122122
export default fedifyLint;
123+
~~~~
124+
125+
Or specify your own federation files:
123126

124-
// Or specify your own federation files
127+
~~~~ typescript twoslash
128+
// @errors: 2304
129+
import fedifyLint from "@fedify/lint";
130+
// ---cut-before---
125131
export default {
126132
...fedifyLint,
127133
files: ["my-own-federation.ts"],
128134
};
135+
~~~~
136+
137+
If you use other ESLint configurations:
129138

130-
// If you use other ESLint configurations
139+
~~~~ typescript twoslash
140+
// @errors: 2304
141+
import fedifyLint from "@fedify/lint";
142+
// ---cut-before---
131143
export default [
132144
// otherConfig,
133145
fedifyLint,
134146
];
135-
```
147+
~~~~
136148

137149
The default configuration applies recommended rules to files that match common
138150
federation-related patterns (e.g., _federation.ts_, _federation/\*.ts_).
@@ -141,7 +153,7 @@ federation-related patterns (e.g., _federation.ts_, _federation/\*.ts_).
141153

142154
You can customize which files to lint and which rules to enable:
143155

144-
```typescript twoslash
156+
~~~~ typescript twoslash
145157
import { plugin } from "@fedify/lint";
146158

147159
export default [{
@@ -156,7 +168,7 @@ export default [{
156168
// ... other rules
157169
},
158170
}];
159-
```
171+
~~~~
160172

161173
### Using configurations
162174

@@ -166,79 +178,79 @@ The plugin provides two preset configurations:
166178

167179
Enables critical rules as errors and optional rules as warnings:
168180

169-
```typescript twoslash
181+
~~~~ typescript twoslash
170182
import fedifyLint from "@fedify/lint";
171183

172184
export default fedifyLint;
173-
```
185+
~~~~
174186

175187
#### Strict
176188

177189
Enables all rules as errors:
178190

179-
```typescript twoslash
191+
~~~~ typescript twoslash
180192
import { plugin } from "@fedify/lint";
181193

182194
export default [{
183195
files: ["**/*.ts"],
184196
...plugin.configs.strict,
185197
}];
186-
```
198+
~~~~
187199

188200
### Running ESLint
189201

190202
Set up your ESLint configuration as shown above and add a script to
191203
_package.json_:
192204

193-
```jsonc
205+
~~~~jsonc
194206
{
195207
"scripts": {
196208
"lint": "eslint ."
197209
}
198210
}
199-
```
211+
~~~~
200212

201213
After setting up the configuration, run ESLint on your codebase:
202214

203215
::: code-group
204216

205-
```sh [npm]
217+
~~~~sh [npm]
206218
npm run lint
207-
```
219+
~~~~
208220

209-
```sh [pnpm]
221+
~~~~sh [pnpm]
210222
pnpm lint
211-
```
223+
~~~~
212224

213-
```sh [Yarn]
225+
~~~~sh [Yarn]
214226
yarn lint
215-
```
227+
~~~~
216228

217-
```sh [Bun]
229+
~~~~sh [Bun]
218230
bun lint
219-
```
231+
~~~~
220232

221233
:::
222234

223235
Or run the linter directly via command line:
224236

225237
::: code-group
226238

227-
```sh [npm]
239+
~~~~sh [npm]
228240
npx eslint .
229-
```
241+
~~~~
230242

231-
```sh [pnpm]
243+
~~~~sh [pnpm]
232244
pnpx eslint .
233-
```
245+
~~~~
234246

235-
```sh [Yarn]
247+
~~~~sh [Yarn]
236248
yarn eslint .
237-
```
249+
~~~~
238250

239-
```sh [Bun]
251+
~~~~sh [Bun]
240252
bunx eslint .
241-
```
253+
~~~~
242254

243255
:::
244256

@@ -1110,10 +1122,10 @@ federation.setActorDispatcher(
11101122

11111123
When you run the linter on the incorrect code, you'll see an error like:
11121124

1113-
```
1125+
~~~~
11141126
error[fedify-lint/actor-id-mismatch]: Actor's `id` property must match
11151127
`ctx.getActorUri(identifier)`. Ensure you're using the correct context method.
1116-
```
1128+
~~~~
11171129

11181130
## See also
11191131

0 commit comments

Comments
 (0)