eslint-config-forcir v3.0.0
Install
yarn add eslint-config-forcir --dev --exact
Peer Dependencies
yarn add typescript prettier eslint jest lint-staged husky --dev --exact
.eslintrc
file in project root
{
// Can be any of: `forcir`, `forcir/backend`, `forcir/frontend`, `forcir/next`
"extends": "forcir/backend"
}
If there are any files you want to exclude from ESLint add
.eslintignore
to project root
Configurations
This package includes 3 guaranteed files of shared rules.
This package also may contain up to 3 additional files that use rules or overrides considered experimental. These do not adhere to semantic versioning (SEMVER). They may be removed at any point without warning.
Next.JS Full-Stack Websites / Applications
forcir/next
forcir/next-experimental
React Frontend-only Applications
forcir/frontend
forcir/frontend-experimental
Node Backend-only APIs / Serverless
forcir/backend
forcir/backend-experimental
.prettierrc
file in project root
{
"printWidth": 120,
"singleQuote": true
}
If there are any files you want to exclude from Prettier add
.prettierignore
to project root
.editorconfig
file in project root
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true
[*.md]
max_line_length = 0
trim_trailing_whitespace = false
[COMMIT_EDITMSG]
max_line_length = 0
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4
Add the engines
field to package.json
"engines": {
"node": ">=16.14",
"npm": ">=8.5.2",
"yarn": ">=1.22.17"
}
Add linting and formatting scripts
"scripts": {
// ...
"format": "prettier --write \"**/*.{ts,tsx,js,json,graphql,md}\"",
"format:check": "prettier --debug-check \"**/*.{ts,tsx,js,json,graphql,md}\"",
"format:quick": "pretty-quick",
"lint": "eslint .",
"lint:staged": "lint-staged",
"prepare": "husky install"
},
Add pre-commit husky hook
For automatically linting and formatting any files staged for commit
npx husky add .husky/pre-commit "yarn run lint:staged"
.lintstagedrc
file in project root
{
"*.{ts,tsx,js}": ["eslint --quiet", "git add"],
"*.{ts,tsx,js,json,graphql,md}": ["prettier --write", "git add"]
}
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago