Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 461 Bytes

valid-track.md

File metadata and controls

40 lines (29 loc) · 461 Bytes

Validate track decorator usage (valid-track)

Apply the @track decorator to class fields only.

Rule details

Example of incorrect code:

import { track } from 'lwc';

@track
class Foo {}

class Foo {
    @track
    trackedMethod() {}
}

class Foo {
    @track
    set state(value) {}
}

class Foo {
    @track
    static state;
}

Example of correct code:

import { track } from 'lwc';

class Foo {
    @track
    state;
}