Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer const over let #38

Merged
merged 1 commit into from
Nov 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/render/engineScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function (inputs, callback, done) {

let isFromCache = true

let engine = (template) => {
const engine = (template) => {
const key = template + ':' + inputs.engine

if (!compiledCache.get(key)) {
Expand All @@ -56,9 +56,6 @@ module.exports = function (inputs, callback, done) {
inputs.parentModuleDirectory
]

let consoleFromSandbox
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this was done in order to not trigger no-use-before-define, but it's actually accessed a bit up which makes that point moot... I'm open to other suggestions for this ☺️

let consoleMessages = []

function respondWrap (rawErr, content) {
let err

Expand Down Expand Up @@ -146,8 +143,8 @@ module.exports = function (inputs, callback, done) {
}
)

consoleMessages = messages
consoleFromSandbox = consoleSandbox
const consoleMessages = messages
const consoleFromSandbox = consoleSandbox

let templateHelpers = inputs.template.helpers
let originalTemplateHelpersStr
Expand All @@ -166,7 +163,7 @@ module.exports = function (inputs, callback, done) {

templateHelpers = {}

for (let fn in sandboxContext) {
for (const fn in sandboxContext) {
if (typeof sandboxContext[fn] === 'function') {
templateHelpers[fn] = sandboxContext[fn]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/render/safeSandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = (_sandbox, options = {}) => {
return result
}

for (let name in sandbox) {
for (const name in sandbox) {
vm._internal.Contextify.globalValue(sandbox[name], name)
}

Expand Down
4 changes: 2 additions & 2 deletions lib/store/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module.exports = (entitySet, provider, model) => ({
return docs.map((doc) => {
const newDoc = Object.assign({}, doc)

for (let prop in newDoc) {
for (const prop in newDoc) {
if (!prop) {
continue
}
Expand All @@ -170,7 +170,7 @@ module.exports = (entitySet, provider, model) => ({
return docs.map((doc) => {
const newDoc = Object.assign({}, doc)

for (let prop in newDoc) {
for (const prop in newDoc) {
if (!prop) {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion lib/store/documentStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function typeDefToJSONSchema (model, def) {
const propDef = def[key]
const collectionTypeRegExp = /^Collection\((\S+)\)$/
let type = propDef.type
let extraSchema = propDef.schema
const extraSchema = propDef.schema
let isCollection = false

if (propDef == null || type == null) {
Expand Down
6 changes: 3 additions & 3 deletions test/render/engineTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const safeSandboxPath = path.join(__dirname, '../../lib/render/safeSandbox')

describe('engine', () => {
describe('engine with dedicated-process strategy', () => {
let scriptManager = ScriptManager({ strategy: 'dedicated-process' })
const scriptManager = ScriptManager({ strategy: 'dedicated-process' })

beforeEach((done) => {
scriptManager.ensureStarted(done)
Expand All @@ -17,7 +17,7 @@ describe('engine', () => {
})

describe('engine with http-server strategy', () => {
let scriptManager = ScriptManager({ strategy: 'http-server' })
const scriptManager = ScriptManager({ strategy: 'http-server' })

beforeEach((done) => {
scriptManager.ensureStarted(done)
Expand All @@ -29,7 +29,7 @@ describe('engine', () => {
})

describe('engine with in-process strategy', function () {
let scriptManager = ScriptManager({ strategy: 'in-process' })
const scriptManager = ScriptManager({ strategy: 'in-process' })

beforeEach((done) => {
scriptManager.ensureStarted(done)
Expand Down
2 changes: 1 addition & 1 deletion test/reporterTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('reporter', () => {
}
})
stdMocks.restore()
let stdoutContent = stdMocks.flush()
const stdoutContent = stdMocks.flush()
stdoutContent.stdout.length.should.be.eql(0)

const allTransportsAreSilent = Object.keys(reporter.logger.transports).every(function (transportName) {
Expand Down