Skip to content

Commit

Permalink
Renaming to JSONMissingBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
navdeep5 committed Dec 5, 2024
1 parent d7436b4 commit 4831ddc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/theme-check-common/src/checks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { DeprecatedFilter } from './deprecated-filter';
import { DeprecatedTag } from './deprecated-tag';
import { EmptyBlockContent } from './empty-block-content';
import { ImgWidthAndHeight } from './img-width-and-height';
import { JsonMissingBlock } from './json-missing-block';
import { JSONMissingBlock } from './json-missing-block';
import { JSONSyntaxError } from './json-syntax-error';
import { LiquidFreeSettings } from './liquid-free-settings';
import { LiquidHTMLSyntaxError } from './liquid-html-syntax-error';
Expand Down Expand Up @@ -63,7 +63,7 @@ export const allChecks: (LiquidCheckDefinition | JSONCheckDefinition)[] = [
DeprecateLazysizes,
EmptyBlockContent,
ImgWidthAndHeight,
JsonMissingBlock,
JSONMissingBlock,
JSONSyntaxError,
LiquidFreeSettings,
LiquidHTMLSyntaxError,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, describe, it } from 'vitest';
import { JsonMissingBlock } from './index';
import { JSONMissingBlock } from './index';
import { check, MockTheme } from '../../test';

describe('Module: JsonMissingBlock', () => {
Expand Down Expand Up @@ -34,7 +34,7 @@ describe('Module: JsonMissingBlock', () => {
`,
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.have.length(1);
expect(offenses[0].message).to.equal(
"Theme block 'blocks/missing_block.liquid' does not exist.",
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('Module: JsonMissingBlock', () => {
'blocks/text.liquid': '',
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.be.empty;
});

Expand Down Expand Up @@ -127,7 +127,7 @@ describe('Module: JsonMissingBlock', () => {
`,
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.have.length(1);
expect(offenses[0].message).to.equal(
"Theme block 'blocks/missing_nested.liquid' does not exist.",
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('Module: JsonMissingBlock', () => {
'blocks/image.liquid': '',
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.have.length(1);
expect(offenses[0].message).to.equal(
"Block type 'text' is not allowed in 'sections/custom-section.liquid'.",
Expand Down Expand Up @@ -232,7 +232,7 @@ describe('Module: JsonMissingBlock', () => {
'blocks/missing_nested.liquid': '',
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.have.length(1);
expect(offenses[0].message).to.equal(
"Block type 'missing_nested' is not allowed in 'blocks/text.liquid'.",
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('Module: JsonMissingBlock', () => {
'blocks/_private_block.liquid': '',
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.have.length(1);
expect(offenses[0].message).to.equal(
"Block type '_private_block' is not allowed in 'blocks/text.liquid'.",
Expand All @@ -316,7 +316,7 @@ describe('Module: JsonMissingBlock', () => {
}`,
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.be.empty;
});

Expand Down Expand Up @@ -371,7 +371,7 @@ describe('Module: JsonMissingBlock', () => {
'blocks/_private_block.liquid': '',
};

const offenses = await check(theme, [JsonMissingBlock]);
const offenses = await check(theme, [JSONMissingBlock]);
expect(offenses).to.be.empty;
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { getSchemaFromJSON } from '../../to-schema';
import { JSONCheckDefinition, Severity, SourceCodeType } from '../../types';
import { getAllBlocks, isPropertyNode } from './missing-block-utils';

export const JsonMissingBlock: JSONCheckDefinition = {
export const JSONMissingBlock: JSONCheckDefinition = {
meta: {
code: 'JsonMissingBlock',
code: 'JSONMissingBlock',
name: 'Check for missing blocks types in JSON templates',
docs: {
description: 'This check ensures that JSON templates contain valid block types.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Context, SourceCodeType, JSONNode, Preset } from '../../types';
import { Context, SourceCodeType, JSONNode } from '../../types';
import { LiteralNode, PropertyNode } from 'json-to-ast';
import { getLocEnd, getLocStart, nodeAtPath } from '../../json';
import { doesFileExist } from '../../utils/file-utils';
Expand Down
4 changes: 2 additions & 2 deletions packages/theme-check-node/configs/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ EmptyBlockContent:
ImgWidthAndHeight:
enabled: true
severity: 0
JSONSyntaxError:
JSONMissingBlock:
enabled: true
severity: 0
JsonMissingBlock:
JSONSyntaxError:
enabled: true
severity: 0
LiquidFreeSettings:
Expand Down
4 changes: 2 additions & 2 deletions packages/theme-check-node/configs/recommended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ EmptyBlockContent:
ImgWidthAndHeight:
enabled: true
severity: 0
JSONSyntaxError:
JSONMissingBlock:
enabled: true
severity: 0
JsonMissingBlock:
JSONSyntaxError:
enabled: true
severity: 0
LiquidFreeSettings:
Expand Down

0 comments on commit 4831ddc

Please sign in to comment.