Skip to content

Commit 82dc26a

Browse files
authored
Fix lint warnings (#5263)
1 parent 1d9e2a1 commit 82dc26a

File tree

235 files changed

+424
-423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+424
-423
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@rollup/plugin-sucrase": "^3.0.0",
6464
"@rollup/plugin-typescript": "^2.0.1",
6565
"@rollup/plugin-virtual": "^2.0.0",
66-
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v0.0.1",
66+
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.0.0",
6767
"@types/mocha": "^5.2.7",
6868
"@types/node": "^8.10.53",
6969
"@typescript-eslint/eslint-plugin": "^3.0.2",

src/compiler/compile/Component.ts

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
create_scopes,
99
extract_names,
1010
Scope,
11-
extract_identifiers,
11+
extract_identifiers
1212
} from './utils/scope';
1313
import Stylesheet from './css/Stylesheet';
1414
import { test } from '../config';
@@ -155,7 +155,7 @@ export default class Component {
155155
) || { start: 0, end: 0 };
156156
this.warn(svelteOptions, {
157157
code: 'custom-element-no-tag',
158-
message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag="my-thing"/>. To hide this warning, use <svelte:options tag={null}/>`,
158+
message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag="my-thing"/>. To hide this warning, use <svelte:options tag={null}/>`
159159
});
160160
}
161161
this.tag = this.component_options.tag || compile_options.tag;
@@ -190,15 +190,15 @@ export default class Component {
190190
this.add_var({
191191
name,
192192
injected: true,
193-
referenced: true,
193+
referenced: true
194194
});
195195
} else if (name[0] === '$') {
196196
this.add_var({
197197
name,
198198
injected: true,
199199
referenced: true,
200200
mutated: true,
201-
writable: true,
201+
writable: true
202202
});
203203

204204
const subscribable_name = name.slice(1);
@@ -289,7 +289,7 @@ export default class Component {
289289
}
290290
const imported_helpers = Array.from(this.helpers, ([name, alias]) => ({
291291
name,
292-
alias,
292+
alias
293293
}));
294294

295295
create_module(
@@ -305,7 +305,7 @@ export default class Component {
305305
.filter(variable => variable.module && variable.export_name)
306306
.map(variable => ({
307307
name: variable.name,
308-
as: variable.export_name,
308+
as: variable.export_name
309309
}))
310310
);
311311

@@ -342,9 +342,9 @@ export default class Component {
342342
reassigned: v.reassigned || false,
343343
referenced: v.referenced || false,
344344
writable: v.writable || false,
345-
referenced_from_script: v.referenced_from_script || false,
345+
referenced_from_script: v.referenced_from_script || false
346346
})),
347-
stats: this.stats.render(),
347+
stats: this.stats.render()
348348
};
349349
}
350350

@@ -409,7 +409,7 @@ export default class Component {
409409
source: this.source,
410410
start: pos.start,
411411
end: pos.end,
412-
filename: this.compile_options.filename,
412+
filename: this.compile_options.filename
413413
});
414414
}
415415

@@ -441,7 +441,7 @@ export default class Component {
441441
pos: pos.start,
442442
filename: this.compile_options.filename,
443443
toString: () =>
444-
`${warning.message} (${start.line}:${start.column})\n${frame}`,
444+
`${warning.message} (${start.line}:${start.column})\n${frame}`
445445
});
446446
}
447447

@@ -453,15 +453,15 @@ export default class Component {
453453
if (node.type === 'ExportDefaultDeclaration') {
454454
this.error(node, {
455455
code: `default-export`,
456-
message: `A component cannot have a default export`,
456+
message: `A component cannot have a default export`
457457
});
458458
}
459459

460460
if (node.type === 'ExportNamedDeclaration') {
461461
if (node.source) {
462462
this.error(node, {
463463
code: `not-implemented`,
464-
message: `A component currently cannot have an export ... from`,
464+
message: `A component currently cannot have an export ... from`
465465
});
466466
}
467467
if (node.declaration) {
@@ -531,10 +531,10 @@ export default class Component {
531531
if (node.type === 'LabeledStatement' && node.label.name === '$') {
532532
component.warn(node as any, {
533533
code: 'module-script-reactive-declaration',
534-
message: '$: has no effect in a module script',
534+
message: '$: has no effect in a module script'
535535
});
536536
}
537-
},
537+
}
538538
});
539539

