From f7e13f5917e176fd44a80479ab06eb61e34dd138 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Fri, 9 Aug 2024 09:05:18 -0500 Subject: feat: Add Node.js Signed-off-by: Matt Strapp --- packages/eslint-config/README.md | 3 +++ packages/eslint-config/library.js | 34 +++++++++++++++++++++++++++++++++ packages/eslint-config/package.json | 17 +++++++++++++++++ packages/locusts/.eslintrc.js | 9 +++++++++ packages/locusts/package.json | 33 ++++++++++++++++++++++++++++++++ packages/locusts/src/index.ts | 15 +++++++++++++++ packages/locusts/tests/locusts.test.ts | 7 +++++++ packages/locusts/tsconfig.json | 13 +++++++++++++ packages/typescript-config/base.json | 20 +++++++++++++++++++ packages/typescript-config/package.json | 9 +++++++++ 10 files changed, 160 insertions(+) create mode 100644 packages/eslint-config/README.md create mode 100644 packages/eslint-config/library.js create mode 100644 packages/eslint-config/package.json create mode 100644 packages/locusts/.eslintrc.js create mode 100644 packages/locusts/package.json create mode 100644 packages/locusts/src/index.ts create mode 100644 packages/locusts/tests/locusts.test.ts create mode 100644 packages/locusts/tsconfig.json create mode 100644 packages/typescript-config/base.json create mode 100644 packages/typescript-config/package.json (limited to 'packages') diff --git a/packages/eslint-config/README.md b/packages/eslint-config/README.md new file mode 100644 index 0000000..8b42d90 --- /dev/null +++ b/packages/eslint-config/README.md @@ -0,0 +1,3 @@ +# `@turbo/eslint-config` + +Collection of internal eslint configurations. diff --git a/packages/eslint-config/library.js b/packages/eslint-config/library.js new file mode 100644 index 0000000..9b59cc0 --- /dev/null +++ b/packages/eslint-config/library.js @@ -0,0 +1,34 @@ +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/packages/eslint-config/package.json b/packages/eslint-config/package.json new file mode 100644 index 0000000..d6a436a --- /dev/null +++ b/packages/eslint-config/package.json @@ -0,0 +1,17 @@ +{ + "name": "@repo/eslint-config", + "version": "0.0.0", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "8.0.1", + "@typescript-eslint/parser": "8.0.1", + "@vercel/style-guide": "6.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-config-turbo": "^2.0.0", + "eslint-plugin-only-warn": "^1.1.0", + "typescript": "^5.4.5" + }, + "files": [ + "library.js" + ], + "private": true +} diff --git a/packages/locusts/.eslintrc.js b/packages/locusts/.eslintrc.js new file mode 100644 index 0000000..1de713c --- /dev/null +++ b/packages/locusts/.eslintrc.js @@ -0,0 +1,9 @@ +/** @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/packages/locusts/package.json b/packages/locusts/package.json new file mode 100644 index 0000000..65a669c --- /dev/null +++ b/packages/locusts/package.json @@ -0,0 +1,33 @@ +{ + "name": "locusts", + "description": "An npm package that introduces locusts into your codebase.", + "version": "1.0.0", + "author": "Matt Strapp (https://mattstrapp.net)", + "bugs": "https://github.com/locusts-r-us/locusts/issues", + + "devDependencies": { + "@repo/eslint-config": "workspace:*", + "@repo/typescript-config": "workspace:*", + "@types/node": "^22.1.0", + "tsup": "^8.2.4", + "tsx": "^4.16.5", + "typescript": "^5.4.5" + }, + "keywords": [], + "license": "0BSD", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "repository": { + "type": "git", + "url": "git+https://github.com/locusts-r-us/locusts.git", + "directory": "packages/locusts" + }, + "scripts": { + "build": "tsup src/index.ts --format cjs,esm --dts", + "dev": "tsup src/index.ts --format cjs,esm --dts --watch", + "lint": "eslint src --fix", + "lint:ci": "eslint src", + "test": "node --test --import tsx ./tests/locusts.test.ts" + }, + "types": "./dist/index.d.ts" +} \ No newline at end of file diff --git a/packages/locusts/src/index.ts b/packages/locusts/src/index.ts new file mode 100644 index 0000000..de25d64 --- /dev/null +++ b/packages/locusts/src/index.ts @@ -0,0 +1,15 @@ +/** + * Introduce locusts into your codebase. + * @remarks + * Locusts are not included in this package. You must provide your own locusts. + * @public + * @example + * ```js + * import introduce_locusts from 'locusts'; + * introduce_locusts(); + * ``` + * @returns void + */ +export default function introduceLocusts() { + // This space intentionally left blank +} \ No newline at end of file diff --git a/packages/locusts/tests/locusts.test.ts b/packages/locusts/tests/locusts.test.ts new file mode 100644 index 0000000..f5a126d --- /dev/null +++ b/packages/locusts/tests/locusts.test.ts @@ -0,0 +1,7 @@ +import { describe, it } from "node:test"; + +describe("Locusts", () => { + it("should be able to be introduced to the environment", () => { + // Test code here + }); +}); diff --git a/packages/locusts/tsconfig.json b/packages/locusts/tsconfig.json new file mode 100644 index 0000000..0a5c316 --- /dev/null +++ b/packages/locusts/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "@repo/typescript-config/base.json", + "compilerOptions": { + "outDir": "dist" + }, + "include": [ + "src" + ], + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/packages/typescript-config/base.json b/packages/typescript-config/base.json new file mode 100644 index 0000000..0f80cfd --- /dev/null +++ b/packages/typescript-config/base.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Default", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "incremental": false, + "isolatedModules": true, + "lib": ["es2022", "DOM", "DOM.Iterable"], + "module": "NodeNext", + "moduleDetection": "force", + "moduleResolution": "NodeNext", + "noUncheckedIndexedAccess": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "ES2022" + } +} diff --git a/packages/typescript-config/package.json b/packages/typescript-config/package.json new file mode 100644 index 0000000..d658269 --- /dev/null +++ b/packages/typescript-config/package.json @@ -0,0 +1,9 @@ +{ + "name": "@repo/typescript-config", + "version": "0.0.0", + "license": "MIT", + "private": true, + "publishConfig": { + "access": "public" + } +} -- cgit v1.2.3