summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/.eslint-resolver.js
blob: e2b0f32d354f1f508cf7edfea2477cfefd131172 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const path = require('path');
const resolve = require('resolve')

// Implements the following resolver spec:
// https://github.com/benmosher/eslint-plugin-import/blob/master/resolvers/README.md
exports.interfaceVersion = 2

exports.resolve = function (source, file, config) {
  if (resolve.isCore(source)) return { found: true, path: null }

  source = source.replace(/\.js$/, '.ts');
  try {
    return {
      found: true, path: resolve.sync(source, {
        extensions: [],
        basedir: path.dirname(path.resolve(file)),
        ...config,
      })
    }
  } catch (err) {
    return { found: false }
  }
}