eslint: Add eslint-plugin-mdx.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-09-03 17:00:48 -07:00
committed by Tim Abbott
parent 3d510601e5
commit 619cb0dd4f
5 changed files with 102 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import prettier from "eslint-config-prettier";
import {configs as astroConfigs} from "eslint-plugin-astro";
import formatjs from "eslint-plugin-formatjs";
import importPlugin from "eslint-plugin-import";
import * as mdx from "eslint-plugin-mdx";
import noJquery from "eslint-plugin-no-jquery";
import unicorn from "eslint-plugin-unicorn";
import globals from "globals";
@@ -36,6 +37,7 @@ export default tseslint.config(
prettier,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
mdx.flat,
{
files: ["**/*.cts", "**/*.mts", "**/*.ts"],
extends: [importPlugin.flatConfigs.typescript],
@@ -185,6 +187,7 @@ export default tseslint.config(
ignores: ["**/*.cts", "**/*.mts", "**/*.ts"],
extends: [tseslint.configs.disableTypeChecked],
rules: {
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-require-imports": "off",
"consistent-return": "error",
@@ -199,6 +202,17 @@ export default tseslint.config(
sourceType: "commonjs",
},
},
{
files: ["**/*.mdx"],
rules: {
"@typescript-eslint/no-unused-vars": "off",
"comma-spacing": "error",
"import/extensions": "off",
"import/unambiguous": "off",
"object-curly-spacing": "error",
quotes: "error",
},
},
{
files: ["web/tests/**"],
rules: {

View File

@@ -142,6 +142,7 @@
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-formatjs": "^5.0.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-mdx": "^3.6.2",
"eslint-plugin-no-jquery": "^3.0.2",
"eslint-plugin-unicorn": "^60.0.0",
"globals": "^16.0.0",

85
pnpm-lock.yaml generated
View File

@@ -446,6 +446,9 @@ importers:
eslint-plugin-import:
specifier: ^2.22.0
version: 2.32.0(@typescript-eslint/parser@8.39.1(eslint@9.33.0(jiti@1.21.7))(typescript@5.9.2))(eslint-import-resolver-webpack@0.13.10)(eslint@9.33.0(jiti@1.21.7))
eslint-plugin-mdx:
specifier: ^3.6.2
version: 3.6.2(eslint@9.33.0(jiti@1.21.7))(remark-lint-file-extension@3.0.1)
eslint-plugin-no-jquery:
specifier: ^3.0.2
version: 3.1.1(eslint@9.33.0(jiti@1.21.7))
@@ -4703,6 +4706,16 @@ packages:
eslint-plugin-import: '>=1.4.0'
webpack: '>=1.11.0'
eslint-mdx@3.6.2:
resolution: {integrity: sha512-5hczn5iSSEcwtNtVXFwCKIk6iLEDaZpwc3vjYDl/B779OzaAAK/ou16J2xVdO6ecOLEO1WZqp7MRCQ/WsKDUig==}
engines: {node: '>=18.0.0'}
peerDependencies:
eslint: '>=8.0.0'
remark-lint-file-extension: '*'
peerDependenciesMeta:
remark-lint-file-extension:
optional: true
eslint-module-utils@2.12.1:
resolution: {integrity: sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==}
engines: {node: '>=4'}
@@ -4745,6 +4758,12 @@ packages:
'@typescript-eslint/parser':
optional: true
eslint-plugin-mdx@3.6.2:
resolution: {integrity: sha512-RfMd5HYD/9+cqANhVWJbuBRg3huWUsAoGJNGmPsyiRD2X6BaG6bvt1omyk1ORlg81GK8ST7Ojt5fNAuwWhWU8A==}
engines: {node: '>=18.0.0'}
peerDependencies:
eslint: '>=8.0.0'
eslint-plugin-no-jquery@3.1.1:
resolution: {integrity: sha512-LTLO3jH/Tjr1pmxCEqtV6qmt+OChv8La4fwgG470JRpgxyFF4NOzoC9CRy92GIWD3Yjl0qLEgPmD2FLQWcNEjg==}
peerDependencies:
@@ -6747,6 +6766,10 @@ packages:
mouse-wheel@1.2.0:
resolution: {integrity: sha512-+OfYBiUOCTWcTECES49neZwL5AoGkXE+lFjIvzwNCnYRlso+EnfvovcBxGoyQ0yQt806eSPjS675K0EwWknXmw==}
mri@1.2.0:
resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==}
engines: {node: '>=4'}
mrmime@2.0.1:
resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==}
engines: {node: '>=10'}
@@ -8304,6 +8327,10 @@ packages:
s.color@0.0.15:
resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==}
sade@1.8.1:
resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==}
engines: {node: '>=6'}
safe-array-concat@1.1.3:
resolution: {integrity: sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==}
engines: {node: '>=0.4'}
@@ -9390,6 +9417,11 @@ packages:
resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
hasBin: true
uvu@0.5.6:
resolution: {integrity: sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==}
engines: {node: '>=8'}
hasBin: true
validate-npm-package-license@3.0.4:
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
@@ -14686,6 +14718,28 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint-mdx@3.6.2(eslint@9.33.0(jiti@1.21.7))(remark-lint-file-extension@3.0.1):
dependencies:
acorn: 8.15.0
acorn-jsx: 5.3.2(acorn@8.15.0)
eslint: 9.33.0(jiti@1.21.7)
espree: 10.4.0
estree-util-visit: 2.0.0
remark-mdx: 3.1.0
remark-parse: 11.0.0
remark-stringify: 11.0.0
synckit: 0.11.11
unified: 11.0.5
unified-engine: 11.2.2
unist-util-visit: 5.0.0
uvu: 0.5.6
vfile: 6.0.3
optionalDependencies:
remark-lint-file-extension: 3.0.1
transitivePeerDependencies:
- bluebird
- supports-color
eslint-module-utils@2.12.1(@typescript-eslint/parser@8.39.1(eslint@9.33.0(jiti@1.21.7))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-webpack@0.13.10)(eslint@9.33.0(jiti@1.21.7)):
dependencies:
debug: 3.2.7
@@ -14757,6 +14811,24 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
eslint-plugin-mdx@3.6.2(eslint@9.33.0(jiti@1.21.7))(remark-lint-file-extension@3.0.1):
dependencies:
eslint: 9.33.0(jiti@1.21.7)
eslint-mdx: 3.6.2(eslint@9.33.0(jiti@1.21.7))(remark-lint-file-extension@3.0.1)
mdast-util-from-markdown: 2.0.2
mdast-util-mdx: 3.0.0
micromark-extension-mdxjs: 3.0.0
remark-mdx: 3.1.0
remark-parse: 11.0.0
remark-stringify: 11.0.0
synckit: 0.11.11
unified: 11.0.5
vfile: 6.0.3
transitivePeerDependencies:
- bluebird
- remark-lint-file-extension
- supports-color
eslint-plugin-no-jquery@3.1.1(eslint@9.33.0(jiti@1.21.7)):
dependencies:
eslint: 9.33.0(jiti@1.21.7)
@@ -17442,6 +17514,8 @@ snapshots:
signum: 1.0.0
to-px: 1.0.1
mri@1.2.0: {}
mrmime@2.0.1: {}
ms@2.0.0: {}
@@ -19689,6 +19763,10 @@ snapshots:
s.color@0.0.15: {}
sade@1.8.1:
dependencies:
mri: 1.2.0
safe-array-concat@1.1.3:
dependencies:
call-bind: 1.0.8
@@ -20969,6 +21047,13 @@ snapshots:
uuid@9.0.1: {}
uvu@0.5.6:
dependencies:
dequal: 2.0.3
diff: 5.2.0
kleur: 4.1.5
sade: 1.8.1
validate-npm-package-license@3.0.4:
dependencies:
spdx-correct: 3.2.0

View File

@@ -84,7 +84,7 @@ def run() -> None:
linter_config.external_linter(
"eslint",
["node_modules/.bin/eslint", "--max-warnings=0", "--cache"],
["astro", "cjs", "cts", "js", "mjs", "mts", "ts"],
["astro", "cjs", "cts", "js", "mdx", "mjs", "mts", "ts"],
fix_arg="--fix",
description="Standard JavaScript style and formatting linter (config: eslint.config.js).",
)

View File

@@ -49,4 +49,4 @@ API_FEATURE_LEVEL = 425
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
PROVISION_VERSION = (343, 0) # bumped 2025-08-28 to move @types/mdast away from dev dependencies.
PROVISION_VERSION = (343, 1) # bumped 2025-09-03 to add eslint-plugin-mdx