Shared ESLint configurations.
Install dependencies:
npm install --save-dev eslint-config-ferfalk eslint eslint-plugin-eslint-comments eslint-plugin-n eslint-plugin-prettier eslint-plugin-promise eslint-plugin-sonarjs prettier prettier-eslint eslint-config-prettier @ferfalk/prettier-config
Install JavaScript dependencies and additional TypeScript dependencies:
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-rxjs
Install additional Jest dependencies:
npm install --save-dev eslint-plugin-jest
Create .eslintrc.json file:
{
"root": true,
"extends": ["ferfalk"]
}
{
"root": true,
"extends": ["ferfalk/typescript"]
}
The TypeScript configuration already extends the JavaScript configuration.
If Jest is configured, add ferfalk/jest rules:
{
"extends": ["ferfalk/typescript", "ferfalk/jest"]
}
Works with JavaScript or TypeScript rules.
Set your Prettier configuration, for @ferfalk/prettier-config add the prettier property on package.json:
{
"prettier": "@ferfalk/prettier-config"
}
This project also publishes lint-staged configurations for JavaScript and TypeScript. Create a lint-staged.config.js file:
import jsConfig from 'eslint-config-ferfalk/lint-staged-javascript.js';
import tsConfig from 'eslint-config-ferfalk/lint-staged-typescript.js';
export default {
...jsConfig,
...tsConfig,
};
const jsConfig = require('eslint-config-ferfalk/lint-staged-javascript.js');
const tsConfig = require('eslint-config-ferfalk/lint-staged-typescript.js');
module.exports = { ...jsConfig, ...tsConfig };