-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework jsdoc rules validators, implement comment-parser
- Loading branch information
Alexej Yaroshevich
committed
Aug 21, 2014
1 parent
4b2dfad
commit 6b499e3
Showing
11 changed files
with
124 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
param: require('./param'), | ||
returns: require('./returns') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "jscs-jsdoc", | ||
"author": "Alexej Yaroshevich <[email protected]>", | ||
"description": "JSCS jsdoc plugin", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "lib/index", | ||
"homepage": "https://github.com/zxqfox/jscs-jsdoc", | ||
"license": "MIT", | ||
|
@@ -20,20 +20,23 @@ | |
"node": ">= 0.8.0" | ||
}, | ||
"dependencies": { | ||
"doctrine": "~0.5.0" | ||
"comment-parser": "zxqfox/comment-parser#jscs-jsdoc", | ||
"doctrine": "^0.5.2" | ||
}, | ||
"devDependencies": { | ||
"jscs": ">=1.3.0 <2.0", | ||
"jshint": "~2.4.4", | ||
"browserify": "~3.30.2", | ||
"chai": "^1.9.1", | ||
"esprima": "^1.2.2", | ||
"jscs": ">=1.3.0 <2.0", | ||
"jshint": "~2.5.4", | ||
"mocha": "~1.17.1" | ||
}, | ||
"peerDependencies": { | ||
"jscs": ">=1.3.0 <2.0" | ||
}, | ||
"scripts": { | ||
"lint": "jshint . && jscs lib test", | ||
"test": "npm run lint && mocha -u bdd -R spec", | ||
"test": "npm run lint && mocha", | ||
"browserify": "browserify --standalone JscsPluginJsdoc lib/index.js -o jscs-jsdoc-browser.js" | ||
}, | ||
"files": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var parse = require('comment-parser'); | ||
|
||
global.parse = parse; | ||
global.fnBody = fnBody; | ||
|
||
function fnBody(func) { | ||
var str = func.toString(); | ||
var out = str.slice( | ||
str.indexOf('{') + 1, | ||
str.lastIndexOf('}') | ||
); | ||
|
||
// strip trailing spaces and tabs | ||
out = out.replace(/^\n*|[ \t]*$/g, ''); | ||
|
||
// strip preceding indentation | ||
var blockIndent = 0; | ||
out.match(/^([ \t]*)/gm).map(function (v) { | ||
if (!blockIndent || (v.length > 0 && v.length < blockIndent)) { | ||
blockIndent = v.length; | ||
} | ||
}); | ||
|
||
// rebuild block without inner indent | ||
out = !blockIndent ? out : out.split('\n').map(function (v) { | ||
return v.substr(blockIndent); | ||
}).join('\n'); | ||
|
||
return out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
-u bdd -R spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters