isml-linter 5.43.6 → 5.43.7
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 +8 -2
- package/package.json +1 -1
- package/src/rules/tree/indent.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.43.7] - 2023-03-03
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- "indent" rule - keep tag type if previous element has trailing spaces;
|
|
7
|
+
|
|
3
8
|
## [5.43.6] - 2023-02-25
|
|
4
9
|
|
|
5
10
|
### Fixed
|
|
6
|
-
- "indent"
|
|
11
|
+
- "indent" rule - don't add indentation to embbeded "isprint" tag if it's in the same line as previous attribute;
|
|
7
12
|
|
|
8
13
|
## [5.43.5] - 2023-02-21
|
|
9
14
|
|
|
10
15
|
### Fixed
|
|
11
|
-
- "indent"
|
|
16
|
+
- "indent" rule - keep indentation of closing tag that is in same line as corresponding opening tag;
|
|
12
17
|
- Tree build for an empty template;
|
|
13
18
|
|
|
14
19
|
## [5.43.4] - 2023-02-20
|
|
@@ -1119,6 +1124,7 @@
|
|
|
1119
1124
|
### Added
|
|
1120
1125
|
- Linter is published;
|
|
1121
1126
|
|
|
1127
|
+
[5.43.7]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.6...v5.43.7
|
|
1122
1128
|
[5.43.6]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.5...v5.43.6
|
|
1123
1129
|
[5.43.5]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.4...v5.43.5
|
|
1124
1130
|
[5.43.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.3...v5.43.4
|
package/package.json
CHANGED
package/src/rules/tree/indent.js
CHANGED
|
@@ -619,17 +619,18 @@ const addIndentation = (node, isOpeningTag) => {
|
|
|
619
619
|
const nodeIndentation = node.isInSameLineAsParent() && isOpeningTag ? '' : Rule.getIndentation(node.depth - 1);
|
|
620
620
|
const attributeOffset = Rule.getAttributeIndentationOffset();
|
|
621
621
|
const attributeList = node.getAttributeList();
|
|
622
|
+
const leadingLineBreakQty = ParseUtils.getLeadingLineBreakQty(node.head);
|
|
622
623
|
let contentResult = '';
|
|
623
624
|
|
|
624
625
|
if (isOpeningTag) {
|
|
625
626
|
const shouldAddIndentationToClosingChar = shouldAddIndentationToClosingChars(node);
|
|
626
627
|
const closingChars = getClosingChars(node);
|
|
627
|
-
const tagNameEndPos =
|
|
628
|
+
const tagNameEndPos = leadingLineBreakQty
|
|
628
629
|
+ ParseUtils.getFirstEmptyCharPos(node.head.trim()) + 1;
|
|
629
630
|
|
|
630
631
|
if (ParseUtils.getLineBreakQty(node.head.trim()) > 0 || shouldAddIndentationToClosingChar && node.isSelfClosing()) {
|
|
631
632
|
contentResult = attributeList.length > 0 ?
|
|
632
|
-
node.head.substring(0, tagNameEndPos).trimStart() :
|
|
633
|
+
node.head.trimStart().substring(0, tagNameEndPos - leadingLineBreakQty).trimStart() :
|
|
633
634
|
node.head.trimStart();
|
|
634
635
|
|
|
635
636
|
for (let i = 0; i < attributeList.length; i++) {
|
|
@@ -662,7 +663,7 @@ const removeAllIndentation = node => {
|
|
|
662
663
|
if (!node.isRoot() && !node.isContainer() && !node.parent.isOneOfTypes(['isscript', 'script'])) {
|
|
663
664
|
|
|
664
665
|
const shouldRemoveHeadIndentation = node.head && !node.isInSameLineAsPreviousSibling() && !node.isInSameLineAsParent() && !(node.lineNumber === node.parent.endLineNumber);
|
|
665
|
-
const shouldRemoveTailIndentation = node.tail && !(node.hasChildren() && node.getLastChild().lineNumber === node.tailLineNumber);
|
|
666
|
+
const shouldRemoveTailIndentation = !!(node.tail && !(node.hasChildren() && node.getLastChild().lineNumber === node.tailLineNumber));
|
|
666
667
|
|
|
667
668
|
if (shouldRemoveHeadIndentation) {
|
|
668
669
|
node.head = removeIndentation(node.head);
|