@weareenvoy/eslint-config-envoy
v1.0.1
Published
Base ESLint config used by the ENVOY web team.
Downloads
250
Readme
ENVOY ESlint Config
Base ESLint config used by the ENVOY web team.
Background
This is an eslint shareable config that currently extends eslint:recommended, airbnb, and the standardjs configurations. There's always room for continued improvement so feel free to create an issue or pull request if you have any recommendations!
There is an npm command line package that may be used to install all the peer dependencies required by the above mentioned extended configurations. The repo for that is here. So, in those cases you would not need to manually install this config.
However, if you have the need, follow the instructions below.
Installing
ESLint shareable configs require additional packages to be installed along side it on the consuming 'host' project. This differs from the 'child' dependency relationship within a package where packages are listed under 'dependencies' and 'devDependencies' within the respective package.json
. Alternatively, many shareable configs will also include 'peerDependecies' that essentially say, "for me to run properly in your package I also need you to have these other packages installed along side me". The reasoning behind declaring a dependency vs. peerDependency relates to the dependency tree that npm creates. A nice brief article that touches on some aspects of dependency vs. peerDependency may be found here. In essence, use cases for peer dependencies help prevent duplication of packages in the npm dependency tree.
However, there is a caveat, which is maintaining compatibility with what we are extending and is why we can use the npm cli tool. It ensures that we are defining the required peer dependencies to match what is defined in the shareable configs we are extending (i.e. airbnb, standardjs).
Install:
install-peerdeps is a package that will install the defined peerDependencies in it's respective package.json
. It was created since peer dependencies were no longer automatically installed as of NPM v3.0.
npx is a built-in tool within npm
that provides the ability to run a packages executable commands (i.e. binaries) without having to globally install the package or use npm run scripts.
So, if you'd like to extend this config the below command will use install-peerdeps
to install the peer dependencies found in this package.json
as devDependencies in your project.
npx install-peerdeps @weareenvoy/eslint-config-envoy --dev
Alt install option:
Alternatively, if you happen to already include all the declared peer dependencies in your project you would not need to run the above and could either:
Install
npm i @weareenvoy/eslint-config-envoy --save-dev
or include in your package.json
"devDependencies": {
"@weareenvoy/eslint-config-envoy": "^1.0.0",
}
Usage
Add this config to the extends
property in your .eslintrc.*
file:
{
'extends': ['@weareenvoy/eslint-config-envoy'],
}
Add any rules you'd like to set for your project:
{
'extends': ['@weareenvoy/eslint-config-envoy'],
'rules': {
'some-rule': 0
}
}