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

Generate linting errors via JSHint #5034

Merged
merged 39 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d78b939
add linting via jshint
hetunandu May 29, 2021
882067b
Merge branch 'release' into fix/semi-colon-in-js
hetunandu May 29, 2021
b47444c
WIP
hetunandu May 31, 2021
969f5fd
Fix semi colon issues in multiline js
hetunandu May 31, 2021
cf6aad7
Merge branch 'fix/semi-colon-in-js' into feature/create-js-linting-er…
hetunandu May 31, 2021
8442490
Fix yarn lock conflict
hetunandu May 31, 2021
9b45800
Merge branch 'release' into feature/create-js-linting-errors
hetunandu Jun 1, 2021
fc4cf36
Merge branch 'release' into feature/create-js-linting-errors
hetunandu Jun 4, 2021
fda8934
Merge branch 'release' into feature/create-js-linting-errors
hetunandu Jun 7, 2021
a3941e3
Combine errors and display them
hetunandu Jun 10, 2021
417c886
Dont show lint errors right now
hetunandu Jun 11, 2021
b4dc6da
Remove unused code
hetunandu Jun 11, 2021
f04d433
Fix tests
hetunandu Jun 14, 2021
55e405f
Merge branch 'release' into feature/create-js-linting-errors
hetunandu Jun 14, 2021
4381b2b
Minor fixes
hetunandu Jun 14, 2021
270cd0a
Review fixes
hetunandu Jun 14, 2021
43cdbb9
Minor fixes
hetunandu Jun 14, 2021
c332750
Fixes for property path
hetunandu Jun 15, 2021
b01da05
Fix for list widget data tree path
hetunandu Jun 16, 2021
392a01a
Add binding success logging
hetunandu Jun 16, 2021
a9a4fa7
Remove unsued import
hetunandu Jun 16, 2021
81a2a9d
Log uneval value as well
hetunandu Jun 16, 2021
d255493
Remove logging for testing event
hetunandu Jun 17, 2021
7a84eb8
Merge branch 'release' into feature/create-js-linting-errors
hetunandu Jun 17, 2021
d6a3779
Fixing tests
hetunandu Jun 17, 2021
b14523f
Fix line break in start issue
hetunandu Jun 17, 2021
ad0387e
Probably fix cypress test
hetunandu Jun 17, 2021
a649130
Probably fix cypress test
hetunandu Jun 17, 2021
3b701c2
Update video settings
hetunandu Jun 17, 2021
e648f90
Test another time
hetunandu Jun 18, 2021
9aa631a
Merge branch 'release' into feature/create-js-linting-errors
hetunandu Jun 18, 2021
4800799
Test once more
hetunandu Jun 18, 2021
99eaa82
Remove addDsl from before clause for error prone tests
hetunandu Jun 18, 2021
0464e61
Test another hunch
hetunandu Jun 18, 2021
128feb6
Avoid update layout race condition
hetunandu Jun 18, 2021
0dd70f1
Final changes
hetunandu Jun 18, 2021
dcbadb8
Move update layout wait to a step before addDsl
hetunandu Jun 18, 2021
3250d9a
Improvements to flaky tests
hetunandu Jun 21, 2021
07dc83e
More flaky tests
hetunandu Jun 21, 2021
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
Prev Previous commit
Next Next commit
Merge branch 'release' into fix/semi-colon-in-js
# Conflicts:
#	app/client/yarn.lock
  • Loading branch information
hetunandu committed May 29, 2021
commit 882067b28de947db33568bf5f3791adab1baa6b2
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@ const commonlocators = require("../../../../locators/commonlocators.json");
const explorerlocators = require("../../../../locators/explorerlocators.json");
let duplicateApplicationDsl;

