isml-linter 5.39.3 → 5.40.1

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 (61) hide show
  1. package/CHANGELOG.md +1184 -1159
  2. package/LICENSE +21 -21
  3. package/README.md +245 -245
  4. package/bin/isml-linter.js +32 -32
  5. package/ismllinter.config.js +33 -33
  6. package/package.json +53 -53
  7. package/scaffold_files/ismllinter.config.js +47 -47
  8. package/src/Builder.js +15 -15
  9. package/src/Constants.js +139 -139
  10. package/src/IsmlLinter.js +255 -255
  11. package/src/enums/ParseStatus.js +5 -5
  12. package/src/enums/SfccTagContainer.js +287 -287
  13. package/src/isml_tree/ContainerNode.js +38 -38
  14. package/src/isml_tree/IsmlNode.js +692 -684
  15. package/src/isml_tree/MaskUtils.js +421 -421
  16. package/src/isml_tree/ParseUtils.js +532 -506
  17. package/src/isml_tree/TreeBuilder.js +273 -273
  18. package/src/publicApi.js +24 -24
  19. package/src/rules/line_by_line/enforce-isprint.js +53 -53
  20. package/src/rules/line_by_line/enforce-require.js +35 -35
  21. package/src/rules/line_by_line/lowercase-filename.js +29 -29
  22. package/src/rules/line_by_line/max-lines.js +37 -37
  23. package/src/rules/line_by_line/no-br.js +36 -36
  24. package/src/rules/line_by_line/no-git-conflict.js +43 -43
  25. package/src/rules/line_by_line/no-import-package.js +34 -34
  26. package/src/rules/line_by_line/no-inline-style.js +34 -34
  27. package/src/rules/line_by_line/no-isscript.js +34 -34
  28. package/src/rules/line_by_line/no-space-only-lines.js +47 -47
  29. package/src/rules/line_by_line/no-tabs.js +38 -38
  30. package/src/rules/line_by_line/no-trailing-spaces.js +52 -52
  31. package/src/rules/prototypes/RulePrototype.js +79 -79
  32. package/src/rules/prototypes/SingleLineRulePrototype.js +47 -47
  33. package/src/rules/prototypes/TreeRulePrototype.js +84 -84
  34. package/src/rules/tree/align-isset.js +87 -87
  35. package/src/rules/tree/contextual-attrs.js +105 -105
  36. package/src/rules/tree/custom-tags.js +54 -54
  37. package/src/rules/tree/disallow-tags.js +39 -39
  38. package/src/rules/tree/empty-eof.js +66 -66
  39. package/src/rules/tree/enforce-security.js +85 -85
  40. package/src/rules/tree/eslint-to-isscript.js +179 -179
  41. package/src/rules/tree/indent.js +856 -853
  42. package/src/rules/tree/leading-iscache.js +39 -39
  43. package/src/rules/tree/leading-iscontent.js +35 -35
  44. package/src/rules/tree/max-depth.js +54 -54
  45. package/src/rules/tree/no-deprecated-attrs.js +67 -67
  46. package/src/rules/tree/no-embedded-isml.js +17 -17
  47. package/src/rules/tree/no-hardcode.js +51 -51
  48. package/src/rules/tree/no-iselse-slash.js +35 -35
  49. package/src/rules/tree/no-redundant-context.js +134 -134
  50. package/src/rules/tree/no-require-in-loop.js +63 -63
  51. package/src/rules/tree/one-element-per-line.js +82 -76
  52. package/src/util/CommandLineUtils.js +19 -19
  53. package/src/util/ConfigUtils.js +219 -219
  54. package/src/util/ConsoleUtils.js +327 -327
  55. package/src/util/CustomTagContainer.js +45 -45
  56. package/src/util/ExceptionUtils.js +173 -149
  57. package/src/util/FileUtils.js +79 -79
  58. package/src/util/GeneralUtils.js +60 -60
  59. package/src/util/NativeExtensionUtils.js +6 -6
  60. package/src/util/RuleUtils.js +295 -295
  61. package/src/util/TempRuleUtils.js +232 -232
