2022-09-16 14:20:29 +00:00
export const originalDSLForDSLMigrations = {
widgetName : "MainContainer" ,
backgroundColor : "none" ,
rightColumn : 450 ,
snapColumns : 64 ,
detachFromLayout : true ,
widgetId : "0" ,
topRow : 0 ,
bottomRow : 840 ,
containerStyle : "none" ,
snapRows : 89 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : true ,
version : undefined ,
minHeight : 780 ,
parentColumnSpace : 1 ,
dynamicBindingPathList : [ ] ,
leftColumn : 0 ,
children : [
{
boxShadow : "{{appsmith.theme.boxShadow.appBoxShadow}}" ,
widgetName : "Container1" ,
borderColor : "transparent" ,
isCanvas : true ,
dynamicPropertyPathList : [
{
key : "borderRadius" ,
} ,
] ,
displayName : "Container" ,
iconSVG : "/static/media/icon.1977dca3.svg" ,
topRow : 0 ,
bottomRow : 6 ,
parentRowSpace : 10 ,
type : "CONTAINER_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.84375 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "backgroundColor" ,
} ,
{
key : "boxShadow" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
children : [
{
boxShadow : "none" ,
widgetName : "Canvas1" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 390 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
minHeight : 400 ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Text1" ,
dynamicPropertyPathList : [ ] ,
displayName : "Text" ,
iconSVG : "/static/media/icon.97c59b52.svg" ,
topRow : 0 ,
bottomRow : 4 ,
parentRowSpace : 10 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
parentColumnSpace : 6.53125 ,
dynamicTriggerPathList : [ ] ,
fontFamily : "Montserrat" ,
leftColumn : 7 ,
dynamicBindingPathList : [ ] ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
text : "Employee Time Tracker" ,
key : "s3ajdid629" ,
labelTextSize : "0.875rem" ,
rightColumn : 55 ,
textAlign : "LEFT" ,
widgetId : "xw0918rbsp" ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "#fff" ,
version : 1 ,
parentId : "22al9skq4c" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "1.25rem" ,
} ,
{
boxShadow : "none" ,
widgetName : "IconButton8" ,
buttonColor : "#fff" ,
displayName : "Icon Button" ,
iconSVG :
"/static/media/icon.1a0c634ac75f9fa6b6ae7a8df882a3ba.svg" ,
searchTags : [ "click" , "submit" ] ,
topRow : 0 ,
bottomRow : 4 ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.53125 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 2 ,
dynamicBindingPathList : [
{
key : "borderRadius" ,
} ,
] ,
isDisabled : false ,
key : "2my0dvhc2p" ,
isDeprecated : false ,
rightColumn : 7 ,
iconName : "time" ,
widgetId : "df7pyl6z5m" ,
isVisible : true ,
version : 1 ,
parentId : "22al9skq4c" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "TERTIARY" ,
} ,
] ,
key : "53ftpwo2aq" ,
labelTextSize : "0.875rem" ,
rightColumn : 164.25 ,
detachFromLayout : true ,
widgetId : "22al9skq4c" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "og1bsi36p4" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
] ,
borderWidth : "0" ,
key : "a4gmk81297" ,
labelTextSize : "0.875rem" ,
backgroundColor : "{{appsmith.theme.colors.primaryColor}}" ,
rightColumn : 64 ,
widgetId : "og1bsi36p4" ,
containerStyle : "card" ,
isVisible : true ,
version : 1 ,
parentId : "0" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
{
boxShadow : "{{appsmith.theme.boxShadow.appBoxShadow}}" ,
widgetName : "Container1Copy" ,
borderColor : "transparent" ,
isCanvas : true ,
dynamicPropertyPathList : [ ] ,
displayName : "Container" ,
iconSVG : "/static/media/icon.1977dca3.svg" ,
topRow : 6 ,
bottomRow : 82 ,
parentRowSpace : 10 ,
type : "CONTAINER_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.84375 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "boxShadow" ,
} ,
] ,
children : [
{
boxShadow : "none" ,
widgetName : "Canvas1Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 730 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
minHeight : 400 ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Tabs1" ,
isCanvas : true ,
displayName : "Tabs" ,
iconSVG : "/static/media/icon.74a6d653.svg" ,
topRow : 5 ,
bottomRow : 71 ,
parentRowSpace : 10 ,
type : "TABS_WIDGET" ,
hideCard : false ,
shouldScrollContents : false ,
animateLoading : true ,
parentColumnSpace : 6.53125 ,
dynamicTriggerPathList : [
{
key : "onTabSelected" ,
} ,
] ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "defaultTab" ,
} ,
] ,
children : [
{
tabId : "tab1" ,
boxShadow : "none" ,
widgetName : "Canvas2" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 610 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : true ,
hideCard : true ,
shouldScrollContents : false ,
minHeight : 400 ,
parentColumnSpace : 1 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Text7" ,
dynamicPropertyPathList : [ ] ,
displayName : "Text" ,
iconSVG : "/static/media/icon.97c59b52.svg" ,
topRow : 1 ,
bottomRow : 6 ,
parentRowSpace : 10 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
leftColumn : 9 ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
] ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
text : "{{lst_user.selectedItem.name}}" ,
key : "e6of5n4o7o" ,
labelTextSize : "0.875rem" ,
rightColumn : 45 ,
textAlign : "LEFT" ,
widgetId : "lzn17wpnmn" ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "{{appsmith.theme.colors.primaryColor}}" ,
version : 1 ,
parentId : "z05jlsrkmt" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "1.25rem" ,
} ,
{
boxShadow : "none" ,
widgetName : "Image2" ,
displayName : "Image" ,
iconSVG :
"/static/media/icon.52d8fb963abcb95c79b10f1553389f22.svg" ,
topRow : 1 ,
bottomRow : 6 ,
parentRowSpace : 10 ,
type : "IMAGE_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.84375 ,
dynamicTriggerPathList : [ ] ,
imageShape : "RECTANGLE" ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "image" ,
} ,
] ,
defaultImage :
"https://assets.appsmith.com/widgets/default.png" ,
key : "52v1r95ynr" ,
image : "{{lst_user.selectedItem.image}}" ,
isDeprecated : false ,
rightColumn : 9 ,
objectFit : "contain" ,
widgetId : "e2whboroyt" ,
isVisible : true ,
version : 1 ,
parentId : "z05jlsrkmt" ,
renderMode : "CANVAS" ,
isLoading : false ,
maxZoomLevel : 1 ,
enableDownload : false ,
borderRadius : "0px" ,
enableRotation : false ,
} ,
{
resetFormOnClick : false ,
boxShadow : "none" ,
widgetName : "Button4" ,
onClick : "{{JSObject1.onClick()}}" ,
buttonColor : "{{appsmith.theme.colors.primaryColor}}" ,
displayName : "Button" ,
iconSVG :
"/static/media/icon.cca026338f1c8eb6df8ba03d084c2fca.svg" ,
searchTags : [ "click" , "submit" ] ,
topRow : 1 ,
bottomRow : 6 ,
parentRowSpace : 10 ,
type : "BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 45 ,
dynamicBindingPathList : [
{
key : "buttonColor" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
text : "Clock In" ,
isDisabled : false ,
key : "y8fmp30elx" ,
isDeprecated : false ,
rightColumn : 63 ,
isDefaultClickDisabled : true ,
widgetId : "eljn3wfgac" ,
isVisible : true ,
recaptchaType : "V3" ,
version : 1 ,
parentId : "z05jlsrkmt" ,
renderMode : "CANVAS" ,
isLoading : false ,
disabledWhenInvalid : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "SECONDARY" ,
placement : "CENTER" ,
} ,
{
template : {
IconButton2 : {
boxShadow : "NONE" ,
widgetName : "IconButton2" ,
buttonColor : "#2E3D49" ,
displayName : "Icon Button" ,
iconSVG : "/static/media/icon.1a0c634a.svg" ,
topRow : 5 ,
bottomRow : 9 ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 5.5869140625 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 55 ,
dynamicBindingPathList : [ ] ,
isDisabled : false ,
key : "qu8lf50ktl" ,
rightColumn : 64 ,
iconName : "time" ,
widgetId : "adfuulfvjx" ,
logBlackList : {
isVisible : true ,
iconName : true ,
borderRadius : true ,
boxShadow : true ,
buttonColor : true ,
buttonVariant : true ,
isDisabled : true ,
widgetName : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
version : 1 ,
parentId : "snzcjlyy9x" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "CIRCLE" ,
buttonVariant : "TERTIARY" ,
onClick : "{{JSObject1.clockout()}}" ,
} ,
btn_clockout : {
groupButtons : {
groupButton1 : {
onClick : "{{JSObject1.clockout()}}" ,
} ,
} ,
borderRadius :
"{{List1.listData.map((currentItem, currentIndex) => {\n return (function(){\n return 'ROUNDED';\n })();\n })}}" ,
boxShadow :
"{{List1.listData.map((currentItem, currentIndex) => {\n return (function(){\n return 'NONE';\n })();\n })}}" ,
buttonVariant :
"{{List1.listData.map((currentItem, currentIndex) => {\n return (function(){\n return 'SECONDARY';\n })();\n })}}" ,
} ,
Text3CopyCopy : {
boxShadow : "none" ,
widgetName : "Text3CopyCopy" ,
dynamicPropertyPathList : [
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG : "/static/media/icon.97c59b52.svg" ,
topRow : 0 ,
bottomRow : 5 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
] ,
leftColumn : 38 ,
shouldTruncate : false ,
borderWidth : "" ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{List1.listData.map((currentItem) => JSObject1.diffHrsMins(currentItem.time_start, currentItem.time_end))}}" ,
2022-09-16 14:20:29 +00:00
key : "s3ajdid629" ,
labelTextSize : "0.875rem" ,
rightColumn : 64 ,
backgroundColor : "transparent" ,
textAlign : "RIGHT" ,
widgetId : "j2qem8c0ac" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "{{appsmith.theme.colors.primaryColor}}" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "1.5rem" ,
textStyle : "BODY" ,
} ,
Text3Copy1 : {
boxShadow : "none" ,
widgetName : "Text3Copy1" ,
dynamicPropertyPathList : [
{
key : "textColor" ,
} ,
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG : "/static/media/icon.97c59b52.svg" ,
topRow : 5 ,
bottomRow : 10 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
] ,
leftColumn : 0 ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{List1.listData.map((currentItem) => JSObject1.timeDisplay(\ncurrentItem.time_start,\ncurrentItem.time_end))}}" ,
2022-09-16 14:20:29 +00:00
key : "s3ajdid629" ,
labelTextSize : "0.875rem" ,
rightColumn : 33 ,
textAlign : "LEFT" ,
widgetId : "xlxxn7mjer" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "" ,
textColor :
"{{List1.listData.map((currentItem) => currentItem.time_end ? 'black' : 'green')}}" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "0.75rem" ,
textStyle : "BODY" ,
} ,
IconButton3Copy : {
boxShadow : "none" ,
widgetName : "IconButton3Copy" ,
onClick :
"{{delTimeLog.run(() => getTimeLogs.run(), () => {})}}" ,
buttonColor : "#FF5858" ,
dynamicPropertyPathList : [
{
key : "borderRadius" ,
} ,
] ,
displayName : "Icon Button" ,
iconSVG : "/static/media/icon.1a0c634a.svg" ,
topRow : 5 ,
bottomRow : 10 ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 5.5869140625 ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 56 ,
dynamicBindingPathList : [
{
key : "borderRadius" ,
} ,
] ,
isDisabled : false ,
key : "qu8lf50ktl" ,
labelTextSize : "0.875rem" ,
rightColumn : 64 ,
iconName : "trash" ,
widgetId : "hbveofpr91" ,
logBlackList : {
isVisible : true ,
iconName : true ,
borderRadius : true ,
boxShadow : true ,
buttonColor : true ,
buttonVariant : true ,
isDisabled : true ,
widgetName : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "SECONDARY" ,
} ,
Text2Copy : {
boxShadow : "none" ,
widgetName : "Text2Copy" ,
dynamicPropertyPathList : [
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG : "/static/media/icon.97c59b52.svg" ,
topRow : 0 ,
bottomRow : 5 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
] ,
leftColumn : 0 ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{List1.listData.map((currentItem) => 'Task: ' + currentItem.task)}}" ,
2022-09-16 14:20:29 +00:00
key : "s3ajdid629" ,
labelTextSize : "0.875rem" ,
rightColumn : 22 ,
textAlign : "LEFT" ,
widgetId : "1iy9e9hnnq" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "#231F20" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "1.125rem" ,
textStyle : "HEADING" ,
} ,
Button3Copy : {
boxShadow : "none" ,
widgetName : "Button3Copy" ,
onClick : "{{JSObject1.clockout()}}" ,
buttonColor : "{{appsmith.theme.colors.primaryColor}}" ,
dynamicPropertyPathList : [
{
key : "isDisabled" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
displayName : "Button" ,
iconSVG : "/static/media/icon.cca02633.svg" ,
topRow : 5 ,
bottomRow : 10 ,
parentRowSpace : 10 ,
type : "BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 5.78125 ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 37 ,
dynamicBindingPathList : [
{
key : "isDisabled" ,
} ,
{
key : "buttonColor" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
text : "Clock Out" ,
isDisabled :
"{{List1.listData.map((currentItem) => currentItem.time_end !== null)}}" ,
key : "6mxrybslxf" ,
labelTextSize : "0.875rem" ,
rightColumn : 56 ,
isDefaultClickDisabled : true ,
widgetId : "690l18wovc" ,
logBlackList : {
isVisible : true ,
animateLoading : true ,
text : true ,
buttonColor : true ,
buttonVariant : true ,
placement : true ,
widgetName : true ,
isDisabled : true ,
isDefaultClickDisabled : true ,
recaptchaType : true ,
version : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
recaptchaType : "V3" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "PRIMARY" ,
iconAlign : "left" ,
placement : "CENTER" ,
} ,
Canvas5Copy : {
boxShadow : "none" ,
widgetName : "Canvas5Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 390 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
dropDisabled : true ,
openParentPropertyPane : true ,
minHeight : 400 ,
noPad : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [ "szq2vx6r6m" ] ,
key : "ir2wg4nsvm" ,
labelTextSize : "0.875rem" ,
rightColumn : 149.25 ,
detachFromLayout : true ,
widgetId : "3vja4gvycq" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "zismwyzhny" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
Container2Copy : {
boxShadow : "none" ,
widgetName : "Container2Copy" ,
borderColor : "transparent" ,
disallowCopy : true ,
isCanvas : true ,
dynamicPropertyPathList : [
{
key : "borderRadius" ,
} ,
] ,
displayName : "Container" ,
iconSVG : "/static/media/icon.1977dca3.svg" ,
topRow : 0 ,
bottomRow : 13 ,
dragDisabled : true ,
type : "CONTAINER_WIDGET" ,
hideCard : false ,
openParentPropertyPane : true ,
isDeletable : false ,
animateLoading : true ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [ "y3jz5nm8of" ] ,
borderWidth : "0" ,
key : "lpcgapoau4" ,
disablePropertyPane : true ,
labelTextSize : "0.875rem" ,
backgroundColor : "white" ,
rightColumn : 64 ,
widgetId : "szq2vx6r6m" ,
containerStyle : "card" ,
isVisible : true ,
version : 1 ,
parentId : "3vja4gvycq" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
Canvas6Copy : {
boxShadow : "none" ,
widgetName : "Canvas6Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 370 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
"1iy9e9hnnq" ,
"hbveofpr91" ,
"xlxxn7mjer" ,
"j2qem8c0ac" ,
"690l18wovc" ,
] ,
key : "ir2wg4nsvm" ,
labelTextSize : "0.875rem" ,
detachFromLayout : true ,
widgetId : "y3jz5nm8of" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "szq2vx6r6m" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
} ,
boxShadow : "{{appsmith.theme.boxShadow.appBoxShadow}}" ,
widgetName : "List1" ,
listData : "{{getTimeLogs.data.reverse()}}" ,
isCanvas : true ,
dynamicPropertyPathList : [
{
key : "isVisible" ,
} ,
] ,
displayName : "List" ,
iconSVG : "/static/media/icon.9925ee17.svg" ,
topRow : 6 ,
bottomRow : 59 ,
parentRowSpace : 10 ,
onPageChange :
'{{getTimeLogs.run(() => resetWidget("List1",true), () => {})}}' ,
type : "LIST_WIDGET" ,
hideCard : false ,
gridGap : 0 ,
animateLoading : true ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [
{
key : "template.IconButton3Copy.onClick" ,
} ,
{
key : "template.Button3Copy.onClick" ,
} ,
{
key : "onPageChange" ,
} ,
] ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "listData" ,
} ,
{
key : "isVisible" ,
} ,
{
key : "boxShadow" ,
} ,
{
key : "template.Button3Copy.buttonColor" ,
} ,
{
key : "template.Button3Copy.borderRadius" ,
} ,
{
key : "template.IconButton3Copy.borderRadius" ,
} ,
{
key : "template.Text2Copy.text" ,
} ,
{
key : "template.Text3Copy1.text" ,
} ,
{
key : "template.Text3Copy1.textColor" ,
} ,
{
key : "template.Text3CopyCopy.text" ,
} ,
{
key : "template.Button3Copy.isDisabled" ,
} ,
] ,
gridType : "vertical" ,
enhancements : true ,
children : [
{
boxShadow : "none" ,
widgetName : "Canvas5Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 390 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
dropDisabled : true ,
openParentPropertyPane : true ,
minHeight : 400 ,
noPad : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Container2Copy" ,
borderColor : "transparent" ,
disallowCopy : true ,
isCanvas : true ,
dynamicPropertyPathList : [
{
key : "borderRadius" ,
} ,
] ,
displayName : "Container" ,
iconSVG : "/static/media/icon.1977dca3.svg" ,
topRow : 0 ,
bottomRow : 11 ,
dragDisabled : true ,
type : "CONTAINER_WIDGET" ,
hideCard : false ,
openParentPropertyPane : true ,
isDeletable : false ,
animateLoading : true ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Canvas6Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 370 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Text2Copy" ,
dynamicPropertyPathList : [
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b52.svg" ,
topRow : 0 ,
bottomRow : 4 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
] ,
leftColumn : 0 ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
text : "Task: {{currentItem.task}}" ,
key : "s3ajdid629" ,
labelTextSize : "0.875rem" ,
rightColumn : 22 ,
textAlign : "LEFT" ,
widgetId : "1iy9e9hnnq" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "#231F20" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "1.125rem" ,
textStyle : "HEADING" ,
} ,
{
boxShadow : "none" ,
widgetName : "IconButton3Copy" ,
onClick :
"{{delTimeLog.run(() => getTimeLogs.run(), () => {})}}" ,
buttonColor : "#FF5858" ,
dynamicPropertyPathList : [
{
key : "borderRadius" ,
} ,
] ,
displayName : "Icon Button" ,
iconSVG :
"/static/media/icon.1a0c634a.svg" ,
topRow : 4 ,
bottomRow : 9 ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 5.5869140625 ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 56 ,
dynamicBindingPathList : [
{
key : "borderRadius" ,
} ,
] ,
isDisabled : false ,
key : "qu8lf50ktl" ,
labelTextSize : "0.875rem" ,
rightColumn : 64 ,
iconName : "trash" ,
widgetId : "hbveofpr91" ,
logBlackList : {
isVisible : true ,
iconName : true ,
borderRadius : true ,
boxShadow : true ,
buttonColor : true ,
buttonVariant : true ,
isDisabled : true ,
widgetName : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "SECONDARY" ,
} ,
{
boxShadow : "none" ,
widgetName : "Text3Copy1" ,
dynamicPropertyPathList : [
{
key : "textColor" ,
} ,
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b52.svg" ,
topRow : 4 ,
bottomRow : 9 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
] ,
leftColumn : 0 ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{JSObject1.timeDisplay(\ncurrentItem.time_start,\ncurrentItem.time_end)}}" ,
2022-09-16 14:20:29 +00:00
key : "s3ajdid629" ,
labelTextSize : "0.875rem" ,
rightColumn : 33 ,
textAlign : "LEFT" ,
widgetId : "xlxxn7mjer" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "" ,
textColor :
"{{currentItem.time_end ? 'black' : 'green'}}" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "0.75rem" ,
textStyle : "BODY" ,
} ,
{
boxShadow : "none" ,
widgetName : "Text3CopyCopy" ,
dynamicPropertyPathList : [
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b52.svg" ,
topRow : 0 ,
bottomRow : 4 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
] ,
leftColumn : 38 ,
shouldTruncate : false ,
borderWidth : "" ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{JSObject1.diffHrsMins(currentItem.time_start, currentItem.time_end)}}" ,
2022-09-16 14:20:29 +00:00
key : "s3ajdid629" ,
labelTextSize : "0.875rem" ,
rightColumn : 64 ,
backgroundColor : "transparent" ,
textAlign : "RIGHT" ,
widgetId : "j2qem8c0ac" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor :
"{{appsmith.theme.colors.primaryColor}}" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "1.5rem" ,
textStyle : "BODY" ,
} ,
{
boxShadow : "none" ,
widgetName : "Button3Copy" ,
onClick : "{{JSObject1.clockout()}}" ,
buttonColor :
"{{appsmith.theme.colors.primaryColor}}" ,
dynamicPropertyPathList : [
{
key : "isDisabled" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
displayName : "Button" ,
iconSVG :
"/static/media/icon.cca02633.svg" ,
topRow : 4 ,
bottomRow : 9 ,
parentRowSpace : 10 ,
type : "BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 5.78125 ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 37 ,
dynamicBindingPathList : [
{
key : "isDisabled" ,
} ,
{
key : "buttonColor" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
text : "Clock Out" ,
isDisabled :
"{{currentItem.time_end !== null}}" ,
key : "6mxrybslxf" ,
labelTextSize : "0.875rem" ,
rightColumn : 56 ,
isDefaultClickDisabled : true ,
widgetId : "690l18wovc" ,
logBlackList : {
isVisible : true ,
animateLoading : true ,
text : true ,
buttonColor : true ,
buttonVariant : true ,
placement : true ,
widgetName : true ,
isDisabled : true ,
isDefaultClickDisabled : true ,
recaptchaType : true ,
version : true ,
type : true ,
hideCard : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
recaptchaType : "V3" ,
version : 1 ,
parentId : "y3jz5nm8of" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "PRIMARY" ,
iconAlign : "left" ,
placement : "CENTER" ,
} ,
] ,
key : "ir2wg4nsvm" ,
labelTextSize : "0.875rem" ,
detachFromLayout : true ,
widgetId : "y3jz5nm8of" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "szq2vx6r6m" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
] ,
borderWidth : "0" ,
key : "lpcgapoau4" ,
disablePropertyPane : true ,
labelTextSize : "0.875rem" ,
backgroundColor : "white" ,
rightColumn : 64 ,
widgetId : "szq2vx6r6m" ,
containerStyle : "card" ,
isVisible : true ,
version : 1 ,
parentId : "3vja4gvycq" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
] ,
key : "ir2wg4nsvm" ,
labelTextSize : "0.875rem" ,
rightColumn : 149.25 ,
detachFromLayout : true ,
widgetId : "3vja4gvycq" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "zismwyzhny" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
] ,
privateWidgets : {
undefined : true ,
} ,
key : "mhpuav1a5z" ,
labelTextSize : "0.875rem" ,
backgroundColor : "transparent" ,
rightColumn : 64 ,
itemBackgroundColor : "#FFFFFF" ,
widgetId : "zismwyzhny" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
isVisible : "{{List1.items.length > 0}}" ,
parentId : "z05jlsrkmt" ,
serverSidePaginationEnabled : true ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0.375rem" ,
} ,
] ,
isDisabled : false ,
key : "53ftpwo2aq" ,
labelTextSize : "0.875rem" ,
tabName : "Time Log" ,
rightColumn : 156.75 ,
detachFromLayout : true ,
widgetId : "z05jlsrkmt" ,
isVisible : true ,
version : 1 ,
parentId : "5i1ijofu5u" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
{
tabId : "tab2" ,
boxShadow : "none" ,
widgetName : "Canvas3" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 610 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : true ,
hideCard : true ,
shouldScrollContents : false ,
minHeight : 400 ,
parentColumnSpace : 1 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
template : {
Image1Copy : {
boxShadow : "none" ,
widgetName : "Image1Copy" ,
displayName : "Image" ,
iconSVG :
"/static/media/icon.52d8fb963abcb95c79b10f1553389f22.svg" ,
topRow : 0 ,
bottomRow : 8 ,
type : "IMAGE_WIDGET" ,
hideCard : false ,
animateLoading : true ,
dynamicTriggerPathList : [ ] ,
imageShape : "RECTANGLE" ,
dynamicBindingPathList : [
{
key : "image" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
leftColumn : 0 ,
defaultImage :
"https://assets.appsmith.com/widgets/default.png" ,
key : "6zvrwxg59v" ,
image :
"{{lst_user.listData.map((currentItem) => currentItem.image)}}" ,
isDeprecated : false ,
rightColumn : 16 ,
objectFit : "cover" ,
widgetId : "bnxe5gjbpt" ,
logBlackList : {
isVisible : true ,
defaultImage : true ,
imageShape : true ,
maxZoomLevel : true ,
enableRotation : true ,
enableDownload : true ,
objectFit : true ,
image : true ,
widgetName : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
boxShadow : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
borderRadius : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
maxZoomLevel : 1 ,
enableDownload : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
enableRotation : false ,
} ,
Text9Copy : {
boxShadow : "none" ,
widgetName : "Text9Copy" ,
dynamicPropertyPathList : [
{
key : "textColor" ,
} ,
] ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b523e6f70ba6f40a10fc2c7c5b5.svg" ,
searchTags : [ "typography" , "paragraph" , "label" ] ,
topRow : 0 ,
bottomRow : 4 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "{{appsmith.theme.fontFamily.appFont}}" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
{
key : "fontFamily" ,
} ,
] ,
leftColumn : 18 ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{lst_user.listData.map((currentItem) => currentItem.name)}}" ,
2022-09-16 14:20:29 +00:00
key : "u6pcautxph" ,
isDeprecated : false ,
rightColumn : 51 ,
textAlign : "LEFT" ,
widgetId : "5k7hnpoca5" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
boxShadow : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
fontFamily : true ,
borderRadius : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "{{appsmith.theme.colors.primaryColor}}" ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
fontSize : "1rem" ,
textStyle : "HEADING" ,
} ,
Text10Copy : {
widgetName : "Text10Copy" ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b523e6f70ba6f40a10fc2c7c5b5.svg" ,
searchTags : [ "typography" , "paragraph" , "label" ] ,
topRow : 4 ,
bottomRow : 8 ,
parentRowSpace : 10 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
fontFamily : "{{appsmith.theme.fontFamily.appFont}}" ,
parentColumnSpace : 5.78125 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 18 ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "fontFamily" ,
} ,
] ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{lst_user.listData.map((currentItem) => currentItem.email)}}" ,
2022-09-16 14:20:29 +00:00
key : "u6pcautxph" ,
isDeprecated : false ,
rightColumn : 63 ,
disableLink : true ,
textAlign : "LEFT" ,
widgetId : "oatmji4m6z" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
fontFamily : true ,
borderRadius : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
dynamicBindingPathList : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "#231F20" ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
fontSize : "1rem" ,
} ,
IconButton9Copy : {
boxShadow : "none" ,
widgetName : "IconButton9Copy" ,
buttonColor :
"{{lst_user.listData.map((currentItem) => getAllTimeLogs.data.some(l=>l.time_end==undefined&& l.user_id==currentItem.id) ? 'limegreen' : 'grey')}}" ,
dynamicPropertyPathList : [
{
key : "buttonColor" ,
} ,
] ,
displayName : "Icon Button" ,
iconSVG :
"/static/media/icon.1a0c634ac75f9fa6b6ae7a8df882a3ba.svg" ,
searchTags : [ "click" , "submit" ] ,
topRow : 0 ,
bottomRow : 4 ,
tooltip : "Clock in/out" ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 5.78125 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 58 ,
dynamicBindingPathList : [
{
key : "buttonColor" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
isDisabled : false ,
key : "6sipw8yyt6" ,
isDeprecated : false ,
rightColumn : 62 ,
iconName : "time" ,
widgetId : "j0zzppxt0f" ,
logBlackList : {
isVisible : true ,
iconName : true ,
buttonVariant : true ,
isDisabled : true ,
widgetName : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
buttonColor : true ,
borderRadius : true ,
boxShadow : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
dynamicBindingPathList : true ,
} ,
isVisible : true ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "TERTIARY" ,
} ,
Canvas10Copy : {
boxShadow : "none" ,
widgetName : "Canvas10Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 390 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
dropDisabled : true ,
openParentPropertyPane : true ,
minHeight : 400 ,
noPad : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [ "jtnfj3x31z" ] ,
key : "yefglrbgux" ,
isDeprecated : false ,
rightColumn : 149.25 ,
detachFromLayout : true ,
widgetId : "a3pfuntay2" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "2vn64tqgfn" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
Container3Copy : {
boxShadow :
"{{appsmith.theme.boxShadow.appBoxShadow}}" ,
widgetName : "Container3Copy" ,
borderColor : "transparent" ,
disallowCopy : true ,
isCanvas : true ,
displayName : "Container" ,
iconSVG :
"/static/media/icon.1977dca3370505e2db3a8e44cfd54907.svg" ,
searchTags : [ "div" , "parent" , "group" ] ,
topRow : 0 ,
bottomRow : 10 ,
dragDisabled : true ,
type : "CONTAINER_WIDGET" ,
hideCard : false ,
openParentPropertyPane : true ,
isDeletable : false ,
animateLoading : true ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "borderRadius" ,
} ,
{
key : "boxShadow" ,
} ,
] ,
children : [ "3smlbuidsm" ] ,
borderWidth : "0" ,
key : "dnbh2d72dk" ,
disablePropertyPane : true ,
backgroundColor : "white" ,
isDeprecated : false ,
rightColumn : 64 ,
widgetId : "jtnfj3x31z" ,
containerStyle : "card" ,
isVisible : true ,
version : 1 ,
parentId : "a3pfuntay2" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
Canvas11Copy : {
boxShadow : "none" ,
widgetName : "Canvas11Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 370 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
"bnxe5gjbpt" ,
"5k7hnpoca5" ,
"oatmji4m6z" ,
"j0zzppxt0f" ,
] ,
key : "yefglrbgux" ,
isDeprecated : false ,
detachFromLayout : true ,
widgetId : "3smlbuidsm" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "jtnfj3x31z" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
} ,
boxShadow : "{{appsmith.theme.boxShadow.appBoxShadow}}" ,
widgetName : "lst_user" ,
listData : "{{getUsers.data}}" ,
isCanvas : true ,
dynamicPropertyPathList : [ ] ,
displayName : "List" ,
iconSVG :
"/static/media/icon.9925ee17dee37bf1ba7374412563a8a7.svg" ,
topRow : 0 ,
bottomRow : 59 ,
parentRowSpace : 10 ,
onPageChange :
'{{getUsers.run(() => resetWidget("lst_user",true), () => {})}}' ,
type : "LIST_WIDGET" ,
hideCard : false ,
onPageSizeChange : "" ,
gridGap : 0 ,
animateLoading : true ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [
{
key : "onListItemClick" ,
} ,
{
key : "onPageSizeChange" ,
} ,
{
key : "onPageChange" ,
} ,
] ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "listData" ,
} ,
{
key : "borderRadius" ,
} ,
{
key : "boxShadow" ,
} ,
{
key : "template.Image1Copy.image" ,
} ,
{
key : "template.Text9Copy.text" ,
} ,
{
key : "template.Text10Copy.text" ,
} ,
{
key : "template.IconButton9Copy.buttonColor" ,
} ,
] ,
gridType : "vertical" ,
enhancements : true ,
children : [
{
boxShadow : "none" ,
widgetName : "Canvas10Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 390 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
dropDisabled : true ,
openParentPropertyPane : true ,
minHeight : 400 ,
noPad : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow :
"{{appsmith.theme.boxShadow.appBoxShadow}}" ,
widgetName : "Container3Copy" ,
borderColor : "transparent" ,
disallowCopy : true ,
isCanvas : true ,
displayName : "Container" ,
iconSVG :
"/static/media/icon.1977dca3370505e2db3a8e44cfd54907.svg" ,
searchTags : [ "div" , "parent" , "group" ] ,
topRow : 0 ,
bottomRow : 10 ,
dragDisabled : true ,
type : "CONTAINER_WIDGET" ,
hideCard : false ,
openParentPropertyPane : true ,
isDeletable : false ,
animateLoading : true ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "borderRadius" ,
} ,
{
key : "boxShadow" ,
} ,
] ,
children : [
{
boxShadow : "none" ,
widgetName : "Canvas11Copy" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 370 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Image1Copy" ,
displayName : "Image" ,
iconSVG :
"/static/media/icon.52d8fb963abcb95c79b10f1553389f22.svg" ,
topRow : 0 ,
bottomRow : 8 ,
type : "IMAGE_WIDGET" ,
hideCard : false ,
animateLoading : true ,
dynamicTriggerPathList : [ ] ,
imageShape : "RECTANGLE" ,
dynamicBindingPathList : [
{
key : "image" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
leftColumn : 0 ,
defaultImage :
"https://assets.appsmith.com/widgets/default.png" ,
key : "6zvrwxg59v" ,
image : "{{currentItem.image}}" ,
isDeprecated : false ,
rightColumn : 16 ,
objectFit : "cover" ,
widgetId : "bnxe5gjbpt" ,
logBlackList : {
isVisible : true ,
defaultImage : true ,
imageShape : true ,
maxZoomLevel : true ,
enableRotation : true ,
enableDownload : true ,
objectFit : true ,
image : true ,
widgetName : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
boxShadow : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
borderRadius : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
maxZoomLevel : 1 ,
enableDownload : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
enableRotation : false ,
} ,
{
boxShadow : "none" ,
widgetName : "Text9Copy" ,
dynamicPropertyPathList : [
{
key : "textColor" ,
} ,
] ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b523e6f70ba6f40a10fc2c7c5b5.svg" ,
searchTags : [
"typography" ,
"paragraph" ,
"label" ,
] ,
topRow : 0 ,
bottomRow : 4 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily :
"{{appsmith.theme.fontFamily.appFont}}" ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
{
key : "fontFamily" ,
} ,
] ,
leftColumn : 18 ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
text : "{{currentItem.name}}" ,
key : "u6pcautxph" ,
isDeprecated : false ,
rightColumn : 51 ,
textAlign : "LEFT" ,
widgetId : "5k7hnpoca5" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
textStyle : true ,
boxShadow : true ,
dynamicBindingPathList : true ,
dynamicTriggerPathList : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
fontFamily : true ,
borderRadius : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor :
"{{appsmith.theme.colors.primaryColor}}" ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
fontSize : "1rem" ,
textStyle : "HEADING" ,
} ,
{
widgetName : "Text10Copy" ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b523e6f70ba6f40a10fc2c7c5b5.svg" ,
searchTags : [
"typography" ,
"paragraph" ,
"label" ,
] ,
topRow : 4 ,
bottomRow : 8 ,
parentRowSpace : 10 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
fontFamily :
"{{appsmith.theme.fontFamily.appFont}}" ,
parentColumnSpace : 5.78125 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 18 ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
{
key : "fontFamily" ,
} ,
] ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
text : "{{currentItem.email}}" ,
key : "u6pcautxph" ,
isDeprecated : false ,
rightColumn : 63 ,
disableLink : true ,
textAlign : "LEFT" ,
widgetId : "oatmji4m6z" ,
logBlackList : {
isVisible : true ,
text : true ,
fontSize : true ,
fontStyle : true ,
textAlign : true ,
textColor : true ,
truncateButtonColor : true ,
widgetName : true ,
shouldTruncate : true ,
overflow : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
fontFamily : true ,
borderRadius : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
dynamicBindingPathList : true ,
} ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "#231F20" ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
fontSize : "1rem" ,
} ,
{
boxShadow : "none" ,
widgetName : "IconButton9Copy" ,
buttonColor :
"{{getAllTimeLogs.data.some(l=>l.time_end==undefined&& l.user_id==currentItem.id) ? 'limegreen' : 'grey'}}" ,
dynamicPropertyPathList : [
{
key : "buttonColor" ,
} ,
] ,
displayName : "Icon Button" ,
iconSVG :
"/static/media/icon.1a0c634ac75f9fa6b6ae7a8df882a3ba.svg" ,
searchTags : [ "click" , "submit" ] ,
topRow : 0 ,
bottomRow : 4 ,
tooltip : "Clock in/out" ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 5.78125 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 58 ,
dynamicBindingPathList : [
{
key : "buttonColor" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
isDisabled : false ,
key : "6sipw8yyt6" ,
isDeprecated : false ,
rightColumn : 62 ,
iconName : "time" ,
widgetId : "j0zzppxt0f" ,
logBlackList : {
isVisible : true ,
iconName : true ,
buttonVariant : true ,
isDisabled : true ,
widgetName : true ,
version : true ,
animateLoading : true ,
searchTags : true ,
type : true ,
hideCard : true ,
isDeprecated : true ,
replacement : true ,
displayName : true ,
key : true ,
iconSVG : true ,
isCanvas : true ,
minHeight : true ,
widgetId : true ,
renderMode : true ,
buttonColor : true ,
borderRadius : true ,
boxShadow : true ,
isLoading : true ,
parentColumnSpace : true ,
parentRowSpace : true ,
leftColumn : true ,
rightColumn : true ,
topRow : true ,
bottomRow : true ,
parentId : true ,
dynamicBindingPathList : true ,
} ,
isVisible : true ,
version : 1 ,
parentId : "3smlbuidsm" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "TERTIARY" ,
} ,
] ,
key : "yefglrbgux" ,
isDeprecated : false ,
detachFromLayout : true ,
widgetId : "3smlbuidsm" ,
accentColor :
"{{appsmith.theme.colors.primaryColor}}" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "jtnfj3x31z" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
] ,
borderWidth : "0" ,
key : "dnbh2d72dk" ,
disablePropertyPane : true ,
backgroundColor : "white" ,
isDeprecated : false ,
rightColumn : 64 ,
widgetId : "jtnfj3x31z" ,
containerStyle : "card" ,
isVisible : true ,
version : 1 ,
parentId : "a3pfuntay2" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
] ,
key : "yefglrbgux" ,
isDeprecated : false ,
rightColumn : 149.25 ,
detachFromLayout : true ,
widgetId : "a3pfuntay2" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "2vn64tqgfn" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
] ,
privateWidgets : {
undefined : true ,
} ,
key : "q9apcnizxn" ,
backgroundColor : "transparent" ,
isDeprecated : false ,
rightColumn : 64 ,
onListItemClick : "{{JSObject1.selectEmployee()}}" ,
itemBackgroundColor : "#FFFFFF" ,
widgetId : "2vn64tqgfn" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
isVisible : true ,
parentId : "5nj3rw1joi" ,
serverSidePaginationEnabled : false ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
] ,
isDisabled : false ,
key : "53ftpwo2aq" ,
labelTextSize : "0.875rem" ,
tabName : "Employees" ,
rightColumn : 156.75 ,
detachFromLayout : true ,
widgetId : "5nj3rw1joi" ,
isVisible : true ,
version : 1 ,
parentId : "5i1ijofu5u" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
{
tabId : "tab0uectdsv5x" ,
boxShadow : "none" ,
widgetName : "Canvas9" ,
displayName : "Canvas" ,
topRow : 1 ,
bottomRow : 620 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : false ,
hideCard : true ,
minHeight : 600 ,
parentColumnSpace : 1 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "{{appsmith.theme.boxShadow.appBoxShadow}}" ,
setAdaptiveYMin : false ,
widgetName : "Chart1" ,
allowScroll : false ,
dynamicPropertyPathList : [
{
key : "onDataPointClick" ,
} ,
] ,
displayName : "Chart" ,
iconSVG :
"/static/media/icon.6adbe31ed817fc4bfd66f9f0a6fc105c.svg" ,
searchTags : [ "graph" , "visuals" , "visualisations" ] ,
topRow : 0 ,
bottomRow : 25 ,
parentRowSpace : 10 ,
type : "CHART_WIDGET" ,
hideCard : false ,
chartData : {
zwbffmrap1 : {
seriesName : "Time" ,
data : "{{JSObject1.totalsChart()}}" ,
} ,
} ,
animateLoading : true ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [
{
key : "onDataPointClick" ,
} ,
] ,
fontFamily : "{{appsmith.theme.fontFamily.appFont}}" ,
leftColumn : 0 ,
dynamicBindingPathList : [
{
key : "chartData.zwbffmrap1.data" ,
} ,
{
key : "borderRadius" ,
} ,
{
key : "boxShadow" ,
} ,
{
key : "accentColor" ,
} ,
{
key : "fontFamily" ,
} ,
] ,
customFusionChartConfig : {
type : "column2d" ,
dataSource : {
data : [
{
label : "Product1" ,
value : 20000 ,
} ,
{
label : "Product2" ,
value : 22000 ,
} ,
{
label : "Product3" ,
value : 32000 ,
} ,
] ,
chart : {
caption : "Sales Report" ,
xAxisName : "Product Line" ,
yAxisName : "Revenue($)" ,
theme : "fusion" ,
alignCaptionWithCanvas : 1 ,
captionFontSize : "24" ,
captionAlignment : "center" ,
captionPadding : "20" ,
captionFontColor : "#231F20" ,
legendIconSides : "4" ,
legendIconBgAlpha : "100" ,
legendIconAlpha : "100" ,
legendPosition : "top" ,
canvasPadding : "0" ,
chartLeftMargin : "20" ,
chartTopMargin : "10" ,
chartRightMargin : "40" ,
chartBottomMargin : "10" ,
xAxisNameFontSize : "14" ,
labelFontSize : "12" ,
labelFontColor : "#716E6E" ,
xAxisNameFontColor : "#716E6E" ,
yAxisNameFontSize : "14" ,
yAxisValueFontSize : "12" ,
yAxisValueFontColor : "#716E6E" ,
yAxisNameFontColor : "#716E6E" ,
} ,
} ,
} ,
onDataPointClick :
"{{storeValue('task',Chart1.selectedDataPoint.x,false)}}" ,
key : "3p90n51o2w" ,
isDeprecated : false ,
rightColumn : 64 ,
widgetId : "202hvtgzef" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
isVisible : true ,
version : 1 ,
parentId : "demz6wbjrc" ,
labelOrientation : "auto" ,
renderMode : "CANVAS" ,
isLoading : false ,
yAxisName : "Duration (Hours)" ,
chartName : "Time spent per Task" ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
xAxisName : "Task" ,
chartType : "BAR_CHART" ,
} ,
{
boxShadow : "{{appsmith.theme.boxShadow.appBoxShadow}}" ,
isVisibleDownload : false ,
iconSVG :
"/static/media/icon.db8a9cbd2acd22a31ea91cc37ea2a46c.svg" ,
topRow : 29 ,
isSortable : false ,
type : "TABLE_WIDGET_V2" ,
inlineEditingSaveOption : "ROW_LEVEL" ,
animateLoading : true ,
dynamicBindingPathList : [
{
key : "tableData" ,
} ,
{
key : "primaryColumns.customColumn3.computedValue" ,
} ,
{
key : "primaryColumns.customColumn2.computedValue" ,
} ,
{
key : "primaryColumns.customColumn1.computedValue" ,
} ,
{
key : "primaryColumns.time_end.computedValue" ,
} ,
{
key : "primaryColumns.date_end.computedValue" ,
} ,
{
key : "primaryColumns.time_start.computedValue" ,
} ,
{
key : "primaryColumns.date_start.computedValue" ,
} ,
{
key : "primaryColumns.rate.computedValue" ,
} ,
{
key : "primaryColumns.notes.computedValue" ,
} ,
{
key : "primaryColumns.user_id.computedValue" ,
} ,
{
key : "primaryColumns.id.computedValue" ,
} ,
{
key : "primaryColumns.task.computedValue" ,
} ,
{
key : "accentColor" ,
} ,
{
key : "borderRadius" ,
} ,
{
key : "boxShadow" ,
} ,
] ,
leftColumn : 0 ,
delimiter : "," ,
defaultSelectedRowIndex : 0 ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
isVisibleFilters : false ,
isVisible : true ,
enableClientSideSearch : false ,
version : 1 ,
totalRecordsCount : 0 ,
isLoading : false ,
childStylesheet : {
button : {
buttonColor : "{{appsmith.theme.colors.primaryColor}}" ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
boxShadow : "none" ,
} ,
menuButton : {
menuColor : "{{appsmith.theme.colors.primaryColor}}" ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
boxShadow : "none" ,
} ,
iconButton : {
menuColor : "{{appsmith.theme.colors.primaryColor}}" ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
boxShadow : "none" ,
} ,
editActions : {
saveButtonColor :
"{{appsmith.theme.colors.primaryColor}}" ,
saveBorderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
discardButtonColor :
"{{appsmith.theme.colors.primaryColor}}" ,
discardBorderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
} ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
primaryColumnId : "id" ,
defaultSelectedRowIndices : [ 0 ] ,
widgetName : "Table2" ,
defaultPageSize : 0 ,
columnOrder : [
"customColumn3" ,
"customColumn1" ,
"customColumn2" ,
"id" ,
"user_id" ,
"task" ,
"notes" ,
"rate" ,
"date_start" ,
"time_start" ,
"date_end" ,
"time_end" ,
] ,
dynamicPropertyPathList : [ ] ,
compactMode : "SHORT" ,
displayName : "Table" ,
bottomRow : 60 ,
columnWidthMap : {
task : 245 ,
step : 62 ,
status : 75 ,
time_start : 194 ,
customColumn1 : 137 ,
customColumn2 : 72 ,
customColumn3 : 60 ,
} ,
parentRowSpace : 10 ,
hideCard : false ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [ ] ,
primaryColumns : {
task : {
index : 1 ,
width : 150 ,
id : "task" ,
originalId : "task" ,
alias : "task" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isCellVisible : true ,
isCellEditable : false ,
isDerived : false ,
label : "task" ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["task"]))}}' ,
labelColor : "#FFFFFF" ,
validation : { } ,
} ,
id : {
allowCellWrapping : false ,
index : 0 ,
width : 150 ,
originalId : "id" ,
id : "id" ,
alias : "id" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "id" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["id"]))}}' ,
validation : { } ,
} ,
user_id : {
allowCellWrapping : false ,
index : 1 ,
width : 150 ,
originalId : "user_id" ,
id : "user_id" ,
alias : "user_id" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "user_id" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["user_id"]))}}' ,
validation : { } ,
} ,
notes : {
allowCellWrapping : false ,
index : 3 ,
width : 150 ,
originalId : "notes" ,
id : "notes" ,
alias : "notes" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "notes" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["notes"]))}}' ,
validation : { } ,
} ,
rate : {
allowCellWrapping : false ,
index : 4 ,
width : 150 ,
originalId : "rate" ,
id : "rate" ,
alias : "rate" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "rate" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["rate"]))}}' ,
validation : { } ,
} ,
date_start : {
allowCellWrapping : false ,
index : 5 ,
width : 150 ,
originalId : "date_start" ,
id : "date_start" ,
alias : "date_start" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "date_start" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["date_start"]))}}' ,
validation : { } ,
} ,
time_start : {
allowCellWrapping : false ,
index : 6 ,
width : 150 ,
originalId : "time_start" ,
id : "time_start" ,
alias : "time_start" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : true ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "time_start" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["time_start"]))}}' ,
validation : { } ,
} ,
date_end : {
allowCellWrapping : false ,
index : 7 ,
width : 150 ,
originalId : "date_end" ,
id : "date_end" ,
alias : "date_end" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "date_end" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["date_end"]))}}' ,
validation : { } ,
} ,
time_end : {
allowCellWrapping : false ,
index : 8 ,
width : 150 ,
originalId : "time_end" ,
id : "time_end" ,
alias : "time_end" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : false ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : false ,
label : "time_end" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
'{{Table2.processedTableData.map((currentRow, currentIndex) => ( currentRow["time_end"]))}}' ,
validation : { } ,
} ,
customColumn1 : {
allowCellWrapping : false ,
index : 9 ,
width : 150 ,
originalId : "customColumn1" ,
id : "customColumn1" ,
alias : "Employee" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : true ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : true ,
label : "Employee" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
"{{Table2.processedTableData.map((currentRow, currentIndex) => ( getUsers.data.find(u=>u.id==currentRow.user_id).name))}}" ,
buttonStyle : "rgb(3, 179, 101)" ,
labelColor : "#FFFFFF" ,
validation : { } ,
} ,
customColumn2 : {
allowCellWrapping : false ,
index : 10 ,
width : 150 ,
originalId : "customColumn2" ,
id : "customColumn2" ,
alias : "duration" ,
horizontalAlignment : "RIGHT" ,
verticalAlignment : "CENTER" ,
columnType : "text" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : true ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : true ,
label : "Duration" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
"{{Table2.processedTableData.map((currentRow, currentIndex) => ( JSObject1.diffHrsMins(currentRow.time_start,currentRow.time_end)))}}" ,
buttonStyle : "rgb(3, 179, 101)" ,
labelColor : "#FFFFFF" ,
validation : { } ,
} ,
customColumn3 : {
allowCellWrapping : false ,
index : 10 ,
width : 150 ,
originalId : "customColumn3" ,
id : "customColumn3" ,
alias : "image" ,
horizontalAlignment : "LEFT" ,
verticalAlignment : "CENTER" ,
columnType : "image" ,
textSize : "0.875rem" ,
enableFilter : true ,
enableSort : true ,
isVisible : true ,
isDisabled : false ,
isCellEditable : false ,
isEditable : false ,
isCellVisible : true ,
isDerived : true ,
label : "image" ,
isSaveVisible : true ,
isDiscardVisible : true ,
computedValue :
"{{Table2.processedTableData.map((currentRow, currentIndex) => ( getUsers.data.find(u=>u.id==currentRow.user_id).image))}}" ,
buttonStyle : "rgb(3, 179, 101)" ,
labelColor : "#FFFFFF" ,
validation : { } ,
} ,
} ,
key : "gijedibkh6" ,
isDeprecated : false ,
rightColumn : 64 ,
textSize : "0.875rem" ,
widgetId : "kug5m016a2" ,
tableData :
"{{getAllTimeLogs.data.filter(log=>log.task==appsmith.store.task || appsmith.store.task ==''|| appsmith.store.task ==undefined)}}" ,
label : "Data" ,
searchKey : "" ,
parentId : "demz6wbjrc" ,
serverSidePaginationEnabled : true ,
renderMode : "CANVAS" ,
horizontalAlignment : "LEFT" ,
isVisibleSearch : false ,
isVisiblePagination : false ,
verticalAlignment : "CENTER" ,
} ,
{
widgetName : "Text8" ,
dynamicPropertyPathList : [
{
key : "textColor" ,
} ,
] ,
displayName : "Text" ,
iconSVG :
"/static/media/icon.97c59b523e6f70ba6f40a10fc2c7c5b5.svg" ,
searchTags : [ "typography" , "paragraph" , "label" ] ,
topRow : 25 ,
bottomRow : 29 ,
parentRowSpace : 10 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
fontFamily : "{{appsmith.theme.fontFamily.appFont}}" ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 1 ,
dynamicBindingPathList : [
{
key : "fontFamily" ,
} ,
{
key : "text" ,
} ,
{
key : "textColor" ,
} ,
] ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "{{'task' in appsmith.store && appsmith.store.task?.length>0 ? `TASK ${appsmith.store.task}` : 'select a bar segment to view log entries for each Task'}}" ,
2022-09-16 14:20:29 +00:00
key : "oqp9xeolbr" ,
isDeprecated : false ,
rightColumn : 57 ,
textAlign : "CENTER" ,
widgetId : "d7cjjtd9xc" ,
isVisible : true ,
fontStyle : "ITALIC" ,
textColor :
"{{'task' in appsmith.store && appsmith.store.task?.length>0 ? 'grey' :'#ff5858'}}" ,
version : 1 ,
parentId : "demz6wbjrc" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
fontSize : "1rem" ,
} ,
{
boxShadow : "none" ,
widgetName : "IconButton9" ,
onClick : "{{storeValue('task',undefined,false)}}" ,
buttonColor : "{{appsmith.theme.colors.primaryColor}}" ,
dynamicPropertyPathList : [
{
key : "onClick" ,
} ,
] ,
displayName : "Icon Button" ,
iconSVG :
"/static/media/icon.1a0c634ac75f9fa6b6ae7a8df882a3ba.svg" ,
searchTags : [ "click" , "submit" ] ,
topRow : 25 ,
bottomRow : 29 ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.21875 ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 59 ,
dynamicBindingPathList : [
{
key : "buttonColor" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
isDisabled : false ,
key : "6493kijvjm" ,
isDeprecated : false ,
rightColumn : 63 ,
iconName : "reset" ,
widgetId : "v5sz0wjggu" ,
isVisible : true ,
version : 1 ,
parentId : "demz6wbjrc" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
buttonVariant : "PRIMARY" ,
} ,
] ,
key : "tgc855brd3" ,
isDeprecated : false ,
tabName : "Report" ,
rightColumn : 418 ,
detachFromLayout : true ,
widgetId : "demz6wbjrc" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "5i1ijofu5u" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius :
"{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
] ,
key : "dmj9a5cird" ,
labelTextSize : "0.875rem" ,
rightColumn : 64 ,
widgetId : "5i1ijofu5u" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
defaultTab : "{{appsmith.store.default_tab }}" ,
onTabSelected : "{{storeValue('default_tab','')}}" ,
shouldShowTabs : true ,
tabsObj : {
tab0uectdsv5x : {
id : "tab0uectdsv5x" ,
index : 0 ,
label : "Report" ,
widgetId : "demz6wbjrc" ,
isVisible : true ,
isDuplicateLabel : false ,
} ,
tab2 : {
label : "Employees" ,
id : "tab2" ,
widgetId : "5nj3rw1joi" ,
isVisible : true ,
index : 1 ,
isDuplicateLabel : false ,
} ,
tab1 : {
label : "Time Log" ,
id : "tab1" ,
widgetId : "z05jlsrkmt" ,
isVisible : true ,
index : 2 ,
isDuplicateLabel : false ,
} ,
} ,
isVisible : true ,
version : 3 ,
parentId : "cmd4xuwm4c" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
{
boxShadow : "none" ,
widgetName : "Text5" ,
dynamicPropertyPathList : [
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG : "/static/media/icon.97c59b52.svg" ,
topRow : 0 ,
bottomRow : 5 ,
parentRowSpace : 10 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
parentColumnSpace : 6.53125 ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
leftColumn : 3 ,
dynamicBindingPathList : [
{
key : "text" ,
} ,
] ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
text : "Last Updated: {{appsmith.store?.updated_at || moment().format('LLL')}}" ,
2022-09-16 14:20:29 +00:00
key : "sm2eopm278" ,
labelTextSize : "0.875rem" ,
rightColumn : 52 ,
textAlign : "LEFT" ,
widgetId : "u1jlz3uo52" ,
isVisible : true ,
fontStyle : "" ,
textColor : "#716e6e" ,
version : 1 ,
parentId : "cmd4xuwm4c" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "0.75rem" ,
} ,
{
boxShadow : "none" ,
widgetName : "IconButton7" ,
onClick :
"{{getUsers.run(() => getTimeLogs.run(), () => {}); \ngetAllTimeLogs.run();\nstoreValue('updated_at',moment().format('LLL'))}}" ,
buttonColor : "{{appsmith.theme.colors.primaryColor}}" ,
dynamicPropertyPathList : [
{
key : "onClick" ,
} ,
{
key : "borderRadius" ,
} ,
] ,
displayName : "Icon Button" ,
iconSVG : "/static/media/icon.1a0c634a.svg" ,
topRow : 0 ,
bottomRow : 5 ,
parentRowSpace : 10 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.53125 ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 54 ,
dynamicBindingPathList : [
{
key : "buttonColor" ,
} ,
] ,
isDisabled : false ,
key : "iifq91zxtp" ,
labelTextSize : "0.875rem" ,
rightColumn : 61 ,
iconName : "refresh" ,
widgetId : "smr6ubs5fn" ,
isVisible : true ,
version : 1 ,
parentId : "cmd4xuwm4c" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0.575rem" ,
buttonVariant : "TERTIARY" ,
} ,
] ,
key : "53ftpwo2aq" ,
labelTextSize : "0.875rem" ,
rightColumn : 164.25 ,
detachFromLayout : true ,
widgetId : "cmd4xuwm4c" ,
containerStyle : "none" ,
isVisible : true ,
version : 1 ,
parentId : "gpxgpyyask" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
] ,
borderWidth : "0" ,
key : "a4gmk81297" ,
labelTextSize : "0.875rem" ,
backgroundColor : "#FFFFFF" ,
rightColumn : 64 ,
widgetId : "gpxgpyyask" ,
containerStyle : "card" ,
isVisible : true ,
version : 1 ,
parentId : "0" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "{{appsmith.theme.borderRadius.appBorderRadius}}" ,
} ,
{
boxShadow : "none" ,
widgetName : "Modal1" ,
isCanvas : true ,
dynamicPropertyPathList : [
{
key : "borderRadius" ,
} ,
] ,
displayName : "Modal" ,
iconSVG : "/static/media/icon.4975978e.svg" ,
topRow : 0 ,
bottomRow : 0 ,
parentRowSpace : 1 ,
type : "MODAL_WIDGET" ,
hideCard : false ,
shouldScrollContents : true ,
animateLoading : true ,
parentColumnSpace : 1 ,
dynamicTriggerPathList : [
{
key : "onClose" ,
} ,
] ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "Canvas8" ,
displayName : "Canvas" ,
topRow : 0 ,
bottomRow : 310 ,
parentRowSpace : 1 ,
type : "CANVAS_WIDGET" ,
canExtend : true ,
hideCard : true ,
shouldScrollContents : false ,
minHeight : 284 ,
parentColumnSpace : 1 ,
leftColumn : 0 ,
dynamicBindingPathList : [ ] ,
children : [
{
boxShadow : "none" ,
widgetName : "IconButton6" ,
onClick : "{{closeModal('Modal1')}}" ,
buttonColor : "{{appsmith.theme.colors.primaryColor}}" ,
displayName : "Icon Button" ,
iconSVG : "/static/media/icon.1a0c634a.svg" ,
topRow : 1 ,
bottomRow : 6 ,
type : "ICON_BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
dynamicTriggerPathList : [ ] ,
leftColumn : 55 ,
dynamicBindingPathList : [
{
key : "buttonColor" ,
} ,
] ,
iconSize : 24 ,
isDisabled : false ,
key : "n2rpp1efil" ,
labelTextSize : "0.875rem" ,
rightColumn : 62 ,
iconName : "cross" ,
widgetId : "6ckbxk9taj" ,
isVisible : true ,
version : 1 ,
parentId : "jforpydvyp" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0.375rem" ,
buttonVariant : "PRIMARY" ,
} ,
{
boxShadow : "none" ,
widgetName : "Text6" ,
dynamicPropertyPathList : [
{
key : "fontSize" ,
} ,
] ,
displayName : "Text" ,
iconSVG : "/static/media/icon.97c59b52.svg" ,
topRow : 1 ,
bottomRow : 6 ,
type : "TEXT_WIDGET" ,
hideCard : false ,
animateLoading : true ,
overflow : "NONE" ,
dynamicTriggerPathList : [ ] ,
fontFamily : "System Default" ,
leftColumn : 2 ,
dynamicBindingPathList : [
{
key : "textColor" ,
} ,
] ,
shouldTruncate : false ,
truncateButtonColor : "#FFC13D" ,
text : "Start New Task" ,
key : "xdyuhi8ryb" ,
labelTextSize : "0.875rem" ,
rightColumn : 51 ,
textAlign : "LEFT" ,
widgetId : "qv4c77718j" ,
isVisible : true ,
fontStyle : "BOLD" ,
textColor : "{{appsmith.theme.colors.primaryColor}}" ,
version : 1 ,
parentId : "jforpydvyp" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
fontSize : "1.5rem" ,
} ,
{
boxShadow : "none" ,
widgetName : "Button2" ,
onClick : "{{JSObject1.saveTimeLog()}}" ,
buttonColor : "{{appsmith.theme.colors.primaryColor}}" ,
dynamicPropertyPathList : [
{
key : "borderRadius" ,
} ,
{
key : "isDisabled" ,
} ,
] ,
displayName : "Button" ,
iconSVG : "/static/media/icon.cca02633.svg" ,
topRow : 18 ,
bottomRow : 23 ,
type : "BUTTON_WIDGET" ,
hideCard : false ,
animateLoading : true ,
dynamicTriggerPathList : [
{
key : "onClick" ,
} ,
] ,
leftColumn : 37 ,
dynamicBindingPathList : [
{
key : "buttonColor" ,
} ,
{
key : "isDisabled" ,
} ,
] ,
text : "Clock In" ,
isDisabled : "{{!Select1.selectedOptionValue}}" ,
key : "4u2z3j5asa" ,
labelTextSize : "0.875rem" ,
rightColumn : 62 ,
isDefaultClickDisabled : true ,
widgetId : "bxshlknohf" ,
buttonStyle : "PRIMARY_BUTTON" ,
isVisible : true ,
recaptchaType : "V3" ,
version : 1 ,
parentId : "jforpydvyp" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0.700rem" ,
buttonVariant : "PRIMARY" ,
iconAlign : "left" ,
placement : "CENTER" ,
} ,
{
boxShadow : "none" ,
widgetName : "Select1" ,
isFilterable : true ,
displayName : "Select" ,
iconSVG : "/static/media/icon.bd99caba.svg" ,
labelText : "Task" ,
topRow : 13 ,
bottomRow : 17 ,
parentRowSpace : 10 ,
labelWidth : "14" ,
type : "SELECT_WIDGET" ,
serverSideFiltering : false ,
hideCard : false ,
defaultOptionValue : "" ,
animateLoading : true ,
parentColumnSpace : 6.4921875 ,
dynamicTriggerPathList : [ ] ,
leftColumn : 2 ,
dynamicBindingPathList : [
{
key : "accentColor" ,
} ,
] ,
labelPosition : "Left" ,
options :
'[\n {\n "label": "Task1",\n "value": "1"\n },\n {\n "label": "Task2",\n "value": "2"\n },\n {\n "label": "Task3",\n "value": "3"\n },\n {\n "label": "Task4",\n "value": "4"\n },\n {\n "label": "Task5",\n "value": "5"\n }\n]' ,
labelStyle : "BOLD" ,
placeholderText : "Select option" ,
isDisabled : false ,
key : "1yzaq5vf81" ,
labelTextSize : "1rem" ,
isRequired : true ,
rightColumn : 62 ,
widgetId : "3bcb22pmkm" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
isVisible : true ,
version : 1 ,
parentId : "jforpydvyp" ,
renderMode : "CANVAS" ,
isLoading : false ,
labelAlignment : "left" ,
borderRadius : "0.375rem" ,
} ,
{
boxShadow : "none" ,
widgetName : "Input1" ,
displayName : "Input" ,
iconSVG : "/static/media/icon.9f505595.svg" ,
topRow : 8 ,
bottomRow : 12 ,
parentRowSpace : 10 ,
labelWidth : "14" ,
autoFocus : false ,
type : "INPUT_WIDGET_V2" ,
hideCard : false ,
animateLoading : true ,
parentColumnSpace : 6.4921875 ,
dynamicTriggerPathList : [ ] ,
resetOnSubmit : true ,
leftColumn : 2 ,
dynamicBindingPathList : [
{
key : "defaultText" ,
} ,
{
key : "accentColor" ,
} ,
] ,
labelPosition : "Left" ,
labelStyle : "BOLD" ,
labelTextColor : "#231f20" ,
inputType : "TEXT" ,
isDisabled : true ,
key : "b2fum05x5g" ,
labelTextSize : "1rem" ,
isRequired : true ,
rightColumn : 62 ,
widgetId : "2ryk9b0he3" ,
accentColor : "{{appsmith.theme.colors.primaryColor}}" ,
isVisible : true ,
label : "Employee" ,
version : 2 ,
parentId : "jforpydvyp" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0.375rem" ,
iconAlign : "left" ,
defaultText : "{{lst_user.selectedItem.name}}" ,
} ,
] ,
isDisabled : false ,
key : "6i5snc4omt" ,
labelTextSize : "0.875rem" ,
rightColumn : 0 ,
detachFromLayout : true ,
widgetId : "jforpydvyp" ,
isVisible : true ,
version : 1 ,
parentId : "ccfshnc4ef" ,
renderMode : "CANVAS" ,
isLoading : false ,
borderRadius : "0px" ,
} ,
] ,
key : "tb04uy1los" ,
height : 284 ,
labelTextSize : "0.875rem" ,
rightColumn : 0 ,
detachFromLayout : true ,
widgetId : "ccfshnc4ef" ,
canOutsideClickClose : true ,
canEscapeKeyClose : true ,
version : 2 ,
parentId : "0" ,
renderMode : "CANVAS" ,
isLoading : false ,
onClose : '{{resetWidget("Modal1",true)}}' ,
borderRadius : "1.100rem" ,
width : 427.5 ,
} ,
] ,
} ;