Skip to content

[css] css.lint.hexColorLength seems to be now irrelevant #81808

Open
microsoft/vscode-css-languageservice
#580

Description

Issue still occurs in Insiders v1.39.0

  • VSCode Version: 1.39.0
  • OS Version: macOS 10.14.6

Steps to Reproduce:

  1. Set css.lint.hexColorLength to error or warning
  2. Create a css file with a wrongly formatted color value
div {
    color: #ccc0003;
}

Expected behavior:
An error or warning as per the css.lint.hexColorLength setting.

Actual behavior:
A css-propertyvaluexpected error.

The css.lint.hexColorLength setting seems to no longer be relevant.

Does this issue occur when all extensions are disabled? Yes

Activity

  1. added
    bug
    css-less-scss
    on Oct 3, 2019
  2. added this to the October 2019 milestone on Oct 3, 2019
  3. octref commented on Oct 22, 2019

    @octref
    Contributor

    Martin Aeschlimann (@aeschli) What do you think would be a good fix? Do we parse invalid colors as HexColor so this linting rule could work?

  4. aeschli commented on Oct 23, 2019

    @aeschli
    Contributor

    Yes, best is probably to create a HexColor for all values matching #[1-9A-Fa-f]+
    We'd then need to make sure all consumers of HexColor can handle invalid length.

  5. andrecasal commented on Oct 23, 2019

    @andrecasal
    Author

    Would also be good to update the setting's description.

  6. changed the title [-]css.lint.hexColorLength seems to be now irrelevant[/-] [+][css] css.lint.hexColorLength seems to be now irrelevant[/+] on May 5, 2020
  7. UsmanQT commented on Nov 24, 2026

    @UsmanQT

    I've opened a fix in microsoft/vscode-css-languageservice#580. The cause is that _parseHexColor only accepted 3, 4, 6 or 8 hex digits, so a color with any other length never became a hex color node and the hexColorLength lint rule could not see it.

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

Metadata

Metadata

Labels

bugcss-less-scss

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions