-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no-system-props: skip html elements (#148)
* add check for react component or not * reverse the check * Create few-beers-jump.md
- Loading branch information
1 parent
ca14bb6
commit 523e169
Showing
4 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"eslint-plugin-primer-react": patch | ||
--- | ||
|
||
no-system-props: skip html elements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function isHTMLElement(jsxNode) { | ||
if (jsxNode.name.type === 'JSXIdentifier') { | ||
// this is a very silly proxy, but it works | ||
// React components are capitalised, html elements are not | ||
const firstLetter = jsxNode.name.name | ||
if (firstLetter === firstLetter.toLowerCase()) return true | ||
} | ||
|
||
return false | ||
} | ||
exports.isHTMLElement = isHTMLElement |