isml-linter 5.40.4 → 5.40.5
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.40.5] - 2023-01-15
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Disallow void elements closing tags;
|
|
7
|
+
- Minor output messages improvement;
|
|
8
|
+
|
|
3
9
|
## [5.40.4] - 2023-01-15
|
|
4
10
|
|
|
5
11
|
### Fixed
|
|
@@ -1034,6 +1040,7 @@
|
|
|
1034
1040
|
### Added
|
|
1035
1041
|
- Linter is published;
|
|
1036
1042
|
|
|
1043
|
+
[5.40.5]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.4...v5.40.5
|
|
1037
1044
|
[5.40.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.3...v5.40.4
|
|
1038
1045
|
[5.40.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.2...v5.40.3
|
|
1039
1046
|
[5.40.2]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.1...v5.40.2
|
package/package.json
CHANGED
|
@@ -103,6 +103,9 @@ const checkBalance = (node, templatePath) => {
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
const parseNextElement = state => {
|
|
106
|
+
const ConfigUtils = require('../util/ConfigUtils');
|
|
107
|
+
|
|
108
|
+
const config = ConfigUtils.load();
|
|
106
109
|
const newElement = getNewElement(state);
|
|
107
110
|
|
|
108
111
|
const trimmedElement = newElement.value.trim();
|
|
@@ -125,7 +128,8 @@ const parseNextElement = state => {
|
|
|
125
128
|
parseTextElement(state, newElement);
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
newElement.columnNumber
|
|
131
|
+
newElement.columnNumber = getElementColumnNumber(newElement, state);
|
|
132
|
+
newElement.isVoidElement = !config.disableHtml5 && Constants.voidElementsArray.indexOf(newElement.tagType) >= 0;
|
|
129
133
|
|
|
130
134
|
if (state.isCrlfLineBreak) {
|
|
131
135
|
newElement.globalPos += newElement.lineNumber - 1;
|
|
@@ -110,7 +110,17 @@ const parseContainerElements = (element, currentParent, newNode, templatePath) =
|
|
|
110
110
|
|
|
111
111
|
const parseNonContainerElements = (element, currentParent, newNode, templatePath) => {
|
|
112
112
|
if (element.isSelfClosing) {
|
|
113
|
-
|
|
113
|
+
if (element.isClosingTag && element.isVoidElement) {
|
|
114
|
+
throw ExceptionUtils.voidElementClosingTag(
|
|
115
|
+
element.tagType,
|
|
116
|
+
element.lineNumber,
|
|
117
|
+
element.globalPos,
|
|
118
|
+
element.value.trim().length,
|
|
119
|
+
templatePath
|
|
120
|
+
);
|
|
121
|
+
} else {
|
|
122
|
+
currentParent.addChild(newNode);
|
|
123
|
+
}
|
|
114
124
|
} else if (!element.isClosingTag && element.tagType !== 'isif') {
|
|
115
125
|
currentParent.addChild(newNode);
|
|
116
126
|
|
|
@@ -7,6 +7,7 @@ const types = {
|
|
|
7
7
|
INVALID_TEMPLATE : 'INVALID_TEMPLATE',
|
|
8
8
|
INVALID_NESTED_ISIF : 'INVALID_NESTED_ISIF',
|
|
9
9
|
INVALID_CHARACTER : 'INVALID_CHARACTER',
|
|
10
|
+
VOID_ELEMENT_CLOSING_TAG : 'VOID_ELEMENT_CLOSING_TAG',
|
|
10
11
|
RULE_ERROR : 'RULE_ERROR',
|
|
11
12
|
NO_CONFIG : 'NO_CONFIG',
|
|
12
13
|
};
|
|
@@ -100,6 +101,18 @@ const invalidCharacterError = (character, lineNumber, globalPos, length, templat
|
|
|
100
101
|
};
|
|
101
102
|
};
|
|
102
103
|
|
|
104
|
+
const voidElementClosingTag = (element, lineNumber, globalPos, length, templatePath) => {
|
|
105
|
+
return {
|
|
106
|
+
message : `"<${element}>" is a void element, and as such, should not have a corresponding closing tag`,
|
|
107
|
+
templatePath : templatePath,
|
|
108
|
+
globalPos,
|
|
109
|
+
length,
|
|
110
|
+
lineNumber : lineNumber,
|
|
111
|
+
isCustom : true,
|
|
112
|
+
type : types.VOID_ELEMENT_CLOSING_TAG
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
103
116
|
const invalidNestedIsifError = (tagType, lineNumber, globalPos, templatePath) => {
|
|
104
117
|
return {
|
|
105
118
|
message : `An error occurred while parsing element "<${tagType}>" in line ${lineNumber}. Try moving the closing character ">" of the "<${tagType}>" element to outside of the "<isif>" condition.`,
|
|
@@ -135,14 +148,14 @@ const unkownError = (templatePath) => {
|
|
|
135
148
|
|
|
136
149
|
const noConfigError = () => {
|
|
137
150
|
return {
|
|
138
|
-
message : `No configuration found. Please run the following command: ${Constants.EOL}${Constants.EOL}\t./node_modules/.bin/isml-linter --init${Constants.EOL}${Constants.EOL}`,
|
|
151
|
+
message : `No ISML Linter configuration file found. Please run the following command: ${Constants.EOL}${Constants.EOL}\t./node_modules/.bin/isml-linter --init${Constants.EOL}${Constants.EOL}`,
|
|
139
152
|
isCustom : true
|
|
140
153
|
};
|
|
141
154
|
};
|
|
142
155
|
|
|
143
156
|
const noEslintConfigError = () => {
|
|
144
157
|
return {
|
|
145
|
-
message : 'No
|
|
158
|
+
message : 'No ESLint configuration file found. Please add an ESLint configuration file and try again.',
|
|
146
159
|
isCustom : true
|
|
147
160
|
};
|
|
148
161
|
};
|
|
@@ -160,6 +173,7 @@ module.exports = {
|
|
|
160
173
|
unbalancedQuotesError,
|
|
161
174
|
ruleApplianceError,
|
|
162
175
|
unkownError,
|
|
176
|
+
voidElementClosingTag,
|
|
163
177
|
invalidNestedIsifError,
|
|
164
178
|
unclosedDeprecatedIsmlComment,
|
|
165
179
|
unbalancedElementError,
|