Skip to content

Commit

Permalink
[Perf] component detection: improve performance by optimizing getId
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot authored and ljharb committed Oct 6, 2022
1 parent d0da6bf commit 5baa3e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

### Changed
* [Docs] [`no-unknown-property`]: fix typo in link ([#3445][] @denkristoffer)
* [Perf] component detection: improve performance by optimizing getId ([#3451][] @golopot)

[#3451]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3451
[#3448]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3448
[#3445]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3445
[#3436]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3436
Expand Down
2 changes: 1 addition & 1 deletion lib/util/Components.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const isFirstLetterCapitalized = require('./isFirstLetterCapitalized');
const isDestructuredFromPragmaImport = require('./isDestructuredFromPragmaImport');

function getId(node) {
return node && node.range.join(':');
return node ? `${node.range[0]}:${node.range[1]}` : '';
}

function usedPropTypesAreEquivalent(propA, propB) {
Expand Down

0 comments on commit 5baa3e0

Please sign in to comment.