Skip to content

Disallow var statements #310

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 1 commit into from
Jul 26, 2019
Merged

Disallow var statements #310

merged 1 commit into from
Jul 26, 2019

Conversation

openorclose
Copy link
Contributor

Let's disallow var statements and allow only const and let.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1432

  • 17 of 17 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 91.683%

Totals Coverage Status
Change from base Build 1426: 0.06%
Covered Lines: 1729
Relevant Lines: 1864

💛 - Coveralls


checkers: {
VariableDeclaration(node: es.VariableDeclaration, ancestors: [es.Node]) {
if (node.kind === 'var') {
Copy link
Member

Choose a reason for hiding this comment

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

I think it might be better to have a rule to allow const and let only rather than to disallow var, and we can merge with noDeclareMutable

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, I take this back. Not currently sane to have a whitelist using rules.


checkers: {
VariableDeclaration(node: es.VariableDeclaration, ancestors: [es.Node]) {
if (node.kind === 'var') {
Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, I take this back. Not currently sane to have a whitelist using rules.

@openorclose
Copy link
Contributor Author

Yeah. I wanted to combine the two also but it's not possible for now.

@openorclose openorclose merged commit 94838ba into master Jul 26, 2019
@thomastanck thomastanck deleted the prevent-var branch August 1, 2020 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants