@gpa-lab/eslint-config
An ESLint configuration conforming to the GPA/LAB style guide
Last updated 19 days ago by mrewers .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @gpa-lab/eslint-config 
SYNC missed versions from official npm registry.

GPA/LAB ESLint Config

This package provides an opinionated but extensible ESLint configuration that enforces the JavaScript coding preferences defined by the GPA/LAB style guide.

Installation

Run the following command from the root of your project to install the config.

npm install @gpa-lab/eslint-config --save-dev

There are a number of peer dependencies listened for this project. Namely:

Please note that several of these peer dependencies pertain only to the optional React and Prettier configurations available as sub-packages (see more details below).

To install the minimum dependencies required for the base configuration run the command:

npm i -D eslint eslint-plugin-import eslint-plugin-jest

If you intend to also use the React sub-package, run the following install the React-specific plugins as well:

npm i -D eslint eslint-plugin-import eslint-plugin-jest eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks

If you intend to use the Prettier configuration, we recommend installing all the dependencies by running:

npm i -D eslint eslint-plugin-import eslint-plugin-jest eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks prettier

(Note: If using the Prettier sub-package without the React sub-package, you can omit the eslint-plugin-jsx-a11y and eslint-plugin-react-hooks plugins, but eslint-plugin-react is still required as the Prettier ruleset refers to it.)

Usage

Basic

Once installed, add an .eslintrc file to your project root and extend the GPA/LAB eslint-config as such:

{
  "extends": ["@gpa-lab/eslint-config"]
};

This will apply the base ruleset to your project.

Note: More details on configuring ESLint for you project can be found in ESLint's official documentation.

Sub-packages

React

This optional package includes an additional set of rules pertaining to React applications. To enable the React sub-package, add @gpa-lab/eslint-config/react to the extends array as such:

{
  "extends": ["@gpa-lab/eslint-config", "@gpa-lab/eslint-config/react"]
};

The React sub-package depends on some ESLint plugins not needed by the base configuration. If you did not install them during the initial setup, you will need to run the following command to install these required peer dependencies.

  npm i -D eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks

Prettier

This package bundles the base rules with additional settings to optimize integration with the Prettier formatting tool. To enable the Prettier configuration, add @gpa-lab/eslint-config/prettier to the extends array as such:

{
  "extends": ["@gpa-lab/eslint-config/prettier"]
};

This this extension includes the ruleset provided by the base configuration, so you do not have to also import @gpa-lab/eslint-config. Please note that if you are using this configuration in conjunction with any other ruleset (including the React sub-package), make sure that it is listed last in the extends array.

The Prettier sub-package depends on some additional packages not needed by the base configuration. If you did not install them during the initial setup, you will need to run the following command to install these required peer dependencies.

  npm i -D eslint-plugin-prettier eslint-plugin-react prettier

If using the Prettier sub-package, we also recommend installing our prettier-config for complete consistency.

Cypress

This optional package extends the base ESLint rules from this package, adding a ruleset for the Cypress end-to-end testing tool and removing the Jest ruleset (which can conflict with Cypress rules). As such, it should be used in lieu of, rather than in addition to the base configuration. We recommend putting a distinct .eslintrc in the cypress directory and setting it to root so that it does not conflict with your project-wide .eslintrc. The result should look something like:

{
  "extends": ["@gpa-lab/eslint-config/cypress"],
  "root": true
};

The Cypress sub-package depends on the Cypress ESLint plugin which can be installed by running the following command:

  npm i -D eslint-plugin-cypress

Current Tags

  • 1.2.1                                ...           latest (19 days ago)

8 Versions

  • 1.2.1                                ...           19 days ago
  • 1.2.0                                ...           23 days ago
  • 1.1.2                                ...           a month ago
  • 1.1.1                                ...           a month ago
  • 1.1.0                                ...           a month ago
  • 1.0.0                                ...           a month ago
  • 0.1.1                                ...           5 months ago
  • 0.1.0                                ...           5 months ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 31
Last Day 0
Last Week 8
Last Month 57
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |