complete eslint devDeps and fix lint errors

This commit is contained in:
xavcz 2016-11-15 09:02:30 +01:00
parent c842dfbf80
commit 4ae1c01eec
12 changed files with 35 additions and 23 deletions

View file

@ -4,6 +4,7 @@
],
"parser": "babel-eslint",
"parserOptions": {
"allowImportExportEverywhere": true,
"ecmaVersion": 6,
"sourceType": "module"
},
@ -23,14 +24,19 @@
"no-console": 1
},
"env": {
"es6": true,
"node": true,
"browser": true,
"commonjs": true
"commonjs": true,
"es6": true,
"meteor": true,
"node": true
},
"plugins": [
"babel",
"meteor"
],
"settings": {
"import/resolver": "meteor"
},
"modules": true,
"root": true,
"globals": {

View file

@ -1,6 +1,6 @@
{
"name": "Nova",
"version": "0.0.0",
"version": "0.27.3",
"engines": {
"npm": "^3.0"
},
@ -47,10 +47,15 @@
"devDependencies": {
"autoprefixer": "^6.3.6",
"babel-eslint": "^7.0.0",
"eslint": "^3.8.0",
"eslint": "^3.10.1",
"eslint-config-airbnb": "^13.0.0",
"eslint-config-meteor": "0.0.9",
"eslint-import-resolver-meteor": "^0.3.3",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-meteor": "^4.0.1"
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-meteor": "^4.0.1",
"eslint-plugin-react": "^6.7.1"
},
"postcss": {
"plugins": {

View file

@ -10,11 +10,11 @@ Categories.helpers({getCollectionName: () => "categories"});
* @param {Object} category
*/
Categories.getParents = function (category) {
var categoriesArray = [];
const categoriesArray = [];
var getParents = function recurse (category) {
var parent;
if (parent = Categories.findOne(category.parentId)) {
const getParents = function recurse (category) {
const parent = Categories.findOne(category.parentId);
if (parent) {
categoriesArray.push(parent);
recurse(parent);
}
@ -57,8 +57,8 @@ Posts.helpers({getCategories: function () {return Posts.getCategories(this);}});
* @param {Object} category
*/
Categories.getUrl = function (category, isAbsolute) {
var isAbsolute = typeof isAbsolute === "undefined" ? false : isAbsolute; // default to false
var prefix = isAbsolute ? Telescope.utils.getSiteUrl().slice(0,-1) : "";
isAbsolute = typeof isAbsolute === "undefined" ? false : isAbsolute; // default to false
const prefix = isAbsolute ? Telescope.utils.getSiteUrl().slice(0,-1) : "";
// return prefix + FlowRouter.path("postsCategory", category);
return `${prefix}/?cat=${category.slug}`;
};

View file

@ -10,7 +10,7 @@ import Telescope from 'meteor/nova:lib';
Telescope.utils.getIcon = function (iconName, iconClass) {
var icons = Telescope.utils.icons;
var iconCode = !!icons[iconName] ? icons[iconName] : iconName;
var iconClass = (typeof iconClass === 'string') ? ' '+iconClass : '';
iconClass = (typeof iconClass === 'string') ? ' '+iconClass : '';
return '<i class="icon fa fa-fw fa-' + iconCode + ' icon-' + iconName + iconClass+ '" aria-hidden="true"></i>';
};
@ -40,7 +40,6 @@ Telescope.utils.icons = {
time: "clock-o",
best: "star",
search: "search",
edit: "pencil",
approve: "check-circle-o",
reject: "times-circle-o",
views: "eye",

View file

@ -72,7 +72,7 @@ NovaEmail.send = function(to, subject, html, text){
if (typeof text === 'undefined'){
// Auto-generate text version if it doesn't exist. Has bugs, but should be good enough.
var text = htmlToText.fromString(html, {
text = htmlToText.fromString(html, {
wordwrap: 130
});
}

View file

@ -46,7 +46,6 @@ getEmbedlyData = function (url) {
// the first 13 characters of the Embedly errors are "failed [400] ", so remove them and parse the rest
var errorObject = JSON.parse(error.message.substring(13));
throw new Meteor.Error(errorObject.error_code, errorObject.error_message);
return null;
}
}

View file

@ -13,7 +13,8 @@ Events.analyticsRequest = function() {
Events.analyticsInit = function() {
// Google Analytics
if (googleAnalyticsId = Telescope.settings.get("googleAnalyticsId")){
const googleAnalyticsId = Telescope.settings.get("googleAnalyticsId");
if (googleAnalyticsId) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

View file

@ -1,8 +1,11 @@
// add support for nested properties
const deepValue = function(obj, path){
for (var i=0, path=path.split('.'), len=path.length; i<len; i++){
const pathArray = path.split('.');
for (var i=0; i < pathArray.length; i++) {
obj = obj[path[i]];
};
}
return obj;
};

View file

@ -27,7 +27,7 @@ _.mixin({
// Get deep value
} else {
while ((obj = obj[keys[i++]]) !== null && i < n) {};
//while ((obj = obj[keys[i++]]) !== null && i < n) {};
value = i < n ? void 0 : obj;
}

View file

@ -47,7 +47,6 @@ Telescope.utils.deepExtend = function () {
return false;
}
var key;
for (key in obj) {}
return key === undefined || hasOwn.call(obj, key);
}
};

View file

@ -6,7 +6,7 @@ function addSearchQueryParameter (parameters, terms) {
const query = escapeStringRegexp(terms.query);
var parameters = Telescope.utils.deepExtend(true, parameters, {
parameters = Telescope.utils.deepExtend(true, parameters, {
selector: {
$or: [
{title: {$regex: query, $options: 'i'}},

View file

@ -3,6 +3,6 @@ import Telescope from 'meteor/nova:lib';
function telescopeCreateUserCallback (options, user) {
user = Telescope.callbacks.run("users.new.sync", user, options);
return user;
};
}
Accounts.onCreateUser(telescopeCreateUserCallback);