Skip to content

feat!: refactor plugin export to conform to latest conventions #957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

michaelfaith
Copy link
Collaborator

@michaelfaith michaelfaith commented Mar 15, 2025

PR Checklist

Overview

This change refactors the plugin's exports to conform to the latest standards recommended by the ESLint team.

The plugin is still the default export, but it now has configs attached to it as well, but the legacy rc-based config (now called 'legacy-recommended') and the recommended flat-config.

For users of the flat config, you'll need to make the following changes.

- import packageJson from "eslint-plugin-package-json/configs/recommended";
+ import packageJson from "eslint-plugin-package-json";

export default [
-   packageJson,
+   packageJson.configs.recommended,
];

For users of the legacy config, you'll need to make the following changes.

module.exports = {
  overrides: [
    {
-     extends: ["plugin:package-json/recommended"],
+     extends: ["plugin:package-json/legacy-recommended"],
      files: ["package.json"],
      parser: "jsonc-eslint-parser",
    },
  ],
};

BREAKING CHANGE

Closes #752

This change refactors the plugin's exports to conform to the latest standards recommended by the ESLint team.

The plugin is still the default export, but it now has configs attached to it as well, but the legacy rc-based config (now called `'legacy-recommended'`) and the `recommended` flat-config.

For users of the flat config, you'll need to make the following changes.

```diff
- import packageJson from "eslint-plugin-package-json/configs/recommended";
+ import packageJson from "eslint-plugin-package-json";

export default [
-   packageJson,
+   packageJson.configs.recommended,
];
```

For users of the legacy config, you'll need to make the following changes.

```diff
module.exports = {
  overrides: [
    {
-     extends: ["plugin:package-json/recommended"],
+     extends: ["plugin:package-json/legacy-recommended"],
      files: ["package.json"],
      parser: "jsonc-eslint-parser",
    },
  ],
};
```

BREAKING CHANGE
@michaelfaith michaelfaith force-pushed the fix/refactor-plugin-obj branch from 9879219 to b85c967 Compare March 15, 2025 20:41
Copy link

codecov bot commented Mar 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.50%. Comparing base (b2cebc2) to head (64ec87f).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #957      +/-   ##
==========================================
+ Coverage   98.77%   99.50%   +0.73%     
==========================================
  Files          21       20       -1     
  Lines        1222     1221       -1     
  Branches      142      142              
==========================================
+ Hits         1207     1215       +8     
+ Misses         15        6       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This change refactors the plugin's exports to conform to the latest standards recommended by the ESLint team.

The plugin is still the default export, but it now has configs attached to it as well, but the legacy rc-based config (now called `'legacy-recommended'`) and the `recommended` flat-config.

For users of the flat config, you'll need to make the following changes.

```js
- import packageJson from "eslint-plugin-package-json/configs/recommended";
+ import packageJson from "eslint-plugin-package-json";

export default [
-	 packageJson,
+	 packageJson.configs.recommended,
];
```

For users of the legacy config, you'll need to make the following changes.

```js
module.exports = {
	overrides: [
		{
- 			extends: ["plugin:package-json/recommended"],
+ 			extends: ["plugin:package-json/legacy-recommended"],
			files: ["package.json"],
			parser: "jsonc-eslint-parser",
		},
	],
};
```

BREAKING CHANGE
@michaelfaith michaelfaith marked this pull request as ready for review March 15, 2025 20:44
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Big Boi in Outkast happily saying 'so fresh and so clean'

@JoshuaKGoldberg JoshuaKGoldberg merged commit 3c46695 into main Mar 17, 2025
14 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the fix/refactor-plugin-obj branch March 17, 2025 12:03
Copy link

🎉 This is included in version v0.26.4 🎉

The release is available on:

Cheers! 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature: unify import of recommended config with other plugins
2 participants