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

Enforce ALL_CAPS variables to be declared as const #604

Closed
aicioara opened this issue Aug 24, 2015 · 3 comments
Closed

Enforce ALL_CAPS variables to be declared as const #604

aicioara opened this issue Aug 24, 2015 · 3 comments

Comments

@aicioara
Copy link

ALL_CAPS variables, by convention are constants. It would be nice to have a rule that enforces const instead of let for those.

This might not be needed if #491 is active, but I prefer this weaker form.

@adidahiya adidahiya changed the title Enforce ALL_CAPS variables to be const Enforce ALL_CAPS variables to be declared as const Aug 24, 2015
@adidahiya adidahiya added this to the TSLint 3.x milestone Jan 15, 2016
@adidahiya adidahiya modified the milestones: TSLint v3.x, TSLint v4.x Sep 1, 2016
@adidahiya adidahiya modified the milestones: TSLint v4.x, TSLint 5.x Mar 30, 2017
@JoshuaKGoldberg
Copy link
Contributor

I would argue that this complements prefer-const quite nicely. Together, they enforce that any variable in UPPER_CASE must be const and therefore never modified.

@reduckted
Copy link
Contributor

Check out tslint-consistent-codestyle and the naming-convention rule. It's very flexible and you should be able to get the outcome that you're after.

The only thing is that it sort of works in the opposite direction to what you wanted. Instead of enforcing const for uppercase variable names, it would enforce uppercase variable names for const variables.

@adidahiya adidahiya modified the milestones: TSLint 5.x, 5.14.0 Mar 12, 2019
@adidahiya
Copy link
Contributor

fixed by #2936

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

4 participants