540540
const { scope, globals } = create_scopes(script.content);
@@ -544,7 +544,7 @@ export default class Component {
544544
if (name[0] === '$') {
545545
this.error(node as any, {
546546
code: 'illegal-declaration',
547-
message: `The $ prefix is reserved, and cannot be used for variable and import names`,
547+
message: `The $ prefix is reserved, and cannot be used for variable and import names`
548548
});
549549
}
550550

@@ -562,7 +562,7 @@ export default class Component {
562562
if (name[0] === '$') {
563563
this.error(node as any, {
564564
code: 'illegal-subscription',
565-
message: `Cannot reference store value inside <script context="module">`,
565+
message: `Cannot reference store value inside <script context="module">`
566566
});
567567
} else {
568568
this.add_var({
@@ -623,7 +623,7 @@ export default class Component {
623623
if (name[0] === '$') {
624624
this.error(node as any, {
625625
code: 'illegal-declaration',
626-
message: `The $ prefix is reserved, and cannot be used for variable and import names`,
626+
message: `The $ prefix is reserved, and cannot be used for variable and import names`
627627
});
628628
}
629629

@@ -647,12 +647,12 @@ export default class Component {
647647
injected: true,
648648
writable: true,
649649
reassigned: true,
650-
initialised: true,
650+
initialised: true
651651
});
652652
} else if (is_reserved_keyword(name)) {
653653
this.add_var({
654654
name,
655-
injected: true,
655+
injected: true
656656
});
657657
} else if (name[0] === '$') {
658658
if (name === '$' || name[1] === '$') {
@@ -666,7 +666,7 @@ export default class Component {
666666
name,
667667
injected: true,
668668
mutated: true,
669-
writable: true,
669+
writable: true
670670
});
671671

672672
this.add_reference(name.slice(1));
@@ -764,7 +764,7 @@ export default class Component {
764764
if (map.has(node)) {
765765
scope = scope.parent;
766766
}
767-
},
767+
}
768768
});
769769

770770
for (const [parent, prop, index] of to_remove) {
@@ -832,7 +832,7 @@ export default class Component {
832832
if (map.has(node)) {
833833
scope = scope.parent;
834834
}
835-
},
835+
}
836836
});
837837
}
838838

@@ -844,7 +844,7 @@ export default class Component {
844844
) {
845845
this.warn(node as any, {
846846
code: 'non-top-level-reactive-declaration',
847-
message: '$: has no effect outside of the top-level',
847+
message: '$: has no effect outside of the top-level'
848848
});
849849
}
850850

@@ -881,7 +881,7 @@ export default class Component {
881881
if (node.body.type !== 'BlockStatement') {
882882
node.body = {
883883
type: 'BlockStatement',
884-
body: [node.body],
884+
body: [node.body]
885885
};
886886
}
887887
node.body.body.push(inside[0]);
@@ -890,8 +890,8 @@ export default class Component {
890890
type: 'BlockStatement',
891891
body: [
892892
before[0],
893-
node,
894-
],
893+
node
894+
]
895895
};
896896
}
897897
return null;
@@ -927,7 +927,7 @@ export default class Component {
927927
// TODO is this still true post-#3539?
928928
component.error(declarator as any, {
929929
code: 'destructured-prop',
930-
message: `Cannot declare props in destructured declaration`,
930+
message: `Cannot declare props in destructured declaration`
931931
});
932932
}
933933

@@ -990,7 +990,7 @@ export default class Component {
990990
if (node.type === 'ExportNamedDeclaration' && node.declaration) {
991991
(parent as Program).body[index] = node.declaration;
992992
}
993-
},
993+
}
994994
});
995995
}
996996

@@ -1004,7 +1004,7 @@ export default class Component {
10041004
hoistable_nodes,
10051005
var_lookup,
10061006
injected_reactive_declaration_vars,
1007-
imports,
1007+
imports
10081008
} = this;
10091009

10101010
const top_level_function_declarations = new Map();
@@ -1136,7 +1136,7 @@ export default class Component {
11361136
if (map.has(node)) {
11371137
scope = scope.parent;
11381138
}
1139-
},
1139+
}
11401140
});
11411141

11421142
checked.add(fn_declaration);
@@ -1229,7 +1229,7 @@ export default class Component {
12291229
if (map.has(node)) {
12301230
scope = scope.parent;
12311231
}
1232-
},
1232+
}
12331233
});
12341234

