Skip to content

Commit

Permalink
eslint upgrade fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eropple committed Oct 8, 2024
1 parent 1910a12 commit 1603fea
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 50 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"husky": "^9.1.5",
"lint-staged": "^15.2.9",
"ts-node": "^10.9.1",
"typescript": "^5.3.3",
"typescript": "^5.5.2",
"vitest": "^2.1.2"
}
}
74 changes: 37 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ module.exports = {

semi: true,
singleQuote: false,
quoteProps: 'consistent',
quoteProps: "consistent",

trailingComma: 'es5',
trailingComma: "es5",
bracketSpacing: true,

arrowParens: 'always',
arrowParens: "always",

requirePragma: false,
insertPragma: false,

proseWrap: 'preserve',
embeddedLanguageFormatting: 'off',
proseWrap: "preserve",
embeddedLanguageFormatting: "off",

endOfLine: 'lf',
endOfLine: "lf",
};
4 changes: 3 additions & 1 deletion src/path-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ type ConversionResult = {
paramPatterns: Record<string, string>;
};

export function convertFastifyToOpenAPIPath(fastifyPath: string): ConversionResult {
export function convertFastifyToOpenAPIPath(
fastifyPath: string
): ConversionResult {
let url = fastifyPath;
const paramPatterns: Record<string, string> = {};

Expand Down
3 changes: 1 addition & 2 deletions src/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomOptions, TSchema } from "@sinclair/typebox";
import { type CustomOptions, type TSchema } from "@sinclair/typebox";
import { pascalCase } from "change-case";

import { SCHEMA_NAME_PROPERTY } from "./constants.js";
Expand Down Expand Up @@ -35,6 +35,5 @@ export function schemaType<T extends TSchema & CustomOptions>(
name: string,
type: T
): T & TaggedSchema {
// @ts-ignore
return { ...type, [SCHEMA_NAME_PROPERTY]: Symbol(pascalCase(name)) };
}
13 changes: 10 additions & 3 deletions src/spec-transforms/fixup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ function fixupSchemaHolder(s: MaybeSchemaHolder): void {
function fixupReferencesInSchema(s: SchemaObject) {
if (s.allOf) {
s.allOf = s.allOf.map((s2) => {
isSchemaObject(s2) && fixupReferencesInSchema(s2);
if (isSchemaObject(s2)) {
fixupReferencesInSchema(s2);
}

return isTaggedSchema(s2) ? refFromTaggedSchema(s2) : s2;
});
}

if (s.anyOf) {
s.anyOf = s.anyOf.map((s2) => {
isSchemaObject(s2) && fixupReferencesInSchema(s2);
if (isSchemaObject(s2)) {
fixupReferencesInSchema(s2);
}
return isTaggedSchema(s2) ? refFromTaggedSchema(s2) : s2;
});
}
Expand All @@ -73,7 +78,9 @@ function fixupReferencesInSchema(s: SchemaObject) {
if (s.properties) {
for (const propKey in s.properties) {
const s2 = s.properties[propKey];
isSchemaObject(s2) && fixupReferencesInSchema(s2);
if (isSchemaObject(s2)) {
fixupReferencesInSchema(s2);
}
s.properties[propKey] = isTaggedSchema(s2) ? refFromTaggedSchema(s2) : s2;
}
}
Expand Down

0 comments on commit 1603fea

Please sign in to comment.