sadpandajoe commented on code in PR #44201:
URL: https://github.com/apache/superset/pull/44201#discussion_r4152602946
##########
superset-frontend/scripts/internal/oxlint-metrics-uploader.js:
##########
@@ -64,12 +65,50 @@ function parseRuleId(code) {
const [, namespace, rule] = match;
if (namespace === 'eslint') {
- return rule;
+ return { parsed: rule, pluginId: namespace };
}
// `eslint-plugin-unicorn(...)` is the same rule as `unicorn/...`
const plugin = namespace.replace(/^eslint-plugin-/, '');
- return `${plugin}/${rule}`;
+ return { parsed: `${plugin}/${rule}`, pluginId: plugin };
+}
+
+function parseOxlintResult(results, ruleIdPrefixes) {
+ // Process OXC JSON output
+ const metricsByRule = {};
+ const occurrencesData = [];
+
+ // OXC JSON format has diagnostics array
+ if (results.diagnostics && Array.isArray(results.diagnostics)) {
+ results.diagnostics.forEach(diagnostic => {
+ const { parsed: ruleId, pluginId } = parseRuleId(diagnostic.code);
Review Comment:
Agreed—Oxlint 1.85’s JSON output for a syntax error has no `code`, so this
path groups it under `undefined` and uploads a blank rule ID. Could both
fallback returns use the same object shape, with a `parseOxlintResult` test
asserting `unknown` and the original unrecognized code?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]