Skip to content

Commit

Permalink
no-duplicates: Add comment explaining ESLint <= 3 autofix disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Mar 31, 2019
1 parent 71a64c6 commit f47622c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/rules/no-duplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ function checkImports(imported, context) {
}

function getFix(first, rest, sourceCode) {
// Sorry ESLint <= 3 users, no autofix for you.
// Sorry ESLint <= 3 users, no autofix for you. Autofixing duplicate imports
// requires multiple `fixer.whatever()` calls in the `fix`: We both need to
// update the first one, and remove the rest. Support for multiple
// `fixer.whatever()` in a single `fix` was added in ESLint 4.1.
// `sourceCode.getCommentsBefore` was added in 4.0, so that's an easy thing to
// check for.
if (typeof sourceCode.getCommentsBefore !== 'function') {
return undefined
}
Expand Down

0 comments on commit f47622c

Please sign in to comment.