Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
25cb44a
chore: update `@eslint/*` dep, add `legacy-peer-deps`, and use ESLint…
lumirlumir Dec 2, 2025
6ea9062
wip
lumirlumir Dec 3, 2025
17d2d66
wip: remove eslintrc related test cases
lumirlumir Dec 3, 2025
16c8b5e
wip: update CI
lumirlumir Dec 3, 2025
fac38d4
wip: use ESLint v10 in `tests/examples/all.test.js`
lumirlumir Dec 3, 2025
1eb14f3
wip: use latest `typescript-eslint`
lumirlumir Dec 3, 2025
bacd60b
Merge branch 'main' into chore-update-eslint-core-plugin-kit
lumirlumir Feb 8, 2026
ed0bc20
ci: ensure ESLint works with at least `9.15.0` and `10`
lumirlumir Feb 8, 2026
ff0b761
ci: add `-D`
lumirlumir Feb 8, 2026
28fbd4e
wip
lumirlumir Feb 8, 2026
5e3969e
wip: update `@eslint/*` deps
lumirlumir Feb 8, 2026
f842810
wip
lumirlumir Feb 8, 2026
91f0e11
wip
lumirlumir Feb 8, 2026
029a499
wip: fix type error
lumirlumir Feb 8, 2026
a8eff00
wip
lumirlumir Feb 8, 2026
01c1806
wip
lumirlumir Feb 8, 2026
7fd174b
wip: remove duplicate test
lumirlumir Feb 8, 2026
ff808f2
wip: run type test in various ESLint version
lumirlumir Feb 8, 2026
0c47cd6
wip
lumirlumir Feb 8, 2026
a57df7c
wip
lumirlumir Feb 8, 2026
d7a413f
wip: remove fail fast
lumirlumir Feb 8, 2026
f57a608
wip
lumirlumir Feb 8, 2026
cf78b2a
Merge branch 'main' of https://github.com/eslint/markdown into chore-…
lumirlumir Feb 15, 2026
8c69770
wip
lumirlumir Feb 18, 2026
c45b002
Merge branch 'main' of https://github.com/eslint/markdown into chore-…
lumirlumir Mar 2, 2026
34c2553
wip: simplify test structure (applying suggestion in #605)
lumirlumir Mar 2, 2026
f589623
wip
lumirlumir Mar 2, 2026
1e90f22
wip
lumirlumir Mar 2, 2026
e01b24a
wip
lumirlumir Mar 10, 2026
9a703ee
Merge branch 'main' into chore-update-eslint-core-plugin-kit
lumirlumir Mar 10, 2026
5b7795c
wip: fix CI
lumirlumir Mar 10, 2026
f8ba3c1
Merge branch 'main' into chore-update-eslint-core-plugin-kit
lumirlumir Mar 13, 2026
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
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml

@lumirlumir lumirlumir Feb 8, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
eslint: [9]
Comment thread
lumirlumir marked this conversation as resolved.
eslint: [9.15.0, 9.x, 10.x]
node: [25.x, 24.x, 22.x, 20.x, "20.19.0"]
include:
- os: windows-latest
eslint: 9
eslint: latest
node: lts/*
- os: macOS-latest
eslint: 9
eslint: latest
node: lts/*
Comment thread
lumirlumir marked this conversation as resolved.
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -69,13 +69,16 @@ jobs:
run: npm install
env:
CI: true
- name: Install ESLint@${{ matrix.eslint }}
run: npm install eslint@${{ matrix.eslint }}
- name: Install ESLint@${{ matrix.eslint }}
run: npm install -D eslint@${{ matrix.eslint }}
- name: Test
run: npm run test

test_types:
name: Test Types
strategy:
matrix:
eslint: [9.x, 10.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -85,6 +88,8 @@ jobs:
node-version: "lts/*"
- name: Install dependencies
run: npm install
- name: Install ESLint@${{ matrix.eslint }}
run: npm install -D eslint@${{ matrix.eslint }}
- name: Check Types
run: npm run test:types

Expand Down
4 changes: 2 additions & 2 deletions examples/react/package.json

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Currently, both eslint-plugin-react and typescript-eslint do not yet support ESLint v10 as a peer dependency, I've used the latest v9 versions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typescript-esint was just released with v10 peer dependency. Can we update?

@lumirlumir lumirlumir Mar 10, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure, I've updated it in e01b24a.

I've also updated other ESLint-related dependencies to their latest versions where possible.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"test": "eslint ."
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"eslint": "^9.7.0",
"@eslint/js": "^9.39.2",
"eslint": "^9.39.2",
"eslint-plugin-react": "^7.35.0",
"globals": "^13.24.0"
}
Expand Down
8 changes: 4 additions & 4 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"test": "eslint ."
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"eslint": "^9.15.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.15.0"
"@eslint/js": "^9.39.2",
"eslint": "^9.39.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.54.0"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
"yorkie": "^2.0.0"
},
"dependencies": {
"@eslint/core": "^0.17.0",
"@eslint/plugin-kit": "^0.4.1",
"@eslint/core": "^1.1.0",
"@eslint/plugin-kit": "^0.6.0",
Comment thread
lumirlumir marked this conversation as resolved.
Outdated
"github-slugger": "^2.0.0",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-frontmatter": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import rules from "./build/rules.js";
// Exports
//-----------------------------------------------------------------------------

/** @type {Linter.RulesRecord} */
/** @satisfies {Linter.RulesRecord} */
Comment thread
lumirlumir marked this conversation as resolved.
const processorRulesConfig = {
// The Markdown parser automatically trims trailing
// newlines from code blocks.
Expand Down
6 changes: 3 additions & 3 deletions tests/examples/all.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ for (const example of examples) {
describe("examples", () => {
describe(example, () => {
it("reports errors on code blocks in .md files", async () => {
const { FlatESLint } = require(
require.resolve("eslint/use-at-your-own-risk", {
const { ESLint } = require(
require.resolve("eslint", {
paths: [cwd],
}),
);
const eslint = new FlatESLint({ cwd });
const eslint = new ESLint({ cwd });
const results = await eslint.lintFiles(["README.md"]);
const readme = results.find(
result => path.basename(result.filePath) == "README.md",
Expand Down
85 changes: 25 additions & 60 deletions tests/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
//-----------------------------------------------------------------------------

import assert from "node:assert";
import api from "eslint";
import unsupportedAPI from "eslint/use-at-your-own-risk";
import path from "node:path";
import plugin from "../src/index.js";
import fs from "node:fs";
import { fileURLToPath, pathToFileURL } from "node:url";
import { ESLint } from "eslint";
import plugin from "../src/index.js";

const ESLint = api.ESLint;
const LegacyESLint = unsupportedAPI.LegacyESLint;
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const rulesDir = path.resolve(__dirname, "../src/rules");
Expand All @@ -33,13 +30,23 @@ const pkg = JSON.parse(
// Helpers
//-----------------------------------------------------------------------------

/**
* Gets the major version of the currently installed ESLint.
* @returns {number} The major version.
*/
function getESLintMajorVersion() {
return Number(ESLint.version.split(".")[0]);
}

/**
* Helper function which creates ESLint instance with enabled/disabled autofix feature.
* @param {string} fixtureConfigName ESLint JSON config fixture filename.
* @param {Object} [options={}] Whether to enable autofix feature.
* @returns {LegacyESLint} ESLint instance to execute in tests.
*/
function initLegacyESLint(fixtureConfigName, options = {}) {
async function initLegacyESLint(fixtureConfigName, options = {}) {
const { LegacyESLint } = await import("eslint/use-at-your-own-risk");

Comment thread
lumirlumir marked this conversation as resolved.
Outdated
return new LegacyESLint({
cwd: path.resolve(__dirname, "./fixtures/"),
ignore: false,
Expand Down Expand Up @@ -87,6 +94,10 @@ describe("meta", () => {
});

describe("LegacyESLint", () => {
if (getESLintMajorVersion() >= 10) {
return; // Skip `LegacyESLint` tests on ESLint v10+
}

describe("recommended config", () => {
let eslint;
const shortText = [
Expand All @@ -96,8 +107,8 @@ describe("LegacyESLint", () => {
"```",
].join("\n");

before(() => {
eslint = initLegacyESLint("recommended.json");
before(async () => {
eslint = await initLegacyESLint("recommended.json");
});

it("should include the plugin", async () => {
Expand Down Expand Up @@ -142,8 +153,8 @@ describe("LegacyESLint", () => {
let eslint;
const shortText = ["```js", "console.log(42);", "```"].join("\n");

before(() => {
eslint = initLegacyESLint("eslintrc.json");
before(async () => {
eslint = await initLegacyESLint("eslintrc.json");
});

it("should run on .md files", async () => {
Expand Down Expand Up @@ -372,7 +383,7 @@ describe("LegacyESLint", () => {
"```",
"````",
].join("\n");
const recursiveCli = initLegacyESLint("eslintrc.json", {
const recursiveCli = await initLegacyESLint("eslintrc.json", {
extensions: [".js", ".markdown", ".md"],
});
const results = await recursiveCli.lintText(code, {
Expand Down Expand Up @@ -466,8 +477,8 @@ describe("LegacyESLint", () => {
});

describe("should fix code", () => {
before(() => {
eslint = initLegacyESLint("eslintrc.json", { fix: true });
before(async () => {
eslint = await initLegacyESLint("eslintrc.json", { fix: true });
});

it("in the simplest case", async () => {
Expand Down Expand Up @@ -1462,52 +1473,6 @@ describe("FlatESLint", () => {
assert.strictEqual(results[0].messages[0].column, 1);
});

// https://github.com/eslint/markdown/issues/181
it("should work when called on nested code blocks in the same file", async () => {
Comment thread
lumirlumir marked this conversation as resolved.
/*
* As of this writing, the nested code block, though it uses the same
* Markdown processor, must use a different extension or ESLint will not
* re-apply the processor on the nested code block. To work around that,
* a file named `test.md` contains a nested `markdown` code block in
* this test.
*
* https://github.com/eslint/eslint/pull/14227/files#r602802758
*/
const code = [
"<!-- test.md -->",
"",
"````markdown",
"<!-- test.md/0_0.markdown -->",
"",
"This test only repros if the MD files have a different number of lines before code blocks.",
"",
"```js",
"// test.md/0_0.markdown/0_0.js",
"console.log('single quotes')",
"```",
"````",
].join("\n");
const recursiveCli = initLegacyESLint("eslintrc.json", {
extensions: [".js", ".markdown", ".md"],
});
const results = await recursiveCli.lintText(code, {
filePath: "test.md",
});

assert.strictEqual(results.length, 1);
assert.strictEqual(results[0].messages.length, 2);
assert.strictEqual(
results[0].messages[0].message,
"Unexpected console statement.",
);
assert.strictEqual(results[0].messages[0].line, 10);
assert.strictEqual(
results[0].messages[1].message,
"Strings must use doublequote.",
);
assert.strictEqual(results[0].messages[1].line, 10);
});

describe("configuration comments", () => {
it("apply only to the code block immediately following", async () => {
const code = [
Expand Down Expand Up @@ -1582,7 +1547,7 @@ describe("FlatESLint", () => {

describe("should fix code", () => {
before(() => {
eslint = initLegacyESLint("eslintrc.json", { fix: true });
eslint = initFlatESLint("eslint.config.js", { fix: true });
});

it("in the simplest case", async () => {
Expand Down
6 changes: 3 additions & 3 deletions tests/types/types.test.ts
Comment thread
lumirlumir marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type {
RangeMap,
Block,
} from "@eslint/markdown";
import type { SourceLocation, SourceRange } from "@eslint/core";
import type { ESLint, Linter } from "eslint";
import type { Plugin, SourceLocation, SourceRange } from "@eslint/core";
import type { Linter } from "eslint";
import type { Position } from "unist";
import type {
// Nodes (abstract)
Expand Down Expand Up @@ -89,7 +89,7 @@ const invalidBlock: Block = {
value: "code",
};

markdown satisfies ESLint.Plugin;
markdown satisfies Plugin;
markdown.meta.name satisfies string;
markdown.meta.version satisfies string;

Expand Down
Loading