@mvf/eslint-config-mvf-typescript-node
v2.0.6
Published
Package for MVF node typescript linting standards
Downloads
57
Maintainers
Keywords
Readme
MVF ESLINT CONFIG FOR TYPESCRIPT
Package for MVF node typescript linting standards
Install MVF eslint config in your application
npm install -D @mvf/eslint-config-mvf-typescript-node
npx install-peerdeps --dev @mvf/eslint-config-mvf-typescript-node
or
yarn add -D @mvf/eslint-config-mvf-typescript-node
yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-airbnb-typescript eslint-config-prettier eslint-plugin-import eslint-plugin-prettier prettier
Enable MVF linter
Create .eslintrc.js
file in your root directory and paste the below:
module.exports = {
...require("@mvf/eslint-config-mvf-typescript-node").eslint,
};
Create .prettierrc.js
file in your root directory and paste the below:
module.exports = {
...require("@mvf/eslint-config-mvf-typescript-node").prettier,
};
Install eslint vscode extension and paste the below to your vscode settings json:
{
...,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{"language": "typescript", "autoFix": true },
{"language": "typescriptreact", "autoFix": true }
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
...
}
You can add the below scripts in the package.json
to run the linter:
"lint": "eslint './src/**/*.ts'" // list lint issues without fixing them
"lint:fix": "npm run lint -- --fix" // fix lint errors automatically when possible and list remaining lint issues
You might need to restart VS Code to see the warnings and errors highlighted in your code.
You can also setup pre-commit checks if you want to:
Setup pre-commit checks, add the following to your package.json
:
{
"dependencies": { ... },
"husky": {
"hooks": {
"pre-commit": "lint-staged && tsc --noEmit && npm test"
}
},
"lint-staged": {
"*.{ts}": [
"eslint --fix"
]
}
}
Publish changes
After you have merged a PR to master, you need to rebuild and publish the components.
- Checkout master
git checkout master && git pull
- Use one of the following make publish commands to publish changes:
make publish kind=patch
- Use this if your change is a bug fix and is backwards compatible.make publish kind=minor
- Use this if your change adds new functionality and is backwards compatible.make publish kind=major
- Use this if your change is not backwards compatible.