Skip to content

feat: codemirror-json-schema pkg#852

Draft
kylemcd wants to merge 2 commits intomainfrom
kyle-kno-11281-fork-codemirror-json-schema-and-bring-into-knock-org
Draft

feat: codemirror-json-schema pkg#852
kylemcd wants to merge 2 commits intomainfrom
kyle-kno-11281-fork-codemirror-json-schema-and-bring-into-knock-org

Conversation

@kylemcd
Copy link
Member

@kylemcd kylemcd commented Feb 4, 2026

Description

** Describe what, why and how of the changes clearly and concisely. Add any additional useful context or info, as necessary. **

Todos

** List any todo items necessary before merging, if any. Delete if none. **

  • Sample todo item 1
  • Sample todo item 2

Checklist

  • Tests have been added for new features or major refactors to existing features.

Screenshots or videos

** Attach any screenshots or recordings to visually illustrate the changes, as necessary. Delete if not relevant. **

@linear
Copy link

linear bot commented Feb 4, 2026

@vercel
Copy link

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
javascript-ms-teams-connect-example Ready Ready Preview, Comment Feb 4, 2026 6:29pm
javascript-nextjs-example Ready Ready Preview, Comment Feb 4, 2026 6:29pm
javascript-slack-connect-example Ready Ready Preview, Comment Feb 4, 2026 6:29pm
javascript-slack-kit-example Ready Ready Preview, Comment Feb 4, 2026 6:29pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

⚠️ No Changeset found

Latest commit: 6bd4fb3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member Author

kylemcd commented Feb 4, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov
Copy link

codecov bot commented Feb 4, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 7 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

expandSchemaProperty(schemaFromState, schemaFromState) ??
schemaFromState;
this.laxSchema = makeSchemaLax(this.schema);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schema caching broken - originalSchema never updated

Medium Severity

The doComplete method compares this.originalSchema !== schemaFromState to determine if the schema changed and needs reprocessing, but this.originalSchema is never updated after the comparison. This means the condition will always be true (after the first call with a non-null schema), causing expandSchemaProperty and makeSchemaLax to run on every completion request instead of only when the schema actually changes. This defeats the intended caching optimization and may cause performance issues with large schemas.

Fix in Cursor Fix in Web

} else {
const [newKey, newValue] = replacement as [string | symbol, unknown];
handleReplacementEntry(key, value, newKey, newValue);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty array return not handled in property replacer

Medium Severity

The replacePropertiesDeeply function doesn't handle the case when PropertyReplacer returns an empty array [] to indicate a property should be removed. When makeSchemaLax returns [] to remove properties like additionalProperties or required, the code checks Array.isArray(replacement[0]) which is false for an empty array, then destructures [] resulting in undefined for both key and value. This causes newObject[undefined] = undefined to be set instead of omitting the property entirely.

Additional Locations (1)

Fix in Cursor Fix in Web

const result = `\`${value}\``;
if (i === arr.length - 1) return "or " + result;
return result;
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single-element array produces incorrect "or" prefix

Low Severity

The joinWithOr function incorrectly prefixes "or" to the last element regardless of array length. When the array has only one element (where i === 0 === arr.length - 1), the result becomes "or \value`"instead of just"`value`". This causes grammatically incorrect output like "Expected one of or string" in validation error messages and "oneOf: or string`" in hover tooltips when there's only one type in a union.

Fix in Cursor Fix in Web

extends: ["@knocklabs/eslint-config/library.js"],
parserOptions: {
projects: ["tsconfig.json"],
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint config uses wrong property name projects

Low Severity

The ESLint configuration uses parserOptions.projects (plural) but the correct property name for @typescript-eslint/parser is parserOptions.project (singular). This typo causes ESLint to ignore the TypeScript project configuration, potentially breaking type-aware lint rules that depend on the TypeScript compiler.

Fix in Cursor Fix in Web

for (const s of schemas) {
if (typeof s !== "object") {
return;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early return breaks loop processing remaining schemas

Medium Severity

In getValueCompletions, the for...of loop iterating through schemas uses return; when encountering a non-object schema, which exits the entire method instead of continuing to the next schema. If any schema in the array is a boolean schema (true or false, which are valid JSON Schema values), the method stops early and skips processing all remaining schemas that could provide valid completions.

Fix in Cursor Fix in Web


private getValueFromLabel(value: string): unknown {
return JSON.parse(value);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused private method getValueFromLabel in JSONCompletion

Low Severity

The private method getValueFromLabel is defined but never called anywhere in the codebase. This is dead code that should be removed.

Fix in Cursor Fix in Web

// "markdown-it-implicit-figures",
// "markdown-it-video",
// "markdown-it-highlightjs",
// ];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code block should be removed

Low Severity

A large block of commented-out code listing defaultPlugins array serves no purpose and should be removed. If these plugins need to be referenced in the future, they can be found in version control history.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant