Skip to content

Commit 7bb7463

Browse files
authored
workspace: migrate to eslint-plugin-alex from stand-alone CLI (facebook#4898)
1 parent 019e614 commit 7bb7463

File tree

7 files changed

+53
-51
lines changed

7 files changed

+53
-51
lines changed

.alexignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.alexrc.cjs

Lines changed: 0 additions & 37 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ If possible, test any visual changes in all latest versions of the following bro
175175

176176
### Push it
177177

178-
1. Run `yarn prettier` and `yarn language:lint` in `./website` directory to ensure your changes are consistent with other files in the repo.
178+
1. Run `yarn lint` and `yarn prettier` in `./website` directory to ensure your changes are consistent with other files in the repo.
179179
1. Run `yarn update-lock` to [deduplicate dependencies](https://yarnpkg.com/cli/dedupe).
180180
1. `git add -A && git commit -m "My message"` to stage and commit your changes.
181181
> replace `My message` with a commit message, such as `Fixed header logo on Android`

eslint.config.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import * as eslintPluginMdx from 'eslint-plugin-mdx';
1616
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
1717
import eslintPluginYml from 'eslint-plugin-yml';
1818
import eslintTs from 'typescript-eslint';
19+
import eslintPluginAlex from 'eslint-plugin-alex';
1920

2021
export default defineConfig([
2122
globalIgnores([
@@ -104,9 +105,43 @@ export default defineConfig([
104105
remarkConfigPath: 'website/.remarkrc.mjs',
105106
}),
106107
plugins: {
108+
alex: eslintPluginAlex,
107109
'case-police': eslintPluginCasePolice,
108110
},
109111
rules: {
112+
'alex/no-problematic-language': [
113+
'warn',
114+
{
115+
ignore: [
116+
`CODE_OF_CONDUCT.md`,
117+
// skip older blog posts
118+
`website/blog/201*`,
119+
],
120+
alexOptions: {
121+
// use a "maybe" level of profanity instead of the default "unlikely"
122+
profanitySureness: 1,
123+
allow: [
124+
// we frequently refer to form props by their name "disabled"
125+
'invalid',
126+
// unfortunately "watchman" is a library name that we depend on
127+
'watchman-watchwoman',
128+
// ignore rehab rule, Detox is an e2e testing library
129+
'rehab',
130+
// host refers to host objects in native code
131+
'host-hostess',
132+
// allowing this term to prevent reporting "primitive", which is a programming term
133+
'savage',
134+
// allowing this term, since it seems to be used not in insensitive cases
135+
'straightforward',
136+
// allowing those terms, since they refer to colors and the surname of one of core contributors
137+
'black',
138+
'white',
139+
// allowing this term, since we use it for expressing gratitude for certain contributors
140+
'special',
141+
],
142+
},
143+
},
144+
],
110145
'case-police/string-check': [
111146
'warn',
112147
{

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
"@eslint/js": "^9.39.1",
3030
"@manypkg/cli": "^0.25.1",
3131
"@typescript-eslint/parser": "^8.47.0",
32+
"alex": "^11.0.1",
3233
"case-police": "^2.1.1",
3334
"eslint": "^9.39.1",
3435
"eslint-config-prettier": "^10.1.8",
36+
"eslint-plugin-alex": "^1.0.0",
3537
"eslint-plugin-case-police": "2.1.1",
3638
"eslint-plugin-mdx": "^3.6.2",
3739
"eslint-plugin-prettier": "^5.5.4",

website/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
"lint:examples": "eslint-examples-jsx && eslint-examples-tsx && tsc-examples",
2929
"lint:markdown:images": "node ../scripts/src/image-check.ts",
3030
"lint:markdown:links": "remark ../docs --quiet -r .remarkrc.withBrokenLinks.mjs",
31-
"language:lint": "cd ../ && alex",
32-
"language:lint:versioned": "cd ../ && alex .",
33-
"ci:lint": "yarn lint:examples && yarn language:lint:versioned && yarn lint:markdown:images && prettier --check src/**/*.scss",
31+
"ci:lint": "yarn lint:examples && yarn lint:markdown:images && prettier --check src/**/*.scss",
3432
"pwa:generate": "npx pwa-asset-generator ./static/img/header_logo.svg ./static/img/pwa --padding '40px' --background 'rgb(32, 35, 42)' --icon-only --opaque true",
3533
"update-redirects": "node ../scripts/src/update-redirects.ts"
3634
},
@@ -65,7 +63,6 @@
6563
"@signalwire/docusaurus-plugin-llms-txt": "^1.2.2",
6664
"@types/google.analytics": "^0.0.46",
6765
"@types/react": "^19.1.17",
68-
"alex": "^11.0.1",
6966
"eslint": "^9.39.1",
7067
"glob": "^13.0.0",
7168
"prettier": "^3.6.2",

yarn.lock

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9166,6 +9166,18 @@ __metadata:
91669166
languageName: node
91679167
linkType: hard
91689168

9169+
"eslint-plugin-alex@npm:^1.0.0":
9170+
version: 1.0.0
9171+
resolution: "eslint-plugin-alex@npm:1.0.0"
9172+
dependencies:
9173+
micromatch: "npm:^4.0.8"
9174+
peerDependencies:
9175+
alex: ^11.0.0
9176+
eslint: ">=8.56.0 || >=9.0.0"
9177+
checksum: 10c0/1f8a048a1f91244217c1c54b5c8b254b9f2e107b50e27df7c5c819b9290c14083354ce764a1abbe6195dd38b128bfb919d240409cbf895279ec9870add53b824
9178+
languageName: node
9179+
linkType: hard
9180+
91699181
"eslint-plugin-case-police@npm:2.1.1":
91709182
version: 2.1.1
91719183
resolution: "eslint-plugin-case-police@npm:2.1.1"
@@ -17827,9 +17839,11 @@ __metadata:
1782717839
"@eslint/js": "npm:^9.39.1"
1782817840
"@manypkg/cli": "npm:^0.25.1"
1782917841
"@typescript-eslint/parser": "npm:^8.47.0"
17842+
alex: "npm:^11.0.1"
1783017843
case-police: "npm:^2.1.1"
1783117844
eslint: "npm:^9.39.1"
1783217845
eslint-config-prettier: "npm:^10.1.8"
17846+
eslint-plugin-alex: "npm:^1.0.0"
1783317847
eslint-plugin-case-police: "npm:2.1.1"
1783417848
eslint-plugin-mdx: "npm:^3.6.2"
1783517849
eslint-plugin-prettier: "npm:^5.5.4"
@@ -17859,7 +17873,6 @@ __metadata:
1785917873
"@signalwire/docusaurus-plugin-llms-txt": "npm:^1.2.2"
1786017874
"@types/google.analytics": "npm:^0.0.46"
1786117875
"@types/react": "npm:^19.1.17"
17862-
alex: "npm:^11.0.1"
1786317876
docusaurus-plugin-sass: "npm:^0.2.6"
1786417877
eslint: "npm:^9.39.1"
1786517878
glob: "npm:^13.0.0"

0 commit comments

Comments
 (0)