Contains lint rules for Crazy Factory
- Typescript 3.x
- packs it for npm usage
- uses jest for testing
- uses travis and semantic-release for deployment
- uses linting, coverage and git hooks to increase code quality.
- is configured to support wallaby
Initially you should:
- npm install
@crazyfactory/tslint-rules
- update
tslint.json
(add rules directory) - enable rules in
tslint.json
- In ts-react-boilerplate, we use
createAsyncActions
to create Redux async actions. Four actions are created from calling it -BASE
,BASE_PENDING
,BASE_FULFILLED
, andBASE_REJECTED
as 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_REJECTED
respectively.
- Same as object-literal-sort-keys but applied to enum keys
- Specify how you should import
react
. Eitherimport *
orimport React
. - Rule options:
type: "default" | "star"
. Default isstar
- Requires literal string in hex format to be uppercase/lowercase and/or of specific lengths.
- Rule options:
case: "uppercase" | "lowercase"
. Default islowercase
allowedLengths: number[]
. Default is[4, 7]
- Please use member-ordering instead!
- Requires or bans space before
/>
part of jsx. - Rule options:
["always", "never"]
. Default isalways
.
-
Requires that string argument called by
Translator
object is in thereference.json
-
Rule options:
path
: path toreference.json
reference.json
needs to be in the following format:{ "reference": [ { "base": "Translation String Here" } ] }
callerNames: string[]
: Name of translator object type, default is["Translator"]
- Requires that all actions created by createAsyncActions and createAction have unique name.