Skip to content

chore: markdown errors #11294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 23, 2024
Merged
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
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ packages/**/dist/*.js
packages/**/build/*.js
packages/**/npm/**/*
packages/**/config/*.js
packages/svelte/messages/**/*.md
packages/svelte/src/compiler/errors.js
packages/svelte/tests/**/*.svelte
packages/svelte/tests/**/_expected*
packages/svelte/tests/**/_actual*
Expand Down
5 changes: 4 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ export default [
ignores: [
'**/*.d.ts',
'**/tests',
'packages/svelte/scripts/process-messages/templates/*.js',
'packages/svelte/src/compiler/errors.js',
'packages/svelte/compiler/index.js',
// documentation can contain invalid examples
'documentation',
// contains a fork of the REPL which doesn't adhere to eslint rules
'sites/svelte-5-preview/**',
// wasn't checked previously, reenable at some point
'sites/svelte.dev/**'
'sites/svelte.dev/**',
'tmp/**'
]
}
];
59 changes: 59 additions & 0 deletions packages/svelte/messages/compile-errors/attributes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## empty_attribute_shorthand

Attribute shorthand cannot be empty

## duplicate_attribute

Attributes need to be unique

## invalid_event_attribute_value

Event attribute must be a JavaScript expression, not a string

## invalid_attribute_name

'%name%' is not a valid attribute name

## animation_invalid_placement

An element that uses the `animate:` directive must be the only child of a keyed `{#each ...}` block

## animation_missing_key

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?

## animation_duplicate

An element can only have one 'animate' directive

## invalid_event_modifier

Valid event modifiers are %list%

## invalid_component_event_modifier

Event modifiers other than 'once' can only be used on DOM elements

## invalid_event_modifier_combination

The '%modifier1%' and '%modifier2%' modifiers cannot be used together

## transition_duplicate

Cannot use multiple `%type%:` directives on a single element

## transition_conflict

Cannot use `%type%:` alongside existing `%existing%:` directive

## invalid_let_directive_placement

`let:` directive at invalid position

## invalid_style_directive_modifier

Invalid 'style:' modifier. Valid modifiers are: 'important'

## invalid_sequence_expression

Sequence expressions are not allowed as attribute/directive values in runes mode, unless wrapped in parentheses
35 changes: 35 additions & 0 deletions packages/svelte/messages/compile-errors/bindings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## invalid_binding_expression

Can only bind to an Identifier or MemberExpression

## invalid_binding_value

Can only bind to state or props

## bind_invalid_target

`bind:%name%` can only be used with %elements%

## bind_invalid

`bind:%name%` is not a valid binding

## bind_invalid_detailed

`bind:%name%` is not a valid binding. %explanation%

## invalid_type_attribute

'type' attribute must be a static text value if input uses two-way binding

## invalid_multiple_attribute

'multiple' attribute must be static if select uses two-way binding

## missing_contenteditable_attribute

'contenteditable' attribute is required for textContent, innerHTML and innerText two-way bindings

## dynamic_contenteditable_attribute

'contenteditable' attribute cannot be dynamic if element uses two-way binding
7 changes: 7 additions & 0 deletions packages/svelte/messages/compile-errors/compiler_options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## invalid_compiler_option

Invalid compiler option: %msg%

## removed_compiler_option

Invalid compiler option: %msg%
3 changes: 3 additions & 0 deletions packages/svelte/messages/compile-errors/components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## invalid_component_directive

This type of directive is not valid on components
3 changes: 3 additions & 0 deletions packages/svelte/messages/compile-errors/const_tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## invalid_const_placement

