isml-linter 5.38.2 → 5.39.0

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +63 -33
  2. package/README.md +2 -1
  3. package/package.json +2 -2
  4. package/src/Constants.js +2 -2
  5. package/src/IsmlLinter.js +14 -0
  6. package/src/enums/{SfccTags.js → SfccTagContainer.js} +0 -0
  7. package/src/isml_tree/ContainerNode.js +1 -1
  8. package/src/isml_tree/IsmlNode.js +88 -83
  9. package/src/isml_tree/MaskUtils.js +2 -2
  10. package/src/isml_tree/ParseUtils.js +15 -13
  11. package/src/isml_tree/TreeBuilder.js +47 -18
  12. package/src/rules/prototypes/TreeRulePrototype.js +4 -8
  13. package/src/rules/tree/align-isset.js +2 -2
  14. package/src/rules/tree/contextual-attrs.js +4 -4
  15. package/src/rules/tree/custom-tags.js +6 -6
  16. package/src/rules/tree/disallow-tags.js +2 -2
  17. package/src/rules/tree/empty-eof.js +11 -11
  18. package/src/rules/tree/enforce-security.js +2 -2
  19. package/src/rules/tree/eslint-to-isscript.js +13 -12
  20. package/src/rules/tree/indent.js +73 -73
  21. package/src/rules/tree/leading-iscache.js +1 -1
  22. package/src/rules/tree/leading-iscontent.js +1 -1
  23. package/src/rules/tree/no-deprecated-attrs.js +4 -4
  24. package/src/rules/tree/no-embedded-isml.js +2 -2
  25. package/src/rules/tree/no-hardcode.js +6 -6
  26. package/src/rules/tree/no-iselse-slash.js +3 -3
  27. package/src/rules/tree/no-redundant-context.js +8 -8
  28. package/src/rules/tree/no-require-in-loop.js +8 -8
  29. package/src/rules/tree/one-element-per-line.js +3 -3
  30. package/src/util/ConsoleUtils.js +44 -2
  31. package/src/util/{CustomTagUtils.js → CustomTagContainer.js} +0 -0
  32. package/src/util/ExceptionUtils.js +27 -0
  33. package/src/util/RuleUtils.js +16 -6
  34. package/src/util/TempRuleUtils.js +4 -4
