Skip to content

False custom_element_props_identifier errors with no custom elements #1241

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

Open
kyoshino opened this issue May 29, 2025 · 1 comment · May be fixed by #1243
Open

False custom_element_props_identifier errors with no custom elements #1241

kyoshino opened this issue May 29, 2025 · 1 comment · May be fixed by #1243

Comments

@kyoshino
Copy link

kyoshino commented May 29, 2025

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

@Rich-Harris Rich-Harris transferred this issue from sveltejs/svelte Jun 2, 2025
@Rich-Harris
Copy link
Member

Transferred issue to eslint-plugin-svelte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants