Skip to content

torchbox/eslint-config-torchbox

Repository files navigation

eslint-config-torchbox on npm Build Status

Shareable ESLint config following Torchbox’s code style.

Usage

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 https://github.com/torchbox/eslint-config-torchbox for rules. extends: 'torchbox', };

Tips

  • 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.

React

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 https://github.com/torchbox/eslint-config-torchbox 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.

Extends

Custom rules

Inherited rules

Contributing

See the contribution guidelines for guidance and setup instructions.

About

Shareable ESLint config following Torchbox’s code style

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •