diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml
index ca2b6f0a..4903f3b2 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.yml
+++ b/.github/ISSUE_TEMPLATE/bug-report.yml
@@ -19,6 +19,8 @@ body:
required: false
- label: "`@eslint/core`"
required: false
+ - label: "`@eslint/mcp`"
+ required: false
- label: "`@eslint/migrate-config`"
required: false
- label: "`@eslint/object-schema`"
diff --git a/.github/ISSUE_TEMPLATE/change.yml b/.github/ISSUE_TEMPLATE/change.yml
index b0ae51d3..7fe3fa6a 100644
--- a/.github/ISSUE_TEMPLATE/change.yml
+++ b/.github/ISSUE_TEMPLATE/change.yml
@@ -18,6 +18,8 @@ body:
required: false
- label: "`@eslint/core`"
required: false
+ - label: "`@eslint/mcp`"
+ required: false
- label: "`@eslint/migrate-config`"
required: false
- label: "`@eslint/object-schema`"
diff --git a/.github/renovate.json5 b/.github/renovate.json5
index 7766f250..d226b633 100644
--- a/.github/renovate.json5
+++ b/.github/renovate.json5
@@ -23,5 +23,12 @@
addLabels: ["deps:npm"],
matchManagers: ["npm"],
},
+ {
+ description: "Update ESLint packages together.",
+ groupName: "eslint",
+ matchPackagePrefixes: ["@eslint/"],
+ matchPackageNames: ["eslint", "eslint-config-eslint", "espree"],
+ minimumReleaseAge: null, // Don't wait for these packages
+ },
],
}
diff --git a/.github/workflows/bun-test.yml b/.github/workflows/bun-test.yml
new file mode 100644
index 00000000..1de262fe
--- /dev/null
+++ b/.github/workflows/bun-test.yml
@@ -0,0 +1,32 @@
+name: Bun CI
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ matrix:
+ os: [windows-latest, macOS-latest, ubuntu-latest]
+ bun: [latest]
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Use Bun ${{ matrix.bun }} ${{ matrix.os }}
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: ${{ matrix.bun }}
+ - name: bun install, build, and test
+ run: |
+ bun install
+ bun run --bun build
+ bun run --bun test
+ env:
+ CI: true
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a52a4371..d85142c2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,7 +36,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
- node-version: [18.x, 20.x, 22.x, 23.x]
+ node-version: [18.x, 20.x, 22.x, 24.x]
steps:
- uses: actions/checkout@v4
diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml
index dd525c79..bdfe9cb4 100644
--- a/.github/workflows/manual-publish.yml
+++ b/.github/workflows/manual-publish.yml
@@ -12,7 +12,9 @@ on:
# packages-start
- compat
- config-array
+ - config-helpers
- core
+ - mcp
- migrate-config
- object-schema
- plugin-kit
@@ -63,8 +65,12 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish to JSR
- if: ${{ inputs.package != 'migrate-config' }}
- run: npx jsr publish
+ run: |
+ if [ -f "jsr.json" ]; then
+ npx jsr publish
+ else
+ echo "No jsr.json file found, skipping JSR publish."
+ fi
working-directory: packages/${{ inputs.package }}
- name: Post Release Announcement
diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml
index 031607de..1374f0c6 100644
--- a/.github/workflows/release-please.yml
+++ b/.github/workflows/release-please.yml
@@ -279,3 +279,28 @@ jobs:
BLUESKY_IDENTIFIER: ${{ vars.BLUESKY_IDENTIFIER }}
BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }}
BLUESKY_HOST: ${{ vars.BLUESKY_HOST }}
+
+ #-----------------------------------------------------------------------------
+ # @eslint/mcp
+ #-----------------------------------------------------------------------------
+ - name: Publish @eslint/mcp package to npm
+ run: npm publish -w packages/mcp --provenance
+ if: ${{ steps.release.outputs['packages/mcp--release_created'] }}
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
+
+ # Note: No JSR package because JSR doesn't support CLIs
+
+ - name: Post Release Announcement
+ run: npx @humanwhocodes/crosspost -t -b -m "eslint/mcp v${{ steps.release.outputs['packages/mcp--major'] }}.${{ steps.release.outputs['packages/mcp--minor'] }}.${{ steps.release.outputs['packages/mcp--patch'] }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/${{ steps.release.outputs['packages/mcp--tag_name'] }}"
+ if: ${{ steps.release.outputs['packages/mcp--release_created'] }}
+ env:
+ TWITTER_API_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
+ TWITTER_API_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
+ TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
+ TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
+ MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
+ MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
+ BLUESKY_IDENTIFIER: ${{ vars.BLUESKY_IDENTIFIER }}
+ BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }}
+ BLUESKY_HOST: ${{ vars.BLUESKY_HOST }}
diff --git a/.gitignore b/.gitignore
index 350ceef7..bfadbe84 100644
--- a/.gitignore
+++ b/.gitignore
@@ -134,3 +134,8 @@ dist
package-lock.json
yarn.lock
+
+# VS Code configuration
+.vscode
+*.code-workspace
+bun.lockb
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 66821b91..63e9ee89 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,9 +1,10 @@
{
- "packages/compat": "1.2.8",
- "packages/config-array": "0.20.0",
- "packages/core": "0.14.0",
- "packages/migrate-config": "1.4.1",
- "packages/config-helpers": "0.2.1",
+ "packages/compat": "1.3.0",
+ "packages/config-array": "0.20.1",
+ "packages/config-helpers": "0.2.3",
+ "packages/core": "0.15.0",
+ "packages/mcp": "0.1.0",
+ "packages/migrate-config": "1.5.1",
"packages/object-schema": "2.1.6",
- "packages/plugin-kit": "0.2.8"
+ "packages/plugin-kit": "0.3.2"
}
diff --git a/README.md b/README.md
index d9afaf21..f6584347 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ This repository is the home of the following packages:
- [`@eslint/config-array`](./packages/config-array)
- [`@eslint/config-helpers`](./packages/config-helpers)
- [`@eslint/core`](./packages/core)
+- [`@eslint/mcp`](./packages/mcp)
- [`@eslint/migrate-config`](./packages/migrate-config)
- [`@eslint/object-schema`](./packages/object-schema)
- [`@eslint/plugin-kit`](./packages/plugin-kit)
@@ -30,11 +31,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/eslint.config.js b/eslint.config.js
index 7e0c9718..57eaab00 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -59,6 +59,7 @@ export default defineConfig([
// TypeScript
...tseslint.config({
files: ["**/*.ts"],
+ ignores: ["**/tests/**/*.ts"],
extends: [...tseslint.configs.strict, ...tseslint.configs.stylistic],
rules: {
"no-use-before-define": "off",
diff --git a/package.json b/package.json
index a9e2d47f..97a25f86 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
"devDependencies": {
"@eslint/config-helpers": "file:packages/config-helpers",
"@types/mocha": "^10.0.7",
- "eslint": "^9.11.1",
+ "eslint": "^9.27.0",
"eslint-config-eslint": "^11.0.0",
"got": "^14.4.1",
"lint-staged": "^15.2.0",
diff --git a/packages/compat/CHANGELOG.md b/packages/compat/CHANGELOG.md
index bf03d053..e258a897 100644
--- a/packages/compat/CHANGELOG.md
+++ b/packages/compat/CHANGELOG.md
@@ -1,5 +1,26 @@
# Changelog
+## [1.3.0](https://github.com/eslint/rewrite/compare/compat-v1.2.9...compat-v1.3.0) (2025-06-09)
+
+
+### Features
+
+* add support for custom name parameter to `includeIgnoreFile` ([#211](https://github.com/eslint/rewrite/issues/211)) ([3e18175](https://github.com/eslint/rewrite/commit/3e1817535e75f6feca7aee6d9ec2afaa0f6ad859))
+
+
+### Dependencies
+
+* The following workspace dependencies were updated
+ * devDependencies
+ * @eslint/core bumped from ^0.14.0 to ^0.15.0
+
+## [1.2.9](https://github.com/eslint/rewrite/compare/compat-v1.2.8...compat-v1.2.9) (2025-05-01)
+
+
+### Bug Fixes
+
+* Upgrade @eslint/core ([#197](https://github.com/eslint/rewrite/issues/197)) ([a830283](https://github.com/eslint/rewrite/commit/a830283cd05a7a471aeec5f4589491f3c4092986))
+
## [1.2.8](https://github.com/eslint/rewrite/compare/compat-v1.2.7...compat-v1.2.8) (2025-04-01)
diff --git a/packages/compat/README.md b/packages/compat/README.md
index 291f91d3..911bac9c 100644
--- a/packages/compat/README.md
+++ b/packages/compat/README.md
@@ -17,7 +17,7 @@ yarn add @eslint/compat -D
# or
pnpm install @eslint/compat -D
# or
-bun install @eslint/compat -D
+bun add @eslint/compat -D
```
For Deno:
@@ -145,7 +145,9 @@ module.exports = [
### Including Ignore Files
-If you were using an alternate ignore file in ESLint v8.x, such as using `--ignore-path .gitignore` on the command line, you can include those patterns programmatically in your config file using the `includeIgnoreFile()` function. For example:
+If you were using an alternate ignore file in ESLint v8.x, such as using `--ignore-path .gitignore` on the command line, you can include those patterns programmatically in your config file using the `includeIgnoreFile()` function.
+
+The `includeIgnoreFile()` function also accepts a second optional `name` parameter that allows you to set a custom name for this configuration object. If not specified, it defaults to `"Imported .gitignore patterns"`. For example:
```js
// eslint.config.js - ESM example
@@ -158,7 +160,7 @@ const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");
export default [
- includeIgnoreFile(gitignorePath),
+ includeIgnoreFile(gitignorePath, "Imported .gitignore patterns"), // second argument is optional.
{
// your overrides
},
@@ -174,7 +176,7 @@ const path = require("node:path");
const gitignorePath = path.resolve(__dirname, ".gitignore");
module.exports = [
- includeIgnoreFile(gitignorePath),
+ includeIgnoreFile(gitignorePath, "Imported .gitignore patterns"), // second argument is optional.
{
// your overrides
},
@@ -196,11 +198,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/packages/compat/jsr.json b/packages/compat/jsr.json
index f83b79bb..b38aa4d0 100644
--- a/packages/compat/jsr.json
+++ b/packages/compat/jsr.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/compat",
- "version": "1.2.8",
+ "version": "1.3.0",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
diff --git a/packages/compat/package.json b/packages/compat/package.json
index c60858f0..cb410317 100644
--- a/packages/compat/package.json
+++ b/packages/compat/package.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/compat",
- "version": "1.2.8",
+ "version": "1.3.0",
"description": "Compatibility utilities for ESLint",
"type": "module",
"main": "dist/esm/index.js",
@@ -33,7 +33,8 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/compat"
},
"keywords": [
"eslint",
@@ -46,11 +47,11 @@
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
- "homepage": "https://github.com/eslint/rewrite#readme",
+ "homepage": "https://github.com/eslint/rewrite/tree/main/packages/compat#readme",
"devDependencies": {
- "@eslint/core": "^0.13.0",
+ "@eslint/core": "^0.15.0",
"c8": "^9.1.0",
- "eslint": "^9.11.0",
+ "eslint": "^9.27.0",
"mocha": "^10.4.0",
"rollup": "^4.16.2",
"typescript": "^5.4.5"
diff --git a/packages/compat/src/ignore-file.js b/packages/compat/src/ignore-file.js
index bd3a0622..c5f996bf 100644
--- a/packages/compat/src/ignore-file.js
+++ b/packages/compat/src/ignore-file.js
@@ -68,10 +68,11 @@ export function convertIgnorePatternToMinimatch(pattern) {
/**
* Reads an ignore file and returns an object with the ignore patterns.
* @param {string} ignoreFilePath The absolute path to the ignore file.
+ * @param {string} [name] The name of the ignore file config.
* @returns {FlatConfig} An object with an `ignores` property that is an array of ignore patterns.
* @throws {Error} If the ignore file path is not an absolute path.
*/
-export function includeIgnoreFile(ignoreFilePath) {
+export function includeIgnoreFile(ignoreFilePath, name) {
if (!path.isAbsolute(ignoreFilePath)) {
throw new Error("The ignore file location must be an absolute path.");
}
@@ -80,7 +81,7 @@ export function includeIgnoreFile(ignoreFilePath) {
const lines = ignoreFile.split(/\r?\n/u);
return {
- name: "Imported .gitignore patterns",
+ name: name || "Imported .gitignore patterns",
ignores: lines
.map(line => line.trim())
.filter(line => line && !line.startsWith("#"))
diff --git a/packages/compat/tests/ignore-file.js b/packages/compat/tests/ignore-file.js
index ebc6cd25..60a48a8a 100644
--- a/packages/compat/tests/ignore-file.js
+++ b/packages/compat/tests/ignore-file.js
@@ -88,5 +88,28 @@ describe("@eslint/compat", () => {
],
});
});
+
+ it("should return an object with a custom name", () => {
+ const ignoreFilePath = fileURLToPath(
+ new URL(
+ "../tests/fixtures/ignore-files/gitignore1.txt",
+ import.meta.url,
+ ),
+ );
+ const result = includeIgnoreFile(ignoreFilePath, "Custom Name");
+ assert.deepStrictEqual(result, {
+ name: "Custom Name",
+ ignores: [
+ "**/node_modules",
+ "!fixtures/node_modules",
+ "dist",
+ "**/*.log",
+ "**/.cache/",
+ ".vuepress/dist",
+ "*/foo.js",
+ "dir/**/*",
+ ],
+ });
+ });
});
});
diff --git a/packages/config-array/CHANGELOG.md b/packages/config-array/CHANGELOG.md
index 410007d5..4ede3a8d 100644
--- a/packages/config-array/CHANGELOG.md
+++ b/packages/config-array/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## [0.20.1](https://github.com/eslint/rewrite/compare/config-array-v0.20.0...config-array-v0.20.1) (2025-06-09)
+
+
+### Bug Fixes
+
+* consider negated patterns universal ([#220](https://github.com/eslint/rewrite/issues/220)) ([2dbe2b9](https://github.com/eslint/rewrite/commit/2dbe2b9c9431997bb4a1ab0335d8101564b62a41))
+* explicit match in array elements of `files` ([#218](https://github.com/eslint/rewrite/issues/218)) ([e84cbd7](https://github.com/eslint/rewrite/commit/e84cbd7468765c25c01fc420b43d75a256533da2))
+
## [0.20.0](https://github.com/eslint/rewrite/compare/config-array-v0.19.2...config-array-v0.20.0) (2025-03-24)
diff --git a/packages/config-array/README.md b/packages/config-array/README.md
index a4cb704d..5c3feb48 100644
--- a/packages/config-array/README.md
+++ b/packages/config-array/README.md
@@ -17,7 +17,7 @@ yarn add @eslint/config-array
# or
pnpm install @eslint/config-array
# or
-bun install @eslint/config-array
+bun add @eslint/config-array
```
For Deno:
@@ -348,11 +348,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/packages/config-array/jsr.json b/packages/config-array/jsr.json
index 4bc929c6..e8630642 100644
--- a/packages/config-array/jsr.json
+++ b/packages/config-array/jsr.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/config-array",
- "version": "0.20.0",
+ "version": "0.20.1",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
diff --git a/packages/config-array/package.json b/packages/config-array/package.json
index 866d1bbc..6bba334c 100644
--- a/packages/config-array/package.json
+++ b/packages/config-array/package.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/config-array",
- "version": "0.20.0",
+ "version": "0.20.1",
"description": "General purpose glob-based configuration matching.",
"author": "Nicholas C. Zakas",
"type": "module",
@@ -24,12 +24,13 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/config-array"
},
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
- "homepage": "https://github.com/eslint/rewrite#readme",
+ "homepage": "https://github.com/eslint/rewrite/tree/main/packages/config-array#readme",
"scripts": {
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
diff --git a/packages/config-array/src/config-array.js b/packages/config-array/src/config-array.js
index de4e063c..a9c0d177 100644
--- a/packages/config-array/src/config-array.js
+++ b/packages/config-array/src/config-array.js
@@ -555,7 +555,7 @@ function assertNormalized(configArray) {
* Ensures that config types are valid.
* @param {Array} extraConfigTypes The config types to check.
* @returns {void}
- * @throws {Error} When the config types array is invalid.
+ * @throws {TypeError} When the config types array is invalid.
*/
function assertExtraConfigTypes(extraConfigTypes) {
if (extraConfigTypes.length > 2) {
@@ -577,7 +577,7 @@ function assertExtraConfigTypes(extraConfigTypes) {
* Returns path-handling implementations for Unix or Windows, depending on a given absolute path.
* @param {string} fileOrDirPath The absolute path to check.
* @returns {PathImpl} Path-handling implementations for the specified path.
- * @throws An error is thrown if the specified argument is not an absolute path.
+ * @throws {Error} An error is thrown if the specified argument is not an absolute path.
*/
function getPathImpl(fileOrDirPath) {
// Posix absolute paths always start with a slash.
@@ -655,6 +655,7 @@ export class ConfigArray extends Array {
* @param {Object} [options.schema] The additional schema
* definitions to use for the ConfigArray schema.
* @param {Array} [options.extraConfigTypes] List of config types supported.
+ * @throws {TypeError} When the `basePath` is not a non-empty string,
*/
constructor(
configs,
@@ -978,7 +979,7 @@ export class ConfigArray extends Array {
const matchingConfigIndices = [];
let matchFound = false;
- const universalPattern = /^\*$|\/\*{1,2}$/u;
+ const universalPattern = /^\*$|^!|\/\*{1,2}$/u;
this.forEach((config, index) => {
if (!config.files) {
@@ -1009,18 +1010,42 @@ export class ConfigArray extends Array {
* a file with a specific extensions such as *.js.
*/
- const universalFiles = config.files.filter(pattern =>
- universalPattern.test(pattern),
- );
+ const nonUniversalFiles = [];
+ const universalFiles = config.files.filter(element => {
+ if (Array.isArray(element)) {
+ /*
+ * filePath matches an element that is an array only if it matches
+ * all patterns in it (AND operation). Therefore, if there is at least
+ * one non-universal pattern in the array, and filePath matches the array,
+ * then we know for sure that filePath matches at least one non-universal
+ * pattern, so we can consider the entire array to be non-universal.
+ * In other words, all patterns in the array need to be universal
+ * for it to be considered universal.
+ */
+ if (
+ element.every(pattern => universalPattern.test(pattern))
+ ) {
+ return true;
+ }
+
+ nonUniversalFiles.push(element);
+ return false;
+ }
+
+ // element is a string
+
+ if (universalPattern.test(element)) {
+ return true;
+ }
+
+ nonUniversalFiles.push(element);
+ return false;
+ });
// universal patterns were found so we need to check the config twice
if (universalFiles.length) {
debug("Universal files patterns found. Checking carefully.");
- const nonUniversalFiles = config.files.filter(
- pattern => !universalPattern.test(pattern),
- );
-
// check that the config matches without the non-universal files first
if (
nonUniversalFiles.length &&
diff --git a/packages/config-array/tests/config-array.test.js b/packages/config-array/tests/config-array.test.js
index d8dfe154..88a57722 100644
--- a/packages/config-array/tests/config-array.test.js
+++ b/packages/config-array/tests/config-array.test.js
@@ -883,6 +883,34 @@ describe("ConfigArray", () => {
assert.strictEqual(config2, undefined);
});
+ it("should match any filename with a config object that has `[]` in files", () => {
+ configs = new ConfigArray(
+ [
+ {
+ files: [[]],
+ defs: {
+ "test-def": "test-value",
+ },
+ },
+ {
+ files: ["**/*.js"], // `[]` is not an explicit match, so we need to add an explicit match
+ },
+ ],
+ {
+ basePath,
+ schema,
+ },
+ );
+
+ configs.normalizeSync();
+
+ assert.deepStrictEqual(configs.getConfig("foo/a.js"), {
+ defs: {
+ "test-def": "test-value",
+ },
+ });
+ });
+
it("should calculate correct config when passed JS filename that matches a async function config", () => {
const configsToTest = createConfigArray();
configsToTest.push(context =>
@@ -1497,12 +1525,12 @@ describe("ConfigArray", () => {
);
});
- it('should return "matched" when passed docx filename', () => {
+ it('should return "unconfigured" when passed docx filename', () => {
const filename = "sss.docx";
assert.strictEqual(
configs.getConfigStatus(filename),
- "matched",
+ "unconfigured",
);
});
@@ -1833,6 +1861,42 @@ describe("ConfigArray", () => {
);
});
+ it('should return "matched" when there is at least one non-universal match, "unconfigured" otherwise', () => {
+ [
+ [["**/*.js", "foo/**"]],
+ [["foo/**", "**/*.js"]],
+ [["**/*.js", "foo/**"], "bar/**"],
+ [["foo/**", "**/*.js"], "bar/**"],
+ [["bar/**"], "foo/*.js"],
+ [[], "foo/*.js"],
+ [["bar/**", "!bar/b.js"], "foo/*.js"],
+ ["!b.js", "foo/*.js"],
+ ].forEach(files => {
+ configs = new ConfigArray(
+ [
+ {
+ files,
+ },
+ ],
+ {
+ basePath,
+ },
+ );
+
+ configs.normalizeSync();
+
+ assert.strictEqual(
+ configs.getConfigStatus("foo/a.js"),
+ "matched",
+ );
+
+ assert.strictEqual(
+ configs.getConfigStatus("bar/a.js"),
+ "unconfigured",
+ );
+ });
+ });
+
it('should return "matched" when file has the same name as a directory that is ignored by a pattern that ends with `/`', () => {
configs = new ConfigArray(
[
@@ -3524,9 +3588,11 @@ describe("ConfigArray", () => {
describe("push()", () => {
it("should throw an error when normalized", () => {
+ // Note: In Node.js the error message contains the word "extensible"
+ // In Bun the error message contains the word "readonly"
assert.throws(() => {
configs.push({});
- }, /extensible/u);
+ }, /extensible|readonly/u);
});
});
});
diff --git a/packages/config-helpers/CHANGELOG.md b/packages/config-helpers/CHANGELOG.md
index dc9c1735..f71d7635 100644
--- a/packages/config-helpers/CHANGELOG.md
+++ b/packages/config-helpers/CHANGELOG.md
@@ -1,5 +1,21 @@
# Changelog
+## [0.2.3](https://github.com/eslint/rewrite/compare/config-helpers-v0.2.2...config-helpers-v0.2.3) (2025-06-09)
+
+
+### Dependencies
+
+* The following workspace dependencies were updated
+ * devDependencies
+ * @eslint/core bumped from ^0.14.0 to ^0.15.0
+
+## [0.2.2](https://github.com/eslint/rewrite/compare/config-helpers-v0.2.1...config-helpers-v0.2.2) (2025-05-01)
+
+
+### Bug Fixes
+
+* Upgrade @eslint/core ([#197](https://github.com/eslint/rewrite/issues/197)) ([a830283](https://github.com/eslint/rewrite/commit/a830283cd05a7a471aeec5f4589491f3c4092986))
+
## [0.2.1](https://github.com/eslint/rewrite/compare/config-helpers-v0.2.0...config-helpers-v0.2.1) (2025-04-01)
diff --git a/packages/config-helpers/README.md b/packages/config-helpers/README.md
index 54d8e476..0e4650de 100644
--- a/packages/config-helpers/README.md
+++ b/packages/config-helpers/README.md
@@ -15,7 +15,7 @@ yarn add @eslint/config-helpers
# or
pnpm install @eslint/config-helpers
# or
-bun install @eslint/config-helpers
+bun add @eslint/config-helpers
```
For Deno:
@@ -87,11 +87,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/packages/config-helpers/jsr.json b/packages/config-helpers/jsr.json
index 77f0da5c..9159f84e 100644
--- a/packages/config-helpers/jsr.json
+++ b/packages/config-helpers/jsr.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/config-helpers",
- "version": "0.2.1",
+ "version": "0.2.3",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
diff --git a/packages/config-helpers/package.json b/packages/config-helpers/package.json
index 6713f43b..384da890 100644
--- a/packages/config-helpers/package.json
+++ b/packages/config-helpers/package.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/config-helpers",
- "version": "0.2.1",
+ "version": "0.2.3",
"description": "Helper utilities for creating ESLint configuration",
"type": "module",
"main": "dist/esm/index.js",
@@ -35,7 +35,8 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/config-helpers"
},
"keywords": [
"eslint"
@@ -46,9 +47,9 @@
},
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/config-helpers#readme",
"devDependencies": {
- "@eslint/core": "^0.13.0",
+ "@eslint/core": "^0.15.0",
"c8": "^9.1.0",
- "eslint": "^9.19.0",
+ "eslint": "^9.27.0",
"mocha": "^10.4.0",
"rollup": "^4.16.2",
"rollup-plugin-copy": "^3.5.0",
diff --git a/packages/config-helpers/src/define-config.js b/packages/config-helpers/src/define-config.js
index 00eb8410..b04141a5 100644
--- a/packages/config-helpers/src/define-config.js
+++ b/packages/config-helpers/src/define-config.js
@@ -136,7 +136,6 @@ function getPluginMember(id) {
* @return {Config} The normalized config object.
*/
function normalizePluginConfig(userNamespace, plugin, config) {
- // @ts-ignore -- ESLint types aren't updated yet
const pluginNamespace = plugin.meta?.namespace;
// don't do anything if the plugin doesn't have a namespace or rules
@@ -205,6 +204,7 @@ function normalizePluginConfig(userNamespace, plugin, config) {
* @param {Config|LegacyConfig|(Config|LegacyConfig)[]} pluginConfig The plugin config to normalize.
* @param {string} pluginConfigName The name of the plugin config.
* @return {InfiniteConfigArray} The normalized plugin config.
+ * @throws {TypeError} If the plugin config is a legacy config.
*/
function deepNormalizePluginConfig(
userPluginNamespace,
@@ -239,6 +239,7 @@ function deepNormalizePluginConfig(
* @param {Config} config The config object.
* @param {string} pluginConfigName The name of the plugin config.
* @return {InfiniteConfigArray} The plugin config.
+ * @throws {TypeError} If the plugin config is not found or is a legacy config.
*/
function findPluginConfig(config, pluginConfigName) {
const { namespace: userPluginNamespace, name: configName } =
@@ -387,6 +388,7 @@ function extendConfig(baseConfig, baseConfigName, extension, extensionName) {
* @param {ConfigWithExtends} config The config object.
* @param {WeakMap} configNames The map of config objects to their names.
* @return {Config[]} The flattened list of config objects.
+ * @throws {TypeError} If the `extends` property is not an array or if nested `extends` is found.
*/
function processExtends(config, configNames) {
if (!config.extends) {
@@ -491,6 +493,7 @@ function processConfigList(configList, configNames) {
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
* @returns {Config[]} The config array.
+ * @throws {TypeError} If no arguments are provided or if an argument is not an object.
*/
export function defineConfig(...args) {
const configNames = new WeakMap();
diff --git a/packages/config-helpers/src/global-ignores.js b/packages/config-helpers/src/global-ignores.js
index f28289c9..062bb15d 100644
--- a/packages/config-helpers/src/global-ignores.js
+++ b/packages/config-helpers/src/global-ignores.js
@@ -24,6 +24,7 @@ let globalIgnoreCount = 0;
* @param {string[]} ignorePatterns The ignore patterns.
* @param {string} [name] The name of the global ignores config.
* @returns {Config} The global ignores config.
+ * @throws {TypeError} If ignorePatterns is not an array or if it is empty.
*/
export function globalIgnores(ignorePatterns, name) {
if (!Array.isArray(ignorePatterns)) {
diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md
index 2890ee30..ab8df483 100644
--- a/packages/core/CHANGELOG.md
+++ b/packages/core/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## [0.15.0](https://github.com/eslint/rewrite/compare/core-v0.14.0...core-v0.15.0) (2025-06-09)
+
+
+### Features
+
+* Add extendable config types ([#210](https://github.com/eslint/rewrite/issues/210)) ([3089754](https://github.com/eslint/rewrite/commit/3089754848c1acd30368424271810cc9703a6cd4))
+
## [0.14.0](https://github.com/eslint/rewrite/compare/core-v0.13.0...core-v0.14.0) (2025-04-30)
diff --git a/packages/core/README.md b/packages/core/README.md
index a288c3c5..19e8222c 100644
--- a/packages/core/README.md
+++ b/packages/core/README.md
@@ -19,11 +19,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/packages/core/jsr.json b/packages/core/jsr.json
index b7f874fe..34707a86 100644
--- a/packages/core/jsr.json
+++ b/packages/core/jsr.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/core",
- "version": "0.14.0",
+ "version": "0.15.0",
"exports": "./dist/esm/types.d.ts",
"publish": {
"include": [
diff --git a/packages/core/package.json b/packages/core/package.json
index 35b58f05..8952f32d 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/core",
- "version": "0.14.0",
+ "version": "0.15.0",
"description": "Runtime-agnostic core of ESLint",
"type": "module",
"types": "./dist/esm/types.d.ts",
@@ -24,7 +24,8 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/core"
},
"keywords": [
"eslint",
@@ -35,11 +36,12 @@
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
- "homepage": "https://github.com/eslint/rewrite#readme",
+ "homepage": "https://github.com/eslint/rewrite/tree/main/packages/core#readme",
"dependencies": {
"@types/json-schema": "^7.0.15"
},
"devDependencies": {
+ "json-schema": "^0.4.0",
"typescript": "^5.8.3"
},
"engines": {
diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts
index 3441052d..f2c7d277 100644
--- a/packages/core/src/types.ts
+++ b/packages/core/src/types.ts
@@ -666,22 +666,36 @@ export interface LinterOptionsConfig {
* Indicates what to do when an unused disable directive is found.
*/
reportUnusedDisableDirectives?: boolean | Severity;
+
+ /**
+ * A severity value indicating if and how unused inline configs should be
+ * tracked and reported.
+ */
+ reportUnusedInlineConfigs?: Severity;
}
/**
- * Shared settings that are accessible from within plugins.
+ * The configuration for a rule.
*/
-export type SettingsConfig = Record;
+export type RuleConfig =
+ | Severity
+ | [Severity, ...RuleOptions];
+/* eslint-disable @typescript-eslint/consistent-indexed-object-style -- needed to allow extension */
/**
- * The configuration for a rule.
+ * A collection of rules and their configurations.
*/
-export type RuleConfig = Severity | [Severity, ...unknown[]];
+export interface RulesConfig {
+ [key: string]: RuleConfig;
+}
/**
- * A collection of rules and their configurations.
+ * A collection of settings.
*/
-export type RulesConfig = Record;
+export interface SettingsConfig {
+ [key: string]: unknown;
+}
+/* eslint-enable @typescript-eslint/consistent-indexed-object-style -- needed to allow extension */
//------------------------------------------------------------------------------
// Languages
diff --git a/packages/core/tests/types/types.test.ts b/packages/core/tests/types/types.test.ts
index 6f066727..dc2c3081 100644
--- a/packages/core/tests/types/types.test.ts
+++ b/packages/core/tests/types/types.test.ts
@@ -15,8 +15,10 @@ import type {
Language,
LanguageContext,
LanguageOptions,
+ LinterOptionsConfig,
OkParseResult,
ParseResult,
+ RuleConfig,
RuleContext,
RuleDefinition,
RulesConfig,
@@ -24,6 +26,7 @@ import type {
RuleTextEdit,
RuleTextEditor,
RuleVisitor,
+ SettingsConfig,
SourceLocation,
SourceRange,
TextSourceCode,
@@ -46,6 +49,41 @@ interface TestRootNode {
length: number;
}
+//-----------------------------------------------------------------------------
+// Tests for config types
+//-----------------------------------------------------------------------------
+
+const emptyRules: RulesConfig = {};
+
+const rules: RulesConfig = {
+ "no-console": "error",
+ "no-unused-vars": 0,
+ "json/no-duplicate-keys": ["warn"],
+ "css/use-baseline": [1, { available: "widely" }],
+};
+
+const emptySettings: SettingsConfig = {};
+
+const settings: SettingsConfig = {
+ foo: true,
+ bar: "baz",
+};
+
+const ruleConfig1: RuleConfig = "error";
+const ruleConfig2: RuleConfig = 1;
+const ruleConfig3: RuleConfig = ["error", { foo: "bar" }];
+const ruleConfig4: RuleConfig = ["error", "foo", "bar"];
+const ruleConfig5: RuleConfig<[{ available: "widely" | "newly" }]> = [
+ "error",
+ { available: "widely" },
+];
+
+const linterConfig: LinterOptionsConfig = {
+ noInlineConfig: true,
+ reportUnusedDisableDirectives: "error",
+ reportUnusedInlineConfigs: "warn",
+};
+
//-----------------------------------------------------------------------------
// Tests for shared types
//-----------------------------------------------------------------------------
diff --git a/packages/mcp/CHANGELOG.md b/packages/mcp/CHANGELOG.md
new file mode 100644
index 00000000..88df58e9
--- /dev/null
+++ b/packages/mcp/CHANGELOG.md
@@ -0,0 +1,10 @@
+# Changelog
+
+## 0.1.0 (2025-05-13)
+
+
+### Features
+
+* Add separate MCP server package ([#201](https://github.com/eslint/rewrite/issues/201)) ([99f41cf](https://github.com/eslint/rewrite/commit/99f41cf3c4788a3bc0111de807ce599b8084d480))
+
+## Changelog
diff --git a/packages/mcp/LICENSE b/packages/mcp/LICENSE
new file mode 100644
index 00000000..261eeb9e
--- /dev/null
+++ b/packages/mcp/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/mcp/README.md b/packages/mcp/README.md
new file mode 100644
index 00000000..90366511
--- /dev/null
+++ b/packages/mcp/README.md
@@ -0,0 +1,44 @@
+# ESLint MCP Server
+
+## Description
+
+[Model Context Protocol](https://modelcontextprotocol.io) (MCP) server for ESLint.
+
+## Usage
+
+The ESLint MCP server is designed to be run by an IDE-based MCP client like [Visual Studio Code's Copilot](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode). The command is:
+
+```shell
+npx @eslint/mcp
+```
+
+You can also run the server from the ESLint CLI, such as:
+
+```shell
+npx eslint --mcp
+```
+
+For further instructions please see the [documentation](https://eslint.org/docs/latest/use/mcp).
+
+## License
+
+Apache 2.0
+
+
+
+
+## Sponsors
+
+The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
+to get your logo on our READMEs and [website](https://eslint.org/sponsors).
+
+Diamond Sponsors
+
Platinum Sponsors
+

Gold Sponsors
+

Silver Sponsors
+

Bronze Sponsors
+

+Technology Sponsors
+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
+

+
diff --git a/packages/mcp/package.json b/packages/mcp/package.json
new file mode 100644
index 00000000..66d05d83
--- /dev/null
+++ b/packages/mcp/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "@eslint/mcp",
+ "version": "0.1.0",
+ "description": "MCP server for ESLint",
+ "type": "module",
+ "bin": "./src/mcp-cli.js",
+ "files": [
+ "src"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "directories": {
+ "test": "tests"
+ },
+ "scripts": {
+ "build": "tsc",
+ "test": "mocha tests/*.js",
+ "test:coverage": "c8 npm test"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/mcp"
+ },
+ "keywords": [
+ "eslint",
+ "mcp"
+ ],
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/eslint/rewrite/issues"
+ },
+ "homepage": "https://github.com/eslint/rewrite/tree/main/packages/mcp#readme",
+ "devDependencies": {
+ "c8": "^9.1.0",
+ "mocha": "^10.4.0",
+ "typescript": "^5.4.5"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.11.0",
+ "eslint": "^9.26.0",
+ "zod": "^3.24.4"
+ }
+}
diff --git a/packages/mcp/src/mcp-cli.js b/packages/mcp/src/mcp-cli.js
new file mode 100755
index 00000000..f684e07d
--- /dev/null
+++ b/packages/mcp/src/mcp-cli.js
@@ -0,0 +1,51 @@
+#!/usr/bin/env node
+/**
+ * @fileoverview CLI to run the MCP server.
+ * @author Nicholas C. Zakas
+ */
+
+/*
+ * IMPORTANT!
+ *
+ * Because this file is executable, `npm install` changes its permission to
+ * include the executable bit. This is a problem because it causes the file to
+ * be marked as changed in Git, even though it hasn't. This, in turn, causes
+ * JSR to think the directory is dirty and fails the build. To prevent this,
+ * we ran:
+ * $ git update-index --chmod=+x packages/mcp/src/mcp-cli.js
+ * This manually changes the executable bit in Git so that it doesn't think the file
+ * is changed.
+ */
+
+//-----------------------------------------------------------------------------
+// Imports
+//-----------------------------------------------------------------------------
+
+import { mcpServer } from "./mcp-server.js";
+import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
+
+//-----------------------------------------------------------------------------
+// Helpers
+//-----------------------------------------------------------------------------
+
+/**
+ * Disconnects the server and sets exit code to 0.
+ * @returns {void}
+ */
+function disconnect() {
+ mcpServer.close();
+ process.exitCode = 0;
+}
+
+//-----------------------------------------------------------------------------
+// Main
+//-----------------------------------------------------------------------------
+
+await mcpServer.connect(new StdioServerTransport());
+
+// Note: do not use console.log() because stdout is part of the server transport
+// eslint-disable-next-line no-console -- Needed to output information
+console.error(`ESLint MCP server is running. cwd: ${process.cwd()}`);
+
+process.on("SIGINT", disconnect);
+process.on("SIGTERM", disconnect);
diff --git a/packages/mcp/src/mcp-server.js b/packages/mcp/src/mcp-server.js
new file mode 100644
index 00000000..72bd27c7
--- /dev/null
+++ b/packages/mcp/src/mcp-server.js
@@ -0,0 +1,64 @@
+/**
+ * @fileoverview MCP Server for handling requests and responses to ESLint.
+ * @author Nicholas C. Zakas
+ */
+
+//-----------------------------------------------------------------------------
+// Requirements
+//-----------------------------------------------------------------------------
+
+import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
+import { z } from "zod";
+import { ESLint } from "eslint";
+
+//-----------------------------------------------------------------------------
+// Server
+//-----------------------------------------------------------------------------
+
+const mcpServer = new McpServer({
+ name: "ESLint",
+ version: "0.1.0", // x-release-please-version
+});
+
+// Important: Cursor throws an error when `describe()` is used in the schema.
+const filePathsSchema = {
+ filePaths: z.array(z.string().min(1)).nonempty(),
+};
+
+//-----------------------------------------------------------------------------
+// Tools
+//-----------------------------------------------------------------------------
+
+mcpServer.tool(
+ "lint-files",
+ "Lint files using ESLint. You must provide a list of absolute file paths to the files you want to lint. The absolute file paths should be in the correct format for your operating system (e.g., forward slashes on Unix-like systems, backslashes on Windows).",
+ filePathsSchema,
+ async ({ filePaths }) => {
+ const eslint = new ESLint({
+ // enable lookup from file rather than from cwd
+ flags: ["unstable_config_lookup_from_file"],
+ });
+
+ const type = /** @type {const} */ ("text");
+ const results = await eslint.lintFiles(filePaths);
+ const content = results.map(result => ({
+ type,
+ text: JSON.stringify(result),
+ }));
+
+ content.unshift({
+ type,
+ text: "Here are the results of running ESLint on the provided files:",
+ });
+ content.push({
+ type,
+ text: "Do not automatically fix these issues. You must ask the user for confirmation before attempting to fix the issues found.",
+ });
+
+ return {
+ content,
+ };
+ },
+);
+
+export { mcpServer };
diff --git a/packages/mcp/tests/fixtures/eslint.config.js b/packages/mcp/tests/fixtures/eslint.config.js
new file mode 100644
index 00000000..1d2e669a
--- /dev/null
+++ b/packages/mcp/tests/fixtures/eslint.config.js
@@ -0,0 +1,7 @@
+export default [
+ {
+ rules: {
+ "no-undef": 2,
+ }
+ }
+];
diff --git a/packages/mcp/tests/fixtures/passing.js b/packages/mcp/tests/fixtures/passing.js
new file mode 100644
index 00000000..9dc2eb82
--- /dev/null
+++ b/packages/mcp/tests/fixtures/passing.js
@@ -0,0 +1,4 @@
+let foo = "bar";
+if (foo) {
+ foo = "bar2";
+}
diff --git a/packages/mcp/tests/fixtures/syntax-error.js b/packages/mcp/tests/fixtures/syntax-error.js
new file mode 100644
index 00000000..5c21341f
--- /dev/null
+++ b/packages/mcp/tests/fixtures/syntax-error.js
@@ -0,0 +1 @@
+{}}
diff --git a/packages/mcp/tests/mcp-cli.js b/packages/mcp/tests/mcp-cli.js
new file mode 100644
index 00000000..8638c221
--- /dev/null
+++ b/packages/mcp/tests/mcp-cli.js
@@ -0,0 +1,60 @@
+/**
+ * @fileoverview Tests for MCP server
+ * @author Nicholas C. Zakas
+ */
+
+//-----------------------------------------------------------------------------
+// Imports
+//-----------------------------------------------------------------------------
+
+import assert from "node:assert";
+import childProcess from "node:child_process";
+import path from "node:path";
+
+//-----------------------------------------------------------------------------
+// Helpers
+//-----------------------------------------------------------------------------
+
+const forkedProcesses = new Set();
+const EXECUTABLE_PATH = path.resolve("./src/mcp-cli.js");
+
+/**
+ * Forks the process to run an instance of ESLint.
+ * @returns {ChildProcess} The resulting child process
+ */
+function runServer(options) {
+ const newProcess = childProcess.fork(
+ EXECUTABLE_PATH,
+ [],
+ Object.assign({ silent: true }, options),
+ );
+
+ forkedProcesses.add(newProcess);
+ return newProcess;
+}
+
+//-----------------------------------------------------------------------------
+// Tests
+//-----------------------------------------------------------------------------
+
+describe("MCP server", () => {
+ it("should start the MCP server", done => {
+ const child = runServer();
+
+ // should not have anything on std out
+ child.stdout.on("data", data => {
+ assert.fail(`Unexpected stdout data: ${data}`);
+ });
+
+ child.stderr.on("data", data => {
+ assert.match(data.toString(), /ESLint MCP server is running/u);
+ done();
+ });
+ });
+
+ afterEach(() => {
+ // Clean up all the processes after every test.
+ forkedProcesses.forEach(child => child.kill());
+ forkedProcesses.clear();
+ });
+});
diff --git a/packages/mcp/tests/mcp-server.test.js b/packages/mcp/tests/mcp-server.test.js
new file mode 100644
index 00000000..d7be975a
--- /dev/null
+++ b/packages/mcp/tests/mcp-server.test.js
@@ -0,0 +1,165 @@
+/**
+ * @fileoverview Tests for MCP server
+ * @author Nicholas C. Zakas
+ */
+
+//-----------------------------------------------------------------------------
+// Requirements
+//-----------------------------------------------------------------------------
+
+import { mcpServer } from "../src/mcp-server.js";
+import assert from "node:assert";
+import path from "node:path";
+import { Client } from "@modelcontextprotocol/sdk/client/index.js";
+import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
+import { fileURLToPath } from "node:url";
+
+//-----------------------------------------------------------------------------
+// Helpers
+//-----------------------------------------------------------------------------
+
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+const passingFilePath = path.join(dirname, "fixtures", "passing.js");
+const syntaxErrorFilePath = path.join(dirname, "fixtures", "syntax-error.js");
+
+const filePathsJsonSchema = {
+ $schema: "http://json-schema.org/draft-07/schema#",
+ additionalProperties: false,
+ properties: {
+ filePaths: {
+ items: {
+ type: "string",
+ minLength: 1,
+ },
+ minItems: 1,
+ type: "array",
+ },
+ },
+ required: ["filePaths"],
+ type: "object",
+};
+
+//-----------------------------------------------------------------------------
+// Tests
+//-----------------------------------------------------------------------------
+
+describe("MCP Server", () => {
+ let client, clientTransport, serverTransport;
+
+ beforeEach(async () => {
+ client = new Client({
+ name: "test client",
+ version: "1.0",
+ });
+
+ [clientTransport, serverTransport] =
+ InMemoryTransport.createLinkedPair();
+
+ // Note: must connect server first or else client hangs
+ await mcpServer.connect(serverTransport);
+ await client.connect(clientTransport);
+ });
+
+ describe("Tools", () => {
+ it("should list tools", async () => {
+ const { tools } = await client.listTools();
+
+ assert.strictEqual(tools.length, 1);
+ assert.strictEqual(tools[0].name, "lint-files");
+ assert.deepStrictEqual(tools[0].inputSchema, filePathsJsonSchema);
+ });
+
+ describe("lint-files", () => {
+ it("should return zero lint messages for a valid file", async () => {
+ const { content: rawResults } = await client.callTool({
+ name: "lint-files",
+ arguments: {
+ filePaths: [passingFilePath],
+ },
+ });
+
+ const results = rawResults
+ .slice(1, rawResults.length - 1)
+ .map(({ type, text }) => ({
+ type,
+ text: JSON.parse(text),
+ }));
+
+ assert.deepStrictEqual(results, [
+ {
+ type: "text",
+ text: {
+ filePath: passingFilePath,
+ messages: [],
+ suppressedMessages: [],
+ errorCount: 0,
+ fatalErrorCount: 0,
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0,
+ usedDeprecatedRules: [],
+ },
+ },
+ ]);
+ });
+
+ it("should return zero lint messages for a valid file and a syntax error for an invalid file", async () => {
+ const { content: rawResults } = await client.callTool({
+ name: "lint-files",
+ arguments: {
+ filePaths: [passingFilePath, syntaxErrorFilePath],
+ },
+ });
+
+ const results = rawResults
+ .slice(1, rawResults.length - 1)
+ .map(({ type, text }) => ({
+ type,
+ text: JSON.parse(text),
+ }));
+ assert.deepStrictEqual(results, [
+ {
+ type: "text",
+ text: {
+ filePath: passingFilePath,
+ messages: [],
+ suppressedMessages: [],
+ errorCount: 0,
+ fatalErrorCount: 0,
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0,
+ usedDeprecatedRules: [],
+ },
+ },
+ {
+ type: "text",
+ text: {
+ filePath: syntaxErrorFilePath,
+ messages: [
+ {
+ ruleId: null,
+ severity: 2,
+ fatal: true,
+ message:
+ "Parsing error: Unexpected token }",
+ line: 1,
+ column: 3,
+ nodeType: null,
+ },
+ ],
+ suppressedMessages: [],
+ errorCount: 1,
+ fatalErrorCount: 1,
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0,
+ usedDeprecatedRules: [],
+ source: "{}}\n",
+ },
+ },
+ ]);
+ });
+ });
+ });
+});
diff --git a/packages/mcp/tsconfig.json b/packages/mcp/tsconfig.json
new file mode 100644
index 00000000..2ece54b6
--- /dev/null
+++ b/packages/mcp/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "files": ["src/mcp-cli.js"],
+ "compilerOptions": {
+ "noEmit": true,
+ "strict": true
+ }
+}
diff --git a/packages/migrate-config/CHANGELOG.md b/packages/migrate-config/CHANGELOG.md
index 8ff0ea5c..de806dfc 100644
--- a/packages/migrate-config/CHANGELOG.md
+++ b/packages/migrate-config/CHANGELOG.md
@@ -1,5 +1,35 @@
# Changelog
+## [1.5.1](https://github.com/eslint/rewrite/compare/migrate-config-v1.5.0...migrate-config-v1.5.1) (2025-06-09)
+
+
+### Dependencies
+
+* The following workspace dependencies were updated
+ * dependencies
+ * @eslint/compat bumped from ^1.2.9 to ^1.3.0
+
+## [1.5.0](https://github.com/eslint/rewrite/compare/migrate-config-v1.4.1...migrate-config-v1.5.0) (2025-05-01)
+
+
+### Features
+
+* Better conversion of .eslintrc.js files in migrate-config ([#172](https://github.com/eslint/rewrite/issues/172)) ([63cb367](https://github.com/eslint/rewrite/commit/63cb3679a4ac931120e6fedfdcb3d934d8f5ed9b))
+
+
+### Dependencies
+
+* The following workspace dependencies were updated
+ * dependencies
+ * @eslint/compat bumped from ^1.2.8 to ^1.2.9
+
+## [1.5.0](https://github.com/eslint/rewrite/compare/migrate-config-v1.4.1...migrate-config-v1.5.0) (2025-04-30)
+
+
+### Features
+
+* Better conversion of .eslintrc.js files in migrate-config ([#172](https://github.com/eslint/rewrite/issues/172)) ([63cb367](https://github.com/eslint/rewrite/commit/63cb3679a4ac931120e6fedfdcb3d934d8f5ed9b))
+
## [1.4.1](https://github.com/eslint/rewrite/compare/migrate-config-v1.4.0...migrate-config-v1.4.1) (2025-04-01)
diff --git a/packages/migrate-config/README.md b/packages/migrate-config/README.md
index 53c341d6..450a81c9 100644
--- a/packages/migrate-config/README.md
+++ b/packages/migrate-config/README.md
@@ -100,11 +100,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/packages/migrate-config/package.json b/packages/migrate-config/package.json
index 21f84c8b..560cee41 100644
--- a/packages/migrate-config/package.json
+++ b/packages/migrate-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/migrate-config",
- "version": "1.4.1",
+ "version": "1.5.1",
"description": "Configuration migration for ESLint",
"type": "module",
"bin": {
@@ -16,11 +16,13 @@
"test": "tests"
},
"scripts": {
- "test": "mocha tests/*.js"
+ "test": "mocha tests/*.js",
+ "test:coverage": "c8 npm test"
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/migrate-config"
},
"keywords": [
"eslint",
@@ -35,10 +37,10 @@
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
- "homepage": "https://github.com/eslint/rewrite#readme",
+ "homepage": "https://github.com/eslint/rewrite/tree/main/packages/migrate-config#readme",
"devDependencies": {
"@types/eslint": "^9.6.0",
- "eslint": "^9.0.0",
+ "eslint": "^9.27.0",
"mocha": "^10.4.0",
"typescript": "^5.4.5"
},
@@ -46,7 +48,7 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"dependencies": {
- "@eslint/compat": "^1.2.8",
+ "@eslint/compat": "^1.3.0",
"@eslint/eslintrc": "^3.1.0",
"camelcase": "^8.0.0",
"espree": "^10.3.0",
diff --git a/packages/object-schema/README.md b/packages/object-schema/README.md
index a303795d..2128755d 100644
--- a/packages/object-schema/README.md
+++ b/packages/object-schema/README.md
@@ -15,7 +15,7 @@ yarn add @eslint/object-schema
# or
pnpm install @eslint/object-schema
# or
-bun install @eslint/object-schema
+bun add @eslint/object-schema
```
For Deno:
@@ -232,11 +232,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/packages/object-schema/package.json b/packages/object-schema/package.json
index 65a6def6..794af474 100644
--- a/packages/object-schema/package.json
+++ b/packages/object-schema/package.json
@@ -33,7 +33,8 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/object-schema"
},
"keywords": [
"object",
@@ -46,7 +47,7 @@
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
- "homepage": "https://github.com/eslint/rewrite#readme",
+ "homepage": "https://github.com/eslint/rewrite/tree/main/packages/object-schema#readme",
"devDependencies": {
"c8": "^9.1.0",
"mocha": "^10.4.0",
diff --git a/packages/object-schema/src/object-schema.js b/packages/object-schema/src/object-schema.js
index 29e881f3..024858d8 100644
--- a/packages/object-schema/src/object-schema.js
+++ b/packages/object-schema/src/object-schema.js
@@ -25,9 +25,9 @@ import { ValidationStrategy } from "./validation-strategy.js";
* @param {string} name The name of the key this strategy is for.
* @param {PropertyDefinition} definition The strategy for the object key.
* @returns {void}
- * @throws {Error} When the strategy is missing a name.
- * @throws {Error} When the strategy is missing a merge() method.
- * @throws {Error} When the strategy is missing a validate() method.
+ * @throws {TypeError} When the strategy is missing a name.
+ * @throws {TypeError} When the strategy is missing a merge() method.
+ * @throws {TypeError} When the strategy is missing a validate() method.
*/
function validateDefinition(name, definition) {
let hasSchema = false;
@@ -152,6 +152,7 @@ export class ObjectSchema {
/**
* Creates a new instance.
* @param {ObjectDefinition} definitions The schema definitions.
+ * @throws {Error} When the definitions are missing or invalid.
*/
constructor(definitions) {
if (!definitions) {
@@ -221,7 +222,7 @@ export class ObjectSchema {
* strategy.
* @param {...Object} objects The objects to merge.
* @returns {Object} A new object with a mix of all objects' keys.
- * @throws {Error} If any object is invalid.
+ * @throws {TypeError} If any object is invalid.
*/
merge(...objects) {
// double check arguments
diff --git a/packages/plugin-kit/CHANGELOG.md b/packages/plugin-kit/CHANGELOG.md
index 293de0f2..9d28ec28 100644
--- a/packages/plugin-kit/CHANGELOG.md
+++ b/packages/plugin-kit/CHANGELOG.md
@@ -1,5 +1,28 @@
# Changelog
+## [0.3.2](https://github.com/eslint/rewrite/compare/plugin-kit-v0.3.1...plugin-kit-v0.3.2) (2025-06-09)
+
+
+### Dependencies
+
+* The following workspace dependencies were updated
+ * dependencies
+ * @eslint/core bumped from ^0.14.0 to ^0.15.0
+
+## [0.3.1](https://github.com/eslint/rewrite/compare/plugin-kit-v0.3.0...plugin-kit-v0.3.1) (2025-05-01)
+
+
+### Bug Fixes
+
+* Upgrade @eslint/core ([#197](https://github.com/eslint/rewrite/issues/197)) ([a830283](https://github.com/eslint/rewrite/commit/a830283cd05a7a471aeec5f4589491f3c4092986))
+
+## [0.3.0](https://github.com/eslint/rewrite/compare/plugin-kit-v0.2.8...plugin-kit-v0.3.0) (2025-04-30)
+
+
+### Features
+
+* make `TextSourceCodeBase` a generic type ([#182](https://github.com/eslint/rewrite/issues/182)) ([484b6ca](https://github.com/eslint/rewrite/commit/484b6ca3149354736317fca09efd3156caa4f4f9))
+
## [0.2.8](https://github.com/eslint/rewrite/compare/plugin-kit-v0.2.7...plugin-kit-v0.2.8) (2025-04-01)
diff --git a/packages/plugin-kit/README.md b/packages/plugin-kit/README.md
index b07ab443..61ac6c32 100644
--- a/packages/plugin-kit/README.md
+++ b/packages/plugin-kit/README.md
@@ -15,7 +15,7 @@ yarn add @eslint/plugin-kit
# or
pnpm install @eslint/plugin-kit
# or
-bun install @eslint/plugin-kit
+bun add @eslint/plugin-kit
```
For Deno:
@@ -28,10 +28,10 @@ deno add @eslint/plugin-kit
This package exports the following utilities:
-- `ConfigCommentParser` - used to parse ESLint configuration comments (i.e., `/* eslint-disable rule */`)
-- `VisitNodeStep` and `CallMethodStep` - used to help implement `SourceCode#traverse()`
-- `Directive` - used to help implement `SourceCode#getDisableDirectives()`
-- `TextSourceCodeBase` - base class to help implement the `SourceCode` interface
+- [`ConfigCommentParser`](#configcommentparser) - used to parse ESLint configuration comments (i.e., `/* eslint-disable rule */`)
+- [`VisitNodeStep` and `CallMethodStep`](#visitnodestep-and-callmethodstep) - used to help implement `SourceCode#traverse()`
+- [`Directive`](#directive) - used to help implement `SourceCode#getDisableDirectives()`
+- [`TextSourceCodeBase`](#textsourcecodebase) - base class to help implement the `SourceCode` interface
### `ConfigCommentParser`
@@ -52,7 +52,7 @@ const directive = commentParser.parseDirective(
if (directive) {
console.log(directive.label); // "eslint-disable"
console.log(directive.value); // "prefer-const, semi"
- console.log(directive.justification); // "I don't want to use these"
+ console.log(directive.justification); // "I don't want to use these."
}
```
@@ -124,9 +124,7 @@ For example:
import { VisitNodeStep, CallMethodStep } from "@eslint/plugin-kit";
class MySourceCode {
-
traverse() {
-
const steps = [];
for (const { node, parent, phase } of iterator(this.ast)) {
@@ -263,11 +261,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
Diamond Sponsors
-
Platinum Sponsors
+
Platinum Sponsors

Gold Sponsors

Silver Sponsors
-

Bronze Sponsors
-

+

Bronze Sponsors
+

Technology Sponsors
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

diff --git a/packages/plugin-kit/jsr.json b/packages/plugin-kit/jsr.json
index efd4b404..fc1cec12 100644
--- a/packages/plugin-kit/jsr.json
+++ b/packages/plugin-kit/jsr.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/plugin-kit",
- "version": "0.2.8",
+ "version": "0.3.2",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
diff --git a/packages/plugin-kit/package.json b/packages/plugin-kit/package.json
index 428343c6..54e4446d 100644
--- a/packages/plugin-kit/package.json
+++ b/packages/plugin-kit/package.json
@@ -1,6 +1,6 @@
{
"name": "@eslint/plugin-kit",
- "version": "0.2.8",
+ "version": "0.3.2",
"description": "Utilities for building ESLint plugins.",
"author": "Nicholas C. Zakas",
"type": "module",
@@ -24,12 +24,13 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/plugin-kit"
},
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
- "homepage": "https://github.com/eslint/rewrite#readme",
+ "homepage": "https://github.com/eslint/rewrite/tree/main/packages/plugin-kit#readme",
"scripts": {
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
@@ -47,7 +48,7 @@
],
"license": "Apache-2.0",
"dependencies": {
- "@eslint/core": "^0.13.0",
+ "@eslint/core": "^0.15.0",
"levn": "^0.4.1"
},
"devDependencies": {
diff --git a/packages/plugin-kit/src/config-comment-parser.js b/packages/plugin-kit/src/config-comment-parser.js
index 17464d9f..2a1f11db 100644
--- a/packages/plugin-kit/src/config-comment-parser.js
+++ b/packages/plugin-kit/src/config-comment-parser.js
@@ -30,6 +30,7 @@ const validSeverities = new Set([0, 1, 2, "off", "warn", "error"]);
/**
* Determines if the severity in the rule configuration is valid.
* @param {RuleConfig} ruleConfig A rule's configuration.
+ * @returns {boolean} `true` if the severity is valid, otherwise `false`.
*/
function isSeverityValid(ruleConfig) {
const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
diff --git a/packages/plugin-kit/src/source-code.js b/packages/plugin-kit/src/source-code.js
index cdede465..a3221af5 100644
--- a/packages/plugin-kit/src/source-code.js
+++ b/packages/plugin-kit/src/source-code.js
@@ -255,6 +255,7 @@ export class TextSourceCodeBase {
* Returns the loc information for the given node or token.
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for.
* @returns {SourceLocation} The loc information for the node or token.
+ * @throws {Error} If the node or token does not have loc information.
*/
getLoc(nodeOrToken) {
if (hasESTreeStyleLoc(nodeOrToken)) {
@@ -274,6 +275,7 @@ export class TextSourceCodeBase {
* Returns the range information for the given node or token.
* @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for.
* @returns {SourceRange} The range information for the node or token.
+ * @throws {Error} If the node or token does not have range information.
*/
getRange(nodeOrToken) {
if (hasESTreeStyleRange(nodeOrToken)) {
@@ -297,6 +299,7 @@ export class TextSourceCodeBase {
* Returns the parent of the given node.
* @param {Options['SyntaxElementWithLoc']} node The node to get the parent of.
* @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node.
+ * @throws {Error} If the method is not implemented in the subclass.
*/
getParent(node) {
throw new Error("Not implemented.");
diff --git a/release-please-config.json b/release-please-config.json
index 26e159c4..194f648b 100644
--- a/release-please-config.json
+++ b/release-please-config.json
@@ -2,7 +2,7 @@
"bootstrap-sha": "b489df4cf3eae08a25ed401db207a78100cf4fc9",
"plugins": ["node-workspace"],
"bump-minor-pre-major": true,
- "separate-pull-requests": true,
+ "extra-label": "triage:no",
"pull-request-title-pattern": "chore: release${component} ${version}",
"packages": {
"packages/compat": {
@@ -45,6 +45,11 @@
}
]
},
+ "packages/mcp": {
+ "release-type": "node",
+ "release-as": "0.1.0",
+ "extra-files": ["src/mcp-server.js"]
+ },
"packages/migrate-config": {
"release-type": "node"
},
diff --git a/templates/package/package.json b/templates/package/package.json
index 125949ce..72cdf1de 100644
--- a/templates/package/package.json
+++ b/templates/package/package.json
@@ -34,7 +34,8 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/eslint/rewrite.git"
+ "url": "git+https://github.com/eslint/rewrite.git",
+ "directory": "packages/<%= name %>"
},
"keywords": [
"eslint"
@@ -45,9 +46,9 @@
},
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/<%= name %>#readme",
"devDependencies": {
- "@eslint/core": "^0.10.0",
+ "@eslint/core": "^0.14.0",
"c8": "^9.1.0",
- "eslint": "^9.11.0",
+ "eslint": "^9.27.0",
"mocha": "^10.4.0",
"rollup": "^4.16.2",
"rollup-plugin-copy": "^3.5.0",
diff --git a/tools/update-readme.js b/tools/update-readme.js
index 48f1dcbb..34051e15 100644
--- a/tools/update-readme.js
+++ b/tools/update-readme.js
@@ -31,7 +31,7 @@ const README_FILE_PATHS = [
/**
* Fetches the latest sponsors from the website.
- * @returns {Promise}} Prerendered sponsors markdown.
+ * @returns {Promise} Prerendered sponsors markdown.
*/
async function fetchSponsorsMarkdown() {
return got(SPONSORS_URL).text();
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy