Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.

Commit 0f97470

Browse files
committed
fix eslint bug for typescript
1 parent c4c7f25 commit 0f97470

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

src/util/parseFile.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from 'fs';
22
import path from 'path';
33

44
import jsYaml from 'js-yaml';
5+
import parseComments, { stringify } from 'comment-parser';
56

67
import commentsToOpenApi from './commentsToOpenApi';
78
import { 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',

0 commit comments

Comments
 (0)