You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
This will contain rules related to react & JSX. I've gone ahead and filed the rule suggestions above as issues in that repo -- follow along there for updates! We should have an initial release on NPM shortly.
Some ideas:
require
displayName
property on classes that extendReact.Component
member-ordering
option that orders methods based on lifecycleprohibit properties / methods on React components:
propTypes
(TS should manage typechecking, not React)mixins
(?)getInitialState
(state should just be initialized on the public class property)multiline JSX should be wrapped in parens
single line JSX should not be wrapped in parens
ban multiline JS expressions (
{ ... }
) in JSXself-closing tags should self close (
<Logo />
, not<Logo></Logo>
)JSX attribute alignment (New Rule: jsx-alignment tslint-react#7)
JSX attribute sorting (alphabetize)
forbid
ReactDOM.findDOMNode()
within a component classban
ruleforbid certain JSX attributes, such as
dangerouslySetInnerHTML
forbid the
on
prefix for method names in react component classes -- prefer the prefixhandle
instead, and useon
in JSX prop names onlyforbid string literal refs (instead use the callback variety of refs)
reference:
The text was updated successfully, but these errors were encountered: