@homeflare/config 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @homeflare/config
2
+
3
+ Shared TypeScript, oxlint and oxfmt configuration for HomeFlare projects. One place to
4
+ change a rule, rather than one copy per repo that drifts.
5
+
6
+ ## tsconfig
7
+
8
+ ```jsonc
9
+ // tsconfig.json — an app or a Worker
10
+ { "extends": "@homeflare/config/tsconfig.base.json" }
11
+
12
+ // tsconfig.json — a package that publishes types
13
+ { "extends": "@homeflare/config/tsconfig.lib.json" }
14
+ ```
15
+
16
+ `tsconfig.lib.json` adds `isolatedDeclarations` and `declaration` on top of the base.
17
+ ⛔ Both are needed together — `isolatedDeclarations` alone is TS5069, even under
18
+ `--noEmit`.
19
+
20
+ ## oxlint
21
+
22
+ ⚠️ oxlint's `extends` takes **file paths**, not package names — there is no
23
+ `eslint-config-*` style resolution. The path into `node_modules` is written out:
24
+
25
+ ```json
26
+ {
27
+ "extends": ["./node_modules/@homeflare/config/oxlintrc.json"],
28
+ "rules": {
29
+ // project-specific overrides go here
30
+ }
31
+ }
32
+ ```
33
+
34
+ ## oxfmt
35
+
36
+ ⚠️ The file must be named `.oxfmtrc.json` — with the leading dot. Without it, oxfmt
37
+ silently uses its defaults, and the symptom is a formatter that rewrites your quotes.
38
+
39
+ ```sh
40
+ cp node_modules/@homeflare/config/oxfmtrc.json .oxfmtrc.json
41
+ ```
42
+
43
+ ## License
44
+
45
+ MIT © Timothy Schneider
package/oxfmtrc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "printWidth": 100,
3
+ "useTabs": false,
4
+ "singleQuote": true,
5
+ "semi": true,
6
+ "ignorePatterns": ["**/node_modules/**", "**/dist/**", "**/coverage/**"]
7
+ }
package/oxlintrc.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "plugins": ["typescript", "unicorn", "oxc", "import"],
3
+ "categories": {
4
+ "correctness": "error",
5
+ "suspicious": "warn",
6
+ "perf": "warn"
7
+ },
8
+ "env": {
9
+ "builtin": true,
10
+ "es2024": true
11
+ },
12
+ "ignorePatterns": ["dist/**", "coverage/**"],
13
+ "rules": {
14
+ "no-console": "error",
15
+ "typescript/consistent-type-imports": "error",
16
+ "typescript/no-explicit-any": "error",
17
+ "import/no-default-export": "error"
18
+ },
19
+ "overrides": [
20
+ {
21
+ "files": ["**/tests/**", "**/*.test.ts", "**/scripts/**"],
22
+ "rules": {
23
+ "no-console": "off"
24
+ }
25
+ }
26
+ ]
27
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@homeflare/config",
3
+ "version": "0.1.0",
4
+ "description": "Shared tsconfig, oxlint and oxfmt configuration for HomeFlare projects.",
5
+ "license": "MIT",
6
+ "author": "Timothy Schneider",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/taslabs-net/homeflare-kit.git",
10
+ "directory": "packages/config"
11
+ },
12
+ "files": [
13
+ "tsconfig.base.json",
14
+ "tsconfig.lib.json",
15
+ "oxlintrc.json",
16
+ "oxfmtrc.json",
17
+ "README.md"
18
+ ],
19
+ "type": "module",
20
+ "exports": {
21
+ "./tsconfig.base.json": "./tsconfig.base.json",
22
+ "./tsconfig.lib.json": "./tsconfig.lib.json",
23
+ "./oxlintrc.json": "./oxlintrc.json",
24
+ "./oxfmtrc.json": "./oxfmtrc.json",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "echo 'config: nothing to build'",
32
+ "clean": "echo 'config: nothing to clean'"
33
+ }
34
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ // The HomeFlare TypeScript baseline. Every project extends this and overrides only
3
+ // what its runtime genuinely needs.
4
+ //
5
+ // { "extends": "@homeflare/config/tsconfig.base.json" }
6
+ //
7
+ // ★ WHY THESE SETTINGS AND NOT tsc's DEFAULTS. Each one below turns a class of runtime
8
+ // bug into a compile error. They are painful to adopt late and nearly free to adopt
9
+ // at the start, which is the whole argument for a shared baseline.
10
+ "compilerOptions": {
11
+ "lib": ["ESNext"],
12
+ "target": "ESNext",
13
+ "module": "preserve",
14
+ "moduleResolution": "bundler",
15
+ "moduleDetection": "force",
16
+
17
+ // ⛔ Emit is a build tool's job, never the checker's.
18
+ "noEmit": true,
19
+ "allowImportingTsExtensions": true,
20
+ "verbatimModuleSyntax": true,
21
+ "isolatedModules": true,
22
+
23
+ "strict": true,
24
+ // ⚠️ arr[0] is T | undefined, not T. The single most common source of "cannot read
25
+ // property of undefined" in production, and the flag that catches it.
26
+ "noUncheckedIndexedAccess": true,
27
+ "noImplicitOverride": true,
28
+ "noFallthroughCasesInSwitch": true,
29
+ // ⚠️ Distinguishes `{ a?: string }` from `{ a: string | undefined }`. Without it,
30
+ // an optional property can be explicitly set to undefined and typecheck.
31
+ "exactOptionalPropertyTypes": true,
32
+
33
+ "skipLibCheck": true
34
+ }
35
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ // For a package that PUBLISHES types. Adds declaration emit to the baseline.
3
+ //
4
+ // { "extends": "@homeflare/config/tsconfig.lib.json" }
5
+ //
6
+ // ⛔ isolatedDeclarations REQUIRES every exported symbol to carry an explicit type.
7
+ // ★ That is what makes a two-tool build safe: when a bundler emits the JS and tsc
8
+ // emits the .d.ts separately, explicit types are the only thing keeping the two
9
+ // from drifting apart.
10
+ // ⚠️ TS5069: isolatedDeclarations cannot be set without `declaration`, even when emit
11
+ // is off. Both appear here; a build config turns `noEmit` off.
12
+ "extends": "./tsconfig.base.json",
13
+ "compilerOptions": {
14
+ "isolatedDeclarations": true,
15
+ "declaration": true
16
+ }
17
+ }