appsmith
appsmith copied to clipboard
fix: Ensured no errors pops up when a space is given infront of export default
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:
After resolving bug:
Summary by CodeRabbit
-
Bug Fixes
- Improved JavaScript editor to accept leading spaces before the
export default
statement, enhancing code flexibility and reducing errors.
- Improved JavaScript editor to accept leading spaces before the
-
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 beforeexport default
statements. - This change enables more flexible and readable code formatting by not throwing errors when spaces are present before
export default
.