Skip to content
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

fix: handle properties behind spread syntax in require-meta-* rules #251

Merged
merged 2 commits into from Jun 20, 2022

Conversation

bmish
Copy link
Member

@bmish bmish commented Jun 15, 2022

We're now able to take into account meta properties inside spreads in the require-meta-* rules.

  1. Introduces new util function evaluateObjectProperties which gathers all properties from an object including those behind spreads.
  2. Uses this new util function when checking for properties inside the meta object in the require-meta-* rules.

Fixes #250.

Example: this is now valid for the require-meta-type rule:

const extra = { type: 'problem' };
module.exports = {
    meta: { ...extra },
    create(context) {}
};

TODO:

  • Unit tests for evaluateObjectProperties util
  • Check for additional places we should evaluate spreads
  • Tests for autofixing behavior when properties are behind a spread

@bmish bmish added the bug label Jun 15, 2022
@bmish bmish force-pushed the meta-spread branch 3 times, most recently from 3dcceb2 to 56f459e Compare June 18, 2022 15:05
@bmish bmish changed the title fix: handle meta properties behind spread syntax fix: handle properties behind spread syntax in require-meta-* rules Jun 18, 2022
@bmish bmish marked this pull request as ready for review June 19, 2022 22:27
@bmish
Copy link
Member Author

bmish commented Jun 19, 2022

Ready for review.

Copy link
Contributor

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 💯

@aladdin-add aladdin-add merged commit abefd1e into eslint-community:main Jun 20, 2022
@piranna
Copy link

piranna commented Jun 20, 2022

great :-)

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

Successfully merging this pull request may close these issues.

require-meta-type don't support spread operator
3 participants