package/CHANGELOG.md CHANGED
@@ -1,26 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.39.0] - 2021-09-17
4
+
5
+ ### Added
6
+ - [Issue #31][issue#31] - "verbose" global configuration option;
7
+
8
+ ## [5.38.5] - 2021-09-12
9
+
10
+ ### Fixed
11
+ - "[eslint-to-isscript][eslint-to-isscript-readme]" rule;
12
+
13
+ ## [5.38.4] - 2021-09-11
14
+
15
+ ### Fixed
16
+ - Tree build edge case;
17
+ - DOM element attributes parse;
18
+ - "no-require-in-loop" rule - occurrence line number;
19
+ - Displayed message when rule-specific unexpected error occurs;
20
+
21
+ ## [5.38.3] - 2021-09-01
22
+
23
+ ### Fixed
24
+ - [Issue #30][issue#30]: allow custom tags to be non-self-closing;
25
+
3
26
  ## [5.38.2] - 2021-08-31
4
27
 
5
28
  ### Changed
6
- - Default value of "[indent][indent-readme]" rule's "quote" option to "never";
7
- - Improved "[indent][indent-readme]" rule's "standAloneClosingChars" configuration occurrence messages;
29
+ - Default value of "[indent][indent-readme]" rule's "quote" option to "never";
30
+ - Improved "[indent][indent-readme]" rule's "standAloneClosingChars" configuration occurrence messages;
8
31
 
9
32
  ### Fixed
10
- - "[indent][indent-readme]" rule - tags closing character global position;
11
-
33
+ - "[indent][indent-readme]" rule - tags closing character global position;
34
+
12
35
  ## [5.38.1] - 2021-08-29
13
36
 
14
37
  ### Fixed
15
- - "[indent][indent-readme]" rule autofix - removed buggy optimization;
16
-
38
+ - "[indent][indent-readme]" rule autofix - removed buggy optimization;
39
+
17
40
  ## [5.38.0] - 2021-08-29
18
41
 
19
42
  ### Added
20
43
  - "standAloneClosingChars" configuration attribute to the "[indent][indent-readme]" rule;
21
44
 
22
45
  ### Fixed
23
- - "indent" rule - duplicated attribute parse;
46
+ - "indent" rule - duplicated attribute parse;
24
47
 
25
48
  ## [5.37.0] - 2021-08-22
26
49
 
@@ -30,33 +53,33 @@
30
53
  ## [5.36.5] - 2021-08-18
31
54
 
32
55
  ### Changed
33
- - Removed redundant information from "invalid character found" error message;
56
+ - Removed redundant information from "invalid character found" error message;
34
57
 
35
58
  ### Fixed
36
- - Unbalanced element position detection;
37
- - Tree build parse on edge cases;
38
- - "[no-inline-style][no-inline-style-readme]" rule - allow `<isprint>` tag to have "style" attribute;
39
-
59
+ - Unbalanced element position detection;
60
+ - Tree build parse on edge cases;
61
+ - "[no-inline-style][no-inline-style-readme]" rule - allow `<isprint>` tag to have "style" attribute;
62
+
40
63
  ## [5.36.4] - 2021-08-15
41
64
 
42
65
  ### Fixed
43
- - "indent" rule - "isif"-nested value indentation;
44
- - "indent" rule - attribute multi-line value indentation;
66
+ - "indent" rule - "isif"-nested value indentation;
67
+ - "indent" rule - attribute multi-line value indentation;
45
68
 
46
69
  ## [5.36.3] - 2021-08-13
47
70
 
48
71
  ### Fixed
49
- - "indent" rule - autofix to keep space between tag attributes;
50
- - "indent" rule - expression attribute indentation fix;
51
- - "indent" rule - indentation of attribute value with embedded "isif" in it;
72
+ - "indent" rule - autofix to keep space between tag attributes;
73
+ - "indent" rule - expression attribute indentation fix;
74
+ - "indent" rule - indentation of attribute value with embedded "isif" in it;
52
75
 
53
76
  ## [5.36.2] - 2021-08-11
54
77
 
55
78
  ### Fixed
56
- - "indent" rule - autofix to keep duplicate spaces between tag attributes;
57
- - "indent" rule - attribute value indentation;
58
- - Tree build - unbalanced element detection;
59
- - Tree build - "script" tag with attribute parse;
79
+ - "indent" rule - autofix to keep duplicate spaces between tag attributes;
80
+ - "indent" rule - attribute value indentation;
81
+ - Tree build - unbalanced element detection;
82
+ - Tree build - "script" tag with attribute parse;
60
83
 
61
84
  ## [5.36.1] - 2021-08-09
62
85
 
@@ -331,7 +354,7 @@
331
354
  - License file;
332
355
 
333
356
  ### Changed
334
- - Set some dependencies as "dev" dependencies;
357
+ - Set some dependencies as "dev" dependencies;
335
358
 
336
359
  ### Security
337
360
  - Upgraded dependencies;
@@ -412,7 +435,7 @@
412
435
  ## [5.22.0] - 2019-11-24
413
436
 
414
437
  ### Added
415
- - [Issue #4][issue#4] ".eslintrc" filename as an acceptable config filename;
438
+ - [Issue #4][issue#4] ".eslintrc" filename as an acceptable config filename;
416
439
 
417
440
  ### Fixed
418
441
  - Command Line - If no directory or template parameter is passed, configured root directory or default directory is used;
@@ -865,7 +888,7 @@
865
888
  - Issue related to &lt;style> tag;
866
889
 
867
890
  ### Removed
868
- - 'empty-eof-line' rule from docs, as it is not implemented yet;
891
+ - 'empty-eof-line' rule from docs, as it is not implemented yet;
869
892
 
870
893
  ## [4.0.0] - 2019-03-03
871
894
 
@@ -878,10 +901,10 @@
878
901
  - No hardcode;
879
902
  - One Element per Line;
880
903
  - No Embedded ISML Tag;
881
-
904
+
882
905
  ### Removed
883
906
  - Global installation support;
884
-
907
+
885
908
  ### Deprecated
886
909
  - Output directory and json file;
887
910
 
@@ -949,6 +972,10 @@
949
972
  ### Added
950
973
  - Linter is published;
951
974
 
975
+ [5.39.0]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.5...v5.39.0
976
+ [5.38.5]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.4...v5.38.5
977
+ [5.38.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.3...v5.38.4
978
+ [5.38.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.2...v5.38.3
952
979
  [5.38.2]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.1...v5.38.2
953
980
  [5.38.1]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.0...v5.38.1
954
981
  [5.38.1]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.0...v5.38.1
@@ -1089,15 +1116,18 @@
1089
1116
  [issue#23]: https://github.com/FabiowQuixada/isml-linter/issues/23
1090
1117
  [issue#26]: https://github.com/FabiowQuixada/isml-linter/issues/26
1091
1118
  [issue#29]: https://github.com/FabiowQuixada/isml-linter/issues/29
1119
+ [issue#30]: https://github.com/FabiowQuixada/isml-linter/issues/30
1120
+ [issue#31]: https://github.com/FabiowQuixada/isml-linter/issues/31
1092
1121
 
1093
1122
  [cli-docs]: <docs/cli.md>
1094
1123
  [api-docs]: <docs/api.md>
1095
1124
  [license]: <LICENSE>
1096
1125
 
1097
- [disallow-tags-readme]: <docs/rules/disallow-tags.md>
1098
- [no-br-readme]: <docs/rules/no-br.md>
1099
- [no-inline-style-readme]: <docs/rules/no-br.md>
1100
- [no-isscript-readme]: <docs/rules/no-isscript.md>
1101
- [enforce-security-readme]: <docs/rules/enforce-security.md>
1102
- [no-hardcode-readme]: <docs/rules/no-hardcode.md>
1103
- [indent-readme]: <docs/rules/indent.md>
1126
+ [disallow-tags-readme]: <docs/rules/disallow-tags.md>
1127
+ [no-br-readme]: <docs/rules/no-br.md>
1128
+ [no-inline-style-readme]: <docs/rules/no-br.md>
1129
+ [no-isscript-readme]: <docs/rules/no-isscript.md>
1130
+ [enforce-security-readme]: <docs/rules/enforce-security.md>
1131
+ [no-hardcode-readme]: <docs/rules/no-hardcode.md>
1132
+ [indent-readme]: <docs/rules/indent.md>
1133
+ [eslint-to-isscript-readme]: <docs/rules/eslint-to-isscript.md>
package/README.md CHANGED
@@ -61,7 +61,8 @@ You can disable any rule by removing it from the config file. You may also find
61
61
  | eslintConfig | Path to a eslint configuration file, to be applied within `<isscript>` tags. Default: _.eslintrc.json_ |
62
62
  | enableCache | <span style="color:orange">[Deprecated]</span> Please check [cache docs][cache-docs]. Default: **false** |
63
63
  | autoFix | Applies fixes for enabled rules. Default: **false** |
64
- | printPartialResults | Prints partial results. Useful to get overall picture in case of many errors. Default: **false** |
64
+ | printPartialResults | Limits issues or rule occurrences listed in the console to up to 30 items. Useful to get overall picture in case of many errors. Default: **false** |
65
+ | verbose | Provides additional details of the linting process in the console. Default: **false** |
65
66
  | disableTreeParse | Enables only rules that do not depend on building an ISML tree. Check below when this might be useful. Default: **false** |
66
67
  | rules | Defines which rules to check. See available rules below |
67
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isml-linter",
3
- "version": "5.38.2",
3
+ "version": "5.39.0",
4
4
  "author": "Fabiow Quixadá <ftquixada@gmail.com>",
5
5
  "license": "MIT",
6
6
  "main": "src/publicApi.js",
@@ -37,10 +37,10 @@
37
37
  "dependencies": {
38
38
  "app-root-path": "^3.0.0",
39
39
  "chalk": "^4.1.0",
40
+ "eslint": "^6.8.0",
40
41
  "readdir": "^1.0.2"
41
42
  },
42
43
  "devDependencies": {
43
- "eslint": "^6.8.0",
44
44
  "eslint-plugin-jasmine": "^4.1.2",
45
45
  "eslint-plugin-varspacing": "^1.2.2",
46
46
  "ghooks": "^2.0.4",
package/src/Constants.js CHANGED
@@ -38,7 +38,7 @@ const specInvalidTemplateDir = path.join(specIsmlTreeTemplateDir, 'inv
38
38
  const specGlobalPosTemplateDir = path.join(specIsmlTreeTemplateDir, 'global_position');
39
39
  const specComplexTemplatesDir = path.join(specIsmlTreeTemplateDir, 'complex_templates');
40
40
  const specElementBalanceTemplatesDir = path.join(specIsmlTreeTemplateDir, 'element_balance');
41
- const specSuffixLineNumberTemplatesDir = path.join(specIsmlTreeTemplateDir, 'suffix_line_number');
41
+ const specTailLineNumberTemplatesDir = path.join(specIsmlTreeTemplateDir, 'tail_line_number');
42
42
  const specAutofixTemplatesDir = path.join(specTemplateDir, 'autofix');
43
43
  const rulesDir = path.join(linterModuleDir, 'src', 'rules');
44
44
  const lineByLineRulesDir = path.join(rulesDir, 'line_by_line');
@@ -104,7 +104,7 @@ module.exports = {
104
104
  specComplexTemplatesDir,
105
105
  specAutofixTemplatesDir,
106
106
  specElementBalanceTemplatesDir,
107
- specSuffixLineNumberTemplatesDir,
107
+ specTailLineNumberTemplatesDir,
108
108
  specDir,
109
109
  linterModuleDir,
110
110
 
package/src/IsmlLinter.js CHANGED
@@ -10,6 +10,7 @@ let RuleUtils = null;
10
10
 
11
11
  const UNKNOWN_ERROR = ExceptionUtils.types.UNKNOWN_ERROR;
12
12
  const UNPARSEABLE = ExceptionUtils.types.INVALID_TEMPLATE;
13
+ const RULE_ERROR = ExceptionUtils.types.RULE_ERROR;
13
14
  const Linter = {};
14
15
 
15
16
  // Configuration set through the public API;
@@ -92,6 +93,7 @@ const getEmptyResult = () => {
92
93
  info : {},
93
94
  UNKNOWN_ERROR : [],
94
95
  INVALID_TEMPLATE : [],
96
+ RULE_ERROR : [],
95
97
  issueQty : 0,
96
98
  occurrenceQty : 0,
97
99
  templatesFixed : 0,
@@ -138,6 +140,17 @@ const checkTemplate = (templatePath, data, content, templateName) => {
138
140
  templateResults.issueQty++;
139
141
  templateResults.occurrenceQty++;
140
142
 
143
+ } else if (e.type === RULE_ERROR) {
144
+ templateResults[RULE_ERROR].push({
145
+ templatePath : formattedTemplatePath,
146
+ ruleID : e.ruleID,
147
+ message : e.message,
148
+ originalError : e.originalError
149
+ });
150
+
151
+ templateResults.issueQty++;
152
+ templateResults.occurrenceQty++;
153
+
141
154
  } else if (!config.ignoreUnparseable) {
142
155
  templateResults[UNPARSEABLE].push({
143
156
  templatePath : formattedTemplatePath,
@@ -164,6 +177,7 @@ const merge = (finalResult, templateResults) => {
164
177
  templatesFixed : finalResult.templatesFixed + templateResults.templatesFixed,
165
178
  UNKNOWN_ERROR : [...finalResult[UNKNOWN_ERROR], ...templateResults[UNKNOWN_ERROR]],
166
179
  INVALID_TEMPLATE : [...finalResult[UNPARSEABLE], ...templateResults[UNPARSEABLE]],
180
+ RULE_ERROR : [...finalResult[RULE_ERROR], ...templateResults[RULE_ERROR]],
167
181
  totalTemplatesQty : finalResult.totalTemplatesQty
168
182
  };
169
183
  };
File without changes
@@ -13,7 +13,7 @@ class ContainerNode extends IsmlNode {
13
13
 
14
14
  constructor(lineNumber, globalPos) {
15
15
  super();
16
- this.value = '(Container node)';
16
+ this.head = '(Container node)';
17
17
  this.lineNumber = lineNumber;
18
18
  this.globalPos = globalPos;
19
19
  }