@@ -5,7 +5,7 @@ import { blockESLintPlugin } from "./blockESLintPlugin.js";
5
5
import { optionsBase } from "./options.fakes.js" ;
6
6
7
7
describe ( "blockESLintPlugin" , ( ) => {
8
- test ( "without mode" , ( ) => {
8
+ test ( "without options or mode" , ( ) => {
9
9
const creation = testBlock ( blockESLintPlugin , {
10
10
options : optionsBase ,
11
11
} ) ;
@@ -16,7 +16,7 @@ describe("blockESLintPlugin", () => {
16
16
{
17
17
"addons": {
18
18
"words": [
19
- "eslint-doc-generatorrc.js ",
19
+ "eslint-doc-generatorrc",
20
20
],
21
21
},
22
22
"block": [Function],
@@ -95,11 +95,6 @@ describe("blockESLintPlugin", () => {
95
95
"eslint-doc-generator": "2.1.0",
96
96
"eslint-plugin-eslint-plugin": "6.4.0",
97
97
},
98
- "peerDependencies": {
99
- "@typescript-eslint/parser": ">=8",
100
- "eslint": ">=9",
101
- "typescript": ">=5",
102
- },
103
98
"scripts": {
104
99
"build:docs": "eslint-doc-generator",
105
100
"lint:docs": "eslint-doc-generator --check",
@@ -140,6 +135,139 @@ describe("blockESLintPlugin", () => {
140
135
` ) ;
141
136
} ) ;
142
137
138
+ test ( "with options.type set to commonjs" , ( ) => {
139
+ const creation = testBlock ( blockESLintPlugin , {
140
+ options : {
141
+ ...optionsBase ,
142
+ type : "commonjs" ,
143
+ } ,
144
+ } ) ;
145
+
146
+ expect ( creation ) . toMatchInlineSnapshot ( `
147
+ {
148
+ "addons": [
149
+ {
150
+ "addons": {
151
+ "words": [
152
+ "eslint-doc-generatorrc",
153
+ ],
154
+ },
155
+ "block": [Function],
156
+ },
157
+ {
158
+ "addons": {
159
+ "sections": {
160
+ "Building": {
161
+ "innerSections": [
162
+ {
163
+ "contents": "
164
+ Run [\`eslint-doc-generator\`](https://github.com/bmish/eslint-doc-generator) to generate Markdown files documenting rules.
165
+
166
+ \`\`\`shell
167
+ pnpm build:docs
168
+ \`\`\`
169
+ ",
170
+ "heading": "Building Docs",
171
+ },
172
+ ],
173
+ },
174
+ "Linting": {
175
+ "contents": {
176
+ "items": [
177
+ "- \`pnpm lint:docs\` ([eslint-doc-generator](https://github.com/bmish/eslint-doc-generator)): Generates and validates documentation for ESLint rules",
178
+ ],
179
+ },
180
+ },
181
+ },
182
+ },
183
+ "block": [Function],
184
+ },
185
+ {
186
+ "addons": {
187
+ "extensions": [
188
+ "eslintPlugin.configs["flat/recommended"]",
189
+ ],
190
+ "ignores": [
191
+ ".eslint-doc-generatorrc.mjs",
192
+ "docs/rules/*/*.ts",
193
+ ],
194
+ "imports": [
195
+ {
196
+ "source": {
197
+ "packageName": "eslint-plugin-eslint-plugin",
198
+ "version": "6.4.0",
199
+ },
200
+ "specifier": "eslintPlugin",
201
+ },
202
+ ],
203
+ },
204
+ "block": [Function],
205
+ },
206
+ {
207
+ "addons": {
208
+ "jobs": [
209
+ {
210
+ "name": "Lint Docs",
211
+ "steps": [
212
+ {
213
+ "run": "pnpm build || exit 0",
214
+ },
215
+ {
216
+ "run": "pnpm lint:docs",
217
+ },
218
+ ],
219
+ },
220
+ ],
221
+ },
222
+ "block": [Function],
223
+ },
224
+ {
225
+ "addons": {
226
+ "properties": {
227
+ "devDependencies": {
228
+ "eslint-doc-generator": "2.1.0",
229
+ "eslint-plugin-eslint-plugin": "6.4.0",
230
+ },
231
+ "scripts": {
232
+ "build:docs": "eslint-doc-generator",
233
+ "lint:docs": "eslint-doc-generator --check",
234
+ },
235
+ },
236
+ },
237
+ "block": [Function],
238
+ },
239
+ {
240
+ "addons": {
241
+ "coverage": {
242
+ "exclude": [
243
+ "src/index.ts",
244
+ "src/rules/index.ts",
245
+ ],
246
+ },
247
+ },
248
+ "block": [Function],
249
+ },
250
+ ],
251
+ "files": {
252
+ ".eslint-doc-generatorrc.mjs": "import prettier from "prettier";
253
+
254
+ /** @type {import('eslint-doc-generator').GenerateOptions} */
255
+ const config = {
256
+ postprocess: async (content, path) =>
257
+ prettier.format(content, {
258
+ ...(await prettier.resolveConfig(path)),
259
+ parser: "markdown",
260
+ }),
261
+ ruleDocTitleFormat: "prefix-name",
262
+ };
263
+
264
+ export default config;
265
+ ",
266
+ },
267
+ }
268
+ ` ) ;
269
+ } ) ;
270
+
143
271
test ( "setup mode" , ( ) => {
144
272
const creation = testBlock ( blockESLintPlugin , {
145
273
mode : "setup" ,
@@ -152,7 +280,7 @@ describe("blockESLintPlugin", () => {
152
280
{
153
281
"addons": {
154
282
"words": [
155
- "eslint-doc-generatorrc.js ",
283
+ "eslint-doc-generatorrc",
156
284
],
157
285
},
158
286
"block": [Function],
@@ -231,11 +359,6 @@ describe("blockESLintPlugin", () => {
231
359
"eslint-doc-generator": "2.1.0",
232
360
"eslint-plugin-eslint-plugin": "6.4.0",
233
361
},
234
- "peerDependencies": {
235
- "@typescript-eslint/parser": ">=8",
236
- "eslint": ">=9",
237
- "typescript": ">=5",
238
- },
239
362
"scripts": {
240
363
"build:docs": "eslint-doc-generator",
241
364
"lint:docs": "eslint-doc-generator --check",
0 commit comments