Merge pull request #12594 from Snuffleupagus/eslint-no-useless-escape
Enable the ESLint `no-useless-escape` rule (PR 12551 follow-up)
This commit is contained in:
		
						commit
						797feddc22
					
				@ -111,6 +111,7 @@
 | 
				
			|||||||
    "no-useless-call": "error",
 | 
					    "no-useless-call": "error",
 | 
				
			||||||
    "no-useless-catch": "error",
 | 
					    "no-useless-catch": "error",
 | 
				
			||||||
    "no-useless-concat": "error",
 | 
					    "no-useless-concat": "error",
 | 
				
			||||||
 | 
					    "no-useless-escape": "error",
 | 
				
			||||||
    "no-useless-return": "error",
 | 
					    "no-useless-return": "error",
 | 
				
			||||||
    "prefer-promise-reject-errors": "error",
 | 
					    "prefer-promise-reject-errors": "error",
 | 
				
			||||||
    "wrap-iife": ["error", "any"],
 | 
					    "wrap-iife": ["error", "any"],
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								external/builder/builder.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								external/builder/builder.js
									
									
									
									
										vendored
									
									
								
							@ -202,7 +202,7 @@ function preprocessCSS(mode, source, destination) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function expandImports(content, baseUrl) {
 | 
					  function expandImports(content, baseUrl) {
 | 
				
			||||||
    return content.replace(/^\s*@import\s+url\(([^\)]+)\);\s*$/gm, function (
 | 
					    return content.replace(/^\s*@import\s+url\(([^)]+)\);\s*$/gm, function (
 | 
				
			||||||
      all,
 | 
					      all,
 | 
				
			||||||
      url
 | 
					      url
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
 | 
				
			|||||||
@ -124,7 +124,7 @@ function safeSpawnSync(command, parameters, options) {
 | 
				
			|||||||
  options.shell = true;
 | 
					  options.shell = true;
 | 
				
			||||||
  // `options.shell = true` requires parameters to be quoted.
 | 
					  // `options.shell = true` requires parameters to be quoted.
 | 
				
			||||||
  parameters = parameters.map(param => {
 | 
					  parameters = parameters.map(param => {
 | 
				
			||||||
    if (!/[\s`~!#$*(){\[|\\;'"<>?]/.test(param)) {
 | 
					    if (!/[\s`~!#$*(){[|\\;'"<>?]/.test(param)) {
 | 
				
			||||||
      return param;
 | 
					      return param;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return '"' + param.replace(/([$\\"`])/g, "\\$1") + '"';
 | 
					    return '"' + param.replace(/([$\\"`])/g, "\\$1") + '"';
 | 
				
			||||||
 | 
				
			|||||||
@ -61,7 +61,7 @@ class Util extends PDFObject {
 | 
				
			|||||||
      throw new TypeError("First argument of printf must be a string");
 | 
					      throw new TypeError("First argument of printf must be a string");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const pattern = /%(,[0-4])?([\+ 0#]+)?([0-9]+)?(\.[0-9]+)?(.)/g;
 | 
					    const pattern = /%(,[0-4])?([+ 0#]+)?([0-9]+)?(\.[0-9]+)?(.)/g;
 | 
				
			||||||
    const PLUS = 1;
 | 
					    const PLUS = 1;
 | 
				
			||||||
    const SPACE = 2;
 | 
					    const SPACE = 2;
 | 
				
			||||||
    const ZERO = 4;
 | 
					    const ZERO = 4;
 | 
				
			||||||
 | 
				
			|||||||
@ -824,7 +824,7 @@ function escapeString(str) {
 | 
				
			|||||||
  // replace "(", ")", "\n", "\r" and "\"
 | 
					  // replace "(", ")", "\n", "\r" and "\"
 | 
				
			||||||
  // by "\(", "\)", "\\n", "\\r" and "\\"
 | 
					  // by "\(", "\)", "\\n", "\\r" and "\\"
 | 
				
			||||||
  // in order to write it in a PDF file.
 | 
					  // in order to write it in a PDF file.
 | 
				
			||||||
  return str.replace(/([\(\)\\\n\r])/g, match => {
 | 
					  return str.replace(/([()\\\n\r])/g, match => {
 | 
				
			||||||
    if (match === "\n") {
 | 
					    if (match === "\n") {
 | 
				
			||||||
      return "\\n";
 | 
					      return "\\n";
 | 
				
			||||||
    } else if (match === "\r") {
 | 
					    } else if (match === "\r") {
 | 
				
			||||||
 | 
				
			|||||||
@ -165,7 +165,7 @@ WebServer.prototype = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      var range = req.headers.range;
 | 
					      var range = req.headers.range;
 | 
				
			||||||
      if (range && !disableRangeRequests) {
 | 
					      if (range && !disableRangeRequests) {
 | 
				
			||||||
        var rangesMatches = /^bytes=(\d+)\-(\d+)?/.exec(range);
 | 
					        var rangesMatches = /^bytes=(\d+)-(\d+)?/.exec(range);
 | 
				
			||||||
        if (!rangesMatches) {
 | 
					        if (!rangesMatches) {
 | 
				
			||||||
          res.writeHead(501);
 | 
					          res.writeHead(501);
 | 
				
			||||||
          res.end("Bad range", "utf8");
 | 
					          res.end("Bad range", "utf8");
 | 
				
			||||||
 | 
				
			|||||||
@ -1552,7 +1552,7 @@ const PDFViewerApplication = {
 | 
				
			|||||||
        if (!producer.includes(generator)) {
 | 
					        if (!producer.includes(generator)) {
 | 
				
			||||||
          return false;
 | 
					          return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        generatorId = generator.replace(/[ .\-]/g, "_");
 | 
					        generatorId = generator.replace(/[ .-]/g, "_");
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -115,7 +115,7 @@ var FontInspector = (function FontInspectorClosure() {
 | 
				
			|||||||
      name.textContent = fontName;
 | 
					      name.textContent = fontName;
 | 
				
			||||||
      var download = document.createElement("a");
 | 
					      var download = document.createElement("a");
 | 
				
			||||||
      if (url) {
 | 
					      if (url) {
 | 
				
			||||||
        url = /url\(['"]?([^\)"']+)/.exec(url);
 | 
					        url = /url\(['"]?([^)"']+)/.exec(url);
 | 
				
			||||||
        download.href = url[1];
 | 
					        download.href = url[1];
 | 
				
			||||||
      } else if (fontObj.data) {
 | 
					      } else if (fontObj.data) {
 | 
				
			||||||
        download.href = URL.createObjectURL(
 | 
					        download.href = URL.createObjectURL(
 | 
				
			||||||
 | 
				
			|||||||
@ -617,10 +617,10 @@ function getPDFFileNameFromURL(url, defaultFilename = "document.pdf") {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
    return defaultFilename;
 | 
					    return defaultFilename;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  const reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
 | 
					  const reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
 | 
				
			||||||
  //              SCHEME        HOST        1.PATH  2.QUERY   3.REF
 | 
					  //              SCHEME        HOST        1.PATH  2.QUERY   3.REF
 | 
				
			||||||
  // Pattern to get last matching NAME.pdf
 | 
					  // Pattern to get last matching NAME.pdf
 | 
				
			||||||
  const reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
 | 
					  const reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
 | 
				
			||||||
  const splitURI = reURI.exec(url);
 | 
					  const splitURI = reURI.exec(url);
 | 
				
			||||||
  let suggestedFilename =
 | 
					  let suggestedFilename =
 | 
				
			||||||
    reFilename.exec(splitURI[1]) ||
 | 
					    reFilename.exec(splitURI[1]) ||
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user