describe("Duplicate application", function() {
describe("Duplicate application", function () {
before(() => {
dsl.dsl.version = 21; // latest migrated version
cy.addDsl(dsl);
});

it("Check whether the duplicate application has the same dsl as the original", function() {
it("Check whether the duplicate application has the same dsl as the original", function () {
cy.get(commonlocators.homeIcon).click({ force: true });
const appname = localStorage.getItem("AppName");
cy.get(homePage.searchInput).type(appname);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);

cy.get(homePage.applicationCard)
.first()
.trigger("mouseover");
cy.get(homePage.appMoreIcon)
.first()
.click({ force: true });
cy.get(homePage.applicationCard).first().trigger("mouseover");
cy.get(homePage.appMoreIcon).first().click({ force: true });
cy.get(homePage.duplicateApp).click({ force: true });

cy.wait("@getPage").should(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,24 @@ const homePage = require("../../../../locators/HomePage.json");
const commonlocators = require("../../../../locators/commonlocators.json");
let forkedApplicationDsl;

describe("Fork application across orgs", function() {
describe("Fork application across orgs", function () {
before(() => {
dsl.dsl.version = 21; // latest migrated version
cy.addDsl(dsl);
});

it("Check if the forked application has the same dsl as the original", function() {
it("Check if the forked application has the same dsl as the original", function () {
cy.get(commonlocators.homeIcon).click({ force: true });
const appname = localStorage.getItem("AppName");
cy.get(homePage.searchInput).type(appname);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);

cy.get(homePage.applicationCard)
.first()
.trigger("mouseover");
cy.get(homePage.appMoreIcon)
.first()
.click({ force: true });
cy.get(homePage.applicationCard).first().trigger("mouseover");
cy.get(homePage.appMoreIcon).first().click({ force: true });
cy.get(homePage.forkAppFromMenu).click({ force: true });
// select a different org here
cy.get(homePage.forkAppOrgList)
.children()
.last()
.click({ force: true });
cy.get(homePage.forkAppOrgList).children().last().click({ force: true });
cy.get(homePage.forkAppOrgButton).click({ force: true });
cy.wait("@postForkAppOrg").then((httpResponse) => {
expect(httpResponse.status).to.equal(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const widgetsPage = require("../../../../locators/Widgets.json");
const publish = require("../../../../locators/publishWidgetspage.json");
const testdata = require("../../../../fixtures/testdata.json");

describe("aTob and bToa library tests ", function() {
describe("aTob and bToa library tests ", function () {
before(() => {
cy.addDsl(dsl);
});

it("Input widget test with default value for atob method", function() {
it("Input widget test with default value for atob method", function () {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.atobInput);
cy.get(commonlocators.editPropCrossButton).click({ force: true });
Expand All @@ -22,7 +22,7 @@ describe("aTob and bToa library tests ", function() {
);
});

it("Input widget test with default value for btoa method", function() {
it("Input widget test with default value for btoa method", function () {
cy.SearchEntityandOpen("Input2");
cy.get(widgetsPage.defaultInput).type(testdata.btoaInput);
cy.get(commonlocators.editPropCrossButton).click({ force: true });
Expand All @@ -33,7 +33,7 @@ describe("aTob and bToa library tests ", function() {
);
});

it("publish widget and validate the data displayed in input widgets value for aToB and bToa", function() {
it("publish widget and validate the data displayed in input widgets value for aToB and bToa", function () {
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input")
.first()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const widgetsPage = require("../../../../locators/Widgets.json");
const publish = require("../../../../locators/publishWidgetspage.json");
const testdata = require("../../../../fixtures/testdata.json");

describe("Loadash basic test with input Widget", function() {
describe("Loadash basic test with input Widget", function () {
before(() => {
cy.addDsl(dsl);
});

it("Input widget test with default value from another Input widget", function() {
it("Input widget test with default value from another Input widget", function () {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.defaultInputBinding);
cy.get(commonlocators.editPropCrossButton).click({ force: true });
Expand All @@ -22,7 +22,7 @@ describe("Loadash basic test with input Widget", function() {
);
});

it("Input widget test with default value for loadash function", function() {
it("Input widget test with default value for loadash function", function () {
cy.SearchEntityandOpen("Input2");
cy.get(widgetsPage.defaultInput).type(testdata.loadashInput);
cy.get(commonlocators.editPropCrossButton).click({ force: true });
Expand All @@ -33,7 +33,7 @@ describe("Loadash basic test with input Widget", function() {
);
});

it("publish widget and validate the data displayed in input widgets from loadash function", function() {
it("publish widget and validate the data displayed in input widgets from loadash function", function () {
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input")
.first()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const widgetsPage = require("../../../../locators/Widgets.json");
const publish = require("../../../../locators/publishWidgetspage.json");
const testdata = require("../../../../fixtures/testdata.json");

describe("Moment basic test with input Widget", function() {
describe("Moment basic test with input Widget", function () {
before(() => {
cy.addDsl(dsl);
});

it("Input widget test with default value from another Input widget", function() {
it("Input widget test with default value from another Input widget", function () {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.defaultInputBinding);
cy.get(commonlocators.editPropCrossButton).click({ force: true });
Expand All @@ -22,7 +22,7 @@ describe("Moment basic test with input Widget", function() {
);
});

it("Binding second input widget with first input widget and validating", function() {
it("Binding second input widget with first input widget and validating", function () {
cy.SearchEntityandOpen("Input2");
cy.get(widgetsPage.defaultInput).type(testdata.momentInput);
cy.get(commonlocators.editPropCrossButton).click({ force: true });
Expand All @@ -33,7 +33,7 @@ describe("Moment basic test with input Widget", function() {
);
});

it("publish widget and validate the data displayed in input widgets", function() {
it("publish widget and validate the data displayed in input widgets", function () {
var currentTime = new Date();
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ describe("Dynamic input autocomplete", () => {
.type("{ctrl}{shift}{downarrow}")
.then(($cm) => {
if ($cm.val() !== "") {
cy.get(dynamicInputLocators.input)
.first()
.clear({
force: true,
});
}

cy.get(dynamicInputLocators.input)
.first()
.type("{{", {
cy.get(dynamicInputLocators.input).first().clear({
force: true,
parseSpecialCharSequences: false,
});
}

cy.get(dynamicInputLocators.input).first().type("{{", {
force: true,
parseSpecialCharSequences: false,
});

// Tests if autocomplete will open
cy.get(dynamicInputLocators.hints).should("exist");
Expand Down Expand Up @@ -57,17 +53,13 @@ describe("Dynamic input autocomplete", () => {
it("opens current value popup", () => {
// Test on widgets pane
cy.openPropertyPane("buttonwidget");
cy.get(dynamicInputLocators.input)
.first()
.focus();
cy.get(dynamicInputLocators.input).first().focus();
cy.assertEvaluatedValuePopup("string");
// Test on api pane
cy.NavigateToAPI_Panel();
cy.get(apiwidget.createapi).click({ force: true });
cy.wait("@createNewApi");
cy.xpath(apiwidget.headerValue)
.first()
.focus();
cy.xpath(apiwidget.headerValue).first().focus();
cy.assertEvaluatedValuePopup("string");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ const StyledContainerComponent = styled.div<
cursor: ${(props) => (props.onClickCapture ? "pointer" : "inherit")};
background: ${(props) =>
props.onClickCapture
? tinycolor(props.backgroundColor)
.darken(5)
.toString()
? tinycolor(props.backgroundColor).darken(5).toString()
: props.backgroundColor};
}
}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ export function PositionedContainer(props: PositionedContainerProps) {
return (
generateClassName(props.widgetId) +
" positioned-widget " +
`t--widget-${props.widgetType
.split("_")
.join("")
.toLowerCase()}`
`t--widget-${props.widgetType.split("_").join("").toLowerCase()}`
);
}, [props.widgetType, props.widgetId]);
const containerStyle: CSSProperties = useMemo(() => {
Expand All @@ -52,10 +49,10 @@ export function PositionedContainer(props: PositionedContainerProps) {
};
}, [props.style]);

const openPropPane = useCallback((e) => openPropertyPane(e, props.widgetId), [
props.widgetId,
openPropertyPane,
]);
const openPropPane = useCallback(
(e) => openPropertyPane(e, props.widgetId),
[props.widgetId, openPropertyPane],
);

return (
<PositionedWidget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,8 @@ class CodeEditor extends Component<Props, State> {
theme,
useValidationMessage,
} = this.props;
const {
isValid,
jsErrorMessage,
validationMessage,
} = this.getPropertyValidation(dynamicData, dataTreePath);
const { isValid, jsErrorMessage, validationMessage } =
this.getPropertyValidation(dynamicData, dataTreePath);
const hasError = !isValid || !!jsErrorMessage;
let evaluated = evaluatedValue;
if (dataTreePath) {
Expand Down
6 changes: 4 additions & 2 deletions app/client/src/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ export const ReduxActionTypes: { [key: string]: string } = {
UPDATE_API_ACTION_BODY_CONTENT_TYPE: "UPDATE_API_ACTION_BODY_CONTENT_TYPE",
};

export type ReduxActionType = typeof ReduxActionTypes[keyof typeof ReduxActionTypes];
export type ReduxActionType =
typeof ReduxActionTypes[keyof typeof ReduxActionTypes];

export const ReduxActionErrorTypes: { [key: string]: string } = {
INITIALIZE_APPSMITH_ERROR: "INITIALIZE_APPSMITH_ERROR",
Expand Down Expand Up @@ -545,7 +546,8 @@ export const ReduxFormActionTypes: { [key: string]: string } = {
ARRAY_PUSH: "@@redux-form/ARRAY_PUSH",
};

export type ReduxActionErrorType = typeof ReduxActionErrorTypes[keyof typeof ReduxActionErrorTypes];
export type ReduxActionErrorType =
typeof ReduxActionErrorTypes[keyof typeof ReduxActionErrorTypes];

export interface ReduxAction<T> {
type: ReduxActionType | ReduxActionErrorType;
Expand Down
6 changes: 2 additions & 4 deletions app/client/src/pages/Editor/APIEditor/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,8 @@ function ImportedHeaders(props: { headers: any }) {
function ApiEditorForm(props: Props) {
const [selectedIndex, setSelectedIndex] = useState(0);
const [showDatasources, toggleDatasources] = useState(false);
const [
apiBindHelpSectionVisible,
setApiBindHelpSectionVisible,
] = useLocalStorage("apiBindHelpSectionVisible", "true");
const [apiBindHelpSectionVisible, setApiBindHelpSectionVisible] =
useLocalStorage("apiBindHelpSectionVisible", "true");

const {
actionConfigurationHeaders,
Expand Down
14 changes: 6 additions & 8 deletions app/client/src/utils/WidgetPropsUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,16 +403,14 @@ export function migrateTabsData(currentDSL: ContainerWidgetProps<WidgetProps>) {
...dynamicBindablePropsList,
];
}
currentDSL.dynamicPropertyPathList = currentDSL.dynamicPropertyPathList.filter(
(each) => {
currentDSL.dynamicPropertyPathList =
currentDSL.dynamicPropertyPathList.filter((each) => {
return each.key !== "tabs";
},
);
currentDSL.dynamicBindingPathList = currentDSL.dynamicBindingPathList.filter(
(each) => {
});
currentDSL.dynamicBindingPathList =
currentDSL.dynamicBindingPathList.filter((each) => {
return each.key !== "tabs";
},
);
});
currentDSL.tabsObj = currentDSL.tabs.reduce(
(obj: any, tab: any, index: number) => {
obj = {
Expand Down
8 changes: 4 additions & 4 deletions app/client/src/utils/autocomplete/TernServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class TernServer {
},
],
},
function(error: Error) {
function (error: Error) {
if (error) window.console.error(error);
else doc.changed = null;
},
Expand Down Expand Up @@ -624,10 +624,10 @@ class TernServer {
};
let mouseOnTip = false;
let old = false;
CodeMirror.on(tip, "mousemove", function() {
CodeMirror.on(tip, "mousemove", function () {
mouseOnTip = true;
});
CodeMirror.on(tip, "mouseout", function(e: MouseEvent) {
CodeMirror.on(tip, "mouseout", function (e: MouseEvent) {
const related = e.relatedTarget;
// @ts-ignore: No types available
if (!related || !CodeMirror.contains(tip, related)) {
Expand All @@ -647,7 +647,7 @@ class TernServer {
cm.on("blur", f);
cm.on("scroll", f);
cm.on("setDoc", f);
return function() {
return function () {
cm.off("cursorActivity", f);
cm.off("blur", f);
cm.off("scroll", f);
Expand Down
5 changes: 3 additions & 2 deletions app/client/src/widgets/BaseWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { flattenObject } from "utils/helpers";

abstract class BaseWidget<
T extends WidgetProps,
K extends WidgetState
K extends WidgetState,
> extends Component<T, K> {
static contextType = EditorContext;

Expand Down Expand Up @@ -473,6 +473,7 @@ export const WidgetOperations = {
ADD_CHILDREN: "ADD_CHILDREN",
};

export type WidgetOperation = typeof WidgetOperations[keyof typeof WidgetOperations];
export type WidgetOperation =
typeof WidgetOperations[keyof typeof WidgetOperations];

export default BaseWidget;
16 changes: 7 additions & 9 deletions app/client/src/widgets/ListWidget/ListWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,8 @@ class ListWidget extends BaseWidget<ListWidgetProps<WidgetProps>, WidgetState> {
};

updateTemplateWidgetProperties = (widget: WidgetProps, itemIndex: number) => {
const {
dynamicBindingPathList,
dynamicTriggerPathList,
template,
} = this.props;
const { dynamicBindingPathList, dynamicTriggerPathList, template } =
this.props;
const { widgetName = "" } = widget;
// Update properties if they're dynamic
// `template` property should have an array of values
Expand Down Expand Up @@ -376,10 +373,11 @@ class ListWidget extends BaseWidget<ListWidgetProps<WidgetProps>, WidgetState> {
"children[0]",
);
// Set properties of the container's canvas child widget
const updatedListItemContainerCanvas = this.updateNonTemplateWidgetProperties(
listItemContainerCanvas,
listItemIndex,
);
const updatedListItemContainerCanvas =
this.updateNonTemplateWidgetProperties(
listItemContainerCanvas,
listItemIndex,
);
// Set the item container's canvas child widget
set(
updatedListItemContainer,
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.