npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

autoslap

v0.4.0

Published

Install and configure ESLint, Prettier, lint-staged and Husky with one command

Downloads

12

Readme

autoslap

Install and configure ESLint, Prettier, lint-staged and Husky with one command

Build Status NPM Codecov Dependencies

Note

You might want to use mrm instead. It's more powerful and if I had time I'd probably go in this direction with autoslap.

About

I'm sure that majority of JavaScript developers use ESLint, probably a good amount of developers use Prettier and some of them use Husky and lint-staged (if you're one of those who don't - you should, but bear with me before you start running these npm installs). Combination of these 4 tools gives a very solid foundation for any JavaScript project - you don't have to worry about inconsistent code style or possibly buggy code in your repo anymore, because Prettier and ESLint will be run before every commit.

The main problem is that if you're creating a new project you have to configure all of that and spend some time that you could spent ~~procrastinating~~ actually writing the code. It's not as complicated as, say, Webpack configuration, but it's still something that could be automated.

That's where autoslap comes in. All you have to do is run autoslap it in your project's main directory... and that's it. It also works with existing projects: ones that were just created (e.g. using create-react-app), ones with already existing tooling (e.g. only eslint and prettier) and ones which don't even have a package.json yet. autoslap installs these packages and adds a basic config to your package.json, which you can tweak anytime.

If you're installing both eslint and prettier, eslint-plugin-prettier and eslint-config-prettier will also be installed and configured.

In the near future you'll also be able to save a profile with your own preferred config for each of these tools.

Install

npm install -g autoslap or yarn global add autoslap

Usage

After installing the package, go to the main directory of your project and run autoslap. This should be enough in 99% of the cases. If your project was just initialized and has no dependencies, you might want to run it with flag --yarn to make sure it's installed with yarn instead of npm. By default, autoslap checks if you have a yarn.lock file in your directory - if so, it will use yarn, otherwise it will use npm.

You can also disable installing some tools by using flags --no-<tool>, e.g. autoslap --no-eslint will not install or configure anything related to ESLint. All available options can be checked out by running autoslap --help.

TODO

  • Saving own config(s)
  • Handling external config files (.prettierrc etc.)
  • Should it configure tools if they're installed but not configured?
  • Typescript support in ESLint (before you ask: I'm not planning supporting TSLint) - should it be even handled at all?
  • Automatic Prettier exclusions based on installed plugins (maybe includes the point above?)

Name

You might be wondering why this package is named that way. It's an acronym for "automatic staged linting and prettyfying". Expanded name doesn't really make much sense, but autoslap sounds catchy to me. You can also think about it as a slap to the ugly code in your repo, you won't be seeing it again. And the slap will be fully automated!

License

MIT

Paweł Dąbrowski © 2019