@zohodesk/testinglibrary 0.1.8-eslint-23 → 0.1.8-eslint-24
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.
|
@@ -50,7 +50,7 @@ async function runEslintForDiff(cliParams, options = {}) {
|
|
|
50
50
|
});
|
|
51
51
|
lint_process.on('close', async onclose => {
|
|
52
52
|
if (diffPath && !(filteredDiffFiles.length === 0)) {
|
|
53
|
-
const filteredJson = await
|
|
53
|
+
const filteredJson = await filterReportBasedDiff(require(reportPath), diffJSON);
|
|
54
54
|
(0, _fileUtils.writeFileContents)(reportPath, JSON.stringify(filteredJson));
|
|
55
55
|
}
|
|
56
56
|
resolve({
|
|
@@ -63,29 +63,28 @@ async function runEslintForDiff(cliParams, options = {}) {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function filterReportBasedDiff(resultJson, diffJson) {
|
|
67
67
|
return new Promise(resolve => {
|
|
68
68
|
if (!diffJson) {
|
|
69
69
|
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'git diff json is not given ...');
|
|
70
70
|
resolve(false);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const impactLineMap = filterDiffJson(diffJson);
|
|
73
73
|
resultJson = resultJson.filter(result => {
|
|
74
|
-
var
|
|
75
|
-
const isImpactFile =
|
|
74
|
+
var _impactLineMap$get;
|
|
75
|
+
const isImpactFile = result.filePath;
|
|
76
76
|
if (!isImpactFile) {
|
|
77
77
|
return false;
|
|
78
78
|
}
|
|
79
|
-
if (((
|
|
79
|
+
if (((_impactLineMap$get = impactLineMap.get(isImpactFile)) === null || _impactLineMap$get === void 0 ? void 0 : _impactLineMap$get.length) !== 0) {
|
|
80
80
|
result.messages = result.messages.filter(errorMsg => {
|
|
81
|
-
if (
|
|
81
|
+
if (impactLineMap.get(isImpactFile).includes(`${errorMsg.line}`)) {
|
|
82
82
|
return true;
|
|
83
83
|
}
|
|
84
84
|
return false;
|
|
85
85
|
});
|
|
86
86
|
return true;
|
|
87
87
|
}
|
|
88
|
-
return false;
|
|
89
88
|
});
|
|
90
89
|
resolve(resultJson);
|
|
91
90
|
});
|
|
@@ -100,7 +99,7 @@ function filterDiffJson(diffJson) {
|
|
|
100
99
|
while ((match = regex.exec(diff.diff)) !== null) {
|
|
101
100
|
diffMatch.push(...splitFilterNumber(match[1]));
|
|
102
101
|
}
|
|
103
|
-
const diffPathKey =
|
|
102
|
+
const diffPathKey = _path.default.resolve(getRootLintPath(), diff.new_path);
|
|
104
103
|
if (diffPathKey === undefined) {
|
|
105
104
|
return;
|
|
106
105
|
}
|