Skip to content

Commit aebd123

Browse files
committed
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.
1 parent f0d4237 commit aebd123

File tree

5 files changed

+4
-11
lines changed

5 files changed

+4
-11
lines changed

.eslintrc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ rules:
9797
key-spacing: [2, {mode: minimum}]
9898
keyword-spacing: 2
9999
linebreak-style: [2, unix]
100-
max-len: [2, 80, 2]
100+
max-len: [2, {code: 80, ignoreUrls: true, tabWidth: 2}]
101101
new-parens: 2
102102
no-mixed-spaces-and-tabs: 2
103103
no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}]

lib/_http_incoming.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,9 @@ function _addHeaderLines(headers, n) {
150150
// TODO: perhaps http_parser could be returning both raw and lowercased versions
151151
// of known header names to avoid us having to call toLowerCase() for those
152152
// headers.
153-
/* eslint-disable max-len */
153+
154154
// 'array' header list is taken from:
155155
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
156-
/* eslint-enable max-len */
157156
function matchKnownFields(field) {
158157
var low = false;
159158
while (true) {

lib/_http_server.js

-2
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,9 @@ function Server(requestListener) {
265265
this.on('request', requestListener);
266266
}
267267

268-
/* eslint-disable max-len */
269268
// Similar option to this. Too lazy to write my own docs.
270269
// http://www.squid-cache.org/Doc/config/half_closed_clients/
271270
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
272-
/* eslint-enable max-len */
273271
this.httpAllowHalfOpen = false;
274272

275273
this.on('connection', connectionListener);

test/parallel/test-process-env.js

-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ if (process.argv[2] === 'you-are-the-child') {
7070
delete process.env.NON_EXISTING_VARIABLE;
7171
assert.strictEqual(true, delete process.env.NON_EXISTING_VARIABLE);
7272

73-
/* eslint-disable max-len */
7473
/* For the moment we are not going to support setting the timezone via the
7574
* environment variables. The problem is that various V8 platform backends
7675
* 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');
8786
assert.strictEqual(3, date.getUTCHours());
8887
assert.strictEqual(5, date.getHours());
8988
*/
90-
/* eslint-enable max-len */
9189

9290
// Environment variables should be case-insensitive on Windows, and
9391
// case-sensitive on other platforms.

test/parallel/test-url-parse-format.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable max-len */
21
'use strict';
32
require('../common');
43
const assert = require('assert');
@@ -272,8 +271,7 @@ const parseTests = {
272271
},
273272

274273
'http://user:[email protected]/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=': {
275-
href: 'http://user:[email protected]/vt/lyrs=m@114???' +
276-
'&hl=en&src=api&x=2&y=2&z=3&s=',
274+
href: 'http://user:[email protected]/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=',
277275
protocol: 'http:',
278276
slashes: true,
279277
host: 'mt0.google.com',
@@ -842,7 +840,7 @@ const parseTests = {
842840
hostname: 'a.b',
843841
hash: null,
844842
pathname: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E',
845-
path: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz',
843+
path: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', // eslint-disable-line max-len
846844
search: '?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz',
847845
query: 'mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz',
848846
href: 'http://a.b/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz'

0 commit comments

Comments
 (0)