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-catch": "error",
 | 
			
		||||
    "no-useless-concat": "error",
 | 
			
		||||
    "no-useless-escape": "error",
 | 
			
		||||
    "no-useless-return": "error",
 | 
			
		||||
    "prefer-promise-reject-errors": "error",
 | 
			
		||||
    "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) {
 | 
			
		||||
    return content.replace(/^\s*@import\s+url\(([^\)]+)\);\s*$/gm, function (
 | 
			
		||||
    return content.replace(/^\s*@import\s+url\(([^)]+)\);\s*$/gm, function (
 | 
			
		||||
      all,
 | 
			
		||||
      url
 | 
			
		||||
    ) {
 | 
			
		||||
 | 
			
		||||
@ -124,7 +124,7 @@ function safeSpawnSync(command, parameters, options) {
 | 
			
		||||
  options.shell = true;
 | 
			
		||||
  // `options.shell = true` requires parameters to be quoted.
 | 
			
		||||
  parameters = parameters.map(param => {
 | 
			
		||||
    if (!/[\s`~!#$*(){\[|\\;'"<>?]/.test(param)) {
 | 
			
		||||
    if (!/[\s`~!#$*(){[|\\;'"<>?]/.test(param)) {
 | 
			
		||||
      return param;
 | 
			
		||||
    }
 | 
			
		||||
    return '"' + param.replace(/([$\\"`])/g, "\\$1") + '"';
 | 
			
		||||
 | 
			
		||||
@ -61,7 +61,7 @@ class Util extends PDFObject {
 | 
			
		||||
      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 SPACE = 2;
 | 
			
		||||
    const ZERO = 4;
 | 
			
		||||
 | 
			
		||||
@ -824,7 +824,7 @@ function escapeString(str) {
 | 
			
		||||
  // replace "(", ")", "\n", "\r" and "\"
 | 
			
		||||
  // by "\(", "\)", "\\n", "\\r" and "\\"
 | 
			
		||||
  // 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") {
 | 
			
		||||
      return "\\n";
 | 
			
		||||
    } else if (match === "\r") {
 | 
			
		||||
 | 
			
		||||
@ -165,7 +165,7 @@ WebServer.prototype = {
 | 
			
		||||
 | 
			
		||||
      var range = req.headers.range;
 | 
			
		||||
      if (range && !disableRangeRequests) {
 | 
			
		||||
        var rangesMatches = /^bytes=(\d+)\-(\d+)?/.exec(range);
 | 
			
		||||
        var rangesMatches = /^bytes=(\d+)-(\d+)?/.exec(range);
 | 
			
		||||
        if (!rangesMatches) {
 | 
			
		||||
          res.writeHead(501);
 | 
			
		||||
          res.end("Bad range", "utf8");
 | 
			
		||||
 | 
			
		||||
@ -1552,7 +1552,7 @@ const PDFViewerApplication = {
 | 
			
		||||
        if (!producer.includes(generator)) {
 | 
			
		||||
          return false;
 | 
			
		||||
        }
 | 
			
		||||
        generatorId = generator.replace(/[ .\-]/g, "_");
 | 
			
		||||
        generatorId = generator.replace(/[ .-]/g, "_");
 | 
			
		||||
        return true;
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -115,7 +115,7 @@ var FontInspector = (function FontInspectorClosure() {
 | 
			
		||||
      name.textContent = fontName;
 | 
			
		||||
      var download = document.createElement("a");
 | 
			
		||||
      if (url) {
 | 
			
		||||
        url = /url\(['"]?([^\)"']+)/.exec(url);
 | 
			
		||||
        url = /url\(['"]?([^)"']+)/.exec(url);
 | 
			
		||||
        download.href = url[1];
 | 
			
		||||
      } else if (fontObj.data) {
 | 
			
		||||
        download.href = URL.createObjectURL(
 | 
			
		||||
 | 
			
		||||
@ -617,10 +617,10 @@ function getPDFFileNameFromURL(url, defaultFilename = "document.pdf") {
 | 
			
		||||
    );
 | 
			
		||||
    return defaultFilename;
 | 
			
		||||
  }
 | 
			
		||||
  const reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
 | 
			
		||||
  const reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
 | 
			
		||||
  //              SCHEME        HOST        1.PATH  2.QUERY   3.REF
 | 
			
		||||
  // 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);
 | 
			
		||||
  let suggestedFilename =
 | 
			
		||||
    reFilename.exec(splitURI[1]) ||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user