Skip to content

Commit 73490bb

Browse files
authored
chore: markdown errors (#11294)
* rename errors.js to errors-tmp.js * start porting errors * generate markdown files for more errors * convert parse errors * convert css errors * convert special_element errors * convert runes errors * convert element errors * more * more * more * more * more * more * fix some tests * fix some tests * more tests * remove unused error * prettierignore * weird * ugh * lint
1 parent 3866887 commit 73490bb

File tree

267 files changed

+3027
-1198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+3027
-1198
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ packages/**/dist/*.js
22
packages/**/build/*.js
33
packages/**/npm/**/*
44
packages/**/config/*.js
5+
packages/svelte/messages/**/*.md
6+
packages/svelte/src/compiler/errors.js
57
packages/svelte/tests/**/*.svelte
68
packages/svelte/tests/**/_expected*
79
packages/svelte/tests/**/_actual*

eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@ export default [
3333
ignores: [
3434
'**/*.d.ts',
3535
'**/tests',
36+
'packages/svelte/scripts/process-messages/templates/*.js',
37+
'packages/svelte/src/compiler/errors.js',
3638
'packages/svelte/compiler/index.js',
3739
// documentation can contain invalid examples
3840
'documentation',
3941
// contains a fork of the REPL which doesn't adhere to eslint rules
4042
'sites/svelte-5-preview/**',
4143
// wasn't checked previously, reenable at some point
42-
'sites/svelte.dev/**'
44+
'sites/svelte.dev/**',
45+
'tmp/**'
4346
]
4447
}
4548
];
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## empty_attribute_shorthand
2+
3+
Attribute shorthand cannot be empty
4+
5+
## duplicate_attribute
6+
7+
Attributes need to be unique
8+
9+
## invalid_event_attribute_value
10+
11+
Event attribute must be a JavaScript expression, not a string
12+
13+
## invalid_attribute_name
14+
15+
'%name%' is not a valid attribute name
16+
17+
## animation_invalid_placement
18+
19+
An element that uses the `animate:` directive must be the only child of a keyed `{#each ...}` block
20+
21+
## animation_missing_key
22+
23+
An element that uses the `animate:` directive must be the only child of a keyed `{#each ...}` block. Did you forget to add a key to your each block?
24+
25+
## animation_duplicate
26+
27+
An element can only have one 'animate' directive
28+
29+
## invalid_event_modifier
30+
31+
Valid event modifiers are %list%
32+
33+
## invalid_component_event_modifier
34+
35+
Event modifiers other than 'once' can only be used on DOM elements
36+
37+
## invalid_event_modifier_combination
38+
39+
The '%modifier1%' and '%modifier2%' modifiers cannot be used together
40+
41+
## transition_duplicate
42+
43+
Cannot use multiple `%type%:` directives on a single element
44+
45+
## transition_conflict
46+
47+
Cannot use `%type%:` alongside existing `%existing%:` directive
48+
49+
## invalid_let_directive_placement
50+
51+
`let:` directive at invalid position
52+
53+
## invalid_style_directive_modifier
54+
55+
Invalid 'style:' modifier. Valid modifiers are: 'important'
56+
57+
## invalid_sequence_expression
58+
59+
Sequence expressions are not allowed as attribute/directive values in runes mode, unless wrapped in parentheses
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## invalid_binding_expression
2+
3+
Can only bind to an Identifier or MemberExpression
4+
5+
## invalid_binding_value
6+
7+
Can only bind to state or props
8+
9+
## bind_invalid_target
10+
11+
`bind:%name%` can only be used with %elements%
12+
13+
## bind_invalid
14+
15+
`bind:%name%` is not a valid binding
16+
17+
## bind_invalid_detailed
18+
19+
`bind:%name%` is not a valid binding. %explanation%
20+
21+
## invalid_type_attribute
22+
23+
'type' attribute must be a static text value if input uses two-way binding
24+
25+
## invalid_multiple_attribute
26+
27+
'multiple' attribute must be static if select uses two-way binding
28+
29+
## missing_contenteditable_attribute
30+
31+
'contenteditable' attribute is required for textContent, innerHTML and innerText two-way bindings
32+
33+
## dynamic_contenteditable_attribute
34+
35+
'contenteditable' attribute cannot be dynamic if element uses two-way binding
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## invalid_compiler_option
2+
3+
Invalid compiler option: %msg%
4+
5+
## removed_compiler_option
6+
7+
Invalid compiler option: %msg%
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## invalid_component_directive
2+
3+
This type of directive is not valid on components
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## invalid_const_placement
2+
3+
{@const} must be the immediate child of {#snippet}, {#if}, {:else if}, {:else}, {#each}, {:then}, {:catch}, <svelte:fragment> or <Component>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## invalid_css_empty_declaration
2+
3+
Declaration cannot be empty
4+
5+
## invalid_css_global_block_list
6+
7+
A :global {...} block cannot be part of a selector list with more than one item
8+
9+
## invalid_css_global_block_modifier
10+
11+
A :global {...} block cannot modify an existing selector
12+
13+
## invalid_css_global_block_combinator
14+
15+
A :global {...} block cannot follow a %name% combinator
16+
17+
## invalid_css_global_block_declaration
18+
19+
A :global {...} block can only contain rules, not declarations
20+
21+
## invalid_css_global_placement
22+
23+
:global(...) can be at the start or end of a selector sequence, but not in the middle
24+
25+
## invalid_css_global_selector
26+
27+
:global(...) must contain exactly one selector
28+
29+
## invalid_css_global_selector_list
30+
31+
:global(...) must not contain type or universal selectors when used in a compound selector
32+
33+
## invalid_css_type_selector_placement
34+
35+
:global(...) must not be followed with a type selector
36+
37+
## invalid_css_selector
38+
39+
Invalid selector
40+
41+
## invalid_css_identifier
42+
43+
Expected a valid CSS identifier
44+
45+
## invalid_nesting_selector
46+
47+
Nesting selectors can only be used inside a rule
48+
49+
## invalid_css_declaration
50+
51+
Declaration cannot be empty
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## invalid_textarea_content
2+
3+
A `<textarea>` can have either a value attribute or (equivalently) child content, but not both
4+
5+
## invalid_void_content
6+
7+
Void elements cannot have children or closing tags
8+
9+
## invalid_element_content
10+
11+
<%name%> cannot have children
12+
13+
## invalid_tag_name
14+
15+
Expected valid tag name
16+
17+
## invalid_node_placement
18+
19+
%thing% is invalid inside <%parent%>
20+
21+
## illegal_title_attribute
22+
23+
`<title>` cannot have attributes nor directives
24+
25+
## invalid_title_content
26+
27+
`<title>` can only contain text and {tags}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## cyclical_reactive_declaration
2+
3+
Cyclical dependency detected: %cycle%
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
## unclosed_element
2+
3+
`<%name%>` was left open
4+
5+
## unclosed_block
6+
7+
Block was left open
8+
9+
## unexpected_block_close
10+
11+
Unexpected block closing tag
12+
13+
## unexpected_eof
14+
15+
Unexpected end of input
16+
17+
## js_parse_error
18+
19+
%message%
20+
21+
## expected_token
22+
23+
Expected token %token%
24+
25+
## unexpected_reserved_word
26+
27+
'%word%' is a reserved word in JavaScript and cannot be used here
28+
29+
## missing_whitespace
30+
31+
Expected whitespace
32+
33+
## expected_pattern
34+
35+
Expected identifier or destructure pattern
36+
37+
## invalid_script_context
38+
39+
If the context attribute is supplied, its value must be "module"
40+
41+
## invalid_elseif
42+
43+
'elseif' should be 'else if'
44+
45+
## invalid_continuing_block_placement
46+
47+
{:...} block is invalid at this position (did you forget to close the preceeding element or block?)
48+
49+
## invalid_block_missing_parent
50+
51+
%child% block must be a child of %parent%
52+
53+
## duplicate_block_part
54+
55+
%name% cannot appear more than once within a block
56+
57+
## expected_block_type
58+
59+
Expected 'if', 'each', 'await', 'key' or 'snippet'
60+
61+
## expected_identifier
62+
63+
Expected an identifier
64+
65+
## invalid_debug
66+
67+
{@debug ...} arguments must be identifiers, not arbitrary expressions
68+
69+
## invalid_const
70+
71+
{@const ...} must be an assignment
72+
73+
## invalid_block_placement
74+
75+
{#%name% ...} block cannot be %location%
76+
77+
## invalid_tag_placement
78+
79+
{@%name% ...} tag cannot be %location%
80+
81+
## missing_attribute_value
82+
83+
Expected attribute value
84+
85+
## unclosed_attribute_value
86+
87+
Expected closing %delimiter% character
88+
89+
## invalid_directive_value
90+
91+
Directive value must be a JavaScript expression enclosed in curly braces
92+
93+
## empty_directive_name
94+
95+
%type% name cannot be empty
96+
97+
## invalid_closing_tag
98+
99+
</%name%> attempted to close an element that was not open
100+
101+
## invalid_closing_tag_after_autoclose
102+
103+
</%name%> attempted to close element that was already automatically closed by <%reason%> (cannot nest <%reason%> inside <%name%>)
104+
105+
## invalid_dollar_binding
106+
107+
The $ name is reserved, and cannot be used for variables and imports
108+
109+
## invalid_dollar_prefix
110+
111+
The $ prefix is reserved, and cannot be used for variables and imports
112+
113+
## invalid_dollar_global
114+
115+
The $ name is reserved. To reference a global variable called $, use globalThis.$
116+
117+
## illegal_subscription
118+
119+
Cannot reference store value inside `<script context="module">`
120+
121+
## duplicate_style_element
122+
123+
A component can have a single top-level `<style>` element
124+
125+
## duplicate_script_element
126+
127+
A component can have a single top-level `<script>` element and/or a single top-level `<script context="module">` element
128+
129+
## invalid_render_expression
130+
131+
{@render ...} tags can only contain call expressions
132+
133+
## invalid_render_arguments
134+
135+
expected at most one argument
136+
137+
## invalid_render_call
138+
139+
Calling a snippet function using apply, bind or call is not allowed
140+
141+
## invalid_render_spread_argument
142+
143+
cannot use spread arguments in {@render ...} tags
144+
145+
## invalid_snippet_rest_parameter
146+
147+
snippets do not support rest parameters; use an array instead

0 commit comments

Comments
 (0)