Repository navigation
Report linter diagnostics on library declarations at the project usage site - #12560
Draft
Timothee Guerin (timotheeguerin) wants to merge 5 commits into
Draft
Timothee Guerin (timotheeguerin) wants to merge 5 commits into
Timothee Guerin (timotheeguerin) wants to merge 5 commits into
Conversation
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
This branch has not been deployed
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.
Linter diagnostics whose target is declared in a library are silently dropped, even when the user's own code is what pulled that declaration in. Rules then have a permanent blind spot, e.g. the Azure
no-query-in-collectionrule can never reporttopcoming fromAzure.Core.StandardListQueryParameters(typespec-azure#6066).This applies to every rule, so it's handled by one ownership policy in the linter rather than per-rule opt-in:
#suppresson the library declaration keeps the diagnostic out of every project.value: T,items: T[]). A property that merely shares the argument's type is not attributed to it;is, or intersection operand that composed it in (forA & B & C, the operand it came from).Array<T>, a template's own members) are still dropped.A rule can still pass an explicit
useSitewhen it knows a better node.Fixes #12558
Related: #1997, #11861
Impact on azure-rest-api-specs
Measured on all 594 projects at
699308ca6aa(warning-free today, so everything is new):The 617 come from just 48 (rule, library declaration) pairs, of two kinds.
Library-owned: 209 warnings from 8 declarations. These need fixing or
#suppressin typespec-azure before this ships:arm-no-recordonArmTagsProperty.tags,TrackedResource.tagsanduserAssignedIdentities(154). Tags areRecordby ARM design, so suppress.key-visibility-requiredonResourceNameParameter.name,OperationStatus.idandScopeParameter.scope(49). Add@visibility.arm-resource-name-patternonPrivateEndpointConnectionParameter.nameandPrivateLinkResourceParameter.name(6). Add@pattern.User-caused: 408 warnings. These are real findings on the user's code:
documentation-required(283, 66 projects): every one is in a project that blanks the library doc with@@doc(X.name, ""), e.g. AppServiceCustomDnsSuffixConfiguration.tsp#L75. It's reported on the spread or argument rather than the@@doc; pointing at the augment is the follow-up tracked in typespec-azure#5445.missing-x-ms-identifiers(76): user item types without identifiers, e.g.is Azure.Core.Page<SkuResource>,ArmResponse<NetworkStatusContractByLocation[]>.no-unknown(17),arm-no-record(12, e.g.ProxyResource<Record<unknown>>),request-body-problem(8),arm-resource-path-segment-invalid-charsandarm-resource-key-invalid-chars(8),no-query-explode(3, theAIGatewayoperands from Avoid duplicate null check and fix null serialization property name #6066),bad-record-type(1).Rollout
Even after the library cleanup, upgrading surfaces about 400 warnings in 93 spec projects. The library edits should land first. The spec repo then needs fixes or suppressions, or a staged rollout, before taking this compiler version.
Known limitations
extendsare not.@@doc(X, "")) is reported on the composition rather than the augment.