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

chore: update logic to calculate length of lint #36548

Draft
wants to merge 27 commits into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
11c88a6
create: feature flag for eslint migration
ayushpahwa Sep 25, 2024
8c4ad0f
update: enum for linter engines
ayushpahwa Sep 25, 2024
8cc1c36
update: refactored if check logic
ayushpahwa Sep 25, 2024
35c9441
update: remove const from enum declaration
ayushpahwa Sep 25, 2024
3ff9c9e
create: type added for lint length
ayushpahwa Sep 25, 2024
77ef464
update: logic added to skip lint length calculation
ayushpahwa Sep 25, 2024
bba3989
Merge branch 'release' into feat/eslint/feature-flag
ayushpahwa Sep 28, 2024
5c3c434
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Sep 28, 2024
7ab0717
Merge branch 'release' into feat/eslint/feature-flag
ayushpahwa Sep 30, 2024
5579787
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Sep 30, 2024
1298a8f
Merge branch 'release' into feat/eslint/feature-flag
ayushpahwa Oct 9, 2024
206db12
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Oct 9, 2024
9e1a65b
Merge branch 'release' into feat/eslint/feature-flag
ayushpahwa Oct 14, 2024
d84b7b1
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Oct 14, 2024
64d4272
Merge branch 'release' into feat/eslint/feature-flag
ayushpahwa Nov 6, 2024
40b0c85
Merge branch 'release' into feat/eslint/feature-flag
ayushpahwa Nov 11, 2024
34b638b
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Nov 11, 2024
18afebc
update: sync with release
ayushpahwa Nov 11, 2024
a03edc2
update: refactor var name
ayushpahwa Nov 11, 2024
23649ca
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Nov 11, 2024
03e97dd
Merge branch 'release' into feat/eslint/feature-flag
ayushpahwa Nov 12, 2024
254f465
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Nov 12, 2024
00d8519
update: refactored variable name
ayushpahwa Nov 12, 2024
43b4ef2
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Nov 12, 2024
ac773e1
update: refactor var name
ayushpahwa Nov 12, 2024
7c35991
Merge branch 'feat/eslint/feature-flag' into feat/eslint/lint-length-…
ayushpahwa Nov 12, 2024
0919825
Merge branch 'release' into feat/eslint/lint-length-processing
ayushpahwa Nov 14, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const getLintAnnotations = (
code,
errorMessage,
line,
lintLength,
originalBinding,
severity,
variables,
Expand All @@ -157,16 +158,20 @@ export const getLintAnnotations = (
});
}

let variableLength = 1;
let calculatedLintLength = 1;

// If lint length is provided, then skip the length calculation logic
if (lintLength && lintLength > 0) {
calculatedLintLength = lintLength;
}
// Find the variable with minimal length
if (variables) {
else if (variables) {
for (const variable of variables) {
if (variable) {
variableLength =
variableLength === 1
calculatedLintLength =
calculatedLintLength === 1
? String(variable).length
: Math.min(String(variable).length, variableLength);
: Math.min(String(variable).length, calculatedLintLength);
}
}
}
Expand Down Expand Up @@ -205,7 +210,7 @@ export const getLintAnnotations = (
};
const to = {
line: from.line,
ch: from.ch + variableLength,
ch: from.ch + calculatedLintLength,
};

annotations.push({
Expand Down
1 change: 1 addition & 0 deletions app/client/src/utils/DynamicBindingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ export interface LintError extends DataTreeError {
line: number;
ch: number;
originalPath?: string;
lintLength?: number;
}

export interface DataTreeEvaluationProps {
Expand Down
Loading