-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adding tslint and gulp #1403
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
Adding tslint and gulp #1403
Conversation
@@ -63,7 +62,7 @@ export class RemoteAttachPicker { | |||
let pipeProgram: string = pipeTransport.pipeProgram; | |||
let pipeArgs: string[] = pipeTransport.pipeArgs; | |||
|
|||
let argList = RemoteAttachPicker.createArgumentList(pipeArgs); | |||
let argList: string = RemoteAttachPicker.createArgumentList(pipeArgs); |
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.
Do we really need to add a rule to complain about not being explicit everywhere? A lot of these typings are obvious based on the code (which is probably why they were left out), and VS Code IntelliSense already lets you know the type when the appropriate typings are found. I find this rule to be a bit too cumbersome.
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.
(BTW, I meant to put this comment on line 87 which makes a little more sense than putting it here - sorry!)
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.
Are always using explicit types recommended typescript practice? I assume you could omit the type when the compiler is able to determine it, like with "auto" in C++. I think making the type explicit is good for readability when it's unclear, but often times it doesn't really help and just adds extra text.
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.
Yes, explicit types is recommended Typescript practice. If the type is a dictionary, feel free to use any
. However most of the time, the type should be defined.
On the rare chance that this is too much (e.g. https://github.com/WardenGnaw/vscode-cpptools/blob/5c231a544c283a0ef6fb053e703846eff76e350f/Extension/src/LanguageServer/protocolFilter.ts#L13) then disabling the linter is fine.
Extension/src/main.ts
Outdated
let words = str.split(" "); | ||
let result = ""; | ||
let words: string[] = str.split(" "); | ||
let result: string = ""; | ||
for (let word of words) { | ||
if (word.indexOf(".") == -1 && word.indexOf("/") == -1 && word.indexOf("\\") == -1 && word.indexOf(":") == -1) { | ||
result += word + " "; | ||
} | ||
else { |
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.
is there a rule to enforce correct formatting of if-else blocks? The "else" should be on the line above next to the {
Adding tslint and the associated changes that it complains about. Adding gulp to do tests, tslint, and more. Including package-lock.json that it keeps complaining about.
Added npm run test, watch, and tslint.
new-parens for forcing all constructor calls to have parenthesis. no more than 1 consecutive blank lines no useage of String(), Boolean(), or Number(), use native type.
5bbb94e
to
5c231a5
Compare
|
||
const lintReporter = (output, file, options) => { | ||
//emits: src/helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’ | ||
var relativeBase = file.base.substring(file.cwd.length + 1).replace('\\', '/'); |
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.
see if you could get source navigation from the lint output to code, from vscode build output.
var handleDownloadFailure = (num, error) => { | ||
let lastError: any = null; | ||
let retryCount: number = 0; | ||
let handleDownloadFailure: (num: any, error: any) => void = (num, error) => { |
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.
num: number
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.
Will add to next PR
return this.DownloadFile(pkg.url, pkg, 4).catch((error) => { handleDownloadFailure(5, error); | ||
return this.DownloadFile(pkg.url, pkg, 5); // Last try, don't catch the error. | ||
})})})})}).then(() => { | ||
return this.DownloadFile(pkg.url, pkg, 0).catch((error) => { |
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.
add todo to fix later.
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.
Will add to next PR
👍 |
Adding tslint and the associated fixes that it complains about.
Adding gulp to do tests, tslint, and more.
Including package-lock.json that it keeps complaining about.