appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

fix: Ensured no errors pops up when a space is given infront of export default

Open prasad-madine opened this issue 7 months ago • 6 comments

Description

Currently, when creating a JS object, adding a space before export default {} throws an error. This behavior restricts developers from formatting their code according to their preferences. Allowing spaces before export default {} will enable more flexible and readable code formatting.

Fixes: [Bug]: Allow space before 'export default{}' #33984

Cypress video:

https://github.com/zemoso-int/appsmith-from-the-business/assets/136346053/e7fda5dc-6f8e-43a6-9a74-86190b3af33c

Screenshots:

Before resolving bug:

Screenshot from 2024-07-01 08-57-49

After resolving bug:

Screenshot from 2024-07-02 10-49-57

Summary by CodeRabbit

  • Bug Fixes

    • Improved JavaScript editor to accept leading spaces before the export default statement, enhancing code flexibility and reducing errors.
  • Tests

    • Added a new Cypress test to verify the functionality of the JavaScript editor with the updated regex pattern.

PR Type

Bug fix


Description

  • Updated the regular expression pattern in index.ts to allow spaces before export default statements.
  • This change enables more flexible and readable code formatting by not throwing errors when spaces are present before export default.

prasad-madine avatar Jul 04 '24 06:07 prasad-madine