Skip to content

Commit 4fc9559

Browse files
committed
Fix code-style
1 parent a31d5ad commit 4fc9559

File tree

2 files changed

+35
-135
lines changed

2 files changed

+35
-135
lines changed

.jscs.json

Lines changed: 14 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@
55
"unist-util-inspect.js",
66
"unist-util-inspect.min.js"
77
],
8+
"preset": "yandex",
9+
"requireQuotedKeysInObjects": true,
10+
"disallowQuotedKeysInObjects": false,
11+
"maximumLineLength": {
12+
"value": 79,
13+
"allExcept": [
14+
"regex",
15+
"urlComments"
16+
]
17+
},
818
"jsDoc": {
919
"checkAnnotations": "jsdoc3",
20+
"checkParamExistence": true,
1021
"checkParamNames": true,
1122
"checkRedundantAccess": true,
1223
"checkRedundantParams": true,
@@ -16,126 +27,9 @@
1627
"enforceExistence": true,
1728
"requireHyphenBeforeDescription": true,
1829
"requireNewlineAfterDescription": true,
30+
"requireParamDescription": true,
1931
"requireParamTypes": true,
32+
"requireReturnDescription": true,
2033
"requireReturnTypes": true
21-
},
22-
"requireCurlyBraces": [
23-
"if",
24-
"else",
25-
"for",
26-
"while",
27-
"do",
28-
"try",
29-
"catch"
30-
],
31-
"requireSpaceAfterKeywords": [
32-
"if",
33-
"else",
34-
"for",
35-
"while",
36-
"do",
37-
"switch",
38-
"return",
39-
"try",
40-
"catch"
41-
],
42-
"requireSpaceBeforeBlockStatements": true,
43-
"requireParenthesesAroundIIFE": true,
44-
"requireSpacesInConditionalExpression": true,
45-
"requireSpacesInFunctionExpression": {
46-
"beforeOpeningCurlyBrace": true
47-
},
48-
"requireSpacesInAnonymousFunctionExpression": {
49-
"beforeOpeningRoundBrace": true,
50-
"beforeOpeningCurlyBrace": true
51-
},
52-
"requireSpacesInNamedFunctionExpression": {
53-
"beforeOpeningRoundBrace": true,
54-
"beforeOpeningCurlyBrace": true
55-
},
56-
"requireBlocksOnNewline": true,
57-
"disallowEmptyBlocks": true,
58-
"disallowSpacesInsideObjectBrackets": true,
59-
"disallowSpacesInsideArrayBrackets": true,
60-
"disallowSpacesInsideParentheses": true,
61-
"requireSpacesInsideObjectBrackets": "all",
62-
"disallowDanglingUnderscores": true,
63-
"disallowSpaceAfterObjectKeys": true,
64-
"requireCommaBeforeLineBreak": true,
65-
"requireOperatorBeforeLineBreak": [
66-
"?",
67-
"+",
68-
"-",
69-
"/",
70-
"*",
71-
"=",
72-
"==",
73-
"===",
74-
"!=",
75-
"!==",
76-
">",
77-
">=",
78-
"<",
79-
"<="
80-
],
81-
"requireSpaceBeforeBinaryOperators": [
82-
"+",
83-
"-",
84-
"/",
85-
"*",
86-
"=",
87-
"==",
88-
"===",
89-
"!=",
90-
"!=="
91-
],
92-
"requireSpaceAfterBinaryOperators": [
93-
"+",
94-
"-",
95-
"/",
96-
"*",
97-
"=",
98-
"==",
99-
"===",
100-
"!=",
101-
"!=="
102-
],
103-
"disallowSpaceAfterPrefixUnaryOperators": [
104-
"++",
105-
"--",
106-
"+",
107-
"-",
108-
"~",
109-
"!"
110-
],
111-
"disallowSpaceBeforePostfixUnaryOperators": [
112-
"++",
113-
"--"
114-
],
115-
"disallowImplicitTypeConversion": [
116-
"numeric",
117-
"boolean",
118-
"binary",
119-
"string"
120-
],
121-
"requireCamelCaseOrUpperCaseIdentifiers": true,
122-
"disallowKeywords": [
123-
"with"
124-
],
125-
"disallowMultipleLineStrings": true,
126-
"disallowMultipleLineBreaks": true,
127-
"validateLineBreaks": "LF",
128-
"validateQuoteMarks": "'",
129-
"disallowMixedSpacesAndTabs": true,
130-
"disallowTrailingWhitespace": true,
131-
"disallowTrailingComma": true,
132-
"disallowKeywordsOnNewLine": [
133-
"else"
134-
],
135-
"requireLineFeedAtFileEnd": true,
136-
"maximumLineLength": 78,
137-
"requireCapitalizedConstructors": true,
138-
"safeContextKeyword": "self",
139-
"requireDotNotation": true,
140-
"disallowYodaConditions": true
34+
}
14135
}

