Install the package, and it's peer dependencies.
npm install eslint prettier @craigmorrison/eslint-config --save-dev
Add the required packages to the extends
object in your ESLint config file.
You should always import the base config.
{
"extends": "@craigmorrison/eslint-config"
}
For additional features, add the relevant files.
{
"extends": [
"@craigmorrison/eslint-config",
"@craigmorrison/eslint-config/typescript",
"@craigmorrison/eslint-config/jest",
"@craigmorrison/eslint-config/react"
]
}
Write a prettier config file in JavaScript (e.g. prettier.config.js
) and spread the imported config object into the one for you project. You can add any overrides or additional rules on subsequent lines.
'use strict';
const baseConfig = require('@craigmorrison/eslint-config/prettier.config.js');
module.exports = {
...baseConfig
};