Merge pull request #9207 from Standard8/use-mozilla-recommended
Switch to using mozilla/recommended configuration for extensions/firefox.
This commit is contained in:
		
						commit
						371ca51402
					
				@ -1,47 +1,42 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  // Note: The root .eslintrc file will define the base rules,
 | 
				
			||||||
 | 
					  // but mozilla/recommended will override them for the rules it sets. Finally,
 | 
				
			||||||
 | 
					  // the rules in this file will take precedence.
 | 
				
			||||||
 | 
					  "extends": [
 | 
				
			||||||
 | 
					    "plugin:mozilla/recommended",
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  "parserOptions": {
 | 
					  "parserOptions": {
 | 
				
			||||||
 | 
					    // Note: Remove the ecmaVersion line when Gecko 52 is no longer supported
 | 
				
			||||||
 | 
					    // to pick up the eslint-plugin-mozilla version (or at least update to
 | 
				
			||||||
 | 
					    // ecmaVersion 8).
 | 
				
			||||||
    "ecmaVersion": 6,
 | 
					    "ecmaVersion": 6,
 | 
				
			||||||
    "sourceType": "script"
 | 
					    "ecmaFeatures": {
 | 
				
			||||||
 | 
					      // Note: We turn this off as it was only added in Gecko 55 (Bug 1339395)
 | 
				
			||||||
 | 
					      // and we still need to support older versions (eslint-plugin-mozilla turns
 | 
				
			||||||
 | 
					      // it on).
 | 
				
			||||||
 | 
					      "experimentalObjectRestSpread": false
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    "sourceType": "script",
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  "plugins": [
 | 
					  "plugins": [
 | 
				
			||||||
    "mozilla"
 | 
					    "mozilla"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  "globals": {
 | 
					 | 
				
			||||||
    "Components": false,
 | 
					 | 
				
			||||||
    "dump": false
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  "rules": {
 | 
					  "rules": {
 | 
				
			||||||
    "mozilla/import-globals": "error",
 | 
					    // Items different from the mozilla/recommended configuration.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Being enabled soon.
 | 
				
			||||||
    "mozilla/use-services": "error",
 | 
					    "mozilla/use-services": "error",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Best Practices
 | 
					    // Other rules mozilla/recommended hasn't enabled yet.
 | 
				
			||||||
    "consistent-return": "error",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Variables
 | 
					 | 
				
			||||||
    "no-shadow": "error",
 | 
					    "no-shadow": "error",
 | 
				
			||||||
    "no-unused-vars": ["error", {
 | 
					 | 
				
			||||||
      "vars": "local",
 | 
					 | 
				
			||||||
      "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
 | 
					 | 
				
			||||||
      "args": "none",
 | 
					 | 
				
			||||||
    }],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Stylistic Issues
 | 
					 | 
				
			||||||
    "no-nested-ternary": "error",
 | 
					 | 
				
			||||||
    "quotes": ["error", "double"],
 | 
					 | 
				
			||||||
    "space-before-function-paren": ["error", "never"],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // ECMAScript 6
 | 
					 | 
				
			||||||
    "arrow-body-style": ["error", "as-needed"],
 | 
					    "arrow-body-style": ["error", "as-needed"],
 | 
				
			||||||
    "arrow-parens": ["error", "always"],
 | 
					    "arrow-parens": ["error", "always"],
 | 
				
			||||||
    "arrow-spacing": ["error", { "before": true, "after": true, }],
 | 
					 | 
				
			||||||
    "constructor-super": "error",
 | 
					    "constructor-super": "error",
 | 
				
			||||||
    "no-confusing-arrow": "error",
 | 
					    "no-confusing-arrow": "error",
 | 
				
			||||||
    "no-const-assign": "error",
 | 
					 | 
				
			||||||
    "no-dupe-class-members": "error",
 | 
					 | 
				
			||||||
    "no-useless-constructor": "error",
 | 
					    "no-useless-constructor": "error",
 | 
				
			||||||
    "object-shorthand": ["error", "always", { "avoidQuotes": true }],
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15
									
								
								extensions/firefox/bootstrap.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								extensions/firefox/bootstrap.js
									
									
									
									
										vendored
									
									
								
							@ -29,21 +29,6 @@ const Cr = Components.results;
 | 
				
			|||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 | 
					Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 | 
				
			||||||
Cu.import("resource://gre/modules/Services.jsm");
 | 
					Cu.import("resource://gre/modules/Services.jsm");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getBoolPref(pref, def) {
 | 
					 | 
				
			||||||
  try {
 | 
					 | 
				
			||||||
    return Services.prefs.getBoolPref(pref);
 | 
					 | 
				
			||||||
  } catch (ex) {
 | 
					 | 
				
			||||||
    return def;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function log(str) {
 | 
					 | 
				
			||||||
  if (!getBoolPref(EXT_PREFIX + ".pdfBugEnabled", false)) {
 | 
					 | 
				
			||||||
    return;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  dump(str + "\n");
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function initializeDefaultPreferences() {
 | 
					function initializeDefaultPreferences() {
 | 
				
			||||||
  /* eslint-disable semi */
 | 
					  /* eslint-disable semi */
 | 
				
			||||||
  var DEFAULT_PREFERENCES =
 | 
					  var DEFAULT_PREFERENCES =
 | 
				
			||||||
 | 
				
			|||||||
@ -81,6 +81,7 @@ var PdfjsChromeUtils = {
 | 
				
			|||||||
      // omitting it in prior Firefox versions breaks the addon.
 | 
					      // omitting it in prior Firefox versions breaks the addon.
 | 
				
			||||||
      var ffVersion = parseInt(Services.appinfo.platformVersion);
 | 
					      var ffVersion = parseInt(Services.appinfo.platformVersion);
 | 
				
			||||||
      if (ffVersion <= 55) {
 | 
					      if (ffVersion <= 55) {
 | 
				
			||||||
 | 
					        // eslint-disable-next-line mozilla/no-useless-parameters
 | 
				
			||||||
        Services.obs.addObserver(this, "quit-application", false);
 | 
					        Services.obs.addObserver(this, "quit-application", false);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -52,6 +52,7 @@ var PdfjsContentUtils = {
 | 
				
			|||||||
      // omitting it in prior Firefox versions breaks the addon.
 | 
					      // omitting it in prior Firefox versions breaks the addon.
 | 
				
			||||||
      var ffVersion = parseInt(Services.appinfo.platformVersion);
 | 
					      var ffVersion = parseInt(Services.appinfo.platformVersion);
 | 
				
			||||||
      if (ffVersion <= 55) {
 | 
					      if (ffVersion <= 55) {
 | 
				
			||||||
 | 
					        // eslint-disable-next-line mozilla/no-useless-parameters
 | 
				
			||||||
        Services.obs.addObserver(this, "quit-application", false);
 | 
					        Services.obs.addObserver(this, "quit-application", false);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user