Skip to content

Commit 00a894e

Browse files
committedApr 17, 2016
Revert "Add BEM conventions for all naming rules #598"
1 parent 4beda5a commit 00a894e

24 files changed

+66
-762
lines changed
 

‎bin/sass-lint.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ var configPath,
1010
configOptions = {},
1111
exitCode = 0;
1212

13+
var tooManyWarnings = function (detects) {
14+
var warningCount = lint.warningCount(detects).count;
15+
16+
return warningCount > 0 && warningCount > program.maxWarnings;
17+
};
18+
1319
var detectPattern = function (pattern) {
1420
var detects;
1521

@@ -19,7 +25,7 @@ var detectPattern = function (pattern) {
1925
lint.outputResults(detects, configOptions, configPath);
2026
}
2127

22-
if (lint.errorCount(detects).count) {
28+
if (lint.errorCount(detects).count || tooManyWarnings(detects)) {
2329
exitCode = 1;
2430
}
2531

@@ -38,6 +44,7 @@ program
3844
.option('-f, --format [format]', 'pass one of the available eslint formats')
3945
.option('-o, --output [output]', 'the path and filename where you would like output to be written')
4046
.option('-s, --syntax [syntax]', 'syntax to evaluate the file(s) with (either sass or scss)')
47+
.option('--max-warnings [integer]', 'Number of warnings to trigger nonzero exit code')
4148
.parse(process.argv);
4249

4350

‎docs/cli/readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Command Line Flag | Description
1616
`-f`,`--format [format]` | Pass one of the available [Eslint formats](https://github.com/eslint/eslint/tree/master/lib/formatters) to format the output of sass-lint results.
1717
`-h`,`--help` | Outputs usage information for the CLI
1818
`-i`,`--ignore [pattern]` | A pattern that should be ignored from linting. Multiple patterns can be used by separating each pattern by `, `. Patterns should be wrapped in quotes (will be merged with other ignore options)
19+
`--max-warnings [integer]`| Normally, if SassLint runs and finds no errors (only warnings), it will exit with a success exit status. However, if this option is specified and the total warning count is greater than the specified threshold, SassLint will exit with an error status.
1920
`-o`,`--output [output]` | The path plus file name relative to where Sass Lint is being run from where the output should be written to.
2021
`-q`,`--no-exit` | Prevents the CLI from throwing an error if there is one (useful for development work)
2122
`-s`,`--syntax` | Syntax to evaluate the given file(s) with, either sass or scss. Use with care: overrides filename extension-based syntax detection.

‎docs/rules/function-name-format.md

+1-68
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Rule `function-name-format` will enforce a convention for function names.
55
## Options
66

77
* `allow-leading-underscore`: `true`/`false` (defaults to `true`)
8-
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, [`strictbem`](https://en.bem.info/method/definitions/),
9-
[`hyphenatedbem`](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/), or a Regular Expression that the function name must match (e.g. `^[_A-Z]+$`)
8+
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, or a Regular Expression that the function name must match (e.g. `^[_A-Z]+$`)
109
* `convention-explanation`: Custom explanation to display to the user if a function doesn't adhere to the convention
1110

1211
## Example 1
@@ -117,72 +116,6 @@ When enabled, the following are disallowed:
117116

118117
## Example 4
119118

120-
Settings:
121-
- `convention: strictbem`
122-
123-
When enabled, the following are allowed:
124-
125-
```scss
126-
@function namespace__function {
127-
@return "foo";
128-
}
129-
130-
@function namespace__function_mod-name {
131-
@return "foo";
132-
}
133-
134-
@function namespace_mod-name__function {
135-
@return "foo";
136-
}
137-
```
138-
139-
When enabled, the following are disallowed:
140-
141-
```scss
142-
@function HYPHENATED-UPPERCASE {
143-
@return "foo";
144-
}
145-
146-
.foo {
147-
content: camelCase();
148-
}
149-
```
150-
151-
## Example 5
152-
153-
Settings:
154-
- `convention: hyphenatedbem`
155-
156-
When enabled, the following are allowed:
157-
158-
```scss
159-
@function namespace__function {
160-
@return "foo";
161-
}
162-
163-
@function namespace__function--mod-name {
164-
@return "foo";
165-
}
166-
167-
@function namespace--mod-name__function {
168-
@return "foo";
169-
}
170-
```
171-
172-
When enabled, the following are disallowed:
173-
174-
```scss
175-
@function HYPHENATED-UPPERCASE {
176-
@return "foo";
177-
}
178-
179-
.foo {
180-
content: camelCase();
181-
}
182-
```
183-
184-
## Example 6
185-
186119
Settings:
187120
- `allow-leading-underscore: true`
188121
- `convention: '^[_A-Z]+$'`

‎docs/rules/mixin-name-format.md

+1-69
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Rule `mixin-name-format` will enforce a convention for mixin names.
55
## Options
66

77
* `allow-leading-underscore`: `true`/`false` (defaults to `true`)
8-
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, [`strictbem`](https://en.bem.info/method/definitions/),
9-
[`hyphenatedbem`](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/), or a Regular Expression that the variable name must match (e.g. `^[_A-Z]+$`)
8+
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, or a Regular Expression that the variable name must match (e.g. `^[_A-Z]+$`)
109
* `convention-explanation`: Custom explanation to display to the user if a mixin doesn't adhere to the convention
1110

1211
## Example 1
@@ -118,73 +117,6 @@ When enabled, the following are disallowed:
118117

119118
## Example 4
120119

121-
Settings:
122-
- `convention: strictbem`
123-
124-
When enabled, the following are allowed:
125-
126-
```scss
127-
@mixin block-name {
128-
content: '';
129-
}
130-
131-
@mixin block-name__mixin {
132-
content: '';
133-
}
134-
135-
@mixin block-name_mod-name {
136-
content: '';
137-
}
138-
```
139-
140-
When enabled, the following are disallowed:
141-
142-
```scss
143-
@mixin HYPHENATED-UPPERCASE {
144-
content: '';
145-
}
146-
147-
.foo {
148-
@include camelCase();
149-
}
150-
```
151-
152-
## Example 5
153-
154-
Settings:
155-
- `convention: hyphenatedbem`
156-
157-
When enabled, the following are allowed:
158-
159-
```scss
160-
@mixin block-name {
161-
content: '';
162-
}
163-
164-
@mixin block-name__mixin {
165-
content: '';
166-
}
167-
168-
@mixin block-name--mod-name {
169-
content: '';
170-
}
171-
```
172-
173-
When enabled, the following are disallowed:
174-
175-
```scss
176-
@mixin HYPHENATED-UPPERCASE {
177-
content: '';
178-
}
179-
180-
.foo {
181-
@include camelCase();
182-
}
183-
```
184-
185-
186-
## Example 6
187-
188120
Settings:
189121
- `allow-leading-underscore: true`
190122
- `convention: ^[_A-Z]+$`

‎docs/rules/placeholder-name-format.md

+1-68
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Rule `placeholder-name-format` will enforce a convention for placeholder names.
55
## Options
66

77
* `allow-leading-underscore`: `true`/`false` (defaults to `true`)
8-
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, [`strictbem`](https://en.bem.info/method/definitions/),
9-
[`hyphenatedbem`](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/), or a Regular Expression that the variable name must match (e.g. `^[_A-Z]+$`)
8+
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, or a Regular Expression that the variable name must match (e.g. `^[_A-Z]+$`)
109
* `convention-explanation`: Custom explanation to display to the user if a placeholder doesn't adhere to the convention
1110

1211
## Example 1
@@ -118,72 +117,6 @@ When enabled, the following are disallowed:
118117

119118
## Example 4
120119

121-
Settings:
122-
- `convention: strictbem`
123-
124-
When enabled, the following are allowed:
125-
126-
```scss
127-
%block-name {
128-
content: '';
129-
}
130-
131-
%block-name__mixin {
132-
content: '';
133-
}
134-
135-
%block-name_mod-name {
136-
content: '';
137-
}
138-
```
139-
140-
When enabled, the following are disallowed:
141-
142-
```scss
143-
%HYPHENATED-UPPERCASE {
144-
content: '';
145-
}
146-
147-
.foo {
148-
@extend %camelCase;
149-
}
150-
```
151-
152-
## Example 5
153-
154-
Settings:
155-
- `convention: hyphenatedbem`
156-
157-
When enabled, the following are allowed:
158-
159-
```scss
160-
%block-name {
161-
content: '';
162-
}
163-
164-
%block-name__mixin {
165-
content: '';
166-
}
167-
168-
%block-name--mod-name {
169-
content: '';
170-
}
171-
```
172-
173-
When enabled, the following are disallowed:
174-
175-
```scss
176-
%HYPHENATED-UPPERCASE {
177-
content: '';
178-
}
179-
180-
.foo {
181-
@extend %camelCase;
182-
}
183-
```
184-
185-
## Example 6
186-
187120
Settings:
188121
- `allow-leading-underscore: true`
189122
- `convention: ^[_A-Z]+$`

‎docs/rules/variable-name-format.md

+1-56
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Rule `variable-name-format` will enforce a convention for variable names.
55
## Options
66

77
* `allow-leading-underscore`: `true`/`false` (defaults to `true`)
8-
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, [`strictbem`](https://en.bem.info/method/definitions/),
9-
[`hyphenatedbem`](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/), or a Regular Expression that the variable name must match (e.g. `^[_A-Z]+$`)
8+
* `convention`: `'hyphenatedlowercase'` (default), `camelcase`, `snakecase`, or a Regular Expression that the variable name must match (e.g. `^[_A-Z]+$`)
109
* `convention-explanation`: Custom explanation to display to the user if a variable doesn't adhere to the convention
1110

1211
## Example 1
@@ -94,60 +93,6 @@ $_snake_case_with_leading_underscore: 1px;
9493

9594
## Example 4
9695

97-
Settings:
98-
- `convention: strictbem`
99-
100-
When enabled, the following are allowed:
101-
102-
```scss
103-
$block-name__variable: 1px;
104-
$block-name__variable_mod-name: 1px;
105-
$block-name_mod-name__variable: 1px;
106-
107-
.foo {
108-
width: $block-name__variable;
109-
}
110-
```
111-
112-
When enabled, the following are disallowed:
113-
114-
```scss
115-
$HYPHENATED-UPPERCASE: 1px;
116-
117-
.foo {
118-
width: $camelCase;
119-
}
120-
```
121-
122-
## Example 5
123-
124-
Settings:
125-
- `convention: hyphenatedbem`
126-
127-
When enabled, the following are allowed:
128-
129-
```scss
130-
$block-name__variable: 1px;
131-
$block-name__variable--mod-name: 1px;
132-
$block-name--mod-name__variable: 1px;
133-
134-
.foo {
135-
width: $block-name__variable;
136-
}
137-
```
138-
139-
When enabled, the following are disallowed:
140-
141-
```scss
142-
$HYPHENATED-UPPERCASE: 1px;
143-
144-
.foo {
145-
width: $camelCase;
146-
}
147-
```
148-
149-
## Example 6
150-
15196
Settings:
15297
- `allow-leading-underscore: true`
15398
- `convention: ^[_A-Z]+$`

‎lib/rules/function-name-format.js

-10
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@ module.exports = {
5050
violationMessage = 'Function \'' + name + '\' should be written in snake_case';
5151
}
5252
break;
53-
case 'strictbem':
54-
if (!helpers.isStrictBEM(strippedName)) {
55-
violationMessage = 'Function \'.' + name + '\' should be written in BEM (Block Element Modifier) format';
56-
}
57-
break;
58-
case 'hyphenatedbem':
59-
if (!helpers.isHyphenatedBEM(strippedName)) {
60-
violationMessage = 'Function \'.' + name + '\' should be written in hyphenated BEM (Block Element Modifier) format';
61-
}
62-
break;
6353
default:
6454
if (!(new RegExp(parser.options.convention).test(strippedName))) {
6555
violationMessage = 'Function \'' + name + '\' should match regular expression /' + parser.options.convention + '/';

‎lib/rules/mixin-name-format.js

-10
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ module.exports = {
6060
violationMessage = 'Mixin \'' + name + '\' should be written in snake_case';
6161
}
6262
break;
63-
case 'strictbem':
64-
if (!helpers.isStrictBEM(strippedName)) {
65-
violationMessage = 'Mixin \'.' + name + '\' should be written in BEM (Block Element Modifier) format';
66-
}
67-
break;
68-
case 'hyphenatedbem':
69-
if (!helpers.isHyphenatedBEM(strippedName)) {
70-
violationMessage = 'Mixin \'.' + name + '\' should be written in hyphenated BEM (Block Element Modifier) format';
71-
}
72-
break;
7363
default:
7464
if (!(new RegExp(parser.options.convention).test(strippedName))) {
7565
violationMessage = 'Mixin \'' + name + '\' should match regular expression /' + parser.options.convention + '/';

‎lib/rules/placeholder-name-format.js

-10
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ module.exports = {
4040
violationMessage = 'Placeholder \'%' + name + '\' should be written in snake_case';
4141
}
4242
break;
43-
case 'strictbem':
44-
if (!helpers.isStrictBEM(strippedName)) {
45-
violationMessage = 'Placeholder \'.' + name + '\' should be written in BEM (Block Element Modifier) format';
46-
}
47-
break;
48-
case 'hyphenatedbem':
49-
if (!helpers.isHyphenatedBEM(strippedName)) {
50-
violationMessage = 'Placeholder \'.' + name + '\' should be written in hyphenated BEM (Block Element Modifier) format';
51-
}
52-
break;
5343
default:
5444
if (!(new RegExp(parser.options.convention).test(strippedName))) {
5545
violationMessage = 'Placeholder \'%' + name + '\' should match regular expression /' + parser.options.convention + '/';

‎lib/rules/variable-name-format.js

-10
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ module.exports = {
4040
violationMessage = 'Variable \'' + name + '\' should be written in snake_case';
4141
}
4242
break;
43-
case 'strictbem':
44-
if (!helpers.isStrictBEM(strippedName)) {
45-
violationMessage = 'Variable \'.' + name + '\' should be written in BEM (Block Element Modifier) format';
46-
}
47-
break;
48-
case 'hyphenatedbem':
49-
if (!helpers.isHyphenatedBEM(strippedName)) {
50-
violationMessage = 'Variable \'.' + name + '\' should be written in hyphenated BEM (Block Element Modifier) format';
51-
}
52-
break;
5343
default:
5444
if (!(new RegExp(parser.options.convention).test(strippedName))) {
5545
violationMessage = 'Variable \'' + name + '\' should match regular expression /' + parser.options.convention + '/';

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"commander": "^2.8.1",
3232
"eslint": "^2.7.0",
33-
"fs-extra": "^0.26.0",
33+
"fs-extra": "^0.27.0",
3434
"glob": "^7.0.0",
3535
"gonzales-pe-sl": "3.2.6",
3636
"js-yaml": "^3.5.4",

‎tests/cli.js

+12
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,18 @@ describe('cli', function () {
320320
});
321321
});
322322

323+
it('should exit with exit code 1 when more warnings than --max-warnings', function (done) {
324+
var command = 'sass-lint -c tests/yml/.color-keyword-errors.yml tests/sass/cli.scss --max-warnings 0';
325+
326+
exec(command, function (err) {
327+
if (err && err.code === 1) {
328+
return done();
329+
}
330+
331+
return done(new Error('Error code not 1'));
332+
});
333+
});
334+
323335
it('should not exit with an error if no config is specified', function (done) {
324336
var command = 'sass-lint tests/sass/cli-clean.scss --verbose --no-exit';
325337

‎tests/rules/function-name-format.js

+10-66
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('function name format - scss', function () {
99
lint.test(file, {
1010
'function-name-format': 1
1111
}, function (data) {
12-
lint.assert.equal(15, data.warningCount);
12+
lint.assert.equal(9, data.warningCount);
1313
done();
1414
});
1515
});
@@ -23,7 +23,7 @@ describe('function name format - scss', function () {
2323
}
2424
]
2525
}, function (data) {
26-
lint.assert.equal(16, data.warningCount);
26+
lint.assert.equal(10, data.warningCount);
2727
done();
2828
});
2929
});
@@ -37,35 +37,7 @@ describe('function name format - scss', function () {
3737
}
3838
]
3939
}, function (data) {
40-
lint.assert.equal(11, data.warningCount);
41-
done();
42-
});
43-
});
44-
45-
it('[convention: strictbem]', function (done) {
46-
lint.test(file, {
47-
'function-name-format': [
48-
1,
49-
{
50-
'convention': 'strictbem'
51-
}
52-
]
53-
}, function (data) {
54-
lint.assert.equal(13, data.warningCount);
55-
done();
56-
});
57-
});
58-
59-
it('[convention: hyphenatedbem]', function (done) {
60-
lint.test(file, {
61-
'function-name-format': [
62-
1,
63-
{
64-
'convention': 'hyphenatedbem'
65-
}
66-
]
67-
}, function (data) {
68-
lint.assert.equal(11, data.warningCount);
40+
lint.assert.equal(9, data.warningCount);
6941
done();
7042
});
7143
});
@@ -80,7 +52,7 @@ describe('function name format - scss', function () {
8052
}
8153
]
8254
}, function (data) {
83-
lint.assert.equal(16, data.warningCount);
55+
lint.assert.equal(9, data.warningCount);
8456
done();
8557
});
8658
});
@@ -94,7 +66,7 @@ describe('function name format - scss', function () {
9466
}
9567
]
9668
}, function (data) {
97-
lint.assert.equal(16, data.warningCount);
69+
lint.assert.equal(10, data.warningCount);
9870
done();
9971
});
10072
});
@@ -107,7 +79,7 @@ describe('function name format - sass', function () {
10779
lint.test(file, {
10880
'function-name-format': 1
10981
}, function (data) {
110-
lint.assert.equal(15, data.warningCount);
82+
lint.assert.equal(9, data.warningCount);
11183
done();
11284
});
11385
});
@@ -121,7 +93,7 @@ describe('function name format - sass', function () {
12193
}
12294
]
12395
}, function (data) {
124-
lint.assert.equal(16, data.warningCount);
96+
lint.assert.equal(10, data.warningCount);
12597
done();
12698
});
12799
});
@@ -135,35 +107,7 @@ describe('function name format - sass', function () {
135107
}
136108
]
137109
}, function (data) {
138-
lint.assert.equal(11, data.warningCount);
139-
done();
140-
});
141-
});
142-
143-
it('[convention: strictbem]', function (done) {
144-
lint.test(file, {
145-
'function-name-format': [
146-
1,
147-
{
148-
'convention': 'strictbem'
149-
}
150-
]
151-
}, function (data) {
152-
lint.assert.equal(13, data.warningCount);
153-
done();
154-
});
155-
});
156-
157-
it('[convention: hyphenatedbem]', function (done) {
158-
lint.test(file, {
159-
'function-name-format': [
160-
1,
161-
{
162-
'convention': 'hyphenatedbem'
163-
}
164-
]
165-
}, function (data) {
166-
lint.assert.equal(11, data.warningCount);
110+
lint.assert.equal(9, data.warningCount);
167111
done();
168112
});
169113
});
@@ -178,7 +122,7 @@ describe('function name format - sass', function () {
178122
}
179123
]
180124
}, function (data) {
181-
lint.assert.equal(16, data.warningCount);
125+
lint.assert.equal(9, data.warningCount);
182126
done();
183127
});
184128
});
@@ -192,7 +136,7 @@ describe('function name format - sass', function () {
192136
}
193137
]
194138
}, function (data) {
195-
lint.assert.equal(16, data.warningCount);
139+
lint.assert.equal(10, data.warningCount);
196140
done();
197141
});
198142
});

