Skip to content

[camelcase] Allow disabling camelcase rule for class members #590

Closed
@jimjenkins5

Description

@jimjenkins5

Repro

{
  "rules": {
    "@typescript-eslint/camelcase": ["error", { "properties": "never" } ]
  }
}
export class MyClassWithAStatic {
  public static this_should_pass(): boolean {
    return true;
  }
}

Expected Result

The static method should pass linting.

Actual Result

An error is reported:

2:18  error  Identifier 'this_should_pass' is not in camel case  @typescript-eslint/camelcase

Additional Info
When disabling the camelCase rule for properties, I would assume class members would also not be checked. However, ideally we would have even more control over this rule and be able to disable it for certain types of members (e.g. by accessibility, and especially for our use, static vs. instance)

The reason this is causing us an issue is that our coding standard is to use camelCase for all variables, properties and methods, but use snake_case for static methods. This is a common coding standard and it would be good to support it.

Even if our use case isn't specifically supported, being able to disable the rule for class methods and properties would be consistent with the current properties option.

Versions

package version
@typescript-eslint/eslint-plugin 1.2.0
TypeScript 3.3.1
ESLint 5.11.1
node 8.10.0
npm 6.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: plugin rule optionNew rule option for an existing eslint-plugin rulehas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions