isml-linter 5.40.5 → 5.41.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.41.0] - 2023-01-21
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Exposed "fix" method in [ISML Linter API][api-docs];
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- Line-by-line and tree rules issues now are fixed in a single ISML Linter execution, not in two steps anymore;
|
|
10
|
+
|
|
3
11
|
## [5.40.5] - 2023-01-15
|
|
4
12
|
|
|
5
13
|
### Fixed
|
|
@@ -1040,6 +1048,7 @@
|
|
|
1040
1048
|
### Added
|
|
1041
1049
|
- Linter is published;
|
|
1042
1050
|
|
|
1051
|
+
[5.41.0]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.5...v5.41.0
|
|
1043
1052
|
[5.40.5]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.4...v5.40.5
|
|
1044
1053
|
[5.40.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.3...v5.40.4
|
|
1045
1054
|
[5.40.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.40.2...v5.40.3
|
package/package.json
CHANGED
package/src/publicApi.js
CHANGED
|
@@ -14,8 +14,23 @@ module.exports = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
linterResult = IsmlLinter.run(path, content);
|
|
17
|
+
|
|
17
18
|
return linterResult;
|
|
18
19
|
},
|
|
20
|
+
fix : (path, content, config) => {
|
|
21
|
+
let autofixConfig = config;
|
|
22
|
+
|
|
23
|
+
if (config) {
|
|
24
|
+
autofixConfig.autoFix = true;
|
|
25
|
+
IsmlLinter.setConfig(autofixConfig);
|
|
26
|
+
} else {
|
|
27
|
+
autofixConfig = IsmlLinter.getConfig();
|
|
28
|
+
autofixConfig.autoFix = true;
|
|
29
|
+
IsmlLinter.setConfig(autofixConfig);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return IsmlLinter.run(path, content, autofixConfig);
|
|
33
|
+
},
|
|
19
34
|
printResults : () => ConsoleUtils.displayOccurrenceList(linterResult),
|
|
20
35
|
build : path => Builder.run(path),
|
|
21
36
|
|
package/src/util/ConfigUtils.js
CHANGED
|
@@ -158,7 +158,7 @@ const existEslintConfigFile = () => {
|
|
|
158
158
|
FileUtils.fileExists(Constants.eslintConfigFilePathList[2]);
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
const isTestEnv = () => process.env.NODE_ENV === Constants.ENV_TEST;
|
|
161
|
+
const isTestEnv = () => process.env.NODE_ENV === Constants.ENV_TEST && !global.isSimulatingProductionEnvironment;
|
|
162
162
|
|
|
163
163
|
const setLocalConfig = configParam => {
|
|
164
164
|
if (isTestEnv()) {
|
package/src/util/RuleUtils.js
CHANGED
|
@@ -93,6 +93,7 @@ const applyRuleOnTemplate = (ruleArray, templatePath, root, config, data) => {
|
|
|
93
93
|
try {
|
|
94
94
|
ConsoleUtils.displayVerboseMessage(`Applying "${rule.id}" rule`, 1);
|
|
95
95
|
const ruleResults = rule.check(root, templateResults.data);
|
|
96
|
+
templateResults.finalContent = ruleResults.fixedContent;
|
|
96
97
|
applyRuleResult(config, ruleResults, templatePath, templateResults, rule);
|
|
97
98
|
|
|
98
99
|
} catch (error) {
|
|
@@ -226,7 +227,7 @@ const checkTemplate = (templatePath, data, content = '', templateName = '') => {
|
|
|
226
227
|
const config = ConfigUtils.load();
|
|
227
228
|
const templateContent = GeneralUtils.toLF(content || fs.readFileSync(templatePath, 'utf-8'));
|
|
228
229
|
const lineResults = checkLineByLineRules(templatePath, templateContent, config, data);
|
|
229
|
-
const treeResults = checkTreeRules(templatePath,
|
|
230
|
+
const treeResults = checkTreeRules(templatePath, lineResults.finalContent, config, data) || { errors : [] };
|
|
230
231
|
const filenameResults = checkFileName(templateName, templateContent);
|
|
231
232
|
|
|
232
233
|
return {
|