Skip to content

Commit 3797a71

Browse files
authored
Merge pull request #933 from sasstools/release/1.10
Prepare 1.10
2 parents 01bdb5a + feea65d commit 3797a71

File tree

102 files changed

+2848
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2848
-202
lines changed

.eslintrc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,12 @@ rules:
135135
- global
136136
valid-jsdoc:
137137
- 2
138-
- prefer:
139-
return: returns
138+
-
139+
requireParamDescription: true
140+
requireReturnDescription: true
141+
requireReturn: false
142+
prefer:
143+
return: "returns"
140144
wrap-iife: 2
141145
yoda:
142146
- 2

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
language: node_js
22
node_js:
3-
- '0.10'
4-
- '0.12'
53
- '4'
64
- '5'
75
- node
8-
- iojs
9-
before_script: npm link
106
after_success: npm run coveralls
117
notifications:
128
slack:

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,62 @@
11
# Sass Lint Changelog
22

3+
## v1.10.0
4+
5+
**November 6th, 2016**
6+
7+
The 'you can ignore those bad habits again' update
8+
9+
** :tada: DISABLE LINTERS :tada: **
10+
The ability to enable and disable linters on the fly has finally(!) been added [#677](https://github.com/sasstools/sass-lint/pull/677) [docs](https://github.com/sasstools/sass-lint/blob/master/docs/toggle-rules-in-src.md)
11+
12+
A massive thank you to everyone who commented/contributed/reported and tested this feature this was very much a community effort here. An extra special thank you to
13+
* [@donabrams](https://github.com/donabrams)
14+
15+
For his initial hard work in getting this off the ground. There were lots of others who have fixed everything from test issues to AST issues to make this possible afterwards, so thanks to you too!
16+
17+
**New Features**
18+
* `max-warnings` which is available with the sass-lint CLI is now available as an option in your config file too [#857](https://github.com/sasstools/sass-lint/pull/857)
19+
* **New Rule** `no-url-domains` rule [#846](https://github.com/sasstools/sass-lint/pull/846) [docs](https://github.com/sasstools/sass-lint/blob/master/docs/rules/no-url-domains.md)
20+
* **New Rule** `max-line-length` rule was added [#840](https://github.com/sasstools/sass-lint/pull/840) [docs](https://github.com/sasstools/sass-lint/blob/master/docs/rules/max-line-length.md)
21+
* **New Rule** `max-file-line-count` rule was added [#842](https://github.com/sasstools/sass-lint/pull/842) [docs](https://github.com/sasstools/sass-lint/blob/master/docs/rules/max-file-line-count.md)
22+
* **New Rule** `declarations-before-nesting` rule was added [#866](https://github.com/sasstools/sass-lint/pull/866) [docs](https://github.com/sasstools/sass-lint/blob/master/docs/rules/declarations-before-nesting.md)
23+
24+
**Fixes**
25+
* Fixed an issue with an un handled error being thrown in certain circumstances for the `space-before-colon` rule [#894](https://github.com/sasstools/sass-lint/pull/894)
26+
* Operators in variable names are now handled correctly for the `variable-name-format` rule [#903](https://github.com/sasstools/sass-lint/pull/903)
27+
* Fixed an issue with string values in the `shorthand-values` rule [#848](https://github.com/sasstools/sass-lint/pull/848)
28+
* Fixed an issue with valid strict BEM producing an error in the `*-name-format` rules [#892](https://github.com/sasstools/sass-lint/pull/892)
29+
* Fixed an issue with non-string user conventions in the `border-zero` rule [#913](https://github.com/sasstools/sass-lint/pull/913)
30+
* Fixed an issue where BOM markers in files were causing parse errors or random errors/warnings [#893](https://github.com/sasstools/sass-lint/pull/893)
31+
* Fixed an issue with interpolates properties in the `no-duplicate-properties` rule [#915](https://github.com/sasstools/sass-lint/pull/915)
32+
* Fixed a possible error with invalid user conventions in the `border-zero` rule [#926](https://github.com/sasstools/sass-lint/pull/926)
33+
34+
**Changes**
35+
* Node 0.10 and 0.12 are no longer officially supported by sass-lint. We've not deliberately broken these builds but we will no longer be testing against them either [#896](https://github.com/sasstools/sass-lint/issues/896) & [#924](https://github.com/sasstools/sass-lint/pull/924)
36+
* In future the `no-url-protocols` rule will not lint domains in URL's for now a new flag is added to mimic this behaviour. The new `no-url-domains` rule can be used instead [#813](https://github.com/sasstools/sass-lint/issues/813)
37+
* Front matter such as those present in Jekyll templates will now be ignored in all files before passing to the AST / Linting [897](https://github.com/sasstools/sass-lint/pull/897)
38+
* Running the tests no longer required sass-lint development to be `npm-link`ed or globally installed. [#911](https://github.com/sasstools/sass-lint/pull/911)
39+
* The concentric property list in `property-sort-order` was updated to reflect the latest release [#922](https://github.com/sasstools/sass-lint/pull/922)
40+
41+
**Updates**
42+
* AST fixes have arrived with version 3.4.7 of gonzales-pe [#906](https://github.com/sasstools/sass-lint/pull/906)
43+
* Updated to the latest versions of many other packages
44+
45+
**Documentation**
46+
* The documentation around configuring a rule was tidied up and made clearer [#910](https://github.com/sasstools/sass-lint/pull/910)
47+
48+
**Special thanks to**
49+
50+
* [bgriffith](https://github.com/bgriffith)
51+
* [donabrams](https://github.com/donabrams)
52+
* [danpurdy](https://github.com/DanPurdy)
53+
* [danwaz](https://github.com/danwaz)
54+
* [lucasjahn](https://github.com/lucasjahn)
55+
* [mrjamesriley](https://github.com/mrjamesriley)
56+
* [notrobin](https://github.com/nottrobin)
57+
* [onishiweb](https://github.com/onishiweb)
58+
* [richarddewit](https://github.com/richarddewit)
59+
360
## v1.9.1
461

562
**August 25, 2016**

README.md

Lines changed: 101 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,97 @@ For all [rules](https://github.com/sasstools/sass-lint/tree/master/docs/rules),
7979

8080
If you want to configure options, set the rule to an array, where the first item in the array is the severity, and the second item in the array is an object including the options you would like to set.
8181

82-
An example configuration of a rule with options look like the following:
82+
Here is an example configuration of a rule, where we are specifying that breaking the [indentation rule](https://github.com/sasstools/sass-lint/blob/master/docs/rules/indentation.md) should be treated as an error (its severity set to two), and setting the `size` option of the rule to 2 spaces:
8383

8484
```yml
85-
indentation:
86-
- 2
87-
-
88-
size: 2
85+
rules:
86+
indentation:
87+
- 2
88+
-
89+
size: 2
8990
```
9091

9192
### [Rules Documentation](https://github.com/sasstools/sass-lint/tree/master/docs/rules)
9293

9394
---
9495

96+
## Disabling Linters via Source
97+
98+
Special comments can be used to disable and enable certain rules throughout your source files in a variety of scenarios. These can be useful when dealing with legacy code or with certain necessary code smells. You can read the documentation for this feature [here](https://github.com/sasstools/sass-lint/tree/master/docs/toggle-rules-in-src.md).
99+
100+
Below are examples of how to use this feature:
101+
102+
103+
### Disable a rule for the entire file
104+
105+
```scss
106+
// sass-lint:disable border-zero
107+
p {
108+
border: none; // No lint reported
109+
}
110+
```
111+
112+
### Disable more than 1 rule
113+
114+
```scss
115+
// sass-lint:disable border-zero, quotes
116+
p {
117+
border: none; // No lint reported
118+
content: "hello"; // No lint reported
119+
}
120+
```
121+
122+
### Disable a rule for a single line
123+
124+
```scss
125+
p {
126+
border: none; // sass-lint:disable-line border-zero
127+
}
128+
```
129+
130+
### Disable all lints within a block (and all contained blocks)
131+
132+
```scss
133+
p {
134+
// sass-lint:disable-block border-zero
135+
border: none; // No result reported
136+
}
137+
138+
a {
139+
border: none; // Failing result reported
140+
}
141+
```
142+
143+
### Disable and enable again
144+
145+
```scss
146+
// sass-lint:disable border-zero
147+
p {
148+
border: none; // No result reported
149+
}
150+
// sass-lint:enable border-zero
151+
152+
a {
153+
border: none; // Failing result reported
154+
}
155+
```
156+
157+
### Disable/enable all linters
158+
159+
```scss
160+
// sass-lint:disable-all
161+
p {
162+
border: none; // No result reported
163+
}
164+
// sass-lint:enable-all
165+
166+
a {
167+
border: none; // Failing result reported
168+
}
169+
```
170+
171+
---
172+
95173
## CLI
96174

97175
Sass Lint [`v1.1.0`](https://github.com/sasstools/sass-lint/releases/tag/v1.1.0) introduced the ability to run Sass Lint through a command line interface. See the [CLI Docs](https://github.com/sasstools/sass-lint/tree/master/docs/cli) for full documentation on how to use the CLI.
@@ -169,6 +247,24 @@ For further information you can visit our CLI documentation linked below.
169247
170248
---
171249
250+
## Front matter
251+
252+
Certain static site generators such as [Jekyll](http://jekyllrb.com/docs/frontmatter/) include the YAML front matter block at the top of their scss file. Sass-lint by default checks a file for this block and attempts to parse your Sass without this front matter. You can see an example of a front matter block below.
253+
254+
```scss
255+
256+
---
257+
# Only the main Sass file needs front matter (the dashes are enough)
258+
---
259+
260+
.test {
261+
color: red;
262+
}
263+
264+
```
265+
266+
---
267+
172268
## Contributions
173269

174270
We welcome all contributions to this project but please do read our [contribution guidelines](https://github.com/sasstools/sass-lint/blob/master/CONTRIBUTING.md) first, especially before opening a pull request. It would also be good to read our [code of conduct](https://github.com/sasstools/sass-lint/blob/master/CODE_OF_CONDUCT.md).

appveyor.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,17 @@ init:
55
# Test against this version of Node.js
66
environment:
77
matrix:
8-
- nodejs_version: '0.10'
9-
- nodejs_version: '0.12'
10-
# io.js
11-
- nodejs_version: '1'
128
- nodejs_version: '4'
139
- nodejs_version: '5'
1410
# Latest stable version of Node
1511
- nodejs_version: 'stable'
16-
matrix:
17-
# Help instructions and version number don't show in appveyor
18-
allow_failures:
19-
- nodejs_version: '0.10'
2012

2113
# Install scripts. (runs after repo cloning)
2214
install:
2315
# Get the latest stable version of Node.js or io.js
2416
- ps: Install-Product node $env:nodejs_version
2517
# install modules
2618
- npm install
27-
# link
28-
- npm link
2919

3020
# Post-install test scripts.
3121
test_script:

bin/sass-lint.js

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@ var program = require('commander'),
66
lint = require('../index');
77

88
var configPath,
9-
ignores,
10-
configOptions = {},
11-
exitCode = 0;
12-
13-
var tooManyWarnings = function (detects) {
14-
var warningCount = lint.warningCount(detects).count;
15-
16-
return warningCount > 0 && warningCount > program.maxWarnings;
17-
};
9+
configOptions = {};
1810

1911
var detectPattern = function (pattern) {
2012
var detects;
@@ -25,13 +17,7 @@ var detectPattern = function (pattern) {
2517
lint.outputResults(detects, configOptions, configPath);
2618
}
2719

28-
if (lint.errorCount(detects).count || tooManyWarnings(detects)) {
29-
exitCode = 1;
30-
}
31-
32-
if (program.exit) {
33-
lint.failOnError(detects);
34-
}
20+
lint.failOnError(detects, configOptions, configPath);
3521
};
3622

3723
program
@@ -47,47 +33,32 @@ program
4733
.option('--max-warnings [integer]', 'Number of warnings to trigger nonzero exit code')
4834
.parse(process.argv);
4935

36+
// Create "options" and "files" dictionaries if they don't exist
37+
configOptions.files = configOptions.files || {};
38+
configOptions.options = configOptions.options || {};
5039

5140
if (program.config && program.config !== true) {
5241
configPath = program.config;
5342
}
5443

5544
if (program.ignore && program.ignore !== true) {
56-
ignores = program.ignore.split(', ');
57-
if (configOptions.hasOwnProperty('files')) {
58-
configOptions.files.ignore = ignores;
59-
}
60-
else {
61-
configOptions.files = {
62-
'ignore': ignores
63-
};
64-
}
45+
configOptions.files.ignore = program.ignore.split(', ');
6546
}
6647

6748
if (program.syntax && ['sass', 'scss'].indexOf(program.syntax) > -1) {
6849
configOptions.syntax = program.syntax;
6950
}
7051

7152
if (program.format && program.format !== true) {
72-
if (configOptions.hasOwnProperty('options')) {
73-
configOptions.options.formatter = program.format;
74-
}
75-
else {
76-
configOptions.options = {
77-
'formatter': program.format
78-
};
79-
}
53+
configOptions.options.formatter = program.format;
8054
}
8155

8256
if (program.output && program.output !== true) {
83-
if (configOptions.hasOwnProperty('options')) {
84-
configOptions.options['output-file'] = program.output;
85-
}
86-
else {
87-
configOptions.options = {
88-
'output-file': program.output
89-
};
90-
}
57+
configOptions.options['output-file'] = program.output;
58+
}
59+
60+
if (program.maxWarnings && program.maxWarnings !== true) {
61+
configOptions.options['max-warnings'] = program.maxWarnings;
9162
}
9263

9364
if (program.args.length === 0) {
@@ -98,7 +69,3 @@ else {
9869
detectPattern(path);
9970
});
10071
}
101-
102-
process.on('exit', function () {
103-
process.exit(exitCode); // eslint-disable-line no-process-exit
104-
});

docs/options/max-warnings.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Max warnings
2+
3+
An error will be thrown if the total number of warnings exceeds the `max-warnings` setting.
4+
5+
## Examples
6+
7+
This can be set as a command-line option:
8+
9+
``` bash
10+
$ sass-lint --max-warnings 50
11+
```
12+
13+
In `.sass-lint.yml`:
14+
15+
``` yaml
16+
options:
17+
max-warnings: 50
18+
```
19+
20+
Or inside a script:
21+
22+
``` javascript
23+
var sassLint = require('sass-lint'),
24+
config = {options: {'max-warnings': 50}};
25+
26+
results = sassLint.lintFiles('sass/**/*.scss', config)
27+
sassLint.failOnError(results, config);
28+
```
29+

0 commit comments

Comments
 (0)