Skip to content
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

Re-enable the unused variables tslint rule for the hygiene task fixes #42157 #42831

Merged
merged 11 commits into from Feb 26, 2018

Conversation

egamma
Copy link
Member

@egamma egamma commented Feb 2, 2018

This Pull request enables the tslint rule for unused-variables. This is done by performing the tslint checks in the context of a Typescript program/project with the tslint rule for unused-variables enabled. Since the checks have to be done in the context of a TS project I currently define the src folder to be this project, this means extensions and tests are no longer tslinted as part of the hygiene.

The tslint rule had some false positive issues in the tslint version 5.8, so this PR also updates tslint to version 5.9.

@egamma egamma added the engineering VS Code - Build / issue tracking / etc. label Feb 2, 2018
@egamma egamma added this to the February 2018 milestone Feb 2, 2018
@joaomoreno
Copy link
Member

@egamma Looks good. Should we still keep the old tslint filter on the test/** and extension/** files?

@egamma
Copy link
Member Author

egamma commented Feb 14, 2018

@joaomoreno

Should we still keep the old tslint filter on the test/** and extension/** files?

The unused variable rule requires that linting is done in the context of a project. Currently the only project that hygiene knows about is the src project. It would be possible to add know how about the other projects in the test and extensions folder:

  • in the test folder there is a single project for the smoke test
  • in the extensions folder there is a project for each extension, that has a tsconfig.json (git, emmet, ...) about 10 of them.

Thinking about this again we should also run hygiene/tslint on the extensions. I´ll look into it.

@kieferrm kieferrm mentioned this pull request Feb 20, 2018
45 tasks
@egamma
Copy link
Member Author

egamma commented Feb 21, 2018

@joaomoreno enabled linting of extensions and tests. Gave a heads-up to extension owners to enable the noUnusedLocals in the tsconfig.json.

@joaomoreno joaomoreno merged commit 635f82f into master Feb 26, 2018
@joaomoreno
Copy link
Member

Looks good to me!

@joaomoreno joaomoreno deleted the unused-variables branch February 26, 2018 15:06
@bpasero
Copy link
Member

bpasero commented Feb 26, 2018

@egamma @joaomoreno fyi after this change landed I feel that git-commit takes easily 3-5 times as long as before, could that be related?

@egamma
Copy link
Member Author

egamma commented Feb 26, 2018

@bpasero @joaomoreno the slow down is caused by tslint creating a project for the changed files, so that the no-unused-variables rule can be applied. Creating the program context depends on the dependencies of the source file. For files inside the base this takes below 1s. For files from an upper layer like the ones you used in commit 442903c this takes 12s. This is a one time cost and the cost is amortized for many files, but in a commit you usually do not have many files and hygiene runs over a small number of files only.

Since the goal is that the hygiene check is fast this setup takes too long and we should roll back and not create a program context for running tslint.

@bpasero
Copy link
Member

bpasero commented Feb 27, 2018

@egamma as someone that commits very often right after making a change, I really cannot work with this new behaviour and would like to disable it.

@egamma
Copy link
Member Author

egamma commented Feb 27, 2018

@bpasero agreed I´ve disabled it.

@bpasero
Copy link
Member

bpasero commented Feb 27, 2018

Thanks 👍

@joaomoreno
Copy link
Member

Too bad... I think we're just going to have to bite unused variables as compiler errors, which we don't prevent from committing right now anyway.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
engineering VS Code - Build / issue tracking / etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants