ngx-rocket / generator-ngx-rocket

:rocket: Extensible Angular 14+ enterprise-grade project generator
https://ngx-rocket.github.io/
MIT License
1.53k stars 216 forks source link

.editorconfig missing `quote_type = single` for formatting of typescript files #580

Closed joboyx closed 3 years ago

joboyx commented 3 years ago

I'm submitting a...

Current behavior

Using prettier as formatter in VSCode, format whole .ts typescript file makes all single-quote (') as double quotes (")

image

Expected behavior

Expected is that when organizing imports and formatting document all quotes should be single

image

Minimal reproduction of the problem with instructions

Environment



ngX-Rocket: 9.1.0
Node.js: v15.2.1
Npm: 7.0.8
OS: darwin x64 20.2.0

Generated project options:
{
  "generator-addon-firebase": {
    "firebaseDeploy": true,
    "version": "3.0.1",
    "props": {
      "firebaseDeploy": true,
      "appName": "tursido-app",
      "projectName": "tursido-app",
      "packageManager": "npm",
      "location": "path",
      "strict": false,
      "skipInstall": false,
      "skipQuickstart": false,
      "initGit": true,
      "usePrefix": true,
      "target": [
        "web"
      ],
      "pwa": true,
      "ui": "ionic",
      "layout": "tabs",
      "auth": true,
      "lazy": true,
      "angulartics": false,
      "languages": [
        "en-US"
      ],
      "tools": [],
      "utility": [
        "lodash"
      ],
      "deploy": "firebase",
      "mobile": [],
      "desktop": []
    }
  },
  "generator-ngx-rocket": {
    "version": "9.1.0",
    "props": {
      "location": "path",
      "strict": false,
      "skipInstall": false,
      "skipQuickstart": false,
      "initGit": true,
      "usePrefix": true,
      "appName": "tursido-app",
      "target": [
        "web"
      ],
      "pwa": true,
      "ui": "ionic",
      "layout": "tabs",
      "auth": true,
      "lazy": true,
      "angulartics": false,
      "languages": [
        "en-US"
      ],
      "tools": [],
      "utility": [
        "lodash"
      ],
      "deploy": "firebase",
      "projectName": "tursido-app",
      "packageManager": "npm",
      "mobile": [],
      "desktop": []
    }
  }
}

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 10.1.7
Node: 15.2.1
OS: darwin x64

Angular: 10.2.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.5
@angular-devkit/build-angular   0.1001.7
@angular-devkit/core            11.0.5
@angular-devkit/schematics      10.1.7
@angular/cdk                    10.2.7
@angular/cli                    10.1.7
@angular/fire                   6.1.4
@angular/flex-layout            10.0.0-beta.32
@schematics/angular             10.1.7
@schematics/update              0.1001.7
rxjs                            6.6.3
typescript                      4.0.5

Others:

ℹ️ WORKAROUND

image

I think as a fix, this manual change to .editorconfig should be included in the boilerplate/generated code by ngx since in previous versions single quote is used by default (I think by prettier in package.json)(that's what I get used, unless this changed). So this might be a regression issue.

sinedied commented 3 years ago

This may be an issue with the prettier VS Code extension or your config, as in the generated project there's already a setting in package.json for prettier with "singleQuote": true. You can verify that it works fine by running npm run prettier from the command line.

It would be ok to enforce the quote_type property in editorconfig, but at the moment it's a proposal and not an "officially" supported property (see https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties).

I also tried with a freshly generated project where I enabled the "prettier" option and the formatting is fine, using the settings from package.json (single quotes).

Are you sure you enabled the "prettier" option when generating your project, and you're using this extension for formatting?

sinedied commented 3 years ago

I just saw that quote_type = single was added to the default ng11 generated app, so I wouldn't hurt to also add it.

ci-rebot commented 3 years ago

:tada: This issue has been resolved in version 9.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: