Skip to content

Commit cce520a

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. PR-URL: #11890 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 74c1e02 commit cce520a

File tree

5 files changed

+4
-11
lines changed

5 files changed

+4
-11
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,9 @@ function _addHeaderLines(headers, n) {
144144
// TODO: perhaps http_parser could be returning both raw and lowercased versions
145145
// of known header names to avoid us having to call toLowerCase() for those
146146
// headers.
147-
/* eslint-disable max-len */
147+
148148
// 'array' header list is taken from:
149149
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
150-
/* eslint-enable max-len */
151150
function matchKnownFields(field) {
152151
var low = false;
153152
while (true) {

lib/_http_server.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,9 @@ function Server(requestListener) {
263263
this.on('request', requestListener);
264264
}
265265

266-
/* eslint-disable max-len */
267266
// Similar option to this. Too lazy to write my own docs.
268267
// http://www.squid-cache.org/Doc/config/half_closed_clients/
269268
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
270-
/* eslint-enable max-len */
271269
this.httpAllowHalfOpen = false;
272270

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

test/parallel/test-process-env.js

Lines changed: 0 additions & 2 deletions
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

Lines changed: 2 additions & 4 deletions
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)