Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/remote-file-size-dependency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/theme-check-common': minor
---

Add an optional `remoteFileSize` dependency: the size of a remote file, such as a script on a CDN. AssetSizeCSS and AssetSizeJavaScript use it, and by default it makes the same HEAD request as before.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,84 +1,7 @@
import { describe, it, expect } from 'vitest';
import { runLiquidCheck } from '../../test';
import { ForbiddenTag, AppBlockValidTags } from './index';

const blocksFilePath = 'blocks/app.liquid';
import { ForbiddenTag } from './index';

describe('Module: AppBlockValidTags', () => {
it('should report an offense when the forbidden tag is used in blocks directory liquid file', async () => {
const tags = ['include', 'layout', 'section', 'sections'];
for (const tag of tags) {
const sourceCode = `
{% ${tag} 'test' %}
{% schema %}
{ }
{% endschema %}
`;

const offenses = await runLiquidCheck(AppBlockValidTags, sourceCode, blocksFilePath);

const expectedStart = {
index: 9,
line: 1,
character: 8,
};
const tagEndOffset = 13;
const endOffset = tag.length + tagEndOffset;

const expectedEnd = {
index: expectedStart.index + endOffset,
line: expectedStart.line,
character: expectedStart.character + endOffset,
};

expect(offenses).to.have.length(1);
expect(offenses).to.containOffense({
check: AppBlockValidTags.meta.code,
message: `Theme app extension blocks cannot contain '${tag}' tags`,
uri: 'file:///blocks/app.liquid',
severity: 0,
start: expectedStart,
end: expectedEnd,
});
}
});

it('should report an offense when the forbidden tag is used with an end tag in blocks directory liquid file', async () => {
const tags = ['javascript', 'stylesheet'];
for (const tag of tags) {
const sourceCode = `
{% ${tag} %}
{% end${tag} %}
{% schema %}
{ }
{% endschema %}
`;

const offenses = await runLiquidCheck(AppBlockValidTags, sourceCode, blocksFilePath);

const expectedStart = {
index: 9,
line: 1,
character: 8,
};
const expectedEnd = {
index: expectedStart.index + tag.length + 34,
line: 2,
character: expectedStart.character + tag.length + 9,
};

expect(offenses).to.have.length(1);
expect(offenses).to.containOffense({
check: AppBlockValidTags.meta.code,
message: `Theme app extension blocks cannot contain '${tag}' tags`,
uri: 'file:///blocks/app.liquid',
severity: 0,
start: expectedStart,
end: expectedEnd,
});
}
});

it('should contain specifically the following forbidden tags', async () => {
const actualTagValues = Object.values(ForbiddenTag);
const expectedTagValues = [
Expand Down
100 changes: 0 additions & 100 deletions packages/theme-check-common/src/checks/asset-preload/index.spec.ts

This file was deleted.

Loading
Loading