Skip to content

Commit 0f3a308

Browse files
author
Alexej Yaroshevich
committed
jscsrc: add requireNewlineAfterDescription rule
1 parent 3bb3c22 commit 0f3a308

18 files changed

+64
-23
lines changed

.jscsrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"checkRedundantReturns": true,
3131
"requireReturnTypes": true,
3232
"checkTypes": "strictNativeCase",
33-
"checkRedundantAccess": true
33+
"checkRedundantAccess": true,
34+
"requireNewlineAfterDescription": true
3435
}
3536
}

lib/esprima-helpers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var scopeNodeTypes = [
1010

1111
/**
1212
* Search for the closest scope node tree for Node
13+
*
1314
* @param {{type: string}} n
1415
* @returns {EsprimaNode}
1516
*/

lib/jsdoc.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = {
4141

4242
/**
4343
* jsdoc comment object
44+
*
4445
* @param {string} value
4546
* @param {{start: DocLocation}} loc
4647
* @constructor
@@ -103,6 +104,7 @@ function DocComment(value, loc) {
103104

104105
/**
105106
* Simple jsdoc tag object
107+
*
106108
* @param {Object} tag object from comment parser, fields: tag, line, value, name, type, description
107109
* @param {DocLocation} loc
108110
* @constructor
@@ -133,6 +135,7 @@ function DocTag(tag, loc) {
133135

134136
/**
135137
* Parses jsdoctype string and provides several methods to work with it
138+
*
136139
* @param {string} type
137140
* @param {DocLocation} loc
138141
* @constructor
@@ -156,7 +159,8 @@ function DocType(type, loc) {
156159
}
157160

158161
/**
159-
* match type
162+
* Match type
163+
*
160164
* @param {EsprimaNode} node
161165
* @returns {boolean}
162166
*/
@@ -178,6 +182,7 @@ function DocType(type, loc) {
178182

179183
/**
180184
* DocLocation
185+
*
181186
* @constructor
182187
* @param {number} line
183188
* @param {number} column
@@ -193,6 +198,7 @@ function DocLocation(line, column, rel) {
193198

194199
/**
195200
* Shift location by line and column
201+
*
196202
* @param {number|Object} line
197203
* @param {number} [column]
198204
* @returns {DocLocation}
@@ -207,6 +213,7 @@ DocLocation.prototype.shift = function(line, column) {
207213

208214
/**
209215
* Comment parsing helper
216+
*
210217
* @param {string} comment
211218
* @returns {Object}
212219
* @private
@@ -229,6 +236,7 @@ function _parseComment(comment) {
229236

230237
/**
231238
* analogue of str.match(/@(\S+)(?:\s+\{([^\}]+)\})?(?:\s+(\S+))?(?:\s+([^$]+))?/);
239+
*
232240
* @param {string} str raw jsdoc string
233241
* @returns {?Object} parsed tag node
234242
*/
@@ -444,6 +452,7 @@ function _iterateDocTypes(node, cb) {
444452

445453
/**
446454
* Converts AST jsDoc node to simple object
455+
*
447456
* @param {Object} node
448457
* @returns {!Array.<SimplifiedType>}
449458
* @see https://github.com/Kuniwak/jsdoctypeparser
@@ -463,6 +472,7 @@ var jsPrimitives = 'string number boolean null undefined Object Function Array D
463472

464473
/**
465474
* Compare parsed jsDocTypes with esprima node
475+
*
466476
* @param {SimplifiedType[]} variants - result of jsDocParseType
467477
* @param {Object} argument - esprima source code node
468478
*/

lib/rules/validate-jsdoc.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var validators = require('./validate-jsdoc/index');
66

77
/**
88
* Rule constructor
9+
*
910
* @this {module:jscs/Rule}
1011
* @constructor
1112
*/
@@ -15,6 +16,7 @@ module.exports.prototype = {
1516

1617
/**
1718
* Load all rules and init them
19+
*
1820
* @param {Object} options
1921
* @throws {Error} If options is not an Object
2022
*/
@@ -137,7 +139,8 @@ module.exports.prototype = {
137139
});
138140

139141
/**
140-
* send error to jscs
142+
* Send error to jscs
143+
*
141144
* @param {string} text
142145
* @param {number|DocLocation} relLine
143146
* @param {number} [relColumn]
@@ -157,6 +160,7 @@ module.exports.prototype = {
157160

158161
/**
159162
* Generates function with location fixing logic to send error to jscs
163+
*
160164
* @param {function(string, number|Object, ?number)} err
161165
* @param {DocTag} tag
162166
* @returns {function(string, number|Object, ?number)}
@@ -175,7 +179,8 @@ module.exports.prototype = {
175179
},
176180

177181
/**
178-
* caching scope search. todo: move to patchNodesInFile
182+
* Caching scope search. todo: move to patchNodesInFile
183+
*
179184
* @param {Object} node
180185
*/
181186
_getReturnStatementsForNode: function(node) {
@@ -199,6 +204,7 @@ module.exports.prototype = {
199204

200205
/**
201206
* Extends each node with helper properties
207+
*
202208
* @param {Object} file
203209
*/
204210
function patchNodesInFile(file) {
@@ -218,6 +224,7 @@ function patchNodesInFile(file) {
218224

219225
/**
220226
* Fetchs jsdoc block for this
227+
*
221228
* @this {module:esprima/Node}
222229
* @returns {DocComment}
223230
*/
@@ -231,6 +238,7 @@ function patchNodesInFile(file) {
231238

232239
/**
233240
* Finds DocComment in file before passed line number
241+
*
234242
* @param {number} line
235243
* @returns {?module:esprima/Node}
236244
*/

lib/rules/validate-jsdoc/check-annotations.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ validateAnnotations.configure = function(options) {
6565
};
6666

6767
/**
68-
* validator for annotations
68+
* Validator for annotations
69+
*
6970
* @param {JSCS.JSFile} file
7071
* @param {JSCS.Errors} errors
7172
*/

lib/rules/validate-jsdoc/check-param-names.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports.options = {
55
};
66

77
/**
8-
* validator for check-param-names
8+
* Validator for check-param-names
9+
*
910
* @param {(FunctionDeclaration|FunctionExpression)} node
1011
* @param {Function} err
1112
*/
@@ -31,7 +32,8 @@ function validateCheckParamNames(node, err) {
3132

3233
node.jsdoc.iterateByType(['param', 'arg', 'argument'],
3334
/**
34-
* tag checker
35+
* Tag checker
36+
*
3537
* @param {DocType} tag
3638
* @param {number} i index
3739
*/

lib/rules/validate-jsdoc/check-redundant-access.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module.exports.options = {
66
};
77

88
/**
9-
* validator for @access
9+
* Validator for @access
10+
*
1011
* @param {(FunctionDeclaration|FunctionExpression)} node
1112
* @param {Function} err
1213
*/

lib/rules/validate-jsdoc/check-redundant-params.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports.options = {
55
};
66

77
/**
8-
* validator for check-param-names
8+
* Validator for check-param-names
9+
*
910
* @param {(FunctionDeclaration|FunctionExpression)} node
1011
* @param {Function} err
1112
*/
@@ -18,7 +19,8 @@ function validateCheckParamNames(node, err) {
1819

1920
node.jsdoc.iterateByType(['param', 'arg', 'argument'],
2021
/**
21-
* tag checker
22+
* Tag checker
23+
*
2224
* @param {DocType} tag
2325
* @param {number} i index
2426
*/

lib/rules/validate-jsdoc/check-redundant-returns.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module.exports.options = {
66
};
77

88
/**
9-
* checking returns types
9+
* Checking returns types
10+
*
1011
* @param {(FunctionDeclaration|FunctionExpression)} node
1112
* @param {DocTag} tag
1213
* @param {Function} err

lib/rules/validate-jsdoc/check-return-types.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module.exports.options = {
66
};
77

88
/**
9-
* checking returns types
9+
* Checking returns types
10+
*
1011
* @param {(FunctionDeclaration|FunctionExpression)} node
1112
* @param {DocTag} tag
1213
* @param {Function} err

0 commit comments

Comments
 (0)