Skip to content

Commit

Permalink
Testing: Add ESLint restricted syntax for truthy length rendering (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored Mar 26, 2019
1 parent 8243a1c commit 1f0fea9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ module.exports = {
selector: 'CallExpression[callee.name="withDispatch"] > :function > BlockStatement > :not(VariableDeclaration,ReturnStatement)',
message: 'withDispatch must return an object with consistent keys. Avoid performing logic in `mapDispatchToProps`.',
},
{
selector: 'LogicalExpression[operator="&&"][left.property.name="length"][right.type="JSXElement"]',
message: 'Avoid truthy checks on length property rendering, as zero length is rendered verbatim.',
},
],
'react/forbid-elements': [ 'error', {
forbid: [
Expand Down

0 comments on commit 1f0fea9

Please sign in to comment.