DEV Community

Kristjan Grm
Kristjan Grm

Posted on

VScode tips on enforcing coding style

Hello everyone, I hope you are having a good day.

I am looking for some tips how can I enforce "same" coding style among a team of programmers.

I think we should define stuff like:

  • line width
  • naming of variables to follow the rules I define (cammelCase)
  • spaces instead of tabs
  • etc...

I am not sure how granular should I be in defining the rules? Should I define relaxed rules where everyone can still do stuff like they want? Or should I be strict and opionated.

We program mainly in Java but it would be cool if I could define rules for different languages (mainly Javascript(Angular - typescript and Java).

In ideal world there would be a plugin that would check the codebase based on there rules:

I am really greateful for any tips / help I receive

Top comments (3)

Collapse
 
keithdarragh_73 profile image
Keith Darragh

I believe you should be able to do this via a plugin for vscode. Have you checked out this plugin:

It provides code completion as well as code formatting. For other languages there are linters which you can use with vscode. I wouldn't worry about being too granular on rules. I would focus on using an existing standard for your rules. Makes it more common for other developers who may roll onto the project later.

Collapse
 
robertguss profile image
Robert Guss

Part of the answer is using an editor config: editorconfig.org/

Not sure about linting for Java though

Collapse
 
nguyenak95 profile image
Nguyen An Khang

Did you try Eslint?