Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to ESLint 9 #337

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .eslintrc.cjs

This file was deleted.

32 changes: 32 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from "@eslint/js";
import ts from "typescript-eslint";
import svelte from "eslint-plugin-svelte";
import prettier from "eslint-config-prettier";
import globals from "globals";
/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs["flat/recommended"],
prettier,
...svelte.configs["flat/prettier"],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
files: ["**/*.svelte"],
languageOptions: {
parserOptions: {
parser: ts.parser,
},
},
rules: {
"svelte/no-inline-styles": "error",
},
},
];
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest --typecheck --coverage.enabled",
"lint": "prettier --check . && eslint --ignore-path .gitignore .",
"lint": "prettier --check . && eslint src test",
"format": "prettier --write ."
},
"type": "module",
Expand All @@ -55,29 +55,29 @@
},
"devDependencies": {
"@cweili/fa-test-util": "^1.0.0",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.0.6",
"@sveltejs/package": "^2.2.4",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@testing-library/svelte": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@vitest/coverage-v8": "^1.1.0",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.5.28",
"@sveltejs/package": "^2.3.5",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@testing-library/svelte": "^5.2.1",
"@types/eslint": "^9.6.1",
"@vitest/coverage-v8": "^2.1.1",
"bootstrap": "^5.3.2",
"eslint": "^8.56.0",
"eslint": "^9.11.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"eslint-plugin-svelte": "^2.44.0",
"globals": "^15.9.0",
"highlight.js": "^11.9.0",
"jsdom": "^23.0.1",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"publint": "^0.2.6",
"sass": "^1.69.5",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vitest": "^1.1.0"
"jsdom": "^25.0.1",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6",
"publint": "^0.2.11",
"sass": "1.77.6",
"svelte": "^4.2.19",
"svelte-check": "^4.0.2",
"typescript": "5.5",
"typescript-eslint": "^8.6.0",
"vite": "^5.4.7",
"vitest": "^2.1.1"
}
}
13 changes: 10 additions & 3 deletions src/lib/fa-layers-text.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@
export let flip: FlipDir | undefined = undefined;

let containerElement: HTMLElement;
$: containerElement && size && setCustomFontSize(containerElement, size);
$: containerElement && color && (containerElement.style.color = color);

$: transform = getTransform(scale, translateX, translateY, rotate, flip, 1, "em", "deg");
$: containerElement && transform && (containerElement.style.transform = transform);
$: if (containerElement) {
containerElement.style.transform = transform;
}
$: if (containerElement && size) {
setCustomFontSize(containerElement, size);
}
$: if (containerElement && color) {
containerElement.style.color = color;
}
</script>

<span {id} class="svelte-fa-layers-text {clazz}">
Expand Down
4 changes: 3 additions & 1 deletion src/lib/fa-layers.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
export let pull: PullDir | undefined = undefined;

let containerElement: HTMLElement;
$: containerElement && size && setCustomFontSize(containerElement, size);
$: if (containerElement && size) {
setCustomFontSize(containerElement, size);
}
</script>

<!-- eslint-disable svelte/no-inline-styles -- Only styles passed to this component should be included -->
Expand Down
4 changes: 3 additions & 1 deletion src/lib/fa.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
export let swapOpacity = false;

let svgElement: HTMLElement | SVGElement;
$: svgElement && size && setCustomFontSize(svgElement, size);
$: if (svgElement && size) {
setCustomFontSize(svgElement, size);
}

$: i = (icon && icon.icon) || [0, 0, "", [], ""];

Expand Down
2 changes: 1 addition & 1 deletion test/basic.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { ComponentProps } from "svelte";
import { describe, expect, test, afterEach } from "vitest";
// @ts-expect-error No typings available
import { fasFlag, fasInfo } from "@cweili/fa-test-util";
import { render, screen, cleanup } from "@testing-library/svelte";
import Fa from "../src/lib/index.js";
Expand Down Expand Up @@ -205,6 +204,7 @@ test("title", async () => {
});

const tag = await screen.findByText(title);
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
expect(tag).to.exist;
// For backward compatibility with SVG 1.1, according to MDN
expect(getFa().querySelector(":first-child")).toBe(tag);
Expand Down
1 change: 0 additions & 1 deletion test/duotone.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { ComponentProps } from "svelte";
import { expect, test, afterEach } from "vitest";
// @ts-expect-error No typings available
import { fasFlag, fadFlag, fadInfo } from "@cweili/fa-test-util";
import { render, screen, cleanup } from "@testing-library/svelte";
import Fa from "../src/lib/index.js";
Expand Down
Loading