fix: only warn on context="module" in runes mode (#13332)

* fix: only warn on context="module" in runes mode

* wow
pull/13336/head
Rich Harris 3 months ago committed by GitHub
parent d6ab12ae76
commit 2553932c2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: only warn on context="module" in runes mode

@ -74,8 +74,6 @@ export function read_script(parser, start, attributes) {
e.script_invalid_context(attribute);
}
w.script_context_deprecated(attribute);
context = 'module';
}
}

@ -359,6 +359,13 @@ export function analyze_component(root, source, options) {
const runes = options.runes ?? Array.from(module.scope.references.keys()).some(is_rune);
if (runes && root.module) {
const context = root.module.attributes.find((attribute) => attribute.name === 'context');
if (context) {
w.script_context_deprecated(context);
}
}
// TODO remove all the ?? stuff, we don't need it now that we're validating the config
/** @type {ComponentAnalysis} */
const analysis = {

@ -0,0 +1,5 @@
<svelte:options runes />
<script context="module">
let num = 2;
</script>

@ -4,11 +4,11 @@
"message": "`context=\"module\"` is deprecated, use the `module` attribute instead",
"start": {
"column": 8,
"line": 1
"line": 3
},
"end": {
"column": 24,
"line": 1
"line": 3
}
}
]
Loading…
Cancel
Save