streetsidesoftware / cspell-dicts

Various cspell dictionaries
Other
218 stars 205 forks source link

Why is "reimagining" not a word? #1425

Closed gajus closed 2 years ago

gajus commented 2 years ago

It is being flagged using this configuration:

version: '0.3'
language: en
ignoreRegExpList:
  - /.*[0-9].*/
minWordLength: 5
words:
  - customeri
nschonni commented 2 years ago

0.3 isn't a valid value for version. It looks like it's only in the en-gb dictionary if you run cspell trace reimagining. It's likely because may be more commonly hyphenated as re-imagining

Jason3S commented 2 years ago

@gajus,

As Nick said, cspell trace reimagining will show you which dictionaries have the word. Looks like it is only in the en-gb dictionary.

Please be careful with ignoreRegExpList is applies to all the lines in a document. /.*[0-9].*/ will ignore any LINE that has a number.

See image: Dark gray is ignored.

image

You can use cspell check <filename> to see how ignoreRegExp impacts a file.

gajus commented 2 years ago

All very valuable insights. Shared summary with the team. Thank you

Please be careful with ignoreRegExpList is applies to all the lines in a document. /.[0-9]./ will ignore any LINE that has a number.

What is the best way to ignore gibberish keywords?

Example, in this code example:

export const CollaborationRequestProfessionalRolesLoader =
  createConnectionLoaderClass<
    PortfolioProjectCollaboratorProfessionalRole & ProfessionalRole
  >({
    query: sql.type(
      ProfessionalRoleShape.merge(
        PortfolioProjectCollaboratorProfessionalRoleShape
      )
    )`
      WITH role_cte AS (${query})
      SELECT
        rc1.*,
        ppcpr1.collaborator_id,
        ppcpr1.sort_order
      FROM role_cte rc1
      INNER JOIN portfolio_project_collaborator_professional_role ppcpr1 ON
        rc1.id = ppcpr1.professional_role_id
    `,
  });

without the ignoreRegExpList, cspell flags ppcpr1 as a misspelled word.

gajus commented 2 years ago

Closing as the original question has been addressed.

Jason3S commented 2 years ago

without the ignoreRegExpList, cspell flags ppcpr1 as a misspelled word.

I suggest using regex101 to try it out first.

gajus commented 2 years ago

@Jason3S probably a separate problem, but regex does not seem to work all the time, e.g.

This is my configuration:

allowCompoundWords: true
dictionaries:
  - en_us
  - en-gb
  - typescript
  - companies
  # contains various useful programming terms such as 'stringifiable'
  - cpp
ignoreRegExpList:
  # https://regex101.com/r/mqoody/1
  - "\b[a-zA-Z0-9]*[0-9]+[a-zA-Z0-9]*\b"
  - "'data-[a-z]*'"
language: en
minWordLength: 5

This is a test case:

https://regex101.com/r/mP6jYG/1

and it still highlights these words:

[..]/__tests__/ResourceDetails.test.tsx:22:27 - Unknown word (fezizlowdugqsvtss)
[..]/__tests__/ResourceDetails.test.tsx:27:27 - Unknown word (sholysbvuitn)
[..]/__tests__/ResourceDetails.test.tsx:46:20 - Unknown word (koyzugldpfbki)
[..]/__tests__/ResourceDetails.test.tsx:52:27 - Unknown word (bculqi)
Jason3S commented 2 years ago

There are two things going on:

  1. \b needs to be \\b.
  2. The regex has very bad performance.

This one is better: https://regex101.com/r/Xp1iuJ/1

Try this:

allowCompoundWords: false # Not a good idea to make this `true` it will hide a LOT of errors.
dictionaries:
    - en_us
    - en-gb
    - typescript
    - companies
    # contains various useful programming terms such as 'stringifiable'
    - cpp
ignoreRegExpList:
    # https://regex101.com/r/mqoody/1
    - "/\\b[a-z]*([0-9]+[a-z]*)+\\b/gi"
    - "/'data-[a-z]+'/gi"
language: en
minWordLength: 5