简体   繁体   English

从未使用过的 Javascript(Eslint) 函数

[英]Javascript(Eslint) Function never Used

I have been using Eslint for some time.我已经使用 Eslint 一段时间了。 I have defined a function which takes user input and assignes it to variable.我定义了一个函数,它接受用户输入并将其分配给变量。 The function is called in HTML on button click.该函数在按钮单击时在 HTML 中调用。 I have an error in js that this function is never used.我在js中有一个错误,这个函数从未被使用过。 I know that this is not a problem at all.我知道这根本不是问题。 Just trying to write correct code from the start.只是试图从一开始就编写正确的代码。 Thank you!谢谢!

If you don't want this to be an error stopping you from starting the application, set the eslint no-unused-vars rule to off or warn in your eslint configuration file ( eslintrc.js or similar).如果您不希望这是阻止您启动应用程序的错误,请将 eslint no-unused-vars规则设置为off或在您的 eslint 配置文件( eslintrc.js或类似文件)中warn For example:例如:

module.exports = {

  ...

  rules: {
    'no-unused-vars': 'off',
  },
};

Note that in order for this to work you have to restart the application.请注意,为了使其工作,您必须重新启动应用程序。

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

相关问题 eslint:禁用警告-特定 function 的“已定义但从未使用”? - eslint: disable warning - `defined but never used` for specific function? 'confirmPassword' 被分配了一个值但从未使用过.eslint - 'confirmPassword' is assigned a value but never used.eslint function 已定义但从未使用 - function is defined but never used Eslint throws 被分配了一个值但从未使用过,webpack 模块 - Eslint throws is assigned a value but never used , webpack module ESLint 抱怨从未使用过本地 state 变量 no-unused-vars - ESLint complains that a local state variable is never used no-unused-vars 如何修复 eslint 在反应中的“组件已定义但从未使用”? - How to fix "Component is defined but never used" for eslint in react? React中的无状态组件和“Props已定义但从未使用过”ESLint错误 - Stateless component in React and “Props is defined but never used” ESLint error ESLint - 出现错误 - 'expect' 被分配了一个值但从未使用过 - ESLint - Getting error - 'expect' is assigned a value but never used @typescript-eslint/eslint-plugin 错误:定义了“路由”但从未使用过(no-unused-vars) - @typescript-eslint/eslint-plugin error: 'Route' is defined but never used (no-unused-vars) Eslint,如何在Javascript 中接受const 和箭头函数? - Eslint, how to accept const and arrow function in Javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM