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

Add a docs-spellcheck linter #34934

Closed
coliff opened this issue Sep 9, 2021 · 3 comments · Fixed by #34940
Closed

Add a docs-spellcheck linter #34934

coliff opened this issue Sep 9, 2021 · 3 comments · Fixed by #34940

Comments

@coliff
Copy link
Contributor

coliff commented Sep 9, 2021

I love that this project includes many tests and linters meaning that any broken links, invalid HTML or CSS/JavaScript bugs are caught before a PR can be made.

I think it'd be helpful to add a docs-spellcheck linter so that any spelling errors are caught before being merged. I propose to use the popular cSpell project as it is customizable, easy to use, has useful built-in dictionaries and has a VS Code extension, GitHub Action and CLI options.

There are some Bootstrap terms/words in the docs which show as false positives so we can add a custom dictionary which is automatically read if file is called .cspell.json (cspell.json also works but having a . at the beginning keeps all the configs together). That file would look something like this:

{
  "version": "0.2",
  "words": [
    "affordance",
    "allowfullscreen",
    "autohide",
    "autohiding",
    "autoplay",
    "autoplays",
    "blazingly",
    "Blockquotes",
    "Bootstrappers",
    "borderless",
    "browserslist",
    "browserslistrc",
    "btncheck",
    "btnradio",
    "callout",
    "callouts",
    "clearfix",
    "Codesniffer",
    "colorspace",
    "combinator",
    "Contentful",
    "Cpath",
    "Crossfade",
    "cssgrid",
    "Csvg",
    "Datalists",
    "Deque",
    "discoverability",
    "docsearch",
    "docsref",
    "dropend",
    "dropleft",
    "dropright",
    "dropstart",
    "dropup",
    "errorf",
    "favicon",
    "favicons",
    "flexbox",
    "fullscreen",
    "fusv",
    "getbootstrap",
    "globby",
    "Grayscale",
    "Hoverable",
    "hreflang",
    "hstack",
    "jsdelivr",
    "Jumpstart",
    "keyframes",
    "libera",
    "Libsass",
    "lightboxes",
    "Lowercased",
    "markdownify",
    "mediaqueries",
    "minifiers",
    "monospace",
    "mouseleave",
    "navbars",
    "navs",
    "Neue",
    "noindex",
    "Noto",
    "offcanvas",
    "popperjs",
    "prebuild",
    "precompiled",
    "prefersreducedmotion",
    "prepended",
    "printf",
    "rects",
    "relref",
    "rgba",
    "roboto",
    "RTLCSS",
    "ruleset",
    "screenreaders",
    "scrollbars",
    "scrollspy",
    "Segoe",
    "sirv",
    "srcset",
    "Stylelint",
    "subnav",
    "svgo",
    "tabbable",
    "textareas",
    "toggleable",
    "touchend",
    "twbs",
    "unitless",
    "Unported",
    "unstylable",
    "unstyled",
    "Uppercased",
    "urlize",
    "vbtn",
    "viewports",
    "vstack",
    "walkthroughs",
    "WCAG",
    "webfont",
    "zindex",
    "بالعالم",
    "مرحبا"
  ],
  "language": "en,en-US",
  "ignorePaths": [
    ".cspell.json"
  ]
}

We can install cSpell CLI by adding "cspell": "^5.9.0", to devDependencies and then in the scripts in package.json we can add something like:
"docs-spellcheck": "cspell \"site/**/*.md\"",
(I set it to scan just markdown files and not the examples HTMLs so the Arabic/RTL files are ignored).

Alternatively the spellcheck could just be done via GitHub Action - or just ask everyone contributing to install this extension for real-time spellcheck in VS Code. :-)
https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker

@coliff coliff added the feature label Sep 9, 2021
@ffoodd
Copy link
Member

ffoodd commented Sep 9, 2021

I like the idea ❤️

FWIW Jetbrains' IDEs also have builtin spellcheck and allow custom dictionnaries.

We may add some mention or requirement in our contributing guidelines, too.

@mdo
Copy link
Member

mdo commented Sep 9, 2021

I'm into it, too!

@coliff
Copy link
Contributor Author

coliff commented Sep 9, 2021

Great! I'll open a PR with my suggested setup - and it can always be tweaked later if needed.

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

Successfully merging a pull request may close this issue.

4 participants