Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix latest tslint errors#13006

Merged
mhegazy merged 8 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
saschanaz:lintfixsaschanaz/TypeScript:lintfixCopy head branch name to clipboard
Dec 26, 2016
Merged

Fix latest tslint errors#13006
mhegazy merged 8 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
saschanaz:lintfixsaschanaz/TypeScript:lintfixCopy head branch name to clipboard

Conversation

@saschanaz

@saschanaz saschanaz commented Dec 18, 2016

Copy link
Copy Markdown
Contributor

Except this type of errors:

export function getNavigationTree(sourceFile: SourceFile): NavigationTree {
    curSourceFile = sourceFile;
    const result = convertToTree(rootNavigationBarNode(sourceFile));
    curSourceFile = undefined;
    return result;
}
let curSourceFile: SourceFile;
// Identifier 'curSourceFile' is never reassigned; use 'const' instead of 'let'.
let response: protocol.Response;
try {
    ({ response } = this.executeCommand(msg));
}
//  Identifier 'response' is never reassigned; use 'const' instead of 'let'.

I think they are tslint bugs rather than actual code problem. (palantir/tslint#1898)

BTW I feel fairly painful to create a new constant for every for-loop, I hope there is a better way to keep high performance...

@saschanaz

saschanaz commented Dec 18, 2016

Copy link
Copy Markdown
Contributor Author

A benchmark shows for-of loop is much slower on Chrome (and thus node.js), does this mean we shouldn't use for-of?

@ghost

ghost commented Dec 18, 2016

Copy link
Copy Markdown

for-of gets emitted as a for loop, since we use an ES5 target. (So maybe some of those manually-written for loops could be upgraded.)
Also, this would be a good time to delete our own preferConstRule.ts since tslint has that now.

@saschanaz

Copy link
Copy Markdown
Contributor Author

Already done the upgrade for obvious cases but many of them are using indices so I couldn't do it for them.

@mhegazy mhegazy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would inline the collection.length check instead of adding a new variable for it. There is not much perf difference on modern engines anyways.

Comment thread src/compiler/checker.ts Outdated
const result: Signature[] = [];
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
const len = symbol.declarations.length;
for (let i = 0; i < len; i++) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to for..of?

@saschanaz saschanaz Dec 19, 2016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inner lines of code use i for some purpose. It seems I can still switch to for-of in this case but should I do it?

Comment thread src/compiler/checker.ts
for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {
const n = declaration.parameters.length;
for (let i = isJSConstructSignature ? 1 : 0; i < n; i++) {
const param = declaration.parameters[i];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {

@mhegazy

mhegazy commented Dec 19, 2016

Copy link
Copy Markdown
Contributor

@saschanaz i have merged a change to move tslint back to 4.0.0-dev.3 (#13028). can you update it with your PR to next again.

@saschanaz

Copy link
Copy Markdown
Contributor Author

It still won't pass because of some bugs, which should be fixed on tslint side.

@mhegazy

mhegazy commented Dec 19, 2016

Copy link
Copy Markdown
Contributor

It still won't pass because of some bugs, which should be fixed on tslint side.

do you have a list of the issues?

@ghost

ghost commented Dec 19, 2016

Copy link
Copy Markdown

@mhegazy See first post and palantir/tslint#1898. I actually fixed one of them yesterday. The other one is also a legitimate issue, but could be fixed on our end by moving the declaration ( let curSourceFile: SourceFile;) to before the function.

@saschanaz

Copy link
Copy Markdown
Contributor Author

@Andy-MS I'm still seeing destructuring issue on Travis, should I do something to get the merged fix?

@ghost

ghost commented Dec 19, 2016

Copy link
Copy Markdown

tslint hasn't published a new version yet, so there's not much to do but wait.

@vladima

vladima commented Dec 19, 2016

Copy link
Copy Markdown
Contributor

I'd prefer not to change our code to workaround bugs in the toolchain hence palantir/tslint#1908

@mhegazy

mhegazy commented Dec 21, 2016

Copy link
Copy Markdown
Contributor

@nchen63 any news about palantir/tslint#1908?

@nchen63

nchen63 commented Dec 23, 2016

Copy link
Copy Markdown
Contributor

it's merged and included in a new release, v4.2.0

@saschanaz

Copy link
Copy Markdown
Contributor Author

It seems tslint@next is still giving tslint@4.1.0-dev.0.

@nchen63

nchen63 commented Dec 23, 2016

Copy link
Copy Markdown
Contributor

should be fixed now

@saschanaz saschanaz closed this Dec 23, 2016
@saschanaz saschanaz reopened this Dec 23, 2016
@mhegazy mhegazy merged commit e4b81d0 into microsoft:master Dec 26, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.