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: only update type snapshots if process.argv includes --fix #113

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

JoshuaKGoldberg
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg commented Dec 19, 2023

PR Checklist

Overview

Only adds a fix() function if process.argv.includes("--fix"). This will therefore stop type snapshots from being updated automatically when ESLint is run through the Node API, such as in an editor extension.

This is the best I can do without ESLint providing a native way for rules to know whether they're in fix mode 😬. I don't like it. It's a rough heuristic and I'll file a followup issue on improving it (that will be blocked on ESLint's making an API, I assume).

This also isn't tested yet so I'll file a followup issue for that too.

Copy link

codecov bot commented Dec 19, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (7ffdbab) 83.15% compared to head (4dcb4cb) 81.83%.

Files Patch % Lines
src/rules/expect.ts 51.85% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #113      +/-   ##
==========================================
- Coverage   83.15%   81.83%   -1.32%     
==========================================
  Files          10       10              
  Lines         843      837       -6     
  Branches       94       93       -1     
==========================================
- Hits          701      685      -16     
- Misses        142      152      +10     

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

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.

Running eslint without --fix still updates snapshots
1 participant