Skip to content

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

Merged
merged 10 commits into from
Jan 5, 2018
Merged

Conversation

WardenGnaw
Copy link
Member

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.

@WardenGnaw WardenGnaw self-assigned this Jan 3, 2018
@@ -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);
Copy link
Member

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.

Copy link
Member

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!)

Copy link
Contributor

@sean-mcmanus sean-mcmanus Jan 5, 2018

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.

Copy link
Member Author

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.

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 {
Copy link
Member

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.
@WardenGnaw WardenGnaw force-pushed the dev/waan/lintandgulp branch from 5bbb94e to 5c231a5 Compare January 4, 2018 21:17

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('\\', '/');

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) => {

Choose a reason for hiding this comment

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

num: number

Copy link
Member Author

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) => {

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.

Copy link
Member Author

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

@rajkumar42
Copy link

👍

@WardenGnaw WardenGnaw merged commit c728178 into microsoft:master Jan 5, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2020
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.

4 participants