isml-linter 5.40.2 → 5.40.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,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.40.4] - 2023-01-15
4
+
5
+ ### Fixed
6
+ - Invalid ">" character detection;
7
+ - Invalid element issue length;
8
+ - "no-inline-style" rule;
9
+
10
+ ## [5.40.3] - 2022-09-12
11
+
12
+ ### Fixed
13
+ - [Issue #35][issue#35] - Manually set bin file linebreak to LF, as previous version didn't fix the issue;
3
14
 
4
15
  ## [5.40.2] - 2022-09-05
5
16
 
@@ -1023,6 +1034,8 @@
1023
1034
  ### Added
1024
1035
  - Linter is published;
1025
1036
 
1037
+ [5.40.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.3...v5.40.4
1038
+ [5.40.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.2...v5.40.3
1026
1039
  [5.40.2]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.1...v5.40.2
1027
1040
  [5.40.1]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.0...v5.40.1
1028
1041
  [5.40.0]: https://github.com/FabiowQuixada/isml-linter/compare/v5.39.4...v5.40.0
@@ -1,32 +1,32 @@
1
- #!/usr/bin/env node
2
-
3
- require('../src/util/NativeExtensionUtils');
4
-
5
- const CommandLineUtils = require('../src/util/CommandLineUtils');
6
- const ConfigUtils = require('../src/util/ConfigUtils');
7
-
8
- try {
9
- const commandObj = CommandLineUtils.parseCommand();
10
-
11
- if (!commandObj) {
12
- process.exit(0);
13
- }
14
-
15
- if (commandObj.options.indexOf('--init') >= 0) {
16
- ConfigUtils.init();
17
- process.exit(0);
18
- }
19
-
20
- const IsmlLinter = require('../src/publicApi');
21
- const filePatternArray = commandObj.files;
22
- const exitCode = IsmlLinter.build(filePatternArray);
23
-
24
- if (commandObj.options.indexOf('--build') >= 0) {
25
- process.exit(exitCode);
26
- }
27
-
28
- } catch (e) {
29
- const ConsoleUtils = require('../src/util/ConsoleUtils');
30
- ConsoleUtils.printExceptionMsg(e.stack || e);
31
- process.exit(1);
32
- }
1
+ #!/usr/bin/env node
2
+
3
+ require('../src/util/NativeExtensionUtils');
4
+
5
+ const CommandLineUtils = require('../src/util/CommandLineUtils');
6
+ const ConfigUtils = require('../src/util/ConfigUtils');
7
+
8
+ try {
9
+ const commandObj = CommandLineUtils.parseCommand();
10
+
11
+ if (!commandObj) {
12
+ process.exit(0);
13
+ }
14
+
15
+ if (commandObj.options.indexOf('--init') >= 0) {
16
+ ConfigUtils.init();
17
+ process.exit(0);
18
+ }
19
+
20
+ const IsmlLinter = require('../src/publicApi');
21
+ const filePatternArray = commandObj.files;
22
+ const exitCode = IsmlLinter.build(filePatternArray);
23
+
24
+ if (commandObj.options.indexOf('--build') >= 0) {
25
+ process.exit(exitCode);
26
+ }
27
+
28
+ } catch (e) {
29
+ const ConsoleUtils = require('../src/util/ConsoleUtils');
30
+ ConsoleUtils.printExceptionMsg(e.stack || e);
31
+ process.exit(1);
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isml-linter",
3
- "version": "5.40.2",
3
+ "version": "5.40.4",
4
4
  "author": "Fabiow Quixadá <ftquixada@gmail.com>",
5
5
  "license": "MIT",
6
6
  "main": "src/publicApi.js",
@@ -140,6 +140,14 @@ const parseNextElement = state => {
140
140
  newElement.globalPos,
141
141
  state.templatePath
142
142
  );
143
+ } else if (newElement.value.trim() === '>') {
144
+ throw ExceptionUtils.invalidCharacterError(
145
+ '>',
146
+ newElement.lineNumber,
147
+ newElement.globalPos,
148
+ 1,
149
+ state.templatePath
150
+ );
143
151
  }
144
152
 
145
153
  return newElement;
@@ -2,7 +2,7 @@ const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype')
2
2
 
3
3
  const ruleId = require('path').basename(__filename).slice(0, -3);
4
4
  const description = 'Avoid using inline style';
5
- const occurrenceText = 'style="';
5
+ const occurrenceText = ' style="';
6
6
 
7
7
  const Rule = Object.create(SingleLineRulePrototype);
8
8
 
@@ -11,7 +11,7 @@ Rule.init(ruleId, description);
11
11
  Rule.isBroken = function(line) { return line.indexOf('<isprint') === -1 && line.indexOf(occurrenceText) >= 0; };
12
12
 
13
13
  Rule.getColumnNumber = function(line) {
14
- return Math.max(line.indexOf(occurrenceText), 0) + 1;
14
+ return Math.max(line.indexOf(occurrenceText), 0) + 2;
15
15
  };
16
16
 
17
17
  Rule.getFirstOccurrence = function(line) {
@@ -23,8 +23,8 @@ Rule.getFirstOccurrence = function(line) {
23
23
  const matchPos = line.indexOf(occurrenceText);
24
24
 
25
25
  result = {
26
- globalPos : matchPos,
27
- length : occurrenceText.length - 2
26
+ globalPos : matchPos + 1,
27
+ length : occurrenceText.length - 3
28
28
  };
29
29
  }
30
30
 
@@ -105,7 +105,7 @@ const invalidNestedIsifError = (tagType, lineNumber, globalPos, templatePath) =>
105
105
  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.`,
106
106
  templatePath : templatePath,
107
107
  globalPos,
108
- length : tagType.length,
108
+ length : tagType.length + 1,
109
109
  lineNumber : lineNumber,
110
110
  isCustom : true,
111
111
  type : types.INVALID_NESTED_ISIF