Skip to content

Commit fc1270e

Browse files
authored
fix: Acknowledge JSX option in JS mode (eslint#74)
1 parent d8bc2f7 commit fc1270e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/components/ast/javascript-ast.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export const JavascriptAst: FC = () => {
1818
tree = espree.parse(explorer.code.javascript, {
1919
ecmaVersion: explorer.jsOptions.esVersion,
2020
sourceType: explorer.jsOptions.sourceType,
21+
ecmaFeatures: {
22+
jsx: explorer.jsOptions.isJSX,
23+
},
2124
});
2225

2326
ast = JSON.stringify(tree, null, 2);

src/components/path/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const CodePath: FC = () => {
3131
javascript,
3232
esVersion,
3333
sourceType,
34+
jsOptions.isJSX,
3435
);
3536
if ("error" in response) {
3637
throw new Error(response.error);

src/lib/generate-code-path.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const generateCodePath = async (
5959
code: string,
6060
esVersion: Version,
6161
sourceType: SourceType,
62+
isJSX: boolean,
6263
): Promise<
6364
| {
6465
error: string;
@@ -127,6 +128,11 @@ export const generateCodePath = async (
127128
languageOptions: {
128129
ecmaVersion: esVersion,
129130
sourceType,
131+
parserOptions: {
132+
ecmaFeatures: {
133+
jsx: isJSX,
134+
},
135+
},
130136
},
131137
};
132138

0 commit comments

Comments
 (0)