-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connectedCallback super #32
Comments
There are two ways to detect a custom element:
A lint rule must be able to operate on a single file out of context (i.e. This is pretty much why the polymer linter made use of the same concept. One thing we can investigate in future is detecting same-file Anyhow, back to the rule... its a good idea, we should definitely have something to check that lifecycle callbacks always call super (in a guarded way). |
I can see this covering these 2 cases
|
I have recently updated this plugin in a TS project and I find this rule conflicted with latest typescript. I inherit from LitElement, so the
Should the plugin detect that the guard is not necessary in that case? |
@tpluscode its a rather unnecessary rule if you ask me, for typescript projects. i'd highly recommend it be disabled if using typescript. if its in the default config, i may well remove it from there at some point. for js projects, its super useful because you don't have any type support to know if there is a super call to make. in typescript projects, you should have strict compilation anyway and know when to call super based on the type system. |
Is there any away for this plugin to detect whether its on typescript or not to disable this rule automatically to prevent the rule conflict? |
we could possibly guess based on the parser being used but that isn't the most reliable either. i think i may just remove it from the default config 🤔 and recommend non-js projects to enable it |
Is there any update on this? I think specially a missing |
i've opened 43081j/eslint-plugin-lit#173 for a lit specific solution at least |
I've been doing a lot of workshops where people learn to use lit-html. One of the most common mistakes is to forget calling super.connectedCallback() when using lit-element.
This would be a good linting rule to add.
This is a mirror issue of 43081j/eslint-plugin-lit#36, opened on request.
The text was updated successfully, but these errors were encountered: