[英]How can I switch to a different ESLint style guide?
I started a new Vue project with vue-cli and Webpack and configured ESLint to Airbnb's style guide. 我开始与VUE-CLI和的WebPack和配置ESLint对Airbnb的风格指南新Vue公司的项目。
How can I change this choice to a Standard style? 如何将此选项更改为标准样式? I am getting really tired of the surplus in commas and semicolons, and want to give it Standard JS a try. 我对逗号和分号的过剩感到非常厌倦,并希望尝试使用标准JS 。
I am working alone at this project right now, so do not worry about team complains :) 我现在正在这个项目独自工作,所以不要担心团队抱怨:)
Just install StandardJS via npm install standard --save-dev
. 只需通过npm install standard --save-dev
安装StandardJS即可 。
Then run through the rules just to quickly get a feel of it. 然后执行规则只是为了快速了解它。
Finally, create a script in your package.json to run StandardJS, when you need it: 最后, 在package.json中创建一个脚本,以便在需要时运行StandardJS:
{
"scripts": {
"check": "standard"
}
}
...then you can run it via npm run check
...然后你可以通过npm run check
运行它
To provide a quick way to yourself to fix most coding style typos, add a fix script to your package.json : 要为自己提供快速修复大多数编码风格拼写错误的方法, 请在package.json中添加修复脚本 :
{
"scripts": {
"check": "standard",
"fix": "standard --fix"
}
}
...and run via npm run fix
...并通过npm run fix
To get a more nicer representation of coding style errors, install snazzy via npm install snazzy --save-dev
, then modify your package.json like so: 为了获得编码风格的错误的更多更好的代表性 ,通过安装时髦 npm install snazzy --save-dev
,然后修改您的package.json像这样:
{
"scripts": {
"check": "standard --verbose | snazzy",
"fix": "standard --fix"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.