Showing 502 of 700 total issues
Function checkPropsOrder
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkPropsOrder(properties) {
const propertiesInfos = properties.map((node) => ({
name: getPropertyName(node),
getter: node.kind === 'get',
setter: node.kind === 'set',
Function ObjectTypeAnnotation
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ObjectTypeAnnotation(annotation, parentName, seen) {
let containsUnresolvedObjectTypeSpread = false;
let containsSpread = false;
const containsIndexers = Boolean(annotation.indexers && annotation.indexers.length);
const shapeTypeDefinition = {
Function checkProperties
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkProperties(declarations) {
if (declarations) {
declarations.forEach((declaration) => {
if (declaration.type !== 'Property') {
return;
Function JSXSpreadAttribute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
JSXSpreadAttribute(node) {
const jsxOpeningElement = node.parent.name;
const type = jsxOpeningElement.type;
let tagName;
Function create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
function validate(node, children) {
let currentIsInline = false;
let previousIsInline = false;
if (!children) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
return {
JSXOpeningElement(node) {
let name;
if (node.name.namespace) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
function handleClosingElement(node) {
if (!node.parent) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
return {
JSXAttribute(node) {
const attributes = new Set(context.options[0] || DEFAULT_ATTRIBUTES);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function isComponentInRenderProp
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function isComponentInRenderProp(node, context) {
if (
node
&& node.parent
&& node.parent.type === 'Property'
Function reportFunctionComponent
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function reportFunctionComponent(componentNode, declaredPropTypes, defaultProps) {
if (defaultProps) {
report(context, messages.noDefaultPropsWithFunction, 'noDefaultPropsWithFunction', {
node: componentNode,
});
Function create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
/**
* Checks for shouldComponentUpdate property
* @param {ASTNode} node The AST node being checked.
* @returns {Boolean} Whether or not the property exists.
Function Program:exit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
'Program:exit'() {
if (!rule) {
return;
}
Function checkPropValidValue
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkPropValidValue(context, node, value, attribute) {
const validTags = VALID_VALUES.get(attribute);
if (value.type !== 'Literal') {
return; // cannot check non-literals
Consider simplifying this complex logical expression. Open
if (
node.expression
&& node.expression.type === 'AssignmentExpression'
&& node.expression.operator === '='
&& node.expression.right.type === 'CallExpression'
Consider simplifying this complex logical expression. Open
if (
parent
&& parent.type === 'MethodDefinition' && (
(parent.static && parent.key.name === 'getDerivedStateFromProps')
|| classMethods.indexOf(parent.key.name) !== -1
Consider simplifying this complex logical expression. Open
if (node.type === 'CallExpression'
&& node.callee
&& node.callee.type === 'MemberExpression'
&& node.callee.object
&& isArrayIndex(node.callee.object)
Consider simplifying this complex logical expression. Open
if (
(configuration === 'multiline' && isMultilineJSX(node))
|| (configuration === 'multiline-multiprop' && isMultilineJSX(node) && node.attributes.length > 1)
|| (configuration === 'multiprop' && node.attributes.length > 1)
|| (configuration === 'always')
Consider simplifying this complex logical expression. Open
if (element.type === 'JSXElement' || element.type === 'JSXExpressionContainer') {
const configuration = context.options[0] || {};
const prevent = configuration.prevent || false;
const allowMultilines = configuration.allowMultilines || false;
Function VariableDeclarator
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
VariableDeclarator(node) {
const unwrappedInitNode = ast.unwrapTSAsExpression(node.init);
// let props = this.props
if (isThisDotProps(unwrappedInitNode) && isInClassComponent(context, node) && node.id.type === 'Identifier') {
Function isJSXValue
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const isJSXValue = (node) => {
if (!node) {
return false;
}
switch (node.type) {