Project

General

Profile

Actions

Patch #32888

closed

Use stylelint to avoid errors and enforce conventions in CSS files

Added by Marius BĂLTEANU over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

In the last few months we had some cases when we added/fixed broken CSS code (ex: r18173, r18144, #32838). These types of errors can be easily avoid if we use a lint tool for CSS (as we started using Rubocop for Ruby).

My proposal is to add Stylelint which is a very well know library, actively maintained, with good community and integrated by many tools.

Attached is a patch that:
  1. Adds package.json and yarn.lock[1] to request the library as development dependency. To install and run it, I propose to use Yarn.
  2. Adds .stylelintrc with the initial list of rules from here. For now, I propose to start only with the possible-errors rules.
  3. Adds .stylelintignore to ignore some files from linting (jquery-ui-*.ccs for now).
  4. Updates the documentation
Beside this, if the overall idea is accepted, I have in plan to add the following:
  • Add more rules to enforce some coding standards in CSS files
  • Add a Javascript lint tool like ESLint
  • Use package.json to handle the version of the current JS libraries (ex: jQuery, jQuery UI, Chart, Raphael, Tribute, etc)
  • Give a shoot to integrate Webpack as assets pipeline (In Rails 6, is default)

Any feedback is really appreciated.

1 I prefer to have yarn.lock committed in the repository in order to enforce the same version between Redmine installations.


Files


Related issues

Related to Redmine - Patch #32890: Fix violations reported by StylelintClosedGo MAEDA

Actions
Actions

Also available in: Atom PDF