@@ -33,25 +33,25 @@ The plugin includes rules that check for:
3333
3434::: code-group
3535
36- ``` sh [Deno]
36+ ~~~~ sh [Deno]
3737deno add jsr:@fedify/lint
38- ```
38+ ~~~~
3939
40- ``` sh [npm]
40+ ~~~~ sh [npm]
4141npm add -D @fedify/lint
42- ```
42+ ~~~~
4343
44- ``` sh [pnpm]
44+ ~~~~ sh [pnpm]
4545pnpm add -D @fedify/lint
46- ```
46+ ~~~~
4747
48- ``` sh [Yarn]
48+ ~~~~ sh [Yarn]
4949yarn add -D @fedify/lint
50- ```
50+ ~~~~
5151
52- ``` sh [Bun]
52+ ~~~~ sh [Bun]
5353bun add -D @fedify/lint
54- ```
54+ ~~~~
5555
5656:::
5757
@@ -61,21 +61,21 @@ bun add -D @fedify/lint
6161
6262Add 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
7272By default, this enables all recommended rules.
7373
7474### Custom configuration
7575
7676You 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
9898After setting up the configuration, run Deno's linter:
9999
100- ``` sh
100+ ~~~~ sh
101101deno lint
102- ```
102+ ~~~~
103103
104104You can also specify which files to lint:
105105
106- ``` sh
106+ ~~~~ sh
107107deno lint federation.ts
108108deno lint src/federation/
109- ```
109+ ~~~~
110110
111111## ESLint
112112
@@ -115,24 +115,36 @@ deno lint src/federation/
115115Add the plugin to your ESLint configuration file (e.g., _ eslint.config.ts_ or
116116_ eslint.config.js_ ):
117117
118- ``` typescript twoslash
118+ ~~~~ typescript twoslash
119119import fedifyLint from " @fedify/lint" ;
120120
121121// If your `createFederation` code is in `federation.ts` or `federation/**.ts`
122122export 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---
125131export 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---
131143export default [
132144 // otherConfig,
133145 fedifyLint ,
134146];
135- ```
147+ ~~~~
136148
137149The default configuration applies recommended rules to files that match common
138150federation-related patterns (e.g., _ federation.ts_ , _ federation/\* .ts_ ).
@@ -141,7 +153,7 @@ federation-related patterns (e.g., _federation.ts_, _federation/\*.ts_).
141153
142154You can customize which files to lint and which rules to enable:
143155
144- ``` typescript twoslash
156+ ~~~~ typescript twoslash
145157import { plugin } from " @fedify/lint" ;
146158
147159export 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
167179Enables critical rules as errors and optional rules as warnings:
168180
169- ``` typescript twoslash
181+ ~~~~ typescript twoslash
170182import fedifyLint from " @fedify/lint" ;
171183
172184export default fedifyLint ;
173- ```
185+ ~~~~
174186
175187#### Strict
176188
177189Enables all rules as errors:
178190
179- ``` typescript twoslash
191+ ~~~~ typescript twoslash
180192import { plugin } from " @fedify/lint" ;
181193
182194export default [{
183195 files: [" **/*.ts" ],
184196 ... plugin .configs .strict ,
185197}];
186- ```
198+ ~~~~
187199
188200### Running ESLint
189201
190202Set 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
201213After setting up the configuration, run ESLint on your codebase:
202214
203215::: code-group
204216
205- ``` sh [npm]
217+ ~~~~ sh [npm]
206218npm run lint
207- ```
219+ ~~~~
208220
209- ``` sh [pnpm]
221+ ~~~~ sh [pnpm]
210222pnpm lint
211- ```
223+ ~~~~
212224
213- ``` sh [Yarn]
225+ ~~~~ sh [Yarn]
214226yarn lint
215- ```
227+ ~~~~
216228
217- ``` sh [Bun]
229+ ~~~~ sh [Bun]
218230bun lint
219- ```
231+ ~~~~
220232
221233:::
222234
223235Or run the linter directly via command line:
224236
225237::: code-group
226238
227- ``` sh [npm]
239+ ~~~~ sh [npm]
228240npx eslint .
229- ```
241+ ~~~~
230242
231- ``` sh [pnpm]
243+ ~~~~ sh [pnpm]
232244pnpx eslint .
233- ```
245+ ~~~~
234246
235- ``` sh [Yarn]
247+ ~~~~ sh [Yarn]
236248yarn eslint .
237- ```
249+ ~~~~
238250
239- ``` sh [Bun]
251+ ~~~~ sh [Bun]
240252bunx eslint .
241- ```
253+ ~~~~
242254
243255:::
244256
@@ -1110,10 +1122,10 @@ federation.setActorDispatcher(
11101122
11111123When you run the linter on the incorrect code, you'll see an error like:
11121124
1113- ```
1125+ ~~~~
11141126error[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