ember-cli / ember-cli/ember-router-generator

Trailing comma for a path in router.js causes ember g route failure

Open
#134 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12
Forks
19
PR merge metrics
No merged PRs in 30d

Description

![image](https://user-images.githubusercontent.com/20237860/75505384-03984780-5a01-11ea-85d2-be59902ed2e0.png)

Notice the comma at the end of path option.

When I try to generate route
![image](https://user-images.githubusercontent.com/20237860/75505400-0bf08280-5a01-11ea-80bd-c57dd6a4f6e5.png)

I get this error.

`
ENV Summary:

TIME: Thu Feb 27 2020 10:25:48 GMT+0000 (Coordinated Universal Time)
TITLE: ember
ARGV:

/usr/local/bin/node
/usr/local/bin/ember
g
route
workspace
EXEC_PATH: /usr/local/bin/node
TMPDIR: /tmp
SHELL: /bin/bash
PATH:
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
PLATFORM: linux x64
FREEMEM: 17924247552
TOTALMEM: 33601220608
UPTIME: 2705
LOADAVG: 3.38330078125,2.31201171875,2.2646484375
CPUS:
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 2970
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 2995
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 3029
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 3029
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 2980
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 2976
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 3005
Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz - 3013
ENDIANNESS: LE
VERSIONS:
ares: 1.15.0
brotli: 1.0.7
cldr: 35.1
http_parser: 2.9.3
icu: 64.2
modules: 64
napi: 5
nghttp2: 1.39.2
node: 10.19.0
openssl: 1.1.1d
tz: 2019c
unicode: 12.1
uv: 1.28.0
v8: 6.8.275.32-node.55
zlib: 1.2.11
ERROR Summary:

broccoliBuilderErrorStack: [undefined]
code: [undefined]
codeFrame: [undefined]
errorMessage: Line 182: Unexpected token )
errorType: [undefined]
location:
column: [undefined]
file: [undefined]
line: [undefined]
message: Line 182: Unexpected token )
name: Error
nodeAnnotation: [undefined]
nodeName: [undefined]
originalErrorMessage: [undefined]
stack: Error: Line 182: Unexpected token )
at ErrorHandler.constructError (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:3396:22)
at ErrorHandler.createError (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:3414:27)
at JSXParser.Parser.unexpectedTokenError (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:542:39)
at JSXParser.Parser.throwUnexpectedToken (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:552:21)
at JSXParser.Parser.parsePrimaryExpression (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:917:31)
at JSXParser.parsePrimaryExpression (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:5365:97)
at JSXParser.Parser.inheritCoverGrammar (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:833:37)
at JSXParser.Parser.parseLeftHandSideExpressionAllowCall (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:1388:26)
at JSXParser.Parser.inheritCoverGrammar (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:833:37)
at JSXParser.Parser.parseUpdateExpression (/root/xvector/x-ui/node_modules/ember-router-generator/node_modules/esprima/dist/esprima.js:1482:26)
`
Remove the comma the error goes away.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the router.js path option and reproduce the failure using `ember g route workspace`. Trace how the generator parses that file and verify that a trailing comma no longer produces the reported `Unexpected token )` error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.