12351235
const { expression } = node.body as ExpressionStatement;
@@ -1239,7 +1239,7 @@ export default class Component {
12391239
assignees,
12401240
dependencies,
12411241
node,
1242-
declaration,
1242+
declaration
12431243
});
12441244
}
12451245
});
@@ -1320,7 +1320,7 @@ export default class Component {
13201320

13211321
this.warn(node, {
13221322
code: 'missing-declaration',
1323-
message,
1323+
message
13241324
});
13251325
}
13261326

@@ -1343,7 +1343,7 @@ function process_component_options(component: Component, nodes) {
13431343
'accessors' in component.compile_options
13441344
? component.compile_options.accessors
13451345
: !!component.compile_options.customElement,
1346-
preserveWhitespace: !!component.compile_options.preserveWhitespace,
1346+
preserveWhitespace: !!component.compile_options.preserveWhitespace
13471347
};
13481348

13491349
const node = nodes.find(node => node.name === 'svelte:options');
@@ -1384,7 +1384,7 @@ function process_component_options(component: Component, nodes) {
13841384
if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) {
13851385
component.error(attribute, {
13861386
code: `invalid-tag-property`,
1387-
message: `tag name must be two or more words joined by the '-' character`,
1387+
message: `tag name must be two or more words joined by the '-' character`
13881388
});
13891389
}
13901390

@@ -1412,12 +1412,12 @@ function process_component_options(component: Component, nodes) {
14121412
if (match) {
14131413
component.error(attribute, {
14141414
code: `invalid-namespace-property`,
1415-
message: `Invalid namespace '${ns}' (did you mean '${match}'?)`,
1415+
message: `Invalid namespace '${ns}' (did you mean '${match}'?)`
14161416
});
14171417
} else {
14181418
component.error(attribute, {
14191419
code: `invalid-namespace-property`,
1420-
message: `Invalid namespace '${ns}'`,
1420+
message: `Invalid namespace '${ns}'`
14211421
});
14221422
}
14231423
}
@@ -1443,13 +1443,13 @@ function process_component_options(component: Component, nodes) {
14431443
default:
14441444
component.error(attribute, {
14451445
code: `invalid-options-attribute`,
1446-
message: `<svelte:options> unknown attribute`,
1446+
message: `<svelte:options> unknown attribute`
14471447
});
14481448
}
14491449
} else {
14501450
component.error(attribute, {
14511451
code: `invalid-options-attribute`,
1452-
message: `<svelte:options> can only have static 'tag', 'namespace', 'accessors', 'immutable' and 'preserveWhitespace' attributes`,
1452+
message: `<svelte:options> can only have static 'tag', 'namespace', 'accessors', 'immutable' and 'preserveWhitespace' attributes`
14531453
});
14541454
}
14551455
});

src/compiler/compile/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
5252
code: `options-lowercase-name`,
5353
message,
5454
filename,
55-
toString: () => message,
55+
toString: () => message
5656
});
5757
}
5858

@@ -62,7 +62,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
6262
code: `options-loop-guard-timeout`,
6363
message,
6464
filename,
65-
toString: () => message,
65+
toString: () => message
6666
});
6767
}
6868
}

src/compiler/compile/nodes/Binding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default class Binding extends Node {
7676

7777
if (info.expression.type === 'Identifier' && !variable.writable) component.error(this.expression.node, {
7878
code: 'invalid-binding',
79-
message: 'Cannot bind to a variable which is not writable',
79+
message: 'Cannot bind to a variable which is not writable'
8080
});
8181
}
8282

src/compiler/compile/nodes/Element.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export default class Element extends Node {
399399
if (/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/.test(name)) {
400400
component.error(attribute, {
401401
code: `illegal-attribute`,
402-
message: `'${name}' is not a valid attribute name`,
402+
message: `'${name}' is not a valid attribute name`
403403
});
404404
}
405405

@@ -423,7 +423,7 @@ export default class Element extends Node {
423423
if (!(parent.type === 'InlineComponent' || within_custom_element(parent))) {
424424
component.error(attribute, {
425425
code: `invalid-slotted-content`,
426-
message: `Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`,
426+
message: `Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`
427427
});
428428
}
429429
}

src/compiler/compile/nodes/Text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const elements_without_text = new Set([
1212
'dl',
1313
'optgroup',
1414
'select',
15-
'video',
15+
'video'
1616
]);
1717

1818
export default class Text extends Node {

0 commit comments

Comments
 (0)