diff options
author | Matt Strapp <matt@mattstrapp.net> | 2024-10-31 10:36:25 -0500 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2024-10-31 10:36:25 -0500 |
commit | 8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8 (patch) | |
tree | 0d8a1772a4579a136ebfdd06a3d368b3a2c0d1cf /src | |
parent | ci: Alter version bump to only ignore pnpm lockfile, not rest (diff) | |
download | locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.gz locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.bz2 locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.lz locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.xz locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.zst locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.zip |
js: Migrate to ESLint 9
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '')
-rw-r--r-- | src/packages/eslint-config/eslint.library.config.js | 39 | ||||
-rw-r--r-- | src/packages/eslint-config/library.js | 34 | ||||
-rw-r--r-- | src/packages/eslint-config/package.json | 10 | ||||
-rw-r--r-- | src/packages/locusts/.eslintrc.js | 9 | ||||
-rw-r--r-- | src/packages/locusts/.prettierignore | 2 | ||||
-rw-r--r-- | src/packages/locusts/README.md | 4 | ||||
-rw-r--r-- | src/packages/locusts/deno.json | 9 | ||||
-rw-r--r-- | src/packages/locusts/eslint.config.mjs | 5 | ||||
-rw-r--r-- | src/packages/locusts/package.json | 19 | ||||
-rw-r--r-- | src/packages/locusts/tsconfig.json | 11 | ||||
-rw-r--r-- | src/packages/svelte/README.md | 4 | ||||
-rw-r--r-- | src/packages/svelte/eslint.config.mjs (renamed from src/packages/svelte/eslint.config.js) | 20 | ||||
-rw-r--r-- | src/packages/svelte/package.json | 152 | ||||
-rw-r--r-- | src/packages/svelte/src/demo.spec.ts | 2 |
14 files changed, 164 insertions, 156 deletions
diff --git a/src/packages/eslint-config/eslint.library.config.js b/src/packages/eslint-config/eslint.library.config.js new file mode 100644 index 0000000..e3c7866 --- /dev/null +++ b/src/packages/eslint-config/eslint.library.config.js @@ -0,0 +1,39 @@ +// @ts-check + +import globals from "globals"; +import eslint from "@eslint/js"; +import ts from "typescript-eslint"; +import prettier from "eslint-config-prettier"; +import turboPlugin from "eslint-plugin-turbo"; + +import { resolve } from "node:path"; + +const project = resolve(process.cwd(), "tsconfig.json"); + +export default ts.config( + eslint.configs.recommended, + ...ts.configs.recommended, + prettier, + { + name: "eslint-config-turbo (recreated flat)", + plugins: { + turbo: { rules: turboPlugin.rules }, + }, + rules: { + "turbo/no-undeclared-env-vars": "error", + }, + }, + { + name: "library", + languageOptions: { + // parserOptions: { + // project: resolve(process.cwd(), "tsconfig.json") + // }, + globals: { + ...globals.browser, + ...globals.node, + }, + }, + ignores: ["build/", ".svelte-kit/", "dist/"], + }, +); diff --git a/src/packages/eslint-config/library.js b/src/packages/eslint-config/library.js deleted file mode 100644 index 9b59cc0..0000000 --- a/src/packages/eslint-config/library.js +++ /dev/null @@ -1,34 +0,0 @@ -const { resolve } = require("node:path"); - -const project = resolve(process.cwd(), "tsconfig.json"); - -/** @type {import("eslint").Linter.Config} */ -module.exports = { - extends: ["eslint:recommended", "prettier", "turbo"], - plugins: ["only-warn"], - globals: { - React: true, - JSX: true, - }, - env: { - node: true, - }, - settings: { - "import/resolver": { - typescript: { - project, - }, - }, - }, - ignorePatterns: [ - // Ignore dotfiles - ".*.js", - "node_modules/", - "dist/", - ], - overrides: [ - { - files: ["*.js?(x)", "*.ts?(x)"], - }, - ], -}; diff --git a/src/packages/eslint-config/package.json b/src/packages/eslint-config/package.json index ba005cf..a05970f 100644 --- a/src/packages/eslint-config/package.json +++ b/src/packages/eslint-config/package.json @@ -3,15 +3,19 @@ "version": "0.0.0", "devDependencies": { "@typescript-eslint/eslint-plugin": "8.12.2", - "@typescript-eslint/parser": "8.12.2", "@vercel/style-guide": "6.0.0", + "@types/eslint": "^9.6.0", + "eslint": "^9.7.0", "eslint-config-prettier": "^9.1.0", "eslint-config-turbo": "^2.2.3", "eslint-plugin-only-warn": "^1.1.0", - "typescript": "^5.6.3" + "globals": "^15.0.0", + "typescript": "^5.6.3", + "typescript-eslint": "^8.0.0" }, "files": [ - "library.js" + "library.mjs" ], + "type": "module", "private": true } diff --git a/src/packages/locusts/.eslintrc.js b/src/packages/locusts/.eslintrc.js deleted file mode 100644 index 1de713c..0000000 --- a/src/packages/locusts/.eslintrc.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @type {import("eslint").Linter.Config} */ -module.exports = { - root: true, - extends: ["@repo/eslint-config/library.js"], - parser: "@typescript-eslint/parser", - parserOptions: { - project: true, - }, -};
\ No newline at end of file diff --git a/src/packages/locusts/.prettierignore b/src/packages/locusts/.prettierignore new file mode 100644 index 0000000..a0cc08c --- /dev/null +++ b/src/packages/locusts/.prettierignore @@ -0,0 +1,2 @@ +mod.ts +mod_test.ts
\ No newline at end of file diff --git a/src/packages/locusts/README.md b/src/packages/locusts/README.md index 6bcd1b6..0b95dcd 100644 --- a/src/packages/locusts/README.md +++ b/src/packages/locusts/README.md @@ -8,8 +8,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/locusts/deno.json b/src/packages/locusts/deno.json index 2e0e371..8a0b4c8 100644 --- a/src/packages/locusts/deno.json +++ b/src/packages/locusts/deno.json @@ -8,7 +8,12 @@ "license": "MIT", "imports": { "@std/testing": "jsr:@std/testing@1", - "@std/expect": "jsr:@std/expect@1", - "locusts": "npm:locusts" + "@std/expect": "jsr:@std/expect@1" + }, + "lint": { + "include": ["mod.ts", "mod_test.ts"] + }, + "fmt": { + "include": ["mod.ts", "mod_test.ts"] } } diff --git a/src/packages/locusts/eslint.config.mjs b/src/packages/locusts/eslint.config.mjs new file mode 100644 index 0000000..1946c04 --- /dev/null +++ b/src/packages/locusts/eslint.config.mjs @@ -0,0 +1,5 @@ +// import ts from 'typescript-eslint'; +import library from "@repo/eslint-config/eslint.library.config.js"; + +/** @type {import("eslint").Linter.Config[]} */ +export default [...library]; diff --git a/src/packages/locusts/package.json b/src/packages/locusts/package.json index 5fb6a7f..93bce80 100644 --- a/src/packages/locusts/package.json +++ b/src/packages/locusts/package.json @@ -5,14 +5,25 @@ "author": "Matt Strapp <matt+locusts@mattstrapp.net> (https://mattstrapp.net)", "bugs": "https://github.com/locusts-r-us/locusts/issues", "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.13.0", "@repo/eslint-config": "workspace:*", "@repo/typescript-config": "workspace:*", "@types/node": "^22.8.4", + "globals": "^15.0.0", + "prettier": "^3.3.2", + "publint": "^0.2.0", "tsup": "^8.3.5", "tsx": "^4.19.2", "typescript": "^5.6.3" }, - "keywords": ["why", "joke"], + "keywords": [ + "why", + "joke" + ], + "files": [ + "dist" + ], "license": "0BSD", "main": "./dist/index.js", "module": "./dist/index.mjs", @@ -22,10 +33,10 @@ "directory": "packages/locusts" }, "scripts": { - "build": "tsup src/index.ts --format cjs,esm --dts", + "build": "tsup src/index.ts --format cjs,esm --dts && publint", "dev": "tsup src/index.ts --format cjs,esm --dts --watch", - "lint": "eslint src --fix", - "lint:ci": "eslint src", + "lint": "prettier --check . && eslint .", + "format": "prettier --write . && eslint --fix .", "test": "node --test --import tsx ./tests/locusts.test.ts" }, "publishConfig": { diff --git a/src/packages/locusts/tsconfig.json b/src/packages/locusts/tsconfig.json index 0a5c316..5e3db2b 100644 --- a/src/packages/locusts/tsconfig.json +++ b/src/packages/locusts/tsconfig.json @@ -3,11 +3,6 @@ "compilerOptions": { "outDir": "dist" }, - "include": [ - "src" - ], - "exclude": [ - "node_modules", - "dist" - ] -}
\ No newline at end of file + "include": ["src"], + "exclude": ["node_modules", "dist"] +} 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.mjs index a526565..7a1890c 100644 --- a/src/packages/svelte/eslint.config.js +++ b/src/packages/svelte/eslint.config.mjs @@ -1,24 +1,11 @@ -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'; +import library from '@repo/eslint-config/eslint.library.config.js'; -export default ts.config( - js.configs.recommended, - ...ts.configs.recommended, +const svelteConfig = ts.config( ...svelte.configs['flat/recommended'], - prettier, ...svelte.configs['flat/prettier'], { - languageOptions: { - globals: { - ...globals.browser, - ...globals.node - } - } - }, - { files: ['**/*.svelte'], languageOptions: { @@ -31,3 +18,6 @@ export default ts.config( 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 <matt+locusts@mattstrapp.net> (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 <matt+locusts@mattstrapp.net> (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', () => { |