From 4ae1c01eecb406a16218a21915c7735a2d40960f Mon Sep 17 00:00:00 2001 From: xavcz Date: Tue, 15 Nov 2016 09:02:30 +0100 Subject: [PATCH] complete eslint devDeps and fix lint errors --- .eslintrc | 12 +++++++++--- package.json | 11 ++++++++--- packages/nova-categories/lib/helpers.js | 12 ++++++------ packages/nova-core/lib/icons.js | 3 +-- packages/nova-email/lib/server/email.js | 2 +- packages/nova-embedly/lib/server/get_embedly_data.js | 1 - packages/nova-events/lib/client/analytics.js | 3 ++- packages/nova-forms/lib/utils.js | 7 +++++-- packages/nova-lib/lib/deep.js | 2 +- packages/nova-lib/lib/deep_extend.js | 1 - packages/nova-search/lib/parameters.js | 2 +- packages/nova-users/lib/server/create_user.js | 2 +- 12 files changed, 35 insertions(+), 23 deletions(-) diff --git a/.eslintrc b/.eslintrc index 34f1a0820..beb34f54e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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": { diff --git a/package.json b/package.json index 216306d39..8a85f322e 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/packages/nova-categories/lib/helpers.js b/packages/nova-categories/lib/helpers.js index b39d01753..0d4be6dcc 100644 --- a/packages/nova-categories/lib/helpers.js +++ b/packages/nova-categories/lib/helpers.js @@ -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}`; }; diff --git a/packages/nova-core/lib/icons.js b/packages/nova-core/lib/icons.js index 263bad790..af2bfb423 100644 --- a/packages/nova-core/lib/icons.js +++ b/packages/nova-core/lib/icons.js @@ -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 ''; }; @@ -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", diff --git a/packages/nova-email/lib/server/email.js b/packages/nova-email/lib/server/email.js index ad01b2a8e..6fc619e86 100644 --- a/packages/nova-email/lib/server/email.js +++ b/packages/nova-email/lib/server/email.js @@ -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 }); } diff --git a/packages/nova-embedly/lib/server/get_embedly_data.js b/packages/nova-embedly/lib/server/get_embedly_data.js index ac2861d5b..bcd98f08b 100644 --- a/packages/nova-embedly/lib/server/get_embedly_data.js +++ b/packages/nova-embedly/lib/server/get_embedly_data.js @@ -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; } } diff --git a/packages/nova-events/lib/client/analytics.js b/packages/nova-events/lib/client/analytics.js index 43b87703e..895f31158 100644 --- a/packages/nova-events/lib/client/analytics.js +++ b/packages/nova-events/lib/client/analytics.js @@ -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), diff --git a/packages/nova-forms/lib/utils.js b/packages/nova-forms/lib/utils.js index 10fcd0c38..62faa081d 100644 --- a/packages/nova-forms/lib/utils.js +++ b/packages/nova-forms/lib/utils.js @@ -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