diff --git a/CHANGELOG.md b/CHANGELOG.md index d39be4a9df..f5975115a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/util/Components.js b/lib/util/Components.js index 7b931c2234..b112923f63 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -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) {