@jfalava/ts-standard 0.3.4 → 0.3.5
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/docs/setup.md +1 -1
- package/examples/README.md +9 -0
- package/examples/github/dependabot.yml +6 -0
- package/examples/github/release.yml +75 -0
- package/examples/package/bunfig.toml +18 -0
- package/examples/package/oxlint.config.ts +57 -0
- package/examples/package/package.json +37 -0
- package/examples/package/tsconfig.json +25 -0
- package/examples/workspace/api/oxlint.config.ts +10 -0
- package/examples/workspace/api/package.json +26 -0
- package/examples/workspace/api/tsconfig.json +7 -0
- package/examples/workspace/bunfig.toml +18 -0
- package/examples/workspace/cli/oxlint.config.ts +10 -0
- package/examples/workspace/cli/package.json +36 -0
- package/examples/workspace/cli/tsconfig.json +10 -0
- package/examples/workspace/iac/oxlint.config.ts +7 -0
- package/examples/workspace/iac/package.json +31 -0
- package/examples/workspace/iac/tsconfig.json +7 -0
- package/examples/workspace/oxlint.config.ts +83 -0
- package/examples/workspace/package.json +63 -0
- package/examples/workspace/tsconfig.base.json +26 -0
- package/package.json +2 -1
package/docs/setup.md
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Files that pass `ts-standard` with no findings, to copy into a repo and rename. Each example passes with `reference/ci.yml` at `.github/workflows/ci.yml` and `github/dependabot.yml` at `.github/dependabot.yml`; `test/check.test.ts` checks that.
|
|
4
|
+
|
|
5
|
+
- `package/`: a single-package repo with no `effect` dependency: `package.json`, `bunfig.toml`, `tsconfig.json` and `oxlint.config.ts`. It loads the `anti-slop` plugin only.
|
|
6
|
+
- `workspace/`: a workspace repo with a root catalog and three packages. `api` and `cli` depend on `effect` and add the `anti-slop-effect` plugin; `iac` deploys with Alchemy and does not. The root has `tsconfig.base.json` and an `oxlint.config.ts` that exports `base` and `antiSlopEffect`.
|
|
7
|
+
- `github/`: `dependabot.yml` and a tag-triggered `release.yml` for the workspace's `cli`. `ci.yml` is `reference/ci.yml`.
|
|
8
|
+
|
|
9
|
+
Add `standard.config.ts` only where a repo differs from the defaults; see `docs/configuration.md`.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# The release workflow for examples/workspace, whose CLI is in cli/. In a single-package repo,
|
|
2
|
+
# read the version from package.json and drop `--cwd cli`. Tags are plain v<version>.
|
|
3
|
+
name: Release
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: release-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: false
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
check:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
timeout-minutes: 15
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
|
+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
|
23
|
+
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
24
|
+
with:
|
|
25
|
+
path: ~/.bun/install/cache
|
|
26
|
+
key: bun-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock') }}
|
|
27
|
+
restore-keys: bun-${{ runner.os }}-${{ runner.arch }}-
|
|
28
|
+
- run: bun install --frozen-lockfile
|
|
29
|
+
- name: Tag matches the CLI version
|
|
30
|
+
run: test "${GITHUB_REF_NAME#v}" = "$(jq -r .version cli/package.json)"
|
|
31
|
+
- run: bun run check
|
|
32
|
+
|
|
33
|
+
build:
|
|
34
|
+
needs: check
|
|
35
|
+
strategy:
|
|
36
|
+
fail-fast: false
|
|
37
|
+
matrix:
|
|
38
|
+
include:
|
|
39
|
+
- { os: ubuntu-latest, target: linux-x64 }
|
|
40
|
+
- { os: ubuntu-24.04-arm, target: linux-arm64 }
|
|
41
|
+
- { os: macos-latest, target: darwin-arm64 }
|
|
42
|
+
- { os: windows-latest, target: windows-x64 }
|
|
43
|
+
runs-on: ${{ matrix.os }}
|
|
44
|
+
timeout-minutes: 30
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
47
|
+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
|
48
|
+
- run: bun install --frozen-lockfile
|
|
49
|
+
- run: bun run --cwd cli build:${{ matrix.target }}
|
|
50
|
+
# Sign and archive here if the release needs it.
|
|
51
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
52
|
+
with:
|
|
53
|
+
name: example-${{ matrix.target }}
|
|
54
|
+
retention-days: 1
|
|
55
|
+
path: cli/dist/example-${{ matrix.target }}*
|
|
56
|
+
|
|
57
|
+
release:
|
|
58
|
+
needs: build
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
timeout-minutes: 10
|
|
61
|
+
permissions:
|
|
62
|
+
contents: write
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
65
|
+
with:
|
|
66
|
+
pattern: example-*
|
|
67
|
+
merge-multiple: true
|
|
68
|
+
path: dist
|
|
69
|
+
- name: Generate checksums
|
|
70
|
+
working-directory: dist
|
|
71
|
+
run: sha256sum * > checksums.txt
|
|
72
|
+
- uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4
|
|
73
|
+
with:
|
|
74
|
+
files: dist/*
|
|
75
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[install]
|
|
2
|
+
minimumReleaseAge = 86400
|
|
3
|
+
minimumReleaseAgeExcludes = [
|
|
4
|
+
# A ts-standard release would otherwise wait a day before it installs.
|
|
5
|
+
"@jfalava/ts-standard",
|
|
6
|
+
# Tracks packageManager, which can move on the day Bun releases.
|
|
7
|
+
"bun-types",
|
|
8
|
+
"@effect/tsgo",
|
|
9
|
+
# @effect/tsgo's native binaries are optional dependencies; without these,
|
|
10
|
+
# bun skips them silently and `effect-tsgo patch` fails.
|
|
11
|
+
"@effect/tsgo-darwin-arm64",
|
|
12
|
+
"@effect/tsgo-darwin-x64",
|
|
13
|
+
"@effect/tsgo-linux-arm",
|
|
14
|
+
"@effect/tsgo-linux-arm64",
|
|
15
|
+
"@effect/tsgo-linux-x64",
|
|
16
|
+
"@effect/tsgo-win32-arm64",
|
|
17
|
+
"@effect/tsgo-win32-x64",
|
|
18
|
+
]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
|
|
3
|
+
import cloudflare from "@cloudflare/oxlint-config";
|
|
4
|
+
import { defineConfig } from "oxlint";
|
|
5
|
+
import type { DummyRuleMap, OxlintConfig } from "oxlint";
|
|
6
|
+
|
|
7
|
+
// @cloudflare/oxlint-config is the base. `options` is root-only, so it is added back below.
|
|
8
|
+
const { options: presetOptions, ...preset } = cloudflare;
|
|
9
|
+
|
|
10
|
+
// The anti-slop rules the preset does not carry. An absolute path resolves the same from any
|
|
11
|
+
// config that spreads this one. This package does not depend on `effect`, so it does not load
|
|
12
|
+
// @jfalava/ts-standard/oxlint/effect; see examples/workspace for a repo that does.
|
|
13
|
+
const antiSlop = fileURLToPath(import.meta.resolve("@jfalava/ts-standard/oxlint"));
|
|
14
|
+
|
|
15
|
+
const plugins: NonNullable<OxlintConfig["plugins"]> = [
|
|
16
|
+
...(preset.plugins ?? []),
|
|
17
|
+
"typescript",
|
|
18
|
+
"unicorn",
|
|
19
|
+
"oxc",
|
|
20
|
+
"import",
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const antiSlopRules: DummyRuleMap = {
|
|
24
|
+
"anti-slop/no-module-mocking": "error",
|
|
25
|
+
"anti-slop/require-safety-comment-for-type-assertion": "error",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Preset rules turned off for good, each with its reason.
|
|
29
|
+
const policyRules: DummyRuleMap = {
|
|
30
|
+
// Taste: `T[]` and `Array<T>` are both fine.
|
|
31
|
+
"typescript/array-type": "off",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Rules that fail when first turned on go here as `"<rule>": "off", // <findings>` until each
|
|
35
|
+
// finding is fixed or disabled at its line with a reason. The map ends empty.
|
|
36
|
+
const pendingRules: DummyRuleMap = {};
|
|
37
|
+
|
|
38
|
+
// `bun run lint` passes `--type-aware --type-check`; the default export sets them too.
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
...preset,
|
|
41
|
+
plugins: plugins.filter((plugin, index) => plugins.indexOf(plugin) === index),
|
|
42
|
+
jsPlugins: [...(preset.jsPlugins ?? []), { name: "anti-slop", specifier: antiSlop }],
|
|
43
|
+
// The preset turns oxlint's correctness category off.
|
|
44
|
+
categories: { correctness: "error" },
|
|
45
|
+
env: { ...preset.env, builtin: true },
|
|
46
|
+
rules: {
|
|
47
|
+
...preset.rules,
|
|
48
|
+
...antiSlopRules,
|
|
49
|
+
...policyRules,
|
|
50
|
+
...pendingRules,
|
|
51
|
+
},
|
|
52
|
+
options: {
|
|
53
|
+
...presetOptions,
|
|
54
|
+
typeAware: true,
|
|
55
|
+
typeCheck: true,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"bin": {
|
|
6
|
+
"example-cli": "./index.ts"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "mkdir -p dist && bun build --compile index.ts --outfile dist/example-cli",
|
|
11
|
+
"build:darwin-arm64": "mkdir -p dist && bun build --compile --target=bun-darwin-arm64 index.ts --outfile dist/example-cli-darwin-arm64",
|
|
12
|
+
"build:linux-arm64": "mkdir -p dist && bun build --compile --target=bun-linux-arm64 index.ts --outfile dist/example-cli-linux-arm64",
|
|
13
|
+
"build:linux-x64": "mkdir -p dist && bun build --compile --target=bun-linux-x64 index.ts --outfile dist/example-cli-linux-x64",
|
|
14
|
+
"build:windows-x64": "mkdir -p dist && bun build --compile --target=bun-windows-x64 index.ts --outfile dist/example-cli-windows-x64.exe",
|
|
15
|
+
"check": "bun run lint && bun run format:check && bun run typecheck && bun run test && bun run standard:check",
|
|
16
|
+
"fix": "bun run lint:fix && bun run format",
|
|
17
|
+
"format": "oxfmt",
|
|
18
|
+
"format:check": "oxfmt --check",
|
|
19
|
+
"lint": "oxlint --type-aware --type-check",
|
|
20
|
+
"lint:fix": "oxlint --type-aware --type-check --fix",
|
|
21
|
+
"prepare": "effect-tsgo patch --no-typescript --tsrs --oxlint",
|
|
22
|
+
"standard:check": "ts-standard",
|
|
23
|
+
"test": "bun test",
|
|
24
|
+
"typecheck": "effect-tsgo tsrs --noEmit"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@cloudflare/oxlint-config": "0.2.0",
|
|
28
|
+
"@effect/tsgo": "0.74.1",
|
|
29
|
+
"@jfalava/ts-standard": "0.3.5",
|
|
30
|
+
"@oxlint/plugins": "1.95.0",
|
|
31
|
+
"bun-types": "1.4.5",
|
|
32
|
+
"oxfmt": "0.80.0",
|
|
33
|
+
"oxlint": "1.95.0",
|
|
34
|
+
"tsrs": "7.1.0-beta.tsrs5"
|
|
35
|
+
},
|
|
36
|
+
"packageManager": "bun@1.4.5"
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@effect/tsgo/schema.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"types": ["bun-types"],
|
|
6
|
+
"target": "ESNext",
|
|
7
|
+
"module": "Preserve",
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
|
|
14
|
+
"strict": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"noUncheckedIndexedAccess": true,
|
|
18
|
+
"noImplicitOverride": true,
|
|
19
|
+
|
|
20
|
+
// Turns the Effect diagnostics on. Without this entry typecheck passes a floating Effect.
|
|
21
|
+
"plugins": [{ "name": "@effect/language-service" }]
|
|
22
|
+
},
|
|
23
|
+
// Tests are typechecked in the same pass; there is no tsconfig.test.json.
|
|
24
|
+
"include": ["*.ts", "src/**/*.ts", "test/**/*.ts"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from "oxlint";
|
|
2
|
+
|
|
3
|
+
import { antiSlopEffect, base } from "../oxlint.config.ts";
|
|
4
|
+
|
|
5
|
+
// This package lists `effect`, so it adds the Effect plugin to the root base.
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
...base,
|
|
8
|
+
jsPlugins: [...(base.jsPlugins ?? []), antiSlopEffect.jsPlugin],
|
|
9
|
+
rules: { ...base.rules, ...antiSlopEffect.rules },
|
|
10
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@example/api",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"check": "bun run lint && bun run format:check && bun run typecheck && bun run test",
|
|
7
|
+
"fix": "bun run lint:fix && bun run format",
|
|
8
|
+
"format": "oxfmt",
|
|
9
|
+
"format:check": "oxfmt --check",
|
|
10
|
+
"lint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error",
|
|
11
|
+
"lint:fix": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error --fix",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"typecheck": "effect-tsgo tsrs --noEmit"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"effect": "catalog:effect"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@cloudflare/workers-types": "catalog:types",
|
|
20
|
+
"@oxlint/plugins": "catalog:build",
|
|
21
|
+
"oxfmt": "catalog:build",
|
|
22
|
+
"oxlint": "catalog:build",
|
|
23
|
+
"tsrs": "catalog:build",
|
|
24
|
+
"vitest": "catalog:build"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[install]
|
|
2
|
+
minimumReleaseAge = 86400
|
|
3
|
+
minimumReleaseAgeExcludes = [
|
|
4
|
+
# A ts-standard release would otherwise wait a day before it installs.
|
|
5
|
+
"@jfalava/ts-standard",
|
|
6
|
+
# Tracks packageManager, which can move on the day Bun releases.
|
|
7
|
+
"bun-types",
|
|
8
|
+
"@effect/tsgo",
|
|
9
|
+
# @effect/tsgo's native binaries are optional dependencies; without these,
|
|
10
|
+
# bun skips them silently and `effect-tsgo patch` fails.
|
|
11
|
+
"@effect/tsgo-darwin-arm64",
|
|
12
|
+
"@effect/tsgo-darwin-x64",
|
|
13
|
+
"@effect/tsgo-linux-arm",
|
|
14
|
+
"@effect/tsgo-linux-arm64",
|
|
15
|
+
"@effect/tsgo-linux-x64",
|
|
16
|
+
"@effect/tsgo-win32-arm64",
|
|
17
|
+
"@effect/tsgo-win32-x64",
|
|
18
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from "oxlint";
|
|
2
|
+
|
|
3
|
+
import { antiSlopEffect, base } from "../oxlint.config.ts";
|
|
4
|
+
|
|
5
|
+
// This package lists `effect`, so it adds the Effect plugin to the root base.
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
...base,
|
|
8
|
+
jsPlugins: [...(base.jsPlugins ?? []), antiSlopEffect.jsPlugin],
|
|
9
|
+
rules: { ...base.rules, ...antiSlopEffect.rules },
|
|
10
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@example/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"bin": {
|
|
6
|
+
"example": "index.ts"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "mkdir -p dist && bun build --compile index.ts --outfile dist/example",
|
|
11
|
+
"build:darwin-arm64": "mkdir -p dist && bun build --compile --target=bun-darwin-arm64 index.ts --outfile dist/example-darwin-arm64",
|
|
12
|
+
"build:linux-arm64": "mkdir -p dist && bun build --compile --target=bun-linux-arm64 index.ts --outfile dist/example-linux-arm64",
|
|
13
|
+
"build:linux-x64": "mkdir -p dist && bun build --compile --target=bun-linux-x64 index.ts --outfile dist/example-linux-x64",
|
|
14
|
+
"build:windows-x64": "mkdir -p dist && bun build --compile --target=bun-windows-x64 index.ts --outfile dist/example-windows-x64.exe",
|
|
15
|
+
"check": "bun run lint && bun run format:check && bun run typecheck && bun run test",
|
|
16
|
+
"fix": "bun run lint:fix && bun run format",
|
|
17
|
+
"format": "oxfmt",
|
|
18
|
+
"format:check": "oxfmt --check",
|
|
19
|
+
"lint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error",
|
|
20
|
+
"lint:fix": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error --fix",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"typecheck": "effect-tsgo tsrs --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@effect/platform-bun": "catalog:effect",
|
|
26
|
+
"effect": "catalog:effect"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@oxlint/plugins": "catalog:build",
|
|
30
|
+
"bun-types": "catalog:build",
|
|
31
|
+
"oxfmt": "catalog:build",
|
|
32
|
+
"oxlint": "catalog:build",
|
|
33
|
+
"tsrs": "catalog:build",
|
|
34
|
+
"vitest": "catalog:build"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@example/iac",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"check": "bun run lint && bun run format:check && bun run typecheck && bun run test",
|
|
7
|
+
"ci:deploy": "alchemy deploy --stage prod --yes",
|
|
8
|
+
"deploy": "alchemy deploy --stage prod",
|
|
9
|
+
"destroy": "alchemy destroy --stage prod",
|
|
10
|
+
"dev": "alchemy dev",
|
|
11
|
+
"fix": "bun run lint:fix && bun run format",
|
|
12
|
+
"format": "oxfmt",
|
|
13
|
+
"format:check": "oxfmt --check",
|
|
14
|
+
"lint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error",
|
|
15
|
+
"lint:fix": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error --fix",
|
|
16
|
+
"plan": "alchemy plan --stage prod",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"typecheck": "effect-tsgo tsrs --noEmit"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"alchemy": "catalog:iac"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@oxlint/plugins": "catalog:build",
|
|
25
|
+
"@types/node": "catalog:types",
|
|
26
|
+
"oxfmt": "catalog:build",
|
|
27
|
+
"oxlint": "catalog:build",
|
|
28
|
+
"tsrs": "catalog:build",
|
|
29
|
+
"vitest": "catalog:build"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
|
|
3
|
+
import cloudflare from "@cloudflare/oxlint-config";
|
|
4
|
+
import { recommended } from "@effect/tsgo/oxlint-presets";
|
|
5
|
+
import { defineConfig } from "oxlint";
|
|
6
|
+
import type { DummyRuleMap, OxlintConfig } from "oxlint";
|
|
7
|
+
|
|
8
|
+
// @cloudflare/oxlint-config without its root-only options, which only the default export adds.
|
|
9
|
+
const { options: presetOptions, ...preset } = cloudflare;
|
|
10
|
+
|
|
11
|
+
// The anti-slop rules the preset does not carry. Absolute paths resolve the same from every
|
|
12
|
+
// package config that spreads `base`.
|
|
13
|
+
const antiSlop = fileURLToPath(import.meta.resolve("@jfalava/ts-standard/oxlint"));
|
|
14
|
+
|
|
15
|
+
const antiSlopRules: DummyRuleMap = {
|
|
16
|
+
"anti-slop/no-module-mocking": "error",
|
|
17
|
+
"anti-slop/require-safety-comment-for-type-assertion": "error",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Packages whose package.json lists `effect` add this plugin and its rules, and no others do:
|
|
21
|
+
// its rules match code shape and would report code that is not Effect.
|
|
22
|
+
export const antiSlopEffect = {
|
|
23
|
+
jsPlugin: {
|
|
24
|
+
name: "anti-slop-effect",
|
|
25
|
+
specifier: fileURLToPath(import.meta.resolve("@jfalava/ts-standard/oxlint/effect")),
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
"anti-slop-effect/no-manual-effect-error-tag": "error",
|
|
29
|
+
"anti-slop-effect/no-manual-tag-comparison": "error",
|
|
30
|
+
"anti-slop-effect/no-manual-tagged-construction": "error",
|
|
31
|
+
"anti-slop-effect/no-service-constructor-imports": "error",
|
|
32
|
+
"anti-slop-effect/prefer-effect-match": "error",
|
|
33
|
+
} satisfies DummyRuleMap,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const plugins: NonNullable<OxlintConfig["plugins"]> = [
|
|
37
|
+
...(preset.plugins ?? []),
|
|
38
|
+
...(recommended.plugins ?? []),
|
|
39
|
+
"typescript",
|
|
40
|
+
"unicorn",
|
|
41
|
+
"oxc",
|
|
42
|
+
"import",
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
// Preset rules turned off for good, each with its reason.
|
|
46
|
+
const policyRules: DummyRuleMap = {
|
|
47
|
+
// Effect idioms: `import * as Schema`, Data.TaggedError classes checked with instanceof, and
|
|
48
|
+
// generator callbacks declared next to their Effect.gen.
|
|
49
|
+
"import/no-namespace": "off",
|
|
50
|
+
"@nkzw/no-instanceof": "off",
|
|
51
|
+
"unicorn/consistent-function-scoping": "off",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Rules that fail when first turned on go here as `"<rule>": "off", // <findings>` until each
|
|
55
|
+
// finding is fixed or disabled at its line with a reason. The map ends empty.
|
|
56
|
+
const pendingRules: DummyRuleMap = {};
|
|
57
|
+
|
|
58
|
+
// The shared base for package configs. Packages spread it; `extends` would drop env and overrides.
|
|
59
|
+
export const base = defineConfig({
|
|
60
|
+
...preset,
|
|
61
|
+
plugins: plugins.filter((plugin, index) => plugins.indexOf(plugin) === index),
|
|
62
|
+
jsPlugins: [...(preset.jsPlugins ?? []), { name: "anti-slop", specifier: antiSlop }],
|
|
63
|
+
// The preset turns oxlint's correctness category off.
|
|
64
|
+
categories: { correctness: "error" },
|
|
65
|
+
rules: {
|
|
66
|
+
...preset.rules,
|
|
67
|
+
...recommended.rules,
|
|
68
|
+
...antiSlopRules,
|
|
69
|
+
...policyRules,
|
|
70
|
+
...pendingRules,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Root-only options. Package lint scripts pass `--type-aware --type-check` and
|
|
75
|
+
// `--report-unused-disable-directives-severity=error` on the command line instead.
|
|
76
|
+
export default defineConfig({
|
|
77
|
+
...base,
|
|
78
|
+
options: {
|
|
79
|
+
...presetOptions,
|
|
80
|
+
typeAware: true,
|
|
81
|
+
typeCheck: true,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-monorepo",
|
|
3
|
+
"private": true,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"packages": [
|
|
6
|
+
"api",
|
|
7
|
+
"cli",
|
|
8
|
+
"iac"
|
|
9
|
+
],
|
|
10
|
+
"catalogs": {
|
|
11
|
+
"build": {
|
|
12
|
+
"@cloudflare/oxlint-config": "0.2.0",
|
|
13
|
+
"@effect/tsgo": "0.74.1",
|
|
14
|
+
"@jfalava/ts-standard": "0.3.5",
|
|
15
|
+
"@oxlint/plugins": "1.95.0",
|
|
16
|
+
"bun-types": "1.4.5",
|
|
17
|
+
"oxfmt": "0.80.0",
|
|
18
|
+
"oxlint": "1.95.0",
|
|
19
|
+
"tsrs": "7.1.0-beta.tsrs5",
|
|
20
|
+
"vitest": "5.1.2"
|
|
21
|
+
},
|
|
22
|
+
"types": {
|
|
23
|
+
"@cloudflare/workers-types": "5.20261128.1",
|
|
24
|
+
"@types/node": "26.6.11"
|
|
25
|
+
},
|
|
26
|
+
"effect": {
|
|
27
|
+
"@effect/platform-bun": "4.1.6",
|
|
28
|
+
"effect": "4.1.6"
|
|
29
|
+
},
|
|
30
|
+
"iac": {
|
|
31
|
+
"alchemy": "2.0.0-beta.87"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"type": "module",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"check": "bun run --workspaces check && oxfmt --check && bun run standard:check",
|
|
38
|
+
"ci:build": "bun run check",
|
|
39
|
+
"ci:deploy": "bun run --cwd iac ci:deploy",
|
|
40
|
+
"deploy": "bun run --cwd iac deploy",
|
|
41
|
+
"destroy": "bun run --cwd iac destroy",
|
|
42
|
+
"dev": "bun run --cwd iac dev",
|
|
43
|
+
"fix": "bun run --workspaces --if-present fix && oxfmt",
|
|
44
|
+
"format": "bun run --workspaces --if-present format && oxfmt",
|
|
45
|
+
"format:check": "bun run --workspaces --if-present format:check && oxfmt --check",
|
|
46
|
+
"lint": "bun run --workspaces --if-present lint",
|
|
47
|
+
"plan": "bun run --cwd iac plan",
|
|
48
|
+
"prepare": "effect-tsgo patch --no-typescript --tsrs --oxlint",
|
|
49
|
+
"standard:check": "ts-standard",
|
|
50
|
+
"test": "bun run --workspaces --if-present test",
|
|
51
|
+
"typecheck": "bun run --workspaces --if-present typecheck"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@cloudflare/oxlint-config": "catalog:build",
|
|
55
|
+
"@effect/tsgo": "catalog:build",
|
|
56
|
+
"@jfalava/ts-standard": "catalog:build",
|
|
57
|
+
"@oxlint/plugins": "catalog:build",
|
|
58
|
+
"oxfmt": "catalog:build",
|
|
59
|
+
"oxlint": "catalog:build",
|
|
60
|
+
"tsrs": "catalog:build"
|
|
61
|
+
},
|
|
62
|
+
"packageManager": "bun@1.4.5"
|
|
63
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@effect/tsgo/schema.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2024",
|
|
5
|
+
"lib": ["ES2024"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "Bundler",
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
// Strict flags live here only; package tsconfigs set none.
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"noImplicitOverride": true,
|
|
20
|
+
"noUncheckedIndexedAccess": true,
|
|
21
|
+
|
|
22
|
+
// Turns the Effect diagnostics on. Without this entry typecheck passes a floating Effect.
|
|
23
|
+
// Package tsconfigs must not override `plugins`.
|
|
24
|
+
"plugins": [{ "name": "@effect/language-service" }]
|
|
25
|
+
}
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jfalava/ts-standard",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Checks a Bun repo against the TypeScript scripts and workflows standard: package.json scripts, pins, tsconfig, lint setup and GitHub workflows. Also ships the anti-slop oxlint plugins the standard uses.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"src",
|
|
15
15
|
"reference",
|
|
16
16
|
"docs",
|
|
17
|
+
"examples",
|
|
17
18
|
"dist",
|
|
18
19
|
"oxlint/LICENSE",
|
|
19
20
|
"oxlint/UPSTREAM.md"
|