full classes compatibility (with static properties)
See original GitHub issueI just upgraded to latest version and I am getting issue with classes used as react component. It seems some rules like displayName or prop-types are not able to read (or just don’t look) static fields.
import React, {Component, PropTypes} from "react"
class Widget extends Component {
static displayName = "Widget"
static childContextTypes = {
styleVariables: PropTypes.object,
RouteHandler: PropTypes.func,
}
static propTypes = {
styleVariables: PropTypes.object,
RouteHandler: PropTypes.func,
}
getChildContext() {
return {
styleVariables: this.props.styleVariables,
RouteHandler: this.props.RouteHandler,
}
}
}
This code give me 3 errors:
6:0 error Widget component definition is missing display name react/display-name
24:22 error 'styleVariables' is missing in props validation for Widget react/prop-types
25:20 error 'RouteHandler' is missing in props validation for Widget react/prop-types
It would be really cool to support this.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:9
- Comments:35 (19 by maintainers)
Top Results From Across the Web
Static properties and methods - The Modern JavaScript Tutorial
Static methods does not depend on the class properties. It can work all on its own. The Whole Math class methods are static...
Read more >static - JavaScript - MDN Web Docs - Mozilla
This page introduces public static properties of classes, which include static methods, static accessors, and static fields. ... Public static features are ...
Read more >All about TypeScript Static Members | TypeScript OOP
Classes contain properties (methods and attributes) which hold variables and operations. Every time we define the properties of a class, they ...
Read more >Static Classes and Static Class Members - C# guide
A non-static class can contain static methods, fields, properties, or events. The static member is callable on a class even when no instance...
Read more >Static properties on a trait cannot be overriden by the class ...
If a trait defines a property then a class can not define a property with the same name unless it is compatible (same...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@benmarten Yep, adding
"parser": "babel-eslint"
to my .eslintrc and installing it solved it for me as well.@sebastienbarre I cannot reproduce your problem with
eslint@0.19.0
,eslint-plugin-react@2.1.1
andbabel-eslint@3.0.1
:test.jsx
.eslintrc