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

ESLint rule flagging manually calling sinon.restore #1283

Open
IgnaceMaes opened this issue Aug 14, 2024 · 0 comments
Open

ESLint rule flagging manually calling sinon.restore #1283

IgnaceMaes opened this issue Aug 14, 2024 · 0 comments

Comments

@IgnaceMaes
Copy link

IgnaceMaes commented Aug 14, 2024

Hey 👋

I noticed some manual sinon.restore calls were occasionally slipping through PR reviews within our teams, even though there is no need for it with this addon.

The following ESLint rule detects those and catches them upfront:

rules: {
  'no-restricted-syntax': [
    'error',
    {
      message: "Restoring the sandbox is handled automatically by 'ember-sinon-qunit'.",
      selector: 'MemberExpression[object.name="sinon"][property.name="restore"]',
    },
  ],
  // ... other rules
},
// ... other config options

Just putting this out here in case it would be helpful to others.

As next steps, I suppose this could be:

  • Added to the readme/docs
  • Or made into an actual lightweight ESLint plugin which consumers could include in their own config
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

No branches or pull requests

1 participant