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 🀣🀣

Collapse
 
isaac0yen profile image
Oyeniyi Isaac

So this library has a list of keywords and loops through the text to return the ones in the list?

But somehow, is very importantΒΏ

Collapse
 
retakenroots profile image
Rene Kootstra • Edited

Yet another example of how to build a cluttered build pipeline.

Collapse
 
silentwatcher_95 profile image
Ali nazari

πŸ‘€

Collapse
 
array_dot_reduce profile image
Bhaskar Ghale

I can see value the value in this tool...

But the example is purely engagement-bait isn't it?
I don't blame you. The number of comments speaks for itself, mine included. πŸ€·β€β™‚οΈ

Collapse
 
silentwatcher_95 profile image
Ali nazari

I used the example of the documentation in here But I am pleased to see that it is driving engagement. πŸ€—πŸ“ˆπŸ“ˆ

Collapse
 
anotherguy profile image
Igor Soloydenko

The example used is crazy. The tool would be helpful if it checked specifically for slurs and derogatory language.

Collapse
 
silentwatcher_95 profile image
Ali nazari

I’m not sure but I think it detects slurs too

Collapse
 
f1nn0s profile image
Finn Mohr

Lol....What is available in these days is unbelievable.
I'm always surprised 🀣

Collapse
 
silentwatcher_95 profile image
Ali nazari

If I say that the idea of ​​this project has been around for a long time and it has only become more complete, it might spoil it more 😏🀣