isml-linter 5.42.2 → 5.42.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/package.json +1 -1
- package/src/isml_tree/IsmlNode.js +5 -1
- package/src/isml_tree/ParseUtils.js +3 -4
- package/src/rules/tree/indent.js +8 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.42.4] - 2023-01-30
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- "indent" rule fix - multiline self-closing HTML conditional comment;
|
|
7
|
+
- "indent" rule fix - closing tag after closing "isif" tag;
|
|
8
|
+
|
|
9
|
+
## [5.42.3] - 2023-01-29
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- Tree build fix when self-closing HTML conditional comments are present;
|
|
13
|
+
|
|
3
14
|
## [5.42.2] - 2023-01-29
|
|
4
15
|
|
|
5
16
|
### Fixed
|
|
@@ -1069,6 +1080,8 @@
|
|
|
1069
1080
|
### Added
|
|
1070
1081
|
- Linter is published;
|
|
1071
1082
|
|
|
1083
|
+
[5.42.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.3...v5.42.4
|
|
1084
|
+
[5.42.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.2...v5.42.3
|
|
1072
1085
|
[5.42.2]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.1...v5.42.2
|
|
1073
1086
|
[5.42.1]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.0...v5.42.1
|
|
1074
1087
|
[5.42.0]: https://github.com/FabiowQuixada/isml-linter/compare/v5.41.0...v5.42.0
|
package/package.json
CHANGED
|
@@ -404,7 +404,11 @@ class IsmlNode {
|
|
|
404
404
|
indentation += ' ';
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
|
|
407
|
+
if(this.isRoot()) {
|
|
408
|
+
console.log('Depth\t :: LineNumber\t :: Content');
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
console.log(this.depth + '\t :: ' + this.lineNumber + '\t\t :: ' + indentation + getDisplayText(this));
|
|
408
412
|
|
|
409
413
|
for (let i = 0; i < this.children.length; i++) {
|
|
410
414
|
this.children[i].print();
|
|
@@ -128,9 +128,8 @@ const parseNextElement = state => {
|
|
|
128
128
|
parseTextElement(state, newElement);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
newElement.columnNumber
|
|
132
|
-
newElement.isVoidElement
|
|
133
|
-
newElement.isHtmlConditionalComment = !!(newElement.type === 'htmlOrIsmlComment' && (newElement.value.indexOf('<!--[if') >= 0 || newElement.value.indexOf('<!--<![endif]' >= 0)));
|
|
131
|
+
newElement.columnNumber = getElementColumnNumber(newElement, state);
|
|
132
|
+
newElement.isVoidElement = !config.disableHtml5 && Constants.voidElementsArray.indexOf(newElement.tagType) >= 0;
|
|
134
133
|
|
|
135
134
|
if (state.isCrlfLineBreak) {
|
|
136
135
|
newElement.globalPos += newElement.lineNumber - 1;
|
|
@@ -196,7 +195,7 @@ const parseTagOrExpressionElement = (state, newElement) => {
|
|
|
196
195
|
// TODO Refactor this, remove this post-processing;
|
|
197
196
|
if (newElement.type === 'htmlConditionalComment') {
|
|
198
197
|
newElement.tagType = 'html_conditional_comment';
|
|
199
|
-
newElement.isSelfClosing =
|
|
198
|
+
newElement.isSelfClosing = newElement.value.indexOf('<!--[if') >= 0 && newElement.value.indexOf('<![endif') >= 0;
|
|
200
199
|
|
|
201
200
|
if (trimmedElement.indexOf('<!--<![endif]') >= 0) {
|
|
202
201
|
newElement.isClosingTag = true;
|
package/src/rules/tree/indent.js
CHANGED
|
@@ -613,7 +613,7 @@ const addIndentation = (node, isOpeningTag) => {
|
|
|
613
613
|
const fullLeadingContent = content.substring(0, startingPos);
|
|
614
614
|
const preLineBreakContent = fullLeadingContent.substring(0, fullLeadingContent.lastIndexOf(Constants.EOL) + 1);
|
|
615
615
|
const fullTrailingContent = content.substring(endingPos);
|
|
616
|
-
|
|
616
|
+
const nodeIndentation = node.isInSameLineAsParent() && isOpeningTag ? '' : Rule.getIndentation(node.depth - 1);
|
|
617
617
|
const attributeOffset = Rule.getAttributeIndentationOffset();
|
|
618
618
|
const attributeList = node.getAttributeList();
|
|
619
619
|
let contentResult = '';
|
|
@@ -641,21 +641,15 @@ const addIndentation = (node, isOpeningTag) => {
|
|
|
641
641
|
} else {
|
|
642
642
|
contentResult = node.head.trim();
|
|
643
643
|
}
|
|
644
|
-
} else {
|
|
645
|
-
const nodeLastChild = node.getLastChild();
|
|
646
|
-
|
|
647
|
-
if (nodeLastChild) {
|
|
648
|
-
const lastChildLineNumber = nodeLastChild.isContainer() ?
|
|
649
|
-
nodeLastChild.getLastChild().getLastLineNumber() :
|
|
650
|
-
nodeLastChild.getLastLineNumber();
|
|
651
644
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
645
|
+
if (node.isOfType('html_conditional_comment')) {
|
|
646
|
+
contentResult = contentResult
|
|
647
|
+
.split(Constants.EOL)
|
|
648
|
+
.map((line, i) => i > 0 ? nodeIndentation + line : line)
|
|
649
|
+
.join(Constants.EOL);
|
|
656
650
|
}
|
|
657
|
-
|
|
658
|
-
contentResult
|
|
651
|
+
} else {
|
|
652
|
+
contentResult = node.tail.trim();
|
|
659
653
|
}
|
|
660
654
|
|
|
661
655
|
return preLineBreakContent + nodeIndentation + contentResult + fullTrailingContent;
|