Skip to content

Commit 85790ea

Browse files
committed
chore: move function to outer scope and replace tab character
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent ac2de21 commit 85790ea

File tree

1 file changed

+31
-31
lines changed
  • lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-no-space-aligned-asterisks/lib

1 file changed

+31
-31
lines changed

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-no-space-aligned-asterisks/lib/main.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,51 +60,51 @@ function main( context ) {
6060
lines = comment.value.split( reEOL.REGEXP );
6161
for ( i = 0; i < lines.length; i++ ) {
6262
if ( lines[ i ].charAt( 0 ) === ' ' ) {
63-
hasLeadingSpace = true;
63+
hasLeadingSpace = true;
6464
break;
6565
}
6666
}
6767
if ( hasLeadingSpace ) {
6868
report( comment.value, comment.loc, comment.range );
6969
}
7070
}
71-
72-
/**
73-
* Reports the error message.
74-
*
75-
* @private
76-
* @param {string} comment - comment text
77-
* @param {Object} loc - location of comment node
78-
* @param {Array} range - comment range
79-
*/
80-
function report( comment, loc, range ) {
81-
context.report({
82-
'node': null,
83-
'message': 'JSDoc comment should not have space-aligned asterisks',
84-
'loc': loc,
85-
'fix': fix
86-
});
87-
88-
/**
89-
* Fixes the lint error by removing leading spaces before asterisks.
90-
*
91-
* @private
92-
* @param {Function} fixer - ESLint fixer
93-
* @returns {(Object|null)} fix or null
94-
*/
95-
function fix( fixer ) {
96-
var fixed = replace( comment, RE_LEADING_SPACE, '*' );
97-
fixed = '/*' + fixed + '*/';
98-
return fixer.replaceTextRange( range, fixed );
99-
}
100-
}
10171
}
10272

10373
return {
10474
'Program:exit': validate,
10575
'FunctionDeclaration': validate,
10676
'FunctionExpression': validate
10777
};
78+
79+
/**
80+
* Reports the error message.
81+
*
82+
* @private
83+
* @param {string} comment - comment text
84+
* @param {Object} loc - location of comment node
85+
* @param {Array} range - comment range
86+
*/
87+
function report( comment, loc, range ) {
88+
context.report({
89+
'node': null,
90+
'message': 'JSDoc comment should not have space-aligned asterisks',
91+
'loc': loc,
92+
'fix': fix
93+
});
94+
95+
/**
96+
* Fixes the lint error by removing leading spaces before asterisks.
97+
*
98+
* @private
99+
* @param {Function} fixer - ESLint fixer
100+
* @returns {(Object|null)} fix or null
101+
*/
102+
function fix( fixer ) {
103+
var fixed = replace( comment, RE_LEADING_SPACE, '*' );
104+
fixed = '/*' + fixed + '*/';
105+
return fixer.replaceTextRange( range, fixed );
106+
}
107+
}
108108
}
109109

110110

0 commit comments

Comments
 (0)