DEV Community

Cover image for Practicing politeness in JavaScript code ๐Ÿคฌ
Ali nazari
Ali nazari

Posted on

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 


Enter fullscreen mode Exit fullscreen mode

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"
}


Enter fullscreen mode Exit fullscreen mode

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



## the boogeyman walked to class


Enter fullscreen mode Exit fullscreen mode

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


Enter fullscreen mode Exit fullscreen mode

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? ๐Ÿง๐Ÿค—

Top comments (34)

Collapse
 
jonrandy profile image
Jon Randy ๐ŸŽ–๏ธ
warning  `boogeyman` may be insensitive, use `boogeymonster` instead  boogeyman-boogeywoman  retext-equality
Enter fullscreen mode Exit fullscreen mode

I have no words. This is completely ridiculous

Collapse
 
silentwatcher_95 profile image
Ali nazari

true ๐Ÿคฃ๐ŸคŒ๐Ÿป

Collapse
 
jonrandy profile image
Jon Randy ๐ŸŽ–๏ธ • Edited

Also, this kind of thing (whether a document is not 'inclusive', or is 'offensive') should be determined/resolved by the normal process of PRs and review/discussion - not arbitrary decision making by a dumb model that has no idea or understanding about context, sarcasm, intent, etc.

This really feels like a solution looking for a problem.

Thread Thread
 
instalab profile image
Samuel Boczek

Might be useful for checking and refactoring old documents, but I agree that you should not just treat the this tools as an end all solution.

Thread Thread
 
silentwatcher_95 profile image
Ali nazari

thank you for your feedback ๐Ÿค—

Collapse
 
ngdangtu profile image
ฤฤƒng Tรบ

What is this abormination?!!! Why would anyone spending their time to create such a tasteless tool like this? What a waste of time!

Collapse
 
silentwatcher_95 profile image
Ali nazari

๐Ÿ™

Collapse
 
best_codes profile image
Best Codes

People don't understand. ๐Ÿ˜•
I can understand, though. ๐Ÿ™‚

Collapse
 
pauluz profile image
Paul Canning

Is this a late April Fools?

Collapse
 
silentwatcher_95 profile image
Ali nazari

Maybe, who knows! ๐Ÿ˜๐Ÿ‘€

Collapse
 
click2install profile image
click2install

Humanity is doomed.

Collapse
 
silentwatcher_95 profile image
Ali nazari

However, it can still be viewed as a fun tool. ๐Ÿ˜

Collapse
 
tullaris profile image
Joรฃo Almeida

Lol good luck writing "merged changes to 'master'"

Collapse
 
silentwatcher_95 profile image
Ali nazari

๐Ÿซก

Collapse
 
kocreative profile image
Kat

Seems like a great little tool! Thank you for bringing it to my attention :)

Collapse
 
silentwatcher_95 profile image
Ali nazari

Thank you for your positive feedback! ๐Ÿค—

Collapse
 
edwin_teisman_fcac5dd744a profile image
Edwin Teisman

Nice little joke you got there. Probably some conservative who wants promote the anti woke movement. They'll follow up with a post against wokeness on Twitter or Reddit

Collapse
 
scarylerie profile image
ScaryLerie

Unnecessary.

Collapse
 
silentwatcher_95 profile image
Ali nazari

thank you for your feedback sir ๐Ÿซก๐Ÿ‘‘

Collapse
 
simonoop profile image
simonoop

What the hell has happened to the freaking world? What's next? Enforcing git branch names?!?!! Oh wait ..

Collapse
 
eevargas profile image
Eli Vargas

I feel offended by this tool ๐Ÿคฃ
Wow the levels that we are reaching now. We are doomed ๐Ÿ˜”

Collapse
 
silentwatcher_95 profile image
Ali nazari

I am slowly thinking that it would have been better if I had not used the example in the documentation of this tool ๐Ÿ˜ต๐Ÿ˜ท
The situation is getting worse ๐Ÿคฃ๐Ÿคฃ