ORDERFOX ESLint Config
This is the updated ORDERFOX ESLint shareable config, based off the eslint-config-airbnb
package.
It targets ES6+ and React projects, in the future if we need it we can have "sub-configurations" inside this one depending on the type of project.
For starters, I went with what we are already using. If you come across any issues, please refer to the github or Slack (hopefully both).
Installation on our projects
1 | Install the package
npm install @orderfox/eslint-config-orderfox
NOTE: You need to be logged in to npm on your terminal for this command to work, since it's a private package.
2 | Install the dependencies
After this, you need to install the correct versions of each peerDependency package.
These can be listed using:
npm info "@orderfox/eslint-config-orderfox@latest" peerDependencies
But doing it manually may take a while, so here is a shortcut for Linux and Mac.
- Linux & Mac
(
export PKG=@orderfox/eslint-config-orderfox;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
- Windows
Supposedly using a package like install-peerdeps would work, but since we are using a private package you would need to pass a npm token to that tool.
I tested it when I created this project and couldn't get it work. So you would need to list the dependencies and install them manually.
Remember, to list all the dependencies run this:
npm info "@orderfox/eslint-config-orderfox@latest" peerDependencies
Then for each one:
npm install --save-dev <DEPENDENCY>
3 | Use it
Add the config to your .eslintrc
or .eslintrc.js
(or whatever option the project has):
{
"extends": "@orderfox/eslint-config-orderfox"
}