V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ethan678
V2EX  ›  程序员

有没有英语比较好,或者第六感比较强的人,看看这句话怎么理解

  •  
  •   ethan678 · 2021-09-17 17:26:08 +08:00 · 1909 次点击
    这是一个创建于 923 天前的主题,其中的信息可能已经有所发展或是发生改变。

    This rule enforces the consistent use of either backticks, double, or single quotes.

    这句话来自 eslint 的官方文档。参见 https://eslint.org/docs/rules/quotes

    我觉得是对下面配置中“2”的解释,表示要成对出现。 这条规则强制单引号、双引号、` 成对使用。

    'quotes': [2, 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],

    5 条回复    2021-09-18 15:52:41 +08:00
    ethan678
        1
    ethan678  
    OP
       2021-09-17 17:29:00 +08:00
    搞错了
    'quotes': [2, 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
    2 表示 警告级别
    cathiabi
        2
    cathiabi  
       2021-09-17 17:31:37 +08:00 via Android
    大的含义上应该是检查代码里面从头到尾用一种引号而不是三种混着用吧。
    ethan678
        3
    ethan678  
    OP
       2021-09-17 17:44:21 +08:00
    @cathiabi 对的
    rizon
        4
    rizon  
       2021-09-18 10:56:44 +08:00
    基本意思就是保持单引号双引号 反引号的使用习惯的一致
    毕竟弱语言里面使用习惯没有强制规定,这时候就得学会自我约束了,如果自己混乱着使用反而给自己添麻烦,
    sliveryukilee
        5
    sliveryukilee  
       2021-09-18 15:52:41 +08:00
    这条规则强制引号使用的一致性,"2" 是 eslint 的通用告警级别 error 的 alias 这个看过文档的应该都知道啊

    https://eslint.org/docs/user-guide/getting-started#configuration
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3565 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:49 · PVG 08:49 · LAX 17:49 · JFK 20:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.