GithubHelp home page GithubHelp logo

nklsj / react-boilerplate-lint-staged-bug-test Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 203 KB

Test problems with lint-staged and/or stylefmt

License: MIT License

JavaScript 96.17% HTML 2.13% CSS 1.70%

react-boilerplate-lint-staged-bug-test's Introduction

Test lint staged / stylefmt bug

Created from https://github.com/digiaonline/react-boilerplate

What's wrong?

Seems like lint-staged or stylefmt doesn't work correctly if you try to add 2 css files into a commit, and if one of those files has lint errors. When git pre-commit hook is run, stylefmt autofixes lint errors. You end up with one file that still has lint errors and one file that has now all of it's original content overwritten by the autofixed contents of the other file.

Steps to reproduce the bug

  • Install Yarn globally (if you don't have it yet) https://yarnpkg.com/lang/en/docs/install/
  • Clone this repo
  • Change contents of src/hello/components/Hello.css so that the file has css lint errors (add too much indent for example)
  • Change contents of src/root/components/Root.css so that the file has css lint errors (add too much indent for example)
  • Type git add .
  • Type yarn precommit
  • Open both css files. One of the files should have been overwritten with the content from the other file.

Steps to fix the bug

This issue seems to fix itself if you modify .lintstagedrc to this

{
  "*.js": [
    "prettier-eslint --write \"src/**/*.js\"",
    "git add"
  ],
  "*.css": [
    "stylefmt --recursive",
    "git add"
  ]
}

So if you add --recursive to this line "stylefmt --recursive",

More discussion on the topic here lint-staged/lint-staged#164

react-boilerplate-lint-staged-bug-test's People

Contributors

nklsj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.