From 8098350666ea769e33d78756b7bc8b19d5ed777a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 4 Apr 2021 15:35:19 -0700 Subject: [PATCH] tools: remove max-len ESLint rule The max-len rule often hampers readability rather than enhancing it. Few developers are inconvenienced by lines longer than 80 characters. Let's remove it. --- .eslintrc.js | 10 ---------- test/parallel/test-http2-binding.js | 2 +- test/parallel/test-policy-integrity-flag.js | 2 -- test/parallel/test-readline-keys.js | 3 --- test/parallel/test-url-parse-format.js | 2 +- test/parallel/test-util-inspect.js | 4 +--- tools/doc/html.js | 1 - tools/doc/json.js | 2 -- 8 files changed, 3 insertions(+), 23 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9579162dcf868c..204780857327f8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -95,7 +95,6 @@ module.exports = { line: { // Ignore all lines that have less characters than 20 and all lines that // start with something that looks like a variable name or code. - // eslint-disable-next-line max-len ignorePattern: '.{0,20}$|[a-z]+ ?[0-9A-Z_.(/=:[#-]|std|http|ssh|ftp|(let|var|const) [a-z_A-Z0-9]+ =|[b-z] |[a-z]*[0-9].* ', ignoreInlineComments: true, ignoreConsecutiveComments: true, @@ -137,13 +136,6 @@ module.exports = { 'key-spacing': ['error', { mode: 'strict' }], 'keyword-spacing': 'error', 'linebreak-style': ['error', 'unix'], - 'max-len': ['error', { - code: 80, - ignorePattern: '^// Flags:', - ignoreRegExpLiterals: true, - ignoreUrls: true, - tabWidth: 2, - }], 'new-parens': 'error', 'no-async-promise-executor': 'error', 'no-class-assign': 'error', @@ -185,7 +177,6 @@ module.exports = { 'no-proto': 'error', 'no-redeclare': ['error', { 'builtinGlobals': false }], 'no-restricted-modules': ['error', 'sys'], - /* eslint-disable max-len */ 'no-restricted-properties': [ 'error', { @@ -238,7 +229,6 @@ module.exports = { message: 'Use Number.isNaN() instead of the global isNaN() function.', }, ], - /* eslint-enable max-len */ 'no-return-await': 'error', 'no-self-assign': 'error', 'no-self-compare': 'error', diff --git a/test/parallel/test-http2-binding.js b/test/parallel/test-http2-binding.js index e81a58dfe8a5c1..29f2901e85e6e0 100644 --- a/test/parallel/test-http2-binding.js +++ b/test/parallel/test-http2-binding.js @@ -107,7 +107,7 @@ const expectedHeaderNames = { HTTP2_HEADER_ACCEPT_LANGUAGE: 'accept-language', HTTP2_HEADER_ACCEPT_RANGES: 'accept-ranges', HTTP2_HEADER_ACCEPT: 'accept', - HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: 'access-control-allow-credentials', // eslint-disable-line max-len + HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS: 'access-control-allow-credentials', HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS: 'access-control-allow-headers', HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS: 'access-control-allow-methods', HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: 'access-control-allow-origin', diff --git a/test/parallel/test-policy-integrity-flag.js b/test/parallel/test-policy-integrity-flag.js index ddcd02236d27c0..d9b3b3524bdcab 100644 --- a/test/parallel/test-policy-integrity-flag.js +++ b/test/parallel/test-policy-integrity-flag.js @@ -21,12 +21,10 @@ const emptySRI = `sha512-${emptyHash.digest('base64')}`; const policyHash = crypto.createHash('sha512'); policyHash.update(fs.readFileSync(depPolicy)); -/* eslint-disable max-len */ // When using \n only const nixPolicySRI = 'sha512-u/nXI6UacK5fKDC2bopcgnuQY4JXJKlK3dESO3GIKKxwogVHjJqpF9rgk7Zw+TJXIc96xBUWKHuUgOzic8/4tQ=='; // When \n is turned into \r\n const windowsPolicySRI = 'sha512-OeyCPRo4OZMosHyquZXDHpuU1F4KzG9UHFnn12FMaHsvqFUt3TFZ+7wmZE7ThZ5rsQWkUjc9ZH0knGZ2e8BYPQ=='; -/* eslint-enable max-len */ const depPolicySRI = `${nixPolicySRI} ${windowsPolicySRI}`; { diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index 8ae0d680d5f039..01757b302a7991 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -136,7 +136,6 @@ addTest('a\x1baA\x1bA', [ ]); // xterm/gnome ESC [ letter (with modifiers) -/* eslint-disable max-len */ addTest('\x1b[2P\x1b[3P\x1b[4P\x1b[5P\x1b[6P\x1b[7P\x1b[8P\x1b[3Q\x1b[8Q\x1b[3R\x1b[8R\x1b[3S\x1b[8S', [ { name: 'f1', sequence: '\x1b[2P', code: '[P', shift: true, meta: false, ctrl: false }, { name: 'f1', sequence: '\x1b[3P', code: '[P', shift: false, meta: true, ctrl: false }, @@ -152,7 +151,6 @@ addTest('\x1b[2P\x1b[3P\x1b[4P\x1b[5P\x1b[6P\x1b[7P\x1b[8P\x1b[3Q\x1b[8Q\x1b[3R\ { name: 'f4', sequence: '\x1b[3S', code: '[S', meta: true }, { name: 'f4', sequence: '\x1b[8S', code: '[S', shift: true, meta: true, ctrl: true }, ]); -/* eslint-enable max-len */ // xterm/gnome ESC O letter addTest('\x1bOP\x1bOQ\x1bOR\x1bOS', [ @@ -250,7 +248,6 @@ addTest('\x1b[A\x1b[B\x1b[2A\x1b[2B', [ ]); // `rxvt` keys with modifiers. -// eslint-disable-next-line max-len addTest('\x1b[20~\x1b[2$\x1b[2^\x1b[3$\x1b[3^\x1b[5$\x1b[5^\x1b[6$\x1b[6^\x1b[7$\x1b[7^\x1b[8$\x1b[8^', [ { name: 'f9', sequence: '\x1b[20~', code: '[20~' }, { name: 'insert', sequence: '\x1b[2$', code: '[2$', shift: true }, diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index cbfc58b1123a72..2beef5e014d451 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -844,7 +844,7 @@ const parseTests = { hostname: 'a.b', hash: null, 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', // eslint-disable-line max-len + path: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?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', href: 'http://a.b/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz' diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 37d669c540eb52..f42ad78ed5b149 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -2610,7 +2610,6 @@ assert.strictEqual( expected = [ '[', - /* eslint-disable max-len */ ' \u001b[33m0\u001b[39m, \u001b[33m1\u001b[39m, \u001b[33m2\u001b[39m, \u001b[33m3\u001b[39m,', ' \u001b[33m4\u001b[39m, \u001b[33m5\u001b[39m, \u001b[33m6\u001b[39m, \u001b[33m7\u001b[39m,', ' \u001b[33m8\u001b[39m, \u001b[33m9\u001b[39m, \u001b[33m10\u001b[39m, \u001b[33m11\u001b[39m,', @@ -2626,7 +2625,6 @@ assert.strictEqual( ' \u001b[33m48\u001b[39m, \u001b[33m49\u001b[39m, \u001b[33m50\u001b[39m, \u001b[33m51\u001b[39m,', ' \u001b[33m52\u001b[39m, \u001b[33m53\u001b[39m, \u001b[33m54\u001b[39m, \u001b[33m55\u001b[39m,', ' \u001b[33m56\u001b[39m, \u001b[33m57\u001b[39m, \u001b[33m58\u001b[39m, \u001b[33m59\u001b[39m', - /* eslint-enable max-len */ ']', ].join('\n'); @@ -3067,7 +3065,7 @@ assert.strictEqual( '[GeneratorFunction: generator] {\n' + ' [length]: 0,\n' + " [name]: 'generator',\n" + - " [prototype]: Object [Generator] { [Symbol(Symbol.toStringTag)]: 'Generator' },\n" + // eslint-disable-line max-len + " [prototype]: Object [Generator] { [Symbol(Symbol.toStringTag)]: 'Generator' },\n" + " [Symbol(Symbol.toStringTag)]: 'GeneratorFunction'\n" + '}' ); diff --git a/tools/doc/html.js b/tools/doc/html.js index 671cb4adf62065..2686a51e43d14c 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -499,7 +499,6 @@ function altDocs(filename, docCreated, versions) { ` : ''; } -// eslint-disable-next-line max-len const githubLogo = ''; function editOnGitHub(filename) { return `
  • ${githubLogo}Edit on GitHub
  • `; diff --git a/tools/doc/json.js b/tools/doc/json.js index 5677fd1ce8b664..cf107dc0b132e7 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -458,7 +458,6 @@ const callWithParams = r`\([^)]*\)`; const maybeExtends = `(?: +extends +${maybeAncestors}${classId})?`; -/* eslint-disable max-len */ const headingExpressions = [ { type: 'event', re: RegExp( `${eventPrefix}${maybeBacktick}${maybeQuote}(${notQuotes})${maybeQuote}${maybeBacktick}$`, 'i') }, @@ -478,7 +477,6 @@ const headingExpressions = [ { type: 'property', re: RegExp( `^${maybeClassPropertyPrefix}${maybeBacktick}${ancestors}(${id})${maybeBacktick}$`, 'i') }, ]; -/* eslint-enable max-len */ function newSection(header, file) { const text = textJoin(header.children, file);