Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

fix most of the autoFix issues using TSLint 4.0 #138

Closed
wants to merge 1 commit into from
Closed

fix most of the autoFix issues using TSLint 4.0 #138

wants to merge 1 commit into from

Conversation

rlasjunies
Copy link

Hi @egamma

Here is a proposal of fix for most of the autoFix issue identified since TSLint 4.0. #135

Actions done:

  • convert the offset in position
  • add a sub tslint-tests at the root of vscode-tslint to collect some tests cases used in these days

Remaining activities identified:

  • no-var-keyword still not supported. This autoFix need more work in the alogrithm. This is the only one not working. => To Do : support multiple inner replacements
  • during the tests I've got the 'innerText' from undefined error ... without the opportunity to reproduce.
  • there is a tsc error in the server code but does not prohibit emit
if (configurationResult.error) {
   throw configurationResult.error;
}

I let you have trial on this proposal, it should help.

BR

@egamma
Copy link
Member

egamma commented Nov 26, 2016

@rlasjunies thanks for looking into this.

Regarding

there is a tsc error in the server code but does not prohibit emit

sigh, tslint broke the API between version 4.0.1 and 4.0.2 palantir/tslint#1789. I'll try to work around it.

@rlasjunies
Copy link
Author

that pretty good, I've seen you have fixed the innerText and the "error".

For the no_var_keyword, I think we need time to fix it. I do not understand what is provided by tslint innerReplacements. Do you know what is expected when there are several several records in the innerReplacements array.

In all the case, I believe it better to publish the fixes as they support the other autoFix rules from tslint 4.0 ( even import-ordered ).

@egamma
Copy link
Member

egamma commented Nov 27, 2016

@rlasjunies I've manually merged the changes, thanks 🌷

The tslint-tests are good, we should look into automating these tests. I'll look into this.

  • I've added an array-type test case to tslint-test. This is also an auto fix with multiple edits
  • I changed the code to not offer an auto fix if the fix consists of more than 1 replacement. In this way the source code isn't damaged.

For the no_var_keyword, I think we need time to fix it. I do not understand what is provided by tslint innerReplacements. Do you know what is expected when there are several several records in the innerReplacements array.

From looking at how the replacements are constructed for some rules in tslint I assume that the idea is that the replacements are applied in sequence. This means we need support creating multiple edits in record actions. Applying multiple (non-overlapping) edits is supported by the editor.

I agree that we should publish this improved version. I'll do so today.

Closing this PR.

@egamma egamma closed this Nov 27, 2016
@egamma egamma modified the milestone: November Dec 9, 2016
adenflorian pushed a commit to adenflorian/vscode-tslint that referenced this pull request Oct 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants