From d0b2e705c49709cfb92a9110c65cd628c91aaa29 Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Thu, 7 Nov 2024 11:11:58 +0100 Subject: [PATCH 1/6] fix: non-optional properties in generic interfaces (#132) --- packages/core/src/types.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 9d2447c..16d77b4 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -186,10 +186,10 @@ export interface RulesMeta< * Generic type for `RuleContext`. */ export interface RuleContextTypeOptions { - LangOptions?: LanguageOptions; - Code?: SourceCode; - RuleOptions?: unknown[]; - Node?: unknown; + LangOptions: LanguageOptions; + Code: SourceCode; + RuleOptions: unknown[]; + Node: unknown; } /** @@ -441,13 +441,13 @@ export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; * Generic options for the `RuleDefinition` type. */ export interface RuleDefinitionTypeOptions { - LangOptions?: LanguageOptions; - Code?: SourceCode; - RuleOptions?: unknown[]; - Visitor?: RuleVisitor; - Node?: unknown; - MessageIds?: string; - ExtRuleDocs?: unknown; + LangOptions: LanguageOptions; + Code: SourceCode; + RuleOptions: unknown[]; + Visitor: RuleVisitor; + Node: unknown; + MessageIds: string; + ExtRuleDocs: unknown; } /** @@ -535,9 +535,9 @@ export type RulesConfig = Record; * Generic options for the `Language` type. */ export interface LanguageTypeOptions { - LangOptions?: LanguageOptions; - Code?: SourceCode; - RootNode?: unknown; + LangOptions: LanguageOptions; + Code: SourceCode; + RootNode: unknown; Node: unknown; } @@ -733,10 +733,10 @@ interface InlineConfigElement { * Generic options for the `SourceCodeBase` type. */ interface SourceCodeBaseTypeOptions { - LangOptions?: LanguageOptions; - RootNode?: unknown; - SyntaxElementWithLoc?: unknown; - ConfigNode?: unknown; + LangOptions: LanguageOptions; + RootNode: unknown; + SyntaxElementWithLoc: unknown; + ConfigNode: unknown; } /** From e73b1dc40fef68819969fdbe9060a47dcc4cae1b Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Wed, 13 Nov 2024 08:05:57 +0000 Subject: [PATCH 2/6] docs: Update README sponsors --- README.md | 2 +- packages/compat/README.md | 2 +- packages/config-array/README.md | 2 +- packages/core/README.md | 2 +- packages/migrate-config/README.md | 2 +- packages/object-schema/README.md | 2 +- packages/plugin-kit/README.md | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7ed7602..0dad54b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

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.

Netlify Algolia 1Password

diff --git a/packages/compat/README.md b/packages/compat/README.md index 82e76ba..870e961 100644 --- a/packages/compat/README.md +++ b/packages/compat/README.md @@ -199,7 +199,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

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.

Netlify Algolia 1Password

diff --git a/packages/config-array/README.md b/packages/config-array/README.md index 9b8fcd1..eb2c121 100644 --- a/packages/config-array/README.md +++ b/packages/config-array/README.md @@ -351,7 +351,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

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.

Netlify Algolia 1Password

diff --git a/packages/core/README.md b/packages/core/README.md index 4e913de..6a2576f 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -22,7 +22,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

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.

Netlify Algolia 1Password

diff --git a/packages/migrate-config/README.md b/packages/migrate-config/README.md index 6d90369..94a3855 100644 --- a/packages/migrate-config/README.md +++ b/packages/migrate-config/README.md @@ -103,7 +103,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

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.

Netlify Algolia 1Password

diff --git a/packages/object-schema/README.md b/packages/object-schema/README.md index b001bc6..d8e3295 100644 --- a/packages/object-schema/README.md +++ b/packages/object-schema/README.md @@ -235,7 +235,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

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.

Netlify Algolia 1Password

diff --git a/packages/plugin-kit/README.md b/packages/plugin-kit/README.md index 03b40e0..bd77edc 100644 --- a/packages/plugin-kit/README.md +++ b/packages/plugin-kit/README.md @@ -266,7 +266,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

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.

Netlify Algolia 1Password

From 071be842f0bd58de4863cdf2ab86d60f49912abf Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Wed, 13 Nov 2024 13:37:44 -0500 Subject: [PATCH 3/6] Merge commit from fork * Fix runaway regex whitespace matching * Include negative lookbehind * Update packages/plugin-kit/tests/config-comment-parser.test.js Co-authored-by: Milos Djermanovic * Update packages/plugin-kit/tests/config-comment-parser.test.js Co-authored-by: Milos Djermanovic * Update packages/plugin-kit/tests/config-comment-parser.test.js Co-authored-by: Milos Djermanovic * Update packages/plugin-kit/tests/config-comment-parser.test.js Co-authored-by: Milos Djermanovic * Update packages/plugin-kit/src/config-comment-parser.js Co-authored-by: Milos Djermanovic --------- Co-authored-by: Milos Djermanovic --- .../plugin-kit/src/config-comment-parser.js | 4 +- .../tests/config-comment-parser.test.js | 49 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/packages/plugin-kit/src/config-comment-parser.js b/packages/plugin-kit/src/config-comment-parser.js index f22f97a..f9a2822 100644 --- a/packages/plugin-kit/src/config-comment-parser.js +++ b/packages/plugin-kit/src/config-comment-parser.js @@ -99,7 +99,9 @@ export class ConfigCommentParser { const items = /** @type {StringConfig} */ ({}); // Collapse whitespace around `:` and `,` to make parsing easier - const trimmedString = string.replace(/\s*([:,])\s*/gu, "$1"); + const trimmedString = string + .trim() + .replace(/(? { if (!name) { diff --git a/packages/plugin-kit/tests/config-comment-parser.test.js b/packages/plugin-kit/tests/config-comment-parser.test.js index e9895dc..549ee8a 100644 --- a/packages/plugin-kit/tests/config-comment-parser.test.js +++ b/packages/plugin-kit/tests/config-comment-parser.test.js @@ -74,6 +74,55 @@ describe("ConfigCommentParser", () => { b: null, }); }); + + it("should return an empty object for an empty string", () => { + const code = ""; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, {}); + }); + + it("should parse string config with one item, no value, and leading whitespace", () => { + const code = `${" ".repeat(100000)}a`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: null, + }); + }); + + it("should parse string config with one item, no value, and trailing whitespace", () => { + const code = `a${" ".repeat(100000)}`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: null, + }); + }); + + it("should parse string config with two items, no values, and whitespace in the middle", () => { + const code = `a${" ".repeat(100000)}b`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: null, + b: null, + }); + }); + + it("should parse string config with multiple items with values separated by commas and lots of whitespace", () => { + const whitespace = " ".repeat(100000); + const code = `a: 1${whitespace},${whitespace}b: 2${whitespace},${whitespace}c: 3${whitespace},${whitespace}d: 4`; + const result = commentParser.parseStringConfig(code, comment); + + assert.deepStrictEqual(result, { + a: "1", + b: "2", + c: "3", + d: "4", + }); + }); + }); describe("parseListConfig", () => { From 2fa68b7150561c48821206272ba7d0440e7e7f15 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Wed, 13 Nov 2024 20:15:49 +0100 Subject: [PATCH 4/6] chore: fix formatting error (#133) --- packages/plugin-kit/tests/config-comment-parser.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/plugin-kit/tests/config-comment-parser.test.js b/packages/plugin-kit/tests/config-comment-parser.test.js index 549ee8a..1feab8b 100644 --- a/packages/plugin-kit/tests/config-comment-parser.test.js +++ b/packages/plugin-kit/tests/config-comment-parser.test.js @@ -122,7 +122,6 @@ describe("ConfigCommentParser", () => { d: "4", }); }); - }); describe("parseListConfig", () => { From 3591a7805a060cb130d40d61f200431b782431d8 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 14 Nov 2024 11:36:38 -0500 Subject: [PATCH 5/6] feat: Add Language#normalizeLanguageOptions() (#131) --- packages/core/src/types.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 16d77b4..3fc3e19 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -587,6 +587,13 @@ export interface Language< */ validateLanguageOptions(languageOptions: Options["LangOptions"]): void; + /** + * Normalizes languageOptions for this language. + */ + normalizeLanguageOptions?( + languageOptions: Options["LangOptions"], + ): Options["LangOptions"]; + /** * Helper for esquery that allows languages to match nodes against * class. esquery currently has classes like `function` that will From a957ee351c27ac1bf22966768cf8aac8c12ce0d2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:44:51 +0100 Subject: [PATCH 6/6] chore: release main (#130) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 8 ++++---- packages/compat/CHANGELOG.md | 14 ++++++++++++++ packages/compat/jsr.json | 2 +- packages/compat/package.json | 4 ++-- packages/core/CHANGELOG.md | 12 ++++++++++++ packages/core/jsr.json | 2 +- packages/core/package.json | 2 +- packages/migrate-config/CHANGELOG.md | 9 +++++++++ packages/migrate-config/package.json | 4 ++-- packages/plugin-kit/CHANGELOG.md | 9 +++++++++ packages/plugin-kit/jsr.json | 2 +- packages/plugin-kit/package.json | 4 ++-- 12 files changed, 58 insertions(+), 14 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8db2893..9432e6e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,8 +1,8 @@ { - "packages/compat": "1.2.2", + "packages/compat": "1.2.3", "packages/config-array": "0.19.0", - "packages/core": "0.8.0", - "packages/migrate-config": "1.3.3", + "packages/core": "0.9.0", + "packages/migrate-config": "1.3.4", "packages/object-schema": "2.1.4", - "packages/plugin-kit": "0.2.2" + "packages/plugin-kit": "0.2.3" } diff --git a/packages/compat/CHANGELOG.md b/packages/compat/CHANGELOG.md index 860e0f6..e00b222 100644 --- a/packages/compat/CHANGELOG.md +++ b/packages/compat/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.2.3](https://github.com/eslint/rewrite/compare/compat-v1.2.2...compat-v1.2.3) (2024-11-14) + + +### Bug Fixes + +* Support legacy `schema` properties ([#128](https://github.com/eslint/rewrite/issues/128)) ([3a87bbb](https://github.com/eslint/rewrite/commit/3a87bbb7f0b501c74507f32083c289304d6c03a6)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @eslint/core bumped from ^0.8.0 to ^0.9.0 + ## [1.2.2](https://github.com/eslint/rewrite/compare/compat-v1.2.1...compat-v1.2.2) (2024-10-25) diff --git a/packages/compat/jsr.json b/packages/compat/jsr.json index 921003f..5527884 100644 --- a/packages/compat/jsr.json +++ b/packages/compat/jsr.json @@ -1,6 +1,6 @@ { "name": "@eslint/compat", - "version": "1.2.2", + "version": "1.2.3", "exports": "./dist/esm/index.js", "publish": { "include": [ diff --git a/packages/compat/package.json b/packages/compat/package.json index 92c67c9..31117e3 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/compat", - "version": "1.2.2", + "version": "1.2.3", "description": "Compatibility utilities for ESLint", "type": "module", "main": "dist/esm/index.js", @@ -48,7 +48,7 @@ }, "homepage": "https://github.com/eslint/rewrite#readme", "devDependencies": { - "@eslint/core": "^0.8.0", + "@eslint/core": "^0.9.0", "c8": "^9.1.0", "eslint": "^9.11.0", "mocha": "^10.4.0", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 7d6e540..a15cbab 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.9.0](https://github.com/eslint/rewrite/compare/core-v0.8.0...core-v0.9.0) (2024-11-14) + + +### Features + +* Add Language#normalizeLanguageOptions() ([#131](https://github.com/eslint/rewrite/issues/131)) ([3591a78](https://github.com/eslint/rewrite/commit/3591a7805a060cb130d40d61f200431b782431d8)) + + +### Bug Fixes + +* non-optional properties in generic interfaces ([#132](https://github.com/eslint/rewrite/issues/132)) ([d0b2e70](https://github.com/eslint/rewrite/commit/d0b2e705c49709cfb92a9110c65cd628c91aaa29)) + ## [0.8.0](https://github.com/eslint/rewrite/compare/core-v0.7.0...core-v0.8.0) (2024-10-25) diff --git a/packages/core/jsr.json b/packages/core/jsr.json index cd858a0..d230446 100644 --- a/packages/core/jsr.json +++ b/packages/core/jsr.json @@ -1,6 +1,6 @@ { "name": "@eslint/core", - "version": "0.8.0", + "version": "0.9.0", "exports": "./dist/esm/types.d.ts", "publish": { "include": [ diff --git a/packages/core/package.json b/packages/core/package.json index 5329f2d..797e3a6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/core", - "version": "0.8.0", + "version": "0.9.0", "description": "Runtime-agnostic core of ESLint", "type": "module", "types": "./dist/esm/types.d.ts", diff --git a/packages/migrate-config/CHANGELOG.md b/packages/migrate-config/CHANGELOG.md index 887735d..9a778d9 100644 --- a/packages/migrate-config/CHANGELOG.md +++ b/packages/migrate-config/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [1.3.4](https://github.com/eslint/rewrite/compare/migrate-config-v1.3.3...migrate-config-v1.3.4) (2024-11-14) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @eslint/compat bumped from ^1.2.2 to ^1.2.3 + ## [1.3.3](https://github.com/eslint/rewrite/compare/migrate-config-v1.3.2...migrate-config-v1.3.3) (2024-10-25) diff --git a/packages/migrate-config/package.json b/packages/migrate-config/package.json index 542d32c..0e47fd0 100644 --- a/packages/migrate-config/package.json +++ b/packages/migrate-config/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/migrate-config", - "version": "1.3.3", + "version": "1.3.4", "description": "Configuration migration for ESLint", "type": "module", "bin": { @@ -46,7 +46,7 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "dependencies": { - "@eslint/compat": "^1.2.2", + "@eslint/compat": "^1.2.3", "@eslint/eslintrc": "^3.1.0", "camelcase": "^8.0.0", "recast": "^0.23.7" diff --git a/packages/plugin-kit/CHANGELOG.md b/packages/plugin-kit/CHANGELOG.md index a32a478..59256dd 100644 --- a/packages/plugin-kit/CHANGELOG.md +++ b/packages/plugin-kit/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [0.2.3](https://github.com/eslint/rewrite/compare/plugin-kit-v0.2.2...plugin-kit-v0.2.3) (2024-11-14) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @eslint/core bumped from ^0.8.0 to ^0.9.0 + ## [0.2.2](https://github.com/eslint/rewrite/compare/plugin-kit-v0.2.1...plugin-kit-v0.2.2) (2024-10-25) diff --git a/packages/plugin-kit/jsr.json b/packages/plugin-kit/jsr.json index 901d012..a6501bc 100644 --- a/packages/plugin-kit/jsr.json +++ b/packages/plugin-kit/jsr.json @@ -1,6 +1,6 @@ { "name": "@eslint/plugin-kit", - "version": "0.2.2", + "version": "0.2.3", "exports": "./dist/esm/index.js", "publish": { "include": [ diff --git a/packages/plugin-kit/package.json b/packages/plugin-kit/package.json index 7f8cda1..155d501 100644 --- a/packages/plugin-kit/package.json +++ b/packages/plugin-kit/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/plugin-kit", - "version": "0.2.2", + "version": "0.2.3", "description": "Utilities for building ESLint plugins.", "author": "Nicholas C. Zakas", "type": "module", @@ -46,7 +46,7 @@ ], "license": "Apache-2.0", "devDependencies": { - "@eslint/core": "^0.8.0", + "@eslint/core": "^0.9.0", "c8": "^9.1.0", "mocha": "^10.4.0", "rollup": "^4.16.2",