$ cnpm install tslint-react-perf
#NOTE I don't use this project anymore. Most of the concerns I'm trying to address here can be mitigated by using hooks properly (useMemo, useCallback).
Supplemental performance-based rules related to React & JSX for TSLint. This library is considered a stopgap until these rules are adopted by tslint-react.
tslint-react-perf has peer dependencies on typescript
and tslint
.
To use these lint rules with the default preset, use configuration inheritance via the extends
keyword. Here's a sample configuration where tslint.json
lives adjacent to your node_modules
folder:
{
"extends": ["tslint:latest", "tslint-react", "tslint-react-perf"],
"rules": {...}
}
jsx-no-bind-props
jsx-no-bind
rule with spread and ternary expression checks.jsx-no-lambda-props
jsx-no-lambda
rule with spread and ternary expression checks.jsx-no-array-literal-props
render
call stack works against pure component rendering. When doing an shallow equality check between two lambdas, React will always consider them unequal values and force the component to re-render more often than necessary.jsx-no-object-literal-props
render
call stack works against pure component rendering. When doing an shallow equality check between two lambdas, React will always consider them unequal values and force the component to re-render more often than necessary.react-pure-components-have-simple-attributes
react-component-classes-should-implement-scu
shouldComponentUpdate()
or extend React.PureComponent
instead of React.Component
Quick Start (requires Node v6+, yarn v0.22+):
yarn
yarn prepare
Copyright 2014 - 2016 © taobao.org |