Skip to content

no-unused-disable autofixing does not properly work #21

Closed
@ehmicky

Description

@ehmicky

This problem appeared in 3.1.0, i.e. was introduced by #13.

Input:

'use strict'

var values = [1, 2]

/* eslint-disable max-nested-callbacks */
values.map(function(value) {
  return values.map(function(otherValue) {
    return value + otherValue
  })
})
/* eslint-enable max-nested-callbacks */

Then eslint --fix file.js. Output:

'use strict'

var values = [1, 2]


values.map(function(value) {
  return values.map(function(otherValue) {
    return value + otherValue
  })
})
/* eslint-enable max-nested-callbacks */

Note that the following works:

'use strict'

var values = [1, 2]

// eslint-disable max-nested-callbacks
values.map(function(value) {
  return values.map(function(otherValue) {
    return value + otherValue
  })
})

.eslintrc.yml:

plugins: [eslint-comments]

rules:
  eslint-comments/no-unused-disable: 2

Versions:

$ eslint --version
v5.13.0
$ npm ls eslint-plugin-eslint-comments
[email protected] /home/me/my-package
└── [email protected]
$ node --version
v11.9.0 

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions