-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve coding style (general) #786
Comments
Good idea to start a discussion on this, but I agree this can probably be a Cordova level discussion. Can you please annotate the individual suggestion with the connected Node/ES requirements so the impact of these changes become clearer? Other discussions about what you suggest can happen when the issue is in the right place and properly framed. Thanks. |
I pretty strongly disagree with these suggestions, especially nested ternaries. Cordova code is already often hard to follow, and ternaries make it even harder to read and understand. |
I noticed that the cordova projects use eslint but doesn't take advantage of shareable configs.. At my company we have several repositories where we want to use a consistent eslint configuration. To ensure this, we actually created an eslint config module. Basically you name the module,
These eslint plugins and configs if they apply across all cordova packages can also be dependencies of our custom config module therefore every cordova package doesn't need to install each package manually either. |
(Another thing for the more generalized version of this issue that probably didn't get created yet) |
@janpio I recently discovered that https://github.com/apache/cordova-discuss is a place to suggest proposals? Would this make sense to do for the eslint config I idea I mentioned above? |
IMHO this is not really the case, but some people seem to use it that way, so why not. (The official location would be the dev mailing list with a link to a thought out description either in mail or via link) |
I would also strive to add Strict mode offers 2 main benefits:
|
Any objections if we transfer this to https://github.com/apache/cordova/issues? I think some of these ideas are covered by apache/cordova#142. |
I think we should do this, since we are still not using ES6 modules. Node.js is in a strange situation where it does support ES6 but not ES6 modules unless we start using an experimental flag along with some other changes as documented in https://nodejs.org/api/esm.html. (This may change in Node.js 12 LTS according to https://2ality.com/2019/04/nodejs-esm-impl.html#using-es-modules-on-node.js.) Maybe this should be a separate discussion in https://github.com/apache/cordova/issues?
I tried to do this, GUI does not seem to let me select |
closing in favor of the linked issue in cordova repository |
Some ideas that I raised in review of PR #764, some of which may apply to other Cordova packages:
forEach
,map
, andreduce
to get rid of for loopskeys
method to get the array of keys then use array methods to get rid of for loopsconst
(first choice) orlet
(second choice) instead ofvar
recursive-readdir-sync
whenever possible instead ofshelljs
and to reduce the amount of “fs*” code we have to maintainI am raising this issue before it gets forgotten. Maybe we should transfer or write this issue in https://github.com/apache/cordova/issues for larger discussion and consideration.
The text was updated successfully, but these errors were encountered: