stylelint: Add ignore: ["custom-elements"] option to selector-type-no-unknown

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

I want to propose add support to Custom Elements.

I add the specification reference to valid Custom Elements name.

Which rule, if any, is this issue related to?

selector-type-no-unknown

What CSS is needed to reproduce this issue?

my-custom-element {}

What stylelint configuration is needed to reproduce this issue?

e.g.

{
  "rules": {
    "selector-type-no-unknown": true
  }
}

Which version of stylelint are you using?

7.8.0

How are you running stylelint: CLI, PostCSS plugin, Node API?

CLI and VSCode plugin.

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

No.

What did you expect to happen?

No warnings to be flagged.

What actually happened (e.g. what warnings or errors you are getting)?

The following warnings were flagged:

Unexpected unknown type selector "my-custom-element" (selector-type-no-unknown)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 26 (23 by maintainers)

Most upvoted comments

missing documentation

@evilebottnawi using a prefix is not a best practice, but a requirement. Actually I use the following config:

        "selector-type-no-unknown": [ true, {
            "ignoreTypes": ["/^[a-zA-Z]([a-zA-Z0-9]*-[a-zA-Z0-9]+)+/"],
        } ]

This should work unless someone wants to use emoji in CE names 😄

@abdonrd I think this is a perfect use-case for a plugin. If the spec gains traction, browsers start implementing and people start relying on custom elements — at that time we would reconsider inclusion of the rule in stylelint core.

@davidtheclark I think the spec already has traction. It is landed in Chrome, Opera, Safari. And active developing in Firefox.

https://platform-status.mozilla.org/#custom-elements

screen shot 2017-02-14 at 13 27 24