Skip to content

Commit cbe99e0

Browse files
committed
[Fix] forbid-component-props: support JSXNamespacedName
See AriPerkkio/eslint-remote-tester#29 (comment)
1 parent 2f376e0 commit cbe99e0

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
88
### Fixed
99
* [`jsx-max-depth`]: Prevent getting stuck in circular references ([#2957][] @AriPerkkio)
1010
* [`jsx-no-target-blank`]: fix handling of `warnOnSpreadAttributes` being false ([#2953][] @Nokel81)
11-
* [`forbid-dom-props`]: support `JSXNamespacedName` [#2961][] @mrtnzlml)
11+
* [`forbid-dom-props`]: support `JSXNamespacedName` ([#2961][] @mrtnzlml)
12+
* [`forbid-component-props`]: support `JSXNamespacedName` (@ljharb)
1213

1314
### Changed
1415
* Fix CHANGELOG.md ([#2950][] @JounQin)

lib/rules/forbid-component-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module.exports = {
8686
// Extract a component name when using a "namespace", e.g. `<AntdLayout.Content />`.
8787
const tag = parentName.name || `${parentName.object.name}.${parentName.property.name}`;
8888
const componentName = parentName.name || parentName.property.name;
89-
if (componentName && componentName[0] !== componentName[0].toUpperCase()) {
89+
if (componentName && typeof componentName[0] === 'string' && componentName[0] !== componentName[0].toUpperCase()) {
9090
// This is a DOM node, not a Component, so exit.
9191
return;
9292
}

tests/lib/rules/forbid-component-props.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ ruleTester.run('forbid-component-props', rule, {
111111
options: [{
112112
forbid: [{propName: 'className', allowedFor: ['this.ReactModal']}]
113113
}]
114+
}, {
115+
code: '<fbt:param name="Total number of files" number={true} />'
114116
}],
115117

116118
invalid: [{

0 commit comments

Comments
 (0)