Coder Social home page Coder Social logo

Comments (4)

briced avatar briced commented on July 26, 2024 1

The exit code is the number of modified files, (https://github.com/renke/import-sort/blob/master/packages/import-sort-cli/src/index.ts)

Problem is, in Unix system, status code 0 is "Everything is ok", every other status is "There's an error"

#33 should to fix this, but it's a big breaking change, and I don't know if this will be merged.

from import-sort.

briced avatar briced commented on July 26, 2024 1

@herkulano
--status, as I understand it, returns the status code, without doing the rewriting (kind of dry-run), so it's coherent to make it return 0.
For --diff the work is done, so it's normal to return a status code "everything is ok".

If it fails, it will call bail() and return -1

from import-sort.

Frikki avatar Frikki commented on July 26, 2024 1

Here's how to suppress the status code when different than 0:

"fix:sort": "import-sort -o './' || true"

... or run with the silent flag:

$ npm run fix:sort --silent

from import-sort.

herkulano avatar herkulano commented on July 26, 2024

@briced for --diff and --status it makes senses to exit with 1 as it means they have found errors.

It's only when you're doing --write or --overwrite that it shouldn't exit with 1 because the files have been successfully changed, so they should be correct and there are no errors in them. The write command should only exit with 1 if there's an error writing the files.

from import-sort.

Related Issues (20)

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.