Changeset 0c6b92a for imaps-frontend/node_modules/eslint-plugin-react/lib
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- Location:
- imaps-frontend/node_modules/eslint-plugin-react/lib
- Files:
-
- 265 added
- 86 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/boolean-prop-naming.js
rd565449 r0c6b92a 11 11 const Components = require('../util/Components'); 12 12 const propsUtil = require('../util/props'); 13 const astUtil = require('../util/ast'); 13 14 const docsUrl = require('../util/docsUrl'); 14 15 const propWrapperUtil = require('../util/propWrapper'); … … 18 19 const getSourceCode = eslintUtil.getSourceCode; 19 20 const getText = eslintUtil.getText; 21 22 /** 23 * Checks if prop is nested 24 * @param {Object} prop Property object, single prop type declaration 25 * @returns {boolean} 26 */ 27 function nestedPropTypes(prop) { 28 return ( 29 prop.type === 'Property' 30 && astUtil.isCallExpression(prop.value) 31 ); 32 } 20 33 21 34 // ------------------------------------------------------------------------------ … … 129 142 * Checks if prop is declared in flow way 130 143 * @param {Object} prop Property object, single prop type declaration 131 * @returns { Boolean}144 * @returns {boolean} 132 145 */ 133 146 function flowCheck(prop) { … … 142 155 * Checks if prop is declared in regular way 143 156 * @param {Object} prop Property object, single prop type declaration 144 * @returns { Boolean}157 * @returns {boolean} 145 158 */ 146 159 function regularCheck(prop) { … … 164 177 165 178 /** 166 * Checks if prop is nested167 * @param {Object} prop Property object, single prop type declaration168 * @returns {Boolean}169 */170 function nestedPropTypes(prop) {171 return (172 prop.type === 'Property'173 && prop.value.type === 'CallExpression'174 );175 }176 177 /**178 179 * Runs recursive check on all proptypes 179 180 * @param {Array} proptypes A list of Property object (for each proptype defined) … … 181 182 */ 182 183 function runCheck(proptypes, addInvalidProp) { 183 (proptypes || []).forEach((prop) => { 184 if (config.validateNested && nestedPropTypes(prop)) { 185 runCheck(prop.value.arguments[0].properties, addInvalidProp); 186 return; 187 } 188 if (flowCheck(prop) || regularCheck(prop) || tsCheck(prop)) { 189 addInvalidProp(prop); 190 } 191 }); 184 if (proptypes) { 185 proptypes.forEach((prop) => { 186 if (config.validateNested && nestedPropTypes(prop)) { 187 runCheck(prop.value.arguments[0].properties, addInvalidProp); 188 return; 189 } 190 if (flowCheck(prop) || regularCheck(prop) || tsCheck(prop)) { 191 addInvalidProp(prop); 192 } 193 }); 194 } 192 195 } 193 196 … … 257 260 } 258 261 259 const annotationTypeParams = component.node.parent.id.typeAnnotation.typeAnnotation.typeParameters; 262 const annotationTypeArguments = propsUtil.getTypeArguments( 263 component.node.parent.id.typeAnnotation.typeAnnotation 264 ); 260 265 if ( 261 annotationType Params && (262 annotationType Params.type === 'TSTypeParameterInstantiation'263 || annotationType Params.type === 'TypeParameterInstantiation'266 annotationTypeArguments && ( 267 annotationTypeArguments.type === 'TSTypeParameterInstantiation' 268 || annotationTypeArguments.type === 'TypeParameterInstantiation' 264 269 ) 265 270 ) { 266 return annotationType Params.params.find(271 return annotationTypeArguments.params.find( 267 272 (param) => param.type === 'TSTypeReference' || param.type === 'GenericTypeAnnotation' 268 273 ); … … 310 315 if ( 311 316 node.value 312 && node.value.type === 'CallExpression'317 && astUtil.isCallExpression(node.value) 313 318 && propWrapperUtil.isPropWrapperFunction( 314 319 context, … … 336 341 const right = node.parent.right; 337 342 if ( 338 right.type === 'CallExpression'343 astUtil.isCallExpression(right) 339 344 && propWrapperUtil.isPropWrapperFunction( 340 345 context, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/button-has-type.js
rd565449 r0c6b92a 29 29 }; 30 30 31 /** @type {import('eslint').Rule.RuleModule} */ 31 32 module.exports = { 32 33 meta: { … … 150 151 151 152 const props = node.arguments[1].properties; 152 const typeProp = props.find((prop) => prop.key && prop.key.name === 'type'); 153 const typeProp = props.find((prop) => ( 154 'key' in prop 155 && prop.key 156 && 'name' in prop.key 157 && prop.key.name === 'type' 158 )); 153 159 154 160 if (!typeProp) { … … 157 163 } 158 164 159 checkExpression(node, typeProp.value);165 checkExpression(node, 'value' in typeProp ? typeProp.value : undefined); 160 166 }, 161 167 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/checked-requires-onchange-or-readonly.js
rd565449 r0c6b92a 25 25 26 26 /** 27 * @param { string[]} properties27 * @param {object[]} properties 28 28 * @param {string} keyName 29 29 * @returns {Set<string>} … … 42 42 } 43 43 44 /** @type {import('eslint').Rule.RuleModule} */ 44 45 module.exports = { 45 46 meta: { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/destructuring-assignment.js
rd565449 r0c6b92a 182 182 } 183 183 184 // valid-jsdoc cannot read function types 185 // eslint-disable-next-line valid-jsdoc 186 /** 187 * Find a parent that satisfy the given predicate 188 * @param {ASTNode} node 189 * @param {(node: ASTNode) => boolean} predicate 190 * @returns {ASTNode | undefined} 191 */ 192 function findParent(node, predicate) { 193 let n = node; 194 while (n) { 195 if (predicate(n)) { 196 return n; 197 } 198 n = n.parent; 199 } 200 return undefined; 201 } 202 184 203 return { 185 204 … … 197 216 198 217 MemberExpression(node) { 199 let scope = getScope(context, node); 200 let SFCComponent = components.get(scope.block); 201 while (!SFCComponent && scope.upper && scope.upper !== scope) { 202 SFCComponent = components.get(scope.upper.block); 203 scope = scope.upper; 204 } 218 const SFCComponent = utils.getParentStatelessComponent(node); 205 219 if (SFCComponent) { 206 220 handleSFCUsage(node); … … 210 224 if (classComponent) { 211 225 handleClassUsage(node); 226 } 227 }, 228 229 TSQualifiedName(node) { 230 if (configuration !== 'always') { 231 return; 232 } 233 // handle `typeof props.a.b` 234 if (node.left.type === 'Identifier' 235 && node.left.name === sfcParams.propsName() 236 && findParent(node, (n) => n.type === 'TSTypeQuery') 237 && utils.getParentStatelessComponent(node) 238 ) { 239 report(context, messages.useDestructAssignment, 'useDestructAssignment', { 240 node, 241 data: { 242 type: 'props', 243 }, 244 }); 212 245 } 213 246 }, … … 258 291 return; 259 292 } 293 260 294 // Skip if props is used elsewhere 261 295 if (propsRefs.length > 1) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/display-name.js
rd565449 r0c6b92a 74 74 * Checks if React.forwardRef is nested inside React.memo 75 75 * @param {ASTNode} node The AST node being checked. 76 * @returns { Boolean} True if React.forwardRef is nested inside React.memo, false if not.76 * @returns {boolean} True if React.forwardRef is nested inside React.memo, false if not. 77 77 */ 78 78 function isNestedMemo(node) { 79 const argumentIsCallExpression = node.arguments && node.arguments[0] && node.arguments[0].type === 'CallExpression'; 80 81 return node.type === 'CallExpression' && argumentIsCallExpression && utils.isPragmaComponentWrapper(node); 79 return astUtil.isCallExpression(node) 80 && node.arguments 81 && astUtil.isCallExpression(node.arguments[0]) 82 && utils.isPragmaComponentWrapper(node); 82 83 } 83 84 … … 112 113 * Checks if the component have a name set by the transpiler 113 114 * @param {ASTNode} node The AST node being checked. 114 * @returns { Boolean} True if component has a name, false if not.115 * @returns {boolean} True if component has a name, false if not. 115 116 */ 116 117 function hasTranspilerName(node) { … … 199 200 return; 200 201 } 201 markDisplayNameAsDeclared( component.node.type === 'TSAsExpression' ? component.node.expression : component.node);202 markDisplayNameAsDeclared(astUtil.unwrapTSAsExpression(component.node)); 202 203 }, 203 204 -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/forbid-component-props.js
rd565449 r0c6b92a 53 53 items: { type: 'string' }, 54 54 }, 55 allowedForPatterns: { 56 type: 'array', 57 uniqueItems: true, 58 items: { type: 'string' }, 59 }, 55 60 message: { type: 'string' }, 56 61 }, … … 67 72 items: { type: 'string' }, 68 73 }, 69 message: { type: 'string' }, 70 }, 71 required: ['disallowedFor'], 72 additionalProperties: false, 73 }, 74 74 disallowedForPatterns: { 75 type: 'array', 76 uniqueItems: true, 77 minItems: 1, 78 items: { type: 'string' }, 79 }, 80 message: { type: 'string' }, 81 }, 82 anyOf: [ 83 { required: ['disallowedFor'] }, 84 { required: ['disallowedForPatterns'] }, 85 ], 86 additionalProperties: false, 87 }, 75 88 { 76 89 type: 'object', … … 82 95 items: { type: 'string' }, 83 96 }, 97 allowedForPatterns: { 98 type: 'array', 99 uniqueItems: true, 100 items: { type: 'string' }, 101 }, 84 102 message: { type: 'string' }, 85 103 }, … … 96 114 items: { type: 'string' }, 97 115 }, 98 message: { type: 'string' }, 99 }, 100 required: ['disallowedFor'], 116 disallowedForPatterns: { 117 type: 'array', 118 uniqueItems: true, 119 minItems: 1, 120 items: { type: 'string' }, 121 }, 122 message: { type: 'string' }, 123 }, 124 anyOf: [ 125 { required: ['disallowedFor'] }, 126 { required: ['disallowedForPatterns'] }, 127 ], 101 128 additionalProperties: false, 102 129 }, … … 115 142 const prop = propName || propPattern; 116 143 const options = { 117 allowList: typeof value === 'string' ? [] : (value.allowedFor || []), 118 disallowList: typeof value === 'string' ? [] : (value.disallowedFor || []), 144 allowList: [].concat(value.allowedFor || []), 145 allowPatternList: [].concat(value.allowedForPatterns || []), 146 disallowList: [].concat(value.disallowedFor || []), 147 disallowPatternList: [].concat(value.disallowedForPatterns || []), 119 148 message: typeof value === 'string' ? null : value.message, 120 149 isPattern: !!value.propNamePattern, … … 141 170 } 142 171 172 function checkIsTagForbiddenByAllowOptions() { 173 if (options.allowList.indexOf(tagName) !== -1) { 174 return false; 175 } 176 177 if (options.allowPatternList.length === 0) { 178 return true; 179 } 180 181 return options.allowPatternList.every( 182 (pattern) => !minimatch(tagName, pattern) 183 ); 184 } 185 186 function checkIsTagForbiddenByDisallowOptions() { 187 if (options.disallowList.indexOf(tagName) !== -1) { 188 return true; 189 } 190 191 if (options.disallowPatternList.length === 0) { 192 return false; 193 } 194 195 return options.disallowPatternList.some( 196 (pattern) => minimatch(tagName, pattern) 197 ); 198 } 199 200 const hasDisallowOptions = options.disallowList.length > 0 || options.disallowPatternList.length > 0; 201 143 202 // disallowList should have a least one item (schema configuration) 144 const isTagForbidden = options.disallowList.length > 0145 ? options.disallowList.indexOf(tagName) !== -1146 : options.allowList.indexOf(tagName) === -1;203 const isTagForbidden = hasDisallowOptions 204 ? checkIsTagForbiddenByDisallowOptions() 205 : checkIsTagForbiddenByAllowOptions(); 147 206 148 207 // if the tagName is undefined (`<this.something>`), we assume it's a forbidden element -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/forbid-elements.js
rd565449 r0c6b92a 21 21 }; 22 22 23 /** @type {import('eslint').Rule.RuleModule} */ 23 24 module.exports = { 24 25 meta: { … … 106 107 } 107 108 108 const argType = argument.type; 109 110 if (argType === 'Identifier' && /^[A-Z_]/.test(argument.name)) { 109 if (argument.type === 'Identifier' && /^[A-Z_]/.test(argument.name)) { 111 110 reportIfForbidden(argument.name, argument); 112 } else if (arg Type === 'Literal' && /^[a-z][^.]*$/.test(argument.value)) {111 } else if (argument.type === 'Literal' && /^[a-z][^.]*$/.test(String(argument.value))) { 113 112 reportIfForbidden(argument.value, argument); 114 } else if (arg Type === 'MemberExpression') {113 } else if (argument.type === 'MemberExpression') { 115 114 reportIfForbidden(getText(context, argument), argument); 116 115 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/forbid-foreign-prop-types.js
rd565449 r0c6b92a 14 14 }; 15 15 16 /** @type {import('eslint').Rule.RuleModule} */ 16 17 module.exports = { 17 18 meta: { … … 109 110 && !isAllowedAssignment(node) 110 111 )) || ( 112 // @ts-expect-error The JSXText type is not present in the estree type definitions 111 113 (node.property.type === 'Literal' || node.property.type === 'JSXText') 114 && 'value' in node.property 112 115 && node.property.value === 'propTypes' 113 116 && !ast.isAssignmentLHS(node) … … 122 125 123 126 ObjectPattern(node) { 124 const propTypesNode = node.properties.find((property) => property.type === 'Property' && property.key.name === 'propTypes'); 127 const propTypesNode = node.properties.find((property) => ( 128 property.type === 'Property' 129 && 'name' in property.key 130 && property.key.name === 'propTypes' 131 )); 125 132 126 133 if (propTypesNode) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/forbid-prop-types.js
rd565449 r0c6b92a 27 27 }; 28 28 29 /** @type {import('eslint').Rule.RuleModule} */ 29 30 module.exports = { 30 31 meta: { … … 135 136 value = value.object; 136 137 } 137 if ( value.type === 'CallExpression') {138 if (astUtil.isCallExpression(value)) { 138 139 if (!isPropTypesPackage(value.callee)) { 139 140 return; … … 159 160 160 161 function checkNode(node) { 161 switch (node && node.type) {162 case 'ObjectExpression':163 checkProperties(node.properties);164 break; 165 case 'Identifier':{166 const propTypesObject = variableUtil.findVariableByName(context, node, node.name);167 if (propTypesObject && propTypesObject.properties) {168 checkProperties(propTypesObject.properties);169 }170 break;171 } 172 case 'CallExpression':{173 174 175 162 if (!node) { 163 return; 164 } 165 166 if (node.type === 'ObjectExpression') { 167 checkProperties(node.properties); 168 } else if (node.type === 'Identifier') { 169 const propTypesObject = variableUtil.findVariableByName(context, node, node.name); 170 if (propTypesObject && propTypesObject.properties) { 171 checkProperties(propTypesObject.properties); 172 } 173 } else if (astUtil.isCallExpression(node)) { 174 const innerNode = node.arguments && node.arguments[0]; 175 if ( 176 propWrapperUtil.isPropWrapperFunction(context, getText(context, node.callee)) 176 177 && innerNode 177 ) { 178 checkNode(innerNode); 179 } 180 break; 181 } 182 default: 183 break; 178 ) { 179 checkNode(innerNode); 180 } 184 181 } 185 182 } … … 197 194 if (node.specifiers.length >= 1) { 198 195 const propTypesSpecifier = node.specifiers.find((specifier) => ( 199 specifier.imported && specifier.imported.name === 'PropTypes' 196 'imported' in specifier 197 && specifier.imported 198 && specifier.imported.name === 'PropTypes' 200 199 )); 201 200 if (propTypesSpecifier) { … … 233 232 } 234 233 235 checkNode( node.parent.right);234 checkNode('right' in node.parent && node.parent.right); 236 235 }, 237 236 238 237 CallExpression(node) { 239 238 if ( 240 node.callee.object 239 node.callee.type === 'MemberExpression' 240 && node.callee.object 241 241 && !isPropTypesPackage(node.callee.object) 242 242 && !propsUtil.isPropTypesDeclaration(node.callee) … … 247 247 if ( 248 248 node.arguments.length > 0 249 && (node.callee.name === 'shape' || astUtil.getPropertyName(node.callee) === 'shape') 250 ) { 251 checkProperties(node.arguments[0].properties); 249 && ( 250 ('name' in node.callee && node.callee.name === 'shape') 251 || astUtil.getPropertyName(node.callee) === 'shape' 252 ) 253 ) { 254 checkProperties('properties' in node.arguments[0] && node.arguments[0].properties); 252 255 } 253 256 }, … … 272 275 ObjectExpression(node) { 273 276 node.properties.forEach((property) => { 274 if (! property.key) {277 if (!('key' in property) || !property.key) { 275 278 return; 276 279 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/function-component-definition.js
rd565449 r0c6b92a 11 11 const reportC = require('../util/report'); 12 12 const getText = require('../util/eslint').getText; 13 const propsUtil = require('../util/props'); 13 14 14 15 // ------------------------------------------------------------------------------ … … 35 36 36 37 function hasOneUnconstrainedTypeParam(node) { 37 const nodeType Params = node.typeParameters;38 39 return nodeType Params40 && nodeType Params.params41 && nodeType Params.params.length === 142 && !nodeType Params.params[0].constraint;38 const nodeTypeArguments = propsUtil.getTypeArguments(node); 39 40 return nodeTypeArguments 41 && nodeTypeArguments.params 42 && nodeTypeArguments.params.length === 1 43 && !nodeTypeArguments.params[0].constraint; 43 44 } 44 45 … … 203 204 } 204 205 206 const nodeTypeArguments = propsUtil.getTypeArguments(node); 205 207 return (fixer) => fixer.replaceTextRange( 206 208 options.range, 207 209 buildFunction(options.template, { 208 210 typeAnnotation, 209 typeParams: getNodeText(node .typeParameters, source),211 typeParams: getNodeText(nodeTypeArguments, source), 210 212 params: getParams(node, source), 211 213 returnType: getNodeText(node.returnType, source), -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/hook-use-state.js
rd565449 r0c6b92a 27 27 }; 28 28 29 /** @type {import('eslint').Rule.RuleModule} */ 29 30 module.exports = { 30 31 meta: { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/index.js
rd565449 r0c6b92a 16 16 'forbid-foreign-prop-types': require('./forbid-foreign-prop-types'), 17 17 'forbid-prop-types': require('./forbid-prop-types'), 18 'forward-ref-uses-ref': require('./forward-ref-uses-ref'), 18 19 'function-component-definition': require('./function-component-definition'), 19 20 'hook-use-state': require('./hook-use-state'), -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-closing-bracket-location.js
rd565449 r0c6b92a 21 21 }; 22 22 23 /** @type {import('eslint').Rule.RuleModule} */ 23 24 module.exports = { 24 25 meta: { … … 101 102 * Get expected location for the closing bracket 102 103 * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop 103 * @return { String} Expected location for the closing bracket104 * @return {string} Expected location for the closing bracket 104 105 */ 105 106 function getExpectedLocation(tokens) { … … 122 123 * expected location. 123 124 * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop 124 * @param { String} expectedLocation Expected location for the closing bracket125 * @param {string} expectedLocation Expected location for the closing bracket 125 126 * @return {?Number} The correct column for the closing bracket, or null 126 127 */ … … 141 142 * Check if the closing bracket is correctly located 142 143 * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop 143 * @param { String} expectedLocation Expected location for the closing bracket144 * @return { Boolean} True if the closing bracket is correctly located, false if not144 * @param {string} expectedLocation Expected location for the closing bracket 145 * @return {boolean} True if the closing bracket is correctly located, false if not 145 146 */ 146 147 function hasCorrectLocation(tokens, expectedLocation) { … … 164 165 * Get the characters used for indentation on the line to be matched 165 166 * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop 166 * @param { String} expectedLocation Expected location for the closing bracket167 * @param { Number} [correctColumn] Expected column for the closing bracket. Default to 0168 * @return { String} The characters used for indentation167 * @param {string} expectedLocation Expected location for the closing bracket 168 * @param {number} [correctColumn] Expected column for the closing bracket. Default to 0 169 * @return {string} The characters used for indentation 169 170 */ 170 171 function getIndentation(tokens, expectedLocation, correctColumn) { … … 236 237 * 237 238 * @param {ASTNode} node The AST node being checked. 238 * @returns { String} Unique ID (based on its range)239 * @returns {string} Unique ID (based on its range) 239 240 */ 240 241 function getOpeningElementId(node) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js
rd565449 r0c6b92a 31 31 ]; 32 32 const DEFAULT_CONFIG = { props: OPTION_NEVER, children: OPTION_NEVER, propElementValues: OPTION_IGNORE }; 33 34 const HTML_ENTITY_REGEX = () => /&[A-Za-z\d#]+;/g; 35 36 function containsLineTerminators(rawStringValue) { 37 return /[\n\r\u2028\u2029]/.test(rawStringValue); 38 } 39 40 function containsBackslash(rawStringValue) { 41 return arrayIncludes(rawStringValue, '\\'); 42 } 43 44 function containsHTMLEntity(rawStringValue) { 45 return HTML_ENTITY_REGEX().test(rawStringValue); 46 } 47 48 function containsOnlyHtmlEntities(rawStringValue) { 49 return rawStringValue.replace(HTML_ENTITY_REGEX(), '').trim() === ''; 50 } 51 52 function containsDisallowedJSXTextChars(rawStringValue) { 53 return /[{<>}]/.test(rawStringValue); 54 } 55 56 function containsQuoteCharacters(value) { 57 return /['"]/.test(value); 58 } 59 60 function containsMultilineComment(value) { 61 return /\/\*/.test(value); 62 } 63 64 function escapeDoubleQuotes(rawStringValue) { 65 return rawStringValue.replace(/\\"/g, '"').replace(/"/g, '\\"'); 66 } 67 68 function escapeBackslashes(rawStringValue) { 69 return rawStringValue.replace(/\\/g, '\\\\'); 70 } 71 72 function needToEscapeCharacterForJSX(raw, node) { 73 return ( 74 containsBackslash(raw) 75 || containsHTMLEntity(raw) 76 || (node.parent.type !== 'JSXAttribute' && containsDisallowedJSXTextChars(raw)) 77 ); 78 } 79 80 function containsWhitespaceExpression(child) { 81 if (child.type === 'JSXExpressionContainer') { 82 const value = child.expression.value; 83 return value ? jsxUtil.isWhiteSpaces(value) : false; 84 } 85 return false; 86 } 87 88 function isLineBreak(text) { 89 return containsLineTerminators(text) && text.trim() === ''; 90 } 91 92 function wrapNonHTMLEntities(text) { 93 const HTML_ENTITY = '<HTML_ENTITY>'; 94 const withCurlyBraces = text.split(HTML_ENTITY_REGEX()).map((word) => ( 95 word === '' ? '' : `{${JSON.stringify(word)}}` 96 )).join(HTML_ENTITY); 97 98 const htmlEntities = text.match(HTML_ENTITY_REGEX()); 99 return htmlEntities.reduce((acc, htmlEntity) => ( 100 acc.replace(HTML_ENTITY, htmlEntity) 101 ), withCurlyBraces); 102 } 103 104 function wrapWithCurlyBraces(rawText) { 105 if (!containsLineTerminators(rawText)) { 106 return `{${JSON.stringify(rawText)}}`; 107 } 108 109 return rawText.split('\n').map((line) => { 110 if (line.trim() === '') { 111 return line; 112 } 113 const firstCharIndex = line.search(/[^\s]/); 114 const leftWhitespace = line.slice(0, firstCharIndex); 115 const text = line.slice(firstCharIndex); 116 117 if (containsHTMLEntity(line)) { 118 return `${leftWhitespace}${wrapNonHTMLEntities(text)}`; 119 } 120 return `${leftWhitespace}{${JSON.stringify(text)}}`; 121 }).join('\n'); 122 } 123 124 function isWhiteSpaceLiteral(node) { 125 return node.type && node.type === 'Literal' && node.value && jsxUtil.isWhiteSpaces(node.value); 126 } 127 128 function isStringWithTrailingWhiteSpaces(value) { 129 return /^\s|\s$/.test(value); 130 } 131 132 function isLiteralWithTrailingWhiteSpaces(node) { 133 return node.type && node.type === 'Literal' && node.value && isStringWithTrailingWhiteSpaces(node.value); 134 } 33 135 34 136 // ------------------------------------------------------------------------------ … … 75 177 76 178 create(context) { 77 const HTML_ENTITY_REGEX = () => /&[A-Za-z\d#]+;/g;78 179 const ruleOptions = context.options[0]; 79 180 const userConfig = typeof ruleOptions === 'string' 80 181 ? { props: ruleOptions, children: ruleOptions, propElementValues: OPTION_IGNORE } 81 182 : Object.assign({}, DEFAULT_CONFIG, ruleOptions); 82 83 function containsLineTerminators(rawStringValue) {84 return /[\n\r\u2028\u2029]/.test(rawStringValue);85 }86 87 function containsBackslash(rawStringValue) {88 return arrayIncludes(rawStringValue, '\\');89 }90 91 function containsHTMLEntity(rawStringValue) {92 return HTML_ENTITY_REGEX().test(rawStringValue);93 }94 95 function containsOnlyHtmlEntities(rawStringValue) {96 return rawStringValue.replace(HTML_ENTITY_REGEX(), '').trim() === '';97 }98 99 function containsDisallowedJSXTextChars(rawStringValue) {100 return /[{<>}]/.test(rawStringValue);101 }102 103 function containsQuoteCharacters(value) {104 return /['"]/.test(value);105 }106 107 function containsMultilineComment(value) {108 return /\/\*/.test(value);109 }110 111 function escapeDoubleQuotes(rawStringValue) {112 return rawStringValue.replace(/\\"/g, '"').replace(/"/g, '\\"');113 }114 115 function escapeBackslashes(rawStringValue) {116 return rawStringValue.replace(/\\/g, '\\\\');117 }118 119 function needToEscapeCharacterForJSX(raw, node) {120 return (121 containsBackslash(raw)122 || containsHTMLEntity(raw)123 || (node.parent.type !== 'JSXAttribute' && containsDisallowedJSXTextChars(raw))124 );125 }126 127 function containsWhitespaceExpression(child) {128 if (child.type === 'JSXExpressionContainer') {129 const value = child.expression.value;130 return value ? jsxUtil.isWhiteSpaces(value) : false;131 }132 return false;133 }134 135 function isLineBreak(text) {136 return containsLineTerminators(text) && text.trim() === '';137 }138 139 function wrapNonHTMLEntities(text) {140 const HTML_ENTITY = '<HTML_ENTITY>';141 const withCurlyBraces = text.split(HTML_ENTITY_REGEX()).map((word) => (142 word === '' ? '' : `{${JSON.stringify(word)}}`143 )).join(HTML_ENTITY);144 145 const htmlEntities = text.match(HTML_ENTITY_REGEX());146 return htmlEntities.reduce((acc, htmlEntity) => (147 acc.replace(HTML_ENTITY, htmlEntity)148 ), withCurlyBraces);149 }150 151 function wrapWithCurlyBraces(rawText) {152 if (!containsLineTerminators(rawText)) {153 return `{${JSON.stringify(rawText)}}`;154 }155 156 return rawText.split('\n').map((line) => {157 if (line.trim() === '') {158 return line;159 }160 const firstCharIndex = line.search(/[^\s]/);161 const leftWhitespace = line.slice(0, firstCharIndex);162 const text = line.slice(firstCharIndex);163 164 if (containsHTMLEntity(line)) {165 return `${leftWhitespace}${wrapNonHTMLEntities(text)}`;166 }167 return `${leftWhitespace}{${JSON.stringify(text)}}`;168 }).join('\n');169 }170 183 171 184 /** … … 187 200 188 201 if (parentType === 'JSXAttribute') { 189 textToReplace = `"${expressionType === 'TemplateLiteral' 190 ? expression.quasis[0].value.raw 191 : expression.raw.slice(1, -1) 192 }"`; 202 if (expressionType !== 'TemplateLiteral' && /["]/.test(expression.raw.slice(1, -1))) { 203 textToReplace = expression.raw; 204 } else { 205 textToReplace = `"${expressionType === 'TemplateLiteral' 206 ? expression.quasis[0].value.raw 207 : expression.raw.slice(1, -1) 208 }"`; 209 } 193 210 } else if (jsxUtil.isJSX(expression)) { 194 211 textToReplace = getText(context, expression); … … 234 251 } 235 252 236 function isWhiteSpaceLiteral(node) {237 return node.type && node.type === 'Literal' && node.value && jsxUtil.isWhiteSpaces(node.value);238 }239 240 function isStringWithTrailingWhiteSpaces(value) {241 return /^\s|\s$/.test(value);242 }243 244 function isLiteralWithTrailingWhiteSpaces(node) {245 return node.type && node.type === 'Literal' && node.value && isStringWithTrailingWhiteSpaces(node.value);246 }247 248 253 // Bail out if there is any character that needs to be escaped in JSX 249 254 // because escaping decreases readability and the original code may be more … … 269 274 && !needToEscapeCharacterForJSX(expression.raw, JSXExpressionNode) && ( 270 275 jsxUtil.isJSX(JSXExpressionNode.parent) 271 || !containsQuoteCharacters(expression.value)276 || (!containsQuoteCharacters(expression.value) || typeof expression.value === 'string') 272 277 ) 273 278 ) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-curly-spacing.js
rd565449 r0c6b92a 36 36 }; 37 37 38 /** @type {import('eslint').Rule.RuleModule} */ 38 39 module.exports = { 39 40 meta: { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-equals-spacing.js
rd565449 r0c6b92a 21 21 }; 22 22 23 /** @type {import('eslint').Rule.RuleModule} */ 23 24 module.exports = { 24 25 meta: { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-first-prop-new-line.js
rd565449 r0c6b92a 8 8 const docsUrl = require('../util/docsUrl'); 9 9 const report = require('../util/report'); 10 const propsUtil = require('../util/props'); 10 11 11 12 // ------------------------------------------------------------------------------ … … 56 57 node: decl, 57 58 fix(fixer) { 58 return fixer.replaceTextRange([(node.typeParameters || node.name).range[1], decl.range[0]], '\n'); 59 const nodeTypeArguments = propsUtil.getTypeArguments(node); 60 return fixer.replaceTextRange([(nodeTypeArguments || node.name).range[1], decl.range[0]], '\n'); 59 61 }, 60 62 }); -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-fragments.js
rd565449 r0c6b92a 23 23 24 24 const messages = { 25 fragmentsNotSupported: 'Fragments are only supported starting from React v16.2. ' 26 + 'Please disable the `react/jsx-fragments` rule in `eslint` settings or upgrade your version of React.', 25 fragmentsNotSupported: 'Fragments are only supported starting from React v16.2. Please disable the `react/jsx-fragments` rule in `eslint` settings or upgrade your version of React.', 27 26 preferPragma: 'Prefer {{react}}.{{fragment}} over fragment shorthand', 28 27 preferFragment: 'Prefer fragment shorthand over {{react}}.{{fragment}}', 29 28 }; 30 29 30 /** @type {import('eslint').Rule.RuleModule} */ 31 31 module.exports = { 32 32 meta: { … … 171 171 if (node.source && node.source.value === 'react') { 172 172 node.specifiers.forEach((spec) => { 173 if ( spec.imported && spec.imported.name === fragmentPragma) {173 if ('imported' in spec && spec.imported && spec.imported.name === fragmentPragma) { 174 174 if (spec.local) { 175 175 fragmentNames.add(spec.local.name); -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-indent-props.js
rd565449 r0c6b92a 46 46 }; 47 47 48 /** @type {import('eslint').Rule.RuleModule} */ 48 49 module.exports = { 49 50 meta: { … … 117 118 * Reports a given indent violation and properly pluralizes the message 118 119 * @param {ASTNode} node Node violating the indent rule 119 * @param { Number} needed Expected indentation character count120 * @param { Number} gotten Indentation character count in the actual node/code120 * @param {number} needed Expected indentation character count 121 * @param {number} gotten Indentation character count in the actual node/code 121 122 */ 122 123 function report(node, needed, gotten) { … … 142 143 * Get node indent 143 144 * @param {ASTNode} node Node to examine 144 * @return { Number} Indent145 * @return {number} Indent 145 146 */ 146 147 function getNodeIndent(node) { … … 174 175 * Check indent for nodes list 175 176 * @param {ASTNode[]} nodes list of node objects 176 * @param { Number} indent needed indent177 * @param {number} indent needed indent 177 178 */ 178 179 function checkNodesIndent(nodes, indent) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-indent.js
rd565449 r0c6b92a 51 51 }; 52 52 53 /** @type {import('eslint').Rule.RuleModule} */ 53 54 module.exports = { 54 55 meta: { … … 106 107 * Responsible for fixing the indentation issue fix 107 108 * @param {ASTNode} node Node violating the indent rule 108 * @param { Number} needed Expected indentation character count109 * @param {number} needed Expected indentation character count 109 110 * @returns {Function} function to be executed by the fixer 110 111 * @private … … 147 148 * Reports a given indent violation and properly pluralizes the message 148 149 * @param {ASTNode} node Node violating the indent rule 149 * @param { Number} needed Expected indentation character count150 * @param { Number} gotten Indentation character count in the actual node/code150 * @param {number} needed Expected indentation character count 151 * @param {number} gotten Indentation character count in the actual node/code 151 152 * @param {Object} [loc] Error line and column location 152 153 */ … … 169 170 * Get node indent 170 171 * @param {ASTNode} node Node to examine 171 * @param { Boolean} [byLastLine] get indent of node's last line172 * @param { Boolean} [excludeCommas] skip comma on start of line173 * @return { Number} Indent172 * @param {boolean} [byLastLine] get indent of node's last line 173 * @param {boolean} [excludeCommas] skip comma on start of line 174 * @return {number} Indent 174 175 */ 175 176 function getNodeIndent(node, byLastLine, excludeCommas) { … … 198 199 * Check if the node is the right member of a logical expression 199 200 * @param {ASTNode} node The node to check 200 * @return { Boolean} true if its the case, false if not201 * @return {boolean} true if its the case, false if not 201 202 */ 202 203 function isRightInLogicalExp(node) { … … 213 214 * Check if the node is the alternate member of a conditional expression 214 215 * @param {ASTNode} node The node to check 215 * @return { Boolean} true if its the case, false if not216 * @return {boolean} true if its the case, false if not 216 217 */ 217 218 function isAlternateInConditionalExp(node) { … … 228 229 * Check if the node is within a DoExpression block but not the first expression (which need to be indented) 229 230 * @param {ASTNode} node The node to check 230 * @return { Boolean} true if its the case, false if not231 * @return {boolean} true if its the case, false if not 231 232 */ 232 233 function isSecondOrSubsequentExpWithinDoExp(node) { … … 299 300 * Check indent for nodes list 300 301 * @param {ASTNode} node The node to check 301 * @param { Number} indent needed indent302 * @param { Boolean} [excludeCommas] skip comma on start of line302 * @param {number} indent needed indent 303 * @param {boolean} [excludeCommas] skip comma on start of line 303 304 */ 304 305 function checkNodesIndent(node, indent, excludeCommas) { … … 319 320 * Check indent for Literal Node or JSXText Node 320 321 * @param {ASTNode} node The node to check 321 * @param { Number} indent needed indent322 * @param {number} indent needed indent 322 323 */ 323 324 function checkLiteralNodeIndent(node, indent) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js
rd565449 r0c6b92a 92 92 function find(refs, prevRefs) { 93 93 for (let i = refs.length - 1; i >= 0; i--) { 94 if ( has(refs[i], 'writeExpr')) {94 if (typeof refs[i].writeExpr !== 'undefined') { 95 95 const writeExpr = refs[i].writeExpr; 96 96 -
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 }, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-no-leaked-render.js
rd565449 r0c6b92a 110 110 } 111 111 112 /**113 * @type {import('eslint').Rule.RuleModule}114 */115 112 /** @type {import('eslint').Rule.RuleModule} */ 116 113 module.exports = { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-no-literals.js
rd565449 r0c6b92a 9 9 const iterFrom = require('es-iterator-helpers/Iterator.from'); 10 10 const map = require('es-iterator-helpers/Iterator.prototype.map'); 11 const some = require('es-iterator-helpers/Iterator.prototype.some'); 12 const flatMap = require('es-iterator-helpers/Iterator.prototype.flatMap'); 13 const fromEntries = require('object.fromentries'); 14 const entries = require('object.entries'); 11 15 12 16 const docsUrl = require('../util/docsUrl'); … … 18 22 // ------------------------------------------------------------------------------ 19 23 20 function trimIfString(val) { 21 return typeof val === 'string' ? val.trim() : val; 24 /** 25 * @param {unknown} value 26 * @returns {string | unknown} 27 */ 28 function trimIfString(value) { 29 return typeof value === 'string' ? value.trim() : value; 22 30 } 31 32 const reOverridableElement = /^[A-Z][\w.]*$/; 33 const reIsWhiteSpace = /^[\s]+$/; 34 const jsxElementTypes = new Set(['JSXElement', 'JSXFragment']); 35 const standardJSXNodeParentTypes = new Set(['JSXAttribute', 'JSXElement', 'JSXExpressionContainer', 'JSXFragment']); 23 36 24 37 const messages = { 25 38 invalidPropValue: 'Invalid prop value: "{{text}}"', 39 invalidPropValueInElement: 'Invalid prop value: "{{text}}" in {{element}}', 26 40 noStringsInAttributes: 'Strings not allowed in attributes: "{{text}}"', 41 noStringsInAttributesInElement: 'Strings not allowed in attributes: "{{text}}" in {{element}}', 27 42 noStringsInJSX: 'Strings not allowed in JSX files: "{{text}}"', 43 noStringsInJSXInElement: 'Strings not allowed in JSX files: "{{text}}" in {{element}}', 28 44 literalNotInJSXExpression: 'Missing JSX expression container around literal string: "{{text}}"', 45 literalNotInJSXExpressionInElement: 'Missing JSX expression container around literal string: "{{text}}" in {{element}}', 29 46 }; 30 47 31 /** @type {import('eslint').Rule.RuleModule} */ 48 /** @type {Exclude<import('eslint').Rule.RuleModule['meta']['schema'], unknown[]>['properties']} */ 49 const commonPropertiesSchema = { 50 noStrings: { 51 type: 'boolean', 52 }, 53 allowedStrings: { 54 type: 'array', 55 uniqueItems: true, 56 items: { 57 type: 'string', 58 }, 59 }, 60 ignoreProps: { 61 type: 'boolean', 62 }, 63 noAttributeStrings: { 64 type: 'boolean', 65 }, 66 }; 67 68 /** 69 * @typedef RawElementConfigProperties 70 * @property {boolean} [noStrings] 71 * @property {string[]} [allowedStrings] 72 * @property {boolean} [ignoreProps] 73 * @property {boolean} [noAttributeStrings] 74 * 75 * @typedef RawOverrideConfigProperties 76 * @property {boolean} [allowElement] 77 * @property {boolean} [applyToNestedElements=true] 78 * 79 * @typedef {RawElementConfigProperties} RawElementConfig 80 * @typedef {RawElementConfigProperties & RawElementConfigProperties} RawOverrideConfig 81 * 82 * @typedef RawElementOverrides 83 * @property {Record<string, RawOverrideConfig>} [elementOverrides] 84 * 85 * @typedef {RawElementConfig & RawElementOverrides} RawConfig 86 * 87 * ---------------------------------------------------------------------- 88 * 89 * @typedef ElementConfigType 90 * @property {'element'} type 91 * 92 * @typedef ElementConfigProperties 93 * @property {boolean} noStrings 94 * @property {Set<string>} allowedStrings 95 * @property {boolean} ignoreProps 96 * @property {boolean} noAttributeStrings 97 * 98 * @typedef OverrideConfigProperties 99 * @property {'override'} type 100 * @property {string} name 101 * @property {boolean} allowElement 102 * @property {boolean} applyToNestedElements 103 * 104 * @typedef {ElementConfigType & ElementConfigProperties} ElementConfig 105 * @typedef {OverrideConfigProperties & ElementConfigProperties} OverrideConfig 106 * 107 * @typedef ElementOverrides 108 * @property {Record<string, OverrideConfig>} elementOverrides 109 * 110 * @typedef {ElementConfig & ElementOverrides} Config 111 * @typedef {Config | OverrideConfig} ResolvedConfig 112 */ 113 114 /** 115 * Normalizes the element portion of the config 116 * @param {RawConfig} config 117 * @returns {ElementConfig} 118 */ 119 function normalizeElementConfig(config) { 120 return { 121 type: 'element', 122 noStrings: !!config.noStrings, 123 allowedStrings: config.allowedStrings 124 ? new Set(map(iterFrom(config.allowedStrings), trimIfString)) 125 : new Set(), 126 ignoreProps: !!config.ignoreProps, 127 noAttributeStrings: !!config.noAttributeStrings, 128 }; 129 } 130 131 /** 132 * Normalizes the config and applies default values to all config options 133 * @param {RawConfig} config 134 * @returns {Config} 135 */ 136 function normalizeConfig(config) { 137 /** @type {Config} */ 138 const normalizedConfig = Object.assign(normalizeElementConfig(config), { 139 elementOverrides: {}, 140 }); 141 142 if (config.elementOverrides) { 143 normalizedConfig.elementOverrides = fromEntries( 144 flatMap( 145 iterFrom(entries(config.elementOverrides)), 146 (entry) => { 147 const elementName = entry[0]; 148 const rawElementConfig = entry[1]; 149 150 if (!reOverridableElement.test(elementName)) { 151 return []; 152 } 153 154 return [[ 155 elementName, 156 Object.assign(normalizeElementConfig(rawElementConfig), { 157 type: 'override', 158 name: elementName, 159 allowElement: !!rawElementConfig.allowElement, 160 applyToNestedElements: typeof rawElementConfig.applyToNestedElements === 'undefined' || !!rawElementConfig.applyToNestedElements, 161 }), 162 ]]; 163 } 164 ) 165 ); 166 } 167 168 return normalizedConfig; 169 } 170 171 const elementOverrides = { 172 type: 'object', 173 patternProperties: { 174 [reOverridableElement.source]: { 175 type: 'object', 176 properties: Object.assign( 177 { applyToNestedElements: { type: 'boolean' } }, 178 commonPropertiesSchema 179 ), 180 181 }, 182 }, 183 }; 184 32 185 module.exports = { 33 meta: {186 meta: /** @type {import('eslint').Rule.RuleModule["meta"]} */ ({ 34 187 docs: { 35 188 description: 'Disallow usage of string literals in JSX', … … 43 196 schema: [{ 44 197 type: 'object', 45 properties: { 46 noStrings: { 47 type: 'boolean', 48 }, 49 allowedStrings: { 50 type: 'array', 51 uniqueItems: true, 52 items: { 53 type: 'string', 54 }, 55 }, 56 ignoreProps: { 57 type: 'boolean', 58 }, 59 noAttributeStrings: { 60 type: 'boolean', 61 }, 62 }, 198 properties: Object.assign( 199 { elementOverrides }, 200 commonPropertiesSchema 201 ), 63 202 additionalProperties: false, 64 203 }], 65 } ,204 }), 66 205 67 206 create(context) { 68 const defaults = { 69 noStrings: false, 70 allowedStrings: [], 71 ignoreProps: false, 72 noAttributeStrings: false, 73 }; 74 const config = Object.assign({}, defaults, context.options[0] || {}); 75 config.allowedStrings = new Set(map(iterFrom(config.allowedStrings), trimIfString)); 76 77 function defaultMessageId() { 78 const ancestorIsJSXElement = arguments.length >= 1 && arguments[0]; 79 if (config.noAttributeStrings && !ancestorIsJSXElement) { 80 return 'noStringsInAttributes'; 81 } 82 if (config.noStrings) { 83 return 'noStringsInJSX'; 84 } 85 return 'literalNotInJSXExpression'; 86 } 87 207 /** @type {RawConfig} */ 208 const rawConfig = (context.options.length && context.options[0]) || {}; 209 const config = normalizeConfig(rawConfig); 210 211 const hasElementOverrides = Object.keys(config.elementOverrides).length > 0; 212 213 /** @type {Map<string, string>} */ 214 const renamedImportMap = new Map(); 215 216 /** 217 * Determines if the given expression is a require statement. Supports 218 * nested MemberExpresions. ie `require('foo').nested.property` 219 * @param {ASTNode} node 220 * @returns {boolean} 221 */ 222 function isRequireStatement(node) { 223 if (node.type === 'CallExpression') { 224 if (node.callee.type === 'Identifier') { 225 return node.callee.name === 'require'; 226 } 227 } 228 if (node.type === 'MemberExpression') { 229 return isRequireStatement(node.object); 230 } 231 232 return false; 233 } 234 235 /** @typedef {{ name: string, compoundName?: string }} ElementNameFragment */ 236 237 /** 238 * Gets the name of the given JSX element. Supports nested 239 * JSXMemeberExpressions. ie `<Namesapce.Component.SubComponent />` 240 * @param {ASTNode} node 241 * @returns {ElementNameFragment | undefined} 242 */ 243 function getJSXElementName(node) { 244 if (node.openingElement.name.type === 'JSXIdentifier') { 245 const name = node.openingElement.name.name; 246 return { 247 name: renamedImportMap.get(name) || name, 248 compoundName: undefined, 249 }; 250 } 251 252 /** @type {string[]} */ 253 const nameFragments = []; 254 255 if (node.openingElement.name.type === 'JSXMemberExpression') { 256 /** @type {ASTNode} */ 257 let current = node.openingElement.name; 258 while (current.type === 'JSXMemberExpression') { 259 if (current.property.type === 'JSXIdentifier') { 260 nameFragments.unshift(current.property.name); 261 } 262 263 current = current.object; 264 } 265 266 if (current.type === 'JSXIdentifier') { 267 nameFragments.unshift(current.name); 268 269 const rootFragment = nameFragments[0]; 270 if (rootFragment) { 271 const rootFragmentRenamed = renamedImportMap.get(rootFragment); 272 if (rootFragmentRenamed) { 273 nameFragments[0] = rootFragmentRenamed; 274 } 275 } 276 277 const nameFragment = nameFragments[nameFragments.length - 1]; 278 if (nameFragment) { 279 return { 280 name: nameFragment, 281 compoundName: nameFragments.join('.'), 282 }; 283 } 284 } 285 } 286 } 287 288 /** 289 * Gets all JSXElement ancestor nodes for the given node 290 * @param {ASTNode} node 291 * @returns {ASTNode[]} 292 */ 293 function getJSXElementAncestors(node) { 294 /** @type {ASTNode[]} */ 295 const ancestors = []; 296 297 let current = node; 298 while (current) { 299 if (current.type === 'JSXElement') { 300 ancestors.push(current); 301 } 302 303 current = current.parent; 304 } 305 306 return ancestors; 307 } 308 309 /** 310 * @param {ASTNode} node 311 * @returns {ASTNode} 312 */ 88 313 function getParentIgnoringBinaryExpressions(node) { 89 314 let current = node; … … 94 319 } 95 320 96 function getValidation(node) { 97 const values = [trimIfString(node.raw), trimIfString(node.value)]; 98 if (values.some((value) => config.allowedStrings.has(value))) { 99 return false; 100 } 101 321 /** 322 * @param {ASTNode} node 323 * @returns {{ parent: ASTNode, grandParent: ASTNode }} 324 */ 325 function getParentAndGrandParent(node) { 102 326 const parent = getParentIgnoringBinaryExpressions(node); 103 104 function isParentNodeStandard() {105 if (!/^[\s]+$/.test(node.value) && typeof node.value === 'string' && parent.type.includes('JSX')) {106 if (config.noAttributeStrings) {107 return parent.type === 'JSXAttribute' || parent.type === 'JSXElement';108 }109 if (!config.noAttributeStrings) {110 return parent.type !== 'JSXAttribute';111 }112 }113 114 return false;115 }116 117 const standard = isParentNodeStandard();118 119 if (config.noStrings) {120 return standard;121 }122 return standard && parent.type !== 'JSXExpressionContainer';123 }124 125 function getParentAndGrandParentType(node) {126 const parent = getParentIgnoringBinaryExpressions(node);127 const parentType = parent.type;128 const grandParentType = parent.parent.type;129 130 327 return { 131 328 parent, 132 parentType,133 grandParentType,134 329 grandParent: parent.parent, 135 330 }; 136 331 } 137 332 333 /** 334 * @param {ASTNode} node 335 * @returns {boolean} 336 */ 138 337 function hasJSXElementParentOrGrandParent(node) { 139 const parents = getParentAndGrandParentType(node); 140 const parentType = parents.parentType; 141 const grandParentType = parents.grandParentType; 142 143 return parentType === 'JSXFragment' || parentType === 'JSXElement' || grandParentType === 'JSXElement'; 144 } 145 146 function reportLiteralNode(node, messageId) { 147 const ancestorIsJSXElement = hasJSXElementParentOrGrandParent(node); 148 messageId = messageId || defaultMessageId(ancestorIsJSXElement); 149 338 const ancestors = getParentAndGrandParent(node); 339 return some(iterFrom([ancestors.parent, ancestors.grandParent]), (parent) => jsxElementTypes.has(parent.type)); 340 } 341 342 /** 343 * Determines whether a given node's value and its immediate parent are 344 * viable text nodes that can/should be reported on 345 * @param {ASTNode} node 346 * @param {ResolvedConfig} resolvedConfig 347 * @returns {boolean} 348 */ 349 function isViableTextNode(node, resolvedConfig) { 350 const textValues = iterFrom([trimIfString(node.raw), trimIfString(node.value)]); 351 if (some(textValues, (value) => resolvedConfig.allowedStrings.has(value))) { 352 return false; 353 } 354 355 const parent = getParentIgnoringBinaryExpressions(node); 356 357 let isStandardJSXNode = false; 358 if (typeof node.value === 'string' && !reIsWhiteSpace.test(node.value) && standardJSXNodeParentTypes.has(parent.type)) { 359 if (resolvedConfig.noAttributeStrings) { 360 isStandardJSXNode = parent.type === 'JSXAttribute' || parent.type === 'JSXElement'; 361 } else { 362 isStandardJSXNode = parent.type !== 'JSXAttribute'; 363 } 364 } 365 366 if (resolvedConfig.noStrings) { 367 return isStandardJSXNode; 368 } 369 370 return isStandardJSXNode && parent.type !== 'JSXExpressionContainer'; 371 } 372 373 /** 374 * Gets an override config for a given node. For any given node, we also 375 * need to traverse the ancestor tree to determine if an ancestor's config 376 * will also apply to the current node. 377 * @param {ASTNode} node 378 * @returns {OverrideConfig | undefined} 379 */ 380 function getOverrideConfig(node) { 381 if (!hasElementOverrides) { 382 return; 383 } 384 385 const allAncestorElements = getJSXElementAncestors(node); 386 if (!allAncestorElements.length) { 387 return; 388 } 389 390 for (const ancestorElement of allAncestorElements) { 391 const isClosestJSXAncestor = ancestorElement === allAncestorElements[0]; 392 393 const ancestor = getJSXElementName(ancestorElement); 394 if (ancestor) { 395 if (ancestor.name) { 396 const ancestorElements = config.elementOverrides[ancestor.name]; 397 const ancestorConfig = ancestor.compoundName 398 ? config.elementOverrides[ancestor.compoundName] || ancestorElements 399 : ancestorElements; 400 401 if (ancestorConfig) { 402 if (isClosestJSXAncestor || ancestorConfig.applyToNestedElements) { 403 return ancestorConfig; 404 } 405 } 406 } 407 } 408 } 409 } 410 411 /** 412 * @param {ResolvedConfig} resolvedConfig 413 * @returns {boolean} 414 */ 415 function shouldAllowElement(resolvedConfig) { 416 return resolvedConfig.type === 'override' && 'allowElement' in resolvedConfig && !!resolvedConfig.allowElement; 417 } 418 419 /** 420 * @param {boolean} ancestorIsJSXElement 421 * @param {ResolvedConfig} resolvedConfig 422 * @returns {string} 423 */ 424 function defaultMessageId(ancestorIsJSXElement, resolvedConfig) { 425 if (resolvedConfig.noAttributeStrings && !ancestorIsJSXElement) { 426 return resolvedConfig.type === 'override' ? 'noStringsInAttributesInElement' : 'noStringsInAttributes'; 427 } 428 429 if (resolvedConfig.noStrings) { 430 return resolvedConfig.type === 'override' ? 'noStringsInJSXInElement' : 'noStringsInJSX'; 431 } 432 433 return resolvedConfig.type === 'override' ? 'literalNotInJSXExpressionInElement' : 'literalNotInJSXExpression'; 434 } 435 436 /** 437 * @param {ASTNode} node 438 * @param {string} messageId 439 * @param {ResolvedConfig} resolvedConfig 440 */ 441 function reportLiteralNode(node, messageId, resolvedConfig) { 150 442 report(context, messages[messageId], messageId, { 151 443 node, 152 444 data: { 153 445 text: getText(context, node).trim(), 446 element: resolvedConfig.type === 'override' && 'name' in resolvedConfig ? resolvedConfig.name : undefined, 154 447 }, 155 448 }); … … 160 453 // -------------------------------------------------------------------------- 161 454 162 return { 455 return Object.assign(hasElementOverrides ? { 456 // Get renamed import local names mapped to their imported name 457 ImportDeclaration(node) { 458 node.specifiers 459 .filter((s) => s.type === 'ImportSpecifier') 460 .forEach((specifier) => { 461 renamedImportMap.set( 462 (specifier.local || specifier.imported).name, 463 specifier.imported.name 464 ); 465 }); 466 }, 467 468 // Get renamed destructured local names mapped to their imported name 469 VariableDeclaration(node) { 470 node.declarations 471 .filter((d) => ( 472 d.type === 'VariableDeclarator' 473 && isRequireStatement(d.init) 474 && d.id.type === 'ObjectPattern' 475 )) 476 .forEach((declaration) => { 477 declaration.id.properties 478 .filter((property) => ( 479 property.type === 'Property' 480 && property.key.type === 'Identifier' 481 && property.value.type === 'Identifier' 482 )) 483 .forEach((property) => { 484 renamedImportMap.set(property.value.name, property.key.name); 485 }); 486 }); 487 }, 488 } : false, { 163 489 Literal(node) { 164 if (getValidation(node) && (hasJSXElementParentOrGrandParent(node) || !config.ignoreProps)) { 165 reportLiteralNode(node); 490 const resolvedConfig = getOverrideConfig(node) || config; 491 492 const hasJSXParentOrGrandParent = hasJSXElementParentOrGrandParent(node); 493 if (hasJSXParentOrGrandParent && shouldAllowElement(resolvedConfig)) { 494 return; 495 } 496 497 if (isViableTextNode(node, resolvedConfig)) { 498 if (hasJSXParentOrGrandParent || !config.ignoreProps) { 499 reportLiteralNode(node, defaultMessageId(hasJSXParentOrGrandParent, resolvedConfig), resolvedConfig); 500 } 166 501 } 167 502 }, 168 503 169 504 JSXAttribute(node) { 170 const isNodeValueString = node && node.value && node.value.type === 'Literal' && typeof node.value.value === 'string' && !config.allowedStrings.has(node.value.value); 171 172 if (config.noStrings && !config.ignoreProps && isNodeValueString) { 173 const messageId = 'invalidPropValue'; 174 reportLiteralNode(node, messageId); 505 const isLiteralString = node.value && node.value.type === 'Literal' 506 && typeof node.value.value === 'string'; 507 const isStringLiteral = node.value && node.value.type === 'StringLiteral'; 508 509 if (isLiteralString || isStringLiteral) { 510 const resolvedConfig = getOverrideConfig(node) || config; 511 512 if ( 513 resolvedConfig.noStrings 514 && !resolvedConfig.ignoreProps 515 && !resolvedConfig.allowedStrings.has(node.value.value) 516 ) { 517 const messageId = resolvedConfig.type === 'override' ? 'invalidPropValueInElement' : 'invalidPropValue'; 518 reportLiteralNode(node, messageId, resolvedConfig); 519 } 175 520 } 176 521 }, 177 522 178 523 JSXText(node) { 179 if (getValidation(node)) { 180 reportLiteralNode(node); 524 const resolvedConfig = getOverrideConfig(node) || config; 525 526 if (shouldAllowElement(resolvedConfig)) { 527 return; 528 } 529 530 if (isViableTextNode(node, resolvedConfig)) { 531 const hasJSXParendOrGrantParent = hasJSXElementParentOrGrandParent(node); 532 reportLiteralNode(node, defaultMessageId(hasJSXParendOrGrantParent, resolvedConfig), resolvedConfig); 181 533 } 182 534 }, 183 535 184 536 TemplateLiteral(node) { 185 const parents = getParentAndGrandParentType(node); 186 const parentType = parents.parentType; 187 const grandParentType = parents.grandParentType; 188 const isParentJSXExpressionCont = parentType === 'JSXExpressionContainer'; 189 const isParentJSXElement = parentType === 'JSXElement' || grandParentType === 'JSXElement'; 190 191 if (isParentJSXExpressionCont && config.noStrings && (isParentJSXElement || !config.ignoreProps)) { 192 reportLiteralNode(node); 537 const ancestors = getParentAndGrandParent(node); 538 const isParentJSXExpressionCont = ancestors.parent.type === 'JSXExpressionContainer'; 539 const isParentJSXElement = ancestors.grandParent.type === 'JSXElement'; 540 541 if (isParentJSXExpressionCont) { 542 const resolvedConfig = getOverrideConfig(node) || config; 543 544 if ( 545 resolvedConfig.noStrings 546 && (isParentJSXElement || !resolvedConfig.ignoreProps) 547 ) { 548 reportLiteralNode(node, defaultMessageId(isParentJSXElement, resolvedConfig), resolvedConfig); 549 } 193 550 } 194 551 }, 195 } ;552 }); 196 553 }, 197 554 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-no-target-blank.js
rd565449 r0c6b92a 71 71 * @param {ASTNode} value The AST node being checked. 72 72 * @param {ASTNode} targetValue The AST node being checked. 73 * @returns { String | String[] | null} The string value, or null if not a string.73 * @returns {string | string[] | null} The string value, or null if not a string. 74 74 */ 75 75 function getStringFromValue(value, targetValue) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-no-useless-fragment.js
rd565449 r0c6b92a 8 8 9 9 const pragmaUtil = require('../util/pragma'); 10 const astUtil = require('../util/ast'); 10 11 const jsxUtil = require('../util/jsx'); 11 12 const docsUrl = require('../util/docsUrl'); … … 76 77 return node 77 78 && node.type === 'JSXExpressionContainer' 78 && node.expression 79 && node.expression.type === 'CallExpression'; 79 && astUtil.isCallExpression(node.expression); 80 80 } 81 81 -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-props-no-multi-spaces.js
rd565449 r0c6b92a 9 9 const eslintUtil = require('../util/eslint'); 10 10 const report = require('../util/report'); 11 const propsUtil = require('../util/props'); 11 12 12 13 const getSourceCode = eslintUtil.getSourceCode; … … 104 105 105 106 function containsGenericType(node) { 106 const nodeType Params = node.typeParameters;107 if (typeof nodeType Params === 'undefined') {107 const nodeTypeArguments = propsUtil.getTypeArguments(node); 108 if (typeof nodeTypeArguments === 'undefined') { 108 109 return false; 109 110 } 110 111 111 return nodeType Params.type === 'TSTypeParameterInstantiation';112 return nodeTypeArguments.type === 'TSTypeParameterInstantiation'; 112 113 } 113 114 … … 115 116 const name = node.name; 116 117 if (containsGenericType(node)) { 117 const type = node.typeParameters;118 const nodeTypeArguments = propsUtil.getTypeArguments(node); 118 119 119 120 return Object.assign( … … 123 124 range: [ 124 125 name.range[0], 125 type.range[1],126 nodeTypeArguments.range[1], 126 127 ], 127 128 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-props-no-spreading.js
rd565449 r0c6b92a 59 59 }, 60 60 custom: { 61 enum: [OPTIONS.enforce, OPTIONS.ignore], 62 }, 63 explicitSpread: { 61 64 enum: [OPTIONS.enforce, OPTIONS.ignore], 62 65 }, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-sort-default-props.js
rd565449 r0c6b92a 26 26 }; 27 27 28 /** @type {import('eslint').Rule.RuleModule} */ 28 29 module.exports = { 29 30 meta: { … … 58 59 * Get properties name 59 60 * @param {Object} node - Property. 60 * @returns { String} Property name.61 * @returns {string} Property name. 61 62 */ 62 63 function getPropertyName(node) { … … 79 80 * Checks if the Identifier node passed in looks like a defaultProps declaration. 80 81 * @param {ASTNode} node The node to check. Must be an Identifier node. 81 * @returns { Boolean} `true` if the node is a defaultProps declaration, `false` if not82 * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not 82 83 */ 83 84 function isDefaultPropsDeclaration(node) { … … 179 180 } 180 181 181 checkNode( node.parent.right);182 checkNode('right' in node.parent && node.parent.right); 182 183 }, 183 184 -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-sort-props.js
rd565449 r0c6b92a 13 13 const jsxUtil = require('../util/jsx'); 14 14 const report = require('../util/report'); 15 const propTypesSortUtil = require('../util/propTypesSort'); 15 16 const eslintUtil = require('../util/eslint'); 16 17 … … 21 22 // Rule Definition 22 23 // ------------------------------------------------------------------------------ 23 24 function isCallbackPropName(name) {25 return /^on[A-Z]/.test(name);26 }27 24 28 25 function isMultilineProp(node) { … … 86 83 87 84 if (options.callbacksLast) { 88 const aIsCallback = isCallbackPropName(aProp);89 const bIsCallback = isCallbackPropName(bProp);85 const aIsCallback = propTypesSortUtil.isCallbackPropName(aProp); 86 const bIsCallback = propTypesSortUtil.isCallbackPropName(bProp); 90 87 if (aIsCallback && !bIsCallback) { 91 88 return 1; … … 280 277 * Checks if the `reservedFirst` option is valid 281 278 * @param {Object} context The context of the rule 282 * @param { Boolean|Array<String>} reservedFirst The `reservedFirst` option283 * @return {Function |undefined} If an error is detected, a function to generate the error message, otherwise, `undefined`279 * @param {boolean | string[]} reservedFirst The `reservedFirst` option 280 * @return {Function | undefined} If an error is detected, a function to generate the error message, otherwise, `undefined` 284 281 */ 285 282 // eslint-disable-next-line consistent-return … … 426 423 const previousValue = memo.value; 427 424 const currentValue = decl.value; 428 const previousIsCallback = isCallbackPropName(previousPropName);429 const currentIsCallback = isCallbackPropName(currentPropName);425 const previousIsCallback = propTypesSortUtil.isCallbackPropName(previousPropName); 426 const currentIsCallback = propTypesSortUtil.isCallbackPropName(currentPropName); 430 427 431 428 if (ignoreCase) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/jsx-space-before-closing.js
rd565449 r0c6b92a 24 24 }; 25 25 26 /** @type {import('eslint').Rule.RuleModule} */ 26 27 module.exports = { 27 28 meta: { … … 59 60 60 61 const leftToken = getTokenBeforeClosingBracket(node); 61 const closingSlash = sourceCode.getTokenAfter(leftToken);62 const closingSlash = /** @type {import("eslint").AST.Token} */ (sourceCode.getTokenAfter(leftToken)); 62 63 63 64 if (leftToken.loc.end.line !== closingSlash.loc.start.line) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-access-state-in-setstate.js
rd565449 r0c6b92a 7 7 8 8 const docsUrl = require('../util/docsUrl'); 9 const astUtil = require('../util/ast'); 9 10 const componentUtil = require('../util/componentUtil'); 10 11 const report = require('../util/report'); … … 19 20 }; 20 21 22 /** @type {import('eslint').Rule.RuleModule} */ 21 23 module.exports = { 22 24 meta: { … … 33 35 create(context) { 34 36 function isSetStateCall(node) { 35 return node.type === 'CallExpression'37 return astUtil.isCallExpression(node) 36 38 && node.callee.property 37 39 && node.callee.property.name === 'setState' … … 73 75 // method containing this.state to the methods array 74 76 methods.forEach((method) => { 75 if ( node.callee.name === method.methodName) {77 if ('name' in node.callee && node.callee.name === method.methodName) { 76 78 let current = node.parent; 77 79 while (current.type !== 'Program') { 78 80 if (current.type === 'MethodDefinition') { 79 81 methods.push({ 80 methodName: current.key.name,82 methodName: 'name' in current.key ? current.key.name : undefined, 81 83 node: method.node, 82 84 }); … … 93 95 while (current.type !== 'Program') { 94 96 if (isFirstArgumentInSetStateCall(current, node)) { 95 const methodName = node.callee.name;97 const methodName = 'name' in node.callee ? node.callee.name : undefined; 96 98 methods.forEach((method) => { 97 99 if (method.methodName === methodName) { … … 110 112 MemberExpression(node) { 111 113 if ( 112 node.property.name === 'state' 114 'name' in node.property 115 && node.property.name === 'state' 113 116 && node.object.type === 'ThisExpression' 114 117 && isClassComponent(node) 115 118 ) { 119 /** @type {import("eslint").Rule.Node} */ 116 120 let current = node; 117 121 while (current.type !== 'Program') { … … 127 131 if (current.type === 'MethodDefinition') { 128 132 methods.push({ 129 methodName: current.key.name, 130 node, 131 }); 132 break; 133 } else if (current.type === 'FunctionExpression' && current.parent.key) { 133 methodName: 'name' in current.key ? current.key.name : undefined, 134 node, 135 }); 136 break; 137 } else if ( 138 current.type === 'FunctionExpression' 139 && 'key' in current.parent 140 && current.parent.key 141 ) { 134 142 methods.push({ 135 methodName: current.parent.key.name,143 methodName: 'name' in current.parent.key ? current.parent.key.name : undefined, 136 144 node, 137 145 }); … … 144 152 node, 145 153 scope: getScope(context, node), 146 variableName: current.id.name,154 variableName: 'name' in current.id ? current.id.name : undefined, 147 155 }); 148 156 break; … … 156 164 Identifier(node) { 157 165 // Checks if the identifier is a variable within an object 166 /** @type {import("eslint").Rule.Node} */ 158 167 let current = node; 159 168 while (current.parent.type === 'BinaryExpression') { … … 161 170 } 162 171 if ( 163 current.parent.value === current164 || current.parent.object === current172 ('value' in current.parent && current.parent.value === current) 173 || ('object' in current.parent && current.parent.object === current) 165 174 ) { 166 175 while (current.type !== 'Program') { … … 180 189 181 190 ObjectPattern(node) { 182 const isDerivedFromThis = node.parent.init && node.parent.init.type === 'ThisExpression';191 const isDerivedFromThis = 'init' in node.parent && node.parent.init && node.parent.init.type === 'ThisExpression'; 183 192 node.properties.forEach((property) => { 184 if (property && property.key && property.key.name === 'state' && isDerivedFromThis) { 193 if ( 194 property 195 && 'key' in property 196 && property.key 197 && 'name' in property.key 198 && property.key.name === 'state' 199 && isDerivedFromThis 200 ) { 185 201 vars.push({ 186 202 node: property.key, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-adjacent-inline-elements.js
rd565449 r0c6b92a 9 9 const isCreateElement = require('../util/isCreateElement'); 10 10 const report = require('../util/report'); 11 const astUtil = require('../util/ast'); 11 12 12 13 // ------------------------------------------------------------------------------ … … 63 64 return true; 64 65 } 65 if ( node.type === 'CallExpression'&& inlineNames.indexOf(node.arguments[0].value) > -1) {66 if (astUtil.isCallExpression(node) && inlineNames.indexOf(node.arguments[0].value) > -1) { 66 67 return true; 67 68 } … … 77 78 }; 78 79 80 /** @type {import('eslint').Rule.RuleModule} */ 79 81 module.exports = { 80 82 meta: { … … 118 120 return; 119 121 } 120 const children = node.arguments[2].elements;122 const children = 'elements' in node.arguments[2] ? node.arguments[2].elements : undefined; 121 123 validate(node, children); 122 124 }, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-array-index-key.js
rd565449 r0c6b92a 190 190 } 191 191 192 if (node.type === 'CallExpression' 193 && node.callee 194 && node.callee.type === 'MemberExpression' 195 && node.callee.object 196 && isArrayIndex(node.callee.object) 197 && node.callee.property 198 && node.callee.property.type === 'Identifier' 199 && node.callee.property.name === 'toString' 192 if ( 193 astUtil.isCallExpression(node) 194 && node.callee 195 && node.callee.type === 'MemberExpression' 196 && node.callee.object 197 && isArrayIndex(node.callee.object) 198 && node.callee.property 199 && node.callee.property.type === 'Identifier' 200 && node.callee.property.name === 'toString' 200 201 ) { 201 202 // key={bar.toString()} … … 206 207 } 207 208 208 if (node.type === 'CallExpression' 209 && node.callee 210 && node.callee.type === 'Identifier' 211 && node.callee.name === 'String' 212 && Array.isArray(node.arguments) 213 && node.arguments.length > 0 214 && isArrayIndex(node.arguments[0]) 209 if ( 210 astUtil.isCallExpression(node) 211 && node.callee 212 && node.callee.type === 'Identifier' 213 && node.callee.name === 'String' 214 && Array.isArray(node.arguments) 215 && node.arguments.length > 0 216 && isArrayIndex(node.arguments[0]) 215 217 ) { 216 218 // key={String(bar)} -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-children-prop.js
rd565449 r0c6b92a 18 18 * @param {ASTNode} node - The AST node being checked. 19 19 * @param {Context} context - The AST node being checked. 20 * @returns { Boolean} - True if node is a createElement call with a props20 * @returns {boolean} - True if node is a createElement call with a props 21 21 * object literal, False if not. 22 22 */ … … 38 38 }; 39 39 40 /** @type {import('eslint').Rule.RuleModule} */ 40 41 module.exports = { 41 42 meta: { … … 87 88 } 88 89 89 const props = node.arguments[1].properties; 90 const childrenProp = props.find((prop) => prop.key && prop.key.name === 'children'); 90 const props = 'properties' in node.arguments[1] ? node.arguments[1].properties : undefined; 91 const childrenProp = props.find((prop) => ( 92 'key' in prop 93 && prop.key 94 && 'name' in prop.key 95 && prop.key.name === 'children' 96 )); 91 97 92 98 if (childrenProp) { 93 if ( childrenProp.value && !isFunction(childrenProp.value)) {99 if ('value' in childrenProp && childrenProp.value && !isFunction(childrenProp.value)) { 94 100 report(context, messages.passChildrenAsArgs, 'passChildrenAsArgs', { 95 101 node, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-danger-with-children.js
rd565449 r0c6b92a 18 18 }; 19 19 20 /** @type {import('eslint').Rule.RuleModule} */ 20 21 module.exports = { 21 22 meta: { … … 86 87 * Checks to see if a node is a line break 87 88 * @param {ASTNode} node The AST node being checked 88 * @returns { Boolean} True if node is a line break, false if not89 * @returns {boolean} True if node is a line break, false if not 89 90 */ 90 91 function isLineBreak(node) { … … 120 121 node.callee 121 122 && node.callee.type === 'MemberExpression' 123 && 'name' in node.callee.property 122 124 && node.callee.property.name === 'createElement' 123 125 && node.arguments.length > 1 -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-danger.js
rd565449 r0c6b92a 30 30 /** 31 31 * Checks if a JSX attribute is dangerous. 32 * @param { String} name - Name of the attribute to check.32 * @param {string} name - Name of the attribute to check. 33 33 * @returns {boolean} Whether or not the attribute is dangerous. 34 34 */ -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-deprecated.js
rd565449 r0c6b92a 116 116 }; 117 117 118 /** @type {import('eslint').Rule.RuleModule} */ 118 119 module.exports = { 119 120 meta: { … … 227 228 return; 228 229 } 229 node.specifiers.filter(((s) => s.imported)).forEach((specifier) => { 230 checkDeprecation(node, `${MODULES[node.source.value][0]}.${specifier.imported.name}`, specifier); 230 node.specifiers.filter(((s) => 'imported' in s && s.imported)).forEach((specifier) => { 231 // TODO, semver-major: remove `in` check as part of jsdoc->tsdoc migration 232 checkDeprecation(node, 'imported' in specifier && `${MODULES[node.source.value][0]}.${specifier.imported.name}`, specifier); 231 233 }); 232 234 }, … … 234 236 VariableDeclarator(node) { 235 237 const reactModuleName = getReactModuleName(node); 236 const isRequire = node.init && node.init.callee && node.init.callee.name === 'require'; 238 const isRequire = node.init 239 && 'callee' in node.init 240 && node.init.callee 241 && 'name' in node.init.callee 242 && node.init.callee.name === 'require'; 237 243 const isReactRequire = node.init 244 && 'arguments' in node.init 238 245 && node.init.arguments 239 246 && node.init.arguments.length 240 && typeof MODULES[ node.init.arguments[0].value] !== 'undefined';247 && typeof MODULES['value' in node.init.arguments[0] ? node.init.arguments[0].value : undefined] !== 'undefined'; 241 248 const isDestructuring = node.id && node.id.type === 'ObjectPattern'; 242 249 … … 247 254 return; 248 255 } 249 node.id.properties.filter((p) => p.type !== 'RestElement' && p.key).forEach((property) => { 250 checkDeprecation(node, `${reactModuleName || pragma}.${property.key.name}`, property); 256 257 ('properties' in node.id ? node.id.properties : undefined).filter((p) => p.type !== 'RestElement' && p.key).forEach((property) => { 258 checkDeprecation( 259 node, 260 'key' in property && 'name' in property.key && `${reactModuleName || pragma}.${property.key.name}`, 261 property 262 ); 251 263 }); 252 264 }, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-direct-mutation-state.js
rd565449 r0c6b92a 39 39 * Checks if the component is valid 40 40 * @param {Object} component The component to process 41 * @returns { Boolean} True if the component is valid, false if not.41 * @returns {boolean} True if the component is valid, false if not. 42 42 */ 43 43 function isValid(component) { 44 return Boolean(component && !component.mutateSetState);44 return !!component && !component.mutateSetState; 45 45 } 46 46 … … 74 74 * Determine if we should currently ignore assignments in this component. 75 75 * @param {?Object} component The component to process 76 * @returns { Boolean} True if we should skip assignment checks.76 * @returns {boolean} True if we should skip assignment checks. 77 77 */ 78 78 function shouldIgnoreComponent(component) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-find-dom-node.js
rd565449 r0c6b92a 17 17 }; 18 18 19 /** @type {import('eslint').Rule.RuleModule} */ 19 20 module.exports = { 20 21 meta: { … … 36 37 const callee = node.callee; 37 38 38 const isfindDOMNode = (callee.name === 'findDOMNode') 39 || (callee.property && callee.property.name === 'findDOMNode'); 40 if (!isfindDOMNode) { 39 const isFindDOMNode = ('name' in callee && callee.name === 'findDOMNode') || ( 40 'property' in callee 41 && callee.property 42 && 'name' in callee.property 43 && callee.property.name === 'findDOMNode' 44 ); 45 46 if (!isFindDOMNode) { 41 47 return; 42 48 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-invalid-html-attribute.js
rd565449 r0c6b92a 290 290 291 291 const singleAttributeParts = splitIntoRangedParts(node, /(\S+)/g); 292 for (const singlePart of singleAttributeParts){292 singleAttributeParts.forEach((singlePart) => { 293 293 const allowedTags = VALID_VALUES.get(attributeName).get(singlePart.value); 294 294 const reportingValue = singlePart.reportingValue; … … 330 330 }); 331 331 } 332 } 332 }); 333 333 334 334 const allowedPairsForAttribute = VALID_PAIR_VALUES.get(attributeName); 335 335 if (allowedPairsForAttribute) { 336 336 const pairAttributeParts = splitIntoRangedParts(node, /(?=(\b\S+\s*\S+))/g); 337 for (const pairPart of pairAttributeParts) { 338 for (const allowedPair of allowedPairsForAttribute) { 339 const pairing = allowedPair[0]; 340 const siblings = allowedPair[1]; 337 pairAttributeParts.forEach((pairPart) => { 338 allowedPairsForAttribute.forEach((siblings, pairing) => { 341 339 const attributes = pairPart.reportingValue.split('\u0020'); 342 340 const firstValue = attributes[0]; … … 358 356 } 359 357 } 360 } 361 } 358 }); 359 }); 362 360 } 363 361 364 362 const whitespaceParts = splitIntoRangedParts(node, /(\s+)/g); 365 for (const whitespacePart of whitespaceParts){363 whitespaceParts.forEach((whitespacePart) => { 366 364 const data = { attributeName }; 367 365 … … 387 385 }); 388 386 } 389 } 387 }); 390 388 } 391 389 … … 580 578 581 579 if (prop.value.type === 'ArrayExpression') { 582 for (const value of prop.value.elements){580 prop.value.elements.forEach((value) => { 583 581 checkPropValidValue(context, node, value, attribute); 584 } 582 }); 585 583 586 584 // eslint-disable-next-line no-continue … … 592 590 } 593 591 592 /** @type {import('eslint').Rule.RuleModule} */ 594 593 module.exports = { 595 594 meta: { … … 641 640 642 641 // ignore non-HTML elements 643 if ( !HTML_ELEMENTS.has(elemNameArg.value)) {642 if (typeof elemNameArg.value === 'string' && !HTML_ELEMENTS.has(elemNameArg.value)) { 644 643 return; 645 644 } … … 647 646 const attributes = new Set(context.options[0] || DEFAULT_ATTRIBUTES); 648 647 649 for (const attribute of attributes){648 attributes.forEach((attribute) => { 650 649 checkCreateProps(context, node, attribute); 651 } 650 }); 652 651 }, 653 652 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-is-mounted.js
rd565449 r0c6b92a 18 18 }; 19 19 20 /** @type {import('eslint').Rule.RuleModule} */ 20 21 module.exports = { 21 22 meta: { … … 39 40 return; 40 41 } 41 if (callee.object.type !== 'ThisExpression' || callee.property.name !== 'isMounted') { 42 if ( 43 callee.object.type !== 'ThisExpression' 44 || !('name' in callee.property) 45 || callee.property.name !== 'isMounted' 46 ) { 42 47 return; 43 48 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-multi-comp.js
rd565449 r0c6b92a 51 51 * Checks if the component is ignored 52 52 * @param {Object} component The component being checked. 53 * @returns { Boolean} True if the component is ignored, false if not.53 * @returns {boolean} True if the component is ignored, false if not. 54 54 */ 55 55 function isIgnored(component) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-object-type-as-default-prop.js
rd565449 r0c6b92a 10 10 const Components = require('../util/Components'); 11 11 const docsUrl = require('../util/docsUrl'); 12 const astUtil = require('../util/ast'); 12 13 const report = require('../util/report'); 13 14 … … 56 57 }); 57 58 } else if ( 58 propDefaultValueType === 'CallExpression'59 astUtil.isCallExpression(propDefaultValue.right) 59 60 && propDefaultValue.right.callee.type === 'Identifier' 60 61 && propDefaultValue.right.callee.name === 'Symbol' -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-redundant-should-component-update.js
rd565449 r0c6b92a 37 37 * Checks for shouldComponentUpdate property 38 38 * @param {ASTNode} node The AST node being checked. 39 * @returns { Boolean} Whether or not the property exists.39 * @returns {boolean} Whether or not the property exists. 40 40 */ 41 41 function hasShouldComponentUpdate(node) { … … 50 50 * Get name of node if available 51 51 * @param {ASTNode} node The AST node being checked. 52 * @return { String} The name of the node52 * @return {string} The name of the node 53 53 */ 54 54 function getNodeName(node) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-render-return-value.js
rd565449 r0c6b92a 18 18 }; 19 19 20 /** @type {import('eslint').Rule.RuleModule} */ 20 21 module.exports = { 21 22 meta: { … … 57 58 callee.object.type !== 'Identifier' 58 59 || !calleeObjectName.test(callee.object.name) 59 || callee.property.name !== 'render'60 || (!('name' in callee.property) || callee.property.name !== 'render') 60 61 ) { 61 62 return; -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-set-state.js
rd565449 r0c6b92a 39 39 * Checks if the component is valid 40 40 * @param {Object} component The component to process 41 * @returns { Boolean} True if the component is valid, false if not.41 * @returns {boolean} True if the component is valid, false if not. 42 42 */ 43 43 function isValid(component) { 44 return Boolean(component && !component.useSetState);44 return !!component && !component.useSetState; 45 45 } 46 46 … … 50 50 */ 51 51 function reportSetStateUsages(component) { 52 let setStateUsage;53 52 for (let i = 0, j = component.setStateUsages.length; i < j; i++) { 54 setStateUsage = component.setStateUsages[i];53 const setStateUsage = component.setStateUsages[i]; 55 54 report(context, messages.noSetState, 'noSetState', { 56 55 node: setStateUsage, -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-string-refs.js
rd565449 r0c6b92a 9 9 const docsUrl = require('../util/docsUrl'); 10 10 const report = require('../util/report'); 11 const testReactVersion = require('../util/version').testReactVersion; 11 12 12 13 // ------------------------------------------------------------------------------ … … 43 44 44 45 create(context) { 46 const checkRefsUsage = testReactVersion(context, '< 18.3.0'); // `this.refs` is writable in React 18.3.0 and later, see https://github.com/facebook/react/pull/28867 45 47 const detectTemplateLiterals = context.options[0] ? context.options[0].noTemplateLiterals : false; 46 48 /** 47 49 * Checks if we are using refs 48 50 * @param {ASTNode} node The AST node being checked. 49 * @returns { Boolean} True if we are using refs, false if not.51 * @returns {boolean} True if we are using refs, false if not. 50 52 */ 51 53 function isRefsUsage(node) { … … 60 62 * Checks if we are using a ref attribute 61 63 * @param {ASTNode} node The AST node being checked. 62 * @returns { Boolean} True if we are using a ref attribute, false if not.64 * @returns {boolean} True if we are using a ref attribute, false if not. 63 65 */ 64 66 function isRefAttribute(node) { 65 return !!( 66 node.type === 'JSXAttribute' 67 && node.name 68 && node.name.name === 'ref' 69 ); 67 return node.type === 'JSXAttribute' 68 && !!node.name 69 && node.name.name === 'ref'; 70 70 } 71 71 … … 73 73 * Checks if a node contains a string value 74 74 * @param {ASTNode} node The AST node being checked. 75 * @returns { Boolean} True if the node contains a string value, false if not.75 * @returns {boolean} True if the node contains a string value, false if not. 76 76 */ 77 77 function containsStringLiteral(node) { 78 return !!( 79 node.value 78 return !!node.value 80 79 && node.value.type === 'Literal' 81 && typeof node.value.value === 'string' 82 ); 80 && typeof node.value.value === 'string'; 83 81 } 84 82 … … 86 84 * Checks if a node contains a string value within a jsx expression 87 85 * @param {ASTNode} node The AST node being checked. 88 * @returns { Boolean} True if the node contains a string value within a jsx expression, false if not.86 * @returns {boolean} True if the node contains a string value within a jsx expression, false if not. 89 87 */ 90 88 function containsStringExpressionContainer(node) { 91 return !!( 92 node.value 89 return !!node.value 93 90 && node.value.type === 'JSXExpressionContainer' 94 91 && node.value.expression 95 92 && ((node.value.expression.type === 'Literal' && typeof node.value.expression.value === 'string') 96 || (node.value.expression.type === 'TemplateLiteral' && detectTemplateLiterals)) 97 ); 93 || (node.value.expression.type === 'TemplateLiteral' && detectTemplateLiterals)); 98 94 } 99 95 100 96 return { 101 97 MemberExpression(node) { 102 if ( isRefsUsage(node)) {98 if (checkRefsUsage && isRefsUsage(node)) { 103 99 report(context, messages.thisRefsDeprecated, 'thisRefsDeprecated', { 104 100 node, … … 106 102 } 107 103 }, 104 108 105 JSXAttribute(node) { 109 106 if ( -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-typos.js
rd565449 r0c6b92a 8 8 const Components = require('../util/Components'); 9 9 const docsUrl = require('../util/docsUrl'); 10 const astUtil = require('../util/ast'); 10 11 const componentUtil = require('../util/componentUtil'); 11 12 const report = require('../util/report'); … … 110 111 ) { // PropTypes.myProp 111 112 checkValidPropType(node.property); 112 } else if ( node.object.type === 'CallExpression') {113 } else if (astUtil.isCallExpression(node.object)) { 113 114 checkValidPropTypeQualifier(node.property); 114 115 checkValidCallExpression(node.object); 115 116 } 116 } else if ( node.type === 'CallExpression') {117 } else if (astUtil.isCallExpression(node)) { 117 118 checkValidCallExpression(node); 118 119 } … … 195 196 if (node.specifiers.length >= 1) { 196 197 const propTypesSpecifier = node.specifiers.find((specifier) => ( 197 specifier.imported && specifier.imported.name === 'PropTypes' 198 specifier.imported 199 && specifier.imported.name === 'PropTypes' 198 200 )); 199 201 if (propTypesSpecifier) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-unescaped-entities.js
rd565449 r0c6b92a 10 10 const jsxUtil = require('../util/jsx'); 11 11 const report = require('../util/report'); 12 const getMessageData = require('../util/message'); 12 13 13 14 // ------------------------------------------------------------------------------ … … 35 36 unescapedEntity: 'HTML entity, `{{entity}}` , must be escaped.', 36 37 unescapedEntityAlts: '`{{entity}}` can be escaped with {{alts}}.', 38 replaceWithAlt: 'Replace with `{{alt}}`.', 37 39 }; 38 40 … … 40 42 module.exports = { 41 43 meta: { 44 hasSuggestions: true, 42 45 docs: { 43 46 description: 'Disallow unescaped HTML entities from appearing in markup', … … 118 121 alts: entities[j].alternatives.map((alt) => `\`${alt}\``).join(', '), 119 122 }, 123 suggest: entities[j].alternatives.map((alt) => Object.assign( 124 getMessageData('replaceWithAlt', messages.replaceWithAlt), 125 { 126 data: { alt }, 127 fix(fixer) { 128 const lineToChange = i - node.loc.start.line; 129 130 const newText = node.raw.split('\n').map((line, idx) => { 131 if (idx === lineToChange) { 132 return line.slice(0, index) + alt + line.slice(index + 1); 133 } 134 135 return line; 136 }).join('\n'); 137 138 return fixer.replaceText(node, newText); 139 }, 140 } 141 )), 120 142 }); 121 143 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-unknown-property.js
rd565449 r0c6b92a 416 416 * Note - these exclusions are not made by React core team, but `eslint-plugin-react` community. 417 417 * 418 * @param { String} name - Attribute name to be normalized419 * @returns { String} Result418 * @param {string} name - Attribute name to be normalized 419 * @returns {string} Result 420 420 */ 421 421 function normalizeAttributeCase(name) { … … 429 429 * then the attribute is a valid data attribute. 430 430 * 431 * @param { String} name - Attribute name to be tested431 * @param {string} name - Attribute name to be tested 432 432 * @returns {boolean} Result 433 433 */ … … 439 439 * Checks if an attribute name has at least one uppercase characters 440 440 * 441 * @param { String} name441 * @param {string} name 442 442 * @returns {boolean} Result 443 443 */ … … 450 450 * of standard aria property names 451 451 * 452 * @param { String} name - Attribute name to be tested453 * @returns { Boolean} Result452 * @param {string} name - Attribute name to be tested 453 * @returns {boolean} Result 454 454 */ 455 455 … … 461 461 * Extracts the tag name for the JSXAttribute 462 462 * @param {JSXAttribute} node - JSXAttribute being tested. 463 * @returns { String|null} tag name463 * @returns {string | null} tag name 464 464 */ 465 465 function getTagName(node) { 466 if (node && node.parent && node.parent.name && node.parent.name) { 466 if ( 467 node 468 && node.parent 469 && node.parent.name 470 ) { 467 471 return node.parent.name.name; 468 472 } … … 474 478 * something like <Foo.bar /> 475 479 * @param {JSXAttribute} node - JSXAttribute being tested. 476 * @returns { Boolean} result480 * @returns {boolean} result 477 481 */ 478 482 function tagNameHasDot(node) { … … 486 490 /** 487 491 * Get the standard name of the attribute. 488 * @param { String} name - Name of the attribute.489 * @param { String} context - eslint context490 * @returns { String | undefined} The standard name of the attribute, or undefined if no standard name was found.492 * @param {string} name - Name of the attribute. 493 * @param {object} context - eslint context 494 * @returns {string | undefined} The standard name of the attribute, or undefined if no standard name was found. 491 495 */ 492 496 function getStandardName(name, context) { … … 513 517 }; 514 518 519 /** @type {import('eslint').Rule.RuleModule} */ 515 520 module.exports = { 516 521 meta: { … … 593 598 594 599 // Some attributes are allowed on some tags only 595 const allowedTags = has(ATTRIBUTE_TAGS_MAP, name) ? ATTRIBUTE_TAGS_MAP[/** @type {keyof ATTRIBUTE_TAGS_MAP} */ (name)] : null; 600 const allowedTags = has(ATTRIBUTE_TAGS_MAP, name) 601 ? ATTRIBUTE_TAGS_MAP[/** @type {keyof ATTRIBUTE_TAGS_MAP} */ (name)] 602 : null; 596 603 if (tagName && allowedTags) { 597 604 // Scenario 1A: Allowed attribute found where not supposed to, report it -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-unsafe.js
rd565449 r0c6b92a 58 58 UNSAFE_componentWillMount: { 59 59 newMethod: 'componentDidMount', 60 details: 61 'See https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html.', 60 details: 'See https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html.', 62 61 }, 63 62 UNSAFE_componentWillReceiveProps: { 64 63 newMethod: 'getDerivedStateFromProps', 65 details: 66 'See https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html.', 64 details: 'See https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html.', 67 65 }, 68 66 UNSAFE_componentWillUpdate: { 69 67 newMethod: 'componentDidUpdate', 70 details: 71 'See https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html.', 68 details: 'See https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html.', 72 69 }, 73 70 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-unstable-nested-components.js
rd565449 r0c6b92a 6 6 'use strict'; 7 7 8 const minimatch = require('minimatch'); 8 9 const Components = require('../util/Components'); 9 10 const docsUrl = require('../util/docsUrl'); 11 const astUtil = require('../util/ast'); 10 12 const isCreateElement = require('../util/isCreateElement'); 11 13 const report = require('../util/report'); … … 24 26 /** 25 27 * Generate error message with given parent component name 26 * @param { String} parentName Name of the parent component, if known27 * @returns { String} Error message with parent component name28 * @param {string} parentName Name of the parent component, if known 29 * @returns {string} Error message with parent component name 28 30 */ 29 31 function generateErrorMessageWithParentName(parentName) { … … 32 34 33 35 /** 34 * Check whether given text starts with `render`. Comparison is case-sensitive. 35 * @param {String} text Text to validate 36 * @returns {Boolean} 37 */ 38 function startsWithRender(text) { 39 return (text || '').startsWith('render'); 36 * Check whether given text matches the pattern passed in. 37 * @param {string} text Text to validate 38 * @param {string} pattern Pattern to match against 39 * @returns {boolean} 40 */ 41 function propMatchesRenderPropPattern(text, pattern) { 42 return typeof text === 'string' && minimatch(text, pattern); 40 43 } 41 44 … … 63 66 * @param {ASTNode} node The AST node 64 67 * @param {Context} context eslint context 65 * @returns { Boolean} True if node is a `createElement` call, false if not68 * @returns {boolean} True if node is a `createElement` call, false if not 66 69 */ 67 70 function isCreateElementMatcher(node, context) { 68 71 return ( 69 node 70 && node.type === 'CallExpression' 72 astUtil.isCallExpression(node) 71 73 && isCreateElement(context, node) 72 74 ); … … 76 78 * Matcher used to check whether given node is a `ObjectExpression` 77 79 * @param {ASTNode} node The AST node 78 * @returns { Boolean} True if node is a `ObjectExpression`, false if not80 * @returns {boolean} True if node is a `ObjectExpression`, false if not 79 81 */ 80 82 function isObjectExpressionMatcher(node) { … … 85 87 * Matcher used to check whether given node is a `JSXExpressionContainer` 86 88 * @param {ASTNode} node The AST node 87 * @returns { Boolean} True if node is a `JSXExpressionContainer`, false if not89 * @returns {boolean} True if node is a `JSXExpressionContainer`, false if not 88 90 */ 89 91 function isJSXExpressionContainerMatcher(node) { … … 94 96 * Matcher used to check whether given node is a `JSXAttribute` of `JSXExpressionContainer` 95 97 * @param {ASTNode} node The AST node 96 * @returns { Boolean} True if node is a `JSXAttribute` of `JSXExpressionContainer`, false if not98 * @returns {boolean} True if node is a `JSXAttribute` of `JSXExpressionContainer`, false if not 97 99 */ 98 100 function isJSXAttributeOfExpressionContainerMatcher(node) { … … 108 110 * Matcher used to check whether given node is an object `Property` 109 111 * @param {ASTNode} node The AST node 110 * @returns { Boolean} True if node is a `Property`, false if not112 * @returns {boolean} True if node is a `Property`, false if not 111 113 */ 112 114 function isPropertyOfObjectExpressionMatcher(node) { … … 116 118 && node.parent.type === 'Property' 117 119 ); 118 }119 120 /**121 * Matcher used to check whether given node is a `CallExpression`122 * @param {ASTNode} node The AST node123 * @returns {Boolean} True if node is a `CallExpression`, false if not124 */125 function isCallExpressionMatcher(node) {126 return node && node.type === 'CallExpression';127 120 } 128 121 … … 133 126 * ``` 134 127 * @param {ASTNode} node The AST node 135 * @returns { Boolean} True if node is directly inside `map` call, false if not128 * @returns {boolean} True if node is directly inside `map` call, false if not 136 129 */ 137 130 function isMapCall(node) { … … 148 141 * @param {ASTNode} node The AST node 149 142 * @param {Context} context eslint context 150 * @returns { Boolean} True if node is a `ReturnStatement` of a React hook, false if not143 * @returns {boolean} True if node is a `ReturnStatement` of a React hook, false if not 151 144 */ 152 145 function isReturnStatementOfHook(node, context) { … … 159 152 } 160 153 161 const callExpression = getClosestMatchingParent(node, context, isCallExpressionMatcher);154 const callExpression = getClosestMatchingParent(node, context, astUtil.isCallExpression); 162 155 return ( 163 156 callExpression … … 175 168 * @param {ASTNode} node The AST node 176 169 * @param {Context} context eslint context 177 * @returns {Boolean} True if component is declared inside a render prop, false if not 178 */ 179 function isComponentInRenderProp(node, context) { 170 * @param {string} propNamePattern a pattern to match render props against 171 * @returns {boolean} True if component is declared inside a render prop, false if not 172 */ 173 function isComponentInRenderProp(node, context, propNamePattern) { 180 174 if ( 181 175 node … … 183 177 && node.parent.type === 'Property' 184 178 && node.parent.key 185 && startsWithRender(node.parent.key.name)179 && propMatchesRenderPropPattern(node.parent.key.name, propNamePattern) 186 180 ) { 187 181 return true; … … 212 206 213 207 // Starts with render, e.g. <Component renderFooter={() => <div />} /> 214 if ( startsWithRender(propName)) {208 if (propMatchesRenderPropPattern(propName, propNamePattern)) { 215 209 return true; 216 210 } … … 232 226 * ``` 233 227 * @param {ASTNode} node The AST node 234 * @returns {Boolean} True if component is declared inside a render property, false if not 235 */ 236 function isDirectValueOfRenderProperty(node) { 228 * @param {string} propNamePattern The pattern to match render props against 229 * @returns {boolean} True if component is declared inside a render property, false if not 230 */ 231 function isDirectValueOfRenderProperty(node, propNamePattern) { 237 232 return ( 238 233 node … … 241 236 && node.parent.key 242 237 && node.parent.key.type === 'Identifier' 243 && startsWithRender(node.parent.key.name)238 && propMatchesRenderPropPattern(node.parent.key.name, propNamePattern) 244 239 ); 245 240 } … … 248 243 * Resolve the component name of given node 249 244 * @param {ASTNode} node The AST node of the component 250 * @returns { String} Name of the component, if any245 * @returns {string} Name of the component, if any 251 246 */ 252 247 function resolveComponentName(node) { … … 287 282 type: 'boolean', 288 283 }, 284 propNamePattern: { 285 type: 'string', 286 }, 289 287 }, 290 288 additionalProperties: false, … … 294 292 create: Components.detect((context, components, utils) => { 295 293 const allowAsProps = context.options.some((option) => option && option.allowAsProps); 294 const propNamePattern = (context.options[0] || {}).propNamePattern || 'render*'; 296 295 297 296 /** … … 304 303 * ``` 305 304 * @param {ASTNode} node The AST node being checked 306 * @returns { Boolean} True if node is inside class component's render block, false if not305 * @returns {boolean} True if node is inside class component's render block, false if not 307 306 */ 308 307 function isInsideRenderMethod(node) { … … 332 331 * ``` 333 332 * @param {ASTNode} node The AST node being checked 334 * @returns { Boolean} True if given node a function component declared inside class component, false if not333 * @returns {boolean} True if given node a function component declared inside class component, false if not 335 334 */ 336 335 function isFunctionComponentInsideClassComponent(node) { … … 355 354 * ``` 356 355 * @param {ASTNode} node The AST node 357 * @returns { Boolean} True if node is declare inside `createElement` call's props, false if not356 * @returns {boolean} True if node is declare inside `createElement` call's props, false if not 358 357 */ 359 358 function isComponentInsideCreateElementsProp(node) { … … 378 377 * ``` 379 378 * @param {ASTNode} node The AST node being checked 380 * @returns { Boolean} True if node is a component declared inside prop, false if not379 * @returns {boolean} True if node is a component declared inside prop, false if not 381 380 */ 382 381 function isComponentInProp(node) { … … 400 399 * ``` 401 400 * @param {ASTNode} node The AST node being checked 402 * @returns { Boolean} True if node is a stateless component returning non-JSX, false if not401 * @returns {boolean} True if node is a stateless component returning non-JSX, false if not 403 402 */ 404 403 function isStatelessComponentReturningNull(node) { … … 428 427 if ( 429 428 // Support allowAsProps option 430 (isDeclaredInsideProps && (allowAsProps || isComponentInRenderProp(node, context )))429 (isDeclaredInsideProps && (allowAsProps || isComponentInRenderProp(node, context, propNamePattern))) 431 430 432 431 // Prevent reporting components created inside Array.map calls … … 438 437 439 438 // Do not mark objects containing render methods 440 || isDirectValueOfRenderProperty(node )439 || isDirectValueOfRenderProperty(node, propNamePattern) 441 440 442 441 // Prevent reporting nested class components twice -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-unused-class-component-methods.js
rd565449 r0c6b92a 99 99 }; 100 100 101 /** @type {import('eslint').Rule.RuleModule} */ 101 102 module.exports = { 102 103 meta: { … … 249 250 .filter((prop) => prop.type === 'Property' && isKeyLiteralLike(prop, prop.key)) 250 251 .forEach((prop) => { 251 addUsedProperty( prop.key);252 addUsedProperty('key' in prop ? prop.key : undefined); 252 253 }); 253 254 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-unused-prop-types.js
rd565449 r0c6b92a 14 14 const docsUrl = require('../util/docsUrl'); 15 15 const report = require('../util/report'); 16 17 /** 18 * Checks if the component must be validated 19 * @param {Object} component The component to process 20 * @returns {boolean} True if the component must be validated, false if not. 21 */ 22 function mustBeValidated(component) { 23 return !!component && !component.ignoreUnusedPropTypesValidation; 24 } 16 25 17 26 // ------------------------------------------------------------------------------ … … 65 74 /** 66 75 * Checks if the prop is ignored 67 * @param { String} name Name of the prop to check.68 * @returns { Boolean} True if the prop is ignored, false if not.76 * @param {string} name Name of the prop to check. 77 * @returns {boolean} True if the prop is ignored, false if not. 69 78 */ 70 79 function isIgnored(name) { … … 73 82 74 83 /** 75 * Checks if the component must be validated76 * @param {Object} component The component to process77 * @returns {Boolean} True if the component must be validated, false if not.78 */79 function mustBeValidated(component) {80 return Boolean(81 component82 && !component.ignoreUnusedPropTypesValidation83 );84 }85 86 /**87 84 * Checks if a prop is used 88 85 * @param {ASTNode} node The AST node being checked. 89 86 * @param {Object} prop Declared prop object 90 * @returns { Boolean} True if the prop is used, false if not.87 * @returns {boolean} True if the prop is used, false if not. 91 88 */ 92 89 function isPropUsed(node, prop) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-unused-state.js
rd565449 r0c6b92a 11 11 12 12 const docsUrl = require('../util/docsUrl'); 13 const ast = require('../util/ast');13 const astUtil = require('../util/ast'); 14 14 const componentUtil = require('../util/componentUtil'); 15 15 const report = require('../util/report'); … … 45 45 46 46 function isThisExpression(node) { 47 return ast .unwrapTSAsExpression(uncast(node)).type === 'ThisExpression';47 return astUtil.unwrapTSAsExpression(uncast(node)).type === 'ThisExpression'; 48 48 } 49 49 … … 66 66 67 67 function isSetStateCall(node) { 68 const unwrappedCalleeNode = ast .unwrapTSAsExpression(node.callee);68 const unwrappedCalleeNode = astUtil.unwrapTSAsExpression(node.callee); 69 69 70 70 return ( … … 79 79 }; 80 80 81 /** @type {import('eslint').Rule.RuleModule} */ 81 82 module.exports = { 82 83 meta: { … … 175 176 // destructures `this.state`. 176 177 function handleStateDestructuring(node) { 177 for (const prop of node.properties){178 node.properties.forEach((prop) => { 178 179 if (prop.type === 'Property') { 179 180 addUsedStateField(prop.key); … … 184 185 classInfo.aliases.add(getName(prop.argument)); 185 186 } 186 } 187 }); 187 188 } 188 189 … … 190 191 // AssignmentExpressions and VariableDeclarators. 191 192 function handleAssignment(left, right) { 192 const unwrappedRight = ast .unwrapTSAsExpression(right);193 const unwrappedRight = astUtil.unwrapTSAsExpression(right); 193 194 194 195 switch (left.type) { … … 202 203 handleStateDestructuring(left); 203 204 } else if (isThisExpression(unwrappedRight) && classInfo.aliases) { 204 for (const prop of left.properties){205 left.properties.forEach((prop) => { 205 206 if (prop.type === 'Property' && getName(prop.key) === 'state') { 206 207 const name = getName(prop.value); … … 211 212 } 212 213 } 213 } 214 }); 214 215 } 215 216 break; … … 221 222 function reportUnusedFields() { 222 223 // Report all unused state fields. 223 for (const node of classInfo.stateFields){224 classInfo.stateFields.forEach((node) => { 224 225 const name = getName(node.key); 225 226 if (!classInfo.usedStateFields.has(name)) { … … 231 232 }); 232 233 } 233 } 234 }); 234 235 } 235 236 … … 293 294 } 294 295 295 const unwrappedNode = ast .unwrapTSAsExpression(node);296 const unwrappedArgumentNode = ast .unwrapTSAsExpression(unwrappedNode.arguments[0]);296 const unwrappedNode = astUtil.unwrapTSAsExpression(node); 297 const unwrappedArgumentNode = astUtil.unwrapTSAsExpression(unwrappedNode.arguments[0]); 297 298 298 299 // If we're looking at a `this.setState({})` invocation, record all the … … 309 310 && unwrappedArgumentNode.type === 'ArrowFunctionExpression' 310 311 ) { 311 const unwrappedBodyNode = ast .unwrapTSAsExpression(unwrappedArgumentNode.body);312 const unwrappedBodyNode = astUtil.unwrapTSAsExpression(unwrappedArgumentNode.body); 312 313 313 314 if (unwrappedBodyNode.type === 'ObjectExpression') { … … 331 332 // If we see state being assigned as a class property using an object 332 333 // expression, record all the fields of that object as state fields. 333 const unwrappedValueNode = ast .unwrapTSAsExpression(node.value);334 const unwrappedValueNode = astUtil.unwrapTSAsExpression(node.value); 334 335 335 336 const name = getName(node.key); … … 432 433 } 433 434 434 if (parent.key.name === 'getInitialState') { 435 if ( 436 'key' in parent 437 && 'name' in parent.key 438 && parent.key.name === 'getInitialState' 439 ) { 435 440 const body = node.body.body; 436 441 const lastBodyNode = body[body.length - 1]; … … 453 458 } 454 459 455 const unwrappedLeft = ast .unwrapTSAsExpression(node.left);456 const unwrappedRight = ast .unwrapTSAsExpression(node.right);460 const unwrappedLeft = astUtil.unwrapTSAsExpression(node.left); 461 const unwrappedRight = astUtil.unwrapTSAsExpression(node.right); 457 462 458 463 // Check for assignments like `this.state = {}` … … 464 469 ) { 465 470 // Find the nearest function expression containing this assignment. 471 /** @type {import("eslint").Rule.Node} */ 466 472 let fn = node; 467 473 while (fn.type !== 'FunctionExpression' && fn.parent) { … … 494 500 return; 495 501 } 496 if (isStateReference(ast .unwrapTSAsExpression(node.object))) {502 if (isStateReference(astUtil.unwrapTSAsExpression(node.object))) { 497 503 // If we see this.state[foo] access, give up. 498 504 if (node.computed && node.property.type !== 'Literal') { … … 503 509 addUsedStateField(node.property); 504 510 // If we see a `this.state` access in a CallExpression, give up. 505 } else if (isStateReference(node) && node.parent.type === 'CallExpression') {511 } else if (isStateReference(node) && astUtil.isCallExpression(node.parent)) { 506 512 classInfo = null; 507 513 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/prefer-exact-props.js
rd565449 r0c6b92a 7 7 const Components = require('../util/Components'); 8 8 const docsUrl = require('../util/docsUrl'); 9 const astUtil = require('../util/ast'); 9 10 const propsUtil = require('../util/props'); 10 11 const propWrapperUtil = require('../util/propWrapper'); … … 82 83 function isNonExactPropWrapperFunction(node) { 83 84 return ( 84 node 85 && node.type === 'CallExpression' 85 astUtil.isCallExpression(node) 86 86 && !propWrapperUtil.isExactPropWrapperFunction(context, getText(context, node.callee)) 87 87 ); -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/prefer-stateless-function.js
rd565449 r0c6b92a 71 71 body.length === 1 72 72 && body[0].type === 'ExpressionStatement' 73 && body[0].expression.type === 'CallExpression'73 && astUtil.isCallExpression(body[0].expression) 74 74 && body[0].expression.callee.type === 'Super' 75 75 ); … … 192 192 * Check if a given AST node have any other properties the ones available in stateless components 193 193 * @param {ASTNode} node The AST node being checked. 194 * @returns { Boolean} True if the node has at least one other property, false if not.194 * @returns {boolean} True if the node has at least one other property, false if not. 195 195 */ 196 196 function hasOtherProperties(node) { … … 355 355 scope = scope.upper; 356 356 } 357 const isRender = blockNode && blockNode.key && blockNode.key.name === 'render'; 357 const isRender = blockNode 358 && blockNode.key 359 && blockNode.key.name === 'render'; 358 360 const allowNull = testReactVersion(context, '>= 15.0.0'); // Stateless components can return null since React 15 359 361 const isReturningJSX = utils.isReturningJSX(node, !allowNull); -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/prop-types.js
rd565449 r0c6b92a 65 65 /** 66 66 * Checks if the prop is ignored 67 * @param { String} name Name of the prop to check.68 * @returns { Boolean} True if the prop is ignored, false if not.67 * @param {string} name Name of the prop to check. 68 * @returns {boolean} True if the prop is ignored, false if not. 69 69 */ 70 70 function isIgnored(name) { … … 90 90 * Internal: Checks if the prop is declared 91 91 * @param {Object} declaredPropTypes Description of propTypes declared in the current component 92 * @param { String[]} keyList Dot separated name of the prop to check.92 * @param {string[]} keyList Dot separated name of the prop to check. 93 93 * @returns {boolean} True if the prop is declared, false if not. 94 94 */ … … 149 149 * Checks if the prop is declared 150 150 * @param {ASTNode} node The AST node being checked. 151 * @param { String[]} names List of names of the prop to check.152 * @returns { Boolean} True if the prop is declared, false if not.151 * @param {string[]} names List of names of the prop to check. 152 * @returns {boolean} True if the prop is declared, false if not. 153 153 */ 154 154 function isDeclaredInComponent(node, names) { … … 191 191 * @param {Object} component The current component to process 192 192 * @param {Array} list The all components to process 193 * @returns { Boolean} True if the component is nested False if not.193 * @returns {boolean} True if the component is nested False if not. 194 194 */ 195 195 function checkNestedComponent(component, list) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/require-optimization.js
rd565449 r0c6b92a 51 51 * Checks to see if our component is decorated by PureRenderMixin via reactMixin 52 52 * @param {ASTNode} node The AST node being checked. 53 * @returns { Boolean} True if node is decorated with a PureRenderMixin, false if not.53 * @returns {boolean} True if node is decorated with a PureRenderMixin, false if not. 54 54 */ 55 55 function hasPureRenderDecorator(node) { … … 78 78 * Checks to see if our component is custom decorated 79 79 * @param {ASTNode} node The AST node being checked. 80 * @returns { Boolean} True if node is decorated name with a custom decorated, false if not.80 * @returns {boolean} True if node is decorated name with a custom decorated, false if not. 81 81 */ 82 82 function hasCustomDecorator(node) { … … 86 86 for (let i = 0; i < allowLength; i++) { 87 87 for (let j = 0, l = node.decorators.length; j < l; j++) { 88 const expression = node.decorators[j].expression; 88 89 if ( 89 node.decorators[j].expression90 && node.decorators[j].expression.name === allowDecorators[i]90 expression 91 && expression.name === allowDecorators[i] 91 92 ) { 92 93 return true; … … 102 103 * Checks if we are declaring a shouldComponentUpdate method 103 104 * @param {ASTNode} node The AST node being checked. 104 * @returns { Boolean} True if we are declaring a shouldComponentUpdate method, false if not.105 * @returns {boolean} True if we are declaring a shouldComponentUpdate method, false if not. 105 106 */ 106 107 function isSCUDeclared(node) { 107 return Boolean( 108 node 109 && node.name === 'shouldComponentUpdate' 110 ); 108 return !!node && node.name === 'shouldComponentUpdate'; 111 109 } 112 110 … … 114 112 * Checks if we are declaring a PureRenderMixin mixin 115 113 * @param {ASTNode} node The AST node being checked. 116 * @returns { Boolean} True if we are declaring a PureRenderMixin method, false if not.114 * @returns {boolean} True if we are declaring a PureRenderMixin method, false if not. 117 115 */ 118 116 function isPureRenderDeclared(node) { … … 127 125 } 128 126 129 return Boolean(130 node127 return ( 128 !!node 131 129 && node.key.name === 'mixins' 132 130 && hasPR -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/self-closing-comp.js
rd565449 r0c6b92a 10 10 const report = require('../util/report'); 11 11 12 const optionDefaults = { component: true, html: true }; 13 14 function isComponent(node) { 15 return ( 16 node.name 17 && (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression') 18 && !jsxUtil.isDOMComponent(node) 19 ); 20 } 21 22 function childrenIsEmpty(node) { 23 return node.parent.children.length === 0; 24 } 25 26 function childrenIsMultilineSpaces(node) { 27 const childrens = node.parent.children; 28 29 return ( 30 childrens.length === 1 31 && (childrens[0].type === 'Literal' || childrens[0].type === 'JSXText') 32 && childrens[0].value.indexOf('\n') !== -1 33 && childrens[0].value.replace(/(?!\xA0)\s/g, '') === '' 34 ); 35 } 36 12 37 // ------------------------------------------------------------------------------ 13 38 // Rule Definition 14 39 // ------------------------------------------------------------------------------ 15 16 const optionDefaults = { component: true, html: true };17 40 18 41 const messages = { … … 50 73 51 74 create(context) { 52 function isComponent(node) {53 return (54 node.name55 && (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression')56 && !jsxUtil.isDOMComponent(node)57 );58 }59 60 function childrenIsEmpty(node) {61 return node.parent.children.length === 0;62 }63 64 function childrenIsMultilineSpaces(node) {65 const childrens = node.parent.children;66 67 return (68 childrens.length === 169 && (childrens[0].type === 'Literal' || childrens[0].type === 'JSXText')70 && childrens[0].value.indexOf('\n') !== -171 && childrens[0].value.replace(/(?!\xA0)\s/g, '') === ''72 );73 }74 75 75 function isShouldBeSelfClosed(node) { 76 76 const configuration = Object.assign({}, optionDefaults, context.options[0]); -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/sort-comp.js
rd565449 r0c6b92a 235 235 * Get properties name 236 236 * @param {Object} node - Property. 237 * @returns { String} Property name.237 * @returns {string} Property name. 238 238 */ 239 239 function getPropertyName(node) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/sort-default-props.js
rd565449 r0c6b92a 23 23 }; 24 24 25 /** @type {import('eslint').Rule.RuleModule} */ 25 26 module.exports = { 26 27 meta: { … … 53 54 * Get properties name 54 55 * @param {Object} node - Property. 55 * @returns { String} Property name.56 * @returns {string} Property name. 56 57 */ 57 58 function getPropertyName(node) { … … 74 75 * Checks if the Identifier node passed in looks like a defaultProps declaration. 75 76 * @param {ASTNode} node The node to check. Must be an Identifier node. 76 * @returns { Boolean} `true` if the node is a defaultProps declaration, `false` if not77 * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not 77 78 */ 78 79 function isDefaultPropsDeclaration(node) { … … 173 174 } 174 175 175 checkNode( node.parent.right);176 checkNode('right' in node.parent && node.parent.right); 176 177 }, 177 178 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/sort-prop-types.js
rd565449 r0c6b92a 5 5 'use strict'; 6 6 7 const astUtil = require('../util/ast'); 7 8 const variableUtil = require('../util/variable'); 8 9 const propsUtil = require('../util/props'); … … 34 35 } 35 36 return getText(context, node.key || node.argument); 36 }37 38 function getValueName(node) {39 return node.type === 'Property' && node.value.property && node.value.property.name;40 }41 42 function isCallbackPropName(propName) {43 return /^on[A-Z]/.test(propName);44 }45 46 function isRequiredProp(node) {47 return getValueName(node) === 'isRequired';48 }49 50 function isShapeProp(node) {51 return Boolean(52 node && node.callee && node.callee.property && node.callee.property.name === 'shape'53 );54 }55 56 function toLowerCase(item) {57 return String(item).toLowerCase();58 37 } 59 38 … … 146 125 let prevPropName = getKey(context, prev); 147 126 let currentPropName = getKey(context, curr); 148 const previousIsRequired = isRequiredProp(prev);149 const currentIsRequired = isRequiredProp(curr);150 const previousIsCallback = isCallbackPropName(prevPropName);151 const currentIsCallback = isCallbackPropName(currentPropName);127 const previousIsRequired = propTypesSortUtil.isRequiredProp(prev); 128 const currentIsRequired = propTypesSortUtil.isRequiredProp(curr); 129 const previousIsCallback = propTypesSortUtil.isCallbackPropName(prevPropName); 130 const currentIsCallback = propTypesSortUtil.isCallbackPropName(currentPropName); 152 131 153 132 if (ignoreCase) { 154 prevPropName = toLowerCase(prevPropName);155 currentPropName = toLowerCase(currentPropName);133 prevPropName = String(prevPropName).toLowerCase(); 134 currentPropName = String(currentPropName).toLowerCase(); 156 135 } 157 136 … … 208 187 209 188 function checkNode(node) { 210 switch (node && node.type) { 211 case 'ObjectExpression': 212 checkSorted(node.properties); 213 break; 214 case 'Identifier': { 215 const propTypesObject = variableUtil.findVariableByName(context, node, node.name); 216 if (propTypesObject && propTypesObject.properties) { 217 checkSorted(propTypesObject.properties); 218 } 219 break; 220 } 221 case 'CallExpression': { 222 const innerNode = node.arguments && node.arguments[0]; 223 if (propWrapperUtil.isPropWrapperFunction(context, node.callee.name) && innerNode) { 224 checkNode(innerNode); 225 } 226 break; 227 } 228 default: 229 break; 189 if (!node) { 190 return; 191 } 192 193 if (node.type === 'ObjectExpression') { 194 checkSorted(node.properties); 195 } else if (node.type === 'Identifier') { 196 const propTypesObject = variableUtil.findVariableByName(context, node, node.name); 197 if (propTypesObject && propTypesObject.properties) { 198 checkSorted(propTypesObject.properties); 199 } 200 } else if (astUtil.isCallExpression(node)) { 201 const innerNode = node.arguments && node.arguments[0]; 202 if (propWrapperUtil.isPropWrapperFunction(context, node.callee.name) && innerNode) { 203 checkNode(innerNode); 204 } 230 205 } 231 206 } … … 261 236 return Object.assign({ 262 237 CallExpression(node) { 263 if (!sortShapeProp || ! isShapeProp(node) || !(node.arguments && node.arguments[0])) {238 if (!sortShapeProp || !propTypesSortUtil.isShapeProp(node) || !(node.arguments && node.arguments[0])) { 264 239 return; 265 240 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/static-property-placement.js
rd565449 r0c6b92a 100 100 * Checks if we are declaring context in class 101 101 * @param {ASTNode} node 102 * @returns { Boolean} True if we are declaring context in class, false if not.102 * @returns {boolean} True if we are declaring context in class, false if not. 103 103 */ 104 104 function isContextInClass(node) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/style-prop-object.js
rd565449 r0c6b92a 19 19 }; 20 20 21 /** @type {import('eslint').Rule.RuleModule} */ 21 22 module.exports = { 22 23 meta: { … … 81 82 && node.arguments.length > 1 82 83 ) { 83 if ( node.arguments[0].name) {84 if ('name' in node.arguments[0] && node.arguments[0].name) { 84 85 // store name of component 85 86 const componentName = node.arguments[0].name; … … 92 93 } 93 94 if (node.arguments[1].type === 'ObjectExpression') { 94 const style = node.arguments[1].properties.find((property) => property.key && property.key.name === 'style' && !property.computed); 95 if (style) { 95 const style = node.arguments[1].properties.find((property) => ( 96 'key' in property 97 && property.key 98 && 'name' in property.key 99 && property.key.name === 'style' 100 && !property.computed 101 )); 102 103 if (style && 'value' in style) { 96 104 if (style.value.type === 'Identifier') { 97 105 checkIdentifiers(style.value); -
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/void-dom-elements-no-children.js
rd565449 r0c6b92a 48 48 const noChildrenInVoidEl = 'Void DOM element <{{element}} /> cannot receive children.'; 49 49 50 /** @type {import('eslint').Rule.RuleModule} */ 50 51 module.exports = { 51 52 meta: { … … 120 121 } 121 122 122 const elementName = args[0].value;123 const elementName = 'value' in args[0] ? args[0].value : undefined; 123 124 124 125 if (!isVoidDOMElement(elementName)) { … … 145 146 146 147 const hasChildrenPropOrDanger = props.some((prop) => { 147 if (! prop.key) {148 if (!('key' in prop) || !prop.key || !('name' in prop.key)) { 148 149 return false; 149 150 } -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/Components.js
rd565449 r0c6b92a 71 71 * 72 72 * @param {ASTNode} node The AST node being added. 73 * @param { Number} confidence Confidence in the component detection (0=banned, 1=maybe, 2=yes)73 * @param {number} confidence Confidence in the component detection (0=banned, 1=maybe, 2=yes) 74 74 * @returns {Object} Added component object 75 75 */ … … 184 184 * Components for which we are not confident are not counted 185 185 * 186 * @returns { Number} Components list length186 * @returns {number} Components list length 187 187 */ 188 188 length() { … … 304 304 305 305 /** 306 * @param {ASTNode} ASTNode306 * @param {ASTNode} node 307 307 * @param {boolean=} strict 308 308 * @returns {boolean} 309 309 */ 310 isReturningJSX( ASTNode, strict) {311 return jsxUtil.isReturningJSX(context, ASTNode, strict, true);312 }, 313 314 isReturningJSXOrNull( ASTNode, strict) {315 return jsxUtil.isReturningJSX(context, ASTNode, strict);316 }, 317 318 isReturningOnlyNull( ASTNode) {319 return jsxUtil.isReturningOnlyNull( ASTNode, context);310 isReturningJSX(node, strict) { 311 return jsxUtil.isReturningJSX(context, node, strict, true); 312 }, 313 314 isReturningJSXOrNull(node, strict) { 315 return jsxUtil.isReturningJSX(context, node, strict); 316 }, 317 318 isReturningOnlyNull(node) { 319 return jsxUtil.isReturningOnlyNull(node, context); 320 320 }, 321 321 … … 408 408 409 409 isPragmaComponentWrapper(node) { 410 if (! node || node.type !== 'CallExpression') {410 if (!astUtil.isCallExpression(node)) { 411 411 return false; 412 412 } … … 568 568 569 569 // for case abc = { [someobject.somekey]: props => { ... return not-jsx } } 570 if (node.parent && node.parent.key && node.parent.key.type === 'MemberExpression' && !utils.isReturningJSX(node) && !utils.isReturningOnlyNull(node)) { 570 if ( 571 node.parent 572 && node.parent.key 573 && node.parent.key.type === 'MemberExpression' 574 && !utils.isReturningJSX(node) 575 && !utils.isReturningOnlyNull(node) 576 ) { 571 577 return undefined; 572 578 } … … 578 584 ) 579 585 ) { 580 if (isFirstLetterCapitalized(node.parent.key.name) && utils.isReturningJSX(node)) { 586 if ( 587 isFirstLetterCapitalized(node.parent.key.name) 588 && utils.isReturningJSX(node) 589 ) { 581 590 return node; 582 591 } … … 642 651 * 643 652 * @param {ASTNode} node The AST node being checked (must be a MemberExpression). 644 * @returns {ASTNode } component node, null if we cannot find the component653 * @returns {ASTNode | null} component node, null if we cannot find the component 645 654 */ 646 655 getRelatedComponent(node) { … … 752 761 * @param {ASTNode} node The AST node being searched. (expects CallExpression) 753 762 * @param {('useCallback'|'useContext'|'useDebugValue'|'useEffect'|'useImperativeHandle'|'useLayoutEffect'|'useMemo'|'useReducer'|'useRef'|'useState')[]} [expectedHookNames] React hook names to which search is limited. 754 * @returns { Boolean} True if the node is a call to a React hook763 * @returns {boolean} True if the node is a call to a React hook 755 764 */ 756 765 isReactHookCall(node, expectedHookNames) { 757 if ( node.type !== 'CallExpression') {766 if (!astUtil.isCallExpression(node)) { 758 767 return false; 759 768 } … … 799 808 800 809 const hookResolvedDefs = potentialHookReference && potentialHookReference.resolved.defs; 801 const localHookName = (isPotentialReactHookCall && node.callee.property.name) 802 || (isPotentialHookCall && potentialHookReference && node.callee.name); 810 const localHookName = ( 811 isPotentialReactHookCall 812 && node.callee.property.name 813 ) || ( 814 isPotentialHookCall 815 && potentialHookReference 816 && node.callee.name 817 ); 803 818 const isHookShadowed = isPotentialHookCall 804 819 && hookResolvedDefs … … 877 892 } 878 893 879 node = utils.getStatelessComponent(node);880 if (! node) {881 return; 882 } 883 components.add( node, 2);894 const cNode = utils.getStatelessComponent(node); 895 if (!cNode) { 896 return; 897 } 898 components.add(cNode, 2); 884 899 }, 885 900 -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/annotations.js
rd565449 r0c6b92a 13 13 * @param {ASTNode} node The AST node being checked. 14 14 * @param {Object} context 15 * @returns { Boolean} True if the node is a type annotated props declaration, false if not.15 * @returns {boolean} True if the node is a type annotated props declaration, false if not. 16 16 */ 17 17 function isAnnotatedFunctionPropsDeclaration(node, context) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/ast.js
rd565449 r0c6b92a 93 93 94 94 /* TODO: properly warn on React.forwardRefs having typo properties 95 if ( nodeType === 'CallExpression') {95 if (astUtil.isCallExpression(ASTNode)) { 96 96 const callee = ASTNode.callee; 97 97 const pragma = pragmaUtil.getFromContext(context); … … 149 149 */ 150 150 function getPropertyNameNode(node) { 151 if (node.key || ['MethodDefinition', 'Property'].indexOf(node.type) !== -1) { 151 if ( 152 node.key 153 || node.type === 'MethodDefinition' 154 || node.type === 'Property' 155 ) { 152 156 return node.key; 153 157 } … … 161 165 * Get properties name 162 166 * @param {Object} node - Property. 163 * @returns { String} Property name.167 * @returns {string} Property name. 164 168 */ 165 169 function getPropertyName(node) { … … 211 215 * @param {Object} context The node to check 212 216 * @param {ASTNode} node The node to check 213 * @return { Boolean} true if it's the first node in its line217 * @return {boolean} true if it's the first node in its line 214 218 */ 215 219 function isNodeFirstInLine(context, node) { … … 223 227 * Checks if the node is a function or arrow function expression. 224 228 * @param {ASTNode} node The node to check 225 * @return { Boolean} true if it's a function-like expression229 * @return {boolean} true if it's a function-like expression 226 230 */ 227 231 function isFunctionLikeExpression(node) { … … 232 236 * Checks if the node is a function. 233 237 * @param {ASTNode} node The node to check 234 * @return { Boolean} true if it's a function238 * @return {boolean} true if it's a function 235 239 */ 236 240 function isFunction(node) { … … 241 245 * Checks if node is a function declaration or expression or arrow function. 242 246 * @param {ASTNode} node The node to check 243 * @return { Boolean} true if it's a function-like247 * @return {boolean} true if it's a function-like 244 248 */ 245 249 function isFunctionLike(node) { … … 250 254 * Checks if the node is a class. 251 255 * @param {ASTNode} node The node to check 252 * @return { Boolean} true if it's a class256 * @return {boolean} true if it's a class 253 257 */ 254 258 function isClass(node) { … … 330 334 * Checks if a node is being assigned a value: props.bar = 'bar' 331 335 * @param {ASTNode} node The AST node being checked. 332 * @returns { Boolean}336 * @returns {boolean} 333 337 */ 334 338 function isAssignmentLHS(node) { … … 340 344 } 341 345 346 function isTSAsExpression(node) { 347 return node && node.type === 'TSAsExpression'; 348 } 349 350 /** 351 * Matcher used to check whether given node is a `CallExpression` 352 * @param {ASTNode} node The AST node 353 * @returns {boolean} True if node is a `CallExpression`, false if not 354 */ 355 function isCallExpression(node) { 356 return node && node.type === 'CallExpression'; 357 } 358 342 359 /** 343 360 * Extracts the expression node that is wrapped inside a TS type assertion … … 347 364 */ 348 365 function unwrapTSAsExpression(node) { 349 if (node && node.type === 'TSAsExpression') return node.expression; 350 return node; 366 return isTSAsExpression(node) ? node.expression : node; 351 367 } 352 368 353 369 function isTSTypeReference(node) { 354 370 if (!node) return false; 355 const nodeType = node.type; 356 return node Type === 'TSTypeReference';371 372 return node.type === 'TSTypeReference'; 357 373 } 358 374 359 375 function isTSTypeAnnotation(node) { 360 if (!node) return false;361 const nodeType = node.type; 362 return node Type === 'TSTypeAnnotation';376 if (!node) { return false; } 377 378 return node.type === 'TSTypeAnnotation'; 363 379 } 364 380 365 381 function isTSTypeLiteral(node) { 366 if (!node) return false;367 const nodeType = node.type; 368 return node Type === 'TSTypeLiteral';382 if (!node) { return false; } 383 384 return node.type === 'TSTypeLiteral'; 369 385 } 370 386 371 387 function isTSIntersectionType(node) { 372 if (!node) return false;373 const nodeType = node.type; 374 return node Type === 'TSIntersectionType';388 if (!node) { return false; } 389 390 return node.type === 'TSIntersectionType'; 375 391 } 376 392 377 393 function isTSInterfaceHeritage(node) { 378 if (!node) return false;379 const nodeType = node.type; 380 return node Type === 'TSInterfaceHeritage';394 if (!node) { return false; } 395 396 return node.type === 'TSInterfaceHeritage'; 381 397 } 382 398 383 399 function isTSInterfaceDeclaration(node) { 384 if (!node) return false; 385 let nodeType = node.type; 400 if (!node) { return false; } 401 402 return (node.type === 'ExportNamedDeclaration' && node.declaration 403 ? node.declaration.type 404 : node.type 405 ) === 'TSInterfaceDeclaration'; 406 } 407 408 function isTSTypeDeclaration(node) { 409 if (!node) { return false; } 410 411 const nodeToCheck = node.type === 'ExportNamedDeclaration' && node.declaration 412 ? node.declaration 413 : node; 414 415 return nodeToCheck.type === 'VariableDeclaration' && nodeToCheck.kind === 'type'; 416 } 417 418 function isTSTypeAliasDeclaration(node) { 419 if (!node) { return false; } 420 386 421 if (node.type === 'ExportNamedDeclaration' && node.declaration) { 387 nodeType = node.declaration.type; 388 } 389 return nodeType === 'TSInterfaceDeclaration'; 390 } 391 392 function isTSTypeDeclaration(node) { 393 if (!node) return false; 394 let nodeType = node.type; 395 let nodeKind = node.kind; 396 if (node.type === 'ExportNamedDeclaration' && node.declaration) { 397 nodeType = node.declaration.type; 398 nodeKind = node.declaration.kind; 399 } 400 return nodeType === 'VariableDeclaration' && nodeKind === 'type'; 401 } 402 403 function isTSTypeAliasDeclaration(node) { 404 if (!node) return false; 405 let nodeType = node.type; 406 if (node.type === 'ExportNamedDeclaration' && node.declaration) { 407 nodeType = node.declaration.type; 408 return nodeType === 'TSTypeAliasDeclaration' && node.exportKind === 'type'; 409 } 410 return nodeType === 'TSTypeAliasDeclaration'; 422 return node.declaration.type === 'TSTypeAliasDeclaration' && node.exportKind === 'type'; 423 } 424 return node.type === 'TSTypeAliasDeclaration'; 411 425 } 412 426 413 427 function isTSParenthesizedType(node) { 414 if (!node) return false;415 const nodeType = node.type; 416 return node Type === 'TSTypeAliasDeclaration';428 if (!node) { return false; } 429 430 return node.type === 'TSTypeAliasDeclaration'; 417 431 } 418 432 419 433 function isTSFunctionType(node) { 420 if (!node) return false;421 const nodeType = node.type; 422 return node Type === 'TSFunctionType';434 if (!node) { return false; } 435 436 return node.type === 'TSFunctionType'; 423 437 } 424 438 425 439 function isTSTypeQuery(node) { 426 if (!node) return false;427 const nodeType = node.type; 428 return node Type === 'TSTypeQuery';440 if (!node) { return false; } 441 442 return node.type === 'TSTypeQuery'; 429 443 } 430 444 431 445 function isTSTypeParameterInstantiation(node) { 432 if (!node) return false;433 const nodeType = node.type; 434 return node Type === 'TSTypeParameterInstantiation';446 if (!node) { return false; } 447 448 return node.type === 'TSTypeParameterInstantiation'; 435 449 } 436 450 437 451 module.exports = { 438 traverse,439 452 findReturnStatement, 453 getComponentProperties, 440 454 getFirstNodeInLine, 455 getKeyValue, 441 456 getPropertyName, 442 457 getPropertyNameNode, 443 getComponentProperties, 444 getKeyValue, 445 isParenthesized, 458 inConstructor, 446 459 isAssignmentLHS, 460 isCallExpression, 447 461 isClass, 448 462 isFunction, 463 isFunctionLike, 449 464 isFunctionLikeExpression, 450 isFunctionLike,451 inConstructor,452 465 isNodeFirstInLine, 466 isParenthesized, 467 isTSAsExpression, 468 isTSFunctionType, 469 isTSInterfaceDeclaration, 470 isTSInterfaceHeritage, 471 isTSIntersectionType, 472 isTSParenthesizedType, 473 isTSTypeAliasDeclaration, 474 isTSTypeAnnotation, 475 isTSTypeDeclaration, 476 isTSTypeLiteral, 477 isTSTypeParameterInstantiation, 478 isTSTypeQuery, 479 isTSTypeReference, 480 traverse, 481 traverseReturns, 453 482 unwrapTSAsExpression, 454 traverseReturns,455 isTSTypeReference,456 isTSTypeAnnotation,457 isTSTypeLiteral,458 isTSIntersectionType,459 isTSInterfaceHeritage,460 isTSInterfaceDeclaration,461 isTSTypeAliasDeclaration,462 isTSParenthesizedType,463 isTSFunctionType,464 isTSTypeQuery,465 isTSTypeParameterInstantiation,466 isTSTypeDeclaration,467 483 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/componentUtil.js
rd565449 r0c6b92a 175 175 */ 176 176 function isStateMemberExpression(node) { 177 return node.type === 'MemberExpression' && node.object.type === 'ThisExpression' && node.property.name === 'state'; 177 return node.type === 'MemberExpression' 178 && node.object.type === 'ThisExpression' 179 && node.property.name === 'state'; 178 180 } 179 181 -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/defaultProps.js
rd565449 r0c6b92a 27 27 } 28 28 if ( 29 node.type === 'CallExpression'29 astUtil.isCallExpression(node) 30 30 && propWrapperUtil.isPropWrapperFunction(context, node.callee.name) 31 31 && node.arguments && node.arguments[0] -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/error.js
rd565449 r0c6b92a 3 3 /** 4 4 * Logs out a message if there is no format option set. 5 * @param { String} message - Message to log.5 * @param {string} message - Message to log. 6 6 */ 7 7 function error(message) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/isCreateContext.js
rd565449 r0c6b92a 1 1 'use strict'; 2 3 const astUtil = require('./ast'); 2 4 3 5 /** 4 6 * Checks if the node is a React.createContext call 5 7 * @param {ASTNode} node - The AST node being checked. 6 * @returns { Boolean} - True if node is a React.createContext call, false if not.8 * @returns {boolean} - True if node is a React.createContext call, false if not. 7 9 */ 8 10 module.exports = function isCreateContext(node) { 9 11 if ( 10 12 node.init 11 && node.init.type === 'CallExpression'12 13 && node.init.callee 13 && node.init.callee.name === 'createContext'14 14 ) { 15 return true; 16 } 15 if ( 16 astUtil.isCallExpression(node.init) 17 && node.init.callee.name === 'createContext' 18 ) { 19 return true; 20 } 17 21 18 if ( 19 node.init 20 && node.init.callee 21 && node.init.callee.type === 'MemberExpression' 22 && node.init.callee.property 23 && node.init.callee.property.name === 'createContext' 24 ) { 25 return true; 22 if ( 23 node.init.callee.type === 'MemberExpression' 24 && node.init.callee.property 25 && node.init.callee.property.name === 'createContext' 26 ) { 27 return true; 28 } 26 29 } 27 30 … … 30 33 && node.expression.type === 'AssignmentExpression' 31 34 && node.expression.operator === '=' 32 && node.expression.right.type === 'CallExpression'35 && astUtil.isCallExpression(node.expression.right) 33 36 && node.expression.right.callee 34 && node.expression.right.callee.name === 'createContext'35 37 ) { 36 return true; 37 } 38 const right = node.expression.right; 38 39 39 if (40 node.expression41 && node.expression.type === 'AssignmentExpression'42 && node.expression.operator === '=' 43 && node.expression.right.type === 'CallExpression'44 && node.expression.right.callee45 && node.expression.right.callee.type === 'MemberExpression'46 && node.expression.right.callee.property47 && node.expression.right.callee.property.name === 'createContext'48 ) {49 return true;40 if (right.callee.name === 'createContext') { 41 return true; 42 } 43 44 if ( 45 right.callee.type === 'MemberExpression' 46 && right.callee.property 47 && right.callee.property.name === 'createContext' 48 ) { 49 return true; 50 } 50 51 } 51 52 -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/isCreateElement.js
rd565449 r0c6b92a 11 11 */ 12 12 module.exports = function isCreateElement(context, node) { 13 if (!node.callee) { 14 return false; 15 } 16 13 17 if ( 14 node.callee 15 && node.callee.type === 'MemberExpression' 18 node.callee.type === 'MemberExpression' 16 19 && node.callee.property.name === 'createElement' 17 20 && node.callee.object … … 22 25 23 26 if ( 24 node 25 && node.callee 26 && node.callee.name === 'createElement' 27 node.callee.name === 'createElement' 27 28 && isDestructuredFromPragmaImport(context, node, 'createElement') 28 29 ) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/isDestructuredFromPragmaImport.js
rd565449 r0c6b92a 1 1 'use strict'; 2 2 3 const astUtil = require('./ast'); 3 4 const pragmaUtil = require('./pragma'); 4 5 const variableUtil = require('./variable'); … … 23 24 if ( 24 25 latestDef.node.init.type === 'MemberExpression' 25 26 26 && latestDef.node.init.object.type === 'Identifier' 27 && latestDef.node.init.object.name === pragma 27 28 ) { 28 29 return true; … … 31 32 if ( 32 33 latestDef.node.init.type === 'Identifier' 33 34 && latestDef.node.init.name === pragma 34 35 ) { 35 36 return true; … … 40 41 41 42 // get "require('react')" from: "{variable} = require('react')" 42 if ( latestDef.node.init.type === 'CallExpression') {43 if (astUtil.isCallExpression(latestDef.node.init)) { 43 44 requireExpression = latestDef.node.init; 44 45 } … … 46 47 if ( 47 48 !requireExpression 48 49 && latestDef.node.init.object.type === 'CallExpression'49 && latestDef.node.init.type === 'MemberExpression' 50 && astUtil.isCallExpression(latestDef.node.init.object) 50 51 ) { 51 52 requireExpression = latestDef.node.init.object; … … 55 56 if ( 56 57 requireExpression 57 58 59 60 58 && requireExpression.callee 59 && requireExpression.callee.name === 'require' 60 && requireExpression.arguments[0] 61 && requireExpression.arguments[0].value === pragma.toLocaleLowerCase() 61 62 ) { 62 63 return true; … … 69 70 if ( 70 71 latestDef.parent 71 72 72 && latestDef.parent.type === 'ImportDeclaration' 73 && latestDef.parent.source.value === pragma.toLocaleLowerCase() 73 74 ) { 74 75 return true; -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/isFirstLetterCapitalized.js
rd565449 r0c6b92a 3 3 /** 4 4 * Check if the first letter of a string is capitalized. 5 * @param { String} word String to check6 * @returns { Boolean} True if first letter is capitalized.5 * @param {string} word String to check 6 * @returns {boolean} True if first letter is capitalized. 7 7 */ 8 function isFirstLetterCapitalized(word) {8 module.exports = function isFirstLetterCapitalized(word) { 9 9 if (!word) { 10 10 return false; … … 12 12 const firstLetter = word.replace(/^_+/, '').charAt(0); 13 13 return firstLetter.toUpperCase() === firstLetter; 14 } 15 16 module.exports = isFirstLetterCapitalized; 14 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/jsx.js
rd565449 r0c6b92a 77 77 /** 78 78 * Check if value has only whitespaces 79 * @param { string} value79 * @param {unknown} value 80 80 * @returns {boolean} 81 81 */ … … 89 89 * @param {Context} context The context of `ASTNode`. 90 90 * @param {ASTNode} ASTnode The AST node being checked 91 * @param { Boolean} [strict] If true, in a ternary condition the node must return JSX in both cases92 * @param { Boolean} [ignoreNull] If true, null return values will be ignored93 * @returns { Boolean} True if the node is returning JSX or null, false if not91 * @param {boolean} [strict] If true, in a ternary condition the node must return JSX in both cases 92 * @param {boolean} [ignoreNull] If true, null return values will be ignored 93 * @returns {boolean} True if the node is returning JSX or null, false if not 94 94 */ 95 95 function isReturningJSX(context, ASTnode, strict, ignoreNull) { … … 146 146 * @param {ASTNode} ASTnode The AST node being checked 147 147 * @param {Context} context The context of `ASTNode`. 148 * @returns { Boolean} True if the node is returning only null values148 * @returns {boolean} True if the node is returning only null values 149 149 */ 150 150 function isReturningOnlyNull(ASTnode, context) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/log.js
rd565449 r0c6b92a 3 3 /** 4 4 * Logs out a message if there is no format option set. 5 * @param { String} message - Message to log.5 * @param {string} message - Message to log. 6 6 */ 7 7 function log(message) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/makeNoMethodSetStateRule.js
rd565449 r0c6b92a 45 45 } 46 46 47 // eslint-disable-next-line valid-jsdoc 48 /** 49 * @param {string} methodName 50 * @param {(context: import('eslint').Rule.RuleContext) => boolean} [shouldCheckUnsafeCb] 51 * @returns {import('eslint').Rule.RuleModule} 52 */ 47 53 module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafeCb) { 48 54 return { … … 91 97 callee.type !== 'MemberExpression' 92 98 || callee.object.type !== 'ThisExpression' 99 || !('name' in callee.property) 93 100 || callee.property.name !== 'setState' 94 101 ) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/pragma.js
rd565449 r0c6b92a 63 63 64 64 if (!JS_IDENTIFIER_REGEX.test(pragma)) { 65 throw new Error(`React pragma ${pragma} is not a valid identifier`); 65 console.warn(`React pragma ${pragma} is not a valid identifier`); 66 return 'React'; 66 67 } 67 68 return pragma; -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/propTypes.js
rd565449 r0c6b92a 24 24 * Check if node is function type. 25 25 * @param {ASTNode} node 26 * @returns { Boolean}26 * @returns {boolean} 27 27 */ 28 28 function isFunctionType(node) { … … 38 38 * 39 39 * @param {ASTNode} node the AST node being checked. 40 * @returns { Boolean} True if the node is a class with generic prop types, false if not.40 * @returns {boolean} True if the node is a class with generic prop types, false if not. 41 41 */ 42 42 function isSuperTypeParameterPropsDeclaration(node) { 43 43 if (node && (node.type === 'ClassDeclaration' || node.type === 'ClassExpression')) { 44 if (node.superTypeParameters && node.superTypeParameters.params.length > 0) { 44 const parameters = propsUtil.getSuperTypeArguments(node); 45 if (parameters && parameters.params.length > 0) { 45 46 return true; 46 47 } … … 77 78 * Checks if a node is inside a class body. 78 79 * 79 * @param {ASTNode} node 80 * @returns { Boolean} True if the node has a ClassBody ancestor, false if not.80 * @param {ASTNode} node the AST node being checked. 81 * @returns {boolean} True if the node has a ClassBody ancestor, false if not. 81 82 */ 82 83 function isInsideClassBody(node) { … … 153 154 /** 154 155 * Checks if prop should be validated by plugin-react-proptypes 155 * @param { String} validator Name of validator to check.156 * @returns { Boolean} True if validator should be checked by custom validator.156 * @param {string} validator Name of validator to check. 157 * @returns {boolean} True if validator should be checked by custom validator. 157 158 */ 158 159 function hasCustomValidator(validator) { … … 173 174 let containsUnresolvedObjectTypeSpread = false; 174 175 let containsSpread = false; 175 const containsIndexers = Boolean(annotation.indexers && annotation.indexers.length);176 const containsIndexers = !!annotation.indexers && annotation.indexers.length > 0; 176 177 const shapeTypeDefinition = { 177 178 type: 'shape', … … 268 269 * The representation is used to verify nested used properties. 269 270 * @param {ASTNode} annotation Type annotation for the props class property. 270 * @param { String} parentName271 * @param {string} parentName 271 272 * @param {Set<ASTNode>} [seen] 272 273 * @return {Object} The representation of the declaration, empty object means … … 297 298 * @param {ASTNode} propTypes 298 299 * @param {Object} declaredPropTypes 299 * @returns { Boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported)300 * @returns {boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported) 300 301 */ 301 302 function declarePropTypesForObjectTypeAnnotation(propTypes, declaredPropTypes) { … … 335 336 * @param {ASTNode} propTypes 336 337 * @param {Object} declaredPropTypes 337 * @returns { Boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported)338 * @returns {boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported) 338 339 */ 339 340 function declarePropTypesForIntersectionTypeAnnotation(propTypes, declaredPropTypes) { … … 428 429 && value.type === 'MemberExpression' 429 430 && value.property 430 && value.property.name431 431 && value.property.name === 'isRequired' 432 432 ) { … … 448 448 // Verify PropTypes that are functions 449 449 if ( 450 value 451 && value.type === 'CallExpression' 450 astUtil.isCallExpression(value) 452 451 && value.callee 453 452 && value.callee.property … … 498 497 if ( 499 498 !argument.elements 500 || !argument.elements.length499 || argument.elements.length === 0 501 500 ) { 502 501 // Invalid proptype or cannot analyse statically … … 577 576 function filterInterfaceOrAliasByName(node, typeName) { 578 577 return ( 579 (node.id && node.id.name === typeName) 580 || (node.declaration && node.declaration.id && node.declaration.id.name === typeName) 578 node.id 579 && node.id.name === typeName 580 ) || ( 581 node.declaration 582 && node.declaration.id 583 && node.declaration.id.name === typeName 581 584 ); 582 585 } … … 638 641 const leftMostName = getLeftMostTypeName(node.typeName); 639 642 const shouldTraverseTypeParams = genericReactTypesImport.has(leftMostName); 640 const nodeType Params = node.typeParameters;641 if (shouldTraverseTypeParams && nodeType Params && nodeTypeParams.length !== 0) {643 const nodeTypeArguments = propsUtil.getTypeArguments(node); 644 if (shouldTraverseTypeParams && nodeTypeArguments && nodeTypeArguments.length !== 0) { 642 645 // All react Generic types are derived from: 643 646 // type PropsWithChildren<P> = P & { children?: ReactNode | undefined } … … 661 664 leftMostName !== rightMostName ? rightMostName : importedName 662 665 ]; 663 const nextNode = nodeType Params.params[idx];666 const nextNode = nodeTypeArguments.params[idx]; 664 667 this.visitTSNode(nextNode); 665 668 return; … … 696 699 const declarations = flatMap( 697 700 candidateTypes, 698 (type) => type.declarations || (type.declaration && type.declaration.declarations) || type.declaration); 701 (type) => ( 702 type.declarations 703 || ( 704 type.declaration 705 && type.declaration.declarations 706 ) 707 || type.declaration 708 ) 709 ); 699 710 700 711 // we tried to find either an interface or a type with the TypeReference name … … 750 761 convertReturnTypeToPropTypes(node, rootNode) { 751 762 // ReturnType<T> should always have one parameter 752 const nodeType Params = node.typeParameters;753 if (nodeType Params) {754 if (nodeType Params.params.length === 1) {755 let returnType = nodeType Params.params[0];763 const nodeTypeArguments = propsUtil.getTypeArguments(node); 764 if (nodeTypeArguments) { 765 if (nodeTypeArguments.params.length === 1) { 766 let returnType = nodeTypeArguments.params[0]; 756 767 // This line is trying to handle typescript-eslint-parser 757 768 // typescript-eslint-parser TSTypeQuery is wrapped by TSTypeReference … … 784 795 case 'ObjectExpression': 785 796 iterateProperties(context, res.properties, (key, value, propNode) => { 786 if (propNode && propNode.argument && propNode.argument.type === 'CallExpression') {787 const propNodeType Params = propNode.argument.typeParameters;788 if (propNodeType Params) {789 this.visitTSNode(propNodeType Params);797 if (propNode && astUtil.isCallExpression(propNode.argument)) { 798 const propNodeTypeArguments = propsUtil.getTypeArguments(propNode.argument); 799 if (propNodeTypeArguments) { 800 this.visitTSNode(propNodeTypeArguments); 790 801 } else { 791 802 // Ignore this CallExpression return value since it doesn't have any typeParameters to let us know it's types. … … 807 818 break; 808 819 case 'CallExpression': 809 if ( res.typeParameters) {810 this.visitTSNode( res.typeParameters);820 if (propsUtil.getTypeArguments(res)) { 821 this.visitTSNode(propsUtil.getTypeArguments(res)); 811 822 } else { 812 823 // Ignore this CallExpression return value since it doesn't have any typeParameters to let us know it's types. … … 993 1004 case 'GenericTypeAnnotation': 994 1005 if (propTypes.id.name === '$ReadOnly') { 995 const propType Params = propTypes.typeParameters;1006 const propTypeArguments = propsUtil.getTypeArguments(propTypes); 996 1007 ignorePropsValidation = declarePropTypesForObjectTypeAnnotation( 997 propType Params.params[0],1008 propTypeArguments.params[0], 998 1009 declaredPropTypes 999 1010 ); … … 1032 1043 } 1033 1044 1045 let propTypesArguments = null; 1046 if (node.parent) { 1047 propTypesArguments = propsUtil.getTypeArguments(node.parent); 1048 } 1049 1034 1050 if ( 1035 1051 node.parent 1036 1052 && node.parent.callee 1037 && node.parent.typeParameters1038 && node.parent.typeParameters.params1053 && propTypesArguments 1054 && propTypesArguments.params 1039 1055 && ( 1040 1056 node.parent.callee.name === 'forwardRef' || ( … … 1046 1062 ) 1047 1063 ) { 1048 const propTypesParams = node.parent.typeParameters;1049 1064 const declaredPropTypes = {}; 1050 const obj = new DeclarePropTypesForTSTypeAnnotation(propTypes Params.params[1], declaredPropTypes, rootNode);1065 const obj = new DeclarePropTypesForTSTypeAnnotation(propTypesArguments.params[1], declaredPropTypes, rootNode); 1051 1066 components.set(node, { 1052 1067 declaredPropTypes: obj.declaredPropTypes, … … 1094 1109 annotation 1095 1110 && annotation.type !== 'TSTypeReference' 1096 && annotation.typeParameters== null1111 && propsUtil.getTypeArguments(annotation) == null 1097 1112 ) { 1098 1113 return; … … 1106 1121 1107 1122 /** 1108 * Resolve the type annotation for a given class declaration node with superTypeParameters.1123 * Resolve the type annotation for a given class declaration node. 1109 1124 * 1110 1125 * @param {ASTNode} node The annotation or a node containing the type annotation. … … 1113 1128 function resolveSuperParameterPropsType(node) { 1114 1129 let propsParameterPosition; 1130 const parameters = propsUtil.getSuperTypeArguments(node); 1131 1115 1132 try { 1116 1133 // Flow <=0.52 had 3 required TypedParameters of which the second one is the Props. … … 1119 1136 } catch (e) { 1120 1137 // In case there is no flow version defined, we can safely assume that when there are 3 Props we are dealing with version <= 0.52 1121 propsParameterPosition = node.superTypeParameters.params.length <= 2 ? 0 : 1;1122 } 1123 1124 let annotation = node.superTypeParameters.params[propsParameterPosition];1138 propsParameterPosition = parameters.params.length <= 2 ? 0 : 1; 1139 } 1140 1141 let annotation = parameters.params[propsParameterPosition]; 1125 1142 while (annotation && (annotation.type === 'TypeAnnotation' || annotation.type === 'NullableTypeAnnotation')) { 1126 1143 annotation = annotation.typeAnnotation; … … 1136 1153 * Checks if we are declaring a `props` class property with a flow type annotation. 1137 1154 * @param {ASTNode} node The AST node being checked. 1138 * @returns { Boolean} True if the node is a type annotated props declaration, false if not.1155 * @returns {boolean} True if the node is a type annotated props declaration, false if not. 1139 1156 */ 1140 1157 function isAnnotatedClassPropsDeclaration(node) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/propTypesSort.js
rd565449 r0c6b92a 17 17 * 18 18 * @param {ASTNode} node the node to check. 19 * @returns { String} The name of the node.19 * @returns {string} The name of the node. 20 20 */ 21 21 function getValueName(node) { 22 return node.type === 'Property' && node.value.property && node.value.property.name; 22 return node.type === 'Property' 23 && node.value.property 24 && node.value.property.name; 23 25 } 24 26 … … 27 29 * 28 30 * @param {ASTNode} node the prop to check. 29 * @returns { Boolean} true if the prop is required.31 * @returns {boolean} true if the prop is required. 30 32 */ 31 33 function isRequiredProp(node) { … … 36 38 * Checks if the proptype is a callback by checking if it starts with 'on'. 37 39 * 38 * @param { String} propName the name of the proptype to check.39 * @returns { Boolean} true if the proptype is a callback.40 * @param {string} propName the name of the proptype to check. 41 * @returns {boolean} true if the proptype is a callback. 40 42 */ 41 43 function isCallbackPropName(propName) { … … 47 49 * 48 50 * @param {ASTNode} node the prop to check. 49 * @returns { Boolean} true if the prop is PropTypes.shape.51 * @returns {boolean} true if the prop is PropTypes.shape. 50 52 */ 51 53 function isShapeProp(node) { 52 return Boolean( 53 node && node.callee && node.callee.property && node.callee.property.name === 'shape' 54 return !!( 55 node 56 && node.callee 57 && node.callee.property 58 && node.callee.property.name === 'shape' 54 59 ); 55 60 } … … 62 67 */ 63 68 function getShapeProperties(node) { 64 return node.arguments && node.arguments[0] && node.arguments[0].properties; 69 return node.arguments 70 && node.arguments[0] 71 && node.arguments[0].properties; 65 72 } 66 73 … … 71 78 * @param {ASTNode} b the second element to compare. 72 79 * @param {Context} context The context of the two nodes. 73 * @param { Boolean=} ignoreCase whether or not to ignore case when comparing the two elements.74 * @param { Boolean=} requiredFirst whether or not to sort required elements first.75 * @param { Boolean=} callbacksLast whether or not to sort callbacks after everything else.76 * @param { Boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements.77 * @returns { Number} the sort order of the two elements.80 * @param {boolean=} ignoreCase whether or not to ignore case when comparing the two elements. 81 * @param {boolean=} requiredFirst whether or not to sort required elements first. 82 * @param {boolean=} callbacksLast whether or not to sort callbacks after everything else. 83 * @param {boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements. 84 * @returns {number} the sort order of the two elements. 78 85 */ 79 86 function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast, noSortAlphabetically) { … … 122 129 * @param {Fixer} fixer the first element to compare. 123 130 * @param {Array} declarations The context of the two nodes. 124 * @param { Boolean=} ignoreCase whether or not to ignore case when comparing the two elements.125 * @param { Boolean=} requiredFirst whether or not to sort required elements first.126 * @param { Boolean=} callbacksLast whether or not to sort callbacks after everything else.127 * @param { Boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements.128 * @param { Boolean=} sortShapeProp whether or not to sort propTypes defined in PropTypes.shape.129 * @param { Boolean=} checkTypes whether or not sorting of prop type definitions are checked.131 * @param {boolean=} ignoreCase whether or not to ignore case when comparing the two elements. 132 * @param {boolean=} requiredFirst whether or not to sort required elements first. 133 * @param {boolean=} callbacksLast whether or not to sort callbacks after everything else. 134 * @param {boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements. 135 * @param {boolean=} sortShapeProp whether or not to sort propTypes defined in PropTypes.shape. 136 * @param {boolean=} checkTypes whether or not sorting of prop type definitions are checked. 130 137 * @returns {Object|*|{range, text}} the sort order of the two elements. 131 138 */ … … 221 228 module.exports = { 222 229 fixPropTypesSort, 230 isCallbackPropName, 231 isRequiredProp, 232 isShapeProp, 223 233 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/props.js
rd565449 r0c6b92a 10 10 * Checks if the Identifier node passed in looks like a propTypes declaration. 11 11 * @param {ASTNode} node The node to check. Must be an Identifier node. 12 * @returns { Boolean} `true` if the node is a propTypes declaration, `false` if not12 * @returns {boolean} `true` if the node is a propTypes declaration, `false` if not 13 13 */ 14 14 function isPropTypesDeclaration(node) { … … 25 25 * Checks if the node passed in looks like a contextTypes declaration. 26 26 * @param {ASTNode} node The node to check. 27 * @returns { Boolean} `true` if the node is a contextTypes declaration, `false` if not27 * @returns {boolean} `true` if the node is a contextTypes declaration, `false` if not 28 28 */ 29 29 function isContextTypesDeclaration(node) { … … 40 40 * Checks if the node passed in looks like a contextType declaration. 41 41 * @param {ASTNode} node The node to check. 42 * @returns { Boolean} `true` if the node is a contextType declaration, `false` if not42 * @returns {boolean} `true` if the node is a contextType declaration, `false` if not 43 43 */ 44 44 function isContextTypeDeclaration(node) { … … 49 49 * Checks if the node passed in looks like a childContextTypes declaration. 50 50 * @param {ASTNode} node The node to check. 51 * @returns { Boolean} `true` if the node is a childContextTypes declaration, `false` if not51 * @returns {boolean} `true` if the node is a childContextTypes declaration, `false` if not 52 52 */ 53 53 function isChildContextTypesDeclaration(node) { … … 58 58 * Checks if the Identifier node passed in looks like a defaultProps declaration. 59 59 * @param {ASTNode} node The node to check. Must be an Identifier node. 60 * @returns { Boolean} `true` if the node is a defaultProps declaration, `false` if not60 * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not 61 61 */ 62 62 function isDefaultPropsDeclaration(node) { … … 68 68 * Checks if we are declaring a display name 69 69 * @param {ASTNode} node The AST node being checked. 70 * @returns { Boolean} True if we are declaring a display name, false if not.70 * @returns {boolean} True if we are declaring a display name, false if not. 71 71 */ 72 72 function isDisplayNameDeclaration(node) { … … 87 87 * Checks if the PropTypes MemberExpression node passed in declares a required propType. 88 88 * @param {ASTNode} propTypeExpression node to check. Must be a `PropTypes` MemberExpression. 89 * @returns { Boolean} `true` if this PropType is required, `false` if not.89 * @returns {boolean} `true` if this PropType is required, `false` if not. 90 90 */ 91 91 function isRequiredPropType(propTypeExpression) { 92 return propTypeExpression.type === 'MemberExpression' && propTypeExpression.property.name === 'isRequired'; 92 return propTypeExpression.type === 'MemberExpression' 93 && propTypeExpression.property.name === 'isRequired'; 94 } 95 96 /** 97 * Returns the type arguments of a node or type parameters if type arguments are not available. 98 * @param {ASTNode} node The node to get the type arguments from. 99 * @returns {ASTNode} The type arguments or type parameters of the node. 100 */ 101 function getTypeArguments(node) { 102 if ('typeArguments' in node) { 103 return node.typeArguments; 104 } 105 return node.typeParameters; 106 } 107 108 /** 109 * Returns the super type arguments of a node or super type parameters if type arguments are not available. 110 * @param {ASTNode} node The node to get the super type arguments from. 111 * @returns {ASTNode} The super type arguments or parameters of the node. 112 */ 113 function getSuperTypeArguments(node) { 114 if ('superTypeArguments' in node) { 115 return node.superTypeArguments; 116 } 117 return node.superTypeParameters; 93 118 } 94 119 … … 101 126 isDisplayNameDeclaration, 102 127 isRequiredPropType, 128 getTypeArguments, 129 getSuperTypeArguments, 103 130 }; -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/usedPropTypes.js
rd565449 r0c6b92a 67 67 * Checks if the string is one of `props`, `nextProps`, or `prevProps` 68 68 * @param {string} name The AST node being checked. 69 * @returns { Boolean} True if the prop name matches69 * @returns {boolean} True if the prop name matches 70 70 */ 71 71 function isCommonVariableNameForProps(name) { … … 76 76 * Checks if the component must be validated 77 77 * @param {Object} component The component to process 78 * @returns { Boolean} True if the component must be validated, false if not.78 * @returns {boolean} True if the component must be validated, false if not. 79 79 */ 80 80 function mustBeValidated(component) { … … 111 111 * @param {ASTNode} node The AST node being checked. 112 112 * @param {boolean} checkAsyncSafeLifeCycles 113 * @return { Boolean} True if the node is a lifecycle method113 * @return {boolean} True if the node is a lifecycle method 114 114 */ 115 115 function isNodeALifeCycleMethod(node, checkAsyncSafeLifeCycles) { 116 const nodeKeyName = (node.key || /** @type {ASTNode} */ ({})).name; 117 118 if (node.kind === 'constructor') { 119 return true; 120 } 121 if (LIFE_CYCLE_METHODS.indexOf(nodeKeyName) >= 0) { 122 return true; 123 } 124 if (checkAsyncSafeLifeCycles && ASYNC_SAFE_LIFE_CYCLE_METHODS.indexOf(nodeKeyName) >= 0) { 125 return true; 116 if (node.key) { 117 if (node.kind === 'constructor') { 118 return true; 119 } 120 121 const nodeKeyName = node.key.name; 122 123 if (typeof nodeKeyName !== 'string') { 124 return false; 125 } 126 127 if (LIFE_CYCLE_METHODS.indexOf(nodeKeyName) >= 0) { 128 return true; 129 } 130 if (checkAsyncSafeLifeCycles && ASYNC_SAFE_LIFE_CYCLE_METHODS.indexOf(nodeKeyName) >= 0) { 131 return true; 132 } 126 133 } 127 134 … … 134 141 * @param {ASTNode} node The AST node being checked. 135 142 * @param {boolean} checkAsyncSafeLifeCycles 136 * @return { Boolean} True if the node is inside a lifecycle method143 * @return {boolean} True if the node is inside a lifecycle method 137 144 */ 138 145 function isInLifeCycleMethod(node, checkAsyncSafeLifeCycles) { 139 if ((node.type === 'MethodDefinition' || node.type === 'Property') && isNodeALifeCycleMethod(node, checkAsyncSafeLifeCycles)) { 146 if ( 147 (node.type === 'MethodDefinition' || node.type === 'Property') 148 && isNodeALifeCycleMethod(node, checkAsyncSafeLifeCycles) 149 ) { 140 150 return true; 141 151 } … … 154 164 */ 155 165 function isSetStateUpdater(node) { 156 const unwrappedParentCalleeNode = node.parent && node.parent.type === 'CallExpression'166 const unwrappedParentCalleeNode = astUtil.isCallExpression(node.parent) 157 167 && ast.unwrapTSAsExpression(node.parent.callee); 158 168 … … 171 181 while (scope) { 172 182 const unwrappedParentCalleeNode = scope.block 173 && scope.block.parent 174 && scope.block.parent.type === 'CallExpression' 183 && astUtil.isCallExpression(scope.block.parent) 175 184 && ast.unwrapTSAsExpression(scope.block.parent.callee); 176 185 if ( … … 215 224 * @param {object} context 216 225 * @param {ASTNode} node The AST node being marked. 217 * @returns { Boolean} True if the prop has spread operator, false if not.226 * @returns {boolean} True if the prop has spread operator, false if not. 218 227 */ 219 228 function hasSpreadOperator(context, node) { -
imaps-frontend/node_modules/eslint-plugin-react/lib/util/variable.js
rd565449 r0c6b92a 12 12 * @param {Array} variables The variables list. 13 13 * @param {string} name The name of the variable to search. 14 * @returns { Boolean} True if the variable was found, false if not.14 * @returns {boolean} True if the variable was found, false if not. 15 15 */ 16 16 function findVariable(variables, name) {
Note:
See TracChangeset
for help on using the changeset viewer.