{@const} must be the immediate child of {#snippet}, {#if}, {:else if}, {:else}, {#each}, {:then}, {:catch}, <svelte:fragment> or <Component>
51 changes: 51 additions & 0 deletions packages/svelte/messages/compile-errors/css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## invalid_css_empty_declaration

Declaration cannot be empty

## invalid_css_global_block_list

A :global {...} block cannot be part of a selector list with more than one item

## invalid_css_global_block_modifier

A :global {...} block cannot modify an existing selector

## invalid_css_global_block_combinator

A :global {...} block cannot follow a %name% combinator

## invalid_css_global_block_declaration

A :global {...} block can only contain rules, not declarations

## invalid_css_global_placement

:global(...) can be at the start or end of a selector sequence, but not in the middle

## invalid_css_global_selector

:global(...) must contain exactly one selector

## invalid_css_global_selector_list

:global(...) must not contain type or universal selectors when used in a compound selector

## invalid_css_type_selector_placement

:global(...) must not be followed with a type selector

## invalid_css_selector

Invalid selector

## invalid_css_identifier

Expected a valid CSS identifier

## invalid_nesting_selector

Nesting selectors can only be used inside a rule

## invalid_css_declaration

Declaration cannot be empty
27 changes: 27 additions & 0 deletions packages/svelte/messages/compile-errors/elements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## invalid_textarea_content

A `<textarea>` can have either a value attribute or (equivalently) child content, but not both

## invalid_void_content

Void elements cannot have children or closing tags

## invalid_element_content

<%name%> cannot have children

## invalid_tag_name

Expected valid tag name

## invalid_node_placement

%thing% is invalid inside <%parent%>

## illegal_title_attribute

`<title>` cannot have attributes nor directives

## invalid_title_content

`<title>` can only contain text and {tags}
3 changes: 3 additions & 0 deletions packages/svelte/messages/compile-errors/legacy_reactivity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## cyclical_reactive_declaration

Cyclical dependency detected: %cycle%
147 changes: 147 additions & 0 deletions packages/svelte/messages/compile-errors/parse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
## unclosed_element

`<%name%>` was left open

## unclosed_block

Block was left open

## unexpected_block_close

Unexpected block closing tag

## unexpected_eof

Unexpected end of input

## js_parse_error

%message%

## expected_token

Expected token %token%

## unexpected_reserved_word

'%word%' is a reserved word in JavaScript and cannot be used here

## missing_whitespace

Expected whitespace

## expected_pattern

Expected identifier or destructure pattern

## invalid_script_context

If the context attribute is supplied, its value must be "module"

## invalid_elseif

'elseif' should be 'else if'

## invalid_continuing_block_placement

{:...} block is invalid at this position (did you forget to close the preceeding element or block?)

## invalid_block_missing_parent

%child% block must be a child of %parent%

## duplicate_block_part

%name% cannot appear more than once within a block

## expected_block_type

Expected 'if', 'each', 'await', 'key' or 'snippet'

## expected_identifier

Expected an identifier

## invalid_debug

{@debug ...} arguments must be identifiers, not arbitrary expressions

## invalid_const

{@const ...} must be an assignment

## invalid_block_placement

{#%name% ...} block cannot be %location%

## invalid_tag_placement

{@%name% ...} tag cannot be %location%

## missing_attribute_value

Expected attribute value

## unclosed_attribute_value

Expected closing %delimiter% character

## invalid_directive_value

Directive value must be a JavaScript expression enclosed in curly braces

## empty_directive_name

%type% name cannot be empty

## invalid_closing_tag

</%name%> attempted to close an element that was not open

## invalid_closing_tag_after_autoclose

</%name%> attempted to close element that was already automatically closed by <%reason%> (cannot nest <%reason%> inside <%name%>)

## invalid_dollar_binding

The $ name is reserved, and cannot be used for variables and imports

## invalid_dollar_prefix

The $ prefix is reserved, and cannot be used for variables and imports

## invalid_dollar_global

The $ name is reserved. To reference a global variable called $, use globalThis.$

## illegal_subscription

Cannot reference store value inside `<script context="module">`

## duplicate_style_element

A component can have a single top-level `<style>` element

## duplicate_script_element

A component can have a single top-level `<script>` element and/or a single top-level `<script context="module">` element

## invalid_render_expression

{@render ...} tags can only contain call expressions

## invalid_render_arguments

expected at most one argument

## invalid_render_call

Calling a snippet function using apply, bind or call is not allowed

## invalid_render_spread_argument

cannot use spread arguments in {@render ...} tags

## invalid_snippet_rest_parameter

snippets do not support rest parameters; use an array instead
Loading
Loading