-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint against imported lowercase components #299
Comments
I'd love to take a stab at this. @gaearon do you know if it's easy to get eslint-plugin-react maintainers to accept new rules into the repo? EDIT: oh, I see there can be local rules defined in the project. |
Hmm, not sure. Here’s what prompted me to create this issue. The code looks like this: import React, { Component } from 'react';
import './App.css';
class App extends Component {
render() {
return <lol />;
}
}
class lol extends Component {
render() {
return <h1>lol</h1>;
}
}
export default App; That rule doesn’t catch it. |
To be clear, What I propose: if |
Anything starting with a lowercase letter. So |
Beware, there are components like "i" that are likely going to be in scope |
Oh, good catch. This rule should have a good HTML tag whitelist I think, then it would be relatively safe. |
Updated the proposal. |
I think HTML tag whitelist it a way to solve it. But takes some regex in webpack plugin is a good solution? |
Pretty sure we want to solve it in the linter, not as a webpack plugin. |
Custom elements must contain a hyphen [*] inherits from |
ha. Obviously I didn't read jsx-eslint/eslint-plugin-react#726 – sorry about that :) |
Closing as I don't feel strongly about this. |
I know this issue is closed, but I'm running into warnings when I import a React component that starts with an underscore. Shouldn't that be allowed syntax as React component? |
If you import something lowercase from a package and then use it in JSX we can be confident you didn't mean a web component.
We should warn in this case. This should probably be a rule in eslint-plugin-react.
The text was updated successfully, but these errors were encountered: