isml-linter 5.42.3 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## [5.42.3] - 2023-01-29
4
10
 
5
11
  ### Fixed
@@ -1074,6 +1080,7 @@
1074
1080
  ### Added
1075
1081
  - Linter is published;
1076
1082
 
1083
+ [5.42.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.3...v5.42.4
1077
1084
  [5.42.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.2...v5.42.3
1078
1085
  [5.42.2]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.1...v5.42.2
1079
1086
  [5.42.1]: https://github.com/FabiowQuixada/isml-linter/compare/v5.42.0...v5.42.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isml-linter",
3
- "version": "5.42.3",
3
+ "version": "5.42.4",
4
4
  "author": "Fabiow Quixadá <ftquixada@gmail.com>",
5
5
  "license": "MIT",
6
6
  "main": "src/publicApi.js",
@@ -404,12 +404,11 @@ class IsmlNode {
404
404
  indentation += ' ';
405
405
  }
406
406
 
407
- // if(this.isRoot()) {
408
- // console.log('Depth\t :: LineNumber\t :: Content');
409
- // }
407
+ if(this.isRoot()) {
408
+ console.log('Depth\t :: LineNumber\t :: Content');
409
+ }
410
410
 
411
- // console.log(this.depth + '\t :: ' + this.lineNumber + '\t\t :: ' + indentation + getDisplayText(this));
412
- console.log(this.depth + ' :: ' + this.lineNumber + ' :: ' + indentation + getDisplayText(this));
411
+ console.log(this.depth + '\t :: ' + this.lineNumber + '\t\t :: ' + indentation + getDisplayText(this));
413
412
 
414
413
  for (let i = 0; i < this.children.length; i++) {
415
414
  this.children[i].print();
@@ -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
- let nodeIndentation = node.isInSameLineAsParent() && isOpeningTag ? '' : Rule.getIndentation(node.depth - 1);
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
- if (node.tailLineNumber === lastChildLineNumber) {
653
- contentResult = Constants.EOL + nodeIndentation;
654
- nodeIndentation = '';
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 += node.tail.trim();
651
+ } else {
652
+ contentResult = node.tail.trim();
659
653
  }
660
654
 
661
655
  return preLineBreakContent + nodeIndentation + contentResult + fullTrailingContent;