-
Notifications
You must be signed in to change notification settings - Fork 904
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
introduce ESLint into the build workflow #278
Conversation
@azakus what do you think? This is material's setup here: https://github.com/material-components/material-components-web/blob/master/.eslintrc.yaml |
i rebased in case you ever do want this. let me know |
Friendly ping on this @azakus |
TSLint was always behind in that it was a standalone project rather than an extension.
There is some compatibility config and/or plugin included to match tslint more closely. But really you're better off just starting again (usually just inherit the Google eslint config and you're ready). So the main difference is in what the base/reconnected config contains. Recently they even introduced rules which make use of the type system, so almost all tslint rules are covered now. |
Oh! I just saw this issue! |
@aomarks i did a run of clang-format (the one from latest import {
A,
B,
C
} from 'foo';
// with
import {A, B, C,} from 'foo'; but on super long lines, and even leaving the trailing comma in 🤔 |
I think it would be good to put out another PR for |
If I run with the same |
@aomarks i figured it out.. i copied the npm script from lit-html (and the clang-format file you guys always use): "format": "clang-format --version; find packages | grep '\\.js$\\|\\.ts$' | xargs clang-format --style=file -i", but here, the first good times. not sure what to do about that, probably just manage and try get the new version for myself |
If we add clang-format as a dev-dependency, then I think maybe this is a good command to use on this repo, so that we include test files, but exclude node_modules (you can also make
|
no because the end you're im not sure how we could use the bundled one in combination with a |
Since the lint and clang-format seems to be pretty much done in this PR already, I say we just submit this PR, and then anyone is welcome to send a followup to add husky (seems good, but need to check with the team a bit, since we haven't used it much before). |
Hm, I thought that |
yep you are right @aomarks im not sure whats going on locally then in that case, ill open a new pr |
Are you interested in this?
Basically you already had your ESLint config in the repo and what not, so I:
*-css.ts
(these look like build artifacts?)*.d.ts
(again from builds?)*.ts
(see below)Disabled rules
I disabled the following for ts files:
no-invalid-this
because we very often callthis
in observer functions (which eslint doesn't detect as being bound)no-unused-vars
because we have compiler options enabled to handle this (more accurately)new-cap
because we often call something likenew this.mdcFoundation.foo
Stylistic rules
I set
indent
andmax-len
to warnings because they should ideally be turned off and Prettier (or clang-format) introduced.The gts repo switched over to prettier a while back iirc, so maybe we should do the same. I'm happy to take their config and add prettier here, then run it over the source.
Commits
I committed 5 things separately in case we do or don't want particular parts:
cc @azakus @sorvell @frankiefu