Showing 502 of 700 total issues
Consider simplifying this complex logical expression. Open
Open
if (
// Support allowAsProps option
(isDeclaredInsideProps && (allowAsProps || isComponentInRenderProp(node, context)))
// Prevent reporting components created inside Array.map calls
Consider simplifying this complex logical expression. Open
Open
if (
node.decorators[i].expression
&& node.decorators[i].expression.callee
&& node.decorators[i].expression.callee.object
&& node.decorators[i].expression.callee.object.name === 'reactMixin'
Function hasTranspilerName
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function hasTranspilerName(node) {
const namedObjectAssignment = (
node.type === 'ObjectExpression'
&& node.parent
&& node.parent.parent
Function internalIsDeclaredInComponent
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function internalIsDeclaredInComponent(declaredPropTypes, keyList) {
for (let i = 0, j = keyList.length; i < j; i++) {
const key = keyList[i];
const propType = (
declaredPropTypes && (
Function CallExpression
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
CallExpression(node) {
if (node.callee.type !== 'MemberExpression' && node.callee.type !== 'Identifier') {
return;
}
Function create
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create(context) {
const configuration = context.options[0] || {};
const forbid = new Map((configuration.forbid || DEFAULTS).map((value) => {
const propName = typeof value === 'string' ? value : value.propName;
const options = {
Function create
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create: Components.detect((context, components) => {
const configuration = context.options[0] || {};
const allowRequiredDefaults = configuration.allowRequiredDefaults || false;
/**
Function isCreateContext
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function isCreateContext(node) {
if (
node.init
&& node.init.type === 'CallExpression'
&& node.init.callee
Function create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
create: Components.detect((context, components) => {
const configuration = context.options[0] || {};
const forbidDefaultForRequired = configuration.forbidDefaultForRequired || false;
const classes = configuration.classes || 'defaultProps';
/**
- 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 traverseReturns
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function traverseReturns(ASTNode, context, onReturn) {
const nodeType = ASTNode.type;
if (nodeType === 'ReturnStatement') {
onReturn(ASTNode.argument, () => {});
Function create
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create(context) {
const configuration = context.options[0] || 'always';
// --------------------------------------------------------------------------
// Public
Function create
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create(context) {
const configuration = context.options[0] || 'multiline-multiprop';
function isMultilineJSX(jsxNode) {
return jsxNode.loc.start.line < jsxNode.loc.end.line;
Function validate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function validate(node) {
if (!node || !node.parent) {
return;
}
Function reportInvalidEntity
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function reportInvalidEntity(node) {
const configuration = context.options[0] || {};
const entities = configuration.forbid || DEFAULTS;
// HTML entities are already escaped in node.value (as well as node.raw),
Function create
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create(context) {
// --------------------------------------------------------------------------
// Public
// --------------------------------------------------------------------------
Function create
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create: Components.detect((context, components, utils) => {
/**
* Checks if the component is valid
* @param {Object} component The component to process
* @returns {Boolean} True if the component is valid, false if not.
Function create
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create(context) {
const configuration = context.options[0] || {};
const allowAllCaps = configuration.allowAllCaps || false;
const allowLeadingUnderscore = configuration.allowLeadingUnderscore || false;
const allowNamespace = configuration.allowNamespace || false;
Function validateBeforeSelfClosing
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function validateBeforeSelfClosing(context, node, option) {
const sourceCode = getSourceCode(context);
const leftToken = getTokenBeforeClosingBracket(node);
const closingSlash = sourceCode.getTokenAfter(leftToken);
Function verifyDefaultPropsDestructuring
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function verifyDefaultPropsDestructuring(context, properties) {
// Loop through each of the default params
properties.filter((prop) => prop.type === 'Property' && prop.value.type === 'AssignmentPattern').forEach((prop) => {
const propName = prop.key.name;
const propDefaultValue = prop.value;
Function MemberExpression
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MemberExpression(node) {
if (
node.property.name === 'state'
&& node.object.type === 'ThisExpression'
&& isClassComponent(node)