1.0.8 • Published 3 years ago
@default-konfig/eslint-config-base v1.0.8
Config ESLINT
ESLint statically analyzes your code to quickly find problems and auto-fix them if it can.
Installation:
Install package && dependencies:
npm i @default-konfig/eslint-config-base eslint eslint-config-prettier eslint-plugin-import eslint-plugin-prettier eslint-import-resolver-typescript @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser eslint-plugin-eslint-comments eslint-plugin-jest eslint-plugin-jest-formatting -D
Create config file:
echo 'module.exports = {
extends: ['@default-konfig/eslint-config-base'],
rules: {},
}' >> .eslintrc.js
Content:
Our Eslint base config use prettier, typescript-eslint and eslint-plugin-import
- Prettier to use prettier config as eslint rules to format code with opinionated code style => see Why prettier
- Typescript to add good typing practice and resolve module with current tsconfig file
- Eslint-plugin-import to sort and add good practice rules with import
Rules trouble:
@typescript-eslint/restrict-template-expressions
: For logging it is much clear to not stringify and log object instead, like this example: this.logger.debug(${BaseMongoDataSource.TAG}/${this.collectionName} findOne(%o)
, filter)