SERVER-101355 Make formatting errors fail eslint check (#32805)

GitOrigin-RevId: 9f6dc4159d6e233e81553eda5a74c7f2735da706
This commit is contained in:
Zack Winter 2025-02-28 09:51:58 -08:00 committed by MongoDB Bot
parent 227fe65a05
commit a7e20a2f5b
7 changed files with 14 additions and 10 deletions

View File

@ -282,11 +282,13 @@ def run_rules_lint(bazel_bin, args):
.split("\n")
)
failing_reports = 0
for report in valid_reports:
# Exclude coverage reports, and check if the output is empty.
if "coverage.dat" in report or not os.path.exists(report) or not os.path.getsize(report):
# Report is empty. No linting errors.
continue
failing_reports += 1
print(f"From {report}:")
with open(report, "r", encoding="utf-8") as f:
print(f.read())
@ -323,3 +325,5 @@ def run_rules_lint(bazel_bin, args):
else:
print(f"ERROR: unknown fix type {fix}", file=sys.stderr)
sys.exit(1)
elif failing_reports != 0:
sys.exit(1)

View File

@ -5,7 +5,7 @@ import {default as no_tojson} from "./rules/no-tojson-fn.js";
export default {
rules: {
"no-print-fn": no_print,
"no-tojson-fn": no_tojson,
"no-print-fn": 0,
"no-tojson-fn": 0,
},
};

View File

@ -251,7 +251,7 @@ export default [
rules: {
// TODO SERVER-99571 : enable mongodb/* rules.
"mongodb/no-print-fn": 1,
"mongodb/no-print-fn": 0,
"mongodb/no-tojson-fn": 1,
"no-prototype-builtins": 0,

View File

@ -38,7 +38,7 @@ function runTest({
// to run the pipeline against. Also create a view named localTargetName is localCollIsView
// is true.
let localColl = localDB[localTargetName];
let localTarget = localColl
let localTarget = localColl;
if (localTargetIsView) {
localColl = localDB[localTargetName + "_coll"];
assert.commandWorked(

View File

@ -44,7 +44,7 @@ function genPipeline(collection) {
}
]
}
}]
}];
}
function setup() {
@ -70,9 +70,9 @@ function assertPipeline(coll, pipeline) {
}
setup();
jsTestLog("From Normal Collection Lookup To Time Series Collection")
jsTestLog("From Normal Collection Lookup To Time Series Collection");
assertPipeline(collName, genPipeline(tsCollName));
jsTestLog("From Time Series Collection Lookup To Normal Collection")
jsTestLog("From Time Series Collection Lookup To Normal Collection");
assertPipeline(tsCollName, genPipeline(collName));
jsTestLog("From Time Series Collection Lookup To Time Series Collection")
jsTestLog("From Time Series Collection Lookup To Time Series Collection");
assertPipeline(tsCollName, genPipeline(tsCollName));

View File

@ -154,4 +154,4 @@ TimeseriesTest.run((insert) => {
],
/* queryFilter = */ {[metaFieldName + ".nested"]: {a: 1, b: 1}},
/* expectedUnsuccessfulQueryFilter=*/ {[metaFieldName + ".nested"]: {b: 1, a: 1}});
})
});

View File

@ -32,7 +32,7 @@ export class QuerySettingsIndexHintsTests {
this.indexA = {a: 1};
this.indexB = {b: 1};
this.indexAB = {a: 1, b: 1};
this.allIndexes = [this.indexA, this.indexB, this.indexAB]
this.allIndexes = [this.indexA, this.indexB, this.indexAB];
}
static shouldCheckPlanCache(db, command) {