Bug 1270203 - make css-angle eslint-clean; r?nchevobbe
MozReview-Commit-ID: IfCMc8ewLDu
--- a/.eslintignore
+++ b/.eslintignore
@@ -96,16 +96,17 @@ devtools/client/netmonitor/har/test/**
devtools/client/performance/**
devtools/client/projecteditor/**
devtools/client/promisedebugger/**
devtools/client/responsivedesign/**
devtools/client/scratchpad/**
devtools/client/shadereditor/**
devtools/client/shared/*.js
devtools/client/shared/*.jsm
+!devtools/client/shared/css-angle.js
!devtools/client/shared/css-color.js
!devtools/client/shared/css-color-db.js
!devtools/client/shared/css-parsing-utils.js
devtools/client/shared/components/**
devtools/client/shared/redux/**
devtools/client/shared/test/**
devtools/client/shared/vendor/**
devtools/client/shared/widgets/**
--- a/devtools/client/shared/css-angle.js
+++ b/devtools/client/shared/css-angle.js
@@ -1,16 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const {Cc, Ci} = require("chrome");
-
const SPECIALVALUES = new Set([
"initial",
"inherit",
"unset"
]);
/**
* This module is used to convert between various angle units.
@@ -221,50 +219,50 @@ CssAngle.prototype = {
*
* @return {String|Boolean}
* - If the current angle is a special value e.g. "inherit" then
* return the angle.
* - If the angle is invalid return an empty string.
* - If the angle is a regular angle e.g. 90deg so we return false
* to indicate that the angle is neither invalid nor special.
*/
- _getInvalidOrSpecialValue: function() {
+ _getInvalidOrSpecialValue: function () {
if (this.specialValue) {
return this.specialValue;
}
if (!this.valid) {
return "";
}
return false;
},
/**
* Change angle
*
* @param {String} angle
* Any valid angle value + unit string
*/
- newAngle: function(angle) {
+ newAngle: function (angle) {
// Store a lower-cased version of the angle to help with format
// testing. The original text is kept as well so it can be
// returned when needed.
this.lowerCased = angle.toLowerCase();
this._angleUnitUppercase = (angle === angle.toUpperCase());
this.authored = angle;
let reg = new RegExp(
`(${Object.keys(CssAngle.ANGLEUNIT).join("|")})$`, "i");
let unitStartIdx = angle.search(reg);
this.authoredAngleValue = angle.substring(0, unitStartIdx);
this.authoredAngleUnit = angle.substring(unitStartIdx, angle.length);
return this;
},
- nextAngleUnit: function() {
+ nextAngleUnit: function () {
// Get a reordered array from the formats object
// to have the current format at the front so we can cycle through.
let formats = Object.keys(CssAngle.ANGLEUNIT);
let putOnEnd = formats.splice(0, formats.indexOf(this.angleUnit));
formats = formats.concat(putOnEnd);
let currentDisplayedValue = this[formats[0]];
for (let format of formats) {
@@ -274,17 +272,17 @@ CssAngle.prototype = {
}
}
return this.toString();
},
/**
* Return a string representing a angle
*/
- toString: function() {
+ toString: function () {
let angle;
switch (this.angleUnit) {
case CssAngle.ANGLEUNIT.deg:
angle = this.deg;
break;
case CssAngle.ANGLEUNIT.rad:
angle = this.rad;
@@ -304,17 +302,17 @@ CssAngle.prototype = {
angle = angle.toUpperCase();
}
return angle;
},
/**
* This method allows comparison of CssAngle objects using ===.
*/
- valueOf: function() {
+ valueOf: function () {
return this.deg;
},
};
/**
* Given a color, classify its type as one of the possible angle
* units, as known by |CssAngle.angleUnit|.
*