How to use the eslint-module-utils/ignore.getFileExtensions function in eslint-module-utils

To help you get started, we’ve selected a few eslint-module-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benmosher / eslint-plugin-import / src / rules / no-unused-modules.js View on Github external
const resolveFiles = (src, ignoreExports, context) => {
  const extensions = Array.from(getFileExtensions(context.settings))

  const srcFiles = new Set()
  const srcFileList = listFilesToProcess(src, extensions)

  // prepare list of ignored files
  const ignoredFilesList =  listFilesToProcess(ignoreExports, extensions)
  ignoredFilesList.forEach(({ filename }) => ignoredFiles.add(filename))

  // prepare list of source files, don't consider files from node_modules
  srcFileList.filter(({ filename }) => !isNodeModule(filename)).forEach(({ filename }) => {
    srcFiles.add(filename)
  })
  return srcFiles
}
github benmosher / eslint-plugin-import / tests / src / core / ignore.js View on Github external
it('returns a set with the file extension ".js" if "import/extensions" is not configured', function () {
      const fileExtensions = getFileExtensions({})

      expect(fileExtensions).to.include('.js')
    })
github benmosher / eslint-plugin-import / tests / src / core / ignore.js View on Github external
it('returns a set with the file extensions configured in "import/extension"', function () {
      const settings = {
        'import/extensions': ['.js', '.jsx'],
      }

      const fileExtensions = getFileExtensions(settings)

      expect(fileExtensions).to.include('.js')
      expect(fileExtensions).to.include('.jsx')
    })