lib/rules/file-extension-in-import.js
function getExistingExtensions(filePath) {
    const basename = path.basename(filePath, path.extname(filePath))
    try {
        return fs
            .readdirSync(path.dirname(filePath))
            .filter(
                filename =>
                    path.basename(filename, path.extname(filename)) === basename
            )
            .map(filename => path.extname(filename))
    } catch (_error) {
        return []
    }
}
function getExistingExtensions(filePath) {
    const basename = path.basename(filePath, path.extname(filePath))
    try {
        return fs
            .readdirSync(path.dirname(filePath))
            .filter(
                filename =>
                    path.basename(filename, path.extname(filename)) === basename
            )
            .map(filename => path.extname(filename))
    } catch (_error) {
        return []
    }
}
function getExistingExtensions ( filePath ) { const basename = path . basename ( filePath , path . extname ( filePath ) ) try { return fs . readdirSync ( path . dirname ( filePath ) ) . filter ( filename => path . basename ( filename , path . extname ( filename ) ) === basename ) . map ( filename => path . extname ( filename ) ) } catch ( _error ) { return [ ] } }
Get all file extensions of the files which have the same basename.
@param {string} filePath The path to the original file to check.
@returns {string[]} File extensions.
Get all file extensions of the files which have the same basename .