Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsconfig.json can't be parsed if it contains comments #13455

Closed
CSchulz opened this issue Jan 17, 2019 · 3 comments
Closed

tsconfig.json can't be parsed if it contains comments #13455

CSchulz opened this issue Jan 17, 2019 · 3 comments
Labels
area: schematics/angular freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Milestone

Comments

@CSchulz
Copy link

CSchulz commented Jan 17, 2019

Bug Report or Feature Request (mark with an x)

- [X] bug report
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [x] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Will also effect other commands.

Versions

Angular CLI: 7.2.2
Node: 10.12.0
OS: darwin x64
Angular: 7.1.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.11.4
@angular-devkit/build-angular      0.11.4
@angular-devkit/build-ng-packagr   0.11.4
@angular-devkit/build-optimizer    0.11.4
@angular-devkit/build-webpack      0.11.4
@angular-devkit/core               7.1.4
@angular-devkit/schematics         7.2.2
@angular/cli                       7.2.2
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.1.4
@schematics/angular                7.2.2
@schematics/update                 0.12.2
ng-packagr                         4.4.5
rxjs                               6.3.3
typescript                         3.1.6
webpack                            4.23.1

Repro steps

Add some comments to the tsconfig.json file:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "importHelpers": true,
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "strict": true,
    "strictPropertyInitialization": false,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "target": "es5",
    "typeRoots": ["node_modules/@types"],
    "lib": ["es2017", "dom"],
    "paths": {
      // use public_api instead of dist folder for recompile on library changes
      "commons": ["projects/commons/src/public_api-dev.ts"]
    }
  }
}

The log given by the failure

$ npx ng generate library
? What name would you like to use for the library? test
Invalid JSON character: "u" at 21:8.

Desired functionality

Should allow comments in tsconfig.json.

Mention any other details that might be useful

Could be related to #5216

/cc @ajafff

@dooks
Copy link

dooks commented Jan 18, 2019

I'm glad there's functionality to fix this, but aren't *.json files not supposed to support comments in the first place?

@clydin
Copy link
Member

clydin commented Jan 18, 2019

JSON5 supports comments. More details can be found here: https://json5.org

@hansl hansl closed this as completed in 6c0b4db Jan 18, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: schematics/angular freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants