Suresh
Suresh

Reputation: 5997

ESLint is giving warning - Parsing error: Identifier expected in Qwik

Getting the following warning in my vscode editor from eslint

Parsing error: Identifier expected.eslint
(property) bind: value: Signal<string>

enter image description here

I can understand the typescript yelling at me due to some type mismatch, but I can't figure out how to fix this.

Here is a trim down version of my code -

export default component$(() => {
    const action = useCreateUserAccount();
    const nameSig = useSignal(defaultValues.name);
    const emailSig = useSignal(defaultValues.email);
    const passwordSig = useSignal(defaultValues.password);

    useTask$(({ track }) => {
        const status = track(() => action.value?.status);
        if (status) {
            nameSig.value = defaultValues.name;
            emailSig.value = defaultValues.email;
            passwordSig.value = defaultValues.password;
        }
    });


    return (
        <>            
            <Form class="space-y-4 md:space-y-6" action={action} >
                <div>
                    <label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Name</label>
                    <input type="text" name="name" id="name" bind: value={nameSig} placeholder="Write your name" />
                </div>
            </Form>
        </>
    );
});

Deb dependencies using regarding Typescript & ESLint.

Upvotes: 0

Views: 2227

Answers (1)

Giorgio Boa
Giorgio Boa

Reputation: 406

the API is bind:value (without space) here is the docs

In VSCode, Typescript and Javascript Language Features linter mess up bind:value and many other attributes because it adds spaces. Please use Prettier to lint your code because it works better.

Upvotes: 2

Related Questions