Skip to content

Commit

Permalink
eslint rule "Do not memorize primitives" for useMemo
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanSilke committed Nov 17, 2023
1 parent 0bac0f8 commit 38c05bd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ module.exports = {
},
],

'no-restricted-syntax': ["error",
{
"selector": "CallExpression[callee.name = useMemo] :matches(ArrowFunctionExpression, ArrowFunctionExpression ReturnStatement, FunctionExpression ReturnStatement) :matches(TemplateLiteral[expressions.length = 0], TemplateLiteral > Identifier, TemplateLiteral > Literal)",
"message": "Do not memorize primitives https://wiki.sberdevices.ru/doc/react-dos-and-donts-dhLkEiVMHJ#h-ne-ispolьzujte-usememo-dlya-memoizacii-primitivov"
},
{
"selector": "CallExpression[callee.name = useMemo] :matches(ArrowFunctionExpression, ArrowFunctionExpression ReturnStatement, FunctionExpression ReturnStatement) > Literal",
"message": "Do not memorize primitives https://wiki.sberdevices.ru/doc/react-dos-and-donts-dhLkEiVMHJ#h-ne-ispolьzujte-usememo-dlya-memoizacii-primitivov"
},
],

'default-param-last': 'warn',

'@typescript-eslint/member-ordering': [
Expand Down

0 comments on commit 38c05bd

Please sign in to comment.