jaredly / stylecleanup

Find & fix unused styles in react native and aphrodite
MIT License
112 stars 11 forks source link

Unexpected token error #5

Open kevinbarabash opened 5 years ago

kevinbarabash commented 5 years ago

I tried running stylecleaup check on webapp, but babylon runs into some syntax it doesn't expect. Here's some of the output:

... javascript/wonder-blocks-package/fixtures_test.js javascript/ycla-package/ycla.js javascript/ycla-package/you-can-learn-anything-entry.js javascript/zero-rating-package/fixtures_test.js javascript/zero-rating-package/login-warning-modal.jsx.fixture.js
/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:4457
  throw err;
  ^

SyntaxError: Unexpected token (9:12)
    at Parser.pp$5.raise (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:3627:50)
    at Parser.parseExprAtom (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:7238:22)
    at Parser.pp$3.parseExprSubscripts (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:3344:19)
    at Parser.parseMaybeAssign (/Users/kevinbarabash/.config/yarn/global/node_modules/babylon/lib/index.js:6474:20)

I'll try adding some console.logs to get some more info.

jaredly commented 5 years ago

huh, I wonder if it's a babel config thing

kevinbarabash commented 5 years ago

most likely... I would've expected object spread or class properties to be the most likely issue, but they're in the list of parser plugins.

Stephen2 commented 5 years ago

I think this'll be closed be the recent PR merge #6

ariabuckles commented 5 years ago

@jaredly any chance you could publish this update to npm? (Also thanks; I love the project)

BedoEbied commented 1 year ago
/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:3274
    if (!this.options.errorRecovery) throw error;
                                     ^

SyntaxError: Unexpected token (112:64)
    at instantiate (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:653:32)
    at constructor (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:946:12)
    at FlowParserMixin.raise (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:3270:19)
    at FlowParserMixin.unexpected (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:3300:16)
    at FlowParserMixin.parseParenAndDistinguishExpression (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:11507:12)
    at FlowParserMixin.parseParenAndDistinguishExpression (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:5874:18)
    at FlowParserMixin.parseExprAtom (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:11141:23)
    at FlowParserMixin.parseExprAtom (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:7007:20)
    at FlowParserMixin.parseExprSubscripts (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:10872:23)
    at FlowParserMixin.parseUpdate (/Users/abdelrahmanebied/.config/yarn/global/node_modules/@babel/parser/lib/index.js:10855:21) {
  code: 'BABEL_PARSER_SYNTAX_ERROR',
  reasonCode: 'UnexpectedToken',
  loc: Position { line: 112, column: 64, index: 3547 },
  pos: [Getter/Setter]
}

Node.js v19.8.1

using "stylecleanup@1.3.0" with binaries: