ESLint problems with Typegoose

85 views Asked by At

I'm having some problems linting my code.

Now I'm using the following versions:

  • "typescript": "^4.8.2",
  • "@typescript-eslint/eslint-plugin": "^2.34.0",
  • "@typescript-eslint/parser": "^2.34.0",
  • "eslint": "^6.5",

Here's my .eslintrc.yml file

---
  # Env Vars #
  env:
    es6: true
    node: true

  ignorePatterns:
    - "!.*"
    - "**/node_modules/.*"

  # Parser vars #
  parser: "@typescript-eslint/parser"
  parserOptions:
    ecmaVersion: 2018

  # Plugins #
  plugins:
    - "@typescript-eslint"
    - mongodb
  extends:
    - plugin:@typescript-eslint/recommended
  
  # Rules #
  rules:
    indent:
      - 1
      - tab
      - SwitchCase: 1
    no-undef: 2
    no-unreachable: 2
    no-unused-expressions: 1
    no-unused-vars: 0
    comma-dangle:
      - 1
      - only-multiline
    no-multi-spaces:
      - 1
      - exceptions:
          VariableDeclarator: true
    no-shadow-restricted-names: 0
    eqeqeq:
      - 1
      - smart
    no-dupe-keys: 2
    no-duplicate-case: 2
    no-extra-semi: 2
    max-depth:
      - 1
      - 4
    no-empty: 2
    "@typescript-eslint/no-var-requires": off
    "@typescript-eslint/explicit-function-return-type": off
    "@typescript-eslint/no-explicit-any": off
    "@typescript-eslint/ban-ts-ignore": off
    "@typescript-eslint/interface-name-prefix": off
    "@typescript-eslint/class-name-casing": off
    "@typescript-eslint/no-use-before-define":
      - error
      - functions: false
        classes: true
    "@typescript-eslint/no-extra-parens": 2
    "@typescript-eslint/ban-ts-comment": 0

But it's returning some linting errors for me when I'm importing Typegoose types, for an example:

error 'index' is defined but never used

import { index } from '@typegoose/typegoose';

@index({
    user: 1,
    deleted: 1,
    facility: 1,
        provider: 1,
}, {
    background: true,
})

and also with the indentation

warning Expected indentation of 1 tab but found 0

this expects the index to be like this, which is awful:

@index({
    user: 1,
    deleted: 1,
    facility: 1,
    provider: 1,
    }, {
    background: true,
    })

If anyone have a clue of what is happening I'd appreciate <3

I already tried all types of rules of ESLint, but I don't want to disable @typescript-eslint/no-unused-vars because it's useful on other parts of the code

0

There are 0 answers