@kmhgmbh/eslint-config v2.0.2
@kmhgmbh/eslint-config
Rules
The main rule set is a modified airbnb-base
.
Based on that, this package includes extended rule sets:
@kmhgmbh/eslint-config/frontend
adds frontend- and Vue-specific rules@kmhgmbh/eslint-config/backend
adds backend-specific rules@kmhgmbh/eslint-config/jest
adds rules and configuration for Jest based tests@kmhgmbh/eslint-config/typescript
adds TypeScript-specific rules@kmhgmbh/eslint-config/typescript-frontend
is used for Vue projects written in TypeScript@kmhgmbh/eslint-config/cdk
adds AWS CDK specific rules to TypeScript and Jest rule sets
There is an additional rule set that enables settings specific to jest. If you use
jest in your project, you should extend your .eslintrc
further, e.g.:
"extends": [
"@kmhgmbh/eslint-config/backend",
"@kmhgmbh/eslint-config/jest",
]
Usage
You need a minimal eslint configuration in your project that extends one of the rule sets in this package.
The easiest way is to put it in your package.json
:
"eslintConfig": {
"extends": "@kmhgmbh/eslint-config"
}
You can, of course, use a separate .eslintrc
…
{
"extends": "@kmhgmbh/eslint-config"
}
… or .eslintrc.js
:
module.exports = {
extends: '@kmhgmbh/eslint-config',
};
You probably also need an npm script in your package.json tu run eslint, e.g.:
"scripts": {
"lint": "eslint --ext .ts,.js,.vue src test"
}
Which would run eslint on all files ending in .js
, .ts
or .vue
found in src/
and test/
.
Installation
npm install -D eslint eslint-plugin-import @kmhgmbh/eslint-config
Optional Peer Dependencies
Depending on the rule set you use, you need to install additional dependencies:
@kmhgmbh/eslint-config/jest
needseslint-plugin-jest
@kmhgmbh/eslint-config/frontend
needseslint-plugin-vue
@kmhgmbh/eslint-config/typescript
needs@typescript-eslint/eslint-plugin
You only need to install peer dependencies for the rule sets you're using, even though npm will warn you about missing optional peer dependencies.