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

chore: document and refactor 'extra' to 'parserSettings' #5834

Merged

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Oct 16, 2022

PR Checklist

Overview

Despite the nontrivial diff, this shouldn't change any significant logic.

  • Replaces the ast, code, extra, and program module scoped variables into parameters that get passed around
    • Wherever possible, combines multiple parameters that reference members of extra
  • Renames Extra to ParseSettings and adds doc comments for its properties
  • Extracts & deduplicates the logic to create parserSettings (formerly extra) into a createParseSettings function, and makes it almost all happen in-place

I'm choosing to ignore the Codecov complaint because the diff is reducing lines of code ✨. But if you think we should test these edge cases more, I could use some help figuring out where that should go.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

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 on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@nx-cloud
Copy link

nx-cloud bot commented Oct 16, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 044f177. 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 💌 from NxCloud.

@netlify
Copy link

netlify bot commented Oct 16, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 044f177
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6357ed4ec3d3df000f4a7624
😎 Deploy Preview https://deploy-preview-5834--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 your Netlify site settings.

@codecov
Copy link

codecov bot commented Oct 16, 2022

Codecov Report

Merging #5834 (044f177) into main (c4e0d86) will increase coverage by 0.03%.
The diff coverage is 89.92%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5834      +/-   ##
==========================================
+ Coverage   91.33%   91.36%   +0.03%     
==========================================
  Files         361      364       +3     
  Lines       12044    12134      +90     
  Branches     3506     3540      +34     
==========================================
+ Hits        11000    11086      +86     
  Misses        748      748              
- Partials      296      300       +4     
Flag Coverage Δ
unittest 91.36% <89.92%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
...ript-estree/src/create-program/createSourceFile.ts 87.50% <0.00%> (ø)
...t-estree/src/create-program/useProvidedPrograms.ts 84.84% <50.00%> (ø)
...-estree/src/create-program/createDefaultProgram.ts 78.26% <71.42%> (+0.98%) ⬆️
...ges/typescript-estree/src/create-program/shared.ts 83.33% <75.00%> (ø)
...pt-estree/src/create-program/createWatchProgram.ts 78.06% <78.57%> (ø)
...-estree/src/create-program/createProjectProgram.ts 93.47% <81.81%> (ø)
...escript-estree/src/parseSettings/inferSingleRun.ts 90.90% <90.90%> (ø)
...ipt-estree/src/parseSettings/warnAboutTSVersion.ts 93.33% <93.33%> (ø)
...pt-estree/src/parseSettings/createParseSettings.ts 96.82% <96.82%> (ø)
packages/typescript-estree/src/ast-converter.ts 100.00% <100.00%> (ø)
... and 1 more

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review October 17, 2022 02:21
@bradzacher bradzacher added the refactor PRs that refactor code only label Oct 24, 2022
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

this is looking fantastic!

image

packages/typescript-estree/src/log.ts Outdated Show resolved Hide resolved
packages/typescript-estree/src/parseSettings.ts Outdated Show resolved Hide resolved
packages/typescript-estree/src/warnAboutTSVersion.ts Outdated Show resolved Hide resolved
@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Oct 24, 2022
@JoshuaKGoldberg
Copy link
Member Author

JoshuaKGoldberg commented Oct 24, 2022

$ /home/runner/work/typescript-eslint/typescript-eslint/node_modules/.bin/playwright test --reporter=list

Running 1 test using 1 worker

  ✘  1 [chromium] › index.spec.ts:4:1 › Index (30s)


  1) [chromium] › index.spec.ts:4:1 › Index ========================================================

    Test timeout of 30000ms exceeded.

    Error: page.evaluate: Target closed
     Please check out https://github.com/dequelabs/axe-core-npm/blob/develop/packages/playwright/error-handling.md

        at AxeBuilder.<anonymous> (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/@axe-core/playwright/src/index.ts:172:[13](https://github.com/typescript-eslint/typescript-eslint/actions/runs/3315439920/jobs/5476094015#step:6:14))
        at step (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/@axe-core/playwright/dist/index.js:33:23)
        at Object.throw (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/@axe-core/playwright/dist/index.js:[14](https://github.com/typescript-eslint/typescript-eslint/actions/runs/3315439920/jobs/5476094015#step:6:15):53)
        at rejected (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/@axe-core/playwright/dist/index.js:6:65)

    Pending operations:
      - page.evaluate at ../../node_modules/@axe-core/playwright/src/index.ts:[28](https://github.com/typescript-eslint/typescript-eslint/actions/runs/3315439920/jobs/5476094015#step:6:29)5:8

😭

Edit: went away on re-run. I'm going to pretend this little blip never happened.

@JoshuaKGoldberg JoshuaKGoldberg removed the awaiting response Issues waiting for a reply from the OP or another party label Oct 24, 2022
bradzacher
bradzacher previously approved these changes Oct 24, 2022
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

image

@bradzacher bradzacher added the 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready label Oct 24, 2022
@JoshuaKGoldberg
Copy link
Member Author

Getting real tired of having to re-request review after merges 🥲

@bradzacher bradzacher merged commit 8ddcc9a into typescript-eslint:main Oct 25, 2022
38 of 39 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the extra-to-parser-settings branch October 25, 2022 22:24
JoshuaKGoldberg added a commit that referenced this pull request Oct 25, 2022
)

* refactor(utils)!: removed `TRuleListener` generic from the `createRule`

* refactor!: removed `TRuleListener` generic from the `CLIEngine` and `RuleCreateFunction`

* chore: document and refactor 'extra' to 'parserSettings' (#5834)

* chore(website): fix renamed Sponsorship docs link (#5882)

* docs: Mention wide globs performance implications in monorepos docs and parser README (#5864)

* docs: Mention wide globs performance implications in monorepos docs and parser readme

* Update docs/linting/typed-linting/MONOREPOS.md

Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>

Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com>
JoshuaKGoldberg added a commit that referenced this pull request Oct 26, 2022
* feat: update TSImportType node

* fix: update visitor keys

* chore: document and refactor 'extra' to 'parserSettings' (#5834)

* chore(website): fix renamed Sponsorship docs link (#5882)

* docs: Mention wide globs performance implications in monorepos docs and parser README (#5864)

* docs: Mention wide globs performance implications in monorepos docs and parser readme

* Update docs/linting/typed-linting/MONOREPOS.md

Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>

Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com>
JoshuaKGoldberg added a commit that referenced this pull request Oct 26, 2022
* feat(scope-manager): ignore ECMA version

* chore: document and refactor 'extra' to 'parserSettings' (#5834)

* chore(website): fix renamed Sponsorship docs link (#5882)

* Remove much more

* Fix WebLinter lint

* docs: Mention wide globs performance implications in monorepos docs and parser README (#5864)

* docs: Mention wide globs performance implications in monorepos docs and parser readme

* Update docs/linting/typed-linting/MONOREPOS.md

Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>

* chore: add auto-canary release for v6 (#5883)

Co-authored-by: Adnan Hashmi <56730784+adnanhashmi09@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready refactor PRs that refactor code only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor: replace module-scoped code and extra variables
2 participants