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

feat(eslint): add inclusive-language rule #71

Merged
merged 4 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable inclusive-language/use-inclusive-words */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer this be disabled just for the rule configuration section (as I'm guessing that's where there are errors) but we also want to get this feature out

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, I just figured all the lines in that section would need the exclusion which might make it less clear.

/*
* Copyright (c) 2017 American Express Travel Related Services Company, Inc.
*
Expand Down Expand Up @@ -53,6 +54,7 @@ module.exports = {
},
plugins: [
'import',
'inclusive-language',
'jsx-a11y',
'markdown',
'react',
Expand Down Expand Up @@ -219,6 +221,32 @@ module.exports = {
// reduces the unnecessary boilerplate of explicitly setting props to `undefined`
// prevent false-confidence for those less experienced with how default props work
'react/require-default-props': 'off',

// encourage the use of inclusive language
'inclusive-language/use-inclusive-words': [
'error',
{
words: [
{
word: 'blacklist',
suggestions: ['blocklist', 'denylist', 'deny', 'block', 'unapproved'],
},
{
word: 'whitelist',
suggestions: ['allowlist', 'passlist', 'allow', 'permit', 'approved'],
},
{
word: 'master',
suggestions: ['main', 'primary', 'host', 'leader'],
},
{
word: 'slave',
suggestions: ['secondary', 'replica', 'client', 'follower'],
},
],
lintStrings: true,
},
],
},
overrides: [{
// Certain rules need to be disabled when we are linting markdown files,
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-inclusive-language": "^2.1.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-markdown": "^1.0.2",
"eslint-plugin-react": "^7.21.5",
Expand Down