Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure ESLint to enforce coding style consistency #7

Closed
sgobotta opened this issue Dec 9, 2018 · 2 comments
Closed

Configure ESLint to enforce coding style consistency #7

sgobotta opened this issue Dec 9, 2018 · 2 comments
Assignees
Labels
clean up Clean code configuration Project's general configuration

Comments

@sgobotta
Copy link
Member

sgobotta commented Dec 9, 2018

Searching for different options, I think the best choice would be to use prettier because it's less bureaucratic than airbnb. We just want clean and pretty indented/formatted code to enforce a style among contributors.

The vue-cli installs all the required dependencies to get it running. The bad thing is that it automatically fixes all code with it's default configuration (which is not what we're aiming for: we don't want double quotes, for example).

Prettier needs a custom .prettierrc.json file. Looking at the current code, the following rules should not harm the current code so much, plus we intent not to use semicolons and avoid double quotes in plain javascript.

taken from prettier configuration. There are other rules that could be useful.

{
  "trailingComma": "es5",
  "tabWidth": 2,
  "semi": false,
  "singleQuote": true
}

In order to instantiate prettier we'll have to configure an .eslintrc.json file. I found this one from an old project that could do the trick.

Then I've had a little thought about the fix option that runs by default in the vue-cli-service at npm run lint. I think it would be safer if we disable the auto fix option for that service. We'll be including a pre-commit hook feature to prevent pushing dirty code. That way we can use the npm run lint script just as a code state checker.

@sgobotta sgobotta added the configuration Project's general configuration label Dec 9, 2018
@sgobotta sgobotta added this to Backlog in Current Tasks Dec 9, 2018
@josx josx moved this from Backlog to To do in Current Tasks Dec 14, 2018
@sgobotta
Copy link
Member Author

sgobotta commented Feb 6, 2019

@sgobotta sgobotta moved this from To do to In progress in Current Tasks Feb 6, 2019
@sgobotta sgobotta moved this from In progress to Backlog in Current Tasks Jun 10, 2019
@sgobotta sgobotta moved this from Backlog to To do in Current Tasks Sep 14, 2019
@sgobotta sgobotta assigned sgobotta and unassigned estefi-prieto Sep 29, 2019
@sgobotta sgobotta moved this from To do to In progress in Current Tasks Sep 29, 2019
@sgobotta sgobotta moved this from In progress to Needs review in Current Tasks Sep 30, 2019
@sgobotta sgobotta moved this from Needs review to In progress in Current Tasks Sep 30, 2019
@sgobotta sgobotta assigned agustinariq and unassigned sgobotta Sep 30, 2019
@sgobotta sgobotta added the clean up Clean code label Sep 30, 2019
@sgobotta
Copy link
Member Author

sgobotta commented Oct 4, 2019

Merged in #162

@sgobotta sgobotta closed this as completed Oct 4, 2019
Current Tasks automation moved this from In progress to Done Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean up Clean code configuration Project's general configuration
Projects
Current Tasks
  
Done
Development

No branches or pull requests

3 participants