Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"arrow-spacing": ["error"],
"no-const-assign": ["error"],
"prefer-const": ["error"],
"prefer-arrow-callback": ["error"],
"spaced-comment": ["error", "always"],
"semi": ["error", "always"]
}
Expand Down
2 changes: 1 addition & 1 deletion auth/cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function createGoogleProvider() {

function cordovaSignInRedirect(provider) {
// [START auth_cordova_sign_in_redirect]
firebase.auth().signInWithRedirect(provider).then(function() {
firebase.auth().signInWithRedirect(provider).then(() => {
return firebase.auth().getRedirectResult();
}).then((result) => {
/** @type {firebase.auth.OAuthCredential} */
Expand Down
4 changes: 2 additions & 2 deletions auth/firebaseui.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ function fuiConfig() {
// [START auth_fui_config]
var uiConfig = {
callbacks: {
signInSuccessWithAuthResult: function(authResult, redirectUrl) {
signInSuccessWithAuthResult: (authResult, redirectUrl) => {
// User successfully signed in.
// Return type determines whether we continue the redirect automatically
// or whether we leave that to developer to handle.
return true;
},
uiShown: function() {
uiShown: () => {
// The widget is rendered.
// Hide the loader.
document.getElementById('loader').style.display = 'none';
Expand Down
28 changes: 14 additions & 14 deletions auth/link-multiple-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ function getProviders() {
function simpleLink(credential) {
// [START auth_simple_link]
auth.currentUser.linkWithCredential(credential)
.then(function(usercred) {
.then((usercred) => {
var user = usercred.user;
console.log("Account linking success", user);
}).catch(function(error) {
}).catch((error) => {
console.log("Account linking error", error);
});
// [END auth_simple_link]
Expand All @@ -53,10 +53,10 @@ function simpleLink(credential) {
function anonymousLink(credential) {
// [START auth_anonymous_link]
auth.currentUser.linkWithCredential(credential)
.then(function(usercred) {
.then((usercred) => {
var user = usercred.user;
console.log("Anonymous account successfully upgraded", user);
}).catch(function(error) {
}).catch((error) => {
console.log("Error upgrading anonymous account", error);
});
// [END auth_anonymous_link]
Expand All @@ -66,12 +66,12 @@ function linkWithPopup() {
var provider = new firebase.auth.GoogleAuthProvider();

// [START auth_link_with_popup]
auth.currentUser.linkWithPopup(provider).then(function(result) {
auth.currentUser.linkWithPopup(provider).then((result) => {
// Accounts successfully linked.
var credential = result.credential;
var user = result.user;
// ...
}).catch(function(error) {
}).catch((error) => {
// Handle Errors here.
// ...
});
Expand All @@ -88,14 +88,14 @@ function linkWithRedirect() {
// [END auth_link_with_redirect]

// [START auth_get_redirect_result]
auth.getRedirectResult().then(function(result) {
auth.getRedirectResult().then((result) => {
if (result.credential) {
// Accounts successfully linked.
var credential = result.credential;
var user = result.user;
// ...
}
}).catch(function(error) {
}).catch((error) => {
// Handle Errors here.
// ...
});
Expand All @@ -118,7 +118,7 @@ function mergeAccounts(newCredential) {
repo.delete(prevUser);

// Sign in user with the account you want to link to
auth.signInWithCredential(newCredential).then(function(result) {
auth.signInWithCredential(newCredential).then((result) => {
console.log("Sign In Success", result);
var currentUser = result.user;
var currentUserData = repo.get(currentUser);
Expand All @@ -128,15 +128,15 @@ function mergeAccounts(newCredential) {
var mergedData = repo.merge(prevUserData, currentUserData);

return prevUser.linkWithCredential(result.credential)
.then(function(linkResult) {
.then((linkResult) => {
// Sign in with the newly linked credential
return auth.signInWithCredential(linkResult.credential);
})
.then(function(signInResult) {
.then((signInResult) => {
// Save the merged data to the new user
repo.set(signInResult.user, mergedData);
});
}).catch(function(error) {
}).catch((error) => {
// If there are errors we want to undo the data merge/deletion
console.log("Sign In Error", error);
repo.set(prevUser, prevUserData);
Expand All @@ -157,10 +157,10 @@ function unlink(providerId) {
var user = auth.currentUser;

// [START auth_unlink_provider]
user.unlink(providerId).then(function() {
user.unlink(providerId).then(() => {
// Auth provider unlinked from account
// ...
}).catch(function(error) {
}).catch((error) => {
// An error happened
// ...
});
Expand Down
2 changes: 1 addition & 1 deletion database/read-and-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function writeUserDataWithCompletion(userId, name, email, imageUrl) {
username: name,
email: email,
profile_picture : imageUrl
}, function(error) {
}, (error) => {
if (error) {
// The write failed...
} else {
Expand Down
20 changes: 10 additions & 10 deletions firestore-next/test.firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class City {
}

// Firestore data converter
var cityConverter = {
toFirestore: function(city) {
const cityConverter = {
toFirestore: (city) => {
return {
name: city.name,
state: city.state,
country: city.country
};
},
fromFirestore: function(snapshot, options){
fromFirestore: (snapshot, options) => {
const data = snapshot.data(options);
return new City(data.name, data.state, data.country);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ describe("firestore", () => {
const q = query(collection(db, "users"), where("born", "<", 1900));
const unsubscribe = onSnapshot(q, (snapshot) => {
console.log("Current users born before 1900:");
snapshot.forEach(function (userSnapshot) {
snapshot.forEach((userSnapshot) => {
console.log(userSnapshot.data());
});
});
Expand Down Expand Up @@ -360,7 +360,7 @@ describe("firestore", () => {
function deleteCollection(db, collectionRef, batchSize) {
const q = query(collectionRef, orderBy('__name__'), limit(batchSize));

return new Promise(function(resolve) {
return new Promise((resolve) => {
deleteQueryBatch(db, q, batchSize, resolve);
});
}
Expand Down Expand Up @@ -616,7 +616,7 @@ describe("firestore", () => {
});
// [END listen_document]

setTimeout(function() {
setTimeout(() => {
unsub();
done();
}, 3000);
Expand All @@ -632,7 +632,7 @@ describe("firestore", () => {
});
// [END listen_document_local]

setTimeout(function() {
setTimeout(() => {
unsub();
done();
}, 3000);
Expand All @@ -650,7 +650,7 @@ describe("firestore", () => {
});
// [END listen_with_metadata]

setTimeout(function() {
setTimeout(() => {
unsub();
done();
}, 3000);
Expand Down Expand Up @@ -695,7 +695,7 @@ describe("firestore", () => {
console.log("Current cities in CA: ", cities.join(", "));
});
// [END listen_multiple]
setTimeout(function() {
setTimeout(() => {
unsubscribe();
done();
}, 2500);
Expand All @@ -720,7 +720,7 @@ describe("firestore", () => {
});
});
// [END listen_diffs]
setTimeout(function() {
setTimeout(() => {
unsubscribe();
done();
}, 2500);
Expand Down
Loading