-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add Travis CI for linting #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "env": { | ||
| "browser": true | ||
| }, | ||
| "extends": "eslint:recommended", | ||
| "rules": { | ||
| "indent": [ | ||
| "error", | ||
| 2 | ||
| ], | ||
| "linebreak-style": [ | ||
| "error", | ||
| "unix" | ||
| ], | ||
| "quotes": [ | ||
| "error", | ||
| "single" | ||
| ], | ||
| "semi": [ | ||
| "error", | ||
| "always" | ||
| ], | ||
| "curly": [ | ||
| "error", | ||
| "all" | ||
| ], | ||
| "consistent-this": [ | ||
| "error", | ||
| "that" | ||
| ], | ||
| "no-console": 0, | ||
| "no-unused-vars": 0 | ||
| }, | ||
| "globals": { | ||
| "chrome": true, | ||
| "firebase": true, | ||
| "Promise": true | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| language: node_js | ||
| node_js: | ||
| - "7" | ||
| install: | ||
| - npm install -g lerna | ||
| - npm install -g eslint | ||
| - lerna bootstrap | ||
| script: | ||
| - ./scripts/test.sh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
| */ | ||
| 'use strict'; | ||
|
|
||
| var componentHandler = componentHandler || undefined; | ||
|
||
|
|
||
| // Shortcuts to DOM Elements. | ||
| var messageForm = document.getElementById('message-form'); | ||
| var messageInput = document.getElementById('new-post-message'); | ||
|
|
@@ -162,7 +164,7 @@ function createPostElement(postId, title, text, author, authorId, authorPic) { | |
| // [END post_value_event_listener] | ||
|
|
||
| // Listen for the starred status. | ||
| var starredStatusRef = firebase.database().ref('posts/' + postId + '/stars/' + uid) | ||
| var starredStatusRef = firebase.database().ref('posts/' + postId + '/stars/' + uid); | ||
| starredStatusRef.on('value', function(snapshot) { | ||
| updateStarredByCurrentUser(postElement, snapshot.val()); | ||
| }); | ||
|
|
@@ -273,21 +275,21 @@ function startDatabaseQueries() { | |
| var author = data.val().author || 'Anonymous'; | ||
| var containerElement = sectionElement.getElementsByClassName('posts-container')[0]; | ||
| containerElement.insertBefore( | ||
| createPostElement(data.key, data.val().title, data.val().body, author, data.val().uid, data.val().authorPic), | ||
| containerElement.firstChild); | ||
| createPostElement(data.key, data.val().title, data.val().body, author, data.val().uid, data.val().authorPic), | ||
| containerElement.firstChild); | ||
| }); | ||
| postsRef.on('child_changed', function(data) { | ||
| var containerElement = sectionElement.getElementsByClassName('posts-container')[0]; | ||
| var postElement = containerElement.getElementsByClassName('post-' + data.key)[0]; | ||
| postElement.getElementsByClassName('mdl-card__title-text')[0].innerText = data.val().title; | ||
| postElement.getElementsByClassName('username')[0].innerText = data.val().author; | ||
| postElement.getElementsByClassName('text')[0].innerText = data.val().body; | ||
| postElement.getElementsByClassName('star-count')[0].innerText = data.val().starCount; | ||
| postsRef.on('child_changed', function(data) { | ||
| var containerElement = sectionElement.getElementsByClassName('posts-container')[0]; | ||
| var postElement = containerElement.getElementsByClassName('post-' + data.key)[0]; | ||
| postElement.getElementsByClassName('mdl-card__title-text')[0].innerText = data.val().title; | ||
| postElement.getElementsByClassName('username')[0].innerText = data.val().author; | ||
| postElement.getElementsByClassName('text')[0].innerText = data.val().body; | ||
| postElement.getElementsByClassName('star-count')[0].innerText = data.val().starCount; | ||
| }); | ||
| postsRef.on('child_removed', function(data) { | ||
| var containerElement = sectionElement.getElementsByClassName('posts-container')[0]; | ||
| var post = containerElement.getElementsByClassName('post-' + data.key)[0]; | ||
| post.parentElement.removeChild(post); | ||
| var containerElement = sectionElement.getElementsByClassName('posts-container')[0]; | ||
| var post = containerElement.getElementsByClassName('post-' + data.key)[0]; | ||
| post.parentElement.removeChild(post); | ||
| }); | ||
| }; | ||
|
|
||
|
|
@@ -370,8 +372,8 @@ function newPostForCurrentUser(title, text) { | |
| var username = (snapshot.val() && snapshot.val().username) || 'Anonymous'; | ||
| // [START_EXCLUDE] | ||
| return writeNewPost(firebase.auth().currentUser.uid, username, | ||
| firebase.auth().currentUser.photoURL, | ||
| title, text); | ||
| firebase.auth().currentUser.photoURL, | ||
| title, text); | ||
| // [END_EXCLUDE] | ||
| }); | ||
| // [END single_value_read] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "globals": { | ||
| "Navigo": true, | ||
| "mdc": true, | ||
| "importScripts": true, | ||
| "FriendlyEats": true | ||
| } | ||
| } | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,29 +19,29 @@ | |
| * Adds a set of mock Restaurants to the Cloud Firestore. | ||
| */ | ||
| FriendlyEats.prototype.addMockRestaurants = function() { | ||
| const promises = []; | ||
| var promises = []; | ||
|
|
||
| for (let i = 0; i < 20; i++) { | ||
| let name = | ||
| for (var i = 0; i < 20; i++) { | ||
| var name = | ||
| this.getRandomItem(this.data.words) + | ||
| ' ' + | ||
| this.getRandomItem(this.data.words); | ||
| let category = this.getRandomItem(this.data.categories); | ||
| let city = this.getRandomItem(this.data.cities); | ||
| let price = Math.floor(Math.random() * 4) + 1; | ||
| let photoID = Math.floor(Math.random() * 22) + 1; | ||
| let photo = `https://storage.googleapis.com/firestorequickstarts.appspot.com/food_${photoID}.png`; | ||
| let numRatings = 0; | ||
| let avgRating = 0; | ||
| var category = this.getRandomItem(this.data.categories); | ||
| var city = this.getRandomItem(this.data.cities); | ||
| var price = Math.floor(Math.random() * 4) + 1; | ||
| var photoID = Math.floor(Math.random() * 22) + 1; | ||
| var photo = 'https://storage.googleapis.com/firestorequickstarts.appspot.com/food_' + photoID + '.png'; | ||
| var numRatings = 0; | ||
| var avgRating = 0; | ||
|
|
||
| const promise = this.addRestaurant({ | ||
| name, | ||
| category, | ||
| price, | ||
| city, | ||
| numRatings, | ||
| avgRating, | ||
| photo | ||
| var promise = this.addRestaurant({ | ||
| name: name, | ||
| category: category, | ||
| price: price, | ||
| city: city, | ||
| numRating: numRatings, | ||
| avgRating: avgRating, | ||
| photo: photo | ||
| }); | ||
|
|
||
| if (!promise) { | ||
|
|
@@ -59,9 +59,9 @@ FriendlyEats.prototype.addMockRestaurants = function() { | |
| * Adds a set of mock Ratings to the given Restaurant. | ||
| */ | ||
| FriendlyEats.prototype.addMockRatings = function(restaurantID) { | ||
| const ratingPromises = []; | ||
| for (let r = 0; r < 5*Math.random(); r++) { | ||
| const rating = this.data.ratings[ | ||
| var ratingPromises = []; | ||
| for (var r = 0; r < 5*Math.random(); r++) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed how amazing this is. The
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's pretty funny. I wonder what the distribution of actual |
||
| var rating = this.data.ratings[ | ||
| parseInt(this.data.ratings.length*Math.random()) | ||
| ]; | ||
| rating.userName = 'Bot (Web)'; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add end of file line break