diff --git a/STARTERKIT/.sass-lint.yml b/STARTERKIT/.sass-lint.yml new file mode 100644 index 0000000..e6ea0b5 --- /dev/null +++ b/STARTERKIT/.sass-lint.yml @@ -0,0 +1,120 @@ +options: + formatter: stylish + merge-default-rules: true +rules: + # Extends + extends-before-mixins: 2 + extends-before-declarations: 2 + placeholder-in-extend: 2 + + # Mixins + mixins-before-declarations: + - 2 + - exclude: + - 'breakpoint' + - 'mq' + - 'respond-to' + - 'rtl' + - 'zen-breakpoint' + - 'zen-layout' + - 'zen-mq' + - 'zen-respond-to' + + # Line Spacing + one-declaration-per-line: 2 + empty-line-between-blocks: + - 2 + - ignore-single-line-rulesets: false + single-line-per-selector: 2 + + # Disallows + no-color-keywords: 2 + no-color-literals: 2 + no-css-comments: 2 + no-debug: 2 + no-duplicate-properties: 2 + no-empty-rulesets: 2 + no-extends: 0 + no-ids: 2 + no-important: 2 + no-invalid-hex: 2 + no-mergeable-selectors: 2 + no-misspelled-properties: + - 2 + - extra-properties: + - '*background' + - '*background-image' + - '*display' + - '*font-family' + - _font-family + - '*height' + - 'interpolation-mode' + - '*list-style-image' + - '*margin-left' + - '*margin-right' + - '*overflow' + - '*position' + - '*vertical-align' + - '*width' + - '*zoom' + no-qualifying-elements: 0 + no-trailing-zero: 2 + no-transition-all: 2 + no-url-protocols: 2 + no-vendor-prefixes: 2 + no-warn: 2 + property-units: 0 + + # Nesting + force-attribute-nesting: 0 + force-element-nesting: 0 + force-pseudo-nesting: 0 + + # Name Formats + class-name-format: + - 2 + - convention: hyphenatedbem + function-name-format: 2 + id-name-format: 2 + mixin-name-format: 2 + placeholder-name-format: + - 2 + - convention: ^[\w_-]+$ + variable-name-format: 2 + + # Style Guide + bem-depth: 0 + border-zero: 2 + brace-style: + - 2 + - style: stroustrup + - allow-single-line: false + clean-import-paths: 2 + empty-args: 0 + hex-length: 2 + hex-notation: 2 + indentation: 2 + leading-zero: 2 + nesting-depth: + - 2 + - max-depth: 4 + property-sort-order: 0 + quotes: 2 + shorthand-values: 2 + url-quotes: 2 + variable-for-property: 2 + zero-unit: 2 + + # Inner Spacing + space-after-comma: 2 + space-before-colon: 2 + space-after-colon: 2 + space-before-brace: 2 + space-before-bang: 2 + space-after-bang: 2 + space-between-parens: 0 + space-around-operator: 0 + + # Final Items + trailing-semicolon: 2 + final-newline: 2 diff --git a/STARTERKIT/.scss-lint.yml b/STARTERKIT/.scss-lint.yml deleted file mode 100644 index 28d585e..0000000 --- a/STARTERKIT/.scss-lint.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Documentation for the scss-lint Linters is available at: -# https://github.com/causes/scss-lint/blob/master/lib/scss_lint/linter/README.md -# -# This file is for new projects with no pre-existing styles. If you are adding -# linting to an existing project, use the following command to create a -# .scss-lint.yml file instead: scss-lint --format=Config -o .scss-lint.yml -# Then go through each linter, one at a time, disabling it and fixing the -# warnings in your code. -linters: - ElsePlacement: - style: new_line # Like Drupal's PHP coding standard. - EmptyLineBetweenBlocks: - ignore_single_line_blocks: false - MergeableSelector: - force_nesting: true - NestingDepth: - max_depth: 4 # &--variant is not a nesting level. https://github.com/causes/scss-lint/issues/384 - PropertySortOrder: - enabled: false - PropertySpelling: - extra_properties: - # Experimental properties and old IE hacks can be listed here. - - '*background' - - '*background-image' - - '*display' - - '*font-family' - - '_font-family' - - '*height' - - '*list-style-image' - - '*margin-left' - - '*margin-right' - - '*overflow' - - '*position' - - '*vertical-align' - - '*width' - - '*zoom' - PseudoElement: - enabled: false - QualifyingElement: - enabled: false - SelectorFormat: - convention: hyphenated_BEM - SingleLinePerProperty: - allow_single_line_rule_sets: false # Allowed by default. - SpaceAfterPropertyColon: - style: at_least_one_space - SpaceAroundOperator: - enabled: false diff --git a/STARTERKIT/Gemfile b/STARTERKIT/Gemfile deleted file mode 100644 index cfc880c..0000000 --- a/STARTERKIT/Gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# -# This file is only needed to specify the version of our Sass linting tool. -# - -source 'https://rubygems.org' - -gem 'scss_lint', '0.48.0' diff --git a/STARTERKIT/gulpfile.js b/STARTERKIT/gulpfile.js index cfc147a..ca25b95 100644 --- a/STARTERKIT/gulpfile.js +++ b/STARTERKIT/gulpfile.js @@ -27,8 +27,10 @@ options.theme = { js : options.rootPath.theme + 'js/' }; -// Set the URL used to access the Drupal website under development. -options.drupalURL = 'http://localhost'; +// Set the URL used to access the Drupal website under development. This will +// allow Browser Sync to serve the website and update CSS changes on the fly. +options.drupalURL = ''; +// options.drupalURL = 'http://localhost'; // Define the node-sass configuration. The includePaths is critical! options.sass = { @@ -83,11 +85,6 @@ options.styleGuide = { title: 'Zen 7.x-6.x Style Guide' }; -// Define the path to the project's .scss-lint.yml. -options.scssLint = { - yml: options.rootPath.project + '.scss-lint.yml' -}; - // Define the paths to the JS files to lint. options.eslint = { files : [ @@ -101,13 +98,6 @@ options.eslint = { options.gulpWatchOptions = {}; // options.gulpWatchOptions = {interval: 1000, mode: 'poll'}; -// If you wish to disable the following tasks, you can set these variables to -// true (which is simpler than re-writing the Gulp tasks to remove them.) -options.disableTask = { - lintSass: false, - browserSync: false -}; - // ################################ // Load Gulp and tools we will use. @@ -194,18 +184,17 @@ gulp.task('lint:js-with-fail', function() { // Lint Sass. gulp.task('lint:sass', function() { - if (options.disableTask.lintSass) { - return Promise.resolve(); - } return gulp.src(options.theme.sass + '**/*.scss') - .pipe($.scssLint({'bundleExec': true, 'config': options.scssLint.yml})); + .pipe($.sassLint()) + .pipe($.sassLint.format()); }); // Lint Sass and throw an error for a CI to catch. gulp.task('lint:sass-with-fail', function() { return gulp.src(options.theme.sass + '**/*.scss') - .pipe($.scssLint({'bundleExec': true, 'config': options.scssLint.yml})) - .pipe($.scssLint.failReporter()); + .pipe($.sassLint()) + .pipe($.sassLint.format()) + .pipe($.sassLint.failOnError()); }); // ############################## @@ -214,7 +203,7 @@ gulp.task('lint:sass-with-fail', function() { gulp.task('watch', ['browser-sync', 'watch:lint-and-styleguide', 'watch:js']); gulp.task('browser-sync', ['watch:css'], function() { - if (options.disableTask.browserSync) { + if (!options.drupalURL) { return Promise.resolve(); } return browserSync.init({ diff --git a/STARTERKIT/package.json b/STARTERKIT/package.json index 9a24472..95bff56 100644 --- a/STARTERKIT/package.json +++ b/STARTERKIT/package.json @@ -18,12 +18,13 @@ "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.4", "gulp-sass": "2.2.0", - "gulp-scss-lint": "^0.3.9", + "gulp-sass-lint": "^1.1.1", "gulp-size": "^2.1.0", "gulp-sourcemaps": "^1.6.0", "kss": "^2.4.0", "node-sass": "3.4.2", "node-sass-import-once": "^1.2.0", + "sass-lint": "^1.6.0", "support-for": "^1.0.5", "typey": "^1.0.0", "zen-grids": "^2.0.1" diff --git a/STARTERKIT/sass/base/_root.scss b/STARTERKIT/sass/base/_root.scss index a63a7a7..a67b4ce 100644 --- a/STARTERKIT/sass/base/_root.scss +++ b/STARTERKIT/sass/base/_root.scss @@ -1,6 +1,8 @@ +// sass-lint:disable no-vendor-prefixes +// scss-lint:disable VendorPrefix + // Use the saner border-box model for all elements. * { - // scss-lint:disable VendorPrefix @if support-for(firefox, 28) { -moz-box-sizing: border-box; } @@ -13,7 +15,6 @@ html { font-family: $font-body; // Prevent iOS text size adjust after orientation change, without disabling // user zoom. - // scss-lint:disable VendorPrefix -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; // On short pages, we want any background gradients to fill the entire height diff --git a/STARTERKIT/sass/base/forms/_forms.scss b/STARTERKIT/sass/base/forms/_forms.scss index 0637882..821e581 100644 --- a/STARTERKIT/sass/base/forms/_forms.scss +++ b/STARTERKIT/sass/base/forms/_forms.scss @@ -65,21 +65,21 @@ input::-moz-focus-inner { // 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` // and `video` controls. // 2. Correct inability to style clickable `input` types in iOS. -html input[type="button"], // 1 -[type="reset"], -[type="submit"] { +html input[type='button'], // 1 +[type='reset'], +[type='submit'] { -webkit-appearance: button; // 2 } // Fix the cursor style for Chrome's increment/decrement buttons. For certain // `font-size` values of the `input`, it causes the cursor style of the // decrement button to change from `default` to `text`. -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { +input[type='number']::-webkit-inner-spin-button, +input[type='number']::-webkit-outer-spin-button { height: auto; } -input[type="search"] { +input[type='search'] { // Address `appearance` set to `searchfield` in Safari and Chrome. -webkit-appearance: textfield; @@ -109,9 +109,9 @@ input[type="search"] { // Style guide: forms.base.button button, -[type="button"], -[type="reset"], -[type="submit"] { +[type='button'], +[type='reset'], +[type='submit'] { @extend %button; } @@ -136,34 +136,34 @@ button, // Style guide: forms.base.input input { - &[type="text"], - &[type="search"], - &[type="tel"], - &[type="url"], - &[type="email"], - &[type="password"], - &[type="date"], - &[type="time"], - &[type="number"] { + &[type='text'], + &[type='search'], + &[type='tel'], + &[type='url'], + &[type='email'], + &[type='password'], + &[type='date'], + &[type='time'], + &[type='number'] { @extend %text-form-element; } - &[type="range"] { + &[type='range'] { // Add your styles. } - &[type="color"] { + &[type='color'] { // Add your styles. } - &[type="file"] { + &[type='file'] { // Add your styles. } } // Checkboxes // -// If an `` element has the `type="checkbox"` attribute set, the form +// If an `` element has the `type='checkbox'` attribute set, the form // field is displayed as a checkbox. // // It's recommended that you don't attempt to style these elements. Firefox's @@ -175,7 +175,7 @@ input { // Radio buttons // -// If an `` element has the `type="radio"` attribute set, the form field +// If an `` element has the `type='radio'` attribute set, the form field // is displayed as a radio button. // // It's recommended that you don't attempt to style these elements. Firefox's @@ -185,8 +185,8 @@ input { // // Style guide: forms.base.input-radio -input[type="checkbox"], -input[type="radio"] { +input[type='checkbox'], +input[type='radio'] { @if support-for(ie, 10) { // Address box sizing set to `content-box` in IE 8/9/10. box-sizing: border-box; diff --git a/STARTERKIT/sass/components/autocomplete/_autocomplete.scss b/STARTERKIT/sass/components/autocomplete/_autocomplete.scss index 1472a2d..3659f20 100644 --- a/STARTERKIT/sass/components/autocomplete/_autocomplete.scss +++ b/STARTERKIT/sass/components/autocomplete/_autocomplete.scss @@ -66,6 +66,7 @@ } } +// sass-lint:disable no-ids // scss-lint:disable IdSelector #autocomplete { @extend %autocomplete__list-wrapper; @@ -82,4 +83,5 @@ @extend %autocomplete__list-item--is-selected; } } +// sass-lint:enable no-ids // scss-lint:enable IdSelector diff --git a/STARTERKIT/sass/components/collapsible-fieldset/_collapsible-fieldset.scss b/STARTERKIT/sass/components/collapsible-fieldset/_collapsible-fieldset.scss index 54cb1d8..805771d 100644 --- a/STARTERKIT/sass/components/collapsible-fieldset/_collapsible-fieldset.scss +++ b/STARTERKIT/sass/components/collapsible-fieldset/_collapsible-fieldset.scss @@ -16,8 +16,9 @@ display: block; padding-left: 15px; @if support-for(ie, 8) { - // IE8 does not support multiple backgrounds, so IE8 will ignore the second - // declaration with the SVG. https://css-tricks.com/using-svg/ + // IE8 does not support multiple backgrounds, so IE8 will ignore the + // second declaration with the SVG. https://css-tricks.com/using-svg/ + // sass-lint:disable no-duplicate-properties // scss-lint:disable DuplicateProperty background-image: image-url('collapsible-fieldset/expanded.png'); background-image: image-url('collapsible-fieldset/expanded.svg'), none; @@ -58,6 +59,7 @@ &__legend { @if support-for(ie, 8) { + // sass-lint:disable no-duplicate-properties // scss-lint:disable DuplicateProperty background-image: image-url('collapsible-fieldset/collapsed.png'); background-image: image-url('collapsible-fieldset/collapsed.svg'), none; diff --git a/STARTERKIT/sass/components/form-table/_form-table.scss b/STARTERKIT/sass/components/form-table/_form-table.scss index 4b23894..470fe99 100644 --- a/STARTERKIT/sass/components/form-table/_form-table.scss +++ b/STARTERKIT/sass/components/form-table/_form-table.scss @@ -69,6 +69,7 @@ } &__narrow-column { + // sass-lint:disable no-vendor-prefixes // scss-lint:disable VendorPrefix width: -moz-min-content; width: -webkit-min-content; diff --git a/STARTERKIT/sass/components/more-link/_more-link.scss b/STARTERKIT/sass/components/more-link/_more-link.scss index 07aa90f..cca94c1 100644 --- a/STARTERKIT/sass/components/more-link/_more-link.scss +++ b/STARTERKIT/sass/components/more-link/_more-link.scss @@ -19,6 +19,7 @@ @if support-for(ie, 8) { // IE8 does not support multiple backgrounds, so IE8 will ignore the second // declaration with the SVG. https://css-tricks.com/using-svg/ + // sass-lint:disable no-duplicate-properties // scss-lint:disable DuplicateProperty background-image: image-url('more-link/more-link__help-icon.png'); background-image: image-url('more-link/more-link__help-icon.svg'), none; diff --git a/STARTERKIT/sass/components/tabs/_tabs.scss b/STARTERKIT/sass/components/tabs/_tabs.scss index d9df3ca..5c6a305 100644 --- a/STARTERKIT/sass/components/tabs/_tabs.scss +++ b/STARTERKIT/sass/components/tabs/_tabs.scss @@ -23,9 +23,11 @@ .tabs, %tabs { - $tab-height: 1.25; - @extend %clearfix; + + // The line height of a tab. + $tab-height: 1.25; + @include margin((2 - $tab-height) 0 0); @include line-height($tab-height); @if support-for(ie, 9) { diff --git a/STARTERKIT/sass/components/watermark/_watermark.scss b/STARTERKIT/sass/components/watermark/_watermark.scss index 3dcfa86..a3f7c8b 100644 --- a/STARTERKIT/sass/components/watermark/_watermark.scss +++ b/STARTERKIT/sass/components/watermark/_watermark.scss @@ -20,6 +20,7 @@ font-weight: bold; text-transform: uppercase; text-align: center; + // sass-lint:disable no-color-literals // scss-lint:disable ColorVariable text-shadow: 0 0 1px rgba(0, 0, 0, .1); word-wrap: break-word; diff --git a/STARTERKIT/sass/init/_colors.scss b/STARTERKIT/sass/init/_colors.scss index b14de93..0a76c85 100644 --- a/STARTERKIT/sass/init/_colors.scss +++ b/STARTERKIT/sass/init/_colors.scss @@ -1,3 +1,4 @@ +// sass-lint:disable indentation, no-color-keywords, space-after-comma // scss-lint:disable ColorKeyword, ColorVariable, SpaceAfterComma // Colors @@ -11,7 +12,7 @@ // Style guide: sass.colors // Define the default color scheme's color names. -$chroma: define-default-color-scheme('branding', "The site's main colors. Can be used to define colors in other color schemes."); +$chroma: define-default-color-scheme('branding', 'The site\'s main colors. Can be used to define colors in other color schemes.'); $chroma: add-colors(( black: #000, diff --git a/STARTERKIT/sass/init/_variables.scss b/STARTERKIT/sass/init/_variables.scss index 7d601f0..632cc42 100644 --- a/STARTERKIT/sass/init/_variables.scss +++ b/STARTERKIT/sass/init/_variables.scss @@ -1,3 +1,4 @@ +// sass-lint:disable space-after-comma // scss-lint:disable SpaceAfterComma // Variables diff --git a/STARTERKIT/sass/init/rtl/_rtl.scss b/STARTERKIT/sass/init/rtl/_rtl.scss index ee48fee..5303a7a 100644 --- a/STARTERKIT/sass/init/rtl/_rtl.scss +++ b/STARTERKIT/sass/init/rtl/_rtl.scss @@ -13,12 +13,12 @@ $include-rtl: true !default; @mixin rtl() { @if $include-rtl { @if & { - [dir="rtl"] & { + [dir='rtl'] & { @content; } } @else { - [dir="rtl"] { + [dir='rtl'] { @content; } } diff --git a/STARTERKIT/sass/init/visually-hidden/_visually-hidden.scss b/STARTERKIT/sass/init/visually-hidden/_visually-hidden.scss index 40b86d8..56670ab 100644 --- a/STARTERKIT/sass/init/visually-hidden/_visually-hidden.scss +++ b/STARTERKIT/sass/init/visually-hidden/_visually-hidden.scss @@ -1,3 +1,4 @@ +// sass-lint:disable no-important // scss-lint:disable ImportantRule // visually-hidden() diff --git a/STARTERKIT/sass/style-guide/chroma-kss-markup.scss b/STARTERKIT/sass/style-guide/chroma-kss-markup.scss index d482ce1..a9e3102 100644 --- a/STARTERKIT/sass/style-guide/chroma-kss-markup.scss +++ b/STARTERKIT/sass/style-guide/chroma-kss-markup.scss @@ -2,6 +2,7 @@ @import 'init'; +// sass-lint:disable no-css-comments // scss-lint:disable Comment /* #{chroma-kss-markup()} diff --git a/STARTERKIT/sass/style-guide/kss-only.scss b/STARTERKIT/sass/style-guide/kss-only.scss index 1615af4..0b0c466 100644 --- a/STARTERKIT/sass/style-guide/kss-only.scss +++ b/STARTERKIT/sass/style-guide/kss-only.scss @@ -5,6 +5,6 @@ // options.styleGuide.css object in gulpfile.js. // Add an outline to every grid item in the style guide. -[id^="kssref-layouts-"] [class^="layout-"][class*="__"] { +[id^='kssref-layouts-'] [class^='layout-'][class*='__'] { outline: 1px dotted color('grey'); }