Skip to content

Commit f932fd8

Browse files
committed
Lint working
1 parent 7a390b4 commit f932fd8

File tree

7 files changed

+53
-24
lines changed

7 files changed

+53
-24
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"Bash(npm test)",
66
"Bash(npm install:*)",
77
"Bash(node:*)",
8-
"Bash(npm info:*)"
8+
"Bash(npm info:*)",
9+
"Bash(npm run lint)",
10+
"Bash(npm run lint:*)"
911
],
1012
"deny": [],
1113
"ask": []

.eslintrc.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
{
22
"extends": "standard",
3-
"plugins": ["svelte3", "jest"],
3+
"plugins": ["svelte3"],
44
"rules": {
55
"space-before-function-paren": 0
66
},
77
"env": {
8-
"jest": true
8+
"node": true,
9+
"browser": true,
10+
"es2022": true
11+
},
12+
"parser": "@babel/eslint-parser",
13+
"parserOptions": {
14+
"ecmaVersion": 2022,
15+
"sourceType": "module",
16+
"requireConfigFile": false,
17+
"babelOptions": {
18+
"presets": ["@babel/preset-env"]
19+
}
20+
},
21+
"globals": {
22+
"test": "readonly",
23+
"describe": "readonly",
24+
"expect": "readonly",
25+
"beforeEach": "readonly",
26+
"afterEach": "readonly",
27+
"vi": "readonly"
928
},
1029
"overrides": [
1130
{

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
node: [14]
11+
node: [21]
1212
svelte: [
1313
3.x,
1414
4.x,

index.es.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ let current_component;
2222
function set_current_component(component) {
2323
current_component = component;
2424
}
25-
Promise.resolve();
2625

27-
// source: https://html.spec.whatwg.org/multipage/indices.html
28-
const boolean_attributes = new Set([
26+
const _boolean_attributes = [
2927
'allowfullscreen',
3028
'allowpaymentrequest',
3129
'async',
@@ -38,6 +36,7 @@ const boolean_attributes = new Set([
3836
'disabled',
3937
'formnovalidate',
4038
'hidden',
39+
'inert',
4140
'ismap',
4241
'loop',
4342
'multiple',
@@ -50,7 +49,12 @@ const boolean_attributes = new Set([
5049
'required',
5150
'reversed',
5251
'selected'
53-
]);
52+
];
53+
/**
54+
* List of HTML boolean attributes (e.g. `<input disabled>`).
55+
* Source: https://html.spec.whatwg.org/multipage/indices.html
56+
*/
57+
const boolean_attributes = new Set([..._boolean_attributes]);
5458

5559
const invalid_attribute_name_character = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
5660
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
@@ -151,7 +155,7 @@ function validate_component(component, name) {
151155
if (!component || !component.$$render) {
152156
if (name === 'svelte:component')
153157
name += ' this={...}';
154-
throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules`);
158+
throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`);
155159
}
156160
return component;
157161
}
@@ -200,7 +204,7 @@ function add_attribute(name, value, boolean) {
200204
function style_object_to_string(style_object) {
201205
return Object.keys(style_object)
202206
.filter(key => style_object[key])
203-
.map(key => `${key}: ${style_object[key]};`)
207+
.map(key => `${key}: ${escape_attribute_value(style_object[key])};`)
204208
.join(' ');
205209
}
206210

@@ -390,7 +394,7 @@ function objectWithKey(key, value) {
390394
: {}
391395
}
392396

393-
/* src/components/SvgElement.svelte generated by Svelte v3.49.0 */
397+
/* src/components/SvgElement.svelte generated by Svelte v3.59.2 */
394398

395399
const SvgElement = create_ssr_component(($$result, $$props, $$bindings, slots) => {
396400
let { tag } = $$props;
@@ -430,7 +434,7 @@ const SvgElement = create_ssr_component(($$result, $$props, $$bindings, slots) =
430434
return `<svg${spread([escape_object(elementProps)], {})}${add_attribute("this", ref, 0)}><!-- HTML_TAG_START -->${markup}<!-- HTML_TAG_END --></svg>`;
431435
});
432436

433-
/* src/components/FontAwesomeIcon.svelte generated by Svelte v3.49.0 */
437+
/* src/components/FontAwesomeIcon.svelte generated by Svelte v3.59.2 */
434438

435439
const FontAwesomeIcon = create_ssr_component(($$result, $$props, $$bindings, slots) => {
436440
let $$restProps = compute_rest_props($$props, [
@@ -535,7 +539,7 @@ const FontAwesomeIcon = create_ssr_component(($$result, $$props, $$bindings, slo
535539
$$rendered = `${result
536540
? `${validate_component(SvgElement, "SvgElement").$$render(
537541
$$result,
538-
Object.assign(result, { style }, { ref }),
542+
Object.assign({}, result, { style }, { ref }),
539543
{
540544
ref: $$value => {
541545
ref = $$value;

index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
function set_current_component(component) {
2727
current_component = component;
2828
}
29-
Promise.resolve();
3029

31-
// source: https://html.spec.whatwg.org/multipage/indices.html
32-
const boolean_attributes = new Set([
30+
const _boolean_attributes = [
3331
'allowfullscreen',
3432
'allowpaymentrequest',
3533
'async',
@@ -42,6 +40,7 @@
4240
'disabled',
4341
'formnovalidate',
4442
'hidden',
43+
'inert',
4544
'ismap',
4645
'loop',
4746
'multiple',
@@ -54,7 +53,12 @@
5453
'required',
5554
'reversed',
5655
'selected'
57-
]);
56+
];
57+
/**
58+
* List of HTML boolean attributes (e.g. `<input disabled>`).
59+
* Source: https://html.spec.whatwg.org/multipage/indices.html
60+
*/
61+
const boolean_attributes = new Set([..._boolean_attributes]);
5862

5963
const invalid_attribute_name_character = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
6064
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
@@ -155,7 +159,7 @@
155159
if (!component || !component.$$render) {
156160
if (name === 'svelte:component')
157161
name += ' this={...}';
158-
throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules`);
162+
throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`);
159163
}
160164
return component;
161165
}
@@ -204,7 +208,7 @@
204208
function style_object_to_string(style_object) {
205209
return Object.keys(style_object)
206210
.filter(key => style_object[key])
207-
.map(key => `${key}: ${style_object[key]};`)
211+
.map(key => `${key}: ${escape_attribute_value(style_object[key])};`)
208212
.join(' ');
209213
}
210214

@@ -394,7 +398,7 @@
394398
: {}
395399
}
396400

397-
/* src/components/SvgElement.svelte generated by Svelte v3.49.0 */
401+
/* src/components/SvgElement.svelte generated by Svelte v3.59.2 */
398402

399403
const SvgElement = create_ssr_component(($$result, $$props, $$bindings, slots) => {
400404
let { tag } = $$props;
@@ -434,7 +438,7 @@
434438
return `<svg${spread([escape_object(elementProps)], {})}${add_attribute("this", ref, 0)}><!-- HTML_TAG_START -->${markup}<!-- HTML_TAG_END --></svg>`;
435439
});
436440

437-
/* src/components/FontAwesomeIcon.svelte generated by Svelte v3.49.0 */
441+
/* src/components/FontAwesomeIcon.svelte generated by Svelte v3.59.2 */
438442

439443
const FontAwesomeIcon = create_ssr_component(($$result, $$props, $$bindings, slots) => {
440444
let $$restProps = compute_rest_props($$props, [
@@ -539,7 +543,7 @@
539543
$$rendered = `${result
540544
? `${validate_component(SvgElement, "SvgElement").$$render(
541545
$$result,
542-
Object.assign(result, { style }, { ref }),
546+
Object.assign({}, result, { style }, { ref }),
543547
{
544548
ref: $$value => {
545549
ref = $$value;

src/components/__fixtures__/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { cleanup, render, screen } from '@testing-library/svelte'
44
import { parse } from '@fortawesome/fontawesome-svg-core'
55
import semver from 'semver'
66

7-
import packageJson from '@fortawesome/free-solid-svg-icons/package.json' assert { type: 'json' }
7+
import packageJson from '@fortawesome/free-solid-svg-icons/package.json' with { type: 'json' }
88

99
const SVG_ICONS_VERSION = semver.parse(packageJson.version)
1010

src/test-setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import '@testing-library/jest-dom'
22

3-
// Global test setup for vitest
3+
// Global test setup for vitest

0 commit comments

Comments
 (0)