Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eslint/rewrite
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: plugin-kit-v0.2.2
Choose a base ref
...
head repository: eslint/rewrite
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: plugin-kit-v0.2.3
Choose a head ref
  • 8 commits
  • 24 files changed
  • 5 contributors

Commits on Oct 31, 2024

  1. docs: Update README sponsors

    GitHub Actions Bot committed Oct 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c24083b View commit details

Commits on Nov 4, 2024

  1. fix: Support legacy schema properties (#128)

    mdjermanovic authored Nov 4, 2024
    Copy the full SHA
    3a87bbb View commit details

Commits on Nov 7, 2024

  1. fix: non-optional properties in generic interfaces (#132)

    fasttime authored Nov 7, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d0b2e70 View commit details

Commits on Nov 13, 2024

  1. docs: Update README sponsors

    GitHub Actions Bot committed Nov 13, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e73b1dc View commit details
  2. 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 <[email protected]>
    
    * Update packages/plugin-kit/tests/config-comment-parser.test.js
    
    Co-authored-by: Milos Djermanovic <[email protected]>
    
    * Update packages/plugin-kit/tests/config-comment-parser.test.js
    
    Co-authored-by: Milos Djermanovic <[email protected]>
    
    * Update packages/plugin-kit/tests/config-comment-parser.test.js
    
    Co-authored-by: Milos Djermanovic <[email protected]>
    
    * Update packages/plugin-kit/src/config-comment-parser.js
    
    Co-authored-by: Milos Djermanovic <[email protected]>
    
    ---------
    
    Co-authored-by: Milos Djermanovic <[email protected]>
    nzakas and mdjermanovic authored Nov 13, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    071be84 View commit details
  3. Copy the full SHA
    2fa68b7 View commit details

Commits on Nov 14, 2024

  1. Copy the full SHA
    3591a78 View commit details
  2. chore: release main (#130)

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Nov 14, 2024
    Copy the full SHA
    a957ee3 View commit details
8 changes: 4 additions & 4 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -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"
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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>
14 changes: 14 additions & 0 deletions packages/compat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


4 changes: 2 additions & 2 deletions packages/compat/README.md
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion packages/compat/jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint/compat",
"version": "1.2.2",
"version": "1.2.3",
"exports": "./dist/esm/index.js",
"publish": {
"include": [
4 changes: 2 additions & 2 deletions packages/compat/package.json
Original file line number Diff line number Diff line change
@@ -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",
15 changes: 15 additions & 0 deletions packages/compat/src/fixup-rules.js
Original file line number Diff line number Diff line change
@@ -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);
178 changes: 178 additions & 0 deletions packages/compat/tests/fixup-rules.js
Original file line number Diff line number Diff line change
@@ -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) {
Loading