diff --git a/.eslintrc.json b/.eslintrc.json
index a838276139..d02a0310a7 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -8,5 +8,9 @@
],
"extends": [
"plugin:ghost/node"
- ]
+ ],
+ "rules": {
+ "no-var": "error",
+ "one-var": [2, "never"]
+ }
}
diff --git a/Gruntfile.js b/Gruntfile.js
index 8d63495395..9319668049 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -48,7 +48,7 @@ const configureGrunt = function (grunt) {
grunt.loadNpmTasks('grunt-subgrunt');
grunt.loadNpmTasks('grunt-update-submodules');
- var cfg = {
+ const cfg = {
// #### Common paths used by tasks
paths: {
build: buildDirectory,
@@ -163,7 +163,7 @@ const configureGrunt = function (grunt) {
bg: grunt.option('client') ? false : true,
stdout: function (chunk) {
// hide certain output to prevent confusion when running alongside server
- var filter = grunt.option('client') ? false : [
+ const filter = grunt.option('client') ? false : [
/> ghost-admin/,
/^Livereload/,
/^Serving on/
@@ -208,7 +208,7 @@ const configureGrunt = function (grunt) {
},
master: {
command: function () {
- var upstream = grunt.option('upstream') || process.env.GHOST_UPSTREAM || 'upstream';
+ const upstream = grunt.option('upstream') || process.env.GHOST_UPSTREAM || 'upstream';
grunt.log.writeln('Pulling down the latest master from ' + upstream);
return `
git submodule sync
@@ -425,7 +425,7 @@ const configureGrunt = function (grunt) {
// so that the test environments do not need to build out the client files
grunt.registerTask('stubClientFiles', function () {
_.each(cfg.clientFiles, function (file) {
- var filePath = path.resolve(cwd + '/core/' + file);
+ const filePath = path.resolve(cwd + '/core/' + file);
fs.ensureFileSync(filePath);
});
});
diff --git a/MigratorConfig.js b/MigratorConfig.js
index 13c4b24502..1a5de8487e 100644
--- a/MigratorConfig.js
+++ b/MigratorConfig.js
@@ -1,5 +1,5 @@
-var config = require('./core/server/config'),
- ghostVersion = require('./core/server/lib/ghost-version');
+const config = require('./core/server/config');
+const ghostVersion = require('./core/server/lib/ghost-version');
/**
* knex-migrator can be used via CLI or within the application
diff --git a/core/frontend/apps/amp/lib/helpers/amp_components.js b/core/frontend/apps/amp/lib/helpers/amp_components.js
index 335c69c138..88fb22e3df 100644
--- a/core/frontend/apps/amp/lib/helpers/amp_components.js
+++ b/core/frontend/apps/amp/lib/helpers/amp_components.js
@@ -8,12 +8,13 @@
// By default supported AMP HTML tags (no additional script tag necessary):
// amp-img, amp-ad, amp-embed, amp-video and amp-pixel.
// (less) dirty requires
-const proxy = require('../../../../services/proxy'),
- SafeString = proxy.SafeString;
+const proxy = require('../../../../services/proxy');
+
+const SafeString = proxy.SafeString;
function ampComponents() {
- let components = [],
- html = this.post && this.post.html || this.html;
+ let components = [];
+ let html = this.post && this.post.html || this.html;
if (!html) {
return;
@@ -23,8 +24,8 @@ function ampComponents() {
components.push('');
}
- let iframeCount = (html.match(/(