diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8db2893a..9432e6ea 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/README.md b/README.md index c4114c17..0dad54b1 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors). <h3>Platinum Sponsors</h3> <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> <p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3> -<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> +<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> +<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> <h3>Technology Sponsors</h3> 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. <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p> diff --git a/packages/compat/CHANGELOG.md b/packages/compat/CHANGELOG.md index 860e0f65..e00b2221 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/README.md b/packages/compat/README.md index efc5875c..870e9613 100644 --- a/packages/compat/README.md +++ b/packages/compat/README.md @@ -198,8 +198,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors). <h3>Platinum Sponsors</h3> <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> <p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3> -<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> +<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> +<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> <h3>Technology Sponsors</h3> 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. <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p> diff --git a/packages/compat/jsr.json b/packages/compat/jsr.json index 921003f7..55278842 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 92c67c9d..31117e34 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/compat/src/fixup-rules.js b/packages/compat/src/fixup-rules.js index 1bad2793..34752d56 100644 --- a/packages/compat/src/fixup-rules.js +++ b/packages/compat/src/fixup-rules.js @@ -183,6 +183,21 @@ export function fixupRule(ruleDefinition) { create: ruleCreate, }; + // copy `schema` property of function-style rule or top-level `schema` property of object-style rule into `meta` object + // @ts-ignore -- top-level `schema` property was not offically supported for object-style rules so it doesn't exist in types + const { schema } = ruleDefinition; + if (schema) { + if (!newRuleDefinition.meta) { + newRuleDefinition.meta = { schema }; + } else { + newRuleDefinition.meta = { + ...newRuleDefinition.meta, + // top-level `schema` had precedence over `meta.schema` so it's okay to overwrite `meta.schema` if it exists + schema, + }; + } + } + // cache the fixed up rule fixedUpRuleReplacements.set(ruleDefinition, newRuleDefinition); fixedUpRules.add(newRuleDefinition); diff --git a/packages/compat/tests/fixup-rules.js b/packages/compat/tests/fixup-rules.js index 7132d21f..8f4b92ba 100644 --- a/packages/compat/tests/fixup-rules.js +++ b/packages/compat/tests/fixup-rules.js @@ -76,6 +76,184 @@ describe("@eslint/backcompat", () => { assert.strictEqual(fixedUpRule, fixedUpRule2); }); + it("should return a new rule object with `meta.schema` when a rule with top-level `schema` and without `meta` is passed to fixupRule", () => { + const schema = [{ type: "string" }]; + const rule = { + schema, + create(context) { + return { + Identifier(node) { + context.report(node, context.options[0]); + }, + }; + }, + }; + const fixedUpRule = fixupRule(rule); + + assert.notStrictEqual(rule, fixedUpRule); + assert.deepStrictEqual(Object.keys(fixedUpRule), [ + ...Object.keys(rule), + "meta", + ]); + assert.strictEqual(typeof fixedUpRule.meta, "object"); + assert.deepStrictEqual(fixedUpRule.meta.schema, schema); + + const config = { + plugins: { + test: { + rules: { + "test-rule": fixedUpRule, + }, + }, + }, + rules: { + "test/test-rule": ["error", "my-option"], + }, + }; + + const linter = new Linter(); + const code = "var foo;"; + const messages = linter.verify(code, config, { + filename: "test.js", + }); + + assert.strictEqual(messages.length, 1); + assert.strictEqual(messages[0].message, "my-option"); + }); + + it("should return a new rule object with `meta.schema` when a rule with top-level `schema` and with `meta` is passed to fixupRule", () => { + const schema = [{ type: "string" }]; + const rule = { + schema, + meta: { + docs: {}, + }, + create(context) { + return { + Identifier(node) { + context.report(node, context.options[0]); + }, + }; + }, + }; + const fixedUpRule = fixupRule(rule); + + assert.notStrictEqual(rule, fixedUpRule); + assert.deepStrictEqual(Object.keys(rule), Object.keys(fixedUpRule)); + assert.deepStrictEqual(Object.keys(fixedUpRule.meta), [ + ...Object.keys(rule.meta), + "schema", + ]); + assert.deepStrictEqual(fixedUpRule.meta.schema, schema); + + const config = { + plugins: { + test: { + rules: { + "test-rule": fixedUpRule, + }, + }, + }, + rules: { + "test/test-rule": ["error", "my-option"], + }, + }; + + const linter = new Linter(); + const code = "var foo;"; + const messages = linter.verify(code, config, { + filename: "test.js", + }); + + assert.strictEqual(messages.length, 1); + assert.strictEqual(messages[0].message, "my-option"); + }); + + it("should return a rule object when a function-style rule is passed to fixupRule", () => { + function rule(context) { + return { + Identifier(node) { + context.report(node, "My message."); + }, + }; + } + const fixedUpRule = fixupRule(rule); + + assert.strictEqual(typeof fixedUpRule, "object"); + assert.deepStrictEqual(Object.keys(fixedUpRule), ["create"]); + assert.strictEqual(typeof fixedUpRule.create, "function"); + assert.notStrictEqual(rule, fixedUpRule.create); // the original rule should be wrapped in `create` + + const config = { + plugins: { + test: { + rules: { + "test-rule": fixedUpRule, + }, + }, + }, + rules: { + "test/test-rule": "error", + }, + }; + + const linter = new Linter(); + const code = "var foo;"; + const messages = linter.verify(code, config, { + filename: "test.js", + }); + + assert.strictEqual(messages.length, 1); + assert.strictEqual(messages[0].message, "My message."); + }); + + it("should return a rule object with `meta.schema` when a function-style rule with schema is passed to fixupRule", () => { + function rule(context) { + return { + Identifier(node) { + context.report(node, context.options[0]); + }, + }; + } + + const schema = [{ type: "string" }]; + rule.schema = schema; + + const fixedUpRule = fixupRule(rule); + + assert.strictEqual(typeof fixedUpRule, "object"); + assert.deepStrictEqual(Object.keys(fixedUpRule), [ + "create", + "meta", + ]); + assert.strictEqual(typeof fixedUpRule.create, "function"); + assert.notStrictEqual(rule, fixedUpRule.create); // the original rule should be wrapped in `create` + assert.strictEqual(typeof fixedUpRule.meta, "object"); + assert.deepStrictEqual(fixedUpRule.meta.schema, schema); + + const config = { + plugins: { + test: { + rules: { + "test-rule": fixedUpRule, + }, + }, + }, + rules: { + "test/test-rule": ["error", "my-option"], + }, + }; + + const linter = new Linter(); + const code = "var foo;"; + const messages = linter.verify(code, config, { + filename: "test.js", + }); + + assert.strictEqual(messages.length, 1); + assert.strictEqual(messages[0].message, "my-option"); + }); + it("should create a rule where getDeclaredVariables() returns the same value as sourceCode.getDeclaredVariables(node)", () => { const rule = { create(context) { diff --git a/packages/config-array/README.md b/packages/config-array/README.md index 9d343aae..eb2c121e 100644 --- a/packages/config-array/README.md +++ b/packages/config-array/README.md @@ -350,8 +350,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors). <h3>Platinum Sponsors</h3> <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> <p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3> -<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> +<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> +<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> <h3>Technology Sponsors</h3> 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. <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p> diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 7d6e5407..a15cbabb 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/README.md b/packages/core/README.md index 0cf11002..6a2576f5 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -21,8 +21,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors). <h3>Platinum Sponsors</h3> <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> <p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3> -<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> +<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> +<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> <h3>Technology Sponsors</h3> 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. <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p> diff --git a/packages/core/jsr.json b/packages/core/jsr.json index cd858a08..d2304469 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 5329f2df..797e3a65 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/core/src/types.ts b/packages/core/src/types.ts index 9d2447c7..3fc3e190 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<string, RuleConfig>; * Generic options for the `Language` type. */ export interface LanguageTypeOptions { - LangOptions?: LanguageOptions; - Code?: SourceCode; - RootNode?: unknown; + LangOptions: LanguageOptions; + Code: SourceCode; + RootNode: unknown; Node: unknown; } @@ -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 @@ -733,10 +740,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; } /** diff --git a/packages/migrate-config/CHANGELOG.md b/packages/migrate-config/CHANGELOG.md index 887735d0..9a778d9a 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/README.md b/packages/migrate-config/README.md index b69d0dd6..94a3855d 100644 --- a/packages/migrate-config/README.md +++ b/packages/migrate-config/README.md @@ -102,8 +102,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors). <h3>Platinum Sponsors</h3> <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> <p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3> -<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> +<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> +<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> <h3>Technology Sponsors</h3> 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. <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p> diff --git a/packages/migrate-config/package.json b/packages/migrate-config/package.json index 542d32ca..0e47fd03 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/object-schema/README.md b/packages/object-schema/README.md index ee23138d..d8e32950 100644 --- a/packages/object-schema/README.md +++ b/packages/object-schema/README.md @@ -234,8 +234,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors). <h3>Platinum Sponsors</h3> <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> <p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3> -<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> +<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> +<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> <h3>Technology Sponsors</h3> 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. <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p> diff --git a/packages/plugin-kit/CHANGELOG.md b/packages/plugin-kit/CHANGELOG.md index a32a4781..59256dd5 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/README.md b/packages/plugin-kit/README.md index 6fa4357c..bd77edce 100644 --- a/packages/plugin-kit/README.md +++ b/packages/plugin-kit/README.md @@ -265,8 +265,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors). <h3>Platinum Sponsors</h3> <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> <p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3> -<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> +<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3> +<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p> <h3>Technology Sponsors</h3> 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. <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p> diff --git a/packages/plugin-kit/jsr.json b/packages/plugin-kit/jsr.json index 901d0122..a6501bc9 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 7f8cda1d..155d501e 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", diff --git a/packages/plugin-kit/src/config-comment-parser.js b/packages/plugin-kit/src/config-comment-parser.js index f22f97a9..f9a28223 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(/(?<!\s)\s*([:,])\s*/gu, "$1"); trimmedString.split(/\s|,+/u).forEach(name => { 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 e9895dcd..1feab8be 100644 --- a/packages/plugin-kit/tests/config-comment-parser.test.js +++ b/packages/plugin-kit/tests/config-comment-parser.test.js @@ -74,6 +74,54 @@ 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", () => {