Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
it('returns a set with the file extension ".js" if "import/extensions" is not configured', function () {
const fileExtensions = getFileExtensions({})
expect(fileExtensions).to.include('.js')
})
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')
})