‎tests/rules/mixin-name-format.js

+10-66
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('mixin name format - scss', function () {
99
lint.test(file, {
1010
'mixin-name-format': 1
1111
}, function (data) {
12-
lint.assert.equal(14, data.warningCount);
12+
lint.assert.equal(7, data.warningCount);
1313
done();
1414
});
1515
});
@@ -23,7 +23,7 @@ describe('mixin name format - scss', function () {
2323
}
2424
]
2525
}, function (data) {
26-
lint.assert.equal(16, data.warningCount);
26+
lint.assert.equal(8, data.warningCount);
2727
done();
2828
});
2929
});
@@ -37,35 +37,7 @@ describe('mixin name format - scss', function () {
3737
}
3838
]
3939
}, function (data) {
40-
lint.assert.equal(10, data.warningCount);
41-
done();
42-
});
43-
});
44-
45-
it('[convention: strictbem]', function (done) {
46-
lint.test(file, {
47-
'mixin-name-format': [
48-
1,
49-
{
50-
'convention': 'strictbem'
51-
}
52-
]
53-
}, function (data) {
54-
lint.assert.equal(13, data.warningCount);
55-
done();
56-
});
57-
});
58-
59-
it('[convention: hyphenatedbem]', function (done) {
60-
lint.test(file, {
61-
'mixin-name-format': [
62-
1,
63-
{
64-
'convention': 'hyphenatedbem'
65-
}
66-
]
67-
}, function (data) {
68-
lint.assert.equal(10, data.warningCount);
40+
lint.assert.equal(7, data.warningCount);
6941
done();
7042
});
7143
});
@@ -80,7 +52,7 @@ describe('mixin name format - scss', function () {
8052
}
8153
]
8254
}, function (data) {
83-
lint.assert.equal(17, data.warningCount);
55+
lint.assert.equal(8, data.warningCount);
8456
done();
8557
});
8658
});
@@ -94,7 +66,7 @@ describe('mixin name format - scss', function () {
9466
}
9567
]
9668
}, function (data) {
97-
lint.assert.equal(15, data.warningCount);
69+
lint.assert.equal(8, data.warningCount);
9870
done();
9971
});
10072
});
@@ -107,7 +79,7 @@ describe('mixin name format - sass', function () {
10779
lint.test(file, {
10880
'mixin-name-format': 1
10981
}, function (data) {
110-
lint.assert.equal(14, data.warningCount);
82+
lint.assert.equal(7, data.warningCount);
11183
done();
11284
});
11385
});
@@ -121,7 +93,7 @@ describe('mixin name format - sass', function () {
12193
}
12294
]
12395
}, function (data) {
124-
lint.assert.equal(16, data.warningCount);
96+
lint.assert.equal(8, data.warningCount);
12597
done();
12698
});
12799
});
@@ -135,35 +107,7 @@ describe('mixin name format - sass', function () {
135107
}
136108
]
137109
}, function (data) {
138-
lint.assert.equal(10, data.warningCount);
139-
done();
140-
});
141-
});
142-
143-
it('[convention: strictbem]', function (done) {
144-
lint.test(file, {
145-
'mixin-name-format': [
146-
1,
147-
{
148-
'convention': 'strictbem'
149-
}
150-
]
151-
}, function (data) {
152-
lint.assert.equal(13, data.warningCount);
153-
done();
154-
});
155-
});
156-
157-
it('[convention: hyphenatedbem]', function (done) {
158-
lint.test(file, {
159-
'mixin-name-format': [
160-
1,
161-
{
162-
'convention': 'hyphenatedbem'
163-
}
164-
]
165-
}, function (data) {
166-
lint.assert.equal(10, data.warningCount);
110+
lint.assert.equal(7, data.warningCount);
167111
done();
168112
});
169113
});
@@ -178,7 +122,7 @@ describe('mixin name format - sass', function () {
178122
}
179123
]
180124
}, function (data) {
181-
lint.assert.equal(17, data.warningCount);
125+
lint.assert.equal(8, data.warningCount);
182126
done();
183127
});
184128
});
@@ -192,7 +136,7 @@ describe('mixin name format - sass', function () {
192136
}
193137
]
194138
}, function (data) {
195-
lint.assert.equal(15, data.warningCount);
139+
lint.assert.equal(8, data.warningCount);
196140
done();
197141
});
198142
});

