Skip to content

Commit 2fc1d8a

Browse files
authored
chore(tsc): enable noUnusedLocals compiler option for tns-core-modules (NativeScript#5755)
1 parent 9d21a74 commit 2fc1d8a

40 files changed

Lines changed: 68 additions & 178 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"unit-test": "tsc -p tsconfig.unit-tests.json && mocha --opts unit-tests/mocha.opts",
5656
"unit-test-watch": "mocha-typescript-watch -p tsconfig.unit-tests.json --opts unit-tests/mocha.opts",
5757
"compile-all": "npm run tsc -- -p tsconfig.json --outDir bin/dist",
58-
"compile-modules": "npm run tsc -- -p tsconfig-modules.json --outDir bin/dist",
58+
"compile-modules": "npm run tsc -- -p tsconfig.modules.json --outDir bin/dist",
5959
"compile-check-base-dts": "npm run tsc -- -p tsconfig.base-dts.json",
6060
"compile-unit-tests": "npm run tsc -- -p tsconfig.unit-tests.json --outDir bin/dist/unit-tests",
6161
"compile-check-combined-dts": "npm run tsc -- -p tsconfig.combined-dts.json",

tns-core-modules/application/application.ios.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export * from "./application-common";
1818
import { createViewFromEntry } from "../ui/builder";
1919
import { ios as iosView, View } from "../ui/core/view";
2020
import { Frame, NavigationEntry } from "../ui/frame";
21-
import { ios } from "../ui/utils";
2221
import * as utils from "../utils/utils";
2322
import { profile, level as profilingLevel, Level } from "../profiling";
2423

tns-core-modules/css/parser.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export type Parsed<V> = { start: number, end: number, value: V };
22

3-
import * as reworkcss from "./reworkcss";
4-
53
// Values
64
export type ARGB = number;
75
export type URL = string;
@@ -833,7 +831,7 @@ const doubleQuoteStringRegEx = /"((?:[^\n\r\f\"]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?)
833831
const commentRegEx = /(\/\*(?:[^\*]|\*[^\/])*\*\/)/gym;
834832
const numberRegEx = /[\+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][\+\-]?\d+)?/gym;
835833
const nameRegEx = /-?(?:(?:[a-zA-Z_]|[^\x00-\x7F]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))(?:[a-zA-Z_0-9\-]*|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)/gym;
836-
const nonQuoteURLRegEx = /(:?[^\)\s\t\n\r\f\'\"\(]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*/gym; // TODO: non-printable code points omitted
834+
// const nonQuoteURLRegEx = /(:?[^\)\s\t\n\r\f\'\"\(]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*/gym; // TODO: non-printable code points omitted
837835

838836
type InputToken = "(" | ")" | "{" | "}" | "[" | "]" | ":" | ";" | "," | " " | "^=" | "|=" | "$=" | "*=" | "~=" | "<!--" | "-->" | undefined /* <EOF-token> */ | InputTokenObject | FunctionInputToken | FunctionToken | SimpleBlock | AtKeywordToken;
839837

@@ -1025,7 +1023,7 @@ export class CSS3Parser {
10251023

10261024
private consumeAWhitespace(): InputToken {
10271025
whitespaceRegEx.lastIndex = this.nextInputCodePointIndex;
1028-
const result = whitespaceRegEx.exec(this.text);
1026+
whitespaceRegEx.exec(this.text);
10291027
this.nextInputCodePointIndex = whitespaceRegEx.lastIndex;
10301028
return " ";
10311029
}

tns-core-modules/debugger/webinspector-css.ios.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import * as inspectorCommandTypes from "./InspectorBackendCommands.ios";
22
var inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBackendCommands");
33

44
import * as debuggerDomains from "./debugger";
5-
import * as devToolsElements from "./devtools-elements";
6-
7-
declare var __inspectorSendEvent;
85

96
import { attachCSSInspectorCommandCallbacks } from "./devtools-elements";
107

tns-core-modules/debugger/webinspector-dom.ios.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ var inspectorCommands: typeof inspectorCommandTypes = require("./InspectorBacken
33
// var inspectorCommandTypes: any = inspectorCommands;
44

55
import * as debuggerDomains from "./debugger";
6-
import * as devToolsElements from "./devtools-elements";
7-
8-
declare var __inspectorSendEvent;
96

107
import { attachDOMInspectorEventCallbacks, attachDOMInspectorCommandCallbacks } from "./devtools-elements";
118

tns-core-modules/file-system/file-system.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ export class FileSystemEntity {
137137
var path = parentFolder.path;
138138
var newPath = fileAccess.joinPath(path, newName);
139139

140-
var hasError = false;
141140
var localError = function (error) {
142-
hasError = true;
143141
if (onError) {
144142
onError(error);
145143
}

tns-core-modules/globals/globals.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ global.registerModule("fetch", () => require("fetch"));
126126
}
127127
}
128128

129-
const __tnsGlobalMergedModules = new Map<string, boolean>();
130-
131129
function registerOnGlobalContext(name: string, module: string): void {
132130

133131
Object.defineProperty(global, name, {

tns-core-modules/image-asset/image-asset.android.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as platform from "../platform";
21
import * as common from "./image-asset-common";
32
import { path as fsPath, knownFolders } from "../file-system";
43

@@ -89,30 +88,3 @@ var calculateAngleFromFile = function (filename: string) {
8988

9089
return rotationAngle;
9190
}
92-
93-
var calculateInSampleSize = function (imageWidth, imageHeight, reqWidth, reqHeight) {
94-
let sampleSize = 1;
95-
let displayWidth = platform.screen.mainScreen.widthDIPs;
96-
let displayHeigth = platform.screen.mainScreen.heightDIPs;
97-
reqWidth = (reqWidth > 0 && reqWidth < displayWidth) ? reqWidth : displayWidth;
98-
reqHeight = (reqHeight > 0 && reqHeight < displayHeigth) ? reqHeight : displayHeigth;
99-
if (imageWidth > reqWidth && imageHeight > reqHeight) {
100-
let halfWidth = imageWidth / 2;
101-
let halfHeight = imageHeight / 2;
102-
while ((halfWidth / sampleSize) > reqWidth && (halfHeight / sampleSize) > reqHeight) {
103-
sampleSize *= 2;
104-
}
105-
}
106-
107-
var totalPixels = (imageWidth / sampleSize) * (imageHeight / sampleSize);
108-
109-
// Anything more than 2x the requested pixels we'll sample down further
110-
var totalReqPixelsCap = reqWidth * reqHeight * 2;
111-
112-
while (totalPixels > totalReqPixelsCap) {
113-
sampleSize *= 2;
114-
totalPixels = (imageWidth / sampleSize) * (imageHeight / sampleSize);
115-
}
116-
117-
return sampleSize;
118-
}

tns-core-modules/ui/action-bar/action-bar.ios.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,7 @@ export class ActionBar extends ActionBarBase {
282282

283283
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) {
284284
const width = layout.getMeasureSpecSize(widthMeasureSpec);
285-
const widthMode = layout.getMeasureSpecMode(widthMeasureSpec);
286285
const height = layout.getMeasureSpecSize(heightMeasureSpec);
287-
const heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
288286

289287
if (this.titleView) {
290288
View.measureChild(this, this.titleView, UNSPECIFIED, UNSPECIFIED);

tns-core-modules/ui/animation/animation.ios.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ let _skip = "_skip";
1818

1919
let FLT_MAX = 340282346638528859811704183484516925440.000000;
2020

21-
declare var CASpringAnimation: any;
22-
2321
class AnimationInfo {
2422
public propertyNameToAnimate: string;
2523
public fromValue: any;

0 commit comments

Comments
 (0)