Glavin001 / tslint-clean-code

TSLint rules for enforcing Clean Code
https://www.npmjs.com/package/tslint-clean-code
MIT License
169 stars 15 forks source link

id-length rule should be able to ignore JSX intrinsic elements #55

Open karol-majewski opened 6 years ago

karol-majewski commented 6 years ago

Currently, every exception for the id-length rule must be passed explicitly as a string. My proposal would be to allow exceptions based on their kind, not only the literal value.

As mentioned in #40, one possible improvement to the rule configuration would be to allow all type parameters to be excluded from checking. It seems like intrinsic elements would be a welcome addition, given the amount of HTML tags otherwise provided manually.

An example configuration object might look like this:

{
  "id-length": [
    true,
    {
      "min": 2,
      "max": 10,
      "exceptions": ["_"],
      "check-type-parameters": false,
      "check-jsx-intrinsic-elements": false
    }
  ]
}
Glavin001 commented 6 years ago

Good idea! I also find id-length problematic for intrinsic tag names when using JSX. Pull Requests welcome! 👍