‎tests/rules/placeholder-name-format.js

+10-66
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('placeholder name format - scss', function () {
99
lint.test(file, {
1010
'placeholder-name-format': 1
1111
}, function (data) {
12-
lint.assert.equal(14, data.warningCount);
12+
lint.assert.equal(7, data.warningCount);
1313
done();
1414
});
1515
});
@@ -23,7 +23,7 @@ describe('placeholder name format - scss', function () {
2323
}
2424
]
2525
}, function (data) {
26-
lint.assert.equal(16, data.warningCount);
26+
lint.assert.equal(8, data.warningCount);
2727
done();
2828
});
2929
});
@@ -37,35 +37,7 @@ describe('placeholder name format - scss', function () {
3737
}
3838
]
3939
}, function (data) {
40-
lint.assert.equal(10, data.warningCount);
41-
done();
42-
});
43-
});
44-
45-
it('[convention: strictbem]', function (done) {
46-
lint.test(file, {
47-
'placeholder-name-format': [
48-
1,
49-
{
50-
'convention': 'strictbem'
51-
}
52-
]
53-
}, function (data) {
54-
lint.assert.equal(13, data.warningCount);
55-
done();
56-
});
57-
});
58-
59-
it('[convention: hyphenatedbem]', function (done) {
60-
lint.test(file, {
61-
'placeholder-name-format': [
62-
1,
63-
{
64-
'convention': 'hyphenatedbem'
65-
}
66-
]
67-
}, function (data) {
68-
lint.assert.equal(10, data.warningCount);
40+
lint.assert.equal(7, data.warningCount);
6941
done();
7042
});
7143
});
@@ -80,7 +52,7 @@ describe('placeholder name format - scss', function () {
8052
}
8153
]
8254
}, function (data) {
83-
lint.assert.equal(17, data.warningCount);
55+
lint.assert.equal(8, data.warningCount);
8456
done();
8557
});
8658
});
@@ -94,7 +66,7 @@ describe('placeholder name format - scss', function () {
9466
}
9567
]
9668
}, function (data) {
97-
lint.assert.equal(15, data.warningCount);
69+
lint.assert.equal(8, data.warningCount);
9870
done();
9971
});
10072
});
@@ -107,7 +79,7 @@ describe('placeholder name format - sass', function () {
10779
lint.test(file, {
10880
'placeholder-name-format': 1
10981
}, function (data) {
110-
lint.assert.equal(14, data.warningCount);
82+
lint.assert.equal(7, data.warningCount);
11183
done();
11284
});
11385
});
@@ -121,7 +93,7 @@ describe('placeholder name format - sass', function () {
12193
}
12294
]
12395
}, function (data) {
124-
lint.assert.equal(16, data.warningCount);
96+
lint.assert.equal(8, data.warningCount);
12597
done();
12698
});
12799
});
@@ -135,35 +107,7 @@ describe('placeholder name format - sass', function () {
135107
}
136108
]
137109
}, function (data) {
138-
lint.assert.equal(10, data.warningCount);
139-
done();
140-
});
141-
});
142-
143-
it('[convention: strictbem]', function (done) {
144-
lint.test(file, {
145-
'placeholder-name-format': [
146-
1,
147-
{
148-
'convention': 'strictbem'
149-
}
150-
]
151-
}, function (data) {
152-
lint.assert.equal(13, data.warningCount);
153-
done();
154-
});
155-
});
156-
157-
it('[convention: hyphenatedbem]', function (done) {
158-
lint.test(file, {
159-
'placeholder-name-format': [
160-
1,
161-
{
162-
'convention': 'hyphenatedbem'
163-
}
164-
]
165-
}, function (data) {
166-
lint.assert.equal(10, data.warningCount);
110+
lint.assert.equal(7, data.warningCount);
167111
done();
168112
});
169113
});
@@ -178,7 +122,7 @@ describe('placeholder name format - sass', function () {
178122
}
179123
]
180124
}, function (data) {
181-
lint.assert.equal(17, data.warningCount);
125+
lint.assert.equal(8, data.warningCount);
182126
done();
183127
});
184128
});
@@ -192,7 +136,7 @@ describe('placeholder name format - sass', function () {
192136
}
193137
]
194138
}, function (data) {
195-
lint.assert.equal(15, data.warningCount);
139+
lint.assert.equal(8, data.warningCount);
196140
done();
197141
});
198142
});

