xo 0.52.1 → 0.52.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ import {
28
28
  CACHE_DIR_NAME,
29
29
  } from './constants.js';
30
30
 
31
- const {__dirname, readJson, require} = createEsmUtils(import.meta);
31
+ const {__dirname, require} = createEsmUtils(import.meta);
32
32
  const {normalizePackageName} = Legacy.naming;
33
33
  const resolveModule = Legacy.ModuleResolver.resolve;
34
34
 
@@ -162,7 +162,7 @@ const handleTSConfig = async options => {
162
162
 
163
163
  if (tsConfigProjectPath) {
164
164
  options.tsConfigPath = path.resolve(options.cwd, tsConfigProjectPath);
165
- options.tsConfig = await readJson(options.tsConfigPath);
165
+ options.tsConfig = JSON5.parse(await fs.readFile(options.tsConfigPath));
166
166
  } else {
167
167
  const tsConfigExplorer = cosmiconfig([], {
168
168
  searchPlaces: ['tsconfig.json'],
@@ -644,9 +644,22 @@ async function recursiveBuildTsConfig(tsConfig, tsConfigPath) {
644
644
  }
645
645
 
646
646
  // If any of the following are missing, then we need to look up the base config as it could apply
647
- // Use node resolution
648
647
  const require = createRequire(tsConfigPath);
649
- const basePath = require.resolve(tsConfig.extends);
648
+
649
+ let basePath;
650
+ try {
651
+ basePath = require.resolve(tsConfig.extends);
652
+ } catch (error) {
653
+ // Tsconfig resolution is odd, It allows behavior that is not exactly like node resolution
654
+ // therefore we attempt to smooth this out here with this hack
655
+ try {
656
+ basePath = require.resolve(path.join(tsConfig.extends, 'tsconfig.json'));
657
+ } catch {
658
+ // Throw the orginal resolution error to let the user know their extends block is invalid
659
+ throw error;
660
+ }
661
+ }
662
+
650
663
  const baseTsConfig = JSON5.parse(await fs.readFile(basePath));
651
664
 
652
665
  delete tsConfig.extends;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xo",
3
- "version": "0.52.1",
3
+ "version": "0.52.2",
4
4
  "description": "JavaScript/TypeScript linter (ESLint wrapper) with great defaults",
5
5
  "license": "MIT",
6
6
  "repository": "xojs/xo",