cattr-app/frontend-application

View on GitHub
app/core/sass/includes/components/v-select.scss

Summary

Maintainability
Test Coverage

Expected border, found margin
Open

    margin: 0;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Class '.vs__selected' should be written in lowercase with hyphens
Open

  &__selected {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Expected margin, found border
Open

    border: 0;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Class '.vs__selected' should be written in lowercase with hyphens
Open

  &__selected {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Pseudo-class should be nested within its parent Parent-selector-extension
Open

  &__dropdown-toggle:hover {

Force Pseudo Nesting

Rule force-pseudo-nesting will enforce the nesting of pseudo elements/classes.

Examples

When enabled, the following are disallowed: ```scss p:nth-of-type(2) { margin: 0; }

.parent { .child { p::first-line { color: #ff0000; } } }

.parent { .child { .sub p::first-line { color: #ff0000; } } } ```

When enabled, the following are allowed:

p {
  &:nth-of-type(2) {
    margin: 0;
  }
}

.parent {
  .child {
    p {
      &::first-line {
        color: #ff0000;
      }
    }
  }
}

.parent {
  .child {
    .sub p {
      &::first-line {
        color: #ff0000;
      }
    }
  }
}

Class '.vs__dropdown-toggle' should be written in lowercase with hyphens
Open

  &__dropdown-toggle:hover {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Class '.vs__selected-options' should be written in lowercase with hyphens
Open

  &__selected-options {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Class '.vs__dropdown-toggle' should be written in lowercase with hyphens
Open

  &__dropdown-toggle {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Color literals such as '#fff' should only be used in variable declarations
Open

    background-color: #fff;

No Color Literals

Rule no-color-literals will disallow the use of color literals and basic color functions in any declarations other than variables or maps/lists.

The list of affected color functions are as follows: * rgb * rgba * hsl * hsla

Other color functions, such as adjust-color and mix, may be used, but the original color must be passed in as a variable.

Options

  • allow-map-identifiers: true/false (defaults to true)
  • allow-rgba: true/false (defaults to false)
  • allow-variable-identifiers: true/false (defaults to true)

Examples

When enabled and default options are used the following are disallowed.

.literal {
  color: mediumslateblue;
}

.linear-gradient-func {
  background: linear-gradient(top, #fff, white);
}

.box-shadow {
  box-shadow: 1px 1px black, 1px 1px black;
}

.background {
  background: 1px solid white;
}

.hex {
  color: #fff;
}

// rgb function passed directly as function argument
.adj {
  color: adjust-color(rgb(255, 0, 0), $blue: 5);
}

// hsl function passed directly as function argument
.scale {
  color: scale-color(hsl(120, 70%, 80%), $lightness: 50%);
}

// hsl function passed directly as function argument
.change {
  color: change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: .8);
}

// color literal passed directly as function argument
.function {
  color: test(#fff);
}

// color functions used directly as property values
.rgb {
  color: rgb(255, 255, 255);
}

.rgba {
  color: rgba(255, 255, 255, .3);
}

.hsl {
  color: hsl(40, 50%, 50%);
}

.hsla {
  color: hsla(40, 50%, 50%, .3);
}

When enabled and default options are used the following are allowed.

$literal: mediumslateblue;
$hexVar: #fff;
$rgb: rgb(255, 255, 255);
$rgba: rgba(255, 255, 255, .3);
$hsl: hsl(40, 50%, 50%);
$hsla: hsla(40, 50%, 50%, .3);

// using color literals as property names
$colors: (
  red: #fff,
  blue : (
    orange: #fff
  )
);

// using color literals as variable identifiers
$black: #000;

.literal {
  color: $literal;
}

.linear-gradient-func {
  background: linear-gradient(top, $hexVar, $literal);
}

.background {
  background: 1px solid $literal;
}

.hex {
  color: $hexVar;
}

.adj {
  color: adjust-color($off-red, $blue: 5);
}

.scale {
  color: scale-color($off-blue, $lightness: 50%);
}

.change {
  color: change-color($orange-extra, $lightness: 40%, $alpha: .8);
}

.function {
  color: test($hexVar);
}

.rgb {
  color: $rgb;
}

.rgba {
  color: $rgba;
}

.hsl {
  color: $hsl;
}

.hsla {
  color: $hsla;
}

[allow-rgba: true]

When enabled and allow-rgba is set to true, the following will be allowed:

// rgba in variables is still fine
$rgba: rgba(255, 0, 0, .5);
$red: rgb(255, 255, 255,);

// rgba can be used directly to alter a variables opacity
.color {
  color: rgba($red, .3);
}

In addition, when enabled and allow-rgba is set to true, the following will be disallowed:

.color {
  // you must use variables and not literals
  color: rgba(0, 0, 0, .3);
  color: rgba(black, .3);
}

[allow-variable-identifiers: false]

When enabled and allow-variable-identifiers is set to false, the following will be disallowed

// variable uses a color literal as an identifier
$black: #000

// variable using a color literal as an identifier is passed to a function
.test {
  color: adjust-color($off-red, $blue: 5)
}

When enabled and allow-variable-identifiers is set to false, the following will be allowed

// variable not directly using a color literal as an identifier
$primary-black: #000

[allow-map-identifiers: false]

When enabled and allow-map-identifiers is set to false, the following will be disallowed

// map identifiers red, blue and orange share their name with a
// color literal and therefore shouldn't be used
$colors: (
  red: #f00,
  blue: (
    orange: $orange
  )
)

When enabled and allow-map-identifiers is set to false, the following will be allowed

$colors: (
  primary-red: #f00,
  map-blue: (
    off-orange: $orange
  )
)

Rule .vs &__selected should be merged with the rule on line 11
Open

  &__selected {

No Mergeable Selectors

Rule no-mergeable-selectors will enforce that selectors aren't repeated and that their properties are merged. You may also pass a whitelist of selectors you wish to exclude from merging.

Options

  • whitelist: [array of selectors] (defaults to empty array [])

Examples

When enabled with the default options, the following will generate a warning/error :

.foo {
  content: 'bar';
}

//duplicate selector
.foo {
  color: red;
}

h1,
h2,
h3 {
  content: '';
}

// mergeable idents
h1, h2, h3 {
  content: '';
}

.test {
  .bar {
    color: blue;
  }
}

// 2 mergeable selectors .test & .test .bar
.test {
  .bar {
    color: red;
  }
}

When whitelist: ['div p', 'div a'] the following will be allowed and no longer generate any mergeable warnings or errors:

div p {
  color: red;
}

// will not be warned as mergeable / duplicate
div p {
  content: '';
}

div a {
  color: blue;
}

// will not be warned as mergeable / duplicate
div a {
  content: '';
}

Note for Sass syntax users

Due to a bug in the current version of the AST we use, gonzales-pe, we are currently unable to enforce this rule within media queries, SCSS syntax is unaffected. We hope to rectify this soon.

Class '.vs__no-options' should be written in lowercase with hyphens
Open

  &__no-options {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Expected color, found padding
Open

    padding: 6px 12px;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Class should be nested within its parent Class
Open

.has-error .vs__dropdown-toggle {

Force Element Nesting

Rule force-element-nesting will enforce the nesting of elements

Examples

When enabled, the following are disallowed:

div p {
  content: '';
}

.parent {
  &__child h1 {
    content: '';
  }
}

a[target="_blank"] span {
  content: '';
}

When enabled, the following are allowed:

div {
  p {
    content: '';
  }
}

.parent {
  &__child {
    h1 {
      content: '';
    }
  }
}

a[target="_blank"] {
  span {
    content: '';
  }
}

Don't include leading zeros on numbers
Open

    font-size: 0.9rem;

Leading Zero

Rule leading-zero will enforce whether or not decimal numbers should include a leading zero.

Options

  • include: true/false (defaults to false)

Examples

When include: false, the following are allowed. When include: true, the following are disallowed:

.foo {
  font-size: .5em;
}

When include: true, the following are allowed. When include: false, the following are disallowed:

.foo {
  font-size: 0.5em;
}

Expected font-size, found border
Open

    border: none;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Class '.vs__dropdown-menu' should be written in lowercase with hyphens
Open

  &__dropdown-menu {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Class '.vs__actions' should be written in lowercase with hyphens
Open

  &__actions {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Don't include leading zeros on numbers
Open

    font-size: 0.9rem;

Leading Zero

Rule leading-zero will enforce whether or not decimal numbers should include a leading zero.

Options

  • include: true/false (defaults to false)

Examples

When include: false, the following are allowed. When include: true, the following are disallowed:

.foo {
  font-size: .5em;
}

When include: true, the following are allowed. When include: false, the following are disallowed:

.foo {
  font-size: 0.5em;
}

Expected line-height, found padding
Open

    padding: 6px 12px;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Expected border-radius, found border
Open

    border: none;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Pseudo-class should be nested within its parent Parent-selector-extension
Open

  &__search:focus {

Force Pseudo Nesting

Rule force-pseudo-nesting will enforce the nesting of pseudo elements/classes.

Examples

When enabled, the following are disallowed: ```scss p:nth-of-type(2) { margin: 0; }

.parent { .child { p::first-line { color: #ff0000; } } }

.parent { .child { .sub p::first-line { color: #ff0000; } } } ```

When enabled, the following are allowed:

p {
  &:nth-of-type(2) {
    margin: 0;
  }
}

.parent {
  .child {
    p {
      &::first-line {
        color: #ff0000;
      }
    }
  }
}

.parent {
  .child {
    .sub p {
      &::first-line {
        color: #ff0000;
      }
    }
  }
}

Class '.vs__search' should be written in lowercase with hyphens
Open

  &__search:focus {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Class '.vs__dropdown-option' should be written in lowercase with hyphens
Open

  &__dropdown-option {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Expected padding, found color
Open

    color: $text-color;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Expected border, found margin
Open

    margin: 0;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Don't include leading zeros on numbers
Open

    font-size: 0.9rem;

Leading Zero

Rule leading-zero will enforce whether or not decimal numbers should include a leading zero.

Options

  • include: true/false (defaults to false)

Examples

When include: false, the following are allowed. When include: true, the following are disallowed:

.foo {
  font-size: .5em;
}

When include: true, the following are allowed. When include: false, the following are disallowed:

.foo {
  font-size: 0.5em;
}

Expected padding, found color
Open

    color: $text-color;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Expected border, found top
Open

    top: calc(100% + 2px);

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Expected padding, found border-radius
Open

    border-radius: 4px;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Don't include leading zeros on numbers
Open

    font-size: 0.9rem;

Leading Zero

Rule leading-zero will enforce whether or not decimal numbers should include a leading zero.

Options

  • include: true/false (defaults to false)

Examples

When include: false, the following are allowed. When include: true, the following are disallowed:

.foo {
  font-size: .5em;
}

When include: true, the following are allowed. When include: false, the following are disallowed:

.foo {
  font-size: 0.5em;
}

Expected color, found padding
Open

    padding: 6px 12px;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Class '.vs__clear' should be written in lowercase with hyphens
Open

  &__clear {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Class '.vs__dropdown-toggle' should be written in lowercase with hyphens
Open

.has-error .vs__dropdown-toggle {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Class '.vs__search' should be written in lowercase with hyphens
Open

  &__search,

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Expected top, found padding
Open

    padding: 0;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Expected padding, found line-height
Open

    line-height: 26px;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Expected margin, found font-size
Open

    font-size: 0.9rem;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Expected color, found padding
Open

    padding: 8px 12px;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

Class '.vs__dropdown-toggle' should be written in lowercase with hyphens
Open

  &--open &__dropdown-toggle {

Class Name Format

Rule class-name-format will enforce a convention for class names.

Options

  • allow-leading-underscore: true/false (defaults to true)
  • convention: 'hyphenatedlowercase' (default), camelcase, snakecase, strictbem, hyphenatedbem, or a Regular Expression that the class name must match (e.g. ^[_A-Z]+$)
  • convention-explanation: Custom explanation to display to the user if a class doesn't adhere to the convention
  • ignore: Array of names to ignore

Example 1

Settings: - allow-leading-underscore: true - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &._with-leading-underscore {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 2

Settings: - allow-leading-underscore: false - convention: hyphenatedlowercase

When enabled, the following are allowed:

.hyphenated-lowercase {
  content: '';

  &.another-hyphenated-lowercase {
    content: '';
  }
}

.foo {
  @extend .hyphenated-lowercase;
}

When enabled, the following are disallowed:

._with-leading-underscore {
  content: '';
}

.HYPHENATED-UPPERCASE {
  content: '';
}

.camelCase {
  content: '';

  @extend .snake_case;
}

Example 3

Settings: - convention: camelcase

When enabled, the following are allowed:

.camelCase {
  content: '';
}

.foo {
  @extend .anotherCamelCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 4

Settings: - convention: pascalcase

When enabled, the following are allowed:

.PascalCase {
  content: '';
}

.Foo {
  @extend .AnotherPascalCase;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .snake_case;
}

Example 5

Settings: - convention: snakecase

When enabled, the following are allowed:

.snake_case {
  content: '';
}

.foo {
  @extend .another_snake_case;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 6

Settings: - convention: strictbem

When enabled, the following are allowed:

.block-name__elem-name {
  content: '';
}

.owner-name_mod-name_mod-val {
  content: '';
}

.block-name__elem-name_mod-bool {
  content: '';
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 7

Settings: - convention: hyphenatedbem

When enabled, the following are allowed:

.site-search {
  color: blue;
  width: 50px;
  height: 100%;
}

.site-search__field {
  text-decoration: underline;
}

.site-search--full {
  color: green;
}

When enabled, the following are disallowed:

.HYPHENATED-UPPERCASE {
  content: '';
}

.foo {
  @extend .camelCase;
}

Example 8

Settings: - convention: ^[_A-Z]+$ - convention-explanation: 'Class must contain only uppercase letters and underscores'

When enabled, the following are allowed:

.SCREAMING_SNAKE_CASE {
  content: '';
}

.foo {
  @extend .SCREAMING_SNAKE_CASE;
}

When enabled, the following are disallowed:

(Each line with a class will report Class must contain only uppercase letters and underscores when linted.)

.HYPHENATED-UPPERCASE {
  content: '';
}

.snake_case {
  content: '';
}

.foo {
  @extend .camelCase;
}

Expected padding, found color
Open

    color: $text-color;

Property Sort Order

Rule property-sort-order will enforce the order in which declarations are written.

Options

  • order: 'alphabetical', 'concentric', 'recess', 'smacss', or [array of properties] (defaults to alphabetical. Unknown properties are sorted alphabetically)
  • ignore-custom-properties: true/false (defaults to false)

Property orders: https://github.com/sasstools/sass-lint/tree/develop/lib/config/property-sort-orders

Examples

When enabled (assuming order: alphabetical), the following are allowed:

.foo {
  content: 'baz';
  height: 100vh;
  width: 100vw;
}

When enabled (assuming order: alphabetical), the following are disallowed:

.foo {
  width: 100vw;
  height: 100vh;
  content: 'baz';
}

Custom Sort Orders

You have the option to create your own custom property sort orders. These are specified in your .sass-lint.yml file as below:

property-sort-order:
  - 1
  -
    order:
      - border
      - display
      - color

When the custom order is specified as above, the following are allowed:

.foo {
  border: 1px solid blue;
  display: block;
  color: red;
}

When the custom order is specified as above, the following are disallowed:

.foo {
  display: block;
  color: red;
  border: 1px solid blue;
}

Ignore Custom Properties

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be allowed

.foo {
  border: 1px solid blue;
  color: red;
  composes: heading;
  display: block;
}

When ignore-custom-properties: false (assume order: 'alphabetical') the following would be disallowed

.foo {
  composes: heading; // not in alphabetical order
  border: 1px solid blue;
  color: red;
  display: block;
}

When ignore-custom-properties: true (assume order: 'alphabetical') the following would be allowed

.foo {
  composes: heading; // custom properties ignored
  border: 1px solid blue;
  color: red;
  display: block;
}

A value of none is not allowed. 0 must be used.
Open

    border: none;

Border Zero

Rule border-zero will enforce whether one should use 0 or none when specifying a zero border value

Options

  • convention: '0'/'none' (defaults to 0)

If an invalid convention is provided the rule will default back to convention: '0'. An extra warning/error will also be thrown on line 1 column 1 of a file with a lint issue to inform you of this fact.

Examples

When convention: '0', the following are allowed. When convention: 'none', the following are disallowed:

.foo {
  border: 0;
}

.bar {
  border-right: 0;
}

When convention: 'none', the following are allowed. When convention: '0', the following are disallowed:

.foo {
  border: none;
}

.bar {
  border-left: none;
}

Invalid conventions

When the invalid convention convention: 'zero' is supplied, the following are allowed as the rule defaults to convention: '0'.

.foo {
  border: none;
}

.bar {
  border-left: 0;
}

A value of none is not allowed. 0 must be used.
Open

    border: none;

Border Zero

Rule border-zero will enforce whether one should use 0 or none when specifying a zero border value

Options

  • convention: '0'/'none' (defaults to 0)

If an invalid convention is provided the rule will default back to convention: '0'. An extra warning/error will also be thrown on line 1 column 1 of a file with a lint issue to inform you of this fact.

Examples

When convention: '0', the following are allowed. When convention: 'none', the following are disallowed:

.foo {
  border: 0;
}

.bar {
  border-right: 0;
}

When convention: 'none', the following are allowed. When convention: '0', the following are disallowed:

.foo {
  border: none;
}

.bar {
  border-left: none;
}

Invalid conventions

When the invalid convention convention: 'zero' is supplied, the following are allowed as the rule defaults to convention: '0'.

.foo {
  border: none;
}

.bar {
  border-left: 0;
}

Properties should be ordered color, font-size, line-height, padding, white-space, width
Open

    padding: 6px 12px;

Properties should be ordered border, margin
Open

    margin: 0;

Properties should be ordered border, border-radius, padding, top
Open

    top: calc(100% + 2px);

0.9 should be written without a leading zero as .9
Open

    font-size: 0.9rem;

Merge rule &__selected with rule on line 11
Open

  &__selected {

0.9 should be written without a leading zero as .9
Open

    font-size: 0.9rem;

Properties should be ordered border, font-size, line-height, margin, padding
Open

    margin: 0;

Selector vs__dropdown-toggle should be written in lowercase with hyphens
Open

.has-error .vs__dropdown-toggle {

0.9 should be written without a leading zero as .9
Open

    font-size: 0.9rem;

Properties should be ordered color, font-size, line-height, padding
Open

    padding: 6px 12px;

Properties should be ordered color, font-size, line-height, padding
Open

    padding: 8px 12px;

0.9 should be written without a leading zero as .9
Open

    font-size: 0.9rem;

border: 0 is preferred over border: none
Open

    border: none;

Color literals like #fff should only be used in variable declarations; they should be referred to via variable everywhere else.
Open

    background-color: #fff;

border: 0 is preferred over border: none
Open

    border: none;

There are no issues that match your filters.

Category
Status