tools: ignore URLs in line length linting

Where inclusion of a lengthy URL causes a line to exceed 80 characters
in our code base, do not report the line length as a linting error.

PR-URL: https://github.com/nodejs/node/pull/11890
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Rich Trott 2017-03-16 22:47:05 -07:00
parent 74c1e02642
commit cce520a5de
5 changed files with 4 additions and 11 deletions

View File

@ -97,7 +97,7 @@ rules:
key-spacing: [2, {mode: minimum}] key-spacing: [2, {mode: minimum}]
keyword-spacing: 2 keyword-spacing: 2
linebreak-style: [2, unix] linebreak-style: [2, unix]
max-len: [2, 80, 2] max-len: [2, {code: 80, ignoreUrls: true, tabWidth: 2}]
new-parens: 2 new-parens: 2
no-mixed-spaces-and-tabs: 2 no-mixed-spaces-and-tabs: 2
no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}] no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}]

View File

@ -144,10 +144,9 @@ function _addHeaderLines(headers, n) {
// TODO: perhaps http_parser could be returning both raw and lowercased versions // TODO: perhaps http_parser could be returning both raw and lowercased versions
// of known header names to avoid us having to call toLowerCase() for those // of known header names to avoid us having to call toLowerCase() for those
// headers. // headers.
/* eslint-disable max-len */
// 'array' header list is taken from: // 'array' header list is taken from:
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp // https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
/* eslint-enable max-len */
function matchKnownFields(field) { function matchKnownFields(field) {
var low = false; var low = false;
while (true) { while (true) {

View File

@ -263,11 +263,9 @@ function Server(requestListener) {
this.on('request', requestListener); this.on('request', requestListener);
} }
/* eslint-disable max-len */
// Similar option to this. Too lazy to write my own docs. // Similar option to this. Too lazy to write my own docs.
// http://www.squid-cache.org/Doc/config/half_closed_clients/ // http://www.squid-cache.org/Doc/config/half_closed_clients/
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F // http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
/* eslint-enable max-len */
this.httpAllowHalfOpen = false; this.httpAllowHalfOpen = false;
this.on('connection', connectionListener); this.on('connection', connectionListener);

View File

@ -70,7 +70,6 @@ if (process.argv[2] === 'you-are-the-child') {
delete process.env.NON_EXISTING_VARIABLE; delete process.env.NON_EXISTING_VARIABLE;
assert.strictEqual(true, delete process.env.NON_EXISTING_VARIABLE); assert.strictEqual(true, delete process.env.NON_EXISTING_VARIABLE);
/* eslint-disable max-len */
/* For the moment we are not going to support setting the timezone via the /* For the moment we are not going to support setting the timezone via the
* environment variables. The problem is that various V8 platform backends * environment variables. The problem is that various V8 platform backends
* deal with timezone in different ways. The windows platform backend caches * deal with timezone in different ways. The windows platform backend caches
@ -87,7 +86,6 @@ date = new Date('Fri, 10 Sep 1982 03:15:00 GMT');
assert.strictEqual(3, date.getUTCHours()); assert.strictEqual(3, date.getUTCHours());
assert.strictEqual(5, date.getHours()); assert.strictEqual(5, date.getHours());
*/ */
/* eslint-enable max-len */
// Environment variables should be case-insensitive on Windows, and // Environment variables should be case-insensitive on Windows, and
// case-sensitive on other platforms. // case-sensitive on other platforms.

View File

@ -1,4 +1,3 @@
/* eslint-disable max-len */
'use strict'; 'use strict';
require('../common'); require('../common');
const assert = require('assert'); const assert = require('assert');
@ -272,8 +271,7 @@ const parseTests = {
}, },
'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=': { 'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=': {
href: 'http://user:pass@mt0.google.com/vt/lyrs=m@114???' + href: 'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=',
'&hl=en&src=api&x=2&y=2&z=3&s=',
protocol: 'http:', protocol: 'http:',
slashes: true, slashes: true,
host: 'mt0.google.com', host: 'mt0.google.com',
@ -842,7 +840,7 @@ const parseTests = {
hostname: 'a.b', hostname: 'a.b',
hash: null, hash: null,
pathname: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E', pathname: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E',
path: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', path: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', // eslint-disable-line max-len
search: '?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', search: '?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz',
query: 'mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', query: 'mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz',
href: 'http://a.b/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz' href: 'http://a.b/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz'