[Feature Request]: LiquidSchema(node) check type for SourceType.LiquidHtml
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 234
- Forks
- 92
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
Feature Request
In theme-check-common, this is far too common of a pattern:
create(context) {
return {
async LiquidRawTag(node) {
if (node.name !== 'schema' || node.body.kind !== 'json') return;
const schema = await getSchema(context);
const { validSchema, ast } = schema ?? {};
if (
!validSchema ||
validSchema instanceof Error ||
!ast ||
ast instanceof Error
) {
return;
}
As our library of theme checks grow, this is only becoming a larger bit of duplicated overhead between checks that validate some details within a valid liquid schema.
Describe the solution you'd like
Id like to see a new CheckNodeMethod like LiquidSchema that only triggers once these checks are performed. Then we only trigger checks like this once the liquid schema has passed basic json validation.
This can improve readability and performance across all liquid checks that look at the liquid schema.
It can look like:
export const SomeSweetNewCheck: LiquidCheckDefinition = {
meta: { ...meta, type: SourceCodeType.LiquidHtml },
create(context) {
return {
async LiquidSchema(node) {
const { validSchema, ast } = node.schema;
...
// Insert sweet functionality here
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in theme-check-common by reading the existing LiquidRawTag handling and the CheckNodeMethod and LiquidCheckDefinition patterns. Define what the LiquidSchema node should expose after valid JSON schema parsing, then verify that schema-specific checks can use it and that the new event only runs for SourceCodeType.LiquidHtml.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100