如何告诉eslint您更喜欢字符串中的单引号 [英] How to tell eslint that you prefer single quotes around your strings

查看:1886
本文介绍了如何告诉eslint您更喜欢字符串中的单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不熟悉eslint,它冒出很多错误,告诉我使用双引号:

I'm new to eslint and it's spewing out a ton of errors telling me to use doublequotes:

error  Strings must use doublequote

这不是我的偏好。我已经建立了一个.eslintrc文件,其中包含以下基本知识:

That's not my preference. I've got an .eslintrc file set up with the basics:

{
  "env": {
    "node": 1
  }
}

我想要将其配置为单引号。

I'd like to configure it for single quotes.

推荐答案

http://eslint.org/docs/rules/quotes.html

{
  "env": {
    "node": 1
  },
  "rules": {
    "quotes": [2, "single", { "avoidEscape": true }]
  }
}

这篇关于如何告诉eslint您更喜欢字符串中的单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