Skip to content

Commit 4661e93

Browse files
authored
chore(deps-dev): upgrading our eslint standards (#1174)
## 🧰 Changes The owner of `eslint-plugin-vitest` lost their NPM access to it was moved into `@vitest/eslint-plugin` a little over a year ago. This upgrades our `@readme/eslint-config` package to pull that in.
1 parent 76f4880 commit 4661e93

14 files changed

+170
-322
lines changed

__tests__/.eslintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"rules": {
44
// vitest currently allows for __dirname, require, etc.
55
// see https://github.com/vitest-dev/vitest/issues/2841
6-
"unicorn/prefer-module": "off"
6+
"unicorn/prefer-module": "off",
7+
8+
"@vitest/require-mock-type-parameters": "off",
79
}
810
}

__tests__/bin.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('bin', () => {
99
await new Promise(resolve => {
1010
exec(`node ${__dirname}/../bin/run.js`, (error, stdout) => {
1111
expect(stdout).toContain("ReadMe's official CLI and GitHub Action");
12+
1213
resolve(true);
1314
});
1415
});

__tests__/commands/docs/upload.test.ts

+23
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ describe('rdme docs upload', () => {
4545
.reply(201, {});
4646

4747
const result = await run(['__tests__/__fixtures__/docs/new-docs/new-doc.md', '--key', key]);
48+
4849
expect(result).toMatchSnapshot();
4950
expect(fs.writeFileSync).not.toHaveBeenCalled();
5051

@@ -64,6 +65,7 @@ describe('rdme docs upload', () => {
6465
.reply(201, {});
6566

6667
const result = await run(['__tests__/__fixtures__/docs/new-docs/new-doc.md', '--key', key, '--version', '1.2.3']);
68+
6769
expect(result).toMatchSnapshot();
6870
expect(fs.writeFileSync).not.toHaveBeenCalled();
6971

@@ -75,6 +77,7 @@ describe('rdme docs upload', () => {
7577
const mock = getAPIv2Mock({ authorization }).head('/versions/stable/guides/new-doc').reply(404);
7678

7779
const result = await run(['__tests__/__fixtures__/docs/new-docs/new-doc.md', '--key', key, '--dry-run']);
80+
7881
expect(result).toMatchSnapshot();
7982
expect(fs.writeFileSync).not.toHaveBeenCalled();
8083

@@ -85,6 +88,7 @@ describe('rdme docs upload', () => {
8588
const mock = getAPIv2Mock({ authorization }).head('/versions/stable/guides/some-slug').reply(200);
8689

8790
const result = await run(['__tests__/__fixtures__/docs/slug-docs/new-doc-slug.md', '--key', key, '--dry-run']);
91+
8892
expect(result).toMatchSnapshot();
8993
expect(fs.writeFileSync).not.toHaveBeenCalled();
9094

@@ -95,6 +99,7 @@ describe('rdme docs upload', () => {
9599
const mock = getAPIv2Mock({ authorization }).head('/versions/stable/guides/some-slug').reply(500);
96100

97101
const result = await run(['__tests__/__fixtures__/docs/slug-docs/new-doc-slug.md', '--key', key, '--dry-run']);
102+
98103
expect(result).toMatchSnapshot();
99104
expect(fs.writeFileSync).not.toHaveBeenCalled();
100105

@@ -116,6 +121,7 @@ describe('rdme docs upload', () => {
116121
.reply(201, {});
117122

118123
const result = await run(['__tests__/__fixtures__/docs/slug-docs/new-doc-slug.md', '--key', key]);
124+
119125
expect(result).toMatchSnapshot();
120126
expect(fs.writeFileSync).not.toHaveBeenCalled();
121127

@@ -134,6 +140,7 @@ describe('rdme docs upload', () => {
134140
.reply(201, {});
135141

136142
const result = await run(['__tests__/__fixtures__/docs/slug-docs/new-doc-slug.md', '--key', key]);
143+
137144
expect(result).toMatchSnapshot();
138145
expect(fs.writeFileSync).not.toHaveBeenCalled();
139146

@@ -157,6 +164,7 @@ describe('rdme docs upload', () => {
157164
prompts.inject([true]);
158165

159166
const result = await run(['__tests__/__fixtures__/docs/mixed-docs/legacy-category.md', '--key', key]);
167+
160168
expect(result).toMatchSnapshot();
161169
expect(fs.writeFileSync).toHaveBeenCalledWith(
162170
'__tests__/__fixtures__/docs/mixed-docs/legacy-category.md',
@@ -190,6 +198,7 @@ describe('rdme docs upload', () => {
190198
prompts.inject([true]);
191199

192200
const result = await run(['__tests__/__fixtures__/docs/mixed-docs/legacy-category.md', '--key', key]);
201+
193202
expect(result).toMatchSnapshot();
194203
expect(fs.writeFileSync).toHaveBeenCalledWith(
195204
'__tests__/__fixtures__/docs/mixed-docs/legacy-category.md',
@@ -205,6 +214,7 @@ describe('rdme docs upload', () => {
205214
prompts.inject([false]);
206215

207216
const result = await run(['__tests__/__fixtures__/docs/mixed-docs/legacy-category.md', '--key', key]);
217+
208218
expect(result).toMatchSnapshot();
209219
expect(fs.writeFileSync).not.toHaveBeenCalled();
210220
});
@@ -227,6 +237,7 @@ describe('rdme docs upload', () => {
227237
key,
228238
'--skip-validation',
229239
]);
240+
230241
expect(result).toMatchSnapshot();
231242
expect(fs.writeFileSync).not.toHaveBeenCalled();
232243

@@ -249,6 +260,7 @@ describe('rdme docs upload', () => {
249260
.reply(201, {});
250261

251262
const result = await run(['__tests__/__fixtures__/docs/mixed-docs/invalid-attributes.md', '--key', key]);
263+
252264
expect(result).toMatchSnapshot();
253265
expect(fs.writeFileSync).not.toHaveBeenCalled();
254266

@@ -278,6 +290,7 @@ describe('rdme docs upload', () => {
278290
.reply(201, {});
279291

280292
const result = await run(['__tests__/__fixtures__/docs/new-docs/new-doc.md', '--key', key]);
293+
281294
expect(result).toMatchSnapshot();
282295
expect(fs.writeFileSync).not.toHaveBeenCalled();
283296

@@ -287,6 +300,7 @@ describe('rdme docs upload', () => {
287300

288301
it('should error out if the file has validation errors', async () => {
289302
const result = await run(['__tests__/__fixtures__/docs/mixed-docs/legacy-category.md', '--key', key]);
303+
290304
expect(result).toMatchSnapshot();
291305
expect(fs.writeFileSync).not.toHaveBeenCalled();
292306
});
@@ -296,6 +310,7 @@ describe('rdme docs upload', () => {
296310
const mock = getAPIv2Mock({ authorization }).head('/versions/stable/guides/new-doc').reply(500);
297311

298312
const result = await run(['__tests__/__fixtures__/docs/new-docs/new-doc.md', '--key', key]);
313+
299314
expect(result).toMatchSnapshot();
300315
expect(fs.writeFileSync).not.toHaveBeenCalled();
301316

@@ -304,12 +319,14 @@ describe('rdme docs upload', () => {
304319

305320
it('should error out if the file does not exist', async () => {
306321
const result = await run(['non-existent-file', '--key', key]);
322+
307323
expect(result).toMatchSnapshot();
308324
expect(fs.writeFileSync).not.toHaveBeenCalled();
309325
});
310326

311327
it('should error out if the file has an invalid file extension', async () => {
312328
const result = await run(['package.json', '--key', key]);
329+
313330
expect(result).toMatchSnapshot();
314331
expect(fs.writeFileSync).not.toHaveBeenCalled();
315332
});
@@ -337,6 +354,7 @@ describe('rdme docs upload', () => {
337354
.reply(201, {});
338355

339356
const result = await run(['__tests__/__fixtures__/docs/existing-docs', '--key', key]);
357+
340358
expect(result).toMatchSnapshot();
341359
expect(fs.writeFileSync).not.toHaveBeenCalled();
342360

@@ -362,6 +380,7 @@ describe('rdme docs upload', () => {
362380
.reply(201, {});
363381

364382
const result = await run(['__tests__/__fixtures__/docs/existing-docs', '--key', key]);
383+
365384
expect(result).toMatchSnapshot();
366385
expect(fs.writeFileSync).not.toHaveBeenCalled();
367386

@@ -407,6 +426,7 @@ describe('rdme docs upload', () => {
407426
.reply(201, {});
408427

409428
const result = await run(['__tests__/__fixtures__/docs/multiple-docs', '--key', key]);
429+
410430
expect(result).toMatchSnapshot();
411431
expect(fs.writeFileSync).not.toHaveBeenCalled();
412432

@@ -416,6 +436,7 @@ describe('rdme docs upload', () => {
416436

417437
it('should error out if the directory does not contain any Markdown files', async () => {
418438
const result = await run(['__tests__/__fixtures__/ref-oas', '--key', key]);
439+
419440
expect(result).toMatchSnapshot();
420441
});
421442

@@ -459,6 +480,7 @@ describe('rdme docs upload', () => {
459480
prompts.inject([true]);
460481

461482
const result = await run(['__tests__/__fixtures__/docs/mixed-docs', '--key', key]);
483+
462484
expect(result).toMatchSnapshot();
463485
expect(fs.writeFileSync).toHaveBeenCalledTimes(5);
464486

@@ -479,6 +501,7 @@ describe('rdme docs upload', () => {
479501
prompts.inject([true]);
480502

481503
const result = await run(['__tests__/__fixtures__/docs/mixed-docs', '--key', key, '--dry-run']);
504+
482505
expect(result).toMatchSnapshot();
483506
expect(fs.writeFileSync).toHaveBeenCalledTimes(5);
484507

__tests__/commands/login.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ describe('rdme login', () => {
102102
const mock = getAPIv1Mock().post('/api/v1/login', { email, password, project }).reply(401, errorResponse);
103103

104104
await expect(run()).rejects.toStrictEqual(new APIv1Error(errorResponse));
105+
105106
mock.done();
106107
});
107108

@@ -144,6 +145,7 @@ describe('rdme login', () => {
144145
.reply(404, errorResponse);
145146

146147
await expect(run()).rejects.toStrictEqual(new APIv1Error(errorResponse));
148+
147149
mock.done();
148150
});
149151
});

__tests__/commands/openapi/inspect.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable vitest/no-conditional-expect */
1+
/* eslint-disable @vitest/no-conditional-expect */
22
import assert from 'node:assert';
33

44
import { describe, it, expect, beforeAll } from 'vitest';
@@ -69,6 +69,7 @@ describe('rdme openapi inspect', () => {
6969
const args = [require.resolve(spec)].concat(...feature.map(f => ['--feature', f]));
7070
if (!shouldSoftError) {
7171
await expect(run(args)).resolves.toMatchSnapshot();
72+
7273
return;
7374
}
7475

__tests__/commands/openapi/reduce.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ describe('rdme openapi reduce', () => {
7676
expect(console.info).toHaveBeenCalledTimes(1);
7777

7878
const output = getCommandOutput();
79+
7980
expect(output).toBe(chalk.yellow(`ℹ️ We found ${spec} and are attempting to reduce it.`));
8081

8182
expect(Object.keys(reducedSpec.paths)).toStrictEqual(['/user']);
@@ -98,6 +99,7 @@ describe('rdme openapi reduce', () => {
9899
expect(console.info).toHaveBeenCalledTimes(1);
99100

100101
const output = getCommandOutput();
102+
101103
expect(output).toBe(chalk.yellow(`ℹ️ We found ${spec} and are attempting to reduce it.`));
102104

103105
expect(Object.keys(reducedSpec.paths)).toStrictEqual(['/user']);
@@ -147,6 +149,7 @@ describe('rdme openapi reduce', () => {
147149
expect(console.info).toHaveBeenCalledTimes(1);
148150

149151
const output = getCommandOutput();
152+
150153
expect(output).toBe(chalk.yellow(`ℹ️ We found ${spec} and are attempting to reduce it.`));
151154

152155
expect(fsWriteFileSyncSpy).toHaveBeenCalledWith('output.json', expect.any(String));
@@ -181,6 +184,7 @@ describe('rdme openapi reduce', () => {
181184
expect(console.info).toHaveBeenCalledTimes(1);
182185

183186
const output = getCommandOutput();
187+
184188
expect(output).toBe(chalk.yellow(`ℹ️ We found ${spec} and are attempting to reduce it.`));
185189

186190
expect(fsWriteFileSyncSpy).toHaveBeenCalledWith('output.json', expect.any(String));

0 commit comments

Comments
 (0)