Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions app/client/src/ce/entities/FeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const FEATURE_FLAG = {
release_actions_redesign_enabled: "release_actions_redesign_enabled",
rollout_remove_feature_walkthrough_enabled:
"rollout_remove_feature_walkthrough_enabled",
rollout_eslint_enabled: "rollout_eslint_enabled",
release_drag_drop_building_blocks_enabled:
"release_drag_drop_building_blocks_enabled",
release_table_cell_label_value_enabled:
Expand Down Expand Up @@ -68,6 +69,8 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
ab_appsmith_ai_query: false,
release_actions_redesign_enabled: false,
rollout_remove_feature_walkthrough_enabled: true,
rollout_js_enabled_one_click_binding_enabled: true,
rollout_eslint_enabled: false,
Comment thread
ayushpahwa marked this conversation as resolved.
Outdated
rollout_side_by_side_enabled: false,
release_layout_conversion_enabled: false,
release_anvil_toggle_enabled: false,
Expand Down
5 changes: 5 additions & 0 deletions app/client/src/plugins/Linting/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { ECMA_VERSION } from "@shared/ast";
import type { LintOptions } from "jshint";
import isEntityFunction from "./utils/isEntityFunction";

export enum LINTER_VERSION {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be something self explanatory ? Version suffix seems to be in number or so, Is LINTER_TYPE what you are looking for ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"JSHINT" = "JSHint",
"ESLINT" = "ESLint",
}

export const lintOptions = (globalData: Record<string, boolean>) =>
({
indent: 2,
Expand Down
18 changes: 17 additions & 1 deletion app/client/src/plugins/Linting/utils/getLintingErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
IGNORED_LINT_ERRORS,
lintOptions,
SUPPORTED_WEB_APIS,
LINTER_VERSION,
} from "../constants";
import type { getLintingErrorsProps } from "../types";
import { JSLibraries } from "workers/common/JSLibrary";
Expand All @@ -38,9 +39,23 @@ import { generate } from "astring";
import getInvalidModuleInputsError from "ee/plugins/Linting/utils/getInvalidModuleInputsError";
import { objectKeys } from "@appsmith/utils";
import { profileFn } from "UITelemetry/generateWebWorkerTraces";
import { WorkerEnv } from "workers/Evaluation/handlers/workerEnv";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";

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

function getLinterVersion() {
Comment thread
ayushpahwa marked this conversation as resolved.
Outdated
let linterVersion = LINTER_VERSION.JSHINT;

const flagValues = WorkerEnv.getFeatureFlags();

if (flagValues?.[FEATURE_FLAG.rollout_eslint_enabled]) {
linterVersion = LINTER_VERSION.ESLINT;
}

return linterVersion;
}

function getEvaluationScriptPosition(scriptType: EvaluationScriptType) {
if (isEmpty(EvaluationScriptPositions)) {
// We are computing position of <<script>> in our templates.
Expand Down Expand Up @@ -194,6 +209,7 @@ export default function getLintingErrors({
scriptType,
webworkerTelemetry,
}: getLintingErrorsProps): LintError[] {
const linterVersion = getLinterVersion();
const scriptPos = getEvaluationScriptPosition(scriptType);
const lintingGlobalData = generateLintingGlobalData(data);
const lintingOptions = lintOptions(lintingGlobalData);
Expand All @@ -202,7 +218,7 @@ export default function getLintingErrors({
"Linter",
// adding some metrics to compare the performance changes with eslint
{
linter: "JSHint",
linter: linterVersion,
linesOfCodeLinted: originalBinding.split("\n").length,
codeSizeInChars: originalBinding.length,
},
Expand Down