@@ -1,287 +1,287 @@
1
- const TAG_DATA = {
2
- 'isactivedatacontext' : {
3
- 'attributes': {
4
- 'category' : {
5
- 'required': true
6
- }
7
- },
8
- 'self-closing' : true
9
- },
10
- 'isactivedatahead' : {
11
- 'within' : ['head'],
12
- 'self-closing' : true
13
- },
14
- 'isanalyticsoff' : {
15
- 'self-closing' : true
16
- },
17
- 'isbreak' : {
18
- 'within' : ['isloop'],
19
- 'self-closing' : true
20
- },
21
- 'iscache' : {
22
- 'attributes': {
23
- 'status' : {
24
- 'values' : ['off', 'on'],
25
- 'deprecatedValues' : ['off']
26
- },
27
- 'type' : {
28
- 'required' : true,
29
- 'values' : ['relative', 'daily']
30
- },
31
- 'hour' : {},
32
- 'minute' : {},
33
- 'varyby' : {},
34
- 'if' : {}
35
- },
36
- 'self-closing' : true
37
- },
38
- 'iscomment': {},
39
- 'iscomponent': {
40
- 'attributes': {
41
- 'pipeline' : {
42
- 'required' : true
43
- },
44
- 'locale' : {},
45
- 'parameterN' : {}
46
- },
47
- 'self-closing' : true
48
- },
49
- 'iscontent' : {
50
- 'attributes': {
51
- 'type' : {},
52
- 'charset' : {},
53
- 'encoding' : {
54
- 'values' : ['on', 'off', 'html', 'xml', 'wml']
55
- },
56
- 'compact' : {
57
- 'values': ['true', 'false']
58
- }
59
- },
60
- 'self-closing' : true
61
- },
62
- 'iscontinue' : {
63
- 'within' : ['isloop'],
64
- 'self-closing' : true
65
- },
66
- 'iscookie' : {
67
- 'attributes': {
68
- 'name' : {
69
- 'required' : true
70
- },
71
- 'value' : {
72
- 'required' : true
73
- },
74
- 'comment' : {},
75
- 'domain' : {},
76
- 'path' : {},
77
- 'maxAge' : {},
78
- 'version' : {},
79
- 'secure' : {
80
- 'values' : ['on', 'off']
81
- }
82
- },
83
- 'self-closing' : true
84
- },
85
- 'isdecorate' : {
86
- 'attributes': {
87
- 'template' : {
88
- 'required' : true
89
- }
90
- }
91
- },
92
- 'iselse': {
93
- 'attributes': {
94
- 'condition' : {}
95
- },
96
- 'self-closing' : true
97
- },
98
- 'isif': {
99
- 'attributes': {
100
- 'condition' : {}
101
- }
102
- },
103
- 'iselseif': {
104
- 'attributes': {
105
- 'condition' : {}
106
- },
107
- 'self-closing' : true
108
- },
109
- 'isinclude' : {
110
- 'attributes': {
111
- 'template': {},
112
- 'url': {},
113
- 'sf-toolkit' : {
114
- 'values' : ['on', 'off'],
115
- 'default' : 'on'
116
- }
117
- },
118
- 'requires' : {
119
- 'exclusive': ['url', 'template']
120
- },
121
- 'self-closing' : true
122
- },
123
- 'isloop' : {
124
- 'attributes': {
125
- 'items' : {},
126
- 'iterator' : {},
127
- 'alias' : {},
128
- 'var' : {},
129
- 'status' : {},
130
- 'begin' : {},
131
- 'end' : {},
132
- 'step' : {}
133
- },
134
- 'requires': {
135
- // TODO Non-exclusive?
136
- // 'non-exclusive' : ['items', 'iterator']
137
- // 'non-exclusive' : ['alias', 'var']
138
- }
139
- },
140
- 'ismodule' : {
141
- 'attributes': {
142
- 'template' : {
143
- 'required' : true
144
- },
145
- 'name' : {
146
- 'required' : true
147
- },
148
- 'attribute': {}
149
- },
150
- 'self-closing' : true
151
- },
152
- 'isnext' : {
153
- 'within' : ['isloop'],
154
- 'self-closing' : true
155
- },
156
- 'isobject' : {
157
- 'attributes': {
158
- 'object' : {
159
- 'required' : true
160
- },
161
- 'view' : {
162
- 'values' : ['none', 'searchhit', 'recommendation', 'setproduct', 'detail'],
163
- 'required' : true
164
- }
165
- }
166
- },
167
- 'isprint' : {
168
- 'attributes': {
169
- 'value' : {
170
- 'required' : true
171
- },
172
- 'style' : {},
173
- 'formatter' : {},
174
- 'timezone' : {
175
- 'values' : ['SITE', 'INSTANCE', 'utc']
176
- },
177
- 'padding' : {},
178
- 'encoding' : {
179
- 'values' : ['on', 'off'],
180
- 'default' : 'on'
181
- }
182
- },
183
- 'self-closing' : true
184
- // TODO Are they really mutually exclusive?
185
- // },
186
- // 'requires' : {
187
- // 'exclusive': ['style', 'formatter']
188
- },
189
- 'isredirect' : {
190
- 'attributes': {
191
- 'location' : {
192
- 'required' : true
193
- },
194
- 'permanent' : {
195
- 'values' : ['true', 'false'],
196
- 'default': 'false'
197
- }
198
- },
199
- 'self-closing' : true
200
- },
201
- 'isremove' : {
202
- 'attributes': {
203
- 'name' : {
204
- 'required' : true
205
- },
206
- 'scope' : {
207
- 'values' : ['session', 'request', 'page'],
208
- 'deprecatedValues' : ['pdict']
209
- }
210
- },
211
- 'self-closing' : true
212
- },
213
- 'isreplace' : {
214
- 'within' : ['isdecorate'],
215
- 'self-closing' : true
216
- },
217
- 'isscript' : {},
218
- 'isselect' : {
219
- 'attributes': {
220
- 'name' : {
221
- 'required' : true
222
- },
223
- 'iterator' : {
224
- 'required' : true
225
- },
226
- 'description' : {
227
- 'required' : true
228
- },
229
- 'value' : {
230
- 'required' : true
231
- },
232
- 'condition' : {
233
- 'values' : ['true', 'false']
234
- },
235
- 'encoding' : {
236
- 'values' : ['on', 'off']
237
- }
238
- },
239
- 'self-closing' : true
240
- },
241
- 'isset' : {
242
- 'attributes': {
243
- 'name' : {
244
- 'required' : true
245
- },
246
- 'value' : {
247
- 'required' : true
248
- },
249
- 'scope' : {
250
- 'required' : true,
251
- 'values' : ['session', 'request', 'page']
252
- }
253
- },
254
- 'self-closing' : true
255
- },
256
- 'isslot' : {
257
- 'attributes': {
258
- 'id' : {
259
- 'required' : true
260
- },
261
- 'context' : {
262
- 'required' : true,
263
- 'values' : ['global', 'category', 'folder'],
264
- 'requires' : {
265
- 'name' : 'context-object',
266
- 'ifValues' : ['category', 'folder']
267
- }
268
- },
269
- 'context-object' : {},
270
- 'description' : {
271
- 'required' : true
272
- },
273
- 'preview-url' : {}
274
- },
275
- 'self-closing' : true
276
- },
277
- 'isstatus' : {
278
- 'attributes': {
279
- 'value' : {
280
- 'required' : true
281
- }
282
- },
283
- 'self-closing' : true
284
- }
285
- };
286
-
287
- module.exports = TAG_DATA;
1
+ const TAG_DATA = {
2
+ 'isactivedatacontext' : {
3
+ 'attributes': {
4
+ 'category' : {
5
+ 'required': true
6
+ }
7
+ },
8
+ 'self-closing' : true
9
+ },
10
+ 'isactivedatahead' : {
11
+ 'within' : ['head'],
12
+ 'self-closing' : true
13
+ },
14
+ 'isanalyticsoff' : {
15
+ 'self-closing' : true
16
+ },
17
+ 'isbreak' : {
18
+ 'within' : ['isloop'],
19
+ 'self-closing' : true
20
+ },
21
+ 'iscache' : {
22
+ 'attributes': {
23
+ 'status' : {
24
+ 'values' : ['off', 'on'],
25
+ 'deprecatedValues' : ['off']
26
+ },
27
+ 'type' : {
28
+ 'required' : true,
29
+ 'values' : ['relative', 'daily']
30
+ },
31
+ 'hour' : {},
32
+ 'minute' : {},
33
+ 'varyby' : {},
34
+ 'if' : {}
35
+ },
36
+ 'self-closing' : true
37
+ },
38
+ 'iscomment': {},
39
+ 'iscomponent': {
40
+ 'attributes': {
41
+ 'pipeline' : {
42
+ 'required' : true
43
+ },
44
+ 'locale' : {},
45
+ 'parameterN' : {}
46
+ },
47
+ 'self-closing' : true
48
+ },
49
+ 'iscontent' : {
50
+ 'attributes': {
51
+ 'type' : {},
52
+ 'charset' : {},
53
+ 'encoding' : {
54
+ 'values' : ['on', 'off', 'html', 'xml', 'wml']
55
+ },
56
+ 'compact' : {
57
+ 'values': ['true', 'false']
58
+ }
59
+ },
60
+ 'self-closing' : true
61
+ },
62
+ 'iscontinue' : {
63
+ 'within' : ['isloop'],
64
+ 'self-closing' : true
65
+ },
66
+ 'iscookie' : {
67
+ 'attributes': {
68
+ 'name' : {
69
+ 'required' : true
70
+ },
71
+ 'value' : {
72
+ 'required' : true
73
+ },
74
+ 'comment' : {},
75
+ 'domain' : {},
76
+ 'path' : {},
77
+ 'maxAge' : {},
78
+ 'version' : {},
79
+ 'secure' : {
80
+ 'values' : ['on', 'off']
81
+ }
82
+ },
83
+ 'self-closing' : true
84
+ },
85
+ 'isdecorate' : {
86
+ 'attributes': {
87
+ 'template' : {
88
+ 'required' : true
89
+ }
90
+ }
91
+ },
92
+ 'iselse': {
93
+ 'attributes': {
94
+ 'condition' : {}
95
+ },
96
+ 'self-closing' : true
97
+ },
98
+ 'isif': {
99
+ 'attributes': {
100
+ 'condition' : {}
101
+ }
102
+ },
103
+ 'iselseif': {
104
+ 'attributes': {
105
+ 'condition' : {}
106
+ },
107
+ 'self-closing' : true
108
+ },
109
+ 'isinclude' : {
110
+ 'attributes': {
111
+ 'template': {},
112
+ 'url': {},
113
+ 'sf-toolkit' : {
114
+ 'values' : ['on', 'off'],
115
+ 'default' : 'on'
116
+ }
117
+ },
118
+ 'requires' : {
119
+ 'exclusive': ['url', 'template']
120
+ },
121
+ 'self-closing' : true
122
+ },
123
+ 'isloop' : {
124
+ 'attributes': {
125
+ 'items' : {},
126
+ 'iterator' : {},
127
+ 'alias' : {},
128
+ 'var' : {},
129
+ 'status' : {},
130
+ 'begin' : {},
131
+ 'end' : {},
132
+ 'step' : {}
133
+ },
134
+ 'requires': {
135
+ // TODO Non-exclusive?
136
+ // 'non-exclusive' : ['items', 'iterator']
137
+ // 'non-exclusive' : ['alias', 'var']
138
+ }
139
+ },
140
+ 'ismodule' : {
141
+ 'attributes': {
142
+ 'template' : {
143
+ 'required' : true
144
+ },
145
+ 'name' : {
146
+ 'required' : true
147
+ },
148
+ 'attribute': {}
149
+ },
150
+ 'self-closing' : true
151
+ },
152
+ 'isnext' : {
153
+ 'within' : ['isloop'],
154
+ 'self-closing' : true
155
+ },
156
+ 'isobject' : {
157
+ 'attributes': {
158
+ 'object' : {
159
+ 'required' : true
160
+ },
161
+ 'view' : {
162
+ 'values' : ['none', 'searchhit', 'recommendation', 'setproduct', 'detail'],
163
+ 'required' : true
164
+ }
165
+ }
166
+ },
167
+ 'isprint' : {
168
+ 'attributes': {
169
+ 'value' : {
170
+ 'required' : true
171
+ },
172
+ 'style' : {},
173
+ 'formatter' : {},
174
+ 'timezone' : {
175
+ 'values' : ['SITE', 'INSTANCE', 'utc']
176
+ },
177
+ 'padding' : {},
178
+ 'encoding' : {
179
+ 'values' : ['on', 'off'],
180
+ 'default' : 'on'
181
+ }
182
+ },
183
+ 'self-closing' : true
184
+ // TODO Are they really mutually exclusive?
185
+ // },
186
+ // 'requires' : {
187
+ // 'exclusive': ['style', 'formatter']
188
+ },
189
+ 'isredirect' : {
190
+ 'attributes': {
191
+ 'location' : {
192
+ 'required' : true
193
+ },
194
+ 'permanent' : {
195
+ 'values' : ['true', 'false'],
196
+ 'default': 'false'
197
+ }
198
+ },
199
+ 'self-closing' : true
200
+ },
201
+ 'isremove' : {
202
+ 'attributes': {
203
+ 'name' : {
204
+ 'required' : true
205
+ },
206
+ 'scope' : {
207
+ 'values' : ['session', 'request', 'page'],
208
+ 'deprecatedValues' : ['pdict']
209
+ }
210
+ },
211
+ 'self-closing' : true
212
+ },
213
+ 'isreplace' : {
214
+ 'within' : ['isdecorate'],
215
+ 'self-closing' : true
216
+ },
217
+ 'isscript' : {},
218
+ 'isselect' : {
219
+ 'attributes': {
220
+ 'name' : {
221
+ 'required' : true
222
+ },
223
+ 'iterator' : {
224
+ 'required' : true
225
+ },
226
+ 'description' : {
227
+ 'required' : true
228
+ },
229
+ 'value' : {
230
+ 'required' : true
231
+ },
232
+ 'condition' : {
233
+ 'values' : ['true', 'false']
234
+ },
235
+ 'encoding' : {
236
+ 'values' : ['on', 'off']
237
+ }
238
+ },
239
+ 'self-closing' : true
240
+ },
241
+ 'isset' : {
242
+ 'attributes': {
243
+ 'name' : {
244
+ 'required' : true
245
+ },
246
+ 'value' : {
247
+ 'required' : true
248
+ },
249
+ 'scope' : {
250
+ 'required' : true,
251
+ 'values' : ['session', 'request', 'page']
252
+ }
253
+ },
254
+ 'self-closing' : true
255
+ },
256
+ 'isslot' : {
257
+ 'attributes': {
258
+ 'id' : {
259
+ 'required' : true
260
+ },
261
+ 'context' : {
262
+ 'required' : true,
263
+ 'values' : ['global', 'category', 'folder'],
264
+ 'requires' : {
265
+ 'name' : 'context-object',
266
+ 'ifValues' : ['category', 'folder']
267
+ }
268
+ },
269
+ 'context-object' : {},
270
+ 'description' : {
271
+ 'required' : true
272
+ },
273
+ 'preview-url' : {}
274
+ },
275
+ 'self-closing' : true
276
+ },
277
+ 'isstatus' : {
278
+ 'attributes': {
279
+ 'value' : {
280
+ 'required' : true
281
+ }
282
+ },
283
+ 'self-closing' : true
284
+ }
285
+ };
286
+
287
+ module.exports = TAG_DATA;
@@ -1,38 +1,38 @@
1
- const IsmlNode = require('./IsmlNode');
2
-
3
- /**
4
- * This is container node that holds values for multi-clause tags, such as
5
- * an <isif> ... <iselseif> ... </isif> chain.
6
- *
7
- * It is not printed when the isml dom tree is printed;
8
- *
9
- * It is used ONLY to hold <isif>, <iselse>, <iselseif> nodes together;
10
- */
11
-
12
- class ContainerNode extends IsmlNode {
13
-
14
- constructor(lineNumber, globalPos) {
15
- super();
16
- this.head = '(Container node)';
17
- this.lineNumber = lineNumber;
18
- this.globalPos = globalPos;
19
- }
20
-
21
- isContainer() { return true; }
22
-
23
- addChild(clause) {
24
- clause.depth = this.depth;
25
- clause.parent = this;
26
- clause.childNo = this.children.length;
27
- this.newestChildNode = clause;
28
- this.children.push(clause);
29
- }
30
-
31
- print() {
32
- for (let i = 0; i < this.children.length; i++) {
33
- this.children[i].print();
34
- }
35
- }
36
- }
37
-
38
- module.exports = ContainerNode;
1
+ const IsmlNode = require('./IsmlNode');
2
+
3
+ /**
4
+ * This is container node that holds values for multi-clause tags, such as
5
+ * an <isif> ... <iselseif> ... </isif> chain.
6
+ *
7
+ * It is not printed when the isml dom tree is printed;
8
+ *
9
+ * It is used ONLY to hold <isif>, <iselse>, <iselseif> nodes together;
10
+ */
11
+
12
+ class ContainerNode extends IsmlNode {
13
+
14
+ constructor(lineNumber, globalPos) {
15
+ super();
16
+ this.head = '(Container node)';
17
+ this.lineNumber = lineNumber;
18
+ this.globalPos = globalPos;
19
+ }
20
+
21
+ isContainer() { return true; }
22
+
23
+ addChild(clause) {
24
+ clause.depth = this.depth;
25
+ clause.parent = this;
26
+ clause.childNo = this.children.length;
27
+ this.newestChildNode = clause;
28
+ this.children.push(clause);
29
+ }
30
+
31
+ print() {
32
+ for (let i = 0; i < this.children.length; i++) {
33
+ this.children[i].print();
34
+ }
35
+ }
36
+ }
37
+
38
+ module.exports = ContainerNode;