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

WebStorm warning: "Unknown html tag nuxt-content". #969

Closed
mikeslattery opened this issue Sep 29, 2021 · 2 comments
Closed

WebStorm warning: "Unknown html tag nuxt-content". #969

mikeslattery opened this issue Sep 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@mikeslattery
Copy link

mikeslattery commented Sep 29, 2021

It appears that Jetbrains IDEs cannot detect that nuxt-content is a registered component. No other component modules I use have this problem.

This problem is more serious than this. The component is registered as NuxtContent instead of the correct name of nuxt-content. This confuses the IDE, and may cause other issues with other tools and libraries.

On a side note, Jetbrains has a similar, but unrelated, issue with Nuxt project /components directory, which is solved by nuxt-storm.

See also fumeapp/nuxt-storm#7

Version

@nuxt/content: v1.14.0
nuxt: v2.15.8
nuxt-storm: 1.1.2
WebStorm: 2021.2

Reproduction Link

https://github.com/nuxtlabs/demo-blog-nuxt-content

Steps to reproduce

  1. git clone https://github.com/nuxtlabs/demo-blog-nuxt-content
  2. If not already, download and install WebStorm (PhpStorm and PyCharm should also work)
  3. Ensure IDE has Vue.js plugin installed (should be already)
  4. Create new project from existing demo-blog-nuxt-content directory from step 1
  5. Run default inspection. Code (menu) -> Inspect Code -> (*) Whole Project -> OK
  6. In "Problems" pane you should see an HTML warning for "Unknown html tag nuxt-content"

What is Expected?

No HTML warnings related to nuxt-conent

What is actually happening?

IDE "Problems" pane has HTML Warning : "Unknown html tag nuxt-content".

Workaround

In the root of the project create a file (I called it .components.js):

// Workaround to "Unknown html tag" Warnings
// See also nuxt-storm's .components.gen.js

import Vue from 'vue'

// This tag registers under the wrong name, NuxtContent
import NuxtContent from '@nuxt/content'
Vue.component('nuxt-content', NuxtContent)

Another workaround is to use <NuxtContent /> instead of <nuxt-content />.

@NozomuIkuta
Copy link
Collaborator

@mikeslattery

Vue itself can resolves both kebab-case and PascalCase component names, regardless of how you register them (ref).

So, I guess this issue is not specific to Nuxt Content module that should be handled by the module.
Instead, it should be handle at WebStorm layer.

By the way, other than NuxtContent component, can WebStorm resolves your kebab-case-named components correctly, even if you register the components with PascalCase name?

@farnabaz
Copy link
Member

This should be fixed in #1288

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants