eugef / node-mocks-http

Mock 'http' objects for testing Express routing functions
Other
747 stars 131 forks source link

Importing produces ESlint warning `import/named` #269

Closed alvarlagerlof closed 1 year ago

alvarlagerlof commented 1 year ago

I have this line of code to import a few functions form this library.

import { createMocks, createRequest, createResponse } from 'node-mocks-http'

However, that gives me an ESLint warning like:

createResponse not found in 'node-mocks-http'eslintimport/named

I something wrong with the exports, or am I importing incorrectly? Thanks!

eugef commented 1 year ago

What version of the lib do you use?

Does the code actually work if you ignore eslint warning

alvarlagerlof commented 1 year ago

What version of the lib do you use?

1.12.2

Does the code actually work if you ignore eslint warning

Yes

eugef commented 1 year ago

Then I think it might be a problem with eslint configuration.

Library package.json doesn't contain module entry, so "import/named" rule should not be applied.

Note: for packages, the plugin will find exported names from https://github.com/jsforum/jsforum/issues/5 (deprecated) or module, if present in package.json. Redux's npm module includes this key, and thereby is lintable, for example.

alvarlagerlof commented 1 year ago

Then I think it might be a problem with eslint configuration.

Mine or ESLint itself? I just have a rule.

eugef commented 1 year ago

That I don't know.

alvarlagerlof commented 1 year ago

Maybe I'll have to ignore the error or something. I'm guessing you have no plans to move to ESM?

eugef commented 1 year ago

Not in the nearest future