npm install @carforyou/eslint-config
Add a lint
script to package.json
:
"lint": "eslint --ext ts,js,tsx,jsx,json ."
Add a format
script to package.json
to be able to use auto fix:
"format": "npm run lint -- --fix",
Create .eslintrc.js
in the root of the project:
module.exports = {
extends: ["@carforyou/eslint-config"],
}
This package provides multiple eslint configurations. They build on top of one another so there's no need to include multiple ones.
- If you're working on plain typescript project use the default:
@carforyou/eslint-config
- If you're working on react project use:
@carforyou/eslint-config/react
- For nextjs applications use:
@carforyou/eslint-config/next
Create .prettierrc.js
in the root of the project:
module.exports = {
...require("@carforyou/eslint-config/prettier"),
}
There's an official eslint plugin available to get notifications about linter errors.
You can add:
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
to your settings.json
to fix fixable eslint errors on file save. This will only fix things that can be auto-fixed. It also might take some time.
There is a pretty good prettier formatter available. This will add prettier
as an option to format document via command palette.
You can also set prettier as default formatter for javascript, typescript and react files. Just add:
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
to your settings.json
.
You can enable formatting on save under Settings
-> Text Editor
-> Formatting
.
npm run build
You can link your local npm package to integrate it with any local project:
cd carforyou-eslint-config
npm run build
cd carforyou-listings-web
npm link ../carforyou-eslint-config
New versions are released on the ci using semantic-release as soon as you merge into master. Please make sure your merge commit message adheres to the corresponding conventions.
You will need to enable the repository in circle CI ui to be able to build it.
For slack notifications to work you will need to provide the token in circle settings.