2.0.6 • Published 2 months ago

@mvf/eslint-config-mvf-typescript-node v2.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

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.

  1. Checkout master git checkout master && git pull
  2. 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.
2.0.5

2 months ago

2.0.6

2 months ago

2.0.3

2 months ago

2.0.2

2 months ago

2.0.4

2 months ago

2.0.1

2 months ago

2.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago