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(eslint-plugin): [ban-ts-comment] support ts-expect-error #1706

Merged
merged 3 commits into from Apr 13, 2020
Merged

feat(eslint-plugin): [ban-ts-comment] support ts-expect-error #1706

merged 3 commits into from Apr 13, 2020

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Mar 8, 2020

This one should be safe to merge without TS3.9 being released - it'll just meant the docs are a bit confusing for a few months, which we should solve by putting a note on them about "feature not being released".

I've made the default true, as I think ts-expect-error is safer, and it's possible to restrict a thing too much :)

closes #1709

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @G-Rath!

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.

@bradzacher bradzacher added the enhancement: plugin rule option New rule option for an existing eslint-plugin rule label Mar 9, 2020
@glen-84
Copy link
Contributor

glen-84 commented Mar 15, 2020

I'm not sure about the default.

In most cases, ts-ignore is ignoring an actual error, and in all cases, ts-expect-error is ignoring an error. How is it "unsafe" that ts-ignore might be ignoring nothing?

Of course, the real issue is that TypeScript doesn't allow you to ignore/expect specific errors (by code).

The rule states:

Using these to suppress TypeScript Compiler Errors reduces the effectiveness of TypeScript overall.

This is surely true for ts-expect-error as well?

@bradzacher
Copy link
Member

Yeah i would agree.
ts-expect-error is just as unsafe as ts-ignore, with the caveat that unused comments get reported for ts-expect-error.

@codecov
Copy link

codecov bot commented Mar 20, 2020

Codecov Report

Merging #1706 into master will decrease coverage by 0.10%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1706      +/-   ##
==========================================
- Coverage   94.49%   94.39%   -0.11%     
==========================================
  Files         162      163       +1     
  Lines        7471     7580     +109     
  Branches     2139     2182      +43     
==========================================
+ Hits         7060     7155      +95     
- Misses        178      182       +4     
- Partials      233      243      +10     
Flag Coverage Δ
#unittest 94.39% <100.00%> (-0.11%) ⬇️
Impacted Files Coverage Δ
packages/eslint-plugin/src/rules/ban-ts-comment.ts 100.00% <100.00%> (ø)
...ages/eslint-plugin/src/rules/no-empty-interface.ts 96.15% <0.00%> (-3.85%) ⬇️
...plugin/src/rules/explicit-module-boundary-types.ts 82.60% <0.00%> (-3.60%) ⬇️
...int-plugin/src/rules/consistent-type-assertions.ts 86.48% <0.00%> (-0.62%) ⬇️
...kages/eslint-plugin/src/rules/no-base-to-string.ts 100.00% <0.00%> (ø)
...-plugin/src/rules/explicit-function-return-type.ts 100.00% <0.00%> (ø)
...-plugin/src/rules/restrict-template-expressions.ts 100.00% <0.00%> (ø)
...t-plugin/src/rules/prefer-reduce-type-parameter.ts 100.00% <0.00%> (ø)
packages/eslint-plugin/src/rules/unbound-method.ts 96.72% <0.00%> (+0.05%) ⬆️

@bradzacher bradzacher changed the title feat(eslint-plugin): support ts-expect-error comment directive feat(eslint-plugin): [ban-ts-comment] support ts-expect-error Apr 12, 2020
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.

change ts-expect-error to be banned by default, and then this is good to merge

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Apr 12, 2020
@G-Rath G-Rath requested a review from bradzacher April 12, 2020 23:32
@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ban-ts-comment] // @ts-expect-error should be recognized
3 participants