Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Add prefer-const rule to tslint #1009

Merged
merged 1 commit into from
Aug 28, 2017
Merged

Conversation

rosen-vladimirov
Copy link
Collaborator

Enable prefer-const rule in tslint and fix the errors:
The rule requires that variable declarations use const instead of let and var if possible.

If a variable is only assigned to once when it is declared, it should be declared using const

The prefer-const rule checks the code and verifies the usage of let and const

Copy link
Contributor

@Mitko-Kerezov Mitko-Kerezov left a comment

Choose a reason for hiding this comment

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

If the linter's happy then I am too 👍

let urlString = args[0],
username = args[1],
password = args[2];
let urlString = args[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

const?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nope, it is set on line 39
Also now linter checks if any const can be used instead of let and shows error in this case.

helpers.ts Outdated
@@ -1,6 +1,6 @@
import * as uuid from "uuid";
import * as net from "net";
let Table = require("cli-table");
const Table = require("cli-table");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the const after the imports, seems more right :)

Enable `prefer-const` rule in tslint and fix the errors:
The rule requires that variable declarations use const instead of let and var if possible.

If a variable is only assigned to once when it is declared, it should be declared using `const`

The prefer-const rule checks the code and verifies the usage of let and const
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/prefer-const branch from 6697c53 to 408e9cd Compare August 28, 2017 10:33
@rosen-vladimirov rosen-vladimirov merged commit 5b4c6da into master Aug 28, 2017
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/prefer-const branch August 28, 2017 10:41
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.

3 participants