‎tests/rules/variable-name-format.js

+10-66
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('variable name format - scss', function () {
99
lint.test(file, {
1010
'variable-name-format': 1
1111
}, function (data) {
12-
lint.assert.equal(13, data.warningCount);
12+
lint.assert.equal(7, data.warningCount);
1313
done();
1414
});
1515
});
@@ -23,7 +23,7 @@ describe('variable name format - scss', function () {
2323
}
2424
]
2525
}, function (data) {
26-
lint.assert.equal(15, data.warningCount);
26+
lint.assert.equal(8, data.warningCount);
2727
done();
2828
});
2929
});
@@ -37,35 +37,7 @@ describe('variable name format - scss', function () {
3737
}
3838
]
3939
}, function (data) {
40-
lint.assert.equal(10, data.warningCount);
41-
done();
42-
});
43-
});
44-
45-
it('[convention: strictbem]', function (done) {
46-
lint.test(file, {
47-
'variable-name-format': [
48-
1,
49-
{
50-
'convention': 'strictbem'
51-
}
52-
]
53-
}, function (data) {
54-
lint.assert.equal(12, data.warningCount);
55-
done();
56-
});
57-
});
58-
59-
it('[convention: hyphenatedbem]', function (done) {
60-
lint.test(file, {
61-
'variable-name-format': [
62-
1,
63-
{
64-
'convention': 'hyphenatedbem'
65-
}
66-
]
67-
}, function (data) {
68-
lint.assert.equal(9, data.warningCount);
40+
lint.assert.equal(7, data.warningCount);
6941
done();
7042
});
7143
});
@@ -80,7 +52,7 @@ describe('variable name format - scss', function () {
8052
}
8153
]
8254
}, function (data) {
83-
lint.assert.equal(16, data.warningCount);
55+
lint.assert.equal(8, data.warningCount);
8456
done();
8557
});
8658
});
@@ -94,7 +66,7 @@ describe('variable name format - scss', function () {
9466
}
9567
]
9668
}, function (data) {
97-
lint.assert.equal(14, data.warningCount);
69+
lint.assert.equal(8, data.warningCount);
9870
done();
9971
});
10072
});
@@ -107,7 +79,7 @@ describe('variable name format - sass', function () {
10779
lint.test(file, {
10880
'variable-name-format': 1
10981
}, function (data) {
110-
lint.assert.equal(13, data.warningCount);
82+
lint.assert.equal(7, data.warningCount);
11183
done();
11284
});
11385
});
@@ -121,7 +93,7 @@ describe('variable name format - sass', function () {
12193
}
12294
]
12395
}, function (data) {
124-
lint.assert.equal(15, data.warningCount);
96+
lint.assert.equal(8, data.warningCount);
12597
done();
12698
});
12799
});
@@ -135,35 +107,7 @@ describe('variable name format - sass', function () {
135107
}
136108
]
137109
}, function (data) {
138-
lint.assert.equal(10, data.warningCount);
139-
done();
140-
});
141-
});
142-
143-
it('[convention: strictbem]', function (done) {
144-
lint.test(file, {
145-
'variable-name-format': [
146-
1,
147-
{
148-
'convention': 'strictbem'
149-
}
150-
]
151-
}, function (data) {
152-
lint.assert.equal(12, data.warningCount);
153-
done();
154-
});
155-
});
156-
157-
it('[convention: hyphenatedbem]', function (done) {
158-
lint.test(file, {
159-
'variable-name-format': [
160-
1,
161-
{
162-
'convention': 'hyphenatedbem'
163-
}
164-
]
165-
}, function (data) {
166-
lint.assert.equal(9, data.warningCount);
110+
lint.assert.equal(7, data.warningCount);
167111
done();
168112
});
169113
});
@@ -178,7 +122,7 @@ describe('variable name format - sass', function () {
178122
}
179123
]
180124
}, function (data) {
181-
lint.assert.equal(16, data.warningCount);
125+
lint.assert.equal(8, data.warningCount);
182126
done();
183127
});
184128
});
@@ -192,7 +136,7 @@ describe('variable name format - sass', function () {
192136
}
193137
]
194138
}, function (data) {
195-
lint.assert.equal(14, data.warningCount);
139+
lint.assert.equal(8, data.warningCount);
196140
done();
197141
});
198142
});

