Fix eslint errors

Test: npm run lint:check
Bug: b/263471740
Change-Id: I8289c8b22d5af5e85fd94ccebf1d82abb0a062c2
This commit is contained in:
Kean Mariotti
2022-12-30 10:15:54 +00:00
parent 1a06fc399f
commit 83fdc7fbe0
13 changed files with 18 additions and 18 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
let webpackConfig = require("./webpack.config.common");
const webpackConfig = require("./webpack.config.common");
delete webpackConfig.entry;
delete webpackConfig.output;

View File

@@ -42,7 +42,7 @@ export default class ObjectFormatter {
private static FLICKER_INTDEF_MAP = readIntdefMap();
static cloneObject(entry: any): any {
let obj: any = {}
const obj: any = {}
const properties = ObjectFormatter.getProperties(entry);
properties.forEach(prop => obj[prop] = entry[prop]);
return obj;
@@ -81,7 +81,8 @@ export default class ObjectFormatter {
props.push(prop);
}
});
} while (obj = Object.getPrototypeOf(obj));
obj = Object.getPrototypeOf(obj);
} while (obj);
return props;
}

View File

@@ -99,6 +99,7 @@ const Region = require('flicker').com.android.server.wm.traces.common.region.Reg
// Service
const TaggingEngine = require('flicker').com.android.server.wm.traces.common.service.TaggingEngine;
const EMPTY_SIZE = Size.Companion.EMPTY;
const EMPTY_BUFFER = ActiveBuffer.Companion.EMPTY;
const EMPTY_COLOR3 = Color3.Companion.EMPTY;
const EMPTY_COLOR = Color.Companion.EMPTY;
@@ -113,14 +114,14 @@ const EMPTY_TRANSFORM = new Transform(0, EMPTY_MATRIX33);
function toSize(proto) {
if (proto == null) {
return EMPTY_BOUNDS;
return EMPTY_SIZE;
}
const width = proto.width ?? proto.w ?? 0;
const height = proto.height ?? proto.h ?? 0;
if (width || height) {
return new Size(width, height);
}
return EMPTY_BOUNDS;
return EMPTY_SIZE;
}
function toActiveBuffer(proto) {

View File

@@ -41,7 +41,7 @@ Layer.fromProto = function (proto: any, excludesCompositionState = false): Layer
let crop: Rect
if (proto.crop) {
crop = toRect(proto.crop)
};
}
const properties = new LayerProperties(
visibleRegion,

View File

@@ -65,7 +65,7 @@ function getDefaultTransform(type: number, x: number, y: number): Matrix33 {
}
export function isFlagSet(type: number, bits: number): Boolean {
var type = type || 0;
type = type || 0;
return (type & bits) === bits;
}

View File

@@ -105,7 +105,7 @@ function createConfiguration(proto: any): Configuration {
if (proto == null) {
return null;
}
var windowConfiguration = null;
let windowConfiguration = null;
if (proto != null && proto.windowConfiguration != null) {
windowConfiguration = createWindowConfiguration(proto.windowConfiguration);

View File

@@ -34,10 +34,10 @@ WindowManagerState.fromProto = function (
realToElapsedTimeOffsetNs: bigint|undefined = undefined,
useElapsedTime = false,
): WindowManagerState {
var inputMethodWIndowAppToken = "";
const inputMethodWIndowAppToken = "";
if (proto.inputMethodWindow != null) {
proto.inputMethodWindow.hashCode.toString(16)
};
}
let parseOrder = 0;
const nextSeq = () => ++parseOrder;

View File

@@ -109,7 +109,7 @@ function getWindowType(proto: any, identifierName: string): number {
}
function getName(identifierName: string): string {
var name = identifierName;
let name = identifierName;
if (identifierName.startsWith(WindowState.STARTING_WINDOW_PREFIX)) {
name = identifierName.substring(WindowState.STARTING_WINDOW_PREFIX.length);

View File

@@ -32,10 +32,8 @@ export class Timestamp {
throw new Error("realToElapsedTimeOffsetNs can't be undefined to use real timestamp");
}
return new Timestamp(TimestampType.REAL, elapsedTimestamp + realToElapsedTimeOffsetNs);
break;
case TimestampType.ELAPSED:
return new Timestamp(TimestampType.ELAPSED, elapsedTimestamp);
break;
default:
throw new Error("Unhandled timestamp type");
}

View File

@@ -68,7 +68,7 @@ abstract class Parser {
}
for (const fieldName in protoObj.$type.fields) {
if (protoObj.$type.fields.hasOwnProperty(fieldName)) {
if (Object.prototype.hasOwnProperty.call(protoObj.$type.fields, fieldName)) {
const fieldProperties = protoObj.$type.fields[fieldName];
const field = protoObj[fieldName];

View File

@@ -60,7 +60,7 @@ export class AppComponent {
static readonly TARGET = "http://localhost:8080";
static readonly TIMESTAMP_IN_BUGREPORT_MESSAGE = 1670509911000000000n;
private winscope: WindowProxy|null = null;
private winscope: Window|null = null;
private isWinscopeUp = false;
private onMessagePongReceived = FunctionUtils.DO_NOTHING;

View File

@@ -53,7 +53,7 @@ class ProxyRequest {
method: string,
path: string,
onSuccess: ((request: XMLHttpRequest) => void|Promise<void>) | undefined,
type?: XMLHttpRequestResponseType,
type?: XMLHttpRequest['responseType'],
jsonRequest: any = null
): Promise<void> {
return new Promise((resolve) => {

View File

@@ -16,7 +16,7 @@
const path = require('path');
const glob = require('glob');
let config = require('./webpack.config.common');
const config = require('./webpack.config.common');
config["mode"] = "development";
@@ -25,7 +25,7 @@ const allTestFiles = [
...glob.sync('./src/**/*.spec.ts')
]
const unitTestFiles = allTestFiles
.filter(file => !file.match(".*component\.spec\.(js|ts)$"))
.filter(file => !file.match(".*component\\.spec\\.(js|ts)$"))
.filter(file => !file.match(".*e2e.*"))
config["entry"] = {
tests: unitTestFiles,