Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-no-bind.js
rd565449 r0c6b92a 10 10 const propName = require('jsx-ast-utils/propName'); 11 11 const docsUrl = require('../util/docsUrl'); 12 const astUtil = require('../util/ast'); 12 13 const jsxUtil = require('../util/jsx'); 13 14 const report = require('../util/report'); … … 25 26 }; 26 27 28 /** @type {import('eslint').Rule.RuleModule} */ 27 29 module.exports = { 28 30 meta: { … … 84 86 85 87 function getNodeViolationType(node) { 86 const nodeType = node.type;87 88 if ( 88 89 !configuration.allowBind 89 && nodeType === 'CallExpression'90 && astUtil.isCallExpression(node) 90 91 && node.callee.type === 'MemberExpression' 91 92 && node.callee.property.type === 'Identifier' … … 94 95 return 'bindCall'; 95 96 } 96 if (node Type === 'ConditionalExpression') {97 if (node.type === 'ConditionalExpression') { 97 98 return getNodeViolationType(node.test) 98 99 || getNodeViolationType(node.consequent) 99 100 || getNodeViolationType(node.alternate); 100 101 } 101 if (!configuration.allowArrowFunctions && node Type === 'ArrowFunctionExpression') {102 if (!configuration.allowArrowFunctions && node.type === 'ArrowFunctionExpression') { 102 103 return 'arrowFunc'; 103 104 } 104 105 if ( 105 106 !configuration.allowFunctions 106 && (node Type === 'FunctionExpression' || nodeType === 'FunctionDeclaration')107 && (node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration') 107 108 ) { 108 109 return 'func'; 109 110 } 110 if (!configuration.allowBind && node Type === 'BindExpression') {111 if (!configuration.allowBind && node.type === 'BindExpression') { 111 112 return 'bindExpression'; 112 113 } … … 117 118 /** 118 119 * @param {string | number} violationType 119 * @param { any} variableName120 * @param {unknown} variableName 120 121 * @param {string | number} blockStart 121 122 */ … … 176 177 blockAncestors.length > 0 177 178 && variableViolationType 179 && 'kind' in node.parent 178 180 && node.parent.kind === 'const' // only support const right now 179 181 ) { 180 addVariableNameToSet( 181 variableViolationType, node.id.name, blockAncestors[0].range[0] 182 ); 182 addVariableNameToSet(variableViolationType, 'name' in node.id ? node.id.name : undefined, blockAncestors[0].range[0]); 183 183 } 184 184 },
Note:
See TracChangeset
for help on using the changeset viewer.