/bug-shield

Primary LanguageTypeScriptMIT LicenseMIT

Hokla's Eslint plugin

Recommended custom eslint rules at Hokla

How to use

Install

yarn add --dev @hokla/eslint-plugin-custom-rules

Optional: In case you also need to setup eslint :

yarn add --dev eslint typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin

Use rules in your projects

In your .eslintrc.json file :

{
  "root": true,
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@hokla/custom-rules/recommended"
  ],
  "plugins": ["@typescript-eslint"],
  "parser": "@typescript-eslint/parser",
  // In case you want to customize the level of warning (default to 'warn')
  "rules": {
    "@hokla/custom-rules/react-query-specify-typing": "warn" // "error" | "warn
  }
}

List of supported rules

Rule Configuration Description
typeorm-query-runner-release recommended Ensure all queryRunner instances finally release their db connection
react-query-specify-type recommended Force to specify data types when using methods useQuery and useMutation
property-decorator-type-mismatch recommended Ensure attribute decorator @Type(...) is consistent with property type
mutation-decorator-return-type-mismatch recommended Ensure GraphQL @Mutation(...) decorator is consistent with method return type
no-async-in-foreach recommended Ensure that we don't use async callbacks in foreach loops
redux-saga-no-sequential-actions recommended Prevent dispatching Redux Saga actions sequentially

Contribute