Skip to content

Commit

Permalink
[Refactor] avoid using deprecated eslint api sourceCode.getComments
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot committed Apr 2, 2020
1 parent ffc7bdd commit 375b82a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rules/dynamic-import-chunkname.js
Expand Up @@ -42,7 +42,9 @@ module.exports = {

const sourceCode = context.getSourceCode()
const arg = node.arguments[0]
const leadingComments = sourceCode.getComments(arg).leading
const leadingComments = sourceCode.getCommentsBefore
? sourceCode.getCommentsBefore(arg) // This method is availabe in ESLint >= 4.
: sourceCode.getComments(arg).leading // This method is deprecated in ESLint 7.

if (!leadingComments || leadingComments.length === 0) {
context.report({
Expand Down

0 comments on commit 375b82a

Please sign in to comment.