Skip to content

Commit 62c8d21

Browse files
Rich-Harristrueadm
authored andcommitted
fix: disallow TODO errors (#10326)
* disallow TODO errors * replace TODO errors * changeset --------- Co-authored-by: Rich Harris <[email protected]>
1 parent baaa79d commit 62c8d21

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.changeset/lemon-geese-call.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: replace TODO errors

packages/svelte/src/compiler/errors.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ const parse = {
8888
'illegal-subscription': () => `Cannot reference store value inside <script context="module">`,
8989
'duplicate-style-element': () => `A component can have a single top-level <style> element`,
9090
'duplicate-script-element': () =>
91-
`A component can have a single top-level <script> element and/or a single top-level <script context="module"> element`
91+
`A component can have a single top-level <script> element and/or a single top-level <script context="module"> element`,
92+
'invalid-render-expression': () => 'expected an identifier followed by (...)',
93+
'invalid-render-arguments': () => 'expected at most one argument'
9294
};
9395

9496
/** @satisfies {Errors} */
@@ -508,7 +510,7 @@ export class CompileError extends Error {
508510
}
509511

510512
/**
511-
* @template {keyof typeof errors} T
513+
* @template {Exclude<keyof typeof errors, 'TODO'>} T
512514
* @param {NodeLike | number | null} node
513515
* @param {T} code
514516
* @param {Parameters<typeof errors[T]>} args

packages/svelte/src/compiler/phases/1-parse/state/tag.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,11 @@ function special(parser) {
586586
const expression = read_expression(parser);
587587

588588
if (expression.type !== 'CallExpression' || expression.callee.type !== 'Identifier') {
589-
error(expression, 'TODO', 'expected an identifier followed by (...)');
589+
error(expression, 'invalid-render-expression');
590590
}
591591

592592
if (expression.arguments.length > 1) {
593-
error(expression.arguments[1], 'TODO', 'expected at most one argument');
593+
error(expression.arguments[1], 'invalid-render-arguments');
594594
}
595595

596596
parser.allow_whitespace();

0 commit comments

Comments
 (0)