faker icon indicating copy to clipboard operation
faker copied to clipboard

refactor: rename module class names

Open Shinigami92 opened this issue 3 years ago • 4 comments
trafficstars

closes #778

Shinigami92 avatar May 07 '22 15:05 Shinigami92

Codecov Report

Merging #932 (4b88870) into main (1fe2877) will decrease coverage by 0.00%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #932      +/-   ##
==========================================
- Coverage   99.62%   99.62%   -0.01%     
==========================================
  Files        2163     2163              
  Lines      241242   241264      +22     
  Branches     1014     1011       -3     
==========================================
+ Hits       240335   240354      +19     
- Misses        886      889       +3     
  Partials       21       21              
Impacted Files Coverage Δ
src/faker.ts 100.00% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)
src/modules/address/index.ts 99.82% <100.00%> (ø)
src/modules/animal/index.ts 100.00% <100.00%> (ø)
src/modules/color/index.ts 99.73% <100.00%> (ø)
src/modules/commerce/index.ts 100.00% <100.00%> (ø)
src/modules/company/index.ts 100.00% <100.00%> (ø)
src/modules/database/index.ts 100.00% <100.00%> (ø)
src/modules/datatype/index.ts 96.24% <100.00%> (ø)
src/modules/date/index.ts 99.10% <100.00%> (-0.01%) :arrow_down:
... and 19 more

codecov[bot] avatar May 07 '22 15:05 codecov[bot]

https://github.com/faker-js/faker/discussions/805#discussioncomment-2599628

ST-DDT avatar May 07 '22 16:05 ST-DDT

@pkuczynski Could you go through this PR/code and reevaluate if you REALLY want to have the modules renamed not to suffixed with Module? I still don't think your initial thought that it could conflict with node's modules is valid in any case. Beside that, I personally find it confusing to name modules everywhere modules but then the module itself is not named module but faker were it actually is not e.g. a sub-instance of Faker. It can be even more confusing if we have later a MinimalFaker, BaseFaker, Faker. (See https://github.com/faker-js/faker/discussions/805#discussioncomment-2690233)

And then we would even have a FakeFaker 👀 confusing like hell 🤷

Shinigami92 avatar May 07 '22 16:05 Shinigami92

not to suffixed with Module?

I think so too, it should be named like what it does and not what generically is. Also in the long run, a module will never be independent, a xxxFaker might.

And then we would even have a FakeFaker 👀 confusing like hell 🤷

No, because fake -> helpers.fake

ST-DDT avatar May 07 '22 16:05 ST-DDT

Would it be possible to integrate this change as a non-breaking change? Maybe with some proxy magic and deprecation of the current classes (in the constructor)?

xDivisionByZerox avatar Aug 21 '22 10:08 xDivisionByZerox

Would it be possible to integrate this change as a non-breaking change? Maybe with some proxy magic and deprecation of the current classes (in the constructor)?

The classes have never been part of the API, so not sure if that is worth it.

ST-DDT avatar Aug 21 '22 13:08 ST-DDT

Team decision

We will use XyzModule.

ST-DDT avatar Sep 08 '22 15:09 ST-DDT