Page MenuHomePhabricator

[MSMF] [TECH] Update linting rules for Mismatch Finder
Closed, ResolvedPublic5 Estimated Story Points

Description

ES lint rule set currently in use is for Vue 2 and doesn't include strongly-recommended rule set. As we are updating our system for Vue 3 we should use the recommended rule set for it, and make sure that all violations are fixed. In addition we don't have a standard on basic formatting rules, which we can enforce with an .editorconfig file.

Acceptance Criteria:

  • ESLint rule is set to Vue 3 strongly-recommended rule set.
  • All linting violations are fixed
  • We have decided and acted upon adding an .editorconfig file We have added stylelint to the project

Event Timeline

Prio Notes:

Impact AreaAffected
production / end usersno
monitoringno
development effortsyes
onboarding effortsmaybe
additional stakeholdersno
ItamarWMDE renamed this task from [MSMF] [TECH] Update linting rules for Mismatch Finder to [SW] [MSMF] [TECH] Update linting rules for Mismatch Finder.Nov 21 2023, 2:07 PM
ItamarWMDE renamed this task from [SW] [MSMF] [TECH] Update linting rules for Mismatch Finder to [MSMF] [TECH] Update linting rules for Mismatch Finder.Nov 30 2023, 10:08 AM
ItamarWMDE updated the task description. (Show Details)
ItamarWMDE set the point value for this task to 5.

@HasanAkgun_WMDE @ItamarWMDE Hello, since the indenting rules are reinforced by Vue 3's strongly-recommended plugin, I don't see what would be the benefit of adding a .editorconfig file. In my opinion we don't need it. What do you think?

I don't necessarily mind either or. Although, I'm not sure indentation (or tabs v. spaces) is actually covered by the vue3-strongly-recommended plugin. At least, I could not find it in the documentation: https://eslint.vuejs.org/rules/

I don't necessarily mind either or. Although, I'm not sure indentation (or tabs v. spaces) is actually covered by the vue3-strongly-recommended plugin. At least, I could not find it in the documentation: https://eslint.vuejs.org/rules/

Hi, @ItamarWMDE you can see these rules included in the vue3/strongly-recommended plugin that reinforce linting rules to a certain extent:

and a few others listed on the workflow run link below.

And these rules that are not part of the plugin but that can be added separately in the .eslintrc file. I think this would cover most of what we need instead of having another configuration file to maintain.

You can find all the indentation rules applied to the code on this workflow run: https://github.com/wmde/wikidata-mismatch-finder/actions/runs/7555911508/job/20571855072#step:5:10 they are shown as warnings not as errors.

The only argument against only having eslint is that the css checks would only happen to the script tags inside the .vue files and not to the rest of the .scss files in the project. But we have already PostCSS installed and could add a configuration file for any specific rules we might want to apply to the CSS linting. The editorconfig file would be more appropriate in the case we didn't have already these plugins installed.

Pefect! thanks for clarifying, then I think it should be okay to skip the .editorconfig for now. Unless @HasanAkgun_WMDE and @noarave have a particular reason we should.

No issue with any of it on my side

@HasanAkgun_WMDE @ItamarWMDE @noarave we still have the issue that SCSS files are not being checked by the any linter. I just realized that PostCSS converts to CSS but doesn't lint the files. I would suggest we install stylelint since it could also check other potential violations in the CSS. It seems to the editorconfig file would only check the indentation. What do you think? To sum it up, my suggestion here is to replace the A/C of an editorconfig file by installing stylelint in the project.

I'm totally fine with it, thanks a lot!

After all the back and forth I have just noticed we do have an editorconfig file already in the project, I still think it is a better idea to install stylelint. Now I am not sure what to do with that file, though. Do we leave it there? @ItamarWMDE @noarave @HasanAkgun_WMDE .

After doing some research, I have found that ESLint has deprecated all formatting rules: https://eslint.org/blog/2023/10/deprecating-formatting-rules/, the deprecated rules will still be available in a new package called stylistic.

The team has discussed that doing this migration to include deprecated rules is too much overhead for the current task and installing prettier is also out of the scope of this task, so we have opted for keeping our current .editorconfig file to take care of indentation and trailing spaces.

*Important note*
EditorConfig is preinstalled in some IDEs: https://editorconfig.org/#pre-installed
but not on others. For the file to work on VSCode an external plugin is needed: https://editorconfig.org/#download

Please make sure you have the correct IDE or plugin for it to work.

ESLint was configured and Stylelint was added to the project. there is a separate task for the deprecated stylint rules to be added with stylistic (or equivalent). I think we can consider this done.