RepoSense icon indicating copy to clipboard operation
RepoSense copied to clipboard

Implement style check on spacing

Open 0blivious opened this issue 4 years ago • 2 comments

  1. there should be space before curly bracket in scss file, e.g.
.fileTypeLabel{  //missing space
}
  1. there should be check for spacing before : in pug file, e.g.
'color' : getFontColor // false
'color': getFontColor // true

0blivious avatar Apr 11 '20 09:04 0blivious

First one can be fixed by adding "block-opening-brace-space-before": "always" to stylelintrc. Second one I think so far there is no official support? Since it is linting style="" blocks in pug files I think should be done by stylelint as well.

niqiukun avatar Apr 11 '20 11:04 niqiukun

Can I work on this?

aidoxe-123 avatar Jul 21 '21 03:07 aidoxe-123

Firstly, perhaps we should consider adding the first check and partially close this issue, as the check is fairly simple to add.

Secondly, looking further into finding out how we can implement the style check for spaces before a ':' in our pug files, there is no official support by the pug linter. Looking at using stylelint for this check, there is a rule, declaration-colon-space-before: "never" which would precisely implement the check in question, though in version 15.0.0 of stylelint, this rule, along with many of our existing rules are deprecated, and slated for removal at the next major release. Furthermore, it sees that the pug format is not officially supported by stylelint, thus requiring either further waiting until it is officially supported (seems like there are no plans for this), or a large amount of implementation work for a postcss custom syntax/parser, a list of which can be found here.

jq1836 avatar Sep 13 '23 13:09 jq1836

While the rules have been removed from stylelint v15 onwards, they have recently been moved to a community plugin. If we use this plugin, we can update stylelint to the latest version (barring other breaking changes).

Regarding the pug issue, given that we no longer have any pug extension files, perhaps this is not such a pressing issue. This might be worth a look for the pug templates in the Vue files.

sopa301 avatar Jan 22 '24 19:01 sopa301

@sopa301 Feel free to create a new issue if you feel that eslint-plugin-vue-pug might be a good addition to the FE, so the team can discuss it further.

MarcusTXK avatar Jan 24 '24 01:01 MarcusTXK