function checkSourceValue(source) {
      const shouldCheckCase = !CASE_SENSITIVE_FS &&
        (!context.options[0] || context.options[0].caseSensitive !== false)

      const resolvedPath = resolve(source.value, context)

      if (resolvedPath === undefined) {
        context.report(source,
          `Unable to resolve path to module '${source.value}'.`)
      }

      else if (shouldCheckCase) {
        const cacheSettings = ModuleCache.getSettings(context.settings)
        if (!fileExistsWithCaseSync(resolvedPath, cacheSettings)) {
          context.report(source,
            `Casing of ${source.value} does not match the underlying filesystem.`)
        }

      }
    }
示例#2
0
 it('detecting case does not include parent folder path (issue #720)', function () {
   const f = path.join(process.cwd().toUpperCase(), './tests/files/jsx/MyUnCoolComponent.jsx')
   expect(fileExistsWithCaseSync(f, ModuleCache.getSettings(testContext), true))
     .to.be.true
 })
示例#3
0
 it('detects case does not match FS', function () {
   expect(fileExistsWithCaseSync(file, ModuleCache.getSettings(testContext)))
     .to.be.false
 })