Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use login.gov shared Stylelint configuration #276

Merged
merged 2 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 2 additions & 71 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,4 @@
{
"plugins": [
"stylelint-scss"
],
"rules": {
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always-multi-line",
"block-closing-brace-space-before": "always-single-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always-multi-line",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"color-hex-case": "lower",
"color-no-invalid-hex": true,
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-no-important": true,
"function-calc-no-unspaced-operator": true,
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-max-empty-lines": 0,
"function-name-case": "lower",
"function-parentheses-space-inside": "never-single-line",
"function-url-quotes": "always",
"function-whitespace-after": "always",
"indentation": 2,
"length-zero-no-unit": true,
"max-empty-lines": 1,
"max-nesting-depth": 4,
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-eol-whitespace": true,
"no-extra-semicolons": true,
"no-invalid-double-slash-comments": true,
"number-no-trailing-zeros": true,
"property-case": "lower",
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-list-comma-space-before": "never",
"selector-max-empty-lines": 0,
"selector-no-qualifying-type": true,
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-no-unknown": true,
"selector-type-case": "lower",
"string-no-newline": true,
"string-quotes": "single",
"unit-case": "lower",
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never"
}
"extends": "@18f/identity-stylelint-config",
"ignoreFiles": "./src/scss/uswds/**/*"
}
20 changes: 9 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const replace = require('gulp-replace');
const rename = require('gulp-rename');
const gulpif = require('gulp-if');
const sass = require('gulp-sass')(require('sass'));
const gulpStylelint = require('gulp-stylelint');
Copy link
Member Author

@aduth aduth Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gulp-stylelint may be abandoned, as it doesn't support the newest major release of Stylelint released early in the year, and the maintainer hasn't been active in related issues (olegskl/gulp-stylelint#132).

In any case, the dependency shifting here removed a lot from the dependency tree (net -1719 lines in package-lock.json), which I'm pretty happy about.

const stylelint = require('stylelint');
const sourcemaps = require('gulp-sourcemaps');
const browserify = require('browserify');
const babel = require('gulp-babel');
Expand Down Expand Up @@ -108,16 +108,14 @@ gulp.task('build-js', () => {

gulp.task('watch-js', () => gulp.watch(`${PROJECT_JS_SRC}/**/*.js`, gulp.series('build-js')));

gulp.task('lint-sass', () =>
gulp.src([`${PROJECT_SASS_SRC}/**/*.scss`, `!${PROJECT_SASS_SRC}/uswds/**/*.scss`]).pipe(
gulpStylelint({
failAfterError: true,
reporters: [{ formatter: 'string', console: true }],
syntax: 'scss',
debug: true,
}),
),
);
gulp.task('lint-sass', async function (callback) {
const { errored, output } = await stylelint.lint({
files: [`${PROJECT_SASS_SRC}/**/*.scss`, `!${PROJECT_SASS_SRC}/uswds/**/*.scss`],
formatter: 'string',
});

callback(errored ? new Error(output) : null);
});

gulp.task('build-sass', () => {
const plugins = [
Expand Down
Loading