‎tests/sass/function-name-format.sass

-21
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,6 @@
1919
@function _with-leading-underscore()
2020
@return 'foo'
2121

22-
@function strictbem()
23-
@return 'foo'
24-
25-
@function strictbem__function()
26-
@return 'foo'
27-
28-
@function strictbem__function_modifier()
29-
@return 'foo'
30-
31-
@function strictbem_modifier__function()
32-
@return 'foo'
33-
34-
@function hyphenatedbem__function()
35-
@return 'foo'
36-
37-
@function hyphenatedbem__function--modifier()
38-
@return 'foo'
39-
40-
@function hyphenatedbem--modifier__function()
41-
@return 'foo'
42-
4322
@function _does_NOT-fitSTANDARD($x)
4423
@return $x
4524

‎tests/sass/function-name-format.scss

-28
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,6 @@
2626
@return 'foo';
2727
}
2828

29-
@function strictbem() {
30-
@return 'foo';
31-
}
32-
33-
@function strictbem__function() {
34-
@return 'foo';
35-
}
36-
37-
@function strictbem__function_modifier() {
38-
@return 'foo';
39-
}
40-
41-
@function strictbem_modifier__function() {
42-
@return 'foo';
43-
}
44-
45-
@function hyphenatedbem__function() {
46-
@return 'foo';
47-
}
48-
49-
@function hyphenatedbem__function--modifier() {
50-
@return 'foo';
51-
}
52-
53-
@function hyphenatedbem--modifier__function() {
54-
@return 'foo';
55-
}
56-
5729
@function _does_NOT-fitSTANDARD($x) {
5830
@return $x;
5931
}

