我使用 ESLint 来提高代码质量,但我需要它不警告某些声明,例如区域设置代码 en_US
。
ESLint warning for camelcase rule
如果我在评论中添加一些配置,就像 the document告诉
/* eslint camelcase: ["error", "properties": ["never"]] */
import zh_TW from 'moment/locale/zh-tw';
ESLint 仍然警告驼峰命名问题。在这种情况下如何关闭警告?
最佳答案
我对配置行有疑问:
Doc says:
/* eslint camelcase: ["error", {properties: "never"}] */
But you did this:
/* eslint camelcase: ["error", "properties": ["never"]] */
(编辑:但它似乎没有什么区别(见评论)。问题一定在其他地方)
另外,我不确定您是否得到了 @vahdet 的建议:
import { zh_TW as zhTw } from 'moment/locale/zh-tw';
^^^^^^^
然后您在代码中使用 zhTw
而不是 zh_TW
,并且不需要排除 linter :)
关于javascript - 针对区域设置代码的驼峰式 ESLint 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44168123/