-
Notifications
You must be signed in to change notification settings - Fork 63
The future of casing rules #185
Comments
I think the multiple smaller rule style is a good idea, although I’d suggest:
|
I’m wondering if we should collaborate with |
@j-f1, does this force users to use babel (maybe is just the parser, dunno)? I know babel now supports TypeScript, but some still prefer to use TypeScript for the transpilation...
|
I don’t think so. The Babel parser is in |
my only issue with pushing class properties to a different plugin is that then our users have to also install the plugin to get the coverage. Creating a shared library to use between us and It seems like we're diverging from eslint-core here, so it's hard to say what we should push upstream. Just to clarify - the idea here would be to essentially tell our users to disable |
disabling |
I just wanted to spin this off of the discussion that @weirdpattern and I were having on #183.
Currently eslint core has the
camelcase
rule, which enforces variable and (optionally) property names are written in camelCase or PascalCase.The problem is that
camelcase
doesn't differentiate between camelCase and PascalCase (eslint/eslint#10473), and rightfully so because there are different use cases which need different casing (i.e. classes and functional components use PascalCase, variables use camelCase).This relaxed rule leads to invalid naming patterns that lint okay:
To help address this, within this plugin, we have:
class-name-casing
which only allows PascalCase for classes AND interfaces.member-naming
which uses regex on specific modifiers (onlyprivate
atm).generic-type-naming
which uses regex.interface-name-prefix
which just allows or blocksI
at the start of interface names.camelcase
(via Fix: camelcase false positives on interface properties (fixes #177) #183) which adds support for class properties and interface properties on top of the base implementation.This is obviously a bit of a mess because the naming is inconsistent, and the configuration styles are inconsistent.
The question is, what should our direction be going forward?
(note for below: when I say
casing
, I mean camelCase / PascalCase / snake_case. When I saycase
, I mean interface / var / class / property / type / etc).I
, (dis)allow class property names starting with_
).This would probably be for a future (2.0?) release, as 1.0.0 is already rather loaded with the dependency upgrades.
Tagging collaborators for visibility
@macklinu, @j-f1, @weirdpattern
The text was updated successfully, but these errors were encountered: