Skip to content

False custom_element_props_identifier errors with no custom elements #1241

@kyoshino

Description

@kyoshino

Describe the bug

After sveltejs/svelte#16003 landed in [email protected], I started getting custom_element_props_identifier errors with a rest prop even though my project doesn’t use custom elements. These errors come from ESLint with eslint-plugin-svelte installed, but not from svelte-check.

I could silence the errors by adding svelte/valid-compile: off to the ESLint config, but something is going wrong on the Svelte side. It may be a bug in eslint-plugin-svelte, but I’m not sure.

Reproduction

Repo: https://github.com/sveltia/sveltia-cms

One of the errors is raised here: image.svelte

A minimum reproduction:

<script>
  let { ...rest } = $props();
</script>

Logs

$ eslint .

/Users/Kohei/Sites/sveltia-cms/src/lib/components/assets/shared/asset-preview.svelte
  45:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

/Users/Kohei/Sites/sveltia-cms/src/lib/components/assets/shared/image.svelte
  33:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

/Users/Kohei/Sites/sveltia-cms/src/lib/components/assets/shared/video.svelte
  30:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

/Users/Kohei/Sites/sveltia-cms/src/lib/components/common/list-container.svelte
  18:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

/Users/Kohei/Sites/sveltia-cms/src/lib/components/common/listing-grid.svelte
  25:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

/Users/Kohei/Sites/sveltia-cms/src/lib/components/common/page-container-main-area.svelte
  21:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

/Users/Kohei/Sites/sveltia-cms/src/lib/components/common/page-container.svelte
  21:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

/Users/Kohei/Sites/sveltia-cms/src/lib/components/common/page-toolbar/view-switcher.svelte
  23:5  error  Using a rest element or a non-destructured declaration with `$props()` means that Svelte can't infer what properties to expose when creating a custom element. Consider destructuring all the props or explicitly specifying the `customElement.props` option.
https://svelte.dev/e/custom_element_props_identifier(custom_element_props_identifier)  svelte/valid-compile

✖ 8 problems (8 errors, 0 warnings)

System Info

-

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions