-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Firstly, this ruleset is fantastic and highly configurable, thanks so much for sharing it.
I think I may have found a small issue with the filter in 1.13.0. I can't be sure as I dont know how to check but I think it may be an issue with parsing the string into a regex. But maybe what I am trying to do isnt possible
Steps to reproduce
I have this simple 2D Point class with public properties for the x,y coordinates initialized by a constructor param property:
export class Point implements IPoint {
constructor(public x: number = 0, public y: number = 0, public Selected: boolean = false) {}
}
I have configured tslint-consistent-codestyle
to enforce PascalCase as default, but I want to make an exception to this rule for the properties x
and y
to enforce camelCase using the filter option.
So in the example above, the Selected
property should be PascalCase while x and y should be fine to be camelCase.
My ruleset looks like this:
"naming-convention": [
true,
{"type": "default", "format": "PascalCase", "leadingUnderscore": "forbid", "trailingUnderscore": "forbid"},
{"type": "parameter", "format": "camelCase"},
{"type": "variable", "format": "camelCase"},
{"type": "property", "format": "camelCase"},
{"type": "property", "modifiers": ["public"], "format": "PascalCase"},
{"type": "parameterProperty", "filter": "^x$", "format": "camelCase"}
]
The last rule {"type": "parameterProperty", "filter": "^x$", "format": "camelCase"}
doesn't seem to be having any effect (i.e. Im still getting a tslint problem match for x and y), and in fact I cant seem to get the filter to work for anything including the examples in the docs, is this just me or is the filter not working?