4

I started a new Vue project with vue-cli and Webpack and configured ESLint to Airbnb's style guide.

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.

I am working alone at this project right now, so do not worry about team complains :)

nicoramirezdev
  • 466
  • 3
  • 14
  • Which IDE are you using ? – Prasheel Mar 15 '18 at 14:53
  • https://github.com/standard/eslint-config-standard – samayo Mar 15 '18 at 14:56
  • @Prasheel I use vim for configuration and Sublime Text 3 for Vue. Although this question is more related to the command line or the file system, I think. – nicoramirezdev Mar 15 '18 at 16:13
  • @samayo so i can just run the commands given in that link on top of my already ESLint configured app? If not, I do not know where to start with that repo... – nicoramirezdev Mar 15 '18 at 16:16
  • Install the library and modify your eslint file with the example given. I haven't tried it but I will. You may find some info here also https://github.com/vuejs-templates/webpack/issues/73 – samayo Mar 15 '18 at 16:19
  • Found a way to disable ESLint for the moment: in **config/index.js**, set `useEslint: true` to false. At least no Airbnb Style Guide, thanks @samayo! – nicoramirezdev Mar 15 '18 at 21:04
  • Glad it worked for you, but some of the rules are actually okay, so try to use it without that empty/tab/space nonesense – samayo Mar 15 '18 at 21:05
  • 1
    Have you succeeded changing the coding style to StandardJS? – user7637745 Jun 15 '18 at 07:24
  • @user7637745 Yes, although this should be for me a one use case. Not need to do this again in the future, I hope... – nicoramirezdev Jan 03 '19 at 15:53

1 Answers1

3

Just install StandardJS via npm install standard --save-dev.

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:

{
  "scripts": {
    "check": "standard"
  }
}

...then you can run it via npm run check


To provide a quick way to yourself to fix most coding style typos, add a fix script to your package.json:

{
  "scripts": {
    "check": "standard",
    "fix": "standard --fix"
  }
}

...and run via 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:

{
  "scripts": {
    "check": "standard --verbose | snazzy",
    "fix": "standard --fix"
  }
}
user7637745
  • 965
  • 2
  • 14
  • 27
  • 1
    I ended up using a different solution for my particular case, but I think this is a well constructed answer for my question. – nicoramirezdev Jan 03 '19 at 11:41