Skip to content

Commit

Permalink
📝 Add merge default rule examples
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPurdy committed Oct 16, 2015
1 parent 3ca62ba commit 3140d18
Showing 1 changed file with 87 additions and 1 deletion.
88 changes: 87 additions & 1 deletion docs/options/merge-default-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,94 @@

Option `merge-default-rules` will determine whether the rules present in a user's external configuration file or passed directly in to Sass Lint will override or merge with the default rules present in Sass Lint. All other configuration options will still be merged.

If an external configuration file has `merge-default-rules` set to `false`, its rules will override the default rules, but rules passed directly in to Sass Lint will be merged with the configuration file rules (unless they, to have `merge-default-rules` set to `false`, in which case they will override).
If an external configuration file has `merge-default-rules` set to `false`, its rules will override the default rules, but rules passed directly in to Sass Lint will be merged with the configuration file rules (unless they too have `merge-default-rules` set to `false`, in which case they will override).

## Options

* `true`/`false` (defaults to `true`)

## Examples

Below is a sample of sass-lints default rules. You can see the full default ruleset [here](https://github.com/sasstools/sass-lint/blob/develop/lib/config/sass-lint.yml).

```yml
options:
formatter: stylish
files:
include: '**/*.s+(a|c)ss'
rules:
# Extends
extends-before-mixins: 1
extends-before-declarations: 1
placeholder-in-extend: 1

# Mixins
mixins-before-declarations: 1
no-color-literals: 0

~~~
```

Below is a default user configured ruleset containing only one rule with `merge-default-rules: true`

```yml
options:
formatter: stylish
merge-default-rules: true
files:
include: '**/*.s+(a|c)ss'
rules:

no-color-literals: 1
```
With `merge-default-rules: true` the rules applied to the linter would be as follows. Notice that `no-color-literals` is now set to `1` and the default ruleset has been merged with our user config

```yml
options:
formatter: stylish
merge-default-rules: true
files:
include: '**/*.s+(a|c)ss'
rules:
# Extends
extends-before-mixins: 1
extends-before-declarations: 1
placeholder-in-extend: 1
# Mixins
mixins-before-declarations: 1
no-color-literals: 1
~~~
```

Below is a default user configured ruleset containing only one rule with `merge-default-rules: false`

```yml
options:
formatter: stylish
merge-default-rules: false
files:
include: '**/*.s+(a|c)ss'
rules:
no-color-literals: 1
```

With `merge-default-rules: false` the rules applied to the linter would be as follows. Notice that `no-color-literals` is now set to `1` but rules not present in the user configuration are not merged.

```yml
options:
formatter: stylish
merge-default-rules: false
files:
include: '**/*.s+(a|c)ss'
rules:
no-color-literals: 1
~~~
```

0 comments on commit 3140d18

Please sign in to comment.