Skip to content

New: Add catchNoFixerButFixableProperty option (default false) to catch non-fixable rules that enable the fixable property in require-meta-fixable rule #165

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

Conversation

bmish
Copy link
Member

@bmish bmish commented Jul 11, 2021

Added behind an option due to risk of false positives.

Open to better names for the option.

@bmish bmish force-pushed the require-meta-fixable-not-fixable-with-property branch 3 times, most recently from 9475e3b to c325f3f Compare July 24, 2021 22:56
…atch non-fixable rules that enable the fixable property in `require-meta-fixable` rule
@bmish bmish force-pushed the require-meta-fixable-not-fixable-with-property branch from c325f3f to 817fd7a Compare July 24, 2021 22:58
@bmish bmish changed the title Update: Catch non-fixable rules that enable the fixable property in require-meta-fixable rule New: Add catchNoFixerButFixableProperty option (default false) to catch non-fixable rules that enable the fixable property in require-meta-fixable rule Jul 24, 2021
@bmish bmish marked this pull request as ready for review July 24, 2021 23:00
`,
options: [{ catchNoFixerButFixableProperty: true }],
errors: [{ messageId: 'noFixerButFixableValue', type: 'Literal' }],
},
Copy link
Contributor

@aladdin-add aladdin-add Jul 26, 2021

Choose a reason for hiding this comment

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

can you add some tests that sometimes do not have a fixer - it seems a quite common case?
e.g.

// valid
module.exports = {
  meta: { fixable: "whitespace" },
  create(context) {
    foo
      ? context.report({ node, message, fix })
      : context.report({ node, message });
  },
};

// invalid
module.exports = {
  meta: { fixable: null },
  create(context) {
    foo
      ? context.report({ node, message, fix })
      : context.report({ node, message });
  },
};

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, added tests.

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 da652aa into eslint-community:master Jul 27, 2021
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.

2 participants