Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ExportMap] fix condition for checking if block comment #1234

Merged
merged 1 commit into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ExportMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function captureJsDoc(comments) {
// capture XSDoc
comments.forEach(comment => {
// skip non-block comments
if (comment.value.slice(0, 4) !== '*\n *') return
if (comment.type !== 'Block') return
try {
doc = doctrine.parse(comment.value, { unwrap: true })
} catch (err) {
Expand Down
24 changes: 20 additions & 4 deletions tests/src/core/getExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ describe('ExportMap', function () {

context('deprecation metadata', function () {

function jsdocTests(parseContext) {
function jsdocTests(parseContext, lineEnding) {
context('deprecated imports', function () {
let imports
before('parse file', function () {
const path = getFilename('deprecated.js')
, contents = fs.readFileSync(path, { encoding: 'utf8' })
, contents = fs.readFileSync(path, { encoding: 'utf8' }).replace(/[\r]\n/g, lineEnding)
imports = ExportMap.parse(path, contents, parseContext)

// sanity checks
Expand Down Expand Up @@ -191,7 +191,15 @@ describe('ExportMap', function () {
attachComment: true,
},
settings: {},
})
}, '\n')
jsdocTests({
parserPath: 'espree',
parserOptions: {
sourceType: 'module',
attachComment: true,
},
settings: {},
}, '\r\n')
})

context('babel-eslint', function () {
Expand All @@ -202,7 +210,15 @@ describe('ExportMap', function () {
attachComment: true,
},
settings: {},
})
}, '\n')
jsdocTests({
parserPath: 'babel-eslint',
parserOptions: {
sourceType: 'module',
attachComment: true,
},
settings: {},
}, '\r\n')
})
})

Expand Down