Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint error Emitter not found in 'mitt' import/named #132

Closed
barnholdy opened this issue May 4, 2021 · 1 comment
Closed

eslint error Emitter not found in 'mitt' import/named #132

barnholdy opened this issue May 4, 2021 · 1 comment

Comments

@barnholdy
Copy link

import mitt, { Emitter } from 'mitt'

gives me eslint error Emitter not found in 'mitt' import/named (https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md)

Where it should work (see: https://github.com/developit/mitt/blob/master/src/index.ts#L15).

Any ideas what is going wrong?

// .eslintrc.js

module.exports = {
  root: true,
  env: {
    browser: true,
    node: true,
  },
  extends: [
    '@nuxtjs/eslint-config-typescript',
    'prettier',
    'plugin:prettier/recommended',
    'plugin:nuxt/recommended',
  ],
  plugins: ['prettier'],
  rules: {},
}

@developit
Copy link
Owner

This is the expected behavior of eslint-plugin-import, see this PR:
import-js/eslint-plugin-import#1726

The recommendation from the maintainers of eslint-plugin-import is to use type imports, or disable import/named globally:

import mitt from 'mitt'
import type { Emitter } from 'mitt'  // this is a type-only import and will be ignored by `import/named`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants