From 25920d5b80d245ab2484b90fb732dd1d3a9b8031 Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Fri, 26 Sep 2014 01:24:35 +0200 Subject: [PATCH] Enable `block-scoped-var` in ESLint Closes #48. --- .eslintrc | 1 + src/bootlint.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.eslintrc b/.eslintrc index 4ce1a48..745cec6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,6 @@ { "rules": { + "block-scoped-var": 2, "brace-style": [2, "stroustrup"], "camelcase": 2, "consistent-this": [2, "self"], diff --git a/src/bootlint.js b/src/bootlint.js index 4810ff8..e2feced 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -168,9 +168,9 @@ var cheerio = require('cheerio'); } else { return function () { - /*eslint-disable no-undef */ + /*eslint-disable no-undef, block-scoped-var */ var doc = window.document; - /*eslint-enable un-undef */ + /*eslint-enable un-undef, block-scoped-var */ if (doc.doctype === null) { return MISSING_DOCTYPE; } @@ -261,9 +261,9 @@ var cheerio = require('cheerio'); exports.lintJquery = function ($) { var theWindow = null; try { - /*eslint-disable no-undef */ + /*eslint-disable no-undef, block-scoped-var */ theWindow = window; - /*eslint-enable no-undef */ + /*eslint-enable no-undef, block-scoped-var */ } catch (e) { // deliberately do nothing @@ -634,17 +634,17 @@ var cheerio = require('cheerio'); exports.showLintReportForCurrentDocument = function () { var errs = this.lintCurrentDocument(); if (errs.length) { - /*eslint-disable no-alert, no-undef */ + /*eslint-disable no-alert, no-undef, block-scoped-var */ window.alert("bootlint found errors in this document! See the JavaScript console for details."); - /*eslint-enable no-alert, no-undef */ + /*eslint-enable no-alert, no-undef, block-scoped-var */ errs.forEach(function (err) { console.warn("bootlint:", err); }); } }; - /*eslint-disable no-undef */ + /*eslint-disable no-undef, block-scoped-var */ window.bootlint = exports; - /*eslint-enable no-undef */ + /*eslint-enable no-undef, block-scoped-var */ $(function () { exports.showLintReportForCurrentDocument(); });