From 701603e85de1944a57dc13650d34876c60c051ba Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 25 Dec 2019 20:03:46 +0100 Subject: [PATCH] Fix the linting errors, from the Prettier auto-formatting, that ESLint `--fix` couldn't handle This patch makes the follow changes: - Remove no longer necessary inline `// eslint-disable-...` comments. - Fix `// eslint-disable-...` comments that Prettier moved down, thus causing new linting errors. - Concatenate strings which now fit on just one line. - Fix comments that are now too long. - Finally, and most importantly, adjust comments that Prettier moved down, since the new positions often is confusing or outright wrong. --- examples/components/pageviewer.js | 4 +- examples/components/simpleviewer.js | 6 +- examples/components/singlepageviewer.js | 6 +- examples/svgviewer/viewer.js | 4 +- external/builder/builder.js | 2 +- gulpfile.js | 10 ++- src/core/cmap.js | 2 +- src/core/document.js | 6 +- src/core/evaluator.js | 15 +++-- src/core/fonts.js | 4 +- src/core/image.js | 4 +- src/core/jpeg_stream.js | 2 +- src/core/jpg.js | 13 ++-- src/core/jpx.js | 2 +- src/core/parser.js | 83 +++++++++++-------------- src/core/pattern.js | 1 - src/core/ps_parser.js | 41 ++++++------ src/core/stream.js | 16 ++--- src/core/type1_parser.js | 7 +-- src/core/unicode.js | 3 +- src/core/worker.js | 5 +- src/display/api.js | 6 +- src/display/font_loader.js | 10 +-- src/display/svg.js | 4 +- src/shared/compatibility.js | 3 +- src/shared/fonts_utils.js | 2 +- test/add_test.js | 2 +- test/driver.js | 2 +- test/font/fontutils.js | 6 +- test/test.js | 2 +- test/unit/core_utils_spec.js | 2 +- test/unit/crypto_spec.js | 12 ++-- test/unit/parser_spec.js | 12 ++-- web/app.js | 27 ++++---- web/chromecom.js | 4 +- web/firefoxcom.js | 2 +- web/overlay_manager.js | 3 +- web/password_prompt.js | 3 +- web/pdf_attachment_viewer.js | 2 +- web/pdf_cursor_tools.js | 5 +- web/pdf_find_controller.js | 4 +- web/pdf_history.js | 2 +- web/pdf_page_view.js | 2 +- web/pdf_print_service.js | 3 +- web/pdf_sidebar.js | 2 +- web/toolbar.js | 4 +- 46 files changed, 167 insertions(+), 195 deletions(-) diff --git a/examples/components/pageviewer.js b/examples/components/pageviewer.js index 626561c5a07337..b6ed43ff9ea3ae 100644 --- a/examples/components/pageviewer.js +++ b/examples/components/pageviewer.js @@ -16,9 +16,7 @@ "use strict"; if (!pdfjsLib.getDocument || !pdfjsViewer.PDFPageView) { - alert( - "Please build the pdfjs-dist library using\n" + " `gulp dist-install`" - ); + alert("Please build the pdfjs-dist library using\n `gulp dist-install`"); } // The workerSrc property shall be specified. diff --git a/examples/components/simpleviewer.js b/examples/components/simpleviewer.js index 3bc1f6a94965a8..d718206229c7b9 100644 --- a/examples/components/simpleviewer.js +++ b/examples/components/simpleviewer.js @@ -16,9 +16,7 @@ "use strict"; if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) { - alert( - "Please build the pdfjs-dist library using\n" + " `gulp dist-install`" - ); + alert("Please build the pdfjs-dist library using\n `gulp dist-install`"); } // The workerSrc property shall be specified. @@ -55,8 +53,8 @@ document.addEventListener("pagesinit", function() { // We can use pdfViewer now, e.g. let's change default scale. pdfViewer.currentScaleValue = "page-width"; + // We can try searching for things. if (SEARCH_FOR) { - // We can try search for things pdfFindController.executeCommand("find", { query: SEARCH_FOR }); } }); diff --git a/examples/components/singlepageviewer.js b/examples/components/singlepageviewer.js index 6ab8cc9e27f3f6..343052985ec636 100644 --- a/examples/components/singlepageviewer.js +++ b/examples/components/singlepageviewer.js @@ -16,9 +16,7 @@ "use strict"; if (!pdfjsLib.getDocument || !pdfjsViewer.PDFSinglePageViewer) { - alert( - "Please build the pdfjs-dist library using\n" + " `gulp dist-install`" - ); + alert("Please build the pdfjs-dist library using\n `gulp dist-install`"); } // The workerSrc property shall be specified. @@ -55,8 +53,8 @@ document.addEventListener("pagesinit", function() { // We can use pdfSinglePageViewer now, e.g. let's change default scale. pdfSinglePageViewer.currentScaleValue = "page-width"; + // We can try searching for things. if (SEARCH_FOR) { - // We can try search for things pdfFindController.executeCommand("find", { query: SEARCH_FOR }); } }); diff --git a/examples/svgviewer/viewer.js b/examples/svgviewer/viewer.js index 9a32261d3fe904..03f837e4510c7f 100644 --- a/examples/svgviewer/viewer.js +++ b/examples/svgviewer/viewer.js @@ -16,9 +16,7 @@ "use strict"; if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) { - alert( - "Please build the pdfjs-dist library using\n" + " `gulp dist-install`" - ); + alert("Please build the pdfjs-dist library using\n `gulp dist-install`"); } // The workerSrc property shall be specified. diff --git a/external/builder/builder.js b/external/builder/builder.js index 39135e773f7f2d..e11d883e0140e7 100644 --- a/external/builder/builder.js +++ b/external/builder/builder.js @@ -120,7 +120,7 @@ function preprocess(inFilename, outFilename, defines) { var line; var state = STATE_NONE; var stack = []; - var control = /^(?:\/\/|)?$)?/; // eslint-disable-next-line max-len + var control = /^(?:\/\/|)?$)?/; var lineNumber = 0; var loc = function() { return fs.realpathSync(inFilename) + ":" + lineNumber; diff --git a/gulpfile.js b/gulpfile.js index d3d7885dfdffe8..60a9a4f8e28381 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -208,7 +208,6 @@ function createWebpackConfig(defines, output) { // `web-streams-polyfill` (already using a transpiled file), and // `src/core/{glyphlist,unicode}.js` (Babel is too slow for those) // should be excluded from processing. - // eslint-disable-next-line max-len exclude: /(node_modules[\\\/]core-js|node_modules[\\\/]web-streams-polyfill|src[\\\/]core[\\\/](glyphlist|unicode))/, options: { presets: skipBabel ? undefined : ["@babel/preset-env"], @@ -425,7 +424,7 @@ function createTestSource(testsName, bot) { "Browser manifest file test/" + PDF_BROWSERS + " does not exist." ); console.log( - "Copy and adjust the example in " + "test/resources/browser_manifests." + "Copy and adjust the example in test/resources/browser_manifests." ); this.emit("error", new Error("Missing manifest file")); return null; @@ -476,7 +475,7 @@ function makeRef(done, bot) { "Browser manifest file test/" + PDF_BROWSERS + " does not exist." ); console.log( - "Copy and adjust the example in " + "test/resources/browser_manifests." + "Copy and adjust the example in test/resources/browser_manifests." ); done(new Error("Missing manifest file")); return; @@ -669,7 +668,7 @@ gulp.task("locale", function() { gulp.dest(VIEWER_LOCALE_OUTPUT) ), gulp - .src(L10N_DIR + "/{" + locales.join(",") + "}" + "/viewer.properties", { + .src(L10N_DIR + "/{" + locales.join(",") + "}/viewer.properties", { base: L10N_DIR, }) .pipe(gulp.dest(VIEWER_LOCALE_OUTPUT)), @@ -1142,7 +1141,6 @@ gulp.task( babelPluginReplaceNonWebPackRequire, ], }).code; - // eslint-disable-next-line max-len var removeCjsSrc = /^(var\s+\w+\s*=\s*(_interopRequireDefault\()?require\(".*?)(?:\/src)(\/[^"]*"\)\)?;)$/gm; content = content.replace( removeCjsSrc, @@ -1679,7 +1677,7 @@ gulp.task( console.log(); console.log("Done. Push with"); console.log( - " cd " + DIST_DIR + "; " + "git push --tags " + DIST_REPO_URL + " master" + " cd " + DIST_DIR + "; git push --tags " + DIST_REPO_URL + " master" ); console.log(); done(); diff --git a/src/core/cmap.js b/src/core/cmap.js index 5327b35816a1f5..a393afb5e11821 100644 --- a/src/core/cmap.js +++ b/src/core/cmap.js @@ -401,8 +401,8 @@ class IdentityCMap extends CMap { return 0x10000; } + // eslint-disable-next-line getter-return get isIdentityCMap() { - // eslint-disable-line getter-return unreachable("should not access .isIdentityCMap"); } } diff --git a/src/core/document.js b/src/core/document.js index d0cb9fba575435..f241723fdfc19f 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -591,8 +591,7 @@ class PDFDocument { ch = stream.getByte(); } while (isSpace(ch)); let str = ""; - while (ch >= 0x20 && ch <= 0x39) { - // < '9' + while (ch >= /* Space = */ 0x20 && ch <= /* '9' = */ 0x39) { str += String.fromCharCode(ch); ch = stream.getByte(); } @@ -622,8 +621,7 @@ class PDFDocument { const MAX_PDF_VERSION_LENGTH = 12; let version = "", ch; - while ((ch = stream.getByte()) > 0x20) { - // Space + while ((ch = stream.getByte()) > /* Space = */ 0x20) { if (version.length >= MAX_PDF_VERSION_LENGTH) { break; } diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 887b473acd5b4f..c164de0485e08b 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -524,8 +524,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { ]) .then( function() { - // Only add the dependency once we know that the native JPEG decoding - // succeeded, to ensure that rendering will always complete. + // Only add the dependency once we know that the native JPEG + // decoding succeeded, to ensure that rendering will always + // complete. operatorList.addDependency(objId); args = [objId, w, h]; @@ -755,7 +756,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { return translated; }) .catch(reason => { - // Error in the font data -- sending unsupported feature notification. + // Error in the font data -- sending unsupported feature + // notification. this.handler.send("UnsupportedFeature", { featureId: UNSUPPORTED_FEATURES.font, }); @@ -2160,9 +2162,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { return; } - // Use a new `StateManager` to prevent incorrect positioning of - // textItems *after* the Form XObject, since errors in the data - // can otherwise prevent `restore` operators from executing. + // Use a new `StateManager` to prevent incorrect positioning + // of textItems *after* the Form XObject, since errors in the + // data can otherwise prevent `restore` operators from + // executing. // NOTE: Only an issue when `options.ignoreErrors === true`. let currentState = stateManager.state.clone(); let xObjStateManager = new StateManager(currentState); diff --git a/src/core/fonts.js b/src/core/fonts.js index 8a0b0e40e61c50..8035121317e450 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -929,9 +929,8 @@ var Font = (function FontClosure() { return true; } // ... obviously some fonts violate that part of the specification, - // please refer to the comment in |Type1Font| below. + // please refer to the comment in |Type1Font| below (pfb file header). if (header[0] === 0x80 && header[1] === 0x01) { - // pfb file header. return true; } return false; @@ -1085,7 +1084,6 @@ var Font = (function FontClosure() { var ranges = []; var length = codes.length; for (var n = 0; n < length; ) { - // eslint-disable-line space-in-parens var start = codes[n].fontCharCode; var codeIndices = [codes[n].glyphId]; ++n; diff --git a/src/core/image.js b/src/core/image.js index 5d5415bebdaa49..1d27973f4600df 100644 --- a/src/core/image.js +++ b/src/core/image.js @@ -142,7 +142,7 @@ var PDFImage = (function PDFImageClosure() { } if (width < 1 || height < 1) { throw new FormatError( - `Invalid image width: ${width} or ` + `height: ${height}` + `Invalid image width: ${width} or height: ${height}` ); } this.width = width; @@ -617,11 +617,11 @@ var PDFImage = (function PDFImageClosure() { var drawWidth = this.drawWidth; var drawHeight = this.drawHeight; var imgData = { - // other fields are filled in below width: drawWidth, height: drawHeight, kind: 0, data: null, + // Other fields are filled in below. }; var numComps = this.numComps; diff --git a/src/core/jpeg_stream.js b/src/core/jpeg_stream.js index 24d7747a52190e..9532ee68165d0b 100644 --- a/src/core/jpeg_stream.js +++ b/src/core/jpeg_stream.js @@ -31,8 +31,8 @@ let JpegStream = (function JpegStreamClosure() { // Note: this seems to mainly affect inline images. let ch; while ((ch = stream.getByte()) !== -1) { + // Find the first byte of the SOI marker (0xFFD8). if (ch === 0xff) { - // Find the first byte of the SOI marker (0xFFD8). stream.skip(-1); // Reset the stream position to the SOI. break; } diff --git a/src/core/jpg.js b/src/core/jpg.js index f29c54514da4b7..ee83f3e48e635e 100644 --- a/src/core/jpg.js +++ b/src/core/jpg.js @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* eslint-disable no-multi-spaces */ import { assert, BaseException, warn } from "../shared/util"; @@ -149,7 +148,6 @@ var JpegImage = (function JpegImageClosure() { var nextByte = data[offset++]; if (nextByte) { if (nextByte === 0xdc && parseDNLMarker) { - // DNL == 0xFFDC offset += 2; // Skip data length. const scanLines = (data[offset++] << 8) | data[offset++]; if (scanLines > 0 && scanLines !== frame.scanLines) { @@ -159,7 +157,6 @@ var JpegImage = (function JpegImageClosure() { ); } } else if (nextByte === 0xd9) { - // EOI == 0xFFD9 throw new EOIMarkerError( "Found EOI marker (0xFFD9) while parsing scan data" ); @@ -746,14 +743,12 @@ var JpegImage = (function JpegImageClosure() { var huffmanTablesAC = [], huffmanTablesDC = []; var fileMarker = readUint16(); - if (fileMarker !== 0xffd8) { - // SOI (Start of Image) + if (fileMarker !== /* SOI (Start of Image) = */ 0xffd8) { throw new JpegError("SOI not found"); } fileMarker = readUint16(); - markerLoop: while (fileMarker !== 0xffd9) { - // EOI (End of image) + markerLoop: while (fileMarker !== /* EOI (End of Image) = */ 0xffd9) { var i, j, l; switch (fileMarker) { case 0xffe0: // APP0 (Application Specific) @@ -776,6 +771,7 @@ var JpegImage = (function JpegImageClosure() { var appData = readDataBlock(); if (fileMarker === 0xffe0) { + // 'JFIF\x00' if ( appData[0] === 0x4a && appData[1] === 0x46 && @@ -783,7 +779,6 @@ var JpegImage = (function JpegImageClosure() { appData[3] === 0x46 && appData[4] === 0 ) { - // 'JFIF\x00' jfif = { version: { major: appData[5], minor: appData[6] }, densityUnits: appData[7], @@ -800,6 +795,7 @@ var JpegImage = (function JpegImageClosure() { } // TODO APP1 - Exif if (fileMarker === 0xffee) { + // 'Adobe' if ( appData[0] === 0x41 && appData[1] === 0x64 && @@ -807,7 +803,6 @@ var JpegImage = (function JpegImageClosure() { appData[3] === 0x62 && appData[4] === 0x65 ) { - // 'Adobe' adobe = { version: (appData[5] << 8) | appData[6], flags0: (appData[7] << 8) | appData[8], diff --git a/src/core/jpx.js b/src/core/jpx.js index f0b424bba5e6f8..63e3763bf4d45d 100644 --- a/src/core/jpx.js +++ b/src/core/jpx.js @@ -404,7 +404,7 @@ var JpxImage = (function JpxImageClosure() { break; case 0xff53: // Coding style component (COC) throw new Error( - "Codestream code 0xFF53 (COC) is " + "not implemented" + "Codestream code 0xFF53 (COC) is not implemented" ); default: throw new Error("Unknown codestream code: " + code.toString(16)); diff --git a/src/core/parser.js b/src/core/parser.js index 8be60345d7a417..fa3993b1a06d02 100644 --- a/src/core/parser.js +++ b/src/core/parser.js @@ -813,12 +813,13 @@ const specialChars = [ ]; function toHexDigit(ch) { - if (ch >= 0x30 && ch <= 0x39) { - // '0'-'9' + if (ch >= /* '0' = */ 0x30 && ch /* '9' = */ <= 0x39) { return ch & 0x0f; } - if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) { - // 'A'-'F', 'a'-'f' + if ( + (ch >= /* 'A' = */ 0x41 && ch <= /* 'F' = */ 0x46) || + (ch >= /* 'a' = */ 0x61 && ch <= /* 'f' = */ 0x66) + ) { return (ch & 0x0f) + 9; } return -1; @@ -1020,23 +1021,21 @@ class Lexer { case 0x29: // ')' strBuf.push(String.fromCharCode(ch)); break; - case 0x30: - case 0x31: - case 0x32: - case 0x33: // '0'-'3' - case 0x34: - case 0x35: - case 0x36: - case 0x37: // '4'-'7' + case 0x30: // '0' + case 0x31: // '1' + case 0x32: // '2' + case 0x33: // '3' + case 0x34: // '4' + case 0x35: // '5' + case 0x36: // '6' + case 0x37: // '7' let x = ch & 0x0f; ch = this.nextChar(); charBuffered = true; - if (ch >= 0x30 && ch <= 0x37) { - // '0'-'7' + if (ch >= /* '0' = */ 0x30 && ch <= /* '7' = */ 0x37) { x = (x << 3) + (ch & 0x0f); ch = this.nextChar(); - if (ch >= 0x30 && ch <= 0x37) { - // '0'-'7' + if (ch >= /* '0' = */ 0x30 && ch /* '7' = */ <= 0x37) { charBuffered = false; x = (x << 3) + (ch & 0x0f); } @@ -1044,8 +1043,7 @@ class Lexer { strBuf.push(String.fromCharCode(x)); break; case 0x0d: // CR - if (this.peekChar() === 0x0a) { - // LF + if (this.peekChar() === /* LF = */ 0x0a) { this.nextChar(); } break; @@ -1076,8 +1074,7 @@ class Lexer { strBuf.length = 0; while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { - if (ch === 0x23) { - // '#' + if (ch === /* '#' = */ 0x23) { ch = this.nextChar(); if (specialChars[ch]) { warn( @@ -1129,8 +1126,7 @@ class Lexer { if (ch < 0) { warn("Unterminated hex string"); break; - } else if (ch === 0x3e) { - // '>' + } else if (ch === /* '>' = */ 0x3e) { this.nextChar(); break; } else if (specialChars[ch] === 1) { @@ -1169,12 +1165,10 @@ class Lexer { return EOF; } if (comment) { - if (ch === 0x0a || ch === 0x0d) { - // LF, CR + if (ch === /* LF = */ 0x0a || ch === /* CR = */ 0x0d) { comment = false; } - } else if (ch === 0x25) { - // '%' + } else if (ch === /* '%' = */ 0x25) { comment = true; } else if (specialChars[ch] !== 1) { break; @@ -1184,19 +1178,19 @@ class Lexer { // Start reading a token. switch (ch | 0) { - case 0x30: - case 0x31: - case 0x32: - case 0x33: - case 0x34: // '0'-'4' - case 0x35: - case 0x36: - case 0x37: - case 0x38: - case 0x39: // '5'-'9' - case 0x2b: - case 0x2d: - case 0x2e: // '+', '-', '.' + case 0x30: // '0' + case 0x31: // '1' + case 0x32: // '2' + case 0x33: // '3' + case 0x34: // '4' + case 0x35: // '5' + case 0x36: // '6' + case 0x37: // '7' + case 0x38: // '8' + case 0x39: // '9' + case 0x2b: // '+' + case 0x2d: // '-' + case 0x2e: // '.' return this.getNumber(); case 0x28: // '(' return this.getString(); @@ -1280,16 +1274,13 @@ class Lexer { skipToNextLine() { let ch = this.currentChar; while (ch >= 0) { - if (ch === 0x0d) { - // CR + if (ch === /* CR = */ 0x0d) { ch = this.nextChar(); - if (ch === 0x0a) { - // LF + if (ch === /* LF = */ 0x0a) { this.nextChar(); } break; - } else if (ch === 0x0a) { - // LF + } else if (ch === /* LF = */ 0x0a) { this.nextChar(); break; } @@ -1323,7 +1314,7 @@ class Linearization { const hint = hints[index]; if (!(Number.isInteger(hint) && hint > 0)) { throw new Error( - `Hint (${index}) in the linearization dictionary ` + "is invalid." + `Hint (${index}) in the linearization dictionary is invalid.` ); } } diff --git a/src/core/pattern.js b/src/core/pattern.js index 09a508c8a874e5..93396bd51c246b 100644 --- a/src/core/pattern.js +++ b/src/core/pattern.js @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* eslint-disable no-multi-spaces */ import { assert, diff --git a/src/core/ps_parser.js b/src/core/ps_parser.js index 281681a31f3d2f..971162ba33d37d 100644 --- a/src/core/ps_parser.js +++ b/src/core/ps_parser.js @@ -190,8 +190,7 @@ class PostScriptLexer { if (ch === 0x0a || ch === 0x0d) { comment = false; } - } else if (ch === 0x25) { - // '%' + } else if (ch === /* '%' = */ 0x25) { comment = true; } else if (!isSpace(ch)) { break; @@ -199,19 +198,19 @@ class PostScriptLexer { ch = this.nextChar(); } switch (ch | 0) { - case 0x30: - case 0x31: - case 0x32: - case 0x33: - case 0x34: // '0'-'4' - case 0x35: - case 0x36: - case 0x37: - case 0x38: - case 0x39: // '5'-'9' - case 0x2b: - case 0x2d: - case 0x2e: // '+', '-', '.' + case 0x30: // '0' + case 0x31: // '1' + case 0x32: // '2' + case 0x33: // '3' + case 0x34: // '4' + case 0x35: // '5' + case 0x36: // '6' + case 0x37: // '7' + case 0x38: // '8' + case 0x39: // '9' + case 0x2b: // '+' + case 0x2d: // '-' + case 0x2e: // '.' return new PostScriptToken( PostScriptTokenTypes.NUMBER, this.getNumber() @@ -229,8 +228,9 @@ class PostScriptLexer { strBuf[0] = String.fromCharCode(ch); while ( - (ch = this.nextChar()) >= 0 && // and 'A'-'Z', 'a'-'z' - ((ch >= 0x41 && ch <= 0x5a) || (ch >= 0x61 && ch <= 0x7a)) + (ch = this.nextChar()) >= 0 && + ((ch >= /* 'A' = */ 0x41 && ch <= /* 'Z' = */ 0x5a) || + (ch >= /* 'a' = */ 0x61 && ch <= /* 'z' = */ 0x7a)) ) { strBuf.push(String.fromCharCode(ch)); } @@ -253,11 +253,10 @@ class PostScriptLexer { while ((ch = this.nextChar()) >= 0) { if ( - (ch >= 0x30 && ch <= 0x39) || // '0'-'9' - ch === 0x2d || - ch === 0x2e + (ch >= /* '0' = */ 0x30 && ch <= /* '9' = */ 0x39) || + ch === /* '-' = */ 0x2d || + ch === /* '.' = */ 0x2e ) { - // '-', '.' strBuf.push(String.fromCharCode(ch)); } else { break; diff --git a/src/core/stream.js b/src/core/stream.js index 5f06ae0ce54cce..b3033d8c2b791d 100644 --- a/src/core/stream.js +++ b/src/core/stream.js @@ -1098,19 +1098,19 @@ var AsciiHexStream = (function AsciiHexStreamClosure() { for (var i = 0, ii = bytes.length; i < ii; i++) { var ch = bytes[i], digit; - if (ch >= 0x30 && ch <= 0x39) { - // '0'-'9' + if (ch >= /* '0' = */ 0x30 && ch <= /* '9' = */ 0x39) { digit = ch & 0x0f; - } else if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) { - // 'A'-'Z', 'a'-'z' + } else if ( + (ch >= /* 'A' = */ 0x41 && ch <= /* 'Z' = */ 0x46) || + (ch >= /* 'a' = */ 0x61 && ch <= /* 'z' = */ 0x66) + ) { digit = (ch & 0x0f) + 9; - } else if (ch === 0x3e) { - // '>' + } else if (ch === /* '>' = */ 0x3e) { this.eof = true; break; } else { - // probably whitespace - continue; // ignoring + // Probably whitespace, ignoring. + continue; } if (firstDigit < 0) { firstDigit = digit; diff --git a/src/core/type1_parser.js b/src/core/type1_parser.js index 0869ba3fa1f149..f714c0dda1f49d 100644 --- a/src/core/type1_parser.js +++ b/src/core/type1_parser.js @@ -385,8 +385,8 @@ var Type1Parser = (function Type1ParserClosure() { return ( (code >= 48 && code <= 57) || // '0'-'9' (code >= 65 && code <= 70) || // 'A'-'F' - (code >= 97 && code <= 102) - ); // 'a'-'f' + (code >= 97 && code <= 102) // 'a'-'f' + ); } function decrypt(data, key, discardNumber) { @@ -521,8 +521,7 @@ var Type1Parser = (function Type1ParserClosure() { if (ch === 0x0a || ch === 0x0d) { comment = false; } - } else if (ch === 0x25) { - // '%' + } else if (ch === /* '%' = */ 0x25) { comment = true; } else if (!isSpace(ch)) { break; diff --git a/src/core/unicode.js b/src/core/unicode.js index 73026aaf099f4e..e0839378c2a012 100644 --- a/src/core/unicode.js +++ b/src/core/unicode.js @@ -52,8 +52,7 @@ function mapSpecialUnicodeValues(code) { return 0; } else if (code >= 0xf600 && code <= 0xf8ff) { return getSpecialPUASymbols()[code] || code; - } else if (code === 0x00ad) { - // softhyphen + } else if (code === /* softhyphen = */ 0x00ad) { return 0x002d; // hyphen } return code; diff --git a/src/core/worker.js b/src/core/worker.js index f8c8bd56035c40..8fe05ab3b113b8 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -527,8 +527,9 @@ var WorkerMessageHandler = { sink.error(reason); - // TODO: Should `reason` be re-thrown here (currently that casues - // "Uncaught exception: ..." messages in the console)? + // TODO: Should `reason` be re-thrown here (currently that + // casues "Uncaught exception: ..." messages in the + // console)? } ); }); diff --git a/src/display/api.js b/src/display/api.js index be4c815a71b05b..05cd487ab2c5d2 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -381,8 +381,8 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { typeof PDFJSDev !== "undefined" && !PDFJSDev.test("TESTING") ? PDFJSDev.eval("BUNDLE_VERSION") : null, + // Only send the required properties, and *not* the entire object. source: { - // Only send the required properties, and *not* the entire object. data: source.data, url: source.url, password: source.password, @@ -1087,8 +1087,8 @@ class PDFPageProxy { const internalRenderTask = new InternalRenderTask({ callback: complete, + // Only include the required properties, and *not* the entire object. params: { - // Include the required properties, and *not* the entire object. canvasContext, viewport, transform, @@ -1641,8 +1641,8 @@ const PDFWorker = (function PDFWorkerClosure() { if ( typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC") && - // eslint-disable-next-line no-undef isNodeJS && + // eslint-disable-next-line no-undef typeof __non_webpack_require__ === "function" ) { // Since bundlers, such as Webpack, cannot be told to leave `require` diff --git a/src/display/font_loader.js b/src/display/font_loader.js index aed1ead649e815..80d9a82dd289a5 100644 --- a/src/display/font_loader.js +++ b/src/display/font_loader.js @@ -113,18 +113,18 @@ class BaseFontLoader { unreachable("Abstract method `_queueLoadingCallback`."); } + // eslint-disable-next-line getter-return get isFontLoadingAPISupported() { - // eslint-disable-line getter-return unreachable("Abstract method `isFontLoadingAPISupported`."); } + // eslint-disable-next-line getter-return get isSyncFontLoadingSupported() { - // eslint-disable-line getter-return unreachable("Abstract method `isSyncFontLoadingSupported`."); } + // eslint-disable-next-line getter-return get _loadTestFont() { - // eslint-disable-line getter-return unreachable("Abstract method `_loadTestFont`."); } @@ -225,8 +225,8 @@ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { get _loadTestFont() { const getLoadTestFont = function() { - // This is a CFF font with 1 glyph for '.' that fills its entire width and - // height. + // This is a CFF font with 1 glyph for '.' that fills its entire width + // and height. return atob( "T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA" + "FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA" + diff --git a/src/display/svg.js b/src/display/svg.js index 4b08266bd4ff43..0ce92bf611b489 100644 --- a/src/display/svg.js +++ b/src/display/svg.js @@ -125,8 +125,8 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { function deflateSync(literals) { if (!isNodeJS) { // zlib is certainly not available outside of Node.js. We can either use - // the pako library for client-side DEFLATE compression, or use the canvas - // API of the browser to obtain a more optimal PNG file. + // the pako library for client-side DEFLATE compression, or use the + // canvas API of the browser to obtain a more optimal PNG file. return deflateSyncUncompressed(literals); } try { diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index d1b3f07c324f25..bd80cd229e8ada 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -248,7 +248,8 @@ if ( return; } if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) { - // The `URL` constructor is assumed to be available in the extension builds. + // The `URL` constructor is assumed to be available in the extension + // builds. return; } globalThis.URL = require("core-js/web/url"); diff --git a/src/shared/fonts_utils.js b/src/shared/fonts_utils.js index a1ce399b0cf069..9fd7845159940f 100644 --- a/src/shared/fonts_utils.js +++ b/src/shared/fonts_utils.js @@ -73,7 +73,7 @@ function readCharstringEncoding(aString) { var charstringTokens = []; var count = aString.length; - for (var i = 0; i < count; ) { // eslint-disable-line space-in-parens + for (var i = 0; i < count; ) { var value = aString[i++] | 0; var token = null; diff --git a/test/add_test.js b/test/add_test.js index dd32d2a9b552ec..f3c8bc5daa87e6 100644 --- a/test/add_test.js +++ b/test/add_test.js @@ -9,7 +9,7 @@ const gitIgnore = "test/pdfs/.gitignore"; if (process.argv.length < 3) { console.log("\nUsage: node add_test.js FILE\n"); console.log( - " Add a PDF as a reference test. FILE must be located in " + `${pdfFolder}` + ` Add a PDF as a reference test. FILE must be located in ${pdfFolder}` ); process.exit(1); } diff --git a/test/driver.js b/test/driver.js index 9c9e4f3c856ac0..63ad1fd1aceed1 100644 --- a/test/driver.js +++ b/test/driver.js @@ -277,8 +277,8 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() { /** * @class */ +// eslint-disable-next-line no-unused-vars var Driver = (function DriverClosure() { - // eslint-disable-line no-unused-vars /** * @constructs Driver * @param {DriverOptions} options diff --git a/test/font/fontutils.js b/test/font/fontutils.js index 7b7a8da8fa0752..bd71dee75c1a6f 100644 --- a/test/font/fontutils.js +++ b/test/font/fontutils.js @@ -19,8 +19,8 @@ var base64alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; +// eslint-disable-next-line no-unused-vars function decodeFontData(base64) { - // eslint-disable-line no-unused-vars var result = []; var bits = 0, @@ -68,8 +68,8 @@ function encodeFontData(data) { return buffer; } +// eslint-disable-next-line no-unused-vars function ttx(data, callback) { - // eslint-disable-line no-unused-vars var xhr = new XMLHttpRequest(); xhr.open("POST", "/ttx"); @@ -89,8 +89,8 @@ function ttx(data, callback) { xhr.send(encodedData); } +// eslint-disable-next-line no-unused-vars function verifyTtxOutput(output) { - // eslint-disable-line no-unused-vars var m = /^(.*?)<\/error>/.exec(output); if (m) { throw m[1]; diff --git a/test/test.js b/test/test.js index b056f23d9b3c41..d5f991f604797a 100644 --- a/test/test.js +++ b/test/test.js @@ -889,8 +889,8 @@ function main() { } else if (!options.browser && !options.browserManifestFile) { startServer(); } else if (options.unitTest) { + // Allows linked PDF files in unit-tests as well. ensurePDFsDownloaded(function() { - // Allows linked PDF files in unit-tests. startUnitTest("/test/unit/unit_test.html", "unit"); }); } else if (options.fontTest) { diff --git a/test/unit/core_utils_spec.js b/test/unit/core_utils_spec.js index ae1c912b2fa1c9..1de422e3b826c4 100644 --- a/test/unit/core_utils_spec.js +++ b/test/unit/core_utils_spec.js @@ -124,8 +124,8 @@ describe("core_utils", function() { const dict = new Dict(); let currentDict = dict; let parentDict = null; + // Exceed the loop limit of 100. for (let i = 0; i < 150; i++) { - // Exceeds the loop limit of 100. parentDict = new Dict(); currentDict.set("Parent", parentDict); currentDict = parentDict; diff --git a/test/unit/crypto_spec.js b/test/unit/crypto_spec.js index 8a34e27cc5454c..f9bcf16b1aee7b 100644 --- a/test/unit/crypto_spec.js +++ b/test/unit/crypto_spec.js @@ -89,7 +89,7 @@ describe("crypto", function() { it("should pass RFC 1321 test #6", function() { var input, result, expected; input = stringToBytes( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv" + "wxyz0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ); result = calculateMD5(input, 0, input.length); expected = hex2binary("d174ab98d277d9f5a5611c2c9f419d9f"); @@ -209,12 +209,12 @@ describe("crypto", function() { var key, input, result, expected, cipher; key = hex2binary("0123456789abcdef"); input = hex2binary( - "123456789abcdef0123456789abcdef0123456789abcdef0123" + "45678" + "123456789abcdef0123456789abcdef0123456789abcdef012345678" ); cipher = new ARCFourCipher(key); result = cipher.encryptBlock(input); expected = hex2binary( - "66a0949f8af7d6891f7f832ba833c00c892ebe30143ce287" + "40011ecf" + "66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf" ); expect(result).toEqual(expected); }); @@ -226,18 +226,18 @@ describe("crypto", function() { input = stringToBytes("abc"); result = calculateSHA256(input, 0, input.length); expected = hex2binary( - "BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9C" + "B410FF61F20015AD" + "BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD" ); expect(result).toEqual(expected); }); it("should properly hash a multiblock input", function() { var input, result, expected; input = stringToBytes( - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmno" + "mnopnopq" + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" ); result = calculateSHA256(input, 0, input.length); expected = hex2binary( - "248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167" + "F6ECEDD419DB06C1" + "248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1" ); expect(result).toEqual(expected); }); diff --git a/test/unit/parser_spec.js b/test/unit/parser_spec.js index 89ea2588dbd514..ce81445cbbbf58 100644 --- a/test/unit/parser_spec.js +++ b/test/unit/parser_spec.js @@ -40,7 +40,7 @@ describe("parser", function() { it("should skip to the end of stream if the EI marker is not found", function() { const string = - "q 1 0 0 1 0 0 cm BI /W 10 /H 10 /BPC 1 " + "/F /A85 ID abc123~> Q"; + "q 1 0 0 1 0 0 cm BI /W 10 /H 10 /BPC 1 /F /A85 ID abc123~> Q"; const input = new StringStream(string); const parser = new Parser({ lexer: new Lexer(input), @@ -320,7 +320,7 @@ describe("parser", function() { return Linearization.create(stream2); }).toThrow( new Error( - 'The "E" parameter in the linearization ' + "dictionary is invalid." + 'The "E" parameter in the linearization dictionary is invalid.' ) ); @@ -343,7 +343,7 @@ describe("parser", function() { return Linearization.create(stream3); }).toThrow( new Error( - 'The "O" parameter in the linearization ' + "dictionary is invalid." + 'The "O" parameter in the linearization dictionary is invalid.' ) ); } @@ -368,7 +368,7 @@ describe("parser", function() { expect(function() { return Linearization.create(stream1); }).toThrow( - new Error("Hint array in the linearization dictionary " + "is invalid.") + new Error("Hint array in the linearization dictionary is invalid.") ); // The hint array should contain two, or four, elements. @@ -389,7 +389,7 @@ describe("parser", function() { expect(function() { return Linearization.create(stream2); }).toThrow( - new Error("Hint array in the linearization dictionary " + "is invalid.") + new Error("Hint array in the linearization dictionary is invalid.") ); // The hint array should not contain zero. @@ -410,7 +410,7 @@ describe("parser", function() { expect(function() { return Linearization.create(stream3); }).toThrow( - new Error("Hint (2) in the linearization dictionary " + "is invalid.") + new Error("Hint (2) in the linearization dictionary is invalid.") ); }); }); diff --git a/web/app.js b/web/app.js index dae4d6467d5b2c..f72a713fbcd4fe 100644 --- a/web/app.js +++ b/web/app.js @@ -1103,7 +1103,8 @@ let PDFViewerApplication = { `${values.scrollLeft},${values.scrollTop}`; rotation = parseInt(values.rotation, 10); - // Always let user preferences take precedence over the view history. + // Always let user preferences take precedence over the view + // history. if (sidebarView === SidebarView.UNKNOWN) { sidebarView = values.sidebarView | 0; } @@ -1135,11 +1136,13 @@ let PDFViewerApplication = { pdfViewer.focus(); } - // For documents with different page sizes, once all pages are resolved, - // ensure that the correct location becomes visible on load. + // For documents with different page sizes, once all pages are + // resolved, ensure that the correct location becomes visible on + // load. // (To reduce the risk, in very large and/or slow loading documents, - // that the location changes *after* the user has started interacting - // with the viewer, wait for either `pagesPromise` or a timeout.) + // that the location changes *after* the user has started + // interacting with the viewer, wait for either `pagesPromise` or + // a timeout.) await Promise.race([ pagesPromise, new Promise(resolve => { @@ -1283,8 +1286,9 @@ let PDFViewerApplication = { // Ghostscript can produce invalid 'dc:title' Metadata entries: // - The title may be "Untitled" (fixes bug 1031612). // - The title may contain incorrectly encoded characters, which thus - // looks broken, hence we ignore the Metadata entry when it contains - // characters from the Specials Unicode block (fixes bug 1605526). + // looks broken, hence we ignore the Metadata entry when it + // contains characters from the Specials Unicode block + // (fixes bug 1605526). if ( metadataTitle !== "Untitled" && !/[\uFFF0-\uFFFF]/g.test(metadataTitle) @@ -1481,7 +1485,7 @@ let PDFViewerApplication = { .get( "printing_not_supported", null, - "Warning: Printing is not fully supported by " + "this browser." + "Warning: Printing is not fully supported by this browser." ) .then(printMessage => { this.error(printMessage); @@ -2555,14 +2559,13 @@ function webViewerKeyDown(evt) { (curElement && curElement.isContentEditable) ) { // Make sure that the secondary toolbar is closed when Escape is pressed. - if (evt.keyCode !== 27) { - // 'Esc' + if (evt.keyCode !== /* Esc = */ 27) { return; } } + // No control key pressed at all. if (cmd === 0) { - // no control key pressed at all. let turnPage = 0, turnOnlyIfPageFit = false; switch (evt.keyCode) { @@ -2680,8 +2683,8 @@ function webViewerKeyDown(evt) { } } + // shift-key if (cmd === 4) { - // shift-key switch (evt.keyCode) { case 13: // enter key case 32: // spacebar diff --git a/web/chromecom.js b/web/chromecom.js index 4cf7d1bad19025..b3c80502907768 100644 --- a/web/chromecom.js +++ b/web/chromecom.js @@ -22,7 +22,7 @@ import { GenericL10n } from "./genericl10n"; if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME")) { throw new Error( - 'Module "pdfjs-web/chromecom" shall not be used outside ' + "CHROME build." + 'Module "pdfjs-web/chromecom" shall not be used outside CHROME build.' ); } @@ -178,11 +178,9 @@ function requestAccessToLocalFile(fileUrl, overlayManager, callback) { // Use Chrome's definition of UI language instead of PDF.js's #lang=..., // because the shown string should match the UI at chrome://extensions. // These strings are from chrome/app/resources/generated_resources_*.xtb. - /* eslint-disable no-unexpected-multiline */ let i18nFileAccessLabel = PDFJSDev.json( "$ROOT/web/chrome-i18n-allow-access-to-file-urls.json" )[chrome.i18n.getUILanguage && chrome.i18n.getUILanguage()]; - /* eslint-enable no-unexpected-multiline */ if (i18nFileAccessLabel) { document.getElementById( diff --git a/web/firefoxcom.js b/web/firefoxcom.js index 9988aabeb3caa1..df580728c2e7fa 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -217,7 +217,7 @@ class MozL10n { // Avoid attempting to needlessly reset the zoom level *twice* in a row, // when using the `Ctrl + 0` keyboard shortcut. if ( - type === "zoomreset" && // eslint-disable-next-line max-len + type === "zoomreset" && PDFViewerApplication.pdfViewer.currentScaleValue === DEFAULT_SCALE_VALUE ) { return; diff --git a/web/overlay_manager.js b/web/overlay_manager.js index e4b8d3491823b5..ef2d9b47c77072 100644 --- a/web/overlay_manager.js +++ b/web/overlay_manager.js @@ -119,8 +119,7 @@ class OverlayManager { * @private */ _keyDown(evt) { - if (this._active && evt.keyCode === 27) { - // Esc key. + if (this._active && evt.keyCode === /* Esc = */ 27) { this._closeThroughCaller(); evt.preventDefault(); } diff --git a/web/password_prompt.js b/web/password_prompt.js index 6cafe7e514ffac..1706fec8d35792 100644 --- a/web/password_prompt.js +++ b/web/password_prompt.js @@ -52,8 +52,7 @@ class PasswordPrompt { this.submitButton.addEventListener("click", this.verify.bind(this)); this.cancelButton.addEventListener("click", this.close.bind(this)); this.input.addEventListener("keydown", e => { - if (e.keyCode === 13) { - // Enter key + if (e.keyCode === /* Enter = */ 13) { this.verify(); } }); diff --git a/web/pdf_attachment_viewer.js b/web/pdf_attachment_viewer.js index 029a230dcffd6d..b36e49e54707b1 100644 --- a/web/pdf_attachment_viewer.js +++ b/web/pdf_attachment_viewer.js @@ -95,8 +95,8 @@ class PDFAttachmentViewer { } else if (PDFJSDev.test("CHROME")) { // In the Chrome extension, the URL is rewritten using the history API // in viewer.js, so an absolute URL must be generated. - // eslint-disable-next-line no-undef viewerUrl = + // eslint-disable-next-line no-undef chrome.runtime.getURL("/content/web/viewer.html") + "?file=" + encodeURIComponent(blobUrl + "#" + filename); diff --git a/web/pdf_cursor_tools.js b/web/pdf_cursor_tools.js index 88a3562efc4bbe..a99f34f5381ee8 100644 --- a/web/pdf_cursor_tools.js +++ b/web/pdf_cursor_tools.js @@ -86,9 +86,8 @@ class PDFCursorTools { } }; - switch ( - tool // Enable the new cursor tool. - ) { + // Enable the new cursor tool. + switch (tool) { case CursorTool.SELECT: disableActiveTool(); break; diff --git a/web/pdf_find_controller.js b/web/pdf_find_controller.js index 57e790d88f77da..7b7a06b3b6e39a 100644 --- a/web/pdf_find_controller.js +++ b/web/pdf_find_controller.js @@ -202,13 +202,13 @@ class PDFFindController { this._pageMatches = []; this._pageMatchesLength = []; this._state = null; + // Currently selected match. this._selected = { - // Currently selected match. pageIdx: -1, matchIdx: -1, }; + // Where the find algorithm currently is in the document. this._offset = { - // Where the find algorithm currently is in the document. pageIdx: null, matchIdx: null, wrapped: false, diff --git a/web/pdf_history.js b/web/pdf_history.js index e6c1b1f26bdc67..20d736d61848cf 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -352,8 +352,8 @@ class PDFHistory { let newUrl; if (this._updateUrl && destination && destination.hash) { const baseUrl = document.location.href.split("#")[0]; + // Prevent errors in Firefox. if (!baseUrl.startsWith("file://")) { - // Prevent errors in Firefox. newUrl = `${baseUrl}#${destination.hash}`; } } diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index 84fbcf3c8d7214..3c09cb7f175040 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -215,8 +215,8 @@ class PDFPageView { update(scale, rotation) { this.scale = scale || this.scale; + // The rotation may be zero. if (typeof rotation !== "undefined") { - // The rotation may be zero. this.rotation = rotation; } diff --git a/web/pdf_print_service.js b/web/pdf_print_service.js index b31241aa9b46fa..000b2a9c2c7e8a 100644 --- a/web/pdf_print_service.js +++ b/web/pdf_print_service.js @@ -300,7 +300,8 @@ window.addEventListener( ) { window.print(); - // The (browser) print dialog cannot be prevented from being shown in IE11. + // The (browser) print dialog cannot be prevented from being shown in + // IE11. event.preventDefault(); if (event.stopImmediatePropagation) { event.stopImmediatePropagation(); diff --git a/web/pdf_sidebar.js b/web/pdf_sidebar.js index ce7e1b4521b3ba..c7cec24f40178f 100644 --- a/web/pdf_sidebar.js +++ b/web/pdf_sidebar.js @@ -389,8 +389,8 @@ class PDFSidebar { removeNotification(view); return; } + // Remove all sidebar notifications on reset. for (view in SidebarView) { - // Remove all sidebar notifications on reset. removeNotification(SidebarView[view]); } diff --git a/web/toolbar.js b/web/toolbar.js index 912b68e9cb6dda..3f905def23c77b 100644 --- a/web/toolbar.js +++ b/web/toolbar.js @@ -250,11 +250,11 @@ class Toolbar { const width = select.clientWidth + SCALE_SELECT_CONTAINER_PADDING; select.setAttribute( "style", - "min-width: " + (width + SCALE_SELECT_PADDING) + "px;" + `min-width: ${width + SCALE_SELECT_PADDING}px;` ); container.setAttribute( "style", - "min-width: " + width + "px; " + "max-width: " + width + "px;" + `min-width: ${width}px; max-width: ${width}px;` ); } });