-
Notifications
You must be signed in to change notification settings - Fork 26.9k
refactor(docs-infra): migrate from tslint to eslint #42820
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
refactor(docs-infra): migrate from tslint to eslint #42820
Conversation
|
Hi @gkalpak 🙂 So, the migration is looking.... good?... hopefully? 😅 I opened this draft PR so start a bit of a discussion and see how you see this, I hope you don't mind 🙂 |
|
First of all, what do you think of the incompatible typescript version? is this something we can accept or it's a deal breaker? 🤔 (I would not want to downgrade the current typescript just to accommodate eslint) |
405fdcd to
ef398d8
Compare
aio/src/app/custom-elements/resource/resource-list.component.html
Outdated
Show resolved
Hide resolved
aio/src/app/custom-elements/resource/resource-list.component.ts
Outdated
Show resolved
Hide resolved
ef398d8 to
5c390c3
Compare
gkalpak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work (as usual), @dario-piotrowicz ❤️
Just a few minor comments, but this is looking very promising 😃
aio/src/app/custom-elements/resource/resource-list.component.html
Outdated
Show resolved
Hide resolved
Thanks a lot for the kind words!!!! 🙂 Well, your comments don't seem to be "just a few" 😅 (I'm going to check them out now!), By the way, could you comment on the typescript version warning? don't you see it as a problem here? 🙂 |
a8959cb to
3dc0712
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for making the changes, @dario-piotrowicz 👍
Getting closer 🏃♂️
Well, your comments don't seem to be "just a few" 😅
Given the size of the PR, they were really "just a few" 😛
I really hope I am not burdening you with this 😓
thank you so very much for taking the time to review the PR 🥰
It would have taken me much more time to do the actual work myself, so thank you for taking it on 💪
By the way, could you comment on the typescript version warning? don't you see it as a problem here? 🙂
Sorry, I meant to comment on that, but then forgot.
Yeah, it's not ideal, but I don't think it is a problem here (as long as linting passes 😅).
[NOTE-TO-SELF] Unresolved comments from previous review:
#42820 (comment), #42820 (comment), #42820 (comment), #42820 (comment), #42820 (comment), #42820 (comment)
2f32874 to
2acf9d5
Compare
|
@gkalpak I think that it's looking good 😃 I was about to put this as ready for review but I noticed that the I did not notice those before (and I am not sure what they are about), I will have a look tomorrow, hopefully once these are taken care of we will be in a good place with this 🙂 |
Ah, good point, @dario-piotrowicz. For now, I think it is better to just focus on migrating the AIO app to eslint and keep tslint for the other scripts that need it (to keep the PR scope manageable). In a follow-up PR we can look into switching to eslint for more AIO scripts. |
6fe6c1b to
6355be4
Compare
thanks!!!!! 😍 about the I just checked and it does work, the issue now is that the eslint rule has the so with Alternatively I can just put what do you think the best solution here would be? 🙂 ( once you let me know I'll update the commit message and eventually change the rules 🙂 ) |
a5dd88b to
97ee610
Compare
97ee610 to
420d0cf
Compare
gkalpak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! I think enabling the no-console rule and only allowing log, warn and error is fine. (We could also consider info and debug, but they are not used anywhere, we can leave them out for now.)
420d0cf to
144cd02
Compare
|
@gkalpak should be all good now 😃 |
gkalpak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 🚀 ![]()
migrate aio to eslint as tslint has been deprecated, the migration is restricted to the aio app and
its e2e tests and does not include the other tools, for such reason both tslint and codelyzer have not
been removed (to be done in a next PR)
some minor tweaks needed to be applied to the code so that it would adhere to the new ESLinting behaviour
most TSLint rules have been substituted with their ESLint equivalent, with some exceptions:
* [whitespace] does not have an ESLint equivalent (suggested to be handled by prettier)
* [import-spacing] does not have an ESLint equivalent (suggested to be handled by prettier)
* [ban] replaced with [no-restricted-syntax] as there is no (official/included) ESLint equivalent
some rules have minor different behaviours compared to their TSLint counterparts:
* @typescript-eslint/naming-convention:
- typescript-eslint does not enforce uppercase for const only.
* @typescript-eslint/no-unused-expressions:
- The TSLint optional config "allow-new" is the default ESLint behavior and will no longer be ignored.
* arrow-body-style:
- ESLint will throw an error if the function body is multiline yet has a one-line return on it.
* eqeqeq:
- Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.
* no-console:
- Custom console methods, if they exist, will no longer be allowed.
* no-invalid-this:
- Functions in methods will no longer be ignored.
* no-underscore-dangle:
- Leading and trailing underscores (_) on identifiers will now be ignored.
* prefer-arrow/prefer-arrow-functions:
- ESLint does not support allowing standalone function declarations.
- ESLint does not support allowing named functions defined with the function keyword.
* space-before-function-paren:
- Option "constructor" is not supported by ESLint.
- Option "method" is not supported by ESLint.
additional notes:
* the current typescript version used by the aio app is 4.3.5, which is not supported by typescript-eslint (the supported
versions are >=3.3.1 and <4.3.0). this causes a warning message to appear during linting, this issue should
likely/hopefully disappear in the future as typescript-eslint catches up
* The new "no-console" rule is not completely equivalent to what we had prior the migration, this is because TSLint's "no-console"
rule let you specify the methods you did not want to allow, whilst ESLint's "no-console" lets you specify the methods that you do
want to allow, so and in order not to have a very long list of methods in the ESLint rule it's been decided for the time being
to simply only allow the "log", "warn" and "error" methods
* 4 dependencies have been added as they have been considered necessary (see: angular#42820 (comment))
extra:
* the migration has been performed by following: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslin
* more on typescript-eslint at: https://github.com/typescript-eslint/typescript-eslint
144cd02 to
d32d845
Compare
|
I switched this to |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |

migration to eslint as tslint has been deprecated
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
ng lintruns the deprecated tslintIssue Number: N/A
What is the new behavior?
ng lintruns eslintDoes this PR introduce a breaking change?