Skip to content

Commit 97c0123

Browse files
committed
chore: lint
1 parent 631b4a5 commit 97c0123

8 files changed

Lines changed: 15 additions & 21 deletions

File tree

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
root: true,
3-
extends: '@block65',
3+
extends: ['@block65/eslint-config', '@block65/eslint-config/typescript'],
44
parserOptions: {
55
tsconfigRootDir: __dirname,
66
project: './tsconfig.json',

__tests__/fixtures/petstore.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@
195195
},
196196
{
197197
"type": "object",
198-
"required": [
199-
"id"
200-
],
198+
"required": ["id"],
201199
"properties": {
202200
"id": {
203201
"type": "integer",
@@ -209,9 +207,7 @@
209207
},
210208
"NewPet": {
211209
"type": "object",
212-
"required": [
213-
"name"
214-
],
210+
"required": ["name"],
215211
"properties": {
216212
"name": {
217213
"type": "string"
@@ -223,10 +219,7 @@
223219
},
224220
"Error": {
225221
"type": "object",
226-
"required": [
227-
"code",
228-
"message"
229-
],
222+
"required": ["code", "message"],
230223
"properties": {
231224
"code": {
232225
"type": "integer",

__tests__/fixtures/petstore/methods.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* Generated on 2022-10-29T14:54:27.697Z
77
*
88
*/
9+
import type { Simplify } from 'type-fest';
910
import type {
1011
RequestMethodCaller,
1112
FindPetsQuery,
1213
Pet,
1314
NewPet,
1415
} from './models.js';
15-
import type { Simplify } from 'type-fest';
1616

1717
/**
1818
* Returns all pets from the system that the user has access to
@@ -47,7 +47,7 @@ export function findPets(parameters?: {
4747
}): RequestMethodCaller<Pet[]> {
4848
const req = {
4949
method: 'get' as const,
50-
pathname: `/pets`,
50+
pathname: '/pets',
5151
query: parameters?.query,
5252
};
5353
return (requestMethod, options) => requestMethod(req, options);
@@ -63,7 +63,7 @@ export function addPet(parameters: {
6363
}): RequestMethodCaller<Pet> {
6464
const req = {
6565
method: 'post' as const,
66-
pathname: `/pets`,
66+
pathname: '/pets',
6767
body: parameters.body,
6868
};
6969
return (requestMethod, options) => requestMethod(req, options);

bin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
import { join } from 'path';
2+
import { join } from 'node:path';
33
import yargs from 'yargs';
44
import { hideBin } from 'yargs/helpers';
55
import { build } from '../src/build.js';

lib/process-document.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ export async function processOpenApiDocument(
358358

359359
for (const [statusCode, response] of Object.entries(
360360
operationObject.responses,
361-
).filter(([statusCode]) => statusCode.startsWith('2'))) {
361+
).filter(([s]) => s.startsWith('2'))) {
362362
// early out if response is 204
363363
// if (statusCode === '204') {
364364
// func.setReturnType('Promise<void>');
@@ -427,7 +427,7 @@ export async function processOpenApiDocument(
427427
name: 'req',
428428
initializer: Writers.object({
429429
method: Writers.assertion((w) => w.quote(method), 'const'),
430-
pathname: `\`${path.replaceAll(/\{/g, '${')}\``,
430+
pathname: `\`${path.replaceAll(/{/g, '${')}\``,
431431
...(queryType &&
432432
paramsParam && {
433433
query: `${paramsParam.getName()}?.query`,

lib/process-schema.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ export function schemaToType(
107107
// WARN: Duplicated code - recursion beat me
108108
type: Writers.objectType({
109109
properties: Object.entries(schemaObject.properties || {}).map(
110-
([propertyName, propertySchema]) => {
110+
([schemaPropertyName, schemaPropertySchema]) => {
111111
const type = schemaToType(
112112
typesAndInterfaces,
113113
schemaObject,
114-
propertyName,
115-
propertySchema,
114+
schemaPropertyName,
115+
schemaPropertySchema,
116116
);
117117

118118
return type;

prettier.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('@block65/eslint-config/prettier');
1+
module.exports = require('@block65/eslint-config/prettier.config.js');

src/build.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export async function build(
6666
const results = await eslint
6767
.lintFiles([entryFile.getFilePath(), typesFile.getFilePath()])
6868
.catch((err) => {
69+
// eslint-disable-next-line no-console
6970
console.error(err);
7071
return [];
7172
});

0 commit comments

Comments
 (0)