简体   繁体   English

ESLint:忽略警告规则

[英]ESLint: ignore warning rules

The typescript files are filled with warning symbols and I am trying to ignore the following rules inside the .eslintrc.json file:打字稿文件充满了警告符号,我试图忽略 .eslintrc.json 文件中的以下规则:

  1. I want to allow the any type我想允许任何类型
  2. I want to ignore setting void behind functions that are not returning anything.我想忽略在不返回任何内容的函数后面设置 void。

These are the corresponding warnings:这些是相应的警告:

  1. Argument 'myArgument' should be typed.eslint@typescript-eslint/explicit-module- boundary-types参数 'myArgument' 应该是 typed.eslint@typescript-eslint/explicit-module-boundary-types
  2. Missing return type on function.eslint@typescript-eslint/explicit-module-boundary-types function.eslint@typescript-eslint/explicit-module-boundary-types 上缺少返回类型

Is there a way to ignore these rules and make the warning disappear?有没有办法忽略这些规则并使警告消失?

For any , you can use "no-explicit-any":false对于any ,您可以使用"no-explicit-any":false

For void , you can use "no-void": false对于void ,您可以使用"no-void": false

For your other warnings, the eslint rule is explicit-module-boundary-types对于您的其他警告,eslint 规则是explicit-module-boundary-types

You probably need你可能需要

 "@typescript-eslint/explicit-module-boundary-types": "off"

see

Stop typescript-eslint/explicit-module-boundary-types to be applied on vue component not using Typescript 停止在不使用 Typescript 的 vue 组件上应用 typescript-eslint/explicit-module-boundary-types

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eslint - 配置规则位置 - Eslint - configured rules location 如何将 typescript-eslint 规则添加到 eslint - How to add typescript-eslint rules to eslint 升级到 ESLint 时导入错误以定义规则 - Upgrading to ESLint with error at imports for definition of rules Angular ESLint:任何数据类型警告 - Angular ESLint : Any Data Type Warning Angular eslint,html 中的一些规则不起作用 - Angular eslint, some rules in html doesn't work 将 angular 更新到 v14 后,TSlint 规则变为 ESlint - TSlint rules to ESlint after update angular to v14 有没有办法在 Angular 项目中列出所有活动的 ESLint / Prettier 规则? - Is there a way to list all active ESLint / Prettier rules in an Angular project? Visual Studio 警告:(ESLint)无法加载配置“defaults/configurations/eslint”以扩展。 引用自 C:\Users\{用户名}\.eslintrc - visual studio warning: (ESLint) Failed to load config "defaults/configurations/eslint" to extend from. Referenced from C:\Users\{username}\.eslintrc 如何在 NX 工作区 (nrwl) 中忽略来自 eslint 的特定文件/文件夹 - How to ignore specific files/folders from eslint within NX workspaces (nrwl) 为什么我没有收到以下所有代码片段的“冗余返回等待”(ESLint:no-return-await)警告? - Why am I not getting "Redundant return await" (ESLint: no-return-await) warning for all the below code snippets?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM