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

Let Yarn handle package.json formatting, not lint-staged #1614

Merged
merged 1 commit into from
May 14, 2018

Commits on May 13, 2018

  1. Let Yarn handle package.json formatting, not lint-staged

    When installing/removing packages, Yarn formats `package.json`, which
    causes it to show up in the `git diff` as shown here:
    
    <details><summary>git diff</summary>
    
    ```diff
    diff --git a/package.json b/package.json
    index 8efeb43..7db2342 100644
    --- a/package.json
    +++ b/package.json
    @@ -6,7 +6,12 @@
         "node": ">=6.13.1",
         "npm": ">=3.10.10"
       },
    -  "browserslist": [">1%", "last 4 versions", "Firefox ESR", "not ie < 9"],
    +  "browserslist": [
    +    ">1%",
    +    "last 4 versions",
    +    "Firefox ESR",
    +    "not ie < 9"
    +  ],
       "dependencies": {
         "@babel/polyfill": "^7.0.0-beta.44",
         "bluebird": "^3.5.1",
    @@ -116,9 +121,18 @@
         "webpack-node-externals": "^1.7.2"
       },
       "lint-staged": {
    -    "*.{js,jsx}": ["eslint --no-ignore --fix", "git add --force"],
    -    "*.{json,md,graphql}": ["prettier --write", "git add --force"],
    -    "*.{css,less,styl,scss,sass,sss}": ["stylelint --fix", "git add --force"]
    +    "*.{js,jsx}": [
    +      "eslint --no-ignore --fix",
    +      "git add --force"
    +    ],
    +    "*.{json,md,graphql}": [
    +      "prettier --write",
    +      "git add --force"
    +    ],
    +    "*.{css,less,styl,scss,sass,sss}": [
    +      "stylelint --fix",
    +      "git add --force"
    +    ]
       },
       "scripts": {
         "precommit": "lint-staged",
    ```
    
    </details>
    
    This change simply makes `lint-staged` ignore `package.json`, so that it
    doesn't conflict with Yarn's formatting.
    josephfrazier committed May 13, 2018
    Configuration menu
    Copy the full SHA
    908578b View commit details
    Browse the repository at this point in the history