JSPM

  • Created
  • Published
  • Downloads 4147
  • Score
    100M100P100Q126953F
  • License MIT

A midly opinionated collection of the best lesser known esLint plugins that every project should include

Package Exports

  • eslint-config-adjunct

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-config-adjunct) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

eslint-config-adjunct

A mildly opinionated collection of the best esLint plugins to use alongside your main eslint configuration.

This config is designed to be used alongside any of the major esLint configs, such as airbnb, standard or eslint:recommended. It provides a range of useful plugins that are often too time consuming to setup and provides an easy way to install just the plugins you need on your project.

Install

To install this config, run the following command.

npm install eslint-config-adjunct --save-dev

Configure

Extend your .eslintrc, with adjunct, which should be the last item in the extends array. For example if your using eslint-config-airbnb as your main rule set, your .eslintrc should look like this:

{
  "extends": ["airbnb", "adjunct"]
}

You can now include html, json and markdown in the list of files passed to esLint to have any contained JavaScript linted.

{
  "scripts": {
    "eslint": "eslint --color *.{html,js,json,jsx,md} src/*.{html,js,json,jsx,md}",
    "eslint:fix": "npm run eslint -- --fix"
  }
}

Install Dependencies

After you have configured eslint to include this package, the first time you run eslint it will output the npm command to install the dependancies required for your project. Cut'n'paste this command into the console, and you are then ready to start linting.

Plugins

Base Plugins

The following esLint plugins are always loaded in this configuration:

Library Plugins

These plugins will be loaded in based on your project dependencies in package.json. If a supported library is part of your project then it's related esLint plugins will be loaded. The following packages are supported:

Prettier

If prettier is installed, any rules that may conflict with setting in Prettier will be disabled. The plugin should read you Prettier config from your projects route.

Test Libraries

Test plugins are loaded based on which testing tools you have listed in devDependencies of package.json. The following test plugins are supported:

Rules

In the most part the default rules are used for the plugins listed above, with the following exceptions.

Markdown

When linting code snippets in Markdown files, a few rules relating to globals and unused vars are disabled.

Switch-Case

Adds the fallthrough: 'never' option to the the newlint-between-switch-case rule.

// Good

switch (foo) {
  case 1:
    something()
    break

  case 2:
  case 3:
    somethingElse()
    break

  default:
    defaultThing()
}

Disabled rules

The following rules are disabled due to them being considered unduely restrictive or unhelpful.

  • jest/no-disabled-tests
  • react-redux/prefer-separate-component-file
  • redux-saga/no-unhandled-errors

License

Copyright © 2019-20 David J. Bradshaw. Licensed under the MIT License.