remove compiler error due to potential of false positives

props-bindable
Simon Holthausen 6 months ago
parent e17e5e78bc
commit 695a309567

@ -182,8 +182,6 @@ const runes = {
`$props() assignment must not contain nested properties or computed keys`,
'invalid-props-location': () =>
`$props() can only be used at the top level of components as a variable declaration initializer`,
'invalid-props-mutation': () =>
'Properties defined by $props() cannot be mutated. Use $props.bindable() instead, or make a copy of the value and reassign it.',
/** @param {string} rune */
'invalid-state-location': (rune) =>
`${rune}(...) can only be used as a variable declaration initializer or a class field`,

@ -330,10 +330,6 @@ const validation = {
// TODO handle mutations of non-state/props in runes mode
}
if (assignee.type === 'MemberExpression' && binding?.kind === 'prop') {
error(node, 'invalid-props-mutation');
}
if (node.name === 'group') {
if (!binding) {
error(node, 'INTERNAL', 'Cannot find declaration for bind:group');
@ -984,11 +980,6 @@ function validate_assignment(node, argument, state) {
if (binding?.kind === 'each') {
error(node, 'invalid-each-assignment');
}
} else if (argument.type === 'MemberExpression') {
const id = object(argument);
if (id && state.scope.get(id.name)?.kind === 'prop') {
error(node, 'invalid-props-mutation');
}
}
let obj = /** @type {import('estree').Expression | import('estree').Super} */ (argument);

@ -1,9 +0,0 @@
import { test } from '../../test';
export default test({
error: {
code: 'invalid-props-mutation',
message:
'Properties defined by $props() cannot be mutated. Use $props.bindable() instead, or make a copy of the value and reassign it.'
}
});
Loading…
Cancel
Save