-
Notifications
You must be signed in to change notification settings - Fork 26.2k
refactor(docs-infra): use eslint in aio's example-lint script #43218
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): use eslint in aio's example-lint script #43218
Conversation
|
@gkalpak here we are! 😄 🎉 But actually.... eslint seems to not handling very well the large amount of files to check here, and it is so much slower than tslint in this instance... whilst this check takes tslint around 40 seconds on my machine, eslint takes around 4 minutes.... 😞 This is rather unfortunate... but I guess it would still make sense to move away from the deprecates tslint.... what do you think? |
aio/content/examples/component-interaction/src/app/votetaker.component.ts
Show resolved
Hide resolved
aio/content/examples/dependency-injection-in-action/src/app/logger.service.ts
Show resolved
Hide resolved
93bd4fc to
7a520cb
Compare
aio/content/examples/dependency-injection/src/app/test.component.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/form-validation/src/app/reactive/hero-form-reactive.component.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/testing/src/app/dashboard/dashboard-hero.component.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/upgrade-module/src/app/a-to-ajs-providers/app.module.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/component-interaction/src/app/votetaker.component.ts
Outdated
Show resolved
Hide resolved
4ffd04e to
2678b4e
Compare
|
@rafaelss95 Thank you so very much for your nice reviewing! it was really helpful and much appreciated! 😃 I replied to your comments feel free to have another look 🙂 (ps: again same as list time, for some reason I cannot re-request your review 😕) |
aio/content/examples/upgrade-module/src/app/downgrade-io/hero-detail.component.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/dependency-injection-in-action/src/app/runners-up.ts
Outdated
Show resolved
Hide resolved
2678b4e to
442de90
Compare
442de90 to
4068711
Compare
|
Hi @dario-piotrowicz, creator of Regarding:
I cover performance concerns in depth in the README here: https://github.com/angular-eslint/angular-eslint#eslint-configs-and-performance I do regret caving to the pressure of not having an extra tsconfig file by default. I think we will change this in v13. For now, though, let's work through that guide for this case (and even take it a bit further at the end): Baseline - how you have it configured at the time of writing ❯ time yarn lint
yarn run v1.22.10
$ yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint
$ yarn ~~check-env
$ node scripts/check-environment
$ yarn aio-check-local
$ node tools/ng-packages-installer check .
$ eslint --ignore-path="tools/transforms/.eslintignore" tools/transforms
Linting "site"...
All files pass linting.
$ eslint content/examples
$ eslint tools/firebase-test-utils && eslint tools/ng-packages-installer
✨ Done in 108.88s.
yarn lint 98.18s user 33.07s system 120% cpu 1:49.20 totalFollowing the performance guide - adding tsconfig.eslint.json and updating .eslintrc.json CREATE tsconfig.eslint.json {
"extends": "./tsconfig.json",
"include": ["**/*.ts"],
"exclude": ["aio-builds-setup", "dist", "node_modules", "out-tsc", "scripts"]
}UPDATE .eslintrc.json "parserOptions": {
- "project": [
- "tsconfig.json",
- "tests/e2e/tsconfig.json"
- ],
+ "project": ["tsconfig.eslint.json"],
- "createDefaultProgram": true
+ "createDefaultProgram": false
}❯ time yarn lint
yarn run v1.22.10
$ yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint
$ yarn ~~check-env
$ node scripts/check-environment
$ yarn aio-check-local
$ node tools/ng-packages-installer check .
$ eslint --ignore-path="tools/transforms/.eslintignore" tools/transforms
Linting "site"...
All files pass linting.
$ eslint content/examples
$ eslint tools/firebase-test-utils && eslint tools/ng-packages-installer
✨ Done in 62.91s.
yarn lint 71.74s user 7.41s system 125% cpu 1:03.25 totalPossibly going even further - no type-checking rules - updating .eslintrc.json You are currently only using one type-checking aware rule - If you can live without that rule, you can speed things up significantly because some expensive Program creation can be skipped. In this scenario, no "parserOptions": {
- "project": [
- "tsconfig.json",
- "tests/e2e/tsconfig.json"
- ],
+ "project": null,
- "createDefaultProgram": true
}
// ...further down in the rules section...
- "dot-notation": "error",
+ "dot-notation": "off",
+ "@typescript-eslint/dot-notation": "off",❯ time yarn lint
yarn run v1.22.10
$ yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint
$ yarn ~~check-env
$ node scripts/check-environment
$ yarn aio-check-local
$ node tools/ng-packages-installer check .
$ eslint --ignore-path="tools/transforms/.eslintignore" tools/transforms
Linting "site"...
All files pass linting.
$ eslint content/examples
$ eslint tools/firebase-test-utils && eslint tools/ng-packages-installer
✨ Done in 31.45s.
yarn lint 35.01s user 3.48s system 120% cpu 31.927 total |
|
Hi @JamesHenry , thank you so very much for your awesome comment and also for the great contribution you've done to the community with your I must admit I didn't really read that part of the readme 😓 Seems like going with the last alternative would be the best thing for me as it really looks so much faster, but I am not totally sure. The fact is that if in the future we'd need to add new rules with type-checking we would have to change the eslintrc file and potentially fall back into the original time issue Whilst with the second solution the linting would not be as fast but we would be more future-proof... Did I get it right @JamesHenry ? that's you're view on this what would you go for? Also since I am just a simple contributor I would really love to hear what someone from the angular team would have to say about this 🙂 (@gkalpak I'm counting on you! 😄) |
|
You can preview 93bd4fc at https://pr43218-93bd4fc.ngbuilds.io/. |
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.
As usual, great work there, @dario-piotrowicz 💯
And thx for chiming in on performance, @JamesHenry ❤️
I've left a few comments. I think I have addressed all your questions (let me know in case I've missed something). Regarding speed, I suggest we first focus on getting the linting behavior we want and then look into making it fast.
Based on prior discussions (here and during the docs-infra team meeting), here is some additional work than needs to be done (not necessarily as part of this PR) before landing this PR:
- Remove
aio/content/examples/tslint.json(and thetslintdependency if not needed any more). Determine if we still needaio/content/examples/tsconfig.json? - Ensure we strip off files/config related to linting (such as
tslint.jsonfiles) from the generated StackBlitz examples and ZIP archives. - Have tooling remove linting comments from code snippets.
(You don't have to worry about the tasks listed above, @dario-piotrowicz. I am just putting them here for tracking purposes.)
aio/content/examples/component-overview/src/app/app.component.spec.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/dependency-injection/src/app/heroes/hero.service.provider.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/hierarchical-dependency-injection/src/app/villains.service.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/http/src/app/http-error-handler.service.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/dependency-injection-in-action/src/app/runners-up.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/upgrade-module/src/app/a-to-ajs-providers/app.module.ts
Outdated
Show resolved
Hide resolved
aio/content/examples/form-validation/src/app/reactive/hero-form-reactive.component.ts
Outdated
Show resolved
Hide resolved
4068711 to
608a306
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.
reviewed-for: public-api
Instead of the deprecated tslint use eslint in the aio's example-lint script
Remove unused tslint config and comments from docs examples.
558051c to
8420d60
Compare
|
You can preview 8420d60 at https://pr43218-8420d60.ngbuilds.io/. |
|
@gkalpak what do you think, is this one ready to go? 😃 |
|
It still needs one more |
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.
Reviewed-for: public-api
Files reviewed: aio/content/examples/styleguide/*
|
This PR was merged into the repository by commit 835987b. |
|
@dario-piotrowicz just wanted to say Thank You for all your work on this PR (including communication and addressing the feedback), this is very impressive (150 files changed)! 👍 |
Thanks a lot @AndrewKushnir! ❤️ But I can't take all the credit, @gkalpak helped me a lot, and even added a couple of commits for me too 😍 The cool thing is, I think (I may need to double check), that with this PR merged all instances of tslint have been removed from all of the aio project (including the site, tooling and here the examples) 😃 🥳 🚀 😎 🎉 |
|
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. |


Instead of the deprecated tslint use eslint in the aio's example-lint script
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?
Linting for the aio example is done using tslint (which is deprecated)
Issue Number: N/A
What is the new behavior?
Linting for the aio example is done using eslint
Does this PR introduce a breaking change?