Skip to content
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

fix: jsx should be included for tsx files but not for ts fixed #1359 #1373

Merged
merged 1 commit into from Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/input/dependency.js
Expand Up @@ -8,7 +8,7 @@ const smartGlob = require('../smart_glob.js');

const STANDARD_BABEL_CONFIG = {
compact: false,
parserOpts: { plugins: [...standardBabelParserPlugins, 'flow'] }
parserOpts: { plugins: [...standardBabelParserPlugins, 'flow', 'jsx'] }
};

/**
Expand Down
7 changes: 3 additions & 4 deletions src/parsers/parse_to_ast.js
Expand Up @@ -2,8 +2,8 @@ const babelParser = require('@babel/parser');
const path = require('path');

const TYPESCRIPT_EXTS = {
'.ts': true,
'.tsx': true
'.ts': ['typescript'],
'.tsx': ['typescript', 'jsx']
};

const standardBabelParserPlugins = [
Expand All @@ -14,7 +14,6 @@ const standardBabelParserPlugins = [
'exportDefaultFrom',
'exportExtensions',
'functionBind',
'jsx',
'partialApplication',
['pipelineOperator', { proposal: 'minimal' }],
'throwExpressions'
Expand All @@ -29,7 +28,7 @@ function getParserOpts(file) {
plugins: [
...standardBabelParserPlugins,
['decorators', { decoratorsBeforeExport: false }],
TYPESCRIPT_EXTS[path.extname(file || '')] ? 'typescript' : 'flow'
...(TYPESCRIPT_EXTS[path.extname(file || '')] || ['flow', 'jsx'])
]
};
}
Expand Down