Skip to content

Commit 6960b03

Browse files
committed
Update names of node types
1 parent 93b2e7f commit 6960b03

21 files changed

Lines changed: 64 additions & 64 deletions

lib/options/always-semicolon.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
var nodeWithoutSemicolon;
2222

2323
// Skip nodes that already have `;` at the end:
24-
if (currentNodeType === 'declDelim') break;
24+
if (currentNodeType === 'declarationDelimiter') break;
2525

2626
// Add semicolon only after declarations and includes.
2727
// If current node is include, insert semicolon right into it.
@@ -50,7 +50,7 @@ module.exports = {
5050
if (lastNode === 'block') {
5151
isBlock = true;
5252
break;
53-
} else if (['s', 'commentML', 'commentSL'].indexOf(lastNode) === -1) break;
53+
} else if (['space', 'multilineComment', 'singlelineComment'].indexOf(lastNode) === -1) break;
5454

5555
space.unshift(nodeWithoutSemicolon.content[j]);
5656
}
@@ -60,7 +60,7 @@ module.exports = {
6060
// Temporarily remove last spaces and comments and insert `;`
6161
// before them:
6262
nodeWithoutSemicolon.content.splice(nodeWithoutSemicolon.content.length - space.length);
63-
var declDelim = gonzales.createNode({ type: 'declDelim', content: ';' });
63+
var declDelim = gonzales.createNode({ type: 'declarationDelimiter', content: ';' });
6464
var args = [i + 1, 0, declDelim].concat(space);
6565
node.splice.apply(node, args);
6666
break;

lib/options/block-indent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = (function() {
1010
for (i = node.length; i--;) {
1111
whitespaceNode = node.get(i);
1212

13-
if (!whitespaceNode.is('s')) continue;
13+
if (!whitespaceNode.is('space')) continue;
1414

1515
spaces = whitespaceNode.content.replace(/\n[ \t]+/gm, '\n');
1616

@@ -34,7 +34,7 @@ module.exports = (function() {
3434
}
3535

3636
// Continue only with space nodes inside {...}:
37-
if (syntax !== 'sass' && level !== 0 && n.is('s')) {
37+
if (syntax !== 'sass' && level !== 0 && n.is('space')) {
3838
processSpaceNode(n, level, value);
3939
}
4040

@@ -55,7 +55,7 @@ module.exports = (function() {
5555
for (i = node.length; i--;) {
5656
whitespaceNode = node.get(i);
5757

58-
if (!whitespaceNode.is('s')) continue;
58+
if (!whitespaceNode.is('space')) continue;
5959

6060
if (whitespaceNode.content === '\n') continue;
6161

lib/options/color-case.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
*/
1212
process: function(node) {
1313
var value = this.getValue('color-case');
14-
if (node.type === 'vhash') {
14+
if (node.type === 'color') {
1515
if (value === 'lower') {
1616
node.content = node.content.toLowerCase();
1717
} else if (value === 'upper') {

lib/options/color-shorthand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
* @param {node} node
1111
*/
1212
process: function(node) {
13-
if (node.type === 'vhash') {
13+
if (node.type === 'color') {
1414
if (this.getValue('color-shorthand')) {
1515
node.content = node.content.replace(/(\w)\1(\w)\2(\w)\3/i, '$1$2$3');
1616
} else {

lib/options/element-case.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515

1616
for (var x = node.content.length; x--;) {
1717
var selector = node.content[x];
18-
if (selector.type !== 'simpleselector') continue;
18+
if (selector.type !== 'simpleSelector') continue;
1919

2020
for (var i = selector.content.length; i--;) {
2121
var simpleselector = selector.content[i];

lib/options/eof-newline.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module.exports = {
1212
process: function(node) {
1313
if (node.type === 'stylesheet') {
1414
var lastChild = node.content[node.content.length - 1];
15-
if (lastChild.type !== 's') {
16-
lastChild = { type: 's', content: '' };
15+
if (lastChild.type !== 'space') {
16+
lastChild = { type: 'space', content: '' };
1717
node.content.push(lastChild);
1818
}
1919
lastChild.content = lastChild.content.replace(/\n$/, '');

lib/options/remove-empty-rulesets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = (function() {
5757

5858
var isEmpty = true;
5959
node.forEach(function(childNode) {
60-
if (childNode.type !== 's') isEmpty = false;
60+
if (childNode.type !== 'space') isEmpty = false;
6161
});
6262
return isEmpty;
6363
}
@@ -67,7 +67,7 @@ module.exports = (function() {
6767
}
6868

6969
function isWhitespace(node) {
70-
return node.type === 's';
70+
return node.type === 'space';
7171
}
7272

7373

lib/options/sort-order.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ module.exports = {
4040
process: function(node) {
4141
var _this = this;
4242
// Types of nodes that can be sorted:
43-
var NODES = ['atruleb', 'atruler', 'atrules', 'commentML', 'commentSL',
44-
'declaration', 's', 'include'];
43+
var NODES = ['atruleb', 'atruler', 'atrules', 'multilineComment', 'singlelineComment',
44+
'declaration', 'space', 'include'];
4545
// Spaces and comments:
46-
var SC = ['commentML', 'commentSL', 's'];
46+
var SC = ['multilineComment', 'singlelineComment', 'space'];
4747

4848
var currentNode;
4949
// Sort order of properties:
@@ -129,7 +129,7 @@ module.exports = {
129129
// If there is no node, or it is nor spaces neither comment, stop:
130130
if (!currentNode || SC.indexOf(currentNode.type) === -1) break;
131131

132-
if (currentNode.is('commentML') || currentNode.is('commentSL')) {
132+
if (currentNode.is('multilineComment') || currentNode.is('singlelineComment')) {
133133
sc.push(currentNode);
134134
d.push(i + 1);
135135
continue;
@@ -204,7 +204,7 @@ module.exports = {
204204

205205
// If there is `;` right after the declaration, save it with the
206206
// declaration and mark it for removing from parent node:
207-
if (currentNode && nextNode && nextNode.is('declDelim')) {
207+
if (currentNode && nextNode && nextNode.is('declarationDelimiter')) {
208208
extendedNode.delim.push(nextNode);
209209
deleted.push(i + 1);
210210
i++;
@@ -358,7 +358,7 @@ module.exports = {
358358

359359
// Divide declarations from different groups with an empty line:
360360
if (prevNode && currentNode.groupIndex > prevNode.groupIndex) {
361-
if (sc0[0] && sc0[0].is('s') &&
361+
if (sc0[0] && sc0[0].is('space') &&
362362
(this.syntax === 'sass' ||
363363
sc0[0].content.match(/\n/g) &&
364364
sc0[0].content.match(/\n/g).length < 2)) {
@@ -371,7 +371,7 @@ module.exports = {
371371
}
372372
if (currentNode.delim.length > 0) {
373373
var delim = this.syntax === 'sass' ? '\n' : ';';
374-
var declDelim = gonzales.createNode({ type: 'declDelim', content: delim });
374+
var declDelim = gonzales.createNode({ type: 'declarationDelimiter', content: delim });
375375
node.content.unshift(declDelim);
376376
}
377377
for (j = 0, nl = sc1.length; j < nl; j++) {

lib/options/space-after-colon.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ module.exports = {
2323
var value = this.getValue('space-after-colon');
2424

2525
for (var i = node.content.length; i--;) {
26-
if (!node.content[i].is('propertyDelim')) continue;
26+
if (!node.content[i].is('propertyDelimiter')) continue;
2727

2828
if (this.getSyntax() === 'sass' && !node.content[i - 1]) break;
2929

3030
// Remove any spaces after colon:
31-
if (node.content[i + 1].is('s')) node.content.splice(i + 1, 1);
31+
if (node.content[i + 1].is('space')) node.content.splice(i + 1, 1);
3232
// If the value set in config is not empty, add spaces:
33-
var space = gonzales.createNode({ type: 's', content: value });
33+
var space = gonzales.createNode({ type: 'space', content: value });
3434
if (value !== '') node.content.splice(i + 1, 0, space);
3535

3636
break;

lib/options/space-after-combinator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ module.exports = {
2727
for (var j = subSelector.content.length; j--;) {
2828
if (!subSelector.content[j].is('combinator')) continue;
2929

30-
if (subSelector.content[j + 1].is('s')) {
30+
if (subSelector.content[j + 1].is('space')) {
3131
subSelector.content[j + 1].content = value;
3232
} else {
33-
var space = gonzales.createNode({ type: 's', content: value });
33+
var space = gonzales.createNode({ type: 'space', content: value });
3434
subSelector.content.splice(j + 1, 0, space);
3535
}
3636
}

0 commit comments

Comments
 (0)