-
Notifications
You must be signed in to change notification settings - Fork 48.8k
[compiler][playground][tests] Standardize more pragmas #33146
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so good!
@@ -98,15 +98,15 @@ export type PluginOptions = { | |||
* provided rules will skip compilation. To disable this feature (never bailout of compilation | |||
* even if the default ESLint is suppressed), pass an empty array. | |||
*/ | |||
eslintSuppressionRules?: Array<string> | null | undefined; | |||
eslintSuppressionRules: Array<string> | null | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're already spreading defaultOptions
when parsing PluginOptions, which would set eslintSuppressionRules
and sources
if they were undefined in the Partial<PluginOptions>
parameter. This type change should be a no-op
function tryParseTestPragmaValue(val: string): Result<unknown, unknown> { | ||
try { | ||
let parsedVal: unknown; | ||
const stringMatch = /^"([^"]*)"$/.exec(val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was needed for hookPattern
strings which contain escape character sequences
see test fixtures --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33144). * #33146 * #33145 * __->__ #33144
`Environment.ts` is getting complex so let's separate test / playground parsing logic from it --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33145). * #33146 * __->__ #33145
see test fixtures --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33144). * #33146 * #33145 * __->__ #33144 DiffTrain build for [fbe7bc2](fbe7bc2)
(Almost) all pragmas are now one of the following: - `@...TestOnly`: custom pragma for test fixtures - `@<configName>` | `@<configName>:true`: enables with either true or a default enabled value - `@<configName>:<json value>`
`Environment.ts` is getting complex so let's separate test / playground parsing logic from it --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33145). * #33146 * __->__ #33145 DiffTrain build for [b629a86](b629a86)
(Almost) all pragmas are now one of the following:
@...TestOnly
: custom pragma for test fixtures@<configName>
|@<configName>:true
: enables with either true or a default enabled value@<configName>:<json value>