isml-linter 5.43.4 → 5.43.5
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 +7 -0
- package/package.json +1 -1
- package/src/isml_tree/ParseUtils.js +4 -0
- package/src/rules/tree/indent.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.43.5] - 2023-02-21
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- "indent" Rule - keep indentation of closing tag that is in same line as corresponding opening tag;
|
|
7
|
+
- Tree build for an empty template;
|
|
8
|
+
|
|
3
9
|
## [5.43.4] - 2023-02-20
|
|
4
10
|
|
|
5
11
|
### Fixed
|
|
@@ -1108,6 +1114,7 @@
|
|
|
1108
1114
|
### Added
|
|
1109
1115
|
- Linter is published;
|
|
1110
1116
|
|
|
1117
|
+
[5.43.5]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.4...v5.43.5
|
|
1111
1118
|
[5.43.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.3...v5.43.4
|
|
1112
1119
|
[5.43.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.2...v5.43.3
|
|
1113
1120
|
[5.43.2]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.1...v5.43.2
|
package/package.json
CHANGED
|
@@ -491,6 +491,10 @@ const getElementList = (templateContent, templatePath, isCrlfLineBreak) => {
|
|
|
491
491
|
const elementList = state.elementList;
|
|
492
492
|
let previousStateContent = state.remainingShadowContent;
|
|
493
493
|
|
|
494
|
+
if (templateContent === '') {
|
|
495
|
+
return [];
|
|
496
|
+
}
|
|
497
|
+
|
|
494
498
|
do {
|
|
495
499
|
initLoopState(state);
|
|
496
500
|
parseNextElement(state);
|
package/src/rules/tree/indent.js
CHANGED
|
@@ -763,6 +763,7 @@ const checkIfShouldAddIndentationToTail = node => {
|
|
|
763
763
|
const isInSameLineAsChild = !node.hasChildren() || node.getLastChild().isInSameLineAsParent();
|
|
764
764
|
const isTailInSameLineAsChild = !node.hasChildren() || node.tailLineNumber === node.getLastChild().getLastLineNumber();
|
|
765
765
|
const isBrokenIntoMultipleLines = !node.hasChildren() && node.tailLineNumber && node.lineNumber !== node.tailLineNumber;
|
|
766
|
+
const isInSameLineAsOpeningTag = !node.hasChildren() && node.tailLineNumber && node.endLineNumber === node.tailLineNumber;
|
|
766
767
|
|
|
767
768
|
const shouldAdd = hasTail &&
|
|
768
769
|
!isTailInSameLineAsChild &&
|
|
@@ -774,6 +775,11 @@ const checkIfShouldAddIndentationToTail = node => {
|
|
|
774
775
|
||
|
|
775
776
|
isBrokenIntoMultipleLines;
|
|
776
777
|
|
|
778
|
+
// TODO Merge this condition into the above ones;
|
|
779
|
+
if (isInSameLineAsOpeningTag) {
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
|
|
777
783
|
return shouldAdd;
|
|
778
784
|
};
|
|
779
785
|
|