This repository was archived by the owner on May 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ describe('index', () => {
88 it ( 'works with example app' , ( ) => {
99 const spec = parseComments ( {
1010 cwd : path . join ( __dirname , '../example/src' ) ,
11- verbose : true ,
11+ verbose : false ,
1212 throwLevel : 'warn' ,
1313 } ) ;
1414
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import fs from 'fs';
22import path from 'path' ;
33
44import jsYaml from 'js-yaml' ;
5+ import parseComments , { stringify } from 'comment-parser' ;
56
67import commentsToOpenApi from './commentsToOpenApi' ;
78import { OpenApiObject } from '../exported' ;
@@ -69,16 +70,14 @@ function parseFile(
6970 } ;
7071 }
7172 } else {
72- const messages = linter . verify ( fileContent , {
73- env : {
74- es6 : true ,
75- node : true ,
76- } ,
73+ const jsDocComments = parseComments ( fileContent ) ;
7774
78- parserOptions : {
79- ecmaVersion : 2018 ,
80- sourceType : 'module' ,
81- } ,
75+ const rawCommentString = jsDocComments . reduce ( ( acc , c ) => {
76+ acc += '\n' + stringify ( [ c ] ) ;
77+ return acc ;
78+ } , '' ) ;
79+
80+ const messages = linter . verify ( rawCommentString , {
8281 rules : {
8382 warnings : 'warn' ,
8483 errors : 'error' ,
You can’t perform that action at this time.
0 commit comments