1 |
|
2 |
|
3 | // our stampit modules
|
4 | var stampit = require( 'stampit' )
|
5 |
|
6 | // let there be light ( * )
|
7 | // basically, with stampit we take a bunch of different objects
|
8 | // and methods and compose them into one mega object, the app
|
9 | // appropriately namespaced, with methods on the prototype, and this set correctly
|
10 | // basic app flow below
|
11 | // init() -> read() -> parse() -> lint() -> done()
|
12 | // init() -> watch() -> read() -> parse() -> lint() -> done()
|
13 |
|
14 |
|
15 | /**
|
16 | * main stylint kickoff function
|
17 | * @param {string} path [custom path if used programmatically]
|
18 | * @param {object} config [config if used programmatically]
|
19 | * @return {Object} [the composed stylint object]
|
20 | */
|
21 | var Stylint = function( path, config, callback ) {
|
22 | var Lint
|
23 |
|
24 | Lint = stampit().compose(
|
25 | require( './src/core/' ),
|
26 | require( './src/checks/' ),
|
27 | require( './src/state/' ),
|
28 | stampit().enclose( function() {
|
29 | this.state.path = typeof path === 'string' ? path : './'
|
30 | this.customConfig = typeof config === 'object' ? config : false
|
31 | this.callback = callback || function() {}
|
32 | } ).enclose( require( './src/core/init' ) )
|
33 | )
|
34 |
|
35 | return Lint
|
36 | }
|
37 |
|
38 | module.exports = Stylint
|