index.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ var isEmpty = require('is-empty');
2323
/**
2424
* Factory to wrap values in ANSI colours.
2525
*
26-
* @param {string} open
27-
* @param {string} close
28-
* @return {function(string): string}
26+
* @param {string} open - Opening sequence.
27+
* @param {string} close - Closing sequence.
28+
* @return {function(string): string} - Bound function.
2929
*/
3030
function ansiColor(open, close) {
3131
return function (value) {
@@ -56,8 +56,8 @@ var COLOR_EXPRESSION = new RegExp(
5656
/**
5757
* Remove ANSI colour from `value`.
5858
*
59-
* @param {string} value
60-
* @return {string}
59+
* @param {string} value - Value to strip.
60+
* @return {string} - Stripped value.
6161
*/
6262
function stripColor(value) {
6363
return value.replace(COLOR_EXPRESSION, '');
@@ -77,8 +77,8 @@ var STOP = CHAR_SPLIT + CHAR_HORIZONTAL_LINE + ' ';
7777
/**
7878
* Colored nesting formatter.
7979
*
80-
* @param {string} value
81-
* @return {string}
80+
* @param {string} value - Value to format as nesting.
81+
* @return {string} - Formatted value.
8282
*/
8383
function formatNesting(value) {
8484
return dim(value);
@@ -120,7 +120,11 @@ function stringify(start, end) {
120120
var positions = [];
121121
var offsets = [];
122122

123-
/** Add a position. */
123+
/**
124+
* Add a position.
125+
*
126+
* @param {Position} position - Position to add.
127+
*/
124128
function add(position) {
125129
var tuple = compile(position);
126130

@@ -134,7 +138,7 @@ function stringify(start, end) {
134138
}
135139

136140
add(start);
137-
add(end)
141+
add(end);
138142

139143
if (positions.length) {
140144
values.push(positions.join('-'));
@@ -150,8 +154,8 @@ function stringify(start, end) {
150154
/**
151155
* Colored node formatter.
152156
*
153-
* @param {Node} node
154-
* @return {string}
157+
* @param {Node} node - Node to format.
158+
* @return {string} - Formatted node.
155159
*/
156160
function formatNode(node) {
157161
var log = node.type;
@@ -178,8 +182,9 @@ function formatNode(node) {
178182
/**
179183
* Inspects a node.
180184
*
181-
* @this {Node}
182-
* @return {string}
185+
* @param {Node} node - Node to inspect.
186+
* @param {string?} [pad] - Padding.
187+
* @return {string} - Formatted node.
183188
*/
184189
function inspect(node, pad) {
185190
var result;
@@ -237,8 +242,9 @@ function inspect(node, pad) {
237242
/**
238243
* Inspects a node, without using color.
239244
*
240-
* @return {string}
241-
* @this {Node}
245+
* @param {Node} node - Node to inspect.
246+
* @param {string?} [pad] - Padding.
247+
* @return {string} - Formatted node.
242248
*/
243249
function noColor(node, pad) {
244250
return stripColor(inspect(node, pad));

0 commit comments

Comments
 (0)