PromucFlow_constructor/app/client/packages/ast/index.ts
Rishabh Rathod b863b39d69
feat: Add linting error for assignment expression (#25140)
## Description


This change adds a linting error for direct mutation of widget property
like `Widget.property = "dsf"` and instead suggests to use setter
methods.


#### PR fixes following issue(s)
Fixes #5822


#### Type of change

- New feature (non-breaking change which adds functionality)

## Testing

- [x] Add jest tests as mentioned in the
[comments](https://www.notion.so/appsmith/Widget-Property-Setters-Tech-Spec-2a34730e2e6d4df8ae7637c363b1096c?pvs=4#276554d9875b42d68868aa969e9d7d03)
of the tech spec document for this project.
- [x] Add test to verify linting error for widget assignment
- [x] Add cypress test for autocomplete of more setter methods 
- [x] Add cypress test for currencyInput setValue 

#### How Has This Been Tested?

- [ ] Manual
- [ ] Jest
- [x] Cypress

#### Test Plan

#### Issues raised during DP testing

## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [x] Cypress test cases have been added and approved by SDET/manual QA
- [x] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

---------

Co-authored-by: Druthi Polisetty <druthi@appsmith.com>
2023-07-24 12:23:45 +05:30

137 lines
3.1 KiB
TypeScript

import type {
ObjectExpression,
PropertyNode,
MemberExpressionData,
IdentifierInfo,
AssignmentExpressionData,
} from "./src";
import {
isIdentifierNode,
isVariableDeclarator,
isObjectExpression,
isLiteralNode,
isPropertyNode,
isPropertyAFunctionNode,
isCallExpressionNode,
getAST,
extractIdentifierInfoFromCode,
entityRefactorFromCode,
extractExpressionsFromCode,
getFunctionalParamsFromNode,
isTypeOfFunction,
isFunctionPresent,
} from "./src";
// constants
import { ECMA_VERSION, SourceType, NodeTypes } from "./src/constants";
// JSObjects
import type {
TParsedJSProperty,
JSPropertyPosition,
JSVarProperty,
JSFunctionProperty,
} from "./src/jsObject";
import { parseJSObject, isJSFunctionProperty } from "./src/jsObject";
// action creator
import {
getTextArgumentAtPosition,
setTextArgumentAtPosition,
getEnumArgumentAtPosition,
setEnumArgumentAtPosition,
getModalName,
setModalName,
getFuncExpressionAtPosition,
getFunction,
replaceActionInQuery,
setCallbackFunctionField,
getActionBlocks,
getFunctionBodyStatements,
getMainAction,
getFunctionName,
setObjectAtPosition,
getThenCatchBlocksFromQuery,
setThenBlockInQuery,
setCatchBlockInQuery,
getFunctionArguments,
getFunctionNameFromJsObjectExpression,
getCallExpressions,
canTranslateToUI,
getFunctionParams,
getQueryParam,
setQueryParam,
checkIfCatchBlockExists,
checkIfThenBlockExists,
checkIfArgumentExistAtPosition,
} from "./src/actionCreator";
// peekOverlay
import type { PeekOverlayExpressionIdentifierOptions } from "./src/peekOverlay";
import { PeekOverlayExpressionIdentifier } from "./src/peekOverlay";
// types or interfaces should be exported with type keyword, while enums can be exported like normal functions
export type {
ObjectExpression,
PropertyNode,
MemberExpressionData,
IdentifierInfo,
TParsedJSProperty,
JSPropertyPosition,
PeekOverlayExpressionIdentifierOptions,
AssignmentExpressionData,
JSVarProperty,
JSFunctionProperty,
};
export {
isIdentifierNode,
isVariableDeclarator,
isObjectExpression,
isLiteralNode,
isPropertyNode,
isPropertyAFunctionNode,
isCallExpressionNode,
getAST,
extractIdentifierInfoFromCode,
entityRefactorFromCode,
extractExpressionsFromCode,
getFunctionalParamsFromNode,
isTypeOfFunction,
parseJSObject,
ECMA_VERSION,
SourceType,
NodeTypes,
getTextArgumentAtPosition,
getEnumArgumentAtPosition,
getModalName,
setModalName,
setTextArgumentAtPosition,
setEnumArgumentAtPosition,
getFuncExpressionAtPosition,
getFunction,
replaceActionInQuery,
setCallbackFunctionField,
getActionBlocks,
getFunctionBodyStatements,
getMainAction,
getFunctionName,
setObjectAtPosition,
getThenCatchBlocksFromQuery,
setThenBlockInQuery,
setCatchBlockInQuery,
getFunctionArguments,
getFunctionNameFromJsObjectExpression,
getCallExpressions,
canTranslateToUI,
getFunctionParams,
getQueryParam,
setQueryParam,
checkIfThenBlockExists,
checkIfCatchBlockExists,
checkIfArgumentExistAtPosition,
isJSFunctionProperty,
isFunctionPresent,
PeekOverlayExpressionIdentifier,
};