From b1bb259292d85f416c9d9acfd2d540e03c3aa738 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Fri, 28 Aug 2015 19:44:04 +0200 Subject: [PATCH] Add scss linter --- .scss-lint.yml | 231 +++++++++++++++++++++++++++++++++++++++++++++++++ Gemfile | 1 + Gemfile.lock | 7 ++ bin/scss-lint | 16 ++++ 4 files changed, 255 insertions(+) create mode 100644 .scss-lint.yml create mode 100755 bin/scss-lint diff --git a/.scss-lint.yml b/.scss-lint.yml new file mode 100644 index 000000000..459768557 --- /dev/null +++ b/.scss-lint.yml @@ -0,0 +1,231 @@ +scss_files: 'app/assets/stylesheets/**/*.scss' +plugin_directories: ['.scss-linters'] + +# List of gem names to load custom linters from (make sure they are already +# installed) +plugin_gems: [] + +linters: + BangFormat: + enabled: true + space_before_bang: true + space_after_bang: false + + BemDepth: + enabled: false + max_elements: 1 + + BorderZero: + enabled: true + convention: zero # or `none` + + ColorKeyword: + enabled: true + + ColorVariable: + enabled: true + + Comment: + enabled: true + + DebugStatement: + enabled: true + + DeclarationOrder: + enabled: true + + DisableLinterReason: + enabled: false + + DuplicateProperty: + enabled: true + + ElsePlacement: + enabled: true + style: same_line # or 'new_line' + + EmptyLineBetweenBlocks: + enabled: true + ignore_single_line_blocks: true + + EmptyRule: + enabled: true + + ExtendDirective: + enabled: false + + FinalNewline: + enabled: true + present: true + + HexLength: + enabled: true + style: short # or 'long' + + HexNotation: + enabled: true + style: lowercase # or 'uppercase' + + HexValidation: + enabled: true + + IdSelector: + enabled: true + + ImportantRule: + enabled: true + + ImportPath: + enabled: true + leading_underscore: false + filename_extension: false + + Indentation: + enabled: true + allow_non_nested_indentation: false + character: space # or 'tab' + width: 2 + + LeadingZero: + enabled: true + style: exclude_zero # or 'include_zero' + + MergeableSelector: + enabled: true + force_nesting: true + + NameFormat: + enabled: true + allow_leading_underscore: true + convention: hyphenated_lowercase # or 'camel_case', or 'snake_case', or a regex pattern + + NestingDepth: + enabled: true + max_depth: 3 + ignore_parent_selectors: false + + PlaceholderInExtend: + enabled: true + + PropertyCount: + enabled: false + include_nested: false + max_properties: 10 + + PropertySortOrder: + enabled: true + ignore_unspecified: false + min_properties: 2 + separate_groups: false + + PropertySpelling: + enabled: true + extra_properties: [] + + PropertyUnits: + enabled: true + global: [ + 'ch', 'em', 'ex', 'rem', # Font-relative lengths + 'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths + 'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths + 'deg', 'grad', 'rad', 'turn', # Angle + 'ms', 's', # Duration + 'Hz', 'kHz', # Frequency + 'dpi', 'dpcm', 'dppx', # Resolution + '%'] # Other + properties: {} + + QualifyingElement: + enabled: true + allow_element_with_attribute: false + allow_element_with_class: false + allow_element_with_id: false + + SelectorDepth: + enabled: true + max_depth: 3 + + SelectorFormat: + enabled: true + convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern + + Shorthand: + enabled: true + allowed_shorthands: [1, 2, 3] + + SingleLinePerProperty: + enabled: true + allow_single_line_rule_sets: true + + SingleLinePerSelector: + enabled: true + + SpaceAfterComma: + enabled: true + + SpaceAfterPropertyColon: + enabled: true + style: one_space # or 'no_space', or 'at_least_one_space', or 'aligned' + + SpaceAfterPropertyName: + enabled: true + + SpaceAfterVariableName: + enabled: true + + SpaceAroundOperator: + enabled: true + style: one_space # or 'no_space' + + SpaceBeforeBrace: + enabled: true + style: space # or 'new_line' + allow_single_line_padding: false + + SpaceBetweenParens: + enabled: true + spaces: 0 + + StringQuotes: + enabled: true + style: single_quotes # or double_quotes + + TrailingSemicolon: + enabled: true + + TrailingWhitespace: + enabled: true + + TrailingZero: + enabled: false + + TransitionAll: + enabled: false + + UnnecessaryMantissa: + enabled: true + + UnnecessaryParentReference: + enabled: true + + UrlFormat: + enabled: true + + UrlQuotes: + enabled: true + + VariableForProperty: + enabled: false + properties: [] + + VendorPrefix: + enabled: true + identifier_list: base + additional_identifiers: [] + excluded_identifiers: [] + + ZeroUnit: + enabled: true + + Compass::*: + enabled: false diff --git a/Gemfile b/Gemfile index 65911040f..360508b6b 100644 --- a/Gemfile +++ b/Gemfile @@ -245,6 +245,7 @@ group :development do gem "pronto-jshint", "0.4.2" gem "pronto-rubocop", "0.4.6" gem "pronto-haml", "0.4.4" + gem "pronto-scss", "0.4.7" # Preloading environment diff --git a/Gemfile.lock b/Gemfile.lock index 862cdbe51..7cc2f0b37 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -514,6 +514,9 @@ GEM pronto-rubocop (0.4.6) pronto (~> 0.4.0) rubocop (~> 0.34.0) + pronto-scss (0.4.7) + pronto (~> 0.4.0) + scss_lint (~> 0.41.0) pry (0.10.1) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -688,6 +691,9 @@ GEM sawyer (0.6.0) addressable (~> 2.3.5) faraday (~> 0.8, < 0.10) + scss_lint (0.41.0) + rainbow (~> 2.0) + sass (~> 3.4.15) selenium-webdriver (2.47.1) childprocess (~> 0.5) multi_json (~> 1.0) @@ -862,6 +868,7 @@ DEPENDENCIES pronto-haml (= 0.4.4) pronto-jshint (= 0.4.2) pronto-rubocop (= 0.4.6) + pronto-scss (= 0.4.7) pry pry-byebug pry-debundle diff --git a/bin/scss-lint b/bin/scss-lint new file mode 100755 index 000000000..110639c4b --- /dev/null +++ b/bin/scss-lint @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'scss-lint' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('scss_lint', 'scss-lint')