ウェブサイト検索

reactjs - TypeScriptでreact-hooksのESLintプラグインを有効にする。TSLintにはプラグインなし


このeslintプラグインをtslintと一緒に使うことは不可能だと言っても正しいでしょうか?

これを my tslint.json に追加してみました:

"plugins": ["react-hooks"],
"rules: {
  "react-hooks/rules-of-hooks": "error",
  "react-hooks/exhaustive-deps": "warn",

しかし、コンソールに次のエラーが表示されます:

Could not find implementations for the following rules specified in the configuration:
    react-hooks/rules-of-hooks
    react-hooks/exhaustive-deps

回答 #1

ネスティング React フックのエラーには、以下のライブラリを使用できます。
https://github.com/Gelio/tslint-react-hooks
同じ貢献者からの PR が core tslint リポジトリに保留中です。最近導入された exhaustive deps ルールについては、作者に同じリポジトリに追加するよう依頼しましたが、まだ返答を待っています。 https://github.com/Gelio/tslint-react-hooks/issues/9