Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: linting changes #28

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ plugins:
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
nodeLinker: node-modules
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion source/__snapshots__/default-custom-attributes.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
2 changes: 1 addition & 1 deletion source/__snapshots__/default-ftrack-schema.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
2 changes: 1 addition & 1 deletion source/__snapshots__/default-highway-test.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
2 changes: 1 addition & 1 deletion source/__snapshots__/default-object-types.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
2 changes: 1 addition & 1 deletion source/__snapshots__/default-types.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
2 changes: 1 addition & 1 deletion source/__snapshots__/schema-has-array-type.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
3 changes: 1 addition & 2 deletions source/__snapshots__/schema-has-base-schema.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down Expand Up @@ -69,5 +69,4 @@ export function getProjectSchemas() {
export type ProjectSchema = ReturnType<typeof getProjectSchemas>[number];
export type ProjectName = ProjectSchema["name"];


// Errors:
3 changes: 1 addition & 2 deletions source/__snapshots__/schema-has-immutable-property.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down Expand Up @@ -64,5 +64,4 @@ export function getProjectSchemas() {
export type ProjectSchema = ReturnType<typeof getProjectSchemas>[number];
export type ProjectName = ProjectSchema["name"];


// Errors:
2 changes: 1 addition & 1 deletion source/__snapshots__/schema-has-integer-type.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
2 changes: 1 addition & 1 deletion source/__snapshots__/schema-has-variable-type.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
2 changes: 1 addition & 1 deletion source/__snapshots__/schema-subtype-of-TypedContext.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// :copyright: Copyright (c) 2023 ftrack

// Generated on 2023-01-31T23:00:00.000Z using schema
// Generated on 2023-02-01T00:00:00.000Z using schema
// from an instance running version 4.13.8 using server on https://ftrack.example.com
// Not intended to modify manually

Expand Down
16 changes: 9 additions & 7 deletions source/emit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,7 @@ test("default object types", async () => {
const contents = await readFile(
join(".", "source", "__snapshots__", "responses", "query_object_types.json")
);
const objectTypes: ObjectType[] = JSON.parse(
contents.toString()
);
const objectTypes: ObjectType[] = JSON.parse(contents.toString());

//act
const emitResult = await emitToString(
Expand All @@ -347,7 +345,13 @@ test("default object types", async () => {
test("default highway test (all values specified)", async () => {
//arrange
const schemasContents = await readFile(
join(".", "source", "__snapshots__", "responses", "query_project_schema.json")
join(
".",
"source",
"__snapshots__",
"responses",
"query_project_schema.json"
)
);
const schemas: Array<ProjectSchema> = JSON.parse(schemasContents.toString());

Expand All @@ -372,9 +376,7 @@ test("default highway test (all values specified)", async () => {
const objectTypeContents = await readFile(
join(".", "source", "__snapshots__", "responses", "query_object_types.json")
);
const objectTypes: ObjectType[] = JSON.parse(
objectTypeContents.toString()
);
const objectTypes: ObjectType[] = JSON.parse(objectTypeContents.toString());

//act
const emitResult = await emitToString(
Expand Down
6 changes: 3 additions & 3 deletions source/emit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ export async function emitToString(
name: "${x.name}",
objectTypes: [
${x.object_types
.map(t => objectTypes.find(x => x.id === t.id))
.map(t => `"${t!.name}"`)
.join(', ')}
.map((t) => objectTypes.find((x) => x.id === t.id))
.map((t) => `"${t?.name}"`)
.join(", ")}
]
}`
)}
Expand Down
11 changes: 11 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// :copyright: Copyright (c) 2023 ftrack

import { defineProject } from "vitest/config";

export default defineProject({
test: {
name: "TS Schema Generator",
globals: true,
globalSetup: __dirname + "/vitest.global-setup.ts",
},
});
5 changes: 5 additions & 0 deletions vitest.global-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// :copyright: Copyright (c) 2023 ftrack

export const setup = () => {
process.env.TZ = "UTC";
};