Skip to content

Conversation

@bfanger
Copy link
Contributor

@bfanger bfanger commented Sep 28, 2020

Feature
svelte-check --fail-on-hints will exit with error code when there are hints, similar to --fail-on-warnings

Use case
I want my CI and commit hooks to fail when there are hints, that way I can prevent committing code with hints such as:

/path/to/Component.svelte:10:3
Hint: 'someVariable' is declared but its value is never read. (ts)

@dummdidumm
Copy link
Member

Thanks for the PR! Could you also update the writer's completion method so that hints also appear in the summary? Else it might feel odd that the summary doesn't mention hints but still fails.

@bfanger
Copy link
Contributor Author

bfanger commented Sep 28, 2020

Also in the machine output?

@dummdidumm
Copy link
Member

Yes

@bfanger bfanger force-pushed the feature/fail-on-hints branch from b1e549f to 5d03237 Compare September 29, 2020 08:21
@bfanger
Copy link
Contributor Author

bfanger commented Sep 29, 2020

I've refactored the completion method, going from 4 to 8 variations:

X error(s) and X warning(s)
X error(s)
X warning(s)
no errors and no warning

to:

X error(s), X warning(s) and X hint(s)
X error(s) and X warning(s)
X error(s) and X hint(s)
X error(s)
X warning(s) and X hint(s)
X warning(s)
X hint(s)
no errors, no warnings  and no hints

@dummdidumm
Copy link
Member

I think at this point it might make sense - also from a maintenance perspective - to simplify this to X error(s), X warning(s) and X hint(s) where X >= 0. I think this also makes it easier to read because it's consistent, all three levels are always listed.

@bfanger bfanger force-pushed the feature/fail-on-hints branch from 5d03237 to 5c85cc8 Compare September 29, 2020 19:02
@bfanger bfanger force-pushed the feature/fail-on-hints branch from 5c85cc8 to 615497a Compare September 29, 2020 19:13
// Event Handler Types
// ----------------------------------------------------------------------
type EventHandler<E = Event, T = HTMLElement> = (event: E & { currentTarget: EventTarget & T}) => any;
type EventHandler<E = Event, T = HTMLElement> =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line was 102 characters, creating a linting error.

@bfanger
Copy link
Contributor Author

bfanger commented Sep 29, 2020

Simplified

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

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

👍

@dummdidumm dummdidumm merged commit 173b23d into sveltejs:master Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants