V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
ethan678
V2EX  ›  程序员

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

  •  
  •   ethan678 · Sep 17, 2021 · 2915 views
    This topic created in 1686 days ago, the information mentioned may be changed or developed.

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

    https://eslint.org/docs/user-guide/getting-started#configuration
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1311 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 17:08 · PVG 01:08 · LAX 10:08 · JFK 13:08
    ♥ Do have faith in what you're doing.