Skip to content

Commit

Permalink
Fix trailing comma in functions linting rule for node < 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhbrook committed Jun 17, 2017
1 parent c64ff06 commit 4012228
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 30 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
}
},
"rules": {
"strict": [2, "global"]
"strict": [ 2, "global" ],
"comma-dangle": [ 2, {
"arrays": "only-multiline",
"objects": "only-multiline",
"functions": "never"
}]
}
}
10 changes: 5 additions & 5 deletions lib/ecstatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ module.exports = function createMiddleware(_dir, _options) {
file = path.normalize(
path.join(
root,
path.relative(path.join('/', baseDir), pathname),
),
path.relative(path.join('/', baseDir), pathname)
)
);
gzipped = `${file}.gz`;

Expand Down Expand Up @@ -260,7 +260,7 @@ module.exports = function createMiddleware(_dir, _options) {
const start = parseInt(partialstart, 10);
const end = Math.min(
total - 1,
partialend ? parseInt(partialend, 10) : total - 1,
partialend ? parseInt(partialend, 10) : total - 1
);
const chunksize = (end - start) + 1;
let fstream = null;
Expand Down Expand Up @@ -372,7 +372,7 @@ module.exports = function createMiddleware(_dir, _options) {
middleware({
url: urlJoin(
encodeURIComponent(pathname),
`/index.${defaultExt}`,
`/index.${defaultExt}`
),
headers: req.headers,
}, res, (autoIndexError) => {
Expand Down Expand Up @@ -439,7 +439,7 @@ if (!module.parent) {
alias: aliases,
default: defaults,
boolean: Object.keys(defaults).filter(
key => typeof defaults[key] === 'boolean',
key => typeof defaults[key] === 'boolean'
),
});
const envPORT = parseInt(process.env.PORT, 10);
Expand Down
9 changes: 5 additions & 4 deletions lib/ecstatic/show-dir/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ module.exports = (opts) => {
const parsed = url.parse(req.url);
const pathname = decodeURIComponent(parsed.pathname);
const dir = path.normalize(
path.join(root,
path.join(
root,
path.relative(
path.join('/', baseDir),
pathname,
),
),
pathname
)
)
);

fs.stat(dir, (statErr, stat) => {
Expand Down
8 changes: 4 additions & 4 deletions test/304.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('304_not_modified_strong', (t) => {
showDir: true,
weakEtags: false,
weakCompare: false,
}),
})
);

server.listen(port, () => {
Expand Down Expand Up @@ -68,7 +68,7 @@ test('304_not_modified_weak', (t) => {
autoIndex: true,
showDir: true,
weakCompare: false,
}),
})
);

server.listen(port, () => {
Expand Down Expand Up @@ -114,7 +114,7 @@ test('304_not_modified_strong_compare', (t) => {
showDir: true,
weakEtags: false,
weakCompare: false,
}),
})
);

server.listen(port, () => {
Expand Down Expand Up @@ -181,7 +181,7 @@ test('304_not_modified_weak_compare', (t) => {
autoIndex: true,
showDir: true,
weakEtags: false,
}),
})
);

server.listen(port, () => {
Expand Down
4 changes: 2 additions & 2 deletions test/core-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('core', (t) => {
autoIndex: true,
showDir: true,
handleError: false,
}),
})
);

server.listen(port, () => {
Expand All @@ -49,7 +49,7 @@ test('core', (t) => {
if (r.type !== undefined) {
t.equal(
res.headers['content-type'].split(';')[0], r.type,
`content-type for \`${file}\``,
`content-type for \`${file}\``
);
}

Expand Down
4 changes: 2 additions & 2 deletions test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('core', (t) => {
showDir: true,
defaultExt: 'html',
handleError: true,
}),
})
);

server.listen(port, () => {
Expand All @@ -51,7 +51,7 @@ test('core', (t) => {
if (r.type !== undefined) {
t.equal(
res.headers['content-type'].split(';')[0], r.type,
`content-type for \`${file}\``,
`content-type for \`${file}\``
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/custom-content-type-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('throws when custom contentType .types file does not exist', (t) => {
setup.bind(null, {
root: `${__dirname}/public/`,
mimeTypes: 'this_file_does_not_exist.types',
}),
})
);
});

Expand Down
2 changes: 1 addition & 1 deletion test/express-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test('express', (t) => {
if (r.type !== undefined) {
t.equal(
res.headers['content-type'].split(';')[0], r.type,
`content-type for \`${file}\``,
`content-type for \`${file}\``
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test('express', (t) => {
if (r.type !== undefined) {
t.equal(
res.headers['content-type'].split(';')[0], r.type,
`content-type for \`${file}\``,
`content-type for \`${file}\``
);
}

Expand Down
8 changes: 4 additions & 4 deletions test/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('headers object', (t) => {
},
autoIndex: true,
defaultExt: 'html',
}),
})
);

server.listen(() => {
Expand Down Expand Up @@ -47,7 +47,7 @@ test('header string', (t) => {
header: 'beep: boop', // for command-line --header 'beep: boop'
autoIndex: true,
defaultExt: 'html',
}),
})
);

server.listen(() => {
Expand Down Expand Up @@ -77,7 +77,7 @@ test('header array', (t) => {
],
autoIndex: true,
defaultExt: 'html',
}),
})
);

server.listen(() => {
Expand Down Expand Up @@ -106,7 +106,7 @@ test('H array', (t) => {
],
autoIndex: true,
defaultExt: 'html',
}),
})
);

server.listen(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/showdir-href-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('url encoding in href', (t) => {
baseDir,
showDir: true,
autoIndex: false,
}),
})
);

server.listen(port, () => {
Expand Down
2 changes: 1 addition & 1 deletion test/showdir-pathname-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test('directory listing with pathname including HTML characters', (t) => {
baseDir,
showDir: true,
autoIndex: false,
}),
})
);

server.listen(port, () => {
Expand Down
2 changes: 1 addition & 1 deletion test/showdir-search-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('directory listing with query string specified', (t) => {
baseDir,
showDir: true,
autoIndex: false,
}),
})
);

server.listen(port, () => {
Expand Down
2 changes: 1 addition & 1 deletion test/showdir-with-spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('directory listing when directory name contains spaces', (t) => {
baseDir,
showDir: true,
autoIndex: false,
}),
})
);

server.listen(port, () => {
Expand Down
2 changes: 1 addition & 1 deletion test/trailing-slash.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('should not add trailing slash when showDir and autoIndex are off', (t) =>
root: `${__dirname}/public`,
autoIndex: false,
showDir: false,
}),
})
);
t.on('end', () => { server.close(); });
server.listen(0, () => {
Expand Down

0 comments on commit 4012228

Please sign in to comment.