‎tests/sass/mixin-name-format.sass

-27
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,6 @@
1919
=_with-leading-underscore()
2020
content: ''
2121

22-
=strictbem()
23-
content: ''
24-
25-
=strictbem_modifier()
26-
content: ''
27-
28-
=strictbem__mixin()
29-
content: ''
30-
31-
=strictbem__mixin_modifier()
32-
content: ''
33-
34-
=strictbem_modifier__mixin()
35-
content: ''
36-
37-
=hyphenatedbem--modifier()
38-
content: ''
39-
40-
=hyphenatedbem__mixin()
41-
content: ''
42-
43-
=hyphenatedbem__mixin--modifier()
44-
content: ''
45-
46-
=hyphenatedbem--modifier__mixin()
47-
content: ''
48-
4922
=_does_NOT-fitSTANDARD()
5023
content: ''
5124

‎tests/sass/mixin-name-format.scss

-36
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,6 @@
2626
content: '';
2727
}
2828

29-
@mixin strictbem() {
30-
content: '';
31-
}
32-
33-
@mixin strictbem_modifier() {
34-
content: '';
35-
}
36-
37-
@mixin strictbem__mixin() {
38-
content: '';
39-
}
40-
41-
@mixin strictbem__mixin_modifier() {
42-
content: '';
43-
}
44-
45-
@mixin strictbem_modifier__mixin() {
46-
content: '';
47-
}
48-
49-
@mixin hyphenatedbem--modifier() {
50-
content: '';
51-
}
52-
53-
@mixin hyphenatedbem__mixin() {
54-
content: '';
55-
}
56-
57-
@mixin hyphenatedbem__mixin--modifier() {
58-
content: '';
59-
}
60-
61-
@mixin hyphenatedbem--modifier__mixin() {
62-
content: '';
63-
}
64-
6529
@mixin _does_NOT-fitSTANDARD() {
6630
content: '';
6731
}

