fix strict typescript unused checks

pull/2958/head
43081j 6 years ago
parent 46bb5fdfb5
commit 1ea7dd1253

@ -1,2 +1,3 @@
**/_actual.js
**/expected.js
test/*/samples/*/output.js

@ -363,7 +363,7 @@ export default class Component {
result = result
.replace(/__svelte:self__/g, this.name)
.replace(compile_options.generate === 'ssr' ? /(@+|#+)(\w*(?:-\w*)?)/g : /(@+)(\w*(?:-\w*)?)/g, (match: string, sigil: string, name: string) => {
.replace(compile_options.generate === 'ssr' ? /(@+|#+)(\w*(?:-\w*)?)/g : /(@+)(\w*(?:-\w*)?)/g, (_match: string, sigil: string, name: string) => {
if (sigil === '@') {
if (internal_exports.has(name)) {
if (compile_options.dev && internal_exports.has(`${name}Dev`)) name = `${name}Dev`;
@ -398,7 +398,7 @@ export default class Component {
this.source
);
const parts = module.split('✂]');
const parts = module.split('✂]');
const final_chunk = parts.pop();
const compiled = new Bundle({ separator: '' });
@ -411,7 +411,7 @@ export default class Component {
const { filename } = compile_options;
// special case — the source file doesn't actually get used anywhere. we need
// special case — the source file doesn't actually get used anywhere. we need
// to add an empty file to populate map.sources and map.sourcesContent
if (!parts.length) {
compiled.addSource({
@ -420,7 +420,7 @@ export default class Component {
});
}
const pattern = /\[✂(\d+)-(\d+)$/;
const pattern = /\[✂(\d+)-(\d+)$/;
parts.forEach((str: string) => {
const chunk = str.replace(pattern, '');
@ -494,7 +494,7 @@ export default class Component {
reserved.forEach(add);
internal_exports.forEach(add);
this.var_lookup.forEach((value, key) => add(key));
this.var_lookup.forEach((_value, key) => add(key));
return (name: string) => {
if (test) name = `${name}$`;
@ -644,7 +644,7 @@ export default class Component {
script.content.body.forEach((node) => {
if (this.hoistable_nodes.has(node) || this.reactive_declaration_nodes.has(node)) {
if (a !== b) result += `[✂${a}-${b}✂]`;
if (a !== b) result += `[✂${a}-${b}✂]`;
a = node.end;
}
@ -656,7 +656,7 @@ export default class Component {
b = script.content.end;
while (/\s/.test(this.source[b - 1])) b -= 1;
if (a < b) result += `[✂${a}-${b}✂]`;
if (a < b) result += `[✂${a}-${b}✂]`;
return result || null;
}
@ -761,7 +761,7 @@ export default class Component {
this.node_for_declaration.set(name, node);
});
globals.forEach((node, name) => {
globals.forEach((_node, name) => {
if (this.var_lookup.has(name)) return;
if (this.injected_reactive_declaration_vars.has(name)) {
@ -1107,7 +1107,7 @@ export default class Component {
});
hoistable_nodes.add(node);
this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
}
}
@ -1199,7 +1199,7 @@ export default class Component {
remove_indentation(this.code, node);
this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
}
}
}

@ -64,7 +64,7 @@ const precedence: Record<string, (node?: Node) => number> = {
type Owner = Wrapper | INode;
function get_function_name(node, parent) {
function get_function_name(_node, parent) {
if (parent.type === 'EventHandler') {
return `${parent.name}_handler`;
}
@ -374,7 +374,7 @@ export default class Expression {
throw new Error(`Well that's odd`);
}
// TOOD optimisation — if this is an event handler,
// TOOD optimisation — if this is an event handler,
// the return value doesn't matter
}
@ -513,6 +513,6 @@ export default class Expression {
});
}
return this.rendered = `[✂${this.node.start}-${this.node.end}✂]`;
return this.rendered = `[✂${this.node.start}-${this.node.end}✂]`;
}
}

@ -17,7 +17,7 @@ export default class Node {
var: string;
attributes: Attribute[];
constructor(component: Component, parent, scope, info: any) {
constructor(component: Component, parent, _scope, info: any) {
this.start = info.start;
this.end = info.end;
this.type = info.type;

@ -371,7 +371,7 @@ export default class Block {
return {
${properties}
};
`.replace(/(#+)(\w*)/g, (match: string, sigil: string, name: string) => {
`.replace(/(#+)(\w*)/g, (_match: string, sigil: string, name: string) => {
return sigil === '#' ? this.alias(name) : sigil.slice(1) + name;
});
}

@ -41,7 +41,7 @@ const events = [
{
event_names: ['resize'],
filter: (node: Element, name: string) =>
filter: (_node: Element, name: string) =>
dimensions.test(name)
},
@ -440,7 +440,7 @@ export default class ElementWrapper extends Wrapper {
binding.render(block, lock);
});
// media bindings — awkward special case. The native timeupdate events
// media bindings — awkward special case. The native timeupdate events
// fire too infrequently, so we need to take matters into our
// own hands
let animation_frame;
@ -453,7 +453,7 @@ export default class ElementWrapper extends Wrapper {
let callee;
// TODO dry this out — similar code for event handlers and component bindings
// TODO dry this out — similar code for event handlers and component bindings
if (has_local_function) {
// need to create a block-local function that calls an instance-level function
block.builders.init.add_block(deindent`

@ -201,7 +201,7 @@ export default class IfBlockWrapper extends Wrapper {
render_compound(
block: Block,
parent_node: string,
parent_nodes: string,
_parent_nodes: string,
dynamic,
{ name, anchor, has_else, if_name, has_transitions },
detaching
@ -265,7 +265,7 @@ export default class IfBlockWrapper extends Wrapper {
render_compound_with_outros(
block: Block,
parent_node: string,
parent_nodes: string,
_parent_nodes: string,
dynamic,
{ name, anchor, has_else, has_transitions },
detaching
@ -386,7 +386,7 @@ export default class IfBlockWrapper extends Wrapper {
render_simple(
block: Block,
parent_node: string,
parent_nodes: string,
_parent_nodes: string,
dynamic,
{ name, anchor, if_name, has_transitions },
detaching
@ -429,7 +429,7 @@ export default class IfBlockWrapper extends Wrapper {
}
`;
// no `p()` here we don't want to update outroing nodes,
// no `p()` here — we don't want to update outroing nodes,
// as that will typically result in glitching
const exit = branch.block.has_outro_method
? deindent`

@ -132,7 +132,7 @@ export function create_scopes(expression: Node) {
},
});
scope.declarations.forEach((node, name) => {
scope.declarations.forEach((_node, name) => {
globals.delete(name);
});

@ -35,6 +35,6 @@ export function flip(node: Element, animation: { from: DOMRect; to: DOMRect }, p
delay,
duration: is_function(duration) ? duration(d) : duration,
easing,
css: (t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);`
css: (_t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);`
};
}

@ -148,7 +148,7 @@ if (typeof HTMLElement !== 'undefined') {
}
}
attributeChangedCallback(attr, oldValue, newValue) {
attributeChangedCallback(attr, _oldValue, newValue) {
this[attr] = newValue;
}

@ -39,7 +39,8 @@ export function element<K extends keyof HTMLElementTagNameMap>(name: K) {
}
export function object_without_properties<T, K extends keyof T>(obj: T, exclude: K[]) {
const target: Pick<T, Exclude<keyof T, K>> = {};
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
const target = {} as Pick<T, Exclude<keyof T, K>>;
for (const k in obj) {
if (
Object.prototype.hasOwnProperty.call(obj, k)

@ -124,7 +124,7 @@ export function scale(node: Element, {
delay,
duration,
easing,
css: (t, u) => `
css: (_t, u) => `
transform: ${transform} scale(${1 - (sd * u)});
opacity: ${target_opacity - (od * u)}
`

Loading…
Cancel
Save