isml-linter 5.43.8 → 5.43.10
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,36 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.43.10] - 2025-12-22
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- "indent" rule - content of a "style" tag should be ignored completely;
|
|
7
|
+
- Fixed README commands to use "npx";
|
|
8
|
+
|
|
9
|
+
### Security
|
|
10
|
+
- Removed unncecessary dependency;
|
|
11
|
+
|
|
12
|
+
## [5.43.9] - 2023-03-05
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- "leading-iscache" and "leading-iscontent" rules - update tree data after move nodes on autofix mode;
|
|
16
|
+
|
|
3
17
|
## [5.43.8] - 2023-03-04
|
|
4
18
|
|
|
5
19
|
### Fixed
|
|
6
20
|
- Identification of HTML tag attributes even when there is no blank space separating them;
|
|
7
|
-
|
|
21
|
+
|
|
8
22
|
## [5.43.7] - 2023-03-03
|
|
9
23
|
|
|
10
24
|
### Fixed
|
|
11
25
|
- "indent" rule - keep tag type if previous element has trailing spaces;
|
|
12
|
-
|
|
26
|
+
|
|
13
27
|
## [5.43.6] - 2023-02-25
|
|
14
28
|
|
|
15
29
|
### Fixed
|
|
16
30
|
- "indent" rule - don't add indentation to embbeded "isprint" tag if it's in the same line as previous attribute;
|
|
17
|
-
|
|
31
|
+
|
|
18
32
|
## [5.43.5] - 2023-02-21
|
|
19
33
|
|
|
20
34
|
### Fixed
|
|
21
35
|
- "indent" rule - keep indentation of closing tag that is in same line as corresponding opening tag;
|
|
22
36
|
- Tree build for an empty template;
|
|
23
|
-
|
|
37
|
+
|
|
24
38
|
## [5.43.4] - 2023-02-20
|
|
25
39
|
|
|
26
40
|
### Fixed
|
|
27
41
|
- [Issue #39][issue#39] - Allow closing tag to be in the same line as corresponding opening tag last character;
|
|
28
|
-
|
|
42
|
+
|
|
29
43
|
## [5.43.3] - 2023-02-20
|
|
30
44
|
|
|
31
45
|
### Fixed
|
|
32
46
|
- Issue that blocked process due to a missing return value in some rules;
|
|
33
|
-
|
|
47
|
+
|
|
34
48
|
## [5.43.2] - 2023-02-12
|
|
35
49
|
|
|
36
50
|
### Security
|
|
@@ -40,7 +54,7 @@
|
|
|
40
54
|
|
|
41
55
|
### Fixed
|
|
42
56
|
- All line-by-line rules are applied, one after the other, without ovewriting the previous rule fixed content;
|
|
43
|
-
|
|
57
|
+
|
|
44
58
|
## [5.43.0] - 2023-01-31
|
|
45
59
|
|
|
46
60
|
### Added
|
|
@@ -48,7 +62,7 @@
|
|
|
48
62
|
|
|
49
63
|
### Fixed
|
|
50
64
|
- Rule-level ignore string with "/" character for directories;
|
|
51
|
-
|
|
65
|
+
|
|
52
66
|
## [5.42.4] - 2023-01-30
|
|
53
67
|
|
|
54
68
|
### Fixed
|
|
@@ -1129,6 +1143,7 @@
|
|
|
1129
1143
|
### Added
|
|
1130
1144
|
- Linter is published;
|
|
1131
1145
|
|
|
1146
|
+
[5.43.9]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.8...v5.43.9
|
|
1132
1147
|
[5.43.8]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.7...v5.43.8
|
|
1133
1148
|
[5.43.7]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.6...v5.43.7
|
|
1134
1149
|
[5.43.6]: https://github.com/FabiowQuixada/isml-linter/compare/v5.43.5...v5.43.6
|
package/README.md
CHANGED
|
@@ -24,10 +24,10 @@ and add the following to package.json:
|
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
26
|
"scripts": {
|
|
27
|
-
"init:isml": "
|
|
28
|
-
"lint:isml": "
|
|
29
|
-
"build:isml": "
|
|
30
|
-
"fix:isml": "
|
|
27
|
+
"init:isml": "npx isml-linter --init",
|
|
28
|
+
"lint:isml": "npx isml-linter",
|
|
29
|
+
"build:isml": "npx isml-linter --build",
|
|
30
|
+
"fix:isml": "npx isml-linter --autofix"
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isml-linter",
|
|
3
|
-
"version": "5.43.
|
|
3
|
+
"version": "5.43.10",
|
|
4
4
|
"author": "Fabiow Quixadá <ftquixada@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/publicApi.js",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"ghooks": "^2.0.4",
|
|
47
47
|
"jasmine": "^3.6.4",
|
|
48
48
|
"jasmine-node": "^1.16.0",
|
|
49
|
-
"rmdir": "^1.0.0",
|
|
50
49
|
"sinon": "^9.2.4",
|
|
51
50
|
"to-snake-case": "^1.0.0"
|
|
52
51
|
}
|
package/src/Constants.js
CHANGED
|
@@ -40,6 +40,7 @@ const specComplexTemplatesDir = path.join(specIsmlTreeTemplateDir, 'com
|
|
|
40
40
|
const specElementBalanceTemplatesDir = path.join(specIsmlTreeTemplateDir, 'element_balance');
|
|
41
41
|
const specTailLineNumberTemplatesDir = path.join(specIsmlTreeTemplateDir, 'tail_line_number');
|
|
42
42
|
const specAutofixTemplatesDir = path.join(specTemplateDir, 'autofix');
|
|
43
|
+
const specTreeRuleTemplatesDir = path.join(specTemplateDir, 'rules', 'tree');
|
|
43
44
|
const rulesDir = path.join(linterModuleDir, 'src', 'rules');
|
|
44
45
|
const lineByLineRulesDir = path.join(rulesDir, 'line_by_line');
|
|
45
46
|
const treeRulesDir = path.join(rulesDir, 'tree');
|
|
@@ -102,6 +103,7 @@ module.exports = {
|
|
|
102
103
|
specColumnNumberTemplateDir,
|
|
103
104
|
specInvalidTemplateDir,
|
|
104
105
|
specComplexTemplatesDir,
|
|
106
|
+
specTreeRuleTemplatesDir,
|
|
105
107
|
specAutofixTemplatesDir,
|
|
106
108
|
specElementBalanceTemplatesDir,
|
|
107
109
|
specTailLineNumberTemplatesDir,
|
|
@@ -351,6 +351,9 @@ class IsmlNode {
|
|
|
351
351
|
return !this.parent || this.parent.getLastChild() === this;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
// No position or line number is set. To get
|
|
355
|
+
// it, it is necessary to re-parse the tree.
|
|
356
|
+
// This is valid for all nodes;
|
|
354
357
|
removeChild(node) {
|
|
355
358
|
let index = null;
|
|
356
359
|
|
|
@@ -365,15 +368,27 @@ class IsmlNode {
|
|
|
365
368
|
|
|
366
369
|
const removedNode = this.children[index];
|
|
367
370
|
this.children.splice(index, 1);
|
|
371
|
+
|
|
372
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
373
|
+
const child = this.children[index];
|
|
374
|
+
child.childNo = i;
|
|
375
|
+
}
|
|
376
|
+
|
|
368
377
|
return removedNode;
|
|
369
378
|
}
|
|
370
379
|
|
|
371
380
|
// No position or line number is set. To get
|
|
372
|
-
// it, it is necessary to re-parse the tree
|
|
381
|
+
// it, it is necessary to re-parse the tree.
|
|
382
|
+
// This is valid for all nodes;
|
|
373
383
|
addChildNodeToPos(node, index) {
|
|
374
384
|
node.parent = this;
|
|
375
385
|
node.depth = this.depth + 1;
|
|
376
386
|
this.children.splice(index, 0, node);
|
|
387
|
+
|
|
388
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
389
|
+
const child = this.children[i];
|
|
390
|
+
child.childNo = i;
|
|
391
|
+
}
|
|
377
392
|
}
|
|
378
393
|
|
|
379
394
|
getRoot() {
|
package/src/rules/tree/indent.js
CHANGED
|
@@ -609,6 +609,12 @@ const getClosingChars = node => {
|
|
|
609
609
|
return '';
|
|
610
610
|
};
|
|
611
611
|
|
|
612
|
+
const shouldChangeIndentation = node => {
|
|
613
|
+
return !node.isRoot() &&
|
|
614
|
+
!node.isContainer() &&
|
|
615
|
+
!node.parent.isOneOfTypes(['isscript', 'script', 'style']);
|
|
616
|
+
}
|
|
617
|
+
|
|
612
618
|
const addIndentation = (node, isOpeningTag) => {
|
|
613
619
|
const content = isOpeningTag ? node.head : node.tail;
|
|
614
620
|
const startingPos = ParseUtils.getNextNonEmptyCharPos(content);
|
|
@@ -660,7 +666,7 @@ const addIndentation = (node, isOpeningTag) => {
|
|
|
660
666
|
};
|
|
661
667
|
|
|
662
668
|
const removeAllIndentation = node => {
|
|
663
|
-
if (
|
|
669
|
+
if (shouldChangeIndentation(node)) {
|
|
664
670
|
|
|
665
671
|
const shouldRemoveHeadIndentation = node.head && !node.isInSameLineAsPreviousSibling() && !node.isInSameLineAsParent() && !(node.lineNumber === node.parent.endLineNumber);
|
|
666
672
|
const shouldRemoveTailIndentation = !!(node.tail && !(node.hasChildren() && node.getLastChild().lineNumber === node.tailLineNumber));
|
|
@@ -681,7 +687,7 @@ const removeAllIndentation = node => {
|
|
|
681
687
|
|
|
682
688
|
const addCorrectIndentation = node => {
|
|
683
689
|
|
|
684
|
-
if (
|
|
690
|
+
if (shouldChangeIndentation(node)) {
|
|
685
691
|
if (node.parent.isOfType('iscomment')) {
|
|
686
692
|
const shouldAddIndentationToText = checkIfShouldAddIndentationToHead(node);
|
|
687
693
|
|