cspell icon indicating copy to clipboard operation
cspell copied to clipboard

[Bug]: Cspell is reading HTML classes

Open aakashgill opened this issue 2 years ago • 1 comments

Hi

I tried this tool and it worked well. It's able to scan the code and giving errors if any incorrect spelling was there. But I'm not sure if it's supposed to read the class attribute or not inside HTML.

  • [x] runtime - command-line tools

Tool I've used to check spellings

  • [x] cspell -- the command-line spelling tool

Version: 6.31.1 OS: Macos Monterey Version: 12.5.1

Bug Description

I'm getting errors in the class names that some of the spellings are incorrect. Since I use ACSS for class names, all the names are utility-first classes and not an actual word.

Steps to reproduce the behavior:

  1. yarn add cspell
  2. I cspell task in package.json "cspell": "cspell 'newhome.php'"
  3. yarn run cspell
  4. See error in screenshot below image image

Expected behavior

To avoid reading the class or ID attribute in HTML so that I don't manually have to restrict some utility-classes.

aakashgill avatar Jun 09 '23 06:06 aakashgill

@aakashgill,

By design, the spell checker checks the entire file. It is possible to use a regular expression to tell the spell check to skip things, ignoreRegExpList.

My suggestion would be to create a custom dictionary to contains your class names, instead of trying to ignore them.

Jason3S avatar Jun 19 '23 08:06 Jason3S

The HTML dictionary defines a Regular Express to match against class names: HTML-class.

It is possible to use this in PHP:

cspell.json

{
  "languageSettings": [
    { "languageId": "php", "locale": "*", "ignoreRegExpList": ["HTML-class"] }
  ]
}

Jason3S avatar Jul 01 '24 14:07 Jason3S

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Aug 01 '24 05:08 github-actions[bot]