Skip to content

Commit 0f60875

Browse files
committed
chore: move declarations to visitor function and other clean-up
--- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 6973674 commit 0f60875

File tree

1 file changed

+9
-7
lines changed
  • lib/node_modules/@stdlib/_tools/remark/plugins/remark-lint-expected-html-sections/lib

1 file changed

+9
-7
lines changed

lib/node_modules/@stdlib/_tools/remark/plugins/remark-lint-expected-html-sections/lib/linter.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ var keys = require( '@stdlib/utils/keys' );
2828
// VARIABLES //
2929

3030
var debug = logger( 'remark-lint-expected-html-sections' );
31-
var SECTION_START = /<section(?:\s+class="([^"]*)")?>/;
31+
var RE_SECTION_START = /<section(?:\s+class="([^"]*)")?>/;
32+
var RE_SECTION_END = /<\/section>/;
3233

3334

3435
// MAIN //
@@ -56,12 +57,9 @@ function factory( options ) {
5657
var requiredRootSections;
5758
var requiredCSections;
5859
var sectionStructure;
59-
var currentSection;
6060
var sectionsFound;
6161
var sectionStack;
62-
var sectionMatch;
6362
var missingRoot;
64-
var className;
6563
var missingC;
6664
var schema;
6765
var msg;
@@ -135,10 +133,14 @@ function factory( options ) {
135133
* @returns {void}
136134
*/
137135
function visitor( node ) {
136+
var currentSection;
137+
var sectionMatch;
138+
var className;
139+
138140
// Check if this is a section start tag:
139-
sectionMatch = SECTION_START.exec( node.value );
141+
sectionMatch = RE_SECTION_START.exec( node.value );
140142
if ( sectionMatch ) {
141-
className = sectionMatch[1] || '';
143+
className = sectionMatch[ 1 ] || '';
142144

143145
debug( 'Found section with class: %s', className );
144146

@@ -169,7 +171,7 @@ function factory( options ) {
169171
sectionStack.push( currentSection );
170172
}
171173
// Check if this is a section end tag:
172-
else if ( /<\/section>/.test( node.value ) ) {
174+
else if ( RE_SECTION_END.test( node.value ) ) {
173175
if ( sectionStack.length > 0 ) {
174176
sectionStack.pop();
175177
}

0 commit comments

Comments
 (0)