From 8ddd55bf34fdaace8f26b7d36b1daab8a9933aa3 Mon Sep 17 00:00:00 2001 From: Boris Sergeev Date: Fri, 23 Sep 2016 20:37:49 +0300 Subject: [PATCH 1/2] Prevented throwing exception in 'pure-component' transform see more at https://github.com/reactjs/react-codemod/issues/64 --- transforms/pure-component.js | 1 + 1 file changed, 1 insertion(+) diff --git a/transforms/pure-component.js b/transforms/pure-component.js index 0b5b2330..e10e09b5 100644 --- a/transforms/pure-component.js +++ b/transforms/pure-component.js @@ -83,6 +83,7 @@ module.exports = function(file, api, options) { const reportSkipped = path => { const name = getClassName(path); const fileName = file.path; + if (!path.value.loc) return; const {line, column} = path.value.loc.start; console.warn(`Class "${name}" skipped in ${fileName} on ${line}:${column}`); From eb263583f3fef33ac8c6c796040a0f3d9d758637 Mon Sep 17 00:00:00 2001 From: Christoph Pojer Date: Sun, 6 Nov 2016 15:53:13 +0000 Subject: [PATCH 2/2] Update pure-component.js --- transforms/pure-component.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transforms/pure-component.js b/transforms/pure-component.js index e10e09b5..723151eb 100644 --- a/transforms/pure-component.js +++ b/transforms/pure-component.js @@ -83,7 +83,10 @@ module.exports = function(file, api, options) { const reportSkipped = path => { const name = getClassName(path); const fileName = file.path; - if (!path.value.loc) return; + if (!path.value.loc) { + console.warn(`Class "${name}" skipped in ${fileName}`); + return; + } const {line, column} = path.value.loc.start; console.warn(`Class "${name}" skipped in ${fileName} on ${line}:${column}`);