propType "chartLabel" is not required, but has no corresponding defaultProps declaration. Open
chartLabel: PropTypes.string,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
propType "data" is not required, but has no corresponding defaultProps declaration. Open
data: PropTypes.array,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
propType "chartLabel" is not required, but has no corresponding defaultProps declaration. Open
chartLabel: PropTypes.string,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prop type "array" is forbidden Open
data: PropTypes.array,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import React, { Component } from 'react';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Export statements should appear at the end of the file Open
export class RechartsBar extends Component {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
File has too many classes (2). Maximum allowed is 1. Open
import React, { Component } from 'react';
- Read upRead up
- Exclude checks
title: max-classes-per-file
rule_type: suggestion
Files containing multiple classes can often result in a less navigable and poorly structured codebase. Best practice is to keep each file limited to a single responsibility.
Rule Details
This rule enforces that each file may contain only a particular number of classes and no more.
Examples of incorrect code for this rule:
::: incorrect
/*eslint max-classes-per-file: "error"*/
class Foo {}
class Bar {}
:::
Examples of correct code for this rule:
::: correct
/*eslint max-classes-per-file: "error"*/
class Foo {}
:::
Options
This rule may be configured with either an object or a number.
If the option is an object, it may contain one or both of:
-
ignoreExpressions
: a boolean option (defaulted tofalse
) to ignore class expressions. -
max
: a numeric option (defaulted to 1) to specify the maximum number of classes.
For example:
{
"max-classes-per-file": ["error", 1]
}
{
"max-classes-per-file": [
"error",
{ "ignoreExpressions": true, "max": 2 }
]
}
Examples of correct code for this rule with the max
option set to 2
:
::: correct
/* eslint max-classes-per-file: ["error", 2] */
class Foo {}
class Bar {}
:::
Examples of correct code for this rule with the ignoreExpressions
option set to true
:
::: correct
/* eslint max-classes-per-file: ["error", { ignoreExpressions: true }] */
class VisitorFactory {
forDescriptor(descriptor) {
return class {
visit(node) {
return `Visiting ${descriptor}.`;
}
};
}
}
::: Source: http://eslint.org/docs/rules/
propType "payload" is not required, but has no corresponding defaultProps declaration. Open
payload: PropTypes.array,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prop spreading is forbidden Open
return <Rectangle {...props} stroke="none" fill={colorScheme[index % colorScheme.length]} />;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prop type "array" is forbidden Open
payload: PropTypes.array,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
propType "active" is not required, but has no corresponding defaultProps declaration. Open
active: PropTypes.bool,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Prefer named exports. Open
export default connect()(RechartsBar);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Declare only one React component per file Open
const ColoredBar = props => {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
'data' PropType is defined but prop is never used Open
data: PropTypes.array,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Declare only one React component per file Open
export class RechartsBar extends Component {
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/