You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/03/14 17:54:10 UTC

[GitHub] [couchdb-fauxton] ericlowry opened a new issue #1252: fauxton edit view format code button breaks es6 arrow functions

ericlowry opened a new issue #1252: fauxton edit view format code button breaks es6 arrow functions 
URL: https://github.com/apache/couchdb-fauxton/issues/1252
 
 
   ## Description
   
   CouchDB 3.0 allows writing es6 arrow function closures, so instead of writing your map function like this:
   
   `function(doc) { if (doc.type === 'WIDGET' ) emit(doc.code,1); }`
   
   you can now do this:
   
   `doc => doc.type === 'WIDGET' && emit(doc.code,1)`
   
   or even this:
   
   `({type,code}) => type === 'WIDGET' && emit(code,1)`
   
   Works perfectly in CouchDB, returns the proper results in the view...
   
   But if you press the `Format Code` button in Fauxton, it breaks breaks the code, by injecting spaces between into the arrow function :-(
   
   ## Steps to Reproduce
   
   1. create a view and write a map function using an arrow function similar to the ones above.
   2. Save and test the view to see the arrow functions working
   3 edit you view and click the format code button, watch as it corrupts your beautiful view into something unrecognizable to couchdb...
   
   ## Expected Behaviour
   
   should format the code with an understanding of modern javascript, like prettier does ;-)
   
   ## Your Environment
   
   [TIP]:  # ( Include as many relevant details about your environment as possible. )
   [TIP]:  # ( You can paste the output of curl http://YOUR-COUCHDB:5984/ here. )
   
   * CouchDB version used: 3.0
   * Browser name and version: Chrome
   * Operating system and version: Docker, latest CouchDB container
   
   ## Additional Context
   
   I consider this a Bug and not a feature request because it breaks the code.  If I didn't like the formatting or something, than I would consider this a feature change...
   
   
   [TIP]:  # ( Add any other context about the problem here. )
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services