Skip to content
Snippets Groups Projects

Swap to @gitlab-formatters/stylelint-formatter-gitlab.

Merged Dave Long requested to merge issue/gitlab_templates-3492697:3492697-stylelint-16 into main
All threads resolved!
@@ -776,24 +776,26 @@ stylelint:
needs:
- composer
script:
- cd $_WEB_ROOT/core && corepack enable && yarn add stylelint-junit-formatter
- cd $_WEB_ROOT/core && corepack enable && yarn add @gitlab-formatters/stylelint-formatter-gitlab
# Change directory to the project root folder.
- cd $CI_PROJECT_DIR/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME
- echo "Stylelint version $(${CI_PROJECT_DIR}/${_WEB_ROOT}/core/node_modules/.bin/stylelint --version)"
# If there is no .stylelintignore file, there is no warning or error. The
# option is just ignored.
# The `|| true` makes sure the second call runs even if the first fails. https://stackoverflow.com/questions/59180675/how-to-continue-job-even-when-script-fails
- $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --formatter verbose --config $CI_PROJECT_DIR/$_WEB_ROOT/core/.stylelintrc.json ./**/*.css --color $_STYLELINT_EXTRA || true
- $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --formatter verbose --config $CI_PROJECT_DIR/$_WEB_ROOT/core/.stylelintrc.json ./**/*.css --color --custom-formatter $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/stylelint-junit-formatter $_STYLELINT_EXTRA > $CI_PROJECT_DIR/junit.xml
- $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --config $CI_PROJECT_DIR/$_WEB_ROOT/core/.stylelintrc.json ./**/*.css --formatter verbose --color $_STYLELINT_EXTRA || true
- echo -e "\e[0Ksection_start:`date +%s`:generate_stylelint_artifact[collapsed=true]\r\e[0KGenerating stylelint artifact"
- $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --config $CI_PROJECT_DIR/$_WEB_ROOT/core/.stylelintrc.json ./**/*.css --custom-formatter=@gitlab-formatters/stylelint-formatter-gitlab --output-file=$CI_PROJECT_DIR/gl-codequality.json $_STYLELINT_EXTRA
- echo -e "\e[0Ksection_end:`date +%s`:generate_stylelint_artifact\r\e[0K"
artifacts:
expose_as: junit
expose_as: stylelint
expire_in: 6 mos
when: always
name: artifacts-$CI_PIPELINE_ID-$CI_JOB_NAME_SLUG
paths:
- junit.xml
- gl-codequality.json
reports:
junit: junit.xml
codequality: gl-codequality.json
eslint:
stage: validate
Loading