Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !3968

Use package.json "prettier" key in the "Formatting Code Automatically" section

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/dmfrancisco/next into next Feb 04, 2018
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: dmfrancisco

Using Prettier in the code editor is very useful and it's even incentivized in the last sentence of the "Formatting Code Automatically" section of the User Guide. Users can also have a custom Prettier configuration in their package.json, which is automatically used by code editor extensions and the Prettier CLI.

However, the instructions in this section pass a --single-quote option to the CLI which will override the user's custom config (if existent). This means the code automatically formatted by their editors may be different to what will end up being committed.

Ideally, it would be great if we could simplify and remove the custom --single-quote config, but I guess this was added to match the styling of the generated files (such as serviceWorker.js).

In this PR I moved the configuration to the "prettier" key in the package.json so that is used by both the CLI and code editor extensions.

I also added a sentence explaining what the key is about so it's harder to miss (because some users may be using a prettier.config.js or .prettierrc file instead and will want to adjust).

Feel free to close if you disagree! Thank you for creating this project and documenting it so well 👏

The reason for this is that I use Prettier in VS Code and have recently blindly copied these instructions, and got confused when I started seeing single quotes instead of double quotes in my committed files, despite having my custom config. 😄

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/dmfrancisco/next