diff --git a/app/client/src/ce/entities/FeatureFlag.ts b/app/client/src/ce/entities/FeatureFlag.ts index 4196cf40f46..413547130dc 100644 --- a/app/client/src/ce/entities/FeatureFlag.ts +++ b/app/client/src/ce/entities/FeatureFlag.ts @@ -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", rollout_side_by_side_enabled: "rollout_side_by_side_enabled", @@ -71,6 +72,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = { ab_appsmith_ai_query: false, release_actions_redesign_enabled: false, rollout_remove_feature_walkthrough_enabled: true, + rollout_eslint_enabled: false, rollout_side_by_side_enabled: false, release_layout_conversion_enabled: false, release_anvil_toggle_enabled: false, diff --git a/app/client/src/plugins/Linting/constants.ts b/app/client/src/plugins/Linting/constants.ts index 6ea64ce2633..492f104f172 100644 --- a/app/client/src/plugins/Linting/constants.ts +++ b/app/client/src/plugins/Linting/constants.ts @@ -2,6 +2,11 @@ import { ECMA_VERSION } from "@shared/ast"; import type { LintOptions } from "jshint"; import isEntityFunction from "./utils/isEntityFunction"; +export enum LINTER_TYPE { + "JSHINT" = "JSHint", + "ESLINT" = "ESLint", +} + export const lintOptions = (globalData: Record) => ({ indent: 2, diff --git a/app/client/src/plugins/Linting/utils/getLintingErrors.ts b/app/client/src/plugins/Linting/utils/getLintingErrors.ts index eccbe7d0afc..9a01b0b8ded 100644 --- a/app/client/src/plugins/Linting/utils/getLintingErrors.ts +++ b/app/client/src/plugins/Linting/utils/getLintingErrors.ts @@ -25,6 +25,7 @@ import { IGNORED_LINT_ERRORS, lintOptions, SUPPORTED_WEB_APIS, + LINTER_TYPE, } from "../constants"; import type { getLintingErrorsProps } from "../types"; import { JSLibraries } from "workers/common/JSLibrary"; @@ -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 = {}; +function getLinterType() { + let linterType = LINTER_TYPE.JSHINT; + + const flagValues = WorkerEnv.getFeatureFlags(); + + if (flagValues?.[FEATURE_FLAG.rollout_eslint_enabled]) { + linterType = LINTER_TYPE.ESLINT; + } + + return linterType; +} + function getEvaluationScriptPosition(scriptType: EvaluationScriptType) { if (isEmpty(EvaluationScriptPositions)) { // We are computing position of <