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(experimental-utils): add literal types to global option #3634

Merged

Conversation

@dora1998
Copy link
Contributor

@dora1998 dora1998 commented Jul 14, 2021

In addition to boolean values, the string values below are allowed in globals field of BaseConfig.

  • "readable"
  • "readonly"
  • "writeable"
  • "writable"
  • "off"

Globals can be disabled with the string "off". For example, in an environment where most ES2015 globals are available but Promise is unavailable, you might use this config:

For historical reasons, the boolean value false and the string value "readable" are equivalent to "readonly". Similarly, the boolean value true and the string value "writeable" are equivalent to "writable". However, the use of older values is deprecated.

https://eslint.org/docs/user-guide/configuring/language-options#using-configuration-files-1

@typescript-eslint
Copy link

@typescript-eslint typescript-eslint bot commented Jul 14, 2021

Thanks for the PR, @dora1998!

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.

Loading

Copy link
Member

@bradzacher bradzacher left a comment

thanks! 1 comment.

Loading

| 'readonly'
| 'writable'
| 'readable'
| 'writeable'
| 'off'
| boolean;
Copy link
Member

@bradzacher bradzacher Jul 31, 2021

Choose a reason for hiding this comment

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

because these are considered deprecated - let's leave them out.
For the types where possible we've been excluding deprecated values/apis to help push people towards the correct things and prevent them from using old things that will be removed in a future version.

In the next major we can consider removing the boolean as well, considering that is deprecated and instead the string values are preferred.

Suggested change
| 'readonly'
| 'writable'
| 'readable'
| 'writeable'
| 'off'
| boolean;
| 'readonly'
| 'writable'
| 'off'
| boolean;

Loading

Copy link
Contributor Author

@dora1998 dora1998 Aug 2, 2021

Choose a reason for hiding this comment

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

It looks better👍 I fixed it!

Loading

@codecov
Copy link

@codecov codecov bot commented Aug 2, 2021

Codecov Report

Merging #3634 (f36944a) into master (f0861e0) will decrease coverage by 0.10%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3634      +/-   ##
==========================================
- Coverage   92.68%   92.58%   -0.11%     
==========================================
  Files         327      188     -139     
  Lines       11351     8480    -2871     
  Branches     3201     2607     -594     
==========================================
- Hits        10521     7851    -2670     
+ Misses        369      262     -107     
+ Partials      461      367      -94     
Flag Coverage Δ
unittest 92.58% <ø> (-0.11%) ⬇️

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

Impacted Files Coverage Δ
...ackages/experimental-utils/src/ts-eslint/Linter.ts 100.00% <ø> (ø)
packages/scope-manager/src/variable/Variable.ts
packages/scope-manager/src/lib/es2018.intl.ts
packages/scope-manager/src/lib/es2015.ts
...s/scope-manager/src/lib/webworker.importscripts.ts
packages/scope-manager/src/lib/es2020.string.ts
packages/scope-manager/src/scope/TSModuleScope.ts
packages/scope-manager/src/variable/index.ts
...cope-manager/src/definition/ClassNameDefinition.ts
packages/scope-manager/src/scope/BlockScope.ts
... and 130 more

Loading

@dora1998 dora1998 requested a review from bradzacher Aug 2, 2021
Copy link
Member

@bradzacher bradzacher left a comment

thanks!

Loading

@bradzacher bradzacher changed the title fix(experimental-utils): add literal types to global option feat(experimental-utils): add literal types to global option Aug 30, 2021
@bradzacher bradzacher merged commit 820965c into typescript-eslint:master Aug 30, 2021
11 checks passed
Loading
@dora1998 dora1998 deleted the fix-eslint-globals-types branch Aug 30, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants