Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Rule to limit variable statements to a single declaration #525

Closed
DanielRosenwasser opened this issue Jul 23, 2015 · 7 comments
Closed

Rule to limit variable statements to a single declaration #525

DanielRosenwasser opened this issue Jul 23, 2015 · 7 comments

Comments

@DanielRosenwasser
Copy link
Contributor

It would be nice if we could disallow the following in our codebase:

var x: string, y: number;
@ashwinr
Copy link
Contributor

ashwinr commented Jul 23, 2015

to clairfy: do you mean disallow multiple variable definitions in the same statement?

@DanielRosenwasser DanielRosenwasser changed the title Rule to limit variable statements to a single statement Rule to limit variable declarations to a single statement Jul 23, 2015
@DanielRosenwasser DanielRosenwasser changed the title Rule to limit variable declarations to a single statement Rule to limit variable statements to a single declaration Jul 23, 2015
@DanielRosenwasser
Copy link
Contributor Author

Yup, sorry about that. It was fairly late.

@adidahiya
Copy link
Contributor

Looks like the corresponding eslint rule for this is called one-var: http://eslint.org/docs/rules/one-var

@ashwinr
Copy link
Contributor

ashwinr commented Jul 23, 2015

👍

@YuichiNukiyama
Copy link
Contributor

related PR: #1194

@jkillian
Copy link
Contributor

jkillian commented May 3, 2016

Decided not to go with one-var as it's a somewhat brief name, instead we'll use no-multiple-variable-declaration, which fits TSLint's style better hopefully. Thanks to @YuichiNukiyama for implementing this! It'll be around in the next release. (Still up for renaming things if people feel strongly about it one way or the other)

@jkillian
Copy link
Contributor

jkillian commented May 3, 2016

Actually, I think no-multiple-variable-declaration is ambiguous in which style it's actually disallowing. Now thinking about one-variable-per-declaration instead

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants