0.4.0 • Published 2 years ago
eslint-config-ferfalk v0.4.0
eslint-config-ferfalk
Shared ESLint configurations.
Installation
JavaScript
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
TypeScript
Install JavaScript dependencies and additional TypeScript dependencies:
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-rxjs
Jest
Install additional Jest dependencies:
npm install --save-dev eslint-plugin-jest
Usage
ESLint
Create .eslintrc.json file:
JavaScript
{
"root": true,
"extends": ["ferfalk"]
}
TypeScript
{
"root": true,
"extends": ["ferfalk/typescript"]
}
The TypeScript configuration already extends the JavaScript configuration.
Jest
If Jest is configured, add ferfalk/jest rules:
{
"extends": ["ferfalk/typescript", "ferfalk/jest"]
}
Works with JavaScript or TypeScript rules.
Prettier
Set your Prettier configuration, for @ferfalk/prettier-config add the prettier property on package.json:
{
"prettier": "@ferfalk/prettier-config"
}
lint-staged
This project also publishes lint-staged configurations for JavaScript and TypeScript. Create a lint-staged.config.js file:
ESM:
import jsConfig from 'eslint-config-ferfalk/lint-staged-javascript.js';
import tsConfig from 'eslint-config-ferfalk/lint-staged-typescript.js';
export default {
...jsConfig,
...tsConfig,
};
CommonJS:
const jsConfig = require('eslint-config-ferfalk/lint-staged-javascript.js');
const tsConfig = require('eslint-config-ferfalk/lint-staged-typescript.js');
module.exports = { ...jsConfig, ...tsConfig };