tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

.eslint-resolver.js (678B)


      1 const path = require('path');
      2 const resolve = require('resolve'); // eslint-disable-line node/no-extraneous-require
      3 
      4 // Implements the following resolver spec:
      5 // https://github.com/benmosher/eslint-plugin-import/blob/master/resolvers/README.md
      6 exports.interfaceVersion = 2;
      7 
      8 exports.resolve = function (source, file, config) {
      9  if (resolve.isCore(source)) return { found: true, path: null };
     10 
     11  source = source.replace(/\.js$/, '.ts');
     12  try {
     13    return {
     14      found: true,
     15      path: resolve.sync(source, {
     16        extensions: [],
     17        basedir: path.dirname(path.resolve(file)),
     18        ...config,
     19      }),
     20    };
     21  } catch (err) {
     22    return { found: false };
     23  }
     24 };