Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Use babylon parser directly to disable strict mode #40

Merged
merged 1 commit into from
Nov 11, 2015

Conversation

dblandin
Copy link
Contributor

We shouldn't assume that all JavaScript analyzed by this engine will adhere to strict ES6 rules. Instead, use the parser as loosely as possible when analyzing for duplication.

/usr/src/app/node_modules/babel/node_modules/babel-core/lib/transformation/file/index.js:671
      throw err;
      ^

SyntaxError: unknown: Argument name clash in strict mode (54:39)
  52 |       chart.yAxis.tickFormat(function() { return ""; });
  53 |
> 54 |       chart.tooltipContent(function(_, _, _, graph) {
     |                                        ^
  55 |         var date = d3.time.format('%b-%d')(new Date(graph.point.x));
  56 |         return "<strong><span style=\"padding:5px;\">" + date + "</span></strong>";
  57 |       });
    at Parser.pp.raise (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/location.js:24:13)
    at Parser.pp.checkLVal (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/lval.js:181:16)
    at Parser.pp.parseFunctionBody (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:766:12)
    at Parser.parseFunctionBody (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/plugins/flow.js:609:20)
    at Parser.pp.parseFunction (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:524:8)
    at Parser.pp.parseExprAtom (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:397:19)
    at Parser.parseExprAtom (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/plugins/jsx/index.js:412:22)
    at Parser.pp.parseExprSubscripts (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:236:19)
    at Parser.pp.parseMaybeUnary (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:217:19)
    at Parser.pp.parseExprOps (/usr/src/app/node_modules/babel/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:163:19)

We shouldn't assume that all JavaScript analyzed by this engine will
adhere to strict ES6 rules. Instead, use the parser as loosely as
possible when analyzing for duplication.
@BlakeWilliams
Copy link
Contributor

Nice! LGTM

@dblandin
Copy link
Contributor Author

@BlakeWilliams Thanks! 👍

dblandin added a commit that referenced this pull request Nov 11, 2015
…le-parsing-javascript

Use babylon parser directly to disable strict mode
@dblandin dblandin merged commit 6730b04 into master Nov 11, 2015
@dblandin dblandin deleted the devon/disable-strict-mode-while-parsing-javascript branch November 11, 2015 15:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants