This project was bootstrapped with Lerna.
@trazable/eslint-config is a collection of useful ESLint configs for much more convenient project developing:
- ๐งฉ Modular usage. Easily combine presets for the different technologies.
- ๐ Almost conflict free.
Here is the example for TypeScript Node project:
// .eslintrc
{
"extends": [
"@trazable/eslint-config-patch",
"@trazable/eslint-config-base",
"@trazable/eslint-config-typescript",
"@trazable/eslint-config-node"
]
}
@trazable/eslint-config
consists of many ESLint presets. They are designed to work with each other without any conflicts. In most cases, you only need to specify extends and parser fields. @trazable/eslint-config
will take care of composing it.
There are two basic presets - patch and base.
Almost every @trazable/eslint-config
preset has some plugins in its dependencies and uses them from there. Default ESLint module resolution behavior doesn't allow doing it this way. The patch preset fixes this problem. It uses @rushstack/eslint-patch
under the hood.
The base preset encapsulates some base plugins and rules. It is required for using other @trazable/eslint-config
presets.
The other presets are optional. Select them depending on your goals and project stack.
For example, the config for React project:
// .eslintrc
{
"extends": [
"@trazable/eslint-config-patch",
"@trazable/eslint-config-base",
"@trazable/eslint-config-react",
]
}
@trazable/eslint-config-patch
@trazable/eslint-config-base
@trazable/eslint-config-node
@trazable/eslint-config-typescript
@trazable/eslint-config-react
In most cases, you need @babel/eslint-parser
for JavaScript, and @typescript-eslint/parser
for Typescript.
Most often happens in monorepos. Rename your .eslintrc to .eslintrc.js and move patch config in the following way:
// .eslintrc.js
require("@trazable/eslint-config-patch")
module.exports = {
extends: [
"@trazable/eslint-config-base",
],
parser: "@babel/eslint-parser",
}
Specify your tsconfig.json location manually:
// .eslintrc
{
"extends": [
"@trazable/eslint-config-patch",
"@trazable/eslint-config-base",
"@trazable/eslint-config-typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
}
}
If it doesn't work, try this:
// .eslintrc.js
const path = require('path')
module.exports = {
extends: [
'@trazable/eslint-config-patch',
'@trazable/eslint-config-base',
'@trazable/eslint-config-typescript',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: [path.resolve(__dirname, './tsconfig.json')]
},
}
Steps to contribute:
- Fork the repo.
- Checkout to a new branch.
- Make changes, commit them.
- git push to your fork.
- Create a pull request into the main repo.
Steps to publish new version to npm:
- Clone the repo.
- Run
npm run release
. - Follow lerna promps