Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(typescript-estree): don't consider a cached program unless it's specified in the currentparserOptions.project config#5999

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bradzacher merged 3 commits intomainfromfix-using-cached-program-incorrectly
Nov 16, 2022

Conversation

bradzacher
Copy link
Member

PR Checklist

Overview

Discovered this while working on#5916

Previously we would consider any cached program as fair game during parsing.
Most of the time this isn't a problem because users always have the same config for an entire lint run.

However if the user has a different value forparserOptions.project around the place, then we would behave incorrectly - we would iterate through our cached programs and return a matching program for a file even if its tsconfig wasn't included in the currentparserOptions.project! This is really bad because it means we'll lint a file with probably incorrect types!!!

I discovered this in the above PR because I defined two separate test runs with different tsconfigs in the same file.
Because our rule tester uses the exact same filename, the parser checked the cache, found the old program matched, and returned it - meaning we never used the new tsconfig (causing the test to fail!)

The fix is simply to enforce that we only consider a program from the cache if and only if its tsconfig exists in the currentparserOptions.project set.

…pecified in the current `parserOptions.project` config
@bradzacherbradzacher added the bugSomething isn't working labelNov 16, 2022
@typescript-eslint
Copy link
Contributor

Thanks for the PR,@bradzacher!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint.

@nx-cloud
Copy link

nx-cloudbot commentedNov 16, 2022
edited
Loading

☁️ Nx Cloud Report

CI is running/has finished running commands for commitba08e6c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 46 targets

Sent with 💌 fromNxCloud.

@netlify
Copy link

netlifybot commentedNov 16, 2022
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commitba08e6c
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/6374fd1b2c8e4d0008873919
😎 Deploy Previewhttps://deploy-preview-5999--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify site settings.

@@ -1,14 +1,11 @@
import path from 'path';
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

the changes here were extracted from#5916 as an easy test for this behaviour.
could add a regression test against this, but I didn't bother because ultimately it's such a rare case.

JoshuaKGoldberg reacted with thumbs up emoji
@codecov
Copy link

codecovbot commentedNov 16, 2022
edited
Loading

Codecov Report

Merging#5999 (ba08e6c) intomain (49f623f) willincrease coverage by0.00%.
The diff coverage is100.00%.

Additional details and impacted files
@@           Coverage Diff           @@##             main    #5999   +/-   ##=======================================  Coverage   91.42%   91.42%           =======================================  Files         365      365             Lines       12339    12342    +3       Branches     3609     3610    +1     =======================================+ Hits        11281    11284    +3  Misses        753      753             Partials      305      305
FlagCoverage Δ
unittest91.42% <100.00%> (+<0.01%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
...pt-estree/src/create-program/createWatchProgram.ts78.39% <100.00%> (+0.33%)⬆️

Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Nice find!

// so we don't want to consider it for caching purposes.
//
// if we did consider it we might return a program for a project
// that wasn't specified in the current parser run (which is obv bad!).

Choose a reason for hiding this comment

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

To you, maybe 😛

Suggested change
// that wasn't specified in the current parser run (which isobvbad!).
// that wasn't specified in the current parser run (which is bad!).

@bradzacherbradzacher merged commit530e0e6 intomainNov 16, 2022
@bradzacherbradzacher deleted the fix-using-cached-program-incorrectly branchNovember 16, 2022 19:44
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsNov 24, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg approved these changes

Assignees
No one assigned
Labels
bugSomething isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@bradzacher@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp