Skip to content
Shareable ESLint config following Torchbox’s code style
JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

eslint-config-torchbox ESLint

eslint-config-torchbox on npm Build Status

Shareable ESLint config following Torchbox’s code style.


Install the config along with its peer dependencies:

npx install-peerdeps --dev eslint-config-torchbox@latest

Then configure ESLint to use this config. As a .eslintrc.js in the root of your project:

module.exports = {
  // See for rules.
  extends: 'torchbox',


  • Use ESLint’s --report-unused-disable-directives flag to ensure you do not use more eslint-disable comments than needed.
  • This config is Prettier-compatible, but it is still usable by projects which do not wish to use Prettier.
  • We recommend using a .eslintignore so ESLint can be targeted at all files, with a blacklist of files to ignore.

Here’s a package.json run script and an ignore file to get you started:

"lint:js": "eslint --report-unused-disable-directives .",

.eslintignore (adapt to your project):


Note the point of the ignore file isn’t just to determine which JS files we don’t want to be linted, but also speed up linting by excluding large folders.


This config is meant first and foremost for React projects, where it will detect which rules to apply based on the version of React used on the project. The config can also be used on non-React projects – just make sure to disable the version check by adding: the following in your config:

module.exports = {
  // [...]
  settings: {
    // Manually set the version to disable automated detection of the "react" dependency.
    react: { version: 'latest' },

Experimental syntax

By default, this config uses ESLint’s built-in parser, which doesn’t support experimental ECMAScript features. If your code uses experimental syntax transpiled with Babel, make sure to set the ESLint parser to babel-eslint:

module.exports = {
  // See for rules.
  extends: 'torchbox',
  // Support non-standard, experimental JS features that Babel knows how to process.
  parser: 'babel-eslint',

What’s included

See config.js for the config definition, and semver.test.js.snap for the whole set of rules and settings.


Custom rules

Inherited rules


See the contribution guidelines for guidance and setup instructions.

You can’t perform that action at this time.