@crazyfactory/tslint-rules
v1.9.0
Published
<!--[](https://greenkeeper.io/) --> [](https://travis-ci.org/crazyfactory/tslint-rules) [ - enable rules in
tslint.json
Rules
create-async-actions
- In ts-react-boilerplate, we use
createAsyncActionsto create Redux async actions. Four actions are created from calling it -BASE,BASE_PENDING,BASE_FULFILLED, andBASE_REJECTEDas an example whencreateAsyncActions("BASE", "BASE_PENDING", "BASE_FULFILLED", "BASE_REJECTED"is called. Still, as you see, we need to provide string literal as arugments due to typescript limitation, if we provide any string variable, the type will be deduced to juststring. This rule enforces 2nd, 3rd, and 4th argument to be the concatenation of the first argument string and_PENDING,_FULFILLED, and_REJECTEDrespectively.
enum-sort-keys
- Same as object-literal-sort-keys but applied to enum keys
import-react
- Specify how you should import
react. Eitherimport *orimport React. - Rule options:
type: "default" | "star". Default isstar
hex-format
- Requires literal string in hex format to be uppercase/lowercase and/or of specific lengths.
- Rule options:
case: "uppercase" | "lowercase". Default islowercaseallowedLengths: number[]. Default is[4, 7]
interface-sort-keys
- Same as object-literal-sort-keys but applied to interface keys
jsx-space-before-trailing-slash
- Requires or bans space before
/>part of jsx. - Rule options:
["always", "never"]. Default isalways.
language
Requires that string argument called by
Translatorobject is in thereference.jsonRule options:
path: path toreference.json
reference.jsonneeds to be in the following format:{ "reference": [ { "base": "Translation String Here" } ] }callerNames: string[]: Name of translator object type, default is["Translator"]
no-dup-actions
- Requires that all actions created by createAsyncActions and createAction have unique name.
