Skip to content

Commit

Permalink
fix(parser): remove the jsx option requirement for automatic jsx prag…
Browse files Browse the repository at this point in the history
…ma resolution (#6134)
  • Loading branch information
Solo-steven committed Dec 2, 2022
1 parent 9d58b6b commit e777f5e
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions packages/parser/src/parser.ts
Expand Up @@ -136,30 +136,28 @@ function parseForESLint(
analyzeOptions.lib = getLib(compilerOptions);
log('Resolved libs from program: %o', analyzeOptions.lib);
}
if (parserOptions.jsx === true) {
if (
analyzeOptions.jsxPragma === undefined &&
compilerOptions.jsxFactory != null
) {
// in case the user has specified something like "preact.h"
const factory = compilerOptions.jsxFactory.split('.')[0].trim();
analyzeOptions.jsxPragma = factory;
log('Resolved jsxPragma from program: %s', analyzeOptions.jsxPragma);
}
if (
analyzeOptions.jsxFragmentName === undefined &&
compilerOptions.jsxFragmentFactory != null
) {
// in case the user has specified something like "preact.Fragment"
const fragFactory = compilerOptions.jsxFragmentFactory
.split('.')[0]
.trim();
analyzeOptions.jsxFragmentName = fragFactory;
log(
'Resolved jsxFragmentName from program: %s',
analyzeOptions.jsxFragmentName,
);
}
if (
analyzeOptions.jsxPragma === undefined &&
compilerOptions.jsxFactory != null
) {
// in case the user has specified something like "preact.h"
const factory = compilerOptions.jsxFactory.split('.')[0].trim();
analyzeOptions.jsxPragma = factory;
log('Resolved jsxPragma from program: %s', analyzeOptions.jsxPragma);
}
if (
analyzeOptions.jsxFragmentName === undefined &&
compilerOptions.jsxFragmentFactory != null
) {
// in case the user has specified something like "preact.Fragment"
const fragFactory = compilerOptions.jsxFragmentFactory
.split('.')[0]
.trim();
analyzeOptions.jsxFragmentName = fragFactory;
log(
'Resolved jsxFragmentName from program: %s',
analyzeOptions.jsxFragmentName,
);
}
if (compilerOptions.emitDecoratorMetadata === true) {
emitDecoratorMetadata = true;
Expand Down

0 comments on commit e777f5e

Please sign in to comment.