question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Trailing commas throw error when parsing routes

See original GitHub issue
Overview of the issue

If there are trailing commas in the routes definition, compodoc throws an error:

Routes parsing error, maybe a trailing comma or an external variable, trying to fix that later after sources scanning.

Operating System, Node.js, npm, compodoc version(s)
OS X 10.12.5
yarn: 0.24.6
npm: 5.0.1
@angular/cli: 1.1.0
node: 8.0.0
os: darwin x64
@angular/animations: 4.1.3
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/material: 2.0.0-beta.6
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.1.0
@angular/compiler-cli: 4.1.3
@angular/language-service: 4.1.3
Angular configuration, a package.json file in the root folder
{
  "name": "components-test",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json --theme stripe --hideGenerator --coverageTest"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.1.3",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/material": "^2.0.0-beta.6",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "angular2-ladda": "^1.2.1",
    "core-js": "^2.4.1",
    "ngx-messages": "^0.2.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.1.0",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@compodoc/compodoc": "^1.0.0-beta.9",
    "@types/jasmine": "2.5.45",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "sass-material-colors": "^0.0.5",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}
Compodoc installed globally or locally ?

Globally

Motivation for or Use Case

The project I am working on is using tslint to enforce styles. Part of the styleguide requires trailing commas. Changing the rule and entire repo is not possible at this time, so the only way to solve the error is to disable tslint around each of the routing declarations.

Reproduce the error
  1. Use trailing commas in your route declarations:
const INVENTORY_ROUTES: Routes = [
  {
    path: 'inventory',
    component: InventoryComponent,
  },
];
  1. Run compodoc: ./node_modules/.bin/compodoc -p src/tsconfig.app.json

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vogloblinskycommented, Jun 30, 2017

@maxencefrenette Thanks for JSON5 link. Works fine with route parser. Bug fixed, coming in next release soon.

1reaction
maxencefrenettecommented, Jun 5, 2017

I was completely wrong, sorry. I edited my comment above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Runtime error when parsing JSON array and map elements ...
In the code below, removing the comma works. Is there a fix for this so I can just see one line change when...
Read more >
Handling Requests: Routing and URL Creation - Yii Framework
When a Yii application starts processing a requested URL, the first step it takes is to parse the URL into a route. The...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Fixed an issue where browser.tabs sometimes returned an incorrect URL for pinned tabs. Bug Fixes. Fixed the Share Menu when sharing an image...
Read more >
opencsv / Bugs / #223 csv has more data columns than ...
I have a client providing a csv file with trailing commas on the data ... we throw an exception and any additional columns...
Read more >
PHP 7 ChangeLog
Fixed bug #81494 (Stopped unbuffered query does not throw error). ... Fixed bug #79699 (PHP parses encoded cookie names so malicious `__Host-` cookies...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found