Skip to content
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

style guide and development tools for pg related modules #2172

Open
jeromew opened this issue Apr 22, 2020 · 1 comment
Open

style guide and development tools for pg related modules #2172

jeromew opened this issue Apr 22, 2020 · 1 comment

Comments

@jeromew
Copy link
Contributor

jeromew commented Apr 22, 2020

Hello @brianc,

I am working with @pspi on a modification of node-pg-copy-streams (cf brianc/node-pg-copy-streams#91) and it could be an opportunity to improve some things in this module.

Can you share with us your ideas about coding style / dev tooling for the modules related to pg ? Do you have written something on this somewhere ? I think that all these modules should share the same spirit as they might be visited by the same people.

Do you have a preference regarding testing frameworks ? (mocha, jest, ?) I saw mocha is used in several sub modules. Is it what you plan to keep using in the future ?

linting - I saw that you use eslint in the main lerna repo so probably external modules should use the same configuration (?)

es6 - do you think it is reasonable now to use ES6 features in the modules ? I saw that pg targets node >= 8.0.0 so probably using features existing in 8.0.0+ is acceptable - cf https://node.green/

I guess I am asking these questions because it might make sense one day that some external pg- modules reach the monorepo and it will be easier if the modules already have the same characteristics.

Thank you for your help,

@brianc
Copy link
Owner

brianc commented Apr 28, 2020

Good questions - sorry for the delay!

Right now the main coding style I'm using is prettier which I have a config for here. And the eslint config to match. Other than that the eslint is pretty relaxed. Over time I'll likely add rules to the eslint file but if I were to ever pull a library in I'd take it upon myself to bring it inline with linting as I'm doing now on #2184

I would say feel free to migrate to typescript if that's something you want to do...I plan on migrating much of the code in this lib to typescript eventually.

Testing frameworks? Good point - I strongly prefer sticking to mocha since all the tests in all the packages here use it (except pg core which predates mocha by a year or two). Migrating test frameworks is doable but its freaky because you could subtley change tests and not know it. For pg core I wrote some really quick but "mostly the same" code that looks similar to mocha, but haven't ported all the tests to it, since some of the tests just haven't changed in years and I'm too busy to go do a full test suite refactor of stuff that is still working (if it ain't broke don't fix it, kinda). One thing w/ pg core tests is the expect to run individual files and the files should exit w/ a 0 status code...so not sure moving to mocha is viable there...but anyways maybe one day but it's low priority. Everything else should use mocha if possible! 🙏

Any es6 features which work on node>=8.x are good to go! I likely wont drop node 8 support for a while...typescript helps "down target" older versions of node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants