From 62132cb65842955813cca2be4b9343063bf1f3b3 Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Sat, 22 Nov 2025 18:29:33 +0100 Subject: [PATCH] workspace: migrate to `eslint-plugin-alex` from stand-alone CLI --- .alexignore | 8 -------- .alexrc.cjs | 37 ------------------------------------- README.md | 2 +- eslint.config.js | 35 +++++++++++++++++++++++++++++++++++ package.json | 2 ++ website/package.json | 5 +---- yarn.lock | 15 ++++++++++++++- 7 files changed, 53 insertions(+), 51 deletions(-) delete mode 100644 .alexignore delete mode 100644 .alexrc.cjs diff --git a/.alexignore b/.alexignore deleted file mode 100644 index 3f05f8fb2b5..00000000000 --- a/.alexignore +++ /dev/null @@ -1,8 +0,0 @@ -# The Code of Conduct calls out language that can't be used so it's not linted. -CODE_OF_CONDUCT.md - -# We will handle the older blog posts later. -website/blog/201* - -# Alex attempts to scan License files from the website output. -website/build/ diff --git a/.alexrc.cjs b/.alexrc.cjs deleted file mode 100644 index 7e48e42440a..00000000000 --- a/.alexrc.cjs +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -exports.allow = [ - // We frequently refer to form props by their name "disabled". - // Ideally we would alex-ignore only the valid uses (PRs accepted). - 'invalid', - - // Unfortunately "watchman" is a library name that we depend on. - 'watchman-watchwoman', - - // ignore rehab rule, Detox is an e2e testing library - 'rehab', - - // host refers to host objects in native code - 'host-hostess', - - // allowing this term to prevent reporting "primitive", which is a programming term - 'savage', - - // allowing this term, since it seems to be used not in insensitive cases - 'straightforward', - - // allowing those terms, since they refer to colors and the surname of one of core contributors - 'black', - 'white', - - // allowing this term, since we use it for expressing gratitude for certain contributors - 'special', -]; - -// Use a "maybe" level of profanity instead of the default "unlikely". -exports.profanitySureness = 1; diff --git a/README.md b/README.md index 00347a1aadf..775ea624a79 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ If possible, test any visual changes in all latest versions of the following bro ### Push it -1. Run `yarn prettier` and `yarn language:lint` in `./website` directory to ensure your changes are consistent with other files in the repo. +1. Run `yarn lint` and `yarn prettier` in `./website` directory to ensure your changes are consistent with other files in the repo. 1. Run `yarn update-lock` to [deduplicate dependencies](https://yarnpkg.com/cli/dedupe). 1. `git add -A && git commit -m "My message"` to stage and commit your changes. > replace `My message` with a commit message, such as `Fixed header logo on Android` diff --git a/eslint.config.js b/eslint.config.js index 93612195a53..89a0e144dc6 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -16,6 +16,7 @@ import * as eslintPluginMdx from 'eslint-plugin-mdx'; import eslintPluginPrettier from 'eslint-plugin-prettier/recommended'; import eslintPluginYml from 'eslint-plugin-yml'; import eslintTs from 'typescript-eslint'; +import eslintPluginAlex from 'eslint-plugin-alex'; export default defineConfig([ globalIgnores([ @@ -104,9 +105,43 @@ export default defineConfig([ remarkConfigPath: 'website/.remarkrc.mjs', }), plugins: { + alex: eslintPluginAlex, 'case-police': eslintPluginCasePolice, }, rules: { + 'alex/no-problematic-language': [ + 'warn', + { + ignore: [ + `CODE_OF_CONDUCT.md`, + // skip older blog posts + `website/blog/201*`, + ], + alexOptions: { + // use a "maybe" level of profanity instead of the default "unlikely" + profanitySureness: 1, + allow: [ + // we frequently refer to form props by their name "disabled" + 'invalid', + // unfortunately "watchman" is a library name that we depend on + 'watchman-watchwoman', + // ignore rehab rule, Detox is an e2e testing library + 'rehab', + // host refers to host objects in native code + 'host-hostess', + // allowing this term to prevent reporting "primitive", which is a programming term + 'savage', + // allowing this term, since it seems to be used not in insensitive cases + 'straightforward', + // allowing those terms, since they refer to colors and the surname of one of core contributors + 'black', + 'white', + // allowing this term, since we use it for expressing gratitude for certain contributors + 'special', + ], + }, + }, + ], 'case-police/string-check': [ 'warn', { diff --git a/package.json b/package.json index e23252ea7c6..b29935d0e45 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,11 @@ "@eslint/js": "^9.39.1", "@manypkg/cli": "^0.25.1", "@typescript-eslint/parser": "^8.47.0", + "alex": "^11.0.1", "case-police": "^2.1.1", "eslint": "^9.39.1", "eslint-config-prettier": "^10.1.8", + "eslint-plugin-alex": "^1.0.0", "eslint-plugin-case-police": "2.1.1", "eslint-plugin-mdx": "^3.6.2", "eslint-plugin-prettier": "^5.5.4", diff --git a/website/package.json b/website/package.json index 159b20f81a5..1eacb8d4c2f 100644 --- a/website/package.json +++ b/website/package.json @@ -28,9 +28,7 @@ "lint:examples": "eslint-examples-jsx && eslint-examples-tsx && tsc-examples", "lint:markdown:images": "node ../scripts/src/image-check.ts", "lint:markdown:links": "remark ../docs --quiet -r .remarkrc.withBrokenLinks.mjs", - "language:lint": "cd ../ && alex", - "language:lint:versioned": "cd ../ && alex .", - "ci:lint": "yarn lint:examples && yarn language:lint:versioned && yarn lint:markdown:images && prettier --check src/**/*.scss", + "ci:lint": "yarn lint:examples && yarn lint:markdown:images && prettier --check src/**/*.scss", "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", "update-redirects": "node ../scripts/src/update-redirects.ts" }, @@ -65,7 +63,6 @@ "@signalwire/docusaurus-plugin-llms-txt": "^1.2.2", "@types/google.analytics": "^0.0.46", "@types/react": "^19.1.17", - "alex": "^11.0.1", "eslint": "^9.39.1", "glob": "^13.0.0", "prettier": "^3.6.2", diff --git a/yarn.lock b/yarn.lock index c2bb4db3ce5..bcdf2981884 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9166,6 +9166,18 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-alex@npm:^1.0.0": + version: 1.0.0 + resolution: "eslint-plugin-alex@npm:1.0.0" + dependencies: + micromatch: "npm:^4.0.8" + peerDependencies: + alex: ^11.0.0 + eslint: ">=8.56.0 || >=9.0.0" + checksum: 10c0/1f8a048a1f91244217c1c54b5c8b254b9f2e107b50e27df7c5c819b9290c14083354ce764a1abbe6195dd38b128bfb919d240409cbf895279ec9870add53b824 + languageName: node + linkType: hard + "eslint-plugin-case-police@npm:2.1.1": version: 2.1.1 resolution: "eslint-plugin-case-police@npm:2.1.1" @@ -17827,9 +17839,11 @@ __metadata: "@eslint/js": "npm:^9.39.1" "@manypkg/cli": "npm:^0.25.1" "@typescript-eslint/parser": "npm:^8.47.0" + alex: "npm:^11.0.1" case-police: "npm:^2.1.1" eslint: "npm:^9.39.1" eslint-config-prettier: "npm:^10.1.8" + eslint-plugin-alex: "npm:^1.0.0" eslint-plugin-case-police: "npm:2.1.1" eslint-plugin-mdx: "npm:^3.6.2" eslint-plugin-prettier: "npm:^5.5.4" @@ -17859,7 +17873,6 @@ __metadata: "@signalwire/docusaurus-plugin-llms-txt": "npm:^1.2.2" "@types/google.analytics": "npm:^0.0.46" "@types/react": "npm:^19.1.17" - alex: "npm:^11.0.1" docusaurus-plugin-sass: "npm:^0.2.6" eslint: "npm:^9.39.1" glob: "npm:^13.0.0"