Giter Site home page Giter Site logo

Comments (15)

sindresorhus avatar sindresorhus commented on June 14, 2024

I usually never run linting without tests as I already have linting in my editor. If I were to do it though, I would just use the globally installed XO: $ xo.

from create-xo.

sindresorhus avatar sindresorhus commented on June 14, 2024

Thoughts?

from create-xo.

joakimbeng avatar joakimbeng commented on June 14, 2024

I see. I like to not have to install many libraries globally, which makes it easier for new developers as well.
This is no big deal though...
But what would you think about adding this feature behind an optional flag? (I could make a PR if you're interested)

from create-xo.

sindresorhus avatar sindresorhus commented on June 14, 2024

@joakimbeng Re flag. I'll think about it. Keeping this open for now.

I kinda got this idea. What if npm could run local binaries. npm run xo would run the local xo binary if no run script exists by that name. Would be sweet. I don't always want to have to proxy binaries through a run script. Do you think that would be a good feature request for npm?

from create-xo.

joakimbeng avatar joakimbeng commented on June 14, 2024

That would be great IMO!
Have you seen the npm-exec discussion? It looks like there's plenty more wanting this feature...
I personally have added node_modules/.bin/ to my path so I seldom run the global executables ;) But I would prefer something like npm run xo or npm exec xo.

from create-xo.

sindresorhus avatar sindresorhus commented on June 14, 2024

@joakimbeng Yes, but totally forgot about it. You should 👍 here: npm/npm#6053 (comment).

from create-xo.

stevemao avatar stevemao commented on June 14, 2024

+1 but I would put it in posttest
Also `-s' means silent? Why silent it?

{
  "scripts": {
    "lint": "xo",
    "posttest": "npm run lint"
  }
}

from create-xo.

joakimbeng avatar joakimbeng commented on June 14, 2024

Without the silent flag you'll get two npm error sections, which is ugly in my opinion:

npm ERR! Darwin 14.0.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "run" "lint"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] lint: `xo`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint script 'xo'.
npm ERR! This is most likely a problem with the my-package package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     xo
npm ERR! You can get their info via:
npm ERR!     npm owner ls my-package
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/joakimbeng/my-package/npm-debug.log

npm ERR! Darwin 14.0.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "run" "test"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] pretest: `npm run lint`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] pretest script 'npm run lint'.
npm ERR! This is most likely a problem with the my-package package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run lint
npm ERR! You can get their info via:
npm ERR!     npm owner ls my-package
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/joakimbeng/my-package/npm-debug.log

With -s it just becomes:

npm ERR! Darwin 14.0.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "run" "test"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] pretest: `npm run -s lint`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] pretest script 'npm run -s lint'.
npm ERR! This is most likely a problem with the my-package package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run -s lint
npm ERR! You can get their info via:
npm ERR!     npm owner ls my-package
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/joakimbeng/my-package/npm-debug.log

from create-xo.

stevemao avatar stevemao commented on June 14, 2024

Oh OK, but I don't wanna silent the output from xo.

from create-xo.

joakimbeng avatar joakimbeng commented on June 14, 2024

The silent flag only affects npm's own output and not XO's

from create-xo.

stevemao avatar stevemao commented on June 14, 2024

yup, cool :)

from create-xo.

joakimbeng avatar joakimbeng commented on June 14, 2024

Putting it in posttest is ok with me, although in bigger packages/applications I think it's better the other way around. Because then the time to run the tests will probably exceed the linting time, and IMO it's a better experience to fail fast.

from create-xo.

stevemao avatar stevemao commented on June 14, 2024

The reason I want to put it in posttest is the same why I made this PR #6 unless npm-exec can land

from create-xo.

JaKXz avatar JaKXz commented on June 14, 2024

TIL $(npm bin) will give you the path to your installed executables...

e.g. $(npm bin)/rimraf *.* :trollface:

from create-xo.

sindresorhus avatar sindresorhus commented on June 14, 2024

Decided to pass on this: #8 (comment)

from create-xo.

Related Issues (6)

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.