Skip to content
Snippets Groups Projects
Commit e6fb5f79 authored by Jean Valverde's avatar Jean Valverde :construction_site:
Browse files

feat: stylelint html report, use npx

parent 47dafa3d
Branches
No related tags found
No related merge requests found
......@@ -336,7 +336,6 @@ php-qa:
# This is a eslint report based on Drupal 8/9 standards.
# https://www.drupal.org/docs/develop/standards/javascript
# @todo junit report.
lint_js:
stage: tests
extends: .lint_template
......@@ -345,25 +344,16 @@ lint_js:
when: never
- when: always
script:
# Added eslint option for Drupal 9.0+.
# @todo move as default option when 8.9 is deprecated.
- |
if [ 1 -eq "$(echo "${CI_DRUPAL_VERSION} >= 9.0" | bc)" ]; then
ESLINT_RESOLVE_FIX="--resolve-plugins-relative-to ${WEB_ROOT}/core"
fi
# Run the eslint command to generate an html report.
# --format junit --output-file "${CI_PROJECT_DIR}/report-${CI_JOB_NAME}/eslint-unit.xml"
- cd ${WEB_ROOT}/core && node_modules/.bin/eslint
- cd ${WEB_ROOT}/core
- npx eslint
--config .eslintrc.passing.json
${ESLINT_RESOLVE_FIX}
--resolve-plugins-relative-to ${WEB_ROOT}/core
--format html
--output-file "${CI_PROJECT_DIR}/report-${CI_JOB_NAME}/eslint.html"
"${DIRS_JS}"
# Drupal 8/9 rules used here for stylelint to check css.
# Drupal 9 rules used here for stylelint to check css.
# https://www.drupal.org/docs/develop/standards/css
# @todo stylelint html & junit report. + sass / scss support?
# https://www.npmjs.com/package/stylelint-junit-formatter
lint_css:
stage: tests
extends: .lint_template
......@@ -372,12 +362,13 @@ lint_css:
when: never
- when: always
script:
# Css report, terminal only.
- cd ${WEB_ROOT}/core && node_modules/.bin/stylelint
- cd ${WEB_ROOT}/core
- yarn add stylelint-html-formatter
- npx stylelint
--config .stylelintrc.json
--formatter verbose
--custom-formatter node_modules/stylelint-html-formatter
--output-file ${CI_PROJECT_DIR}/report-${CI_JOB_NAME}/stylelint.html
"${DIRS_CSS}"
2>&1 | tee ${CI_PROJECT_DIR}/report-${CI_JOB_NAME}/lint_css.txt
lint_twig:
stage: tests
......
......@@ -270,7 +270,11 @@ Eslint is based on the official
Stylelint is based on the official
[Drupal 8/9 stylelintrc.json](https://git.drupalcode.org/project/drupal/raw/HEAD/core/.stylelintrc.json)
Both provide a html report that you can browse from within Gitlab CI.
_Note:_ As this project is meant for Drupal, there is no override for these files.
To setup your own rules for your css and js file you need to override these jobs
and include your own config file.
### Metrics jobs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment