Как исправить проблемы с линтами?

Я получаю сообщение об ошибке lint-staged при попытке сканирования файлов вне каталога 'src / **', несмотря на файл конфигурации (см. Ниже). Запуск eslint в консоли не показывает ту же ошибку (отображаются только предупреждения). Учитывая, что lint-staged вызывается через Husky, я не могу зафиксировать свои коды без --no-verify.

Любая идея, как это решить?

.lintstagedrc.json

{
  "*.ts": [
    "eslint 'src/**' --fix",
    "npm run test:staged"
  ]
}

Ошибка запуска lint-staged:

node@2d6c88d1fbea:/workspaces/TDD$ lint-staged
✔ Preparing...
⚠ Running tasks...
  ❯ Running tasks for *.ts
    ✖ eslint 'src/**' --fix [FAILED]
    ◼ npm run test:staged
↓ Skipped because of errors from tasks. [SKIPPED]
✔ Reverting to original state because of errors...
✔ Cleaning up... 

✖ eslint 'src/**' --fix:

/workspaces/TDD/jest-integration-config.ts
  1:16  error  Require statement not part of import statement  @typescript-eslint/no-var-requires

/workspaces/TDD/jest-unit-config.ts
  1:16  error  Require statement not part of import statement  @typescript-eslint/no-var-requires

/workspaces/TDD/src/presentantion/controllers/signup/signup.spec.ts
  25:18  warning  'email' is defined but never used    @typescript-eslint/no-unused-vars
  34:20  warning  'account' is defined but never used  @typescript-eslint/no-unused-vars

/workspaces/TDD/src/presentantion/helpers/http-helper.ts
  14:20  warning  Argument 'data' should be typed with a non-any type  @typescript-eslint/explicit-module-boundary-types
  14:26  warning  Unexpected any. Specify a different type             @typescript-eslint/no-explicit-any

/workspaces/TDD/src/presentantion/protocols/http.ts
  3:11  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  7:12  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 8 problems (2 errors, 6 warnings)

Без ошибок в файлах вне src dir:

node@2d6c88d1fbea:/workspaces/TDD$ eslint 'src/**' --fix

/workspaces/TDD/src/presentantion/controllers/signup/signup.spec.ts
  25:18  warning  'email' is defined but never used    @typescript-eslint/no-unused-vars
  34:20  warning  'account' is defined but never used  @typescript-eslint/no-unused-vars

/workspaces/TDD/src/presentantion/helpers/http-helper.ts
  14:20  warning  Argument 'data' should be typed with a non-any type  @typescript-eslint/explicit-module-boundary-types
  14:26  warning  Unexpected any. Specify a different type             @typescript-eslint/no-explicit-any

/workspaces/TDD/src/presentantion/protocols/http.ts
  3:11  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  7:12  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 6 problems (0 errors, 6 warnings)

person Paulo Gontijo    schedule 08.09.2020    source источник


Ответы (1)


Убедитесь, что у вас есть папка src / и один файл в src

person Lincoln Gadea    schedule 18.11.2020