Я наконец нашел способ (с gulp) и хочу поделиться им в StackOverflow.
Сначала установите следующие зависимости:
yarn add -D stylelint gulp-stylelint stylelint-checkstyle-formatter stylelint-scss stylelint-config-recommended-scss
Затем используйте следующее задание глотка:
gulp.task("scss-lint", function() {
const gulpStylelint = require('gulp-stylelint');
const stylelintCheckstyleFormatter = require('stylelint-checkstyle-formatter');
return gulp
.src('src/**/*.scss')
.pipe(gulpStylelint({
reportOutputDir: 'build/reports/scss-checkstyle',
reporters: [
{formatter: 'verbose', console: true},
{formatter: stylelintCheckstyleFormatter, save: 'checkstyle.xml'},
],
}));
});
И, наконец, мой .stylelint
:
{
"extends": "stylelint-config-recommended-scss",
"defaultSeverity": "warning",
"formatter": "stylelint-checkstyle-formatter",
"plugins": [
"stylelint-scss"
],
"rules": {
"indentation": 4,
"color-hex-length": null,
"shorthand-property-no-redundant-values": null,
"no-missing-end-of-source-newline": null,
"declaration-empty-line-before": null,
"at-rule-empty-line-before": null,
"selector-type-no-unknown": [
true,
{
"ignore": ["custom-elements"],
"ignoreTypes": ["tooltip"]
}
]
}
}