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

eslint-config-silent

v0.30.0

Published

Silence all rules that you don't have to care about.

Downloads

389

Readme

eslint-config-silent Actions Status

ESLint is annoying sometimes, but if a rule is:

  • Fully automatic fixable.
  • Automatic fix is reliable.
  • Against the rule won't cause runtime error.

Then why you have to care about it? Just let ESLint do the job, you don't need be bothered.

Installation

You can install it via yarn or npm.

$ yarn add eslint-config-silent --dev
$ npm install eslint-config-silent --save-dev

Usage

This config only turns rules off, but you don't want to keep them off all the time, so you should use a environment variable to control it.

.eslintrc.js

'use strict';

const config = {
  root: true,
  extends: 'some-other-config-you-use',
};

if (process.env.NODE_ENV !== 'production') {
  config.extends = [config.extends, 'silent'];
}

module.exports = config;

And you need a chance to let ESLint fix them, lint-staged is a great tool that allows you to do that.

package.json

{
  "lint-staged": {
    "*.js": ["cross-env NODE_ENV=production eslint --fix", "git add"]
  }
}

And that's it, enjoy your silent ESLint (cross-env is a tool that set environment variables across platforms).

A few ESLint plugins are supported as well:

Add extra exclusions for the plugins you use like so:

.eslintrc.js

'use strict';

const config = {
  root: true,
  extends: 'some-other-config-you-use',
};

if (process.env.NODE_ENV !== 'production') {
  config.extends = [
    config.extends,
    'silent',
    'silent/@babel',
    'silent/@typescript-eslint',
    'silent/ava',
    'silent/flowtype',
    'silent/import',
    'silent/prettier',
    'silent/react',
    'silent/unicorn',
    'silent/vue',
  ];
}

module.exports = config;

If you extend a config which uses a plugin, it is recommended to add 'silent/that-plugin' (if available). For example, eslint-config-airbnb enables eslint-plugin-react rules, so 'silent/react' is recommended:

.eslintrc.js

'use strict';

const config = {
  root: true,
  extends: 'airbnb',
};

if (process.env.NODE_ENV !== 'production') {
  config.extends = [config.extends, 'silent', 'silent/react'];
}

module.exports = config;

If you’re unsure which plugins are used, you can usually find them in your package.json.

FAQ

What if someone uses git commit --no-verify ?

You can set a CI job to lint your code (without --fix parameter), so if some code is not fixed, you will know. Like this repo.

How can I override my custom rules?

You can write .eslintrc.js like this:

'use strict';

const silent = require('eslint-config-silent');

const config = {
  root: true,
  extends: 'some-other-config-you-use',
  rules: {
    'your-custom-rule': 'error',
  },
};

if (process.env.NODE_ENV !== 'production') {
  config.rules = [...config.rules, ...silent.rules];
}

module.exports = config;

Contributing

If you find a rule should or shouldn't be included in this config, please open a issue.

Credits

This config is inspired by eslint-config-prettier.

License

MIT