aladdin-add / eslint-plugin

autofix some errors reported by eslint rules.
107 stars 10 forks source link

no-unused-var rule creates invalid code (3) #58

Closed laurent22 closed 4 years ago

laurent22 commented 5 years ago

Tell us about your environment

In this file:

const { _ } = require('lib/locale.js');

class OneDriveApi {

    async example() {
        throw new Error(_('oops'));
    }
}

module.exports = { OneDriveApi };

The rule replaces the require statement to:

const {} = require('lib/locale.js');

Even though the underscore function is used in throw new Error(_('oops'));

aladdin-add commented 5 years ago

I was not able to repro the issue, see the commit https://github.com/aladdin-add/eslint-plugin/commit/a5687d2735702d28393c0a58ad191d2351e549a0

can you repro in the eslint demo page: https://eslint.org/demo, as we didn't modify the rule but adding a fixer.

aladdin-add commented 4 years ago

closing, as cannot be reproduced. please feel free to open a new issue if you encounter it again! :)