From 8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 31 Oct 2024 10:36:25 -0500 Subject: js: Migrate to ESLint 9 Signed-off-by: Matt Strapp --- src/packages/svelte/README.md | 4 +- src/packages/svelte/eslint.config.js | 33 -------- src/packages/svelte/eslint.config.mjs | 23 +++++ src/packages/svelte/package.json | 152 +++++++++++++++++----------------- src/packages/svelte/src/demo.spec.ts | 2 +- 5 files changed, 102 insertions(+), 112 deletions(-) delete mode 100644 src/packages/svelte/eslint.config.js create mode 100644 src/packages/svelte/eslint.config.mjs (limited to 'src/packages/svelte') diff --git a/src/packages/svelte/README.md b/src/packages/svelte/README.md index e638873..5fee47e 100644 --- a/src/packages/svelte/README.md +++ b/src/packages/svelte/README.md @@ -5,8 +5,8 @@ ## Description -Locusts is a series of libraries that allows you to introduce locusts into your codebase. -Why would you want to do that? I don't know. +Locusts is a series of libraries that allows you to introduce locusts into your +codebase. Why would you want to do that? I don't know. ## Installation diff --git a/src/packages/svelte/eslint.config.js b/src/packages/svelte/eslint.config.js deleted file mode 100644 index a526565..0000000 --- a/src/packages/svelte/eslint.config.js +++ /dev/null @@ -1,33 +0,0 @@ -import prettier from 'eslint-config-prettier'; -import js from '@eslint/js'; -import svelte from 'eslint-plugin-svelte'; -import globals from 'globals'; -import ts from 'typescript-eslint'; - -export default ts.config( - 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 - } - } - }, - { - ignores: ['build/', '.svelte-kit/', 'dist/'] - } -); diff --git a/src/packages/svelte/eslint.config.mjs b/src/packages/svelte/eslint.config.mjs new file mode 100644 index 0000000..7a1890c --- /dev/null +++ b/src/packages/svelte/eslint.config.mjs @@ -0,0 +1,23 @@ +import svelte from 'eslint-plugin-svelte'; +import ts from 'typescript-eslint'; +import library from '@repo/eslint-config/eslint.library.config.js'; + +const svelteConfig = ts.config( + ...svelte.configs['flat/recommended'], + ...svelte.configs['flat/prettier'], + { + files: ['**/*.svelte'], + + languageOptions: { + parserOptions: { + parser: ts.parser + } + } + }, + { + ignores: ['build/', '.svelte-kit/', 'dist/'] + } +); + +/** @type {import("eslint").Linter.Config[]} */ +export default [...library, ...svelteConfig]; diff --git a/src/packages/svelte/package.json b/src/packages/svelte/package.json index 863f062..713a633 100644 --- a/src/packages/svelte/package.json +++ b/src/packages/svelte/package.json @@ -1,77 +1,77 @@ { - "name": "@locusts/svelte", - "description": "A svelte component that introduces locusts into your website.", - "version": "0.0.0", - "author": "Matt Strapp (https://mattstrapp.net)", - "bugs": "https://github.com/locusts-r-us/locusts/issues", - "scripts": { - "dev": "vite dev", - "build": "vite build && npm run package", - "preview": "vite preview", - "package": "svelte-kit sync && svelte-package && publint", - "prepublishOnly": "npm run package", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "format": "prettier --write .", - "lint": "prettier --check . && eslint .", - "test:unit": "vitest", - "test": "npm run test:unit -- --run" - }, - "keywords": [ - "svelte", - "component", - "why", - "joke" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/locusts-r-us/locusts.git", - "directory": "packages/svelte" - }, - "license": "0BSD", - "files": [ - "dist", - "!dist/**/*.test.*", - "!dist/**/*.spec.*" - ], - "sideEffects": [ - "**/*.css" - ], - "svelte": "./dist/index.js", - "types": "./dist/index.d.ts", - "type": "module", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "svelte": "./dist/index.js" - } - }, - "peerDependencies": { - "svelte": "^5.0.0" - }, - "devDependencies": { - "@repo/eslint-config": "workspace:*", - "@repo/typescript-config": "workspace:*", - "@sveltejs/adapter-auto": "^3.0.0", - "@sveltejs/kit": "^2.0.0", - "@sveltejs/package": "^2.0.0", - "@sveltejs/vite-plugin-svelte": "^4.0.0", - "@types/eslint": "^9.6.0", - "eslint": "^9.7.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-svelte": "^2.36.0", - "globals": "^15.0.0", - "prettier": "^3.3.2", - "prettier-plugin-svelte": "^3.2.6", - "publint": "^0.2.0", - "svelte": "^5.0.0", - "svelte-check": "^4.0.0", - "typescript": "^5.6.3", - "typescript-eslint": "^8.0.0", - "vite": "^5.0.11", - "vitest": "^2.0.4" - }, - "publishConfig": { - "access": "public" - } -} \ No newline at end of file + "name": "@locusts/svelte", + "description": "A svelte component that introduces locusts into your website.", + "version": "0.0.0", + "author": "Matt Strapp (https://mattstrapp.net)", + "bugs": "https://github.com/locusts-r-us/locusts/issues", + "scripts": { + "dev": "vite dev", + "build": "vite build && npm run package", + "preview": "vite preview", + "package": "svelte-kit sync && svelte-package && publint", + "prepublishOnly": "npm run package", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "format": "prettier --write .", + "lint": "prettier --check . && eslint --fix .", + "test:unit": "vitest", + "test": "npm run test:unit -- --run" + }, + "keywords": [ + "svelte", + "component", + "why", + "joke" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/locusts-r-us/locusts.git", + "directory": "packages/svelte" + }, + "license": "0BSD", + "files": [ + "dist", + "!dist/**/*.test.*", + "!dist/**/*.spec.*" + ], + "sideEffects": [ + "**/*.css" + ], + "svelte": "./dist/index.js", + "types": "./dist/index.d.ts", + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js" + } + }, + "peerDependencies": { + "svelte": "^5.0.0" + }, + "devDependencies": { + "@repo/eslint-config": "workspace:*", + "@repo/typescript-config": "workspace:*", + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/package": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^4.0.0", + "@types/eslint": "^9.6.0", + "eslint": "^9.7.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.36.0", + "globals": "^15.0.0", + "prettier": "^3.3.2", + "prettier-plugin-svelte": "^3.2.6", + "publint": "^0.2.0", + "svelte": "^5.0.0", + "svelte-check": "^4.0.0", + "typescript": "^5.6.3", + "typescript-eslint": "^8.0.0", + "vite": "^5.0.11", + "vitest": "^2.0.4" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/src/packages/svelte/src/demo.spec.ts b/src/packages/svelte/src/demo.spec.ts index 682c26c..d2c1a85 100644 --- a/src/packages/svelte/src/demo.spec.ts +++ b/src/packages/svelte/src/demo.spec.ts @@ -1,4 +1,4 @@ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; describe('Locusts should exist', () => { it('Locusts should exist', () => { -- cgit v1.2.3