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 --- .changeset/README.md | 11 +- .eslintrc.js | 9 -- .prettierignore | 6 + .vscode/settings.json | 8 +- CONTRIBUTING.md | 24 ++-- deno.json | 14 +- docs/.NET.md | 3 +- docs/BEAM.md | 7 +- docs/C.md | 3 +- docs/Docker.md | 7 +- docs/Go.md | 3 +- docs/JavaScript.md | 4 +- docs/Python.md | 6 +- docs/Rust.md | 3 +- eslint.config.mjs | 7 + package.json | 3 +- pnpm-lock.yaml | 82 +++++++---- .../eslint-config/eslint.library.config.js | 39 ++++++ src/packages/eslint-config/library.js | 34 ----- src/packages/eslint-config/package.json | 10 +- src/packages/locusts/.eslintrc.js | 9 -- src/packages/locusts/.prettierignore | 2 + src/packages/locusts/README.md | 4 +- src/packages/locusts/deno.json | 9 +- src/packages/locusts/eslint.config.mjs | 5 + src/packages/locusts/package.json | 19 ++- src/packages/locusts/tsconfig.json | 11 +- 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 +- turbo.json | 7 +- 33 files changed, 320 insertions(+), 243 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 .prettierignore create mode 100644 eslint.config.mjs create mode 100644 src/packages/eslint-config/eslint.library.config.js delete mode 100644 src/packages/eslint-config/library.js delete mode 100644 src/packages/locusts/.eslintrc.js create mode 100644 src/packages/locusts/.prettierignore create mode 100644 src/packages/locusts/eslint.config.mjs delete mode 100644 src/packages/svelte/eslint.config.js create mode 100644 src/packages/svelte/eslint.config.mjs diff --git a/.changeset/README.md b/.changeset/README.md index e5b6d8d..468dd17 100644 --- a/.changeset/README.md +++ b/.changeset/README.md @@ -1,8 +1,11 @@ # Changesets -Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works -with multi-package repos, or single-package repos to help you version and publish your code. You can -find the full documentation for it [in our repository](https://github.com/changesets/changesets) +Hello and welcome! This folder has been automatically generated by +`@changesets/cli`, a build tool that works with multi-package repos, or +single-package repos to help you version and publish your code. You can find the +full documentation for it +[in our repository](https://github.com/changesets/changesets) -We have a quick list of common questions to get you started engaging with this project in +We have a quick list of common questions to get you started engaging with this +project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 1de713c..0000000 --- a/.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/.prettierignore b/.prettierignore new file mode 100644 index 0000000..003de6b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +# Package Managers +package-lock.json +pnpm-lock.yaml +yarn.lock + +**/.svelte-kit diff --git a/.vscode/settings.json b/.vscode/settings.json index 0731833..0195b8a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,5 +13,9 @@ "mode": "auto" } ], - "java.compile.nullAnalysis.mode": "automatic" -} \ No newline at end of file + "java.compile.nullAnalysis.mode": "automatic", + "deno.enablePaths": [ + "src/packages/locusts/mod.ts", + "src/packages/locusts/mod.test.ts" + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 42fe3cd..5b96221 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ # Contributing -First off, thanks for taking the time to contribute! 🎉 -We welcome all sorts of contributions, from bug reports to feature requests to code contributions. +First off, thanks for taking the time to contribute! 🎉 We welcome all sorts of +contributions, from bug reports to feature requests to code contributions. ## How to contribute @@ -12,24 +12,30 @@ The main ways to can contribute are: ### Requesting a new language -If you'd like to request a new language to be added to the repository, please open an issue with the `new language` label. -Please include the following information: +If you'd like to request a new language to be added to the repository, please +open an issue with the `new language` label. Please include the following +information: - The name of the language - A brief description of the language - The language's website, if any exist -- Any relevant documentation on how to build, test, and publish libraries in the language +- Any relevant documentation on how to build, test, and publish libraries in the + language - Any CI information - Any other relevant information ### Adding a new language -If you'd like to add a new language to the repository, please follow these guidelines: +If you'd like to add a new language to the repository, please follow these +guidelines: -- The language **MUST** have some way of publishing and consuming libraries (ie. a package manager). -- Your PR **MUST** include a GitHub Actions pipeline to build, run tests, and potentially publish the library to the library location. +- The language **MUST** have some way of publishing and consuming libraries (ie. + a package manager). +- Your PR **MUST** include a GitHub Actions pipeline to build, run tests, and + potentially publish the library to the library location. - See any of the existing language workflows for examples. -- Your PR **MUST** include a `LANGUAGE`.md file in the `docs` directory with the following information: +- Your PR **MUST** include a `LANGUAGE`.md file in the `docs` directory with the + following information: - A basic way to add the library as a dependency - An example of how to use the library - A link on the README.md to the new language documentation diff --git a/deno.json b/deno.json index dd406b5..3c716ea 100644 --- a/deno.json +++ b/deno.json @@ -1,5 +1,15 @@ { "workspace": [ "./src/packages/locusts" - ] -} \ No newline at end of file + ], + "lint": { + "exclude": [ + "*" + ] + }, + "fmt": { + "exclude": [ + "*" + ] + } +} diff --git a/docs/.NET.md b/docs/.NET.md index 2ff1e04..e8a2c29 100644 --- a/docs/.NET.md +++ b/docs/.NET.md @@ -26,4 +26,5 @@ Locusts.IntroduceLocusts(); ## License -This project is licensed under the BSD Zero Clause License. See the [LICENSE](../LICENSE) file for details. +This project is licensed under the BSD Zero Clause License. See the +[LICENSE](../LICENSE) file for details. diff --git a/docs/BEAM.md b/docs/BEAM.md index 6e3ea50..abdce6a 100644 --- a/docs/BEAM.md +++ b/docs/BEAM.md @@ -19,6 +19,7 @@ def deps do end ``` -Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) -and published on [HexDocs](https://hexdocs.pm). Once published, the docs can -be found at . +Documentation can be generated with +[ExDoc](https://github.com/elixir-lang/ex_doc) and published on +[HexDocs](https://hexdocs.pm). Once published, the docs can be found at +. diff --git a/docs/C.md b/docs/C.md index 86ce271..e3ae830 100644 --- a/docs/C.md +++ b/docs/C.md @@ -48,4 +48,5 @@ make ## License -This project is licensed under the BSD Zero Clause License. See the [LICENSE](../LICENSE) file for details. +This project is licensed under the BSD Zero Clause License. See the +[LICENSE](../LICENSE) file for details. diff --git a/docs/Docker.md b/docs/Docker.md index 989e232..7e6ab52 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -4,11 +4,12 @@ A docker container containing locusts also exist. -If you would like to add locusts to your company's servers, you can use the following command: +If you would like to add locusts to your company's servers, you can use the +following command: ```bash docker run --rm ghcr.io/locusts-r-us/locusts:master ``` -That's it. There are locusts now in your computer. -What those locusts do is up to the reader. +That's it. There are locusts now in your computer. What those locusts do is up +to the reader. diff --git a/docs/Go.md b/docs/Go.md index 1763734..f0a9925 100644 --- a/docs/Go.md +++ b/docs/Go.md @@ -30,4 +30,5 @@ func main() { ## License -This project is licensed under the BSD Zero Clause License. See the [LICENSE](../LICENSE) file for details. +This project is licensed under the BSD Zero Clause License. See the +[LICENSE](../LICENSE) file for details. diff --git a/docs/JavaScript.md b/docs/JavaScript.md index c2fb788..f8a6687 100644 --- a/docs/JavaScript.md +++ b/docs/JavaScript.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/docs/Python.md b/docs/Python.md index 01273bf..51d4bd6 100644 --- a/docs/Python.md +++ b/docs/Python.md @@ -5,7 +5,8 @@ ## Description -locusts-r-us is a library that provides a way to introduce locusts into your code. +locusts-r-us is a library that provides a way to introduce locusts into your +code. Why would you want to do that? I don't know. @@ -30,4 +31,5 @@ if __name__ == "__main__": ## License -This project is licensed under the BSD Zero Clause License. See the [LICENSE](../LICENSE) file for details. +This project is licensed under the BSD Zero Clause License. See the +[LICENSE](../LICENSE) file for details. diff --git a/docs/Rust.md b/docs/Rust.md index 0e599e4..c42257a 100644 --- a/docs/Rust.md +++ b/docs/Rust.md @@ -38,4 +38,5 @@ fn main() { ## License -This project is licensed under the BSD Zero Clause License. See the [LICENSE](../LICENSE) file for details. +This project is licensed under the BSD Zero Clause License. See the +[LICENSE](../LICENSE) file for details. diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..fceabb0 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,7 @@ +export default { + languageOptions: { + parserOptions: { + project: true, + }, + }, +}; diff --git a/package.json b/package.json index 525fdd4..1159828 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,7 @@ "scripts": { "build": "turbo build", "dev": "turbo dev", - "format": "prettier --write \"**/*.{ts,tsx,md}\"", - "ci:format": "prettier --check \"**/*.{ts,tsx,md}\"", + "format": "turbo format && prettier --write \"**/*.md\"", "lint": "turbo lint", "test": "turbo test", "publish-packages": "turbo build && bash ./contrib/tag-repo && changeset publish", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b06ea1b..a254140 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,15 +26,18 @@ importers: src/packages/eslint-config: devDependencies: + '@types/eslint': + specifier: ^9.6.0 + version: 9.6.1 '@typescript-eslint/eslint-plugin': specifier: 8.12.2 - version: 8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) - '@typescript-eslint/parser': - specifier: 8.12.2 - version: 8.12.2(eslint@9.13.0)(typescript@5.6.3) + version: 8.12.2(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) '@vercel/style-guide': specifier: 6.0.0 version: 6.0.0(eslint@9.13.0)(prettier@3.3.3)(typescript@5.6.3)(vitest@2.1.4(@types/node@22.8.4)) + eslint: + specifier: ^9.7.0 + version: 9.13.0 eslint-config-prettier: specifier: ^9.1.0 version: 9.1.0(eslint@9.13.0) @@ -44,12 +47,24 @@ importers: eslint-plugin-only-warn: specifier: ^1.1.0 version: 1.1.0 + globals: + specifier: ^15.0.0 + version: 15.11.0 typescript: specifier: ^5.6.3 version: 5.6.3 + typescript-eslint: + specifier: ^8.0.0 + version: 8.12.2(eslint@9.13.0)(typescript@5.6.3) src/packages/locusts: devDependencies: + '@eslint/eslintrc': + specifier: ^3.1.0 + version: 3.1.0 + '@eslint/js': + specifier: ^9.13.0 + version: 9.13.0 '@repo/eslint-config': specifier: workspace:* version: link:../eslint-config @@ -59,6 +74,12 @@ importers: '@types/node': specifier: ^22.8.4 version: 22.8.4 + globals: + specifier: ^15.0.0 + version: 15.11.0 + publint: + specifier: ^0.2.0 + version: 0.2.12 tsup: specifier: ^8.3.5 version: 8.3.5(postcss@8.4.47)(tsx@4.19.2)(typescript@5.6.3) @@ -4265,6 +4286,24 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 7.18.0(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/scope-manager': 8.12.2 + '@typescript-eslint/type-utils': 8.12.2(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/utils': 8.12.2(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/visitor-keys': 8.12.2 + eslint: 9.13.0 + graphemer: 1.4.0 + ignore: 5.3.2 + natural-compare: 1.4.0 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3)': dependencies: '@eslint-community/regexpp': 4.12.1 @@ -4461,8 +4500,8 @@ snapshots: eslint-import-resolver-alias: 1.1.2(eslint-plugin-import@2.30.0) eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-plugin-import@2.30.0)(eslint@9.13.0) eslint-plugin-eslint-comments: 3.2.0(eslint@9.13.0) - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0) - eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0) + eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) eslint-plugin-jsx-a11y: 6.10.0(eslint@9.13.0) eslint-plugin-playwright: 1.6.2(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0) eslint-plugin-react: 7.35.2(eslint@9.13.0) @@ -5122,7 +5161,7 @@ snapshots: eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.30.0): dependencies: - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0) eslint-import-resolver-node@0.3.9: dependencies: @@ -5138,36 +5177,27 @@ snapshots: debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 9.13.0 - eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0) + eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0) fast-glob: 3.3.2 get-tsconfig: 4.8.0 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.30.0(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0) + eslint-plugin-import: 2.30.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.11.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0): + eslint-module-utils@2.11.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 7.18.0(eslint@9.13.0)(typescript@5.6.3) eslint: 9.13.0 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-plugin-import@2.30.0)(eslint@9.13.0) - transitivePeerDependencies: - - supports-color - - eslint-module-utils@2.11.0(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint@9.13.0): - dependencies: - debug: 3.2.7 - optionalDependencies: - '@typescript-eslint/parser': 8.12.2(eslint@9.13.0)(typescript@5.6.3) - eslint: 9.13.0 eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-plugin-import@2.30.0)(eslint@9.13.0) transitivePeerDependencies: - supports-color @@ -5177,7 +5207,7 @@ snapshots: eslint: 9.13.0 ignore: 5.3.2 - eslint-plugin-import@2.30.0(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0): + eslint-plugin-import@2.30.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -5188,7 +5218,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.13.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.11.0(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint@9.13.0) + eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.13.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -5199,18 +5229,18 @@ snapshots: semver: 6.3.1 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.12.2(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/parser': 7.18.0(eslint@9.13.0)(typescript@5.6.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3): + eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3): dependencies: '@typescript-eslint/utils': 5.62.0(eslint@9.13.0)(typescript@5.6.3) eslint: 9.13.0 optionalDependencies: - '@typescript-eslint/eslint-plugin': 8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/eslint-plugin': 8.12.2(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) transitivePeerDependencies: - supports-color - typescript @@ -5242,7 +5272,7 @@ snapshots: eslint: 9.13.0 globals: 13.24.0 optionalDependencies: - eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) + eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@8.12.2(@typescript-eslint/parser@7.18.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) eslint-plugin-react-hooks@4.6.2(eslint@9.13.0): dependencies: 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 (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.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', () => { diff --git a/turbo.json b/turbo.json index 77a4042..75b7694 100644 --- a/turbo.json +++ b/turbo.json @@ -14,6 +14,11 @@ "dist/**" ] }, + "format": { + "dependsOn": [ + "^format" + ] + }, "lint": { "dependsOn": [ "^lint" @@ -25,4 +30,4 @@ }, "test": {} } -} \ No newline at end of file +} -- cgit v1.2.3