From 0b1b49cb8aa8da28f84c94f5eec82f19f1a764c7 Mon Sep 17 00:00:00 2001 From: Tejas Manohar Date: Sun, 11 Oct 2015 17:59:51 -0500 Subject: [PATCH] use strict in all .js files closes #508 --- benchmarks/experimental/async.js | 2 ++ benchmarks/experimental/index.js | 2 ++ benchmarks/middleware.js | 2 ++ lib/application.js | 2 ++ lib/context.js | 2 ++ lib/request.js | 2 ++ lib/response.js | 2 ++ test/application.js | 2 ++ test/context.js | 2 ++ test/context/assert.js | 2 ++ test/context/cookies.js | 2 ++ test/context/inspect.js | 2 ++ test/context/onerror.js | 2 ++ test/context/state.js | 2 ++ test/context/throw.js | 2 ++ test/context/toJSON.js | 2 ++ test/experimental/async.js | 2 ++ test/experimental/index.js | 2 ++ test/request/accepts.js | 2 ++ test/request/acceptsCharsets.js | 2 ++ test/request/acceptsEncodings.js | 2 ++ test/request/acceptsLanguages.js | 2 ++ test/request/charset.js | 2 ++ test/request/fresh.js | 2 ++ test/request/get.js | 2 ++ test/request/header.js | 4 +++- test/request/headers.js | 2 ++ test/request/host.js | 2 ++ test/request/hostname.js | 2 ++ test/request/href.js | 2 ++ test/request/idempotent.js | 2 ++ test/request/inspect.js | 2 ++ test/request/ip.js | 2 ++ test/request/ips.js | 2 ++ test/request/is.js | 2 ++ test/request/length.js | 2 ++ test/request/origin.js | 2 ++ test/request/path.js | 4 +++- test/request/protocol.js | 2 ++ test/request/query.js | 4 +++- test/request/querystring.js | 4 +++- test/request/search.js | 4 +++- test/request/secure.js | 4 +++- test/request/stale.js | 4 +++- test/request/subdomains.js | 2 ++ test/request/type.js | 2 ++ test/response/append.js | 2 ++ test/response/attachment.js | 2 ++ test/response/body.js | 2 ++ test/response/etag.js | 2 ++ test/response/header.js | 2 ++ test/response/headers.js | 2 ++ test/response/inspect.js | 2 ++ test/response/is.js | 2 ++ test/response/last-modified.js | 2 ++ test/response/length.js | 2 ++ test/response/message.js | 2 ++ test/response/redirect.js | 2 ++ test/response/remove.js | 2 ++ test/response/set.js | 2 ++ test/response/socket.js | 2 ++ test/response/status.js | 2 ++ test/response/type.js | 2 ++ test/response/vary.js | 4 +++- test/response/writeable.js | 2 ++ 65 files changed, 138 insertions(+), 8 deletions(-) diff --git a/benchmarks/experimental/async.js b/benchmarks/experimental/async.js index 5dc568c..53394ec 100644 --- a/benchmarks/experimental/async.js +++ b/benchmarks/experimental/async.js @@ -1,4 +1,6 @@ +'use strict'; + var http = require('http'); var koa = require('../..'); var app = koa(); diff --git a/benchmarks/experimental/index.js b/benchmarks/experimental/index.js index 6166d07..5c39caf 100644 --- a/benchmarks/experimental/index.js +++ b/benchmarks/experimental/index.js @@ -1,4 +1,6 @@ +'use strict'; + // support async await by babel require('babel/register')({ optional: ['asyncToGenerator'] diff --git a/benchmarks/middleware.js b/benchmarks/middleware.js index b7a5496..365b2d5 100644 --- a/benchmarks/middleware.js +++ b/benchmarks/middleware.js @@ -1,4 +1,6 @@ +'use strict'; + var http = require('http'); var koa = require('..'); var app = koa(); diff --git a/lib/application.js b/lib/application.js index 461b6e1..ce58899 100644 --- a/lib/application.js +++ b/lib/application.js @@ -1,4 +1,6 @@ +'use strict'; + /** * Module dependencies. */ diff --git a/lib/context.js b/lib/context.js index 6fe17c3..88b0cf2 100644 --- a/lib/context.js +++ b/lib/context.js @@ -1,4 +1,6 @@ +'use strict'; + /** * Module dependencies. */ diff --git a/lib/request.js b/lib/request.js index 12a92e0..93a090f 100644 --- a/lib/request.js +++ b/lib/request.js @@ -1,4 +1,6 @@ +'use strict'; + /** * Module dependencies. */ diff --git a/lib/response.js b/lib/response.js index 6d5fb0e..c2cd7c8 100644 --- a/lib/response.js +++ b/lib/response.js @@ -1,4 +1,6 @@ +'use strict'; + /** * Module dependencies. */ diff --git a/test/application.js b/test/application.js index 5928040..2494e0e 100644 --- a/test/application.js +++ b/test/application.js @@ -1,4 +1,6 @@ +'use strict'; + var stderr = require('test-console').stderr; var request = require('supertest'); var statuses = require('statuses'); diff --git a/test/context.js b/test/context.js index 19b1006..87b4bd8 100644 --- a/test/context.js +++ b/test/context.js @@ -1,4 +1,6 @@ +'use strict'; + var Stream = require('stream'); var koa = require('..'); diff --git a/test/context/assert.js b/test/context/assert.js index 04a7980..e2e918d 100644 --- a/test/context/assert.js +++ b/test/context/assert.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); var assert = require('assert'); diff --git a/test/context/cookies.js b/test/context/cookies.js index 90057c5..9097bf1 100644 --- a/test/context/cookies.js +++ b/test/context/cookies.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('supertest'); var koa = require('../..'); diff --git a/test/context/inspect.js b/test/context/inspect.js index 8af6ca6..ead9377 100644 --- a/test/context/inspect.js +++ b/test/context/inspect.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.inspect()', function(){ diff --git a/test/context/onerror.js b/test/context/onerror.js index 9db2259..076adb2 100644 --- a/test/context/onerror.js +++ b/test/context/onerror.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('supertest'); var koa = require('../..'); diff --git a/test/context/state.js b/test/context/state.js index 78eb02c..9ac1651 100644 --- a/test/context/state.js +++ b/test/context/state.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('supertest'); var assert = require('assert'); var koa = require('../..'); diff --git a/test/context/throw.js b/test/context/throw.js index 8b016a0..5feb049 100644 --- a/test/context/throw.js +++ b/test/context/throw.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); var assert = require('assert'); diff --git a/test/context/toJSON.js b/test/context/toJSON.js index d6e11a0..84218ef 100644 --- a/test/context/toJSON.js +++ b/test/context/toJSON.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.toJSON()', function(){ diff --git a/test/experimental/async.js b/test/experimental/async.js index 82ee0b8..a50305f 100644 --- a/test/experimental/async.js +++ b/test/experimental/async.js @@ -1,4 +1,6 @@ +'use strict'; + /** * Separate file primarily because we use `require('babel/register')`. */ diff --git a/test/experimental/index.js b/test/experimental/index.js index 5bbf087..bfe2862 100644 --- a/test/experimental/index.js +++ b/test/experimental/index.js @@ -1,4 +1,6 @@ +'use strict'; + require('babel/register')({ optional: ['asyncToGenerator'] }); diff --git a/test/request/accepts.js b/test/request/accepts.js index 34f3a91..317d264 100644 --- a/test/request/accepts.js +++ b/test/request/accepts.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.accepts(types)', function(){ diff --git a/test/request/acceptsCharsets.js b/test/request/acceptsCharsets.js index be905bd..35b5198 100644 --- a/test/request/acceptsCharsets.js +++ b/test/request/acceptsCharsets.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.acceptsCharsets()', function(){ diff --git a/test/request/acceptsEncodings.js b/test/request/acceptsEncodings.js index da88373..5f17287 100644 --- a/test/request/acceptsEncodings.js +++ b/test/request/acceptsEncodings.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.acceptsEncodings()', function(){ diff --git a/test/request/acceptsLanguages.js b/test/request/acceptsLanguages.js index 6e8c3b7..5dbf6d0 100644 --- a/test/request/acceptsLanguages.js +++ b/test/request/acceptsLanguages.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.acceptsLanguages(langs)', function(){ diff --git a/test/request/charset.js b/test/request/charset.js index ddbfb75..12eb09b 100644 --- a/test/request/charset.js +++ b/test/request/charset.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; var assert = require('assert'); diff --git a/test/request/fresh.js b/test/request/fresh.js index 34e112d..8d2a89b 100644 --- a/test/request/fresh.js +++ b/test/request/fresh.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.fresh', function(){ diff --git a/test/request/get.js b/test/request/get.js index 263c808..fd3d8ae 100644 --- a/test/request/get.js +++ b/test/request/get.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.get(name)', function(){ diff --git a/test/request/header.js b/test/request/header.js index 4ec024e..7eb23b2 100644 --- a/test/request/header.js +++ b/test/request/header.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('req.header', function(){ @@ -6,4 +8,4 @@ describe('req.header', function(){ var req = request(); req.header.should.equal(req.req.headers); }) -}) \ No newline at end of file +}) diff --git a/test/request/headers.js b/test/request/headers.js index 7a85975..d68c141 100644 --- a/test/request/headers.js +++ b/test/request/headers.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('req.headers', function(){ diff --git a/test/request/host.js b/test/request/host.js index 303cd86..96c4c1b 100644 --- a/test/request/host.js +++ b/test/request/host.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; var assert = require('assert'); diff --git a/test/request/hostname.js b/test/request/hostname.js index 5014666..fb55f71 100644 --- a/test/request/hostname.js +++ b/test/request/hostname.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; var assert = require('assert'); diff --git a/test/request/href.js b/test/request/href.js index f427d80..b927cc7 100644 --- a/test/request/href.js +++ b/test/request/href.js @@ -1,4 +1,6 @@ +'use strict'; + var Stream = require('stream'); var http = require('http'); var koa = require('../../'); diff --git a/test/request/idempotent.js b/test/request/idempotent.js index 773dfa6..264b7c8 100644 --- a/test/request/idempotent.js +++ b/test/request/idempotent.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('ctx.idempotent', function(){ diff --git a/test/request/inspect.js b/test/request/inspect.js index 1c9db75..dca0df8 100644 --- a/test/request/inspect.js +++ b/test/request/inspect.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; var assert = require('assert'); diff --git a/test/request/ip.js b/test/request/ip.js index 409921b..af169cc 100644 --- a/test/request/ip.js +++ b/test/request/ip.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('req.ip', function(){ diff --git a/test/request/ips.js b/test/request/ips.js index 801d9cd..078d8c9 100644 --- a/test/request/ips.js +++ b/test/request/ips.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('req.ips', function(){ diff --git a/test/request/is.js b/test/request/is.js index 7e937d3..30a79eb 100644 --- a/test/request/is.js +++ b/test/request/is.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); var should = require('should'); var assert = require('assert'); diff --git a/test/request/length.js b/test/request/length.js index 5894da1..53928bb 100644 --- a/test/request/length.js +++ b/test/request/length.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; var assert = require('assert'); diff --git a/test/request/origin.js b/test/request/origin.js index 8c1081f..e5a9c52 100644 --- a/test/request/origin.js +++ b/test/request/origin.js @@ -1,4 +1,6 @@ +'use strict'; + var Stream = require('stream'); var http = require('http'); var koa = require('../../'); diff --git a/test/request/path.js b/test/request/path.js index 8f9e6ae..f42dca0 100644 --- a/test/request/path.js +++ b/test/request/path.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.path', function(){ @@ -26,4 +28,4 @@ describe('ctx.path=', function(){ ctx.originalUrl.should.equal('/login'); ctx.request.originalUrl.should.equal('/login'); }) -}) \ No newline at end of file +}) diff --git a/test/request/protocol.js b/test/request/protocol.js index dd24f95..eec4f1c 100644 --- a/test/request/protocol.js +++ b/test/request/protocol.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('req.protocol', function(){ diff --git a/test/request/query.js b/test/request/query.js index 99a74ee..20f4410 100644 --- a/test/request/query.js +++ b/test/request/query.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.query', function(){ @@ -38,4 +40,4 @@ describe('ctx.query=', function(){ ctx.originalUrl.should.equal('/store/shoes'); ctx.request.originalUrl.should.equal('/store/shoes'); }) -}) \ No newline at end of file +}) diff --git a/test/request/querystring.js b/test/request/querystring.js index 8c89b77..e689d84 100644 --- a/test/request/querystring.js +++ b/test/request/querystring.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.querystring', function(){ @@ -42,4 +44,4 @@ describe('ctx.querystring=', function(){ ctx.originalUrl.should.equal('/store/shoes'); ctx.request.originalUrl.should.equal('/store/shoes'); }) -}) \ No newline at end of file +}) diff --git a/test/request/search.js b/test/request/search.js index 6f5b1b2..99a1323 100644 --- a/test/request/search.js +++ b/test/request/search.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.search=', function(){ @@ -34,4 +36,4 @@ describe('ctx.search=', function(){ ctx.search.should.equal(''); }) }) -}) \ No newline at end of file +}) diff --git a/test/request/secure.js b/test/request/secure.js index fceef19..07f7013 100644 --- a/test/request/secure.js +++ b/test/request/secure.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('req.secure', function(){ @@ -7,4 +9,4 @@ describe('req.secure', function(){ req.req.socket = { encrypted: true }; req.secure.should.be.true; }) -}) \ No newline at end of file +}) diff --git a/test/request/stale.js b/test/request/stale.js index 3000d5d..fb4e617 100644 --- a/test/request/stale.js +++ b/test/request/stale.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('req.stale', function(){ @@ -11,4 +13,4 @@ describe('req.stale', function(){ ctx.fresh.should.be.true; ctx.stale.should.be.false; }) -}) \ No newline at end of file +}) diff --git a/test/request/subdomains.js b/test/request/subdomains.js index df2a0a6..8df5be5 100644 --- a/test/request/subdomains.js +++ b/test/request/subdomains.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; describe('req.subdomains', function(){ diff --git a/test/request/type.js b/test/request/type.js index f3b31ef..6de60e3 100644 --- a/test/request/type.js +++ b/test/request/type.js @@ -1,4 +1,6 @@ +'use strict'; + var request = require('../context').request; var assert = require('assert'); diff --git a/test/response/append.js b/test/response/append.js index 83fd2c3..91ad44d 100644 --- a/test/response/append.js +++ b/test/response/append.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.append(name, val)', function(){ diff --git a/test/response/attachment.js b/test/response/attachment.js index abb5612..e4db826 100644 --- a/test/response/attachment.js +++ b/test/response/attachment.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); var request = require('supertest'); var koa = require('../..'); diff --git a/test/response/body.js b/test/response/body.js index edfa01e..b28252c 100644 --- a/test/response/body.js +++ b/test/response/body.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; var assert = require('assert'); var fs = require('fs'); diff --git a/test/response/etag.js b/test/response/etag.js index eb709c4..0a86af1 100644 --- a/test/response/etag.js +++ b/test/response/etag.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; describe('res.etag=', function(){ diff --git a/test/response/header.js b/test/response/header.js index 3bf9f3d..02820dd 100644 --- a/test/response/header.js +++ b/test/response/header.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; describe('res.header', function(){ diff --git a/test/response/headers.js b/test/response/headers.js index 33087c4..d60686e 100644 --- a/test/response/headers.js +++ b/test/response/headers.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; describe('res.header', function(){ diff --git a/test/response/inspect.js b/test/response/inspect.js index abb2282..ee12ee2 100644 --- a/test/response/inspect.js +++ b/test/response/inspect.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; var assert = require('assert'); diff --git a/test/response/is.js b/test/response/is.js index 57d4ab0..c59a06a 100644 --- a/test/response/is.js +++ b/test/response/is.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); var should = require('should'); var assert = require('assert'); diff --git a/test/response/last-modified.js b/test/response/last-modified.js index 0eddad1..69f86e1 100644 --- a/test/response/last-modified.js +++ b/test/response/last-modified.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; describe('res.lastModified', function(){ diff --git a/test/response/length.js b/test/response/length.js index ef23e3f..e9234e1 100644 --- a/test/response/length.js +++ b/test/response/length.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; var should = require('should'); var assert = require('assert'); diff --git a/test/response/message.js b/test/response/message.js index 24472b2..4b9f9a3 100644 --- a/test/response/message.js +++ b/test/response/message.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; var Stream = require('stream'); diff --git a/test/response/redirect.js b/test/response/redirect.js index ca3d72b..41bc3e2 100644 --- a/test/response/redirect.js +++ b/test/response/redirect.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.redirect(url)', function(){ diff --git a/test/response/remove.js b/test/response/remove.js index ab5ca7f..b74c46d 100644 --- a/test/response/remove.js +++ b/test/response/remove.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.remove(name)', function(){ diff --git a/test/response/set.js b/test/response/set.js index 6eb846f..45a304a 100644 --- a/test/response/set.js +++ b/test/response/set.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.set(name, val)', function(){ diff --git a/test/response/socket.js b/test/response/socket.js index 5217a35..6bb24d7 100644 --- a/test/response/socket.js +++ b/test/response/socket.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; var Stream = require('stream'); diff --git a/test/response/status.js b/test/response/status.js index aa5972a..744a6d9 100644 --- a/test/response/status.js +++ b/test/response/status.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; var request = require('supertest'); var statuses = require('statuses'); diff --git a/test/response/type.js b/test/response/type.js index 2aba95c..a02e248 100644 --- a/test/response/type.js +++ b/test/response/type.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); var assert = require('assert'); diff --git a/test/response/vary.js b/test/response/vary.js index ef0b76c..2dcb314 100644 --- a/test/response/vary.js +++ b/test/response/vary.js @@ -1,4 +1,6 @@ +'use strict'; + var context = require('../context'); describe('ctx.vary(field)', function(){ @@ -29,4 +31,4 @@ describe('ctx.vary(field)', function(){ ctx.response.header.vary.should.equal('Accept, Accept-Encoding'); }) }) -}) \ No newline at end of file +}) diff --git a/test/response/writeable.js b/test/response/writeable.js index 0f58b32..ee4323b 100644 --- a/test/response/writeable.js +++ b/test/response/writeable.js @@ -1,4 +1,6 @@ +'use strict'; + var response = require('../context').response; describe('res.writable', function(){