feat(all): support suppressing warnings via // fable-disable comments#4808
Draft
MangelMaxime wants to merge 1 commit into
Draft
feat(all): support suppressing warnings via // fable-disable comments#4808MangelMaxime wants to merge 1 commit into
// fable-disable comments#4808MangelMaxime wants to merge 1 commit into
Conversation
// fable-disable comments
| /// Dart target: only the comparison itself is honored, `methodName` fills in which one so the | ||
| /// message stays specific (e.g. "String.Contains: second argument is ignored"). | ||
| let stringSecondArgumentIgnored (methodName: string) = | ||
| StringSecondArgumentIgnored, $"String.{methodName}: second argument is ignored" |
|
|
||
| let endState = loop initialState | ||
| // Materialize each run's text; endState lets the caller resume correctly on the next line. | ||
| (runs |> Seq.map string |> List.ofSeq), endState |
Contributor
Python Type Checking Results (Pyright)
Excluded files with errors (4 files)These files have known type errors and are excluded from CI. Remove from
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
In Fable we added support for
TreatWarningsAsErrors: some warnings Fable generates as informational signals can be treated as errors when this is enabled.With this PR, I'm adding support for ESLint-style suppression comments (we can't reuse
#nowarn- it only accepts numeric codes and is resolved by FCS before Fable's own warnings even exist - and a new compiler-level directive would mean patching FCS itself).This adds support for:
// fable-disable-line// fable-disable-next-line// fable-disable...// fable-enableFor example, a user recently requested a warning for duplicate
CompiledNames on union cases. I originally thought this should be an error, but some libraries (e.g. Fable.React) use duplicate names on purpose to represent JS binding "overloads" - so it could only ever be a warning.By adding suppression comments, people can keep
TreatWarningsAsErrorsenabled for safety, while still deciding, case by case, to suppress the specific warnings they judge harmless.The current codes in
src/Fable.Transforms/Global/WarningCodes.fsare here to serve as an example.