‎tests/sass/placeholder-name-format.sass

-27
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,6 @@
1919
%_with-leading-underscore
2020
content: ''
2121

22-
%strictbem
23-
content: ''
24-
25-
%strictbem_modifier
26-
content: ''
27-
28-
%strictbem__placeholder
29-
content: ''
30-
31-
%strictbem__placeholder_modifier
32-
content: ''
33-
34-
%strictbem_modifier__placeholder
35-
content: ''
36-
37-
%hyphenatedbem--modifier
38-
content: ''
39-
40-
%hyphenatedbem__placeholder
41-
content: ''
42-
43-
%hyphenatedbem__placeholder--modifier
44-
content: ''
45-
46-
%hyphenatedbem--modifier__placeholder
47-
content: ''
48-
4922
%_does_NOT-fitSTANDARD
5023
content: ''
5124

‎tests/sass/placeholder-name-format.scss

-36
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,6 @@
2626
content: '';
2727
}
2828

29-
%strictbem {
30-
content: '';
31-
}
32-
33-
%strictbem_placeholder {
34-
content: '';
35-
}
36-
37-
%strictbem__mixin {
38-
content: '';
39-
}
40-
41-
%strictbem__mixin_placeholder {
42-
content: '';
43-
}
44-
45-
%strictbem_placeholder__mixin {
46-
content: '';
47-
}
48-
49-
%hyphenatedbem--placeholder {
50-
content: '';
51-
}
52-
53-
%hyphenatedbem__mixin {
54-
content: '';
55-
}
56-
57-
%hyphenatedbem__mixin--placeholder {
58-
content: '';
59-
}
60-
61-
%hyphenatedbem--placeholder__mixin {
62-
content: '';
63-
}
64-
6529
%_does_NOT-fitSTANDARD {
6630
content: '';
6731
}

