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

Add ??? flag to variable-name rule #1328

Closed
unional opened this issue Jun 22, 2016 · 5 comments
Closed

Add ??? flag to variable-name rule #1328

unional opened this issue Jun 22, 2016 · 5 comments

Comments

@unional
Copy link
Contributor

unional commented Jun 22, 2016

Bug Report

  • TSLint version: 3.10.2
  • TypeScript version: 1.9.0-dev.20160614-1.0
  • Running TSLint via: VSCode

TypeScript code being linted

export interface Foo {

}

// [tslint] variable name must be in camelcase or uppercase
export const Foo = { 
  someFunction() {}
}

Is there a better construct without hitting this warning or getting into class + static method?
how can I disable this rule only for this use case (maybe adding a bypass-overload flag)?

@jkillian
Copy link
Contributor

You could add the allow-pascal-case option to allow this format of name in general.

@unional
Copy link
Contributor Author

unional commented Jun 23, 2016

Yes, but that's what I don't want to.
This is really a type + utility construct. And being a type it should be uppercase.
The utility part is really a namespace idea, not a variable.

@wovalle
Copy link

wovalle commented Sep 19, 2017

I'm facing this issue, I don't want to allow all my variables to be pascal-case but the exported ones (mostly react functional components).

@ajafff
Copy link
Contributor

ajafff commented Sep 19, 2017

@wovalle
I'd like to suggest one of my custom rules: https://github.com/ajafff/tslint-consistent-codestyle/blob/master/docs/naming-convention.md#examples

Example config for your use case:

"naming-convention": [
    true,
    {"type": "variable", "format": "camelCase"},
    {"type": "variable", "modifiers": "export", "format": "PascalCase", "final": true}
]

@JoshuaKGoldberg
Copy link
Contributor

Duplicate of #522

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