function loadPatterns(rootDir) {
  return fs.readdirSync(rootDir).map((name) => {
    for (const [sourceFile, resultFile, options] of [
      ['source.js', 'result.js'],
      [
        'source.vue',
        'result.vue',
        { languageOptions: { parser: 'vue-eslint-parser' } }
      ]
    ]) {
      const sourceFilePath = path.join(rootDir, name, sourceFile)
      if (fs.existsSync(sourceFilePath)) {
        return {
          code: fs.readFileSync(sourceFilePath, 'utf8'),
          name,
          sourceFilePath,
          resultFilePath: path.join(rootDir, name, resultFile),
          options
        }
      }
    }
  })
}
Load test patterns from fixtures.

@returns {LoadedPattern[]} The loaded patterns.