‎tests/sass/variable-name-format.sass

-10
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ $PascalCase: 1
55
$Camel_Snake_Case: 1
66
$SCREAMING_SNAKE_CASE: 1
77
$_with-leading-underscore: 1
8-
9-
$strictbem: 1
10-
$strictbem__variable: 1
11-
$strictbem__variable_modifier: 1
12-
$strictbem_modifier__variable: 1
13-
$hyphenatedbem--modifier: 1
14-
$hyphenatedbem__variable: 1
15-
$hyphenatedbem__variable--modifier: 1
16-
$hyphenatedbem--modifier__variable: 1
17-
188
$_does_NOT-fitSTANDARD: 1
199

2010
.class

‎tests/sass/variable-name-format.scss

-10
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ $PascalCase: 1;
55
$Camel_Snake_Case: 1;
66
$SCREAMING_SNAKE_CASE: 1;
77
$_with-leading-underscore: 1;
8-
9-
$strictbem: 1;
10-
$strictbem__variable: 1;
11-
$strictbem__variable_modifier: 1;
12-
$strictbem_modifier__variable: 1;
13-
$hyphenatedbem--modifier: 1;
14-
$hyphenatedbem__variable: 1;
15-
$hyphenatedbem__variable--modifier: 1;
16-
$hyphenatedbem--modifier__variable: 1;
17-
188
$_does_NOT-fitSTANDARD: 1;
199

2010
.class {

0 commit comments

Comments
 (0)
Please sign in to comment.