Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: telemetry added for current linter #36400

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions app/client/src/plugins/Linting/utils/getLintingErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import setters from "workers/Evaluation/setters";
import { isMemberExpressionNode } from "@shared/ast/src";
import { generate } from "astring";
import getInvalidModuleInputsError from "ee/plugins/Linting/utils/getInvalidModuleInputsError";
import { startAndEndSpanForFn } from "UITelemetry/generateTraces";
import { objectKeys } from "@appsmith/utils";

const EvaluationScriptPositions: Record<string, Position> = {};

Expand Down Expand Up @@ -65,7 +67,7 @@ function generateLintingGlobalData(data: Record<string, unknown>) {
);
libAccessors.forEach((accessor) => (globalData[accessor] = true));
// Add all supported web apis
Object.keys(SUPPORTED_WEB_APIS).forEach(
objectKeys(SUPPORTED_WEB_APIS).forEach(
(apiName) => (globalData[apiName] = true),
);
return globalData;
Expand Down Expand Up @@ -185,7 +187,16 @@ export default function getLintingErrors({
const lintingGlobalData = generateLintingGlobalData(data);
const lintingOptions = lintOptions(lintingGlobalData);

jshint(script, lintingOptions);
startAndEndSpanForFn(
"Linter",
// adding some metrics to compare the performance changes with eslint
{
linter: "JSHint",
linesOfCodeLinted: originalBinding.split("\n").length,
codeSizeInChars: originalBinding.length,
},
() => jshint(script, lintingOptions),
);
const sanitizedJSHintErrors = sanitizeJSHintErrors(jshint.errors, scriptPos);
const jshintErrors: LintError[] = sanitizedJSHintErrors.map((lintError) =>
convertJsHintErrorToAppsmithLintError(
Expand Down
Loading