The Arctic Ice Studio JavaScript Style Guide rules with support for React as an extensible ESLint configuration.
This package implements the rules of the Arctic Ice Studio JavaScript style guide as an extensible shared ESLint configuration with plugin support for React, its Hooks and JSX A11Y.
Getting Started
To only use the ESLint core and eslint-plugin-import
rules, please use the base configurations of the @arcticicestudio/eslint-config-base package.
Note that this package uses npm version 7.7.0 or higher as the main package manager, but the documentations also include instructions to work with Yarn (classic / v1
).
Installation
Add the package as development dependency to your project:
# With npm...
npm install --save-dev @arcticicestudio/eslint-config
# or Yarn.
yarn add --dev @arcticicestudio/eslint-config
Note that peer dependencies, like the remark-lint package itself, are only installed automatically when using a npm version equal or higher than 7.0.0
, otherwise they must be installed separately like described in the peer dependencies section below.
See the Node distribution index for more information about which npm version is bundled with which Node version.
Peer Dependencies
This package depends on the eslint-plugin-react and eslint-plugin-jsx-a11y packages that are defined as peer dependencies. Since this configuration is build on top of the base rules package, the additional eslint-plugin-import peer dependency is also required.
>=7.0.0
npm versions As of npm version 7.0.0
, peer dependencies are installed automatically and does not require any additional steps.
>=5.0.0 <7.0.0
npm versions For npm version equal to or higher than 5.0.0
(pre-bundled with Node.js 8) but less than 7.0.0
, all peer dependencies can be auto-installed using the pre-bundled npx
package:
npx install-peerdeps --dev @arcticicestudio/eslint-config
<5.0.0
npm versions If you’re using a npm version less than 5.0.0
, the npx
package is not pre-bundled, but users can either simply install the npx
package globally to run the above command or use the install-peerdeps helper package locally/globally to let it handle the installation of all peer dependencies:
# Install and use the "install-peerdeps" helper package locally...
npm install install-peerdeps
./node_modules/.bin/install-peerdeps --dev @arcticicestudio/eslint-config
# ...or globally.
npm install --global install-peerdeps
install-peerdeps --dev @arcticicestudio/eslint-config
To install all peer dependencies manually without npx
or any helper package, the npm info
command can be used to get a list of all packages and their versions:
# List the names and versions of all peer dependencies...
npm info "@arcticicestudio/eslint-config" peerDependencies
# ...and install each listed package manually.
npm install PACKAGE@VERSION
Using Yarn instead of npm
If you’re not using npm but Yarn, peer dependencies can be installed by either adding them manually or using the install-peerdeps helper package:
# Either add all packages manually by listing all required names and their versions and install them manually...
yarn info @arcticicestudio/eslint-config peerDependencies
yarn add --dev remark-lint #...
# ...or use the "install-peerdeps" helper package.
yarn add --dev install-peerdeps
yarn run install-peerdeps --dev @arcticicestudio/eslint-config
Usage
This package provides a shareable configuration preset that can be used by extending the ESLint configuration file. Add @arcticicestudio/eslint-config
and/or any of the additional entry points to the extends
array in your .eslintrc
configuration file:
module.exports = {
extends: [
/* Provides all base rules and specific rules for "React" and "JSX A11Y". */
"@arcticicestudio/eslint-config"
/*
* Optional entry point to enable support for projects using React Hooks.
*/
"@arcticicestudio/eslint-config/react-hooks"
]
};
Entry Points
This package provides multiple entry points that can be composed especially for the projects they are used in:
-
@arcticicestudio/eslint-config
— The default entry point that includes the base rules of the @arcticicestudio/eslint-config-base package as well as additional rules from the eslint-plugin-react and eslint-plugin-jsx-a11y packages. -
@arcticicestudio/eslint-config/react-hooks
— Entry point to enable support for React Hooks through eslint-plugin-react-hooks.
Contributing
Please read the contribution guidelines of the Arctic Ice Studio JavaScript style guide project for detailed information.
Copyright © 2018-present Arctic Ice Studio and Sven Greb