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

create-vue + airbnb gives unresolved path to 'vitest/config' #53

Open
woodcoder opened this issue Mar 21, 2023 · 1 comment
Open

create-vue + airbnb gives unresolved path to 'vitest/config' #53

woodcoder opened this issue Mar 21, 2023 · 1 comment

Comments

@woodcoder
Copy link

Using create-vue to scaffold a vue3 JavaScript project with vitest using something like:

npm create [email protected]
yarn add --dev @vue/eslint-config-airbnb
vi vue-project/.eslintrc.cjs

Gives the following yarn lint error (amongst a couple of other, understandable syntax complaints):

vue-project/vitest.config.js
  3:46  error  Unable to resolve path to module 'vitest/config'  import/no-unresolved

However, running yarn vitest works - the import is fine.

I believe this is because the node_modules file is actually vitest/config.d.ts (which exports the js file in dist).
__

As a workaround I've been able to avoid the warning by specifying and adding .d.ts to the resolver's extensions in .eslintrc.cjs:

  settings: {
    'import/resolver': {
      node: {
        extensions: ['.vue', '.js', '.jsx', '.cjs', '.mjs', '.d.ts'],
      },
    },
  },

__

This is something that used to work without needing this extra config (I think when the vitest config in vue-create was placed directly in vite.config.js).

Is this a regression, an unsupported configuration, or have I found the correct fix and it just needs some extra documentation?

Many thanks.

@haoqunjiang haoqunjiang added bug Something isn't working bug: upstream and removed bug Something isn't working labels Aug 18, 2023
@haoqunjiang
Copy link
Member

It's because the resolve package, which was depended on by eslint-import-resolver-node, hasn't supported the exports field yet.
Tracked at import-js/eslint-plugin-import#2430 (comment) and browserify/resolve#222

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