-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add @Suppress directive to suppress warnings, hints and compati…
…bility issues
- Loading branch information
Showing
35 changed files
with
702 additions
and
162 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { assertValidatorAcceptsAndDoesNotWarn, assertValidatorWarns } from './helpers'; | ||
|
||
describe('@suppress', () => { | ||
it('warns on type level if @suppress is not used', () => { | ||
assertValidatorWarns( | ||
` | ||
type Stuff @rootEntity { | ||
foo: String | ||
} | ||
type Child @childEntity { | ||
stuff: Int | ||
} | ||
`, | ||
'Type "Child" is not used.', | ||
); | ||
}); | ||
|
||
it('does not warn on type level if @suppress is used correctly with one entry', () => { | ||
assertValidatorAcceptsAndDoesNotWarn( | ||
` | ||
type Stuff @rootEntity { | ||
foo: String | ||
} | ||
type Child @childEntity @suppress(warnings: [UNUSED]) { | ||
stuff: Int | ||
} | ||
`, | ||
); | ||
}); | ||
|
||
it('does not warn on type level if @suppress is used correctly with one non-list entry', () => { | ||
assertValidatorAcceptsAndDoesNotWarn( | ||
` | ||
type Stuff @rootEntity { | ||
foo: String | ||
} | ||
type Child @childEntity @suppress(warnings: UNUSED) { | ||
stuff: Int | ||
} | ||
`, | ||
); | ||
}); | ||
|
||
it('does not warn on type level if @suppress is used correctly with multiple entries', () => { | ||
assertValidatorAcceptsAndDoesNotWarn( | ||
` | ||
type Stuff @rootEntity { | ||
foo: String | ||
} | ||
type Child @childEntity @suppress(warnings: [DEPRECATED, UNUSED]) { | ||
stuff: Int | ||
} | ||
`, | ||
); | ||
}); | ||
|
||
it('warns on type level if @suppress is used with the wrong code entries', () => { | ||
assertValidatorWarns( | ||
` | ||
type Stuff @rootEntity { | ||
foo: String | ||
} | ||
type Child @childEntity @suppress(warnings: [DEPRECATED]) { | ||
stuff: Int | ||
} | ||
`, | ||
'Type "Child" is not used.', | ||
); | ||
}); | ||
|
||
it('warns on field level if @suppress is not used', () => { | ||
assertValidatorWarns( | ||
` | ||
type Stuff @rootEntity { | ||
foo: String | ||
_key: ID @key | ||
} | ||
`, | ||
'The field "_key" is deprecated and should be replaced with "id" (of type "ID").', | ||
); | ||
}); | ||
|
||
it('does not warn on field level if @suppress is used', () => { | ||
assertValidatorAcceptsAndDoesNotWarn( | ||
` | ||
type Stuff @rootEntity { | ||
foo: String | ||
_key: ID @key @suppress(warnings: [DEPRECATED]) | ||
} | ||
`, | ||
); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.