Search code examples
javascriptlodasheslint

What does Import members from the full Lodash module mean


import _ from 'lodash';

const foo = _.range(3);

But ESLint is giving the error "ESLint: Import members from the full Lodash module.(lodash/import-scope)"


Solution

  • You need to extract only the modules you need to make the code more efficient and semantic like so:

    import { range } from 'lodash'
    

    or

    import range from 'lodash/range'
    

    edited by VLAZ's suggestion.

    more info: https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/import-scope.md