HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptMinor

Writing a jQuery widget: Code layout

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
writinglayoutjquerycodewidget

Problem

I'm doing my first major jQuery development. It's a Widget for recurring events, and is as such a fairly complex beast. The full code is available at https://github.com/collective/jquery.recurrenceinput.js for those who want to check it out. I appreciate any kind of feedback about any part of the code, so anyone who wants to take a look at it, that would be awesome.

I have a couple of specific questions, and it seems best to put them as separate posts, so here is the first one:

Does my directory layout fit with what a jQuery developer would expect? Is it "best practice"?

The directory structure is this (somewhat simplified):

demo // Files to run the demo/tests:
    delete.png
    jquery.recurrenceinput.css
    overlays.css
    undelete.png
    input.html
    jquery.tools.dateinput.css
    pb_close.png

lib // jQuery files:
    jquery-1.4.2.js
    jquery.tmpl-beta1.js
    jquery.tools.dateinput-1.2.5.js
    jquery.tools.overlay-1.2.5.js
    jquery.utils.i18n-0.8.5.js

src // Actual code
    jquery.recurrenceinput.display.js
    jquery.recurrenceinput.form.js
    jquery.recurrenceinput.js

tests // Tests and supporting files

    jslint.js
    qunit.css
    qunit.js
    test.html
    tests.js

README.rst

Solution

lib is not really lib, but your project's dependencies. Normally you'd call it vendor

tests -> test. This one is just a convention.

I took a quick look at your code and the first thing I saw was snake_case. JS/jQuery convention is to use CamelCase.

Context

StackExchange Code Review Q#5371, answer score: 2

Revisions (0)

No revisions yet.