add warnings for deprecated <svelte:options> attributes

pull/11277/head
Rich Harris 5 months ago
parent 2837a1b30c
commit b45d272747

@ -406,8 +406,20 @@ export function analyze_component(root, source, options) {
source
};
if (!options.customElement && root.options?.customElement) {
warn(analysis.warnings, root.options, [], 'missing-custom-element-compile-option');
if (root.options) {
for (const attribute of root.options.attributes) {
if (attribute.name === 'accessors') {
warn(analysis.warnings, attribute, [], 'deprecated-accessors');
}
if (attribute.name === 'customElement' && !options.customElement) {
warn(analysis.warnings, attribute, [], 'missing-custom-element-compile-option');
}
if (attribute.name === 'immutable') {
warn(analysis.warnings, attribute, [], 'deprecated-immutable');
}
}
}
if (analysis.runes) {

@ -238,7 +238,11 @@ const legacy = {
`Using <slot> to render parent content is deprecated. Use {@render ...} tags instead.`,
/** @param {string} name */
'deprecated-event-handler': (name) =>
`Using on:${name} to listen to the ${name} event is is deprecated. Use the event attribute on${name} instead.`
`Using on:${name} to listen to the ${name} event is is deprecated. Use the event attribute on${name} instead.`,
'deprecated-accessors': () =>
`The accessors option has been deprecated. It will have no effect in runes mode.`,
'deprecated-immutable': () =>
`The immutable option has been deprecated. It will have no effect in runes mode.`
};
const block = {

@ -4,11 +4,11 @@
"message": "The 'customElement' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?",
"start": {
"line": 1,
"column": 0
"column": 16
},
"end": {
"line": 1,
"column": 49
"column": 46
}
}
]

Loading…
Cancel
Save