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

feat(types): add unbound property in parser options #5419

Merged
merged 4 commits into from Aug 17, 2022
Merged

feat(types): add unbound property in parser options #5419

merged 4 commits into from Aug 17, 2022

Conversation

juank1809
Copy link
Contributor

@juank1809 juank1809 commented Aug 4, 2022

PR Checklist

Overview

Added a new mapped indexer to our parser options interface, this allows users to add any additional properties they want

Considerations
Maybe these other options that I discarded could fit better:

 additionalProperties: {
    [additionalProperties: string]: string
  }
    [additionalProperties: string]: any  

@nx-cloud
Copy link

nx-cloud bot commented Aug 4, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 5512b34. 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 47 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @juank1809!

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.

@netlify
Copy link

netlify bot commented Aug 4, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 5512b34
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/62fcec8d90bebb000891db4f
😎 Deploy Preview https://deploy-preview-5419--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 Aug 4, 2022

Codecov Report

Merging #5419 (99587fb) into main (6fd476c) will increase coverage by 0.07%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #5419      +/-   ##
==========================================
+ Coverage   91.67%   91.74%   +0.07%     
==========================================
  Files         363      366       +3     
  Lines       12227    12344     +117     
  Branches     3549     3601      +52     
==========================================
+ Hits        11209    11325     +116     
  Misses        668      668              
- Partials      350      351       +1     
Flag Coverage Δ
unittest 91.74% <ø> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
...s/eslint-plugin/src/rules/prefer-optional-chain.ts 93.85% <0.00%> (-0.36%) ⬇️
packages/eslint-plugin/src/rules/typedef.ts 96.00% <0.00%> (ø)
...ackages/eslint-plugin/src/rules/prefer-as-const.ts 100.00% <0.00%> (ø)
...lint-plugin/src/rules/prefer-nullish-coalescing.ts 100.00% <0.00%> (ø)
packages/eslint-plugin/src/util/isNodeEqual.ts 100.00% <0.00%> (ø)
packages/eslint-plugin/src/util/isNullLiteral.ts 100.00% <0.00%> (ø)
...es/eslint-plugin/src/util/isUndefinedIdentifier.ts 100.00% <0.00%> (ø)
...ckages/scope-manager/src/referencer/TypeVisitor.ts 97.95% <0.00%> (+0.02%) ⬆️
...ackages/scope-manager/src/referencer/Referencer.ts 95.96% <0.00%> (+0.03%) ⬆️
packages/eslint-plugin/src/rules/no-unused-vars.ts 95.95% <0.00%> (+0.04%) ⬆️
... and 5 more

@@ -58,6 +78,7 @@ interface ParserOptions {
tsconfigRootDir?: string;
warnOnUnsupportedTypeScriptVersion?: boolean;
moduleResolver?: string;
[additionalProperties: string]: ParserOptionsValue | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

You needn't add a specific type for the index signature because typescript will strictly type the known keys even with an unbounded index signature

Suggested change
[additionalProperties: string]: ParserOptionsValue | undefined;
[additionalProperties: string]: unknown;

@bradzacher bradzacher added the enhancement New feature or request label Aug 4, 2022
bradzacher
bradzacher previously approved these changes Aug 17, 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.

LGTM - thanks for this!

@bradzacher bradzacher changed the title feat(types): add new unbound property in parser options feat(types): add unbound property in parser options Aug 17, 2022
@bradzacher bradzacher enabled auto-merge (squash) August 17, 2022 13:27
@bradzacher bradzacher merged commit e08a9dd into typescript-eslint:main Aug 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Add "parser" field to ParserOptions
2 participants