eslint-config-tomfa
v0.0.2
Published
A set of eslint-configs for personal projects, forked from @otovo/eslint-config-otovo.
Downloads
2
Readme
Tomfa eslint config
This repo contains sets of opinionated linting rules (eslint-configs) for Tomfa projects.
Installing
npx install-peerdeps --dev @tomfa/eslint-config-tomfa
# Alternatively, install correct version of each package listed by:
npm info "@tomfa/eslint-config-tomfa@latest" peerDependencies
Quick start
Depending on your project, add one of these to your .eslintrc
file:
- Pure JS:
@tomfa/eslint-config-tomfa
- React JS:
@tomfa/eslint-config-tomfa/react-recommended
- Typescript:
@tomfa/eslint-config-tomfa/typescript-recommended
- React with Typescript:
@tomfa/eslint-config-tomfa/react-typescript-recommended
Example .eslintrc
using React with Typescript:
{
"env": { "browser": true },
"extends": ["@tomfa/eslint-config-tomfa/react-typescript-recommended"]
}
Slow start
@tomfa/eslint-config-tomfa
consists of several small sets of rules:
- javascript
- react
- typescript
- prettier
- prettier-react
- prettier-typescript
For a given project, you will probably need several of them. For example: If you want to add javascript
and react
, prettier
and prettier-react
to your repo, add the following to your .eslintrc
config:
{
"env": {
"browser": true
},
"extends": [
"@tomfa/eslint-config-tomfa/javascript",
"@tomfa/eslint-config-tomfa/react",
"@tomfa/eslint-config-tomfa/prettier",
"@tomfa/eslint-config-tomfa/prettier-react"
]
}
Recommended sets
Instead of adding rule sets one by one, you can use one of four collections:
@tomfa/eslint-config-tomfa
@tomfa/eslint-config-tomfa/react-recommended
@tomfa/eslint-config-tomfa/typescript-recommended
@tomfa/eslint-config-tomfa/react-typescript-recommended
You use collections in the same way you add rule sets: By adding them to the extends
array in .eslintrc
:
{
"env": {
"browser": true
},
"parser": "@typescript-eslint/parser",
"extends": ["@tomfa/eslint-config-tomfa/react-typescript-recommended"]
}
The following is a overview of the rules each collection includes:
| | default
| react-recommended
| typescript-reecommended
| react-typescript-recommended
|
| ------------------- | --------- | ------------------- | ------------------------- | ------------------------------ |
| javascript | ✅ | ✅ | ✅ | ✅ |
| prettier | ✅ | ✅ | ✅ | ✅ |
| react | | ✅ | | ✅ |
| prettier-react | | ✅ | | ✅ |
| typescript | | | ✅ | ✅ |
| prettier-typescript | | | ✅ | ✅ |
Publishing
This package is hosted on npm under @tomfa/eslint-config-tomfa namespace and is published using np
. To publish a new version, run
yarn run release
Doing so guides you through publishing to npm, pushing tags to Github and create release notes.