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-sensible

v7.2.1

Published

Eslint config with sensible defaults

Downloads

55

Readme

eslint-config-sensible

THIS PROJECT IS NOT MAINTAINED.

npm License Travis branch

Dependency Status devDependency Status peerDependency Status

This package provides sensible shareable Eslint configs.

Usage

This package exports the following ESLint configurations for your usage.

sensible

Our default export contains all of our ESLint rules for ES6+.

It does not include rules for node, react or lodash. You need to add those from

respectively, if you need.

It requires:

  • eslint
  • eslint-plugin-import

You can extend/override the rules for this config. You can find the list of rules:

Installation:

  1. npm install --save-dev eslint-config-sensible eslint-plugin-import eslint
  2. add "extends": ["sensible"] to your .eslintrc.* config.

sensible/babel

This config is like default sensible config, but it also supports:

It does not include rules for node, react or lodash. You need to add those from

respectively, if you need.

It requires:

  • eslint
  • babel-eslint
  • eslint-plugin-babel
  • eslint-plugin-import

You can extend/override the rules for this config. You can find the list of rules:

Installation:

  1. npm install --save-dev eslint-config-sensible eslint-plugin-import eslint-plugin-babel babel-eslint eslint
  2. add "extends": ["sensible/babel"] to your .eslintrc.* config.

sensible/legacy

Lints ES5 and below.

It does not include rules for node, react or lodash. You need to add those from

respectively, if you need.

It requires:

  • eslint
  • eslint-plugin-import

You can extend/override the rules for this config. You can find the list of rules:

Installation:

  1. npm install --save-dev eslint-config-sensible eslint-plugin-import eslint
  2. add "extends": ["sensible/legacy"] to your .eslintrc.* config.

sensible/node

Lints Node.js code.

It includes Node.js rules only.

It requires:

  • eslint

You can extend/override the rules for this config. You can find the list of rules here.

Installation:

  1. npm install --save-dev eslint-config-sensible eslint
  2. add "extends": ["sensible/node"] to your .eslintrc.* config.

sensible/react

Lints React.js/JSX code.

It includes React/JSX rules only.

It requires:

  • eslint
  • eslint-plugin-react

You can extend/override the rules for this config. You can find the list of rules here.

Installation:

  1. npm install --save-dev eslint-config-sensible eslint-plugin-react eslint
  2. add "extends": ["sensible/react"] to your .eslintrc.* config.

sensible/lodash

Lints lodash v4 code.

It includes lodash rules only.

It requires:

  • eslint
  • eslint-plugin-lodash

It only supports the default import of lodash, e.g.

var _ = require('lodash') or import _ from 'lodash'

It does not support the usage of:

  • lodash/fp
  • import of separate methods, like
    • var map = require('lodash/map') or
    • var map = require('lodash').map
  • usage of a name, other than _ as your lodash identifier (can be changed, read below)

In your .eslintrc.* config you can change the lodash identifier, that this config is going to look for, like this:

{
  "extends": ["sensible/lodash"],
  "settings": {
    "lodash": {
      "pragma": "_" // default
    }
  }
}

You can extend/override the rules for this config. You can find the list of rules here.

Installation:

  1. npm install --save-dev eslint-config-sensible eslint-plugin-lodash eslint
  2. add "extends": ["sensible/lodash"] to your .eslintrc.* config.

You should combine these configurations(order does matter) to get the desired rulesets. For example:

ES6+, node and react(with jsx):

{
  "extends": ["sensible", "sensible/node" "sensible/react"]
}

ES6+ and lodash:

{
  "extends": ["sensible", sensible/lodash"]
}

ES5, node and react(with jsx):

{
  "extends": ["sensible/legacy", "sensible/node" "sensible/react]
}

Override config rule:

Overrides quotes: [2, "single"]

{
  "extends": ["sensible"],
  "rules": {
    "quotes": [2, "double"],
  }
}

Note for eslint-plugin-import rule, if you use default or legacy config.

It has import/no-unresolved rule enabled and by default uses Node.js resolver.

If you are going to use webpack with loaders specified in require/import, then you might want to install eslint-import-resolver-webpack.

If you use another module bundler, that lets you use custom paths in require/import, then you might want to read this.

Or you can disable this rule entirely, although I find it very useful.

{
  "extends": [
    "sensible" // or "sensible/legacy"
  ],
  "rules": {
    "import/no-unresolved": 0
  }
}

License

MIT License