Practicing politeness in JavaScript code 🀬


Imagine that you published a big open source project and many people are currently changing your code or updating the project documents.

what if someone accidently write something race related , gender favoring , polarizing and etc… πŸ‘€

cat typing

we have a tool called alex !

According to what is written in the documentation of this tool:

Whether your own or someone else’s writing, alex helps you find gender favoring, polarizing, race related, or other unequal phrasing in text.

Set up Alex in our project

in order to use alex inside our project , first we need to install its package.

it will be a good practice if you install alex as a dev-dependency
or you can just install it globally in your system.

npm i -D alex 

Alex reads plain text, HTML, MDX, or markdown as input.

One of its uses is to scan all project documents for any literary issues.

Let’s assume that all our documents are written in Markdown format, so we instruct Alex to check all files with a .md extension

In our package.json file, we can create a script like:

{
  "scripts": {
      "test-doc" : "npx alex *.md"
}

After that, I create a file called policy.md as an example document:

## the boogeyman walked to class

if you run the test-doc command, you will probably get this result:

> test-doc
> npx alex *.md

policy.md
  1:8-1:17  warning  `boogeyman` may be insensitive, use `boogeymonster` instead  boogeyman-boogeywoman  retext-equality

‼ 1 warning

You can use this command together with tools such as Husky ** and **lint-staged to run the process of checking your files automatically. πŸ€–

What are your thoughts on this tool, and how crucial is compliance with this matter for software projects? πŸ§πŸ€—