Skip to content

Commit

Permalink
fix: - bump typescript version
Browse files Browse the repository at this point in the history
- only use emit JSX on ts if file ends with .tsx(issues with normal file)
- fix default entry for walker on non-main-module projects
  • Loading branch information
renanccastro committed Aug 28, 2024
1 parent 3318916 commit 1920938
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
13 changes: 7 additions & 6 deletions lib/util/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function precompileTypeScript(filePath, fileContent) {
inlineSources: false,
experimentalDecorators: true,
emitDecoratorMetadata: true,
jsx: ts.JsxEmit.React,
jsx: filePath.endsWith('.tsx') ? ts.JsxEmit.React: ts.JsxEmit.None,
}
});
} catch (e) {
Expand All @@ -87,14 +87,15 @@ module.exports = function readAndParse(filePath) {
const fileContent = fs.readFileSync(filePath, 'utf-8');
const isTsFile = filePath.endsWith(".ts") || filePath.endsWith("tsx");
const codeContent = isTsFile ? precompileTypeScript(filePath, fileContent).outputText : fileContent;

return parse(codeContent, {
parser: {
parse: (source) =>
meteorBabelParser(source, {
...defaultParserOptions,
tokens: true,
}),
{
return meteorBabelParser(source, {
...defaultParserOptions,
tokens: true,
});
},
},
});
};
Expand Down
24 changes: 15 additions & 9 deletions lib/util/walker.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,23 @@ class Walker {
onFile,
this.cachedParsedFile
);
fs.writeFileSync(this.filePath(), JSON.stringify(this.cachedParsedFile));
return;
}
} else {
handleFolder(
this.appPath,
this.appPath,
archList,
onFile,
this.cachedParsedFile
);
}

if(!fs.existsSync(path.join(this.appPath, 'server'))){
debug('No server folder found in the app');
return;
}
debug('Starting from meteor server folder');

handleFolder(
path.join(this.appPath, 'server'),
this.appPath,
archList,
onFile,
this.cachedParsedFile
);
fs.writeFileSync(this.filePath(), JSON.stringify(this.cachedParsedFile));
}

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@quave/eslint-plugin-meteor-quave",
"version": "1.5.0",
"version": "1.5.1",
"description": "Quave linting rules for ESLint",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"readline-sync": "^1.4.10",
"recast": "^0.23.4",
"reify": "^0.20.12",
"typescript": "^5.4.5",
"typescript": "^5.5.4",
"validate-commit-msg": "^2.14.0"
},
"peerDependencies": {
Expand Down

0 comments on commit 1920938

Please sign in to comment.