ESLint shareable config
$ npm install --save-dev eslint babel-eslint eslint-config-pier1
Once the eslint-config-pier1
package is installed, you can use it by specifying pier1
in the extends
section of your ESLint configuration.
{
"extends": "pier1",
"rules": {
// Additional, per-project rules...
},
"globals": {
// Additional, per-project `no-undef` ignores...
}
}
There are several rules in the eslint:recommended
ruleset that you might want to override and enforce in your project.
To use Pier 1 Imports style in conjunction with ESLint's recommended rule set, extend them both, making sure to list pier1
last:
{
"extends": ["eslint:recommended", "pier1"],
"rules": {
// Additional, per-project rules...
},
"globals": {
// Additional, per-project `no-undef` ignores...
}
}
To see how the pier1
config compares with eslint:recommended
, refer to the source code of index.js
, which lists every ESLint rule along with whether (and how) it is enforced by the pier1
config.
Using the pier1
config with eslint-plugin-demandware
Demandware has numerous globals that need to be defined so that ESLint will not warn about their usage.
Once the eslint-plugin-demandware
package is installed, you can use it by specifying demandware
in the plugins
and demandware/globals
in the env
section of your ESLint configuration.
{
"extends": ["eslint:recommended", "pier1"],
"rules": {
// Additional, per-project rules...
},
"plugins": [
// Additional, per-project plugins...
"demandware"
],
"env": {
// Additional, per-project environments...
"demandware/globals": true
},
"globals": {
// Additional, per-project `no-undef` ignores...
}
}
Licensed under the MIT License.
Copyright (c) 2017 Pier 1 Imports, Inc.