Skip to content

Commit

Permalink
Merge pull request #118 from simonihmig/fix-ts-resolve
Browse files Browse the repository at this point in the history
Fix resolving of peer deps
  • Loading branch information
NullVoxPopuli authored Jan 15, 2025
2 parents 8b10aef + cdb0284 commit ff785cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/parser/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ const mathMLTags = require('mathml-tag-names');

let TypescriptScope = null;
try {
const path = require.resolve('@typescript-eslint/parser');
const parserPath = require.resolve('@typescript-eslint/parser');
// eslint-disable-next-line n/no-unpublished-require
TypescriptScope = require('@typescript-eslint/scope-manager', { paths: [path] });
const scopeManagerPath = require.resolve('@typescript-eslint/scope-manager', {
paths: [parserPath],
});
TypescriptScope = require(scopeManagerPath);
} catch {
// not available
}
Expand Down
5 changes: 3 additions & 2 deletions src/parser/ts-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ const { replaceRange } = require('./transforms');
let patchTs, replaceExtensions, syncMtsGtsSourceFiles, typescriptParser, isPatched;

try {
const tsPath = require.resolve('@typescript-eslint/parser');
const parserPath = require.resolve('@typescript-eslint/parser');
// eslint-disable-next-line n/no-unpublished-require
const ts = require('typescript', { paths: [tsPath] });
const tsPath = require.resolve('typescript', { paths: [parserPath] });
const ts = require(tsPath);
typescriptParser = require('@typescript-eslint/parser');
patchTs = function patchTs() {
if (isPatched) {
Expand Down

0 comments on commit ff785cf

Please sign in to comment.