From c134e06229d97e04c40e4c8c496714c03c8ee4d3 Mon Sep 17 00:00:00 2001 From: David Majda Date: Thu, 22 Sep 2016 16:23:24 +0200 Subject: [PATCH] Move "use strict" directives up Move "use strict" directives to the first line of each file. In particular, move them above any ESLint comments, which are far less important. There are few exceptions: Executable files In these, the "use strict" directive must give way to the shebang. lib/parser.js Here, the "Generated by..." comment comes first. Also, ESLint comments are prepended in post-processing. --- benchmark/index.js | 6 ++---- benchmark/run | 4 ++-- benchmark/runner.js | 4 ++-- benchmark/server | 4 ++-- spec/api/generated-parser-api.spec.js | 4 ++-- spec/behavior/generated-parser-behavior.spec.js | 4 ++-- spec/server | 4 ++-- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/benchmark/index.js b/benchmark/index.js index 137fb5a..8ce98a5 100644 --- a/benchmark/index.js +++ b/benchmark/index.js @@ -1,11 +1,11 @@ +"use strict"; + /* eslint-env browser, jquery */ let benchmarks = require("./benchmarks.js"); let Runner = require("./runner.js"); $("#run").click(() => { - "use strict"; - // Results Table Manipulation let resultsTable = $("#results-table"); @@ -134,7 +134,5 @@ $("#run").click(() => { }); $(document).ready(() => { - "use strict"; - $("#run").focus(); }); diff --git a/benchmark/run b/benchmark/run index 90ebc6f..7f3a2e6 100755 --- a/benchmark/run +++ b/benchmark/run @@ -1,10 +1,10 @@ #!/usr/bin/env node +"use strict"; + /* eslint-env node */ /* eslint no-console: 0*/ -"use strict"; - let fs = require("fs"); let benchmarks = require("./benchmarks.js"); diff --git a/benchmark/runner.js b/benchmark/runner.js index 3ca9948..af4a8de 100644 --- a/benchmark/runner.js +++ b/benchmark/runner.js @@ -1,7 +1,7 @@ -/* global setTimeout */ - "use strict"; +/* global setTimeout */ + let peg = require("../lib/peg"); let Runner = { diff --git a/benchmark/server b/benchmark/server index b5bbf0b..236801d 100755 --- a/benchmark/server +++ b/benchmark/server @@ -1,10 +1,10 @@ #!/usr/bin/env node +"use strict"; + /* eslint-env node */ /* eslint no-console: 0 */ -"use strict"; - // Small server whose main purpose is to ensure that both the benchmarked code // and the benchmark get passed through Babel & Browserify before they are // served to the browser. diff --git a/spec/api/generated-parser-api.spec.js b/spec/api/generated-parser-api.spec.js index 8d96917..7d0f5d4 100644 --- a/spec/api/generated-parser-api.spec.js +++ b/spec/api/generated-parser-api.spec.js @@ -1,8 +1,8 @@ +"use strict"; + /* eslint no-console: 0 */ /* global console */ -"use strict"; - let peg = require("../../lib/peg"); describe("generated parser API", function() { diff --git a/spec/behavior/generated-parser-behavior.spec.js b/spec/behavior/generated-parser-behavior.spec.js index 8da9b64..6e86c42 100644 --- a/spec/behavior/generated-parser-behavior.spec.js +++ b/spec/behavior/generated-parser-behavior.spec.js @@ -1,8 +1,8 @@ +"use strict"; + /* eslint no-console: 0 */ /* global console */ -"use strict"; - let peg = require("../../lib/peg"); describe("generated parser behavior", function() { diff --git a/spec/server b/spec/server index ab3469d..619d4d8 100755 --- a/spec/server +++ b/spec/server @@ -1,10 +1,10 @@ #!/usr/bin/env node +"use strict"; + /* eslint-env node */ /* eslint no-console: 0 */ -"use strict"; - // Small server whose main purpose is to ensure that both the specced code and // the specs get passed through Babel & Browserify before they are served to the // browser.