Skip to content

Commit

Permalink
fix mts extension not in includes
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Nov 23, 2023
1 parent dd72c1c commit c700351
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/parsers/gjs-gts-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ module.exports = {
const isTypescript = options.filePath.endsWith('.gts');

let result = null;
let filePath = options.filePath;
const filePath = options.filePath;
if (options.project) {
jsCode = replaceExtensions(jsCode);
filePath = options.filePath.replace(/\.gts$/, '.mts');
}

result = isTypescript
Expand Down
5 changes: 4 additions & 1 deletion lib/parsers/ts-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ module.exports.patchTs = function patchTs() {
...ts.sys,
readDirectory(...args) {
const results = sys.readDirectory.call(this, ...args);
return results.map((f) => f.replace(/\.gts$/, '.mts'));
return [
...results,
...results.filter((x) => x.endsWith('.gts')).map((f) => f.replace(/\.gts$/, '.mts')),
];
},
fileExists(fileName) {
return fs.existsSync(fileName.replace(/\.mts$/, '.gts')) || fs.existsSync(fileName);
Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules-preprocessor/tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"strictNullChecks": true
},
"include": [
"**/*"
"**/*.ts",
"**/*.gts"
],
}

0 comments on commit c700351

Please sign in to comment.