ESLint configuration to use
This package includes 1 ESLint Config:
- config-frontend
npm i -D @luanelioliveira/eslint-config
You can also install a specific version of the package by appending the version tag. For example, to install version 1.0.0
npm i -D @luanelioliveira/eslint-config@1.0.0
npm i -D eslint prettier typescript
Add .eslintrc
to project root
{
"extends": "@luanelioliveira/eslint-config/config-frontend"
}
Add .prettierrc
to project root
{
"printWidth": 120,
"singleQuote": true,
"semi": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
Optional: If there are any files you want to exclude from Prettier, add .prettierignore
to project root
Add .editorconfig
to project root
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
max_line_length = 120
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = 0
trim_trailing_whitespace = false
Add the node engine to package.json
{
"engines": {
"node": "^16.0.0"
}
}
Add scripts for linting and formatting to package.json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,scss,md,graphql}\"",
"format:check": "prettier --debug-check \"src/**/*.{ts,tsx,js,jsx,json,css,scss,md,graphql}\""
}
}