Skip to content

Commit bec8625

Browse files
committed
Update wording
1 parent 3f7084f commit bec8625

File tree

6 files changed

+26
-27
lines changed

6 files changed

+26
-27
lines changed

etc/eslint/rules/stdlib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ rules[ 'stdlib/jsdoc-definition-spacing' ] = 'error';
606606
rules[ 'stdlib/jsdoc-doctest' ] = 'error';
607607

608608
/**
609-
* Ensure that (only) return annotations for floating-point typed values always contain decimal points.
609+
* Ensure that only return annotations for real-valued return values always contain decimal points.
610610
*
611611
* @name jsdoc-doctest-decimal-point
612612
* @memberof rules

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# jsdoc-doctest-decimal-point
2222

23-
> [ESLint rule][eslint-rules] to enforce that (only) return annotations for floating-point typed values always contain decimal points.
23+
> [ESLint rule][eslint-rules] to ensure that only return annotations for real-valued return values always contain decimal points.
2424
2525
<section class="intro">
2626

@@ -38,7 +38,7 @@ var rule = require( '@stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point' );
3838

3939
#### rule
4040

41-
[ESLint rule][eslint-rules] to enforce that (only) return annotations for floating-point typed values always contain decimal points.
41+
[ESLint rule][eslint-rules] to ensure that only return annotations for real-valued return values always contain decimal points.
4242

4343
**Bad**:
4444

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* ESLint rule to enforce that (only) return annotations for floating-point typed values always contain decimal points.
22+
* ESLint rule to ensure that only return annotations for real-valued return values always contain decimal points.
2323
*
2424
* @module @stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point
2525
*

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point/lib/main.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@ var rule;
5353
*
5454
* @private
5555
* @param {string} comment - return annotation
56-
* @param {boolean} includeDP - boolean indicating whether annotation must include decimal point
56+
* @param {boolean} flg - boolean indicating whether annotation must include decimal point
5757
* @returns {string} fixed return annotation
5858
*/
59-
function createReplacement( comment, includeDP ) {
60-
if ( includeDP ) {
59+
function createReplacement( comment, flg ) {
60+
if ( flg ) {
6161
return replace( comment, RE_DECIMAL, '$1.0$2' );
6262
}
6363
return replace( comment, RE_DECIMAL, '$1$2' );
6464
}
6565

6666
/**
67-
* Checks the return value type for whether return annotations should include a decimal point or not.
67+
* Checks the return value type for whether return annotations should include a decimal point.
6868
*
6969
* @private
7070
* @param {string} type - type name
71-
* @returns {(boolean|null)} for numbers, a boolean indicating whether return annotation value should include a decimal point or not, `null` otherwise
71+
* @returns {(boolean|null)} for numbers, a boolean indicating whether return annotation value should include a decimal point, `null` otherwise
7272
*/
7373
function checkType( type ) {
7474
if ( contains( FLOAT_TYPES, type ) ) {
@@ -81,15 +81,15 @@ function checkType( type ) {
8181
}
8282

8383
/**
84-
* Checks whether a comment is a return annotation and, if so, whether it (only) includes decimal points for floating-point typed return values.
84+
* Checks whether a comment is a return annotation and, if so, whether it only includes decimal points for real-valued return values.
8585
*
8686
* @private
8787
* @param {string} comment - comment to examine
88-
* @param {string} returnType - JSDoc return type
89-
* @param {boolean} includeDP - boolean indicating whether annotation must include decimal point
88+
* @param {string} rType - JSDoc return type
89+
* @param {boolean} flg - boolean indicating whether annotation must include decimal point
9090
* @returns {(string|null)} error message or null
9191
*/
92-
function checkComment( comment, returnType, includeDP ) {
92+
function checkComment( comment, rType, flg ) {
9393
var matches;
9494
var str;
9595
var val;
@@ -98,27 +98,27 @@ function checkComment( comment, returnType, includeDP ) {
9898
matches = str.match( RE_ANNOTATION );
9999
if ( matches ) {
100100
val = matches[ 1 ];
101-
if ( includeDP ) {
101+
if ( flg ) {
102102
if ( RE_NUMBER.test( val ) && !contains( val, '.' ) ) {
103-
return '`//'+str+'` should be `//'+createReplacement( str, includeDP )+'` (return annotations for values of type `'+returnType+'` must always include a decimal point)';
103+
return '`//'+str+'` should be `//'+createReplacement( str, flg )+'` (return annotations for values of type `'+rType+'` must always include a decimal point)';
104104
}
105105
}
106106
else if ( contains( val, '.0' ) ) {
107-
return '`//'+str+'` should be `//'+createReplacement( str, includeDP )+'` (return annotations for values of type `'+returnType+'` must NOT include a decimal point)';
107+
return '`//'+str+'` should be `//'+createReplacement( str, flg )+'` (return annotations for values of type `'+rType+'` must NOT include a decimal point)';
108108
}
109109
}
110110
return null;
111111
}
112112

113113
/**
114-
* Rule for validating that (only) return annotations for floating-point typed values always contain decimal points.
114+
* Rule for validating that only return annotations for real-valued return values always contain decimal points.
115115
*
116116
* @param {Object} context - ESLint context
117117
* @returns {Object} validators
118118
*/
119119
function main( context ) {
120-
var includeDP = false;
121120
var source = context.getSourceCode();
121+
var flg = false;
122122

123123
/**
124124
* Reports the error message.
@@ -135,17 +135,17 @@ function main( context ) {
135135
}
136136

137137
/**
138-
* Checks whether (only) return annotations for floating-point typed values always contain decimal points.
138+
* Checks whether only return annotations for real-valued return values always contain decimal points.
139139
*
140140
* @private
141141
* @param {ASTNode} node - node to examine
142142
*/
143143
function validate( node ) {
144-
var returnType;
145144
var comments;
146145
var current;
147146
var jsdoc;
148147
var descr;
148+
var rType;
149149
var tags;
150150
var ast;
151151
var msg;
@@ -161,9 +161,9 @@ function main( context ) {
161161
return;
162162
}
163163
if ( tags[ 0 ].title === 'returns' ) {
164-
returnType = tags[ 0 ].type.name;
165-
includeDP = checkType( returnType );
166-
if ( isNull( includeDP ) ) {
164+
rType = tags[ 0 ].type.name;
165+
flg = checkType( rType );
166+
if ( isNull( flg ) ) {
167167
return;
168168
}
169169
} else {
@@ -191,7 +191,7 @@ function main( context ) {
191191
}
192192
for ( j = 0; j < comments.length; j++ ) {
193193
current = comments[ j ];
194-
msg = checkComment( current, returnType, includeDP );
194+
msg = checkComment( current, rType, flg );
195195
if ( msg ) {
196196
report( node, msg );
197197
}

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point",
33
"version": "0.0.0",
4-
"description": "ESLint rule to enforce that (only) return annotations for floating-point typed values always contain decimal points.",
4+
"description": "ESLint rule to ensure that only return annotations for real-valued return values always contain decimal points.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",
@@ -62,7 +62,6 @@
6262
"return",
6363
"comment",
6464
"annotation",
65-
"throws",
6665
"returns",
6766
"logs",
6867
"log",

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-doctest-decimal-point/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ tape( 'the function negatively validates code where not all return annotations i
7070
t.end();
7171
});
7272

73-
tape( 'the function does not validate comments nor return annotations outside of JSDoc examples', function test( t ) {
73+
tape( 'the function does not validate comments or return annotations outside of JSDoc examples', function test( t ) {
7474
var tester = new RuleTester();
7575

7676
try {

0 commit comments

Comments
 (0)