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

About project structure #22

Closed
tunnckoCore opened this issue May 8, 2015 · 4 comments
Closed

About project structure #22

tunnckoCore opened this issue May 8, 2015 · 4 comments

Comments

@tunnckoCore
Copy link

All in src looks strange. That __tests__ directories...

__tests__ in src, __tests__ in rules, __tests__ in rules/declaration* and etc..

Also for things like that index.js in rules directory you can use some of them

  • export-files: node.js utility for exporting a directory of files as modules.
  • export-dirs: Export directories and their files as node.js modules.
  • to-exports: Create exports from a directory of non-javascript or javascript files.

You should firstly start with that thing.

@MoOx
Copy link
Contributor

MoOx commented May 8, 2015

__tests__ is a common pattern used by big projects like react. It avoid to get a huge test folder with duplicated tree structure and ensure modularity of the components. Like having multiples .md files near the corresponding code.

For the index.js we might be able to get rid of it using some others tricks that this kind of exports.
I will think about it.

@tunnckoCore
Copy link
Author

duplicated tree structure and ensure modularity of the components

omg. now tree structure is duplicated and confusing, lol
its enough to have just one test/ folder and in her to have fixtures/ or something..

@MoOx
Copy link
Contributor

MoOx commented May 8, 2015

src/rules/*.js
test/rules/*.js
docs/rules/*.js

vs

src/rules/*/*.js
src/rules/*/*.md
src/rules/*/__tests__/*.js

To write decoupled code it make more sense to me.

omg. now tree structure is duplicated and confusing, lol

I work with a lot of people in different teams that like this way that encourage modularity.

Sometimes __tests__ is test but it doesn't change the way files are arranged.
The most I work with fixtures, the more I like to write tiny decoupled components that have fixtures embed in the tests. Like here stylelint already does and eslint does too.
An good example of painful fixtures to maintain is my cssnext project (btw I will change that soon).
es6 template string (multilines string) might help too to have embed fixtures.

@davidtheclark
Copy link
Contributor

I also think that having tests right there next to the thing they're testing makes sense for this project, which will end up having so many relatively independent little parts.

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

No branches or pull requests

3 participants