@timmo001/oxlint-rules 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/oxlint-rules",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Shared Oxlint plugins and configs with optional Effect rules.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -20,11 +20,12 @@
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
- "src",
24
- "!src/**/*.test.ts",
23
+ "src/effect",
24
+ "!src/effect/**/*.test.ts",
25
25
  "vendor/anti-slop/src",
26
26
  "vendor/anti-slop/LICENSE",
27
27
  "!vendor/anti-slop/src/**/*.test.ts",
28
+ "!vendor/anti-slop/README.md",
28
29
  "skills",
29
30
  "README.md",
30
31
  "THIRD_PARTY_NOTICES.md",
@@ -37,7 +38,7 @@
37
38
  "format:check": "prettier --check \"{src,scripts}/**/*.ts\" \"skills/**/*.{md,mjs}\" \"*.md\" \"*.json\"",
38
39
  "lint": "oxlint src scripts",
39
40
  "skills:validate": "bunx skills-ref validate skills/install-timmo-oxlint-rules && bunx skills-ref validate skills/add-oxlint-rule",
40
- "test": "node --experimental-strip-types src/effect/rules/no-try-catch-in-effect-generators.test.ts && bun test src/install/copy.test.ts",
41
+ "test": "node --experimental-strip-types scripts/test.ts",
41
42
  "typecheck": "tsc --noEmit"
42
43
  },
43
44
  "peerDependencies": {
@@ -21,8 +21,9 @@ description: >-
21
21
  5. Put generic upstream-independent rules under the appropriate locally owned
22
22
  plugin. Never modify `vendor/anti-slop`; propose an upstream contribution
23
23
  separately when Dylan Mulroy's plugin should own the behaviour.
24
- 6. Register the rule in its plugin and matching config, then update the README
25
- rule list and behaviour description.
24
+ 6. Register the rule in its plugin. Verify the matching config and copy command
25
+ discover it from the plugin's `rules` map, then update the README rule list
26
+ and behaviour description. Do not add rule names to either skill.
26
27
  7. Run `mise run check`, `mise run build`, `npm pack --dry-run`, and
27
28
  `bunx jsr@0.14.3 publish --dry-run` in the central checkout.
28
29
 
@@ -37,8 +37,10 @@ description: >-
37
37
  3. Run `node scripts/copy.mjs <bun|npm|pnpm|yarn> <destination>`. Add `--force`
38
38
  only after explicit replacement approval.
39
39
  4. Register the three entry points printed by the command as `anti-slop`,
40
- `anti-slop-effect`, and `timmo-effect`. Enable `timmo-effect` only for direct
41
- Effect use or an explicit request.
40
+ `anti-slop-effect`, and `timmo-effect`. Merge every printed general rule
41
+ setting into the target config. Merge every printed Effect rule setting only
42
+ for direct Effect use or an explicit request. Do not maintain a rule list in
43
+ this skill.
42
44
 
43
45
  Run the target repository's normal lint, typecheck, tests, and build. Report
44
46
  package-manager changes, preserved local configuration, enabled rule groups,
package/src/cli.ts DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env node
2
- import { resolve } from "node:path";
3
-
4
- import { copyRules, DEFAULT_COPY_DESTINATION } from "./install/copy.ts";
5
-
6
- function usage() {
7
- return "Usage: oxlint-rules copy [destination] [--force]";
8
- }
9
-
10
- const [command, ...arguments_] = process.argv.slice(2);
11
- if (command === "--help" || command === "-h") {
12
- console.log(usage());
13
- } else if (command !== "copy") {
14
- console.error(usage());
15
- process.exitCode = 1;
16
- } else {
17
- const force = arguments_.includes("--force");
18
- const positional = arguments_.filter((argument) => argument !== "--force");
19
- if (positional.length > 1) {
20
- console.error(usage());
21
- process.exitCode = 1;
22
- } else {
23
- try {
24
- const destination = resolve(positional[0] ?? DEFAULT_COPY_DESTINATION);
25
- const entries = await copyRules(destination, { force });
26
- console.log("Copied Oxlint plugins:");
27
- console.log(` anti-slop: ${entries.antiSlop}`);
28
- console.log(` anti-slop-effect: ${entries.antiSlopEffect}`);
29
- console.log(` timmo-effect: ${entries.timmoEffect}`);
30
- } catch (error) {
31
- console.error(error instanceof Error ? error.message : String(error));
32
- process.exitCode = 1;
33
- }
34
- }
35
- }
@@ -1,20 +0,0 @@
1
- import { defineConfig } from "oxlint";
2
-
3
- import recommended from "./recommended.ts";
4
-
5
- const effect = defineConfig({
6
- extends: [recommended],
7
- jsPlugins: [
8
- {
9
- name: "anti-slop-effect",
10
- specifier: "@timmo001/oxlint-rules/upstream/effect",
11
- },
12
- { name: "timmo-effect", specifier: "@timmo001/oxlint-rules/effect" },
13
- ],
14
- rules: {
15
- "anti-slop-effect/no-service-constructor-imports": "error",
16
- "timmo-effect/no-try-catch-in-effect-generators": "error",
17
- },
18
- });
19
-
20
- export default effect;
@@ -1,29 +0,0 @@
1
- import { defineConfig } from "oxlint";
2
-
3
- const recommended = defineConfig({
4
- jsPlugins: [
5
- {
6
- name: "anti-slop",
7
- specifier: "@timmo001/oxlint-rules/upstream/anti-slop",
8
- },
9
- ],
10
- rules: {
11
- "anti-slop/no-chained-type-assertions": "error",
12
- "anti-slop/no-conditional-empty-object-spread": "error",
13
- "anti-slop/no-known-value-widening": "error",
14
- "anti-slop/no-module-mocking": "error",
15
- "anti-slop/no-object-parameters": "error",
16
- "anti-slop/no-reflect-apply": "error",
17
- "anti-slop/no-reflect-get": "error",
18
- "anti-slop/no-runtime-typeof": "error",
19
- "anti-slop/no-shape-in-symbol-names": "error",
20
- "anti-slop/no-unknown-parameters": "error",
21
- "anti-slop/no-unknown-returns": "error",
22
- "anti-slop/no-unknown-type-aliases": "error",
23
- "anti-slop/no-unsafe-dictionary-type": "error",
24
- "anti-slop/no-widen-then-assert": "error",
25
- "anti-slop/require-safety-comment-for-type-assertion": "error",
26
- },
27
- });
28
-
29
- export default recommended;
@@ -1,77 +0,0 @@
1
- import { cp, mkdir, readdir, rm } from "node:fs/promises";
2
- import { dirname, join, relative, resolve, sep } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
-
5
- export const DEFAULT_COPY_DESTINATION = "tools/oxlint/timmo-rules";
6
-
7
- export interface CopyRulesOptions {
8
- readonly force?: boolean;
9
- readonly sourceRoot?: string;
10
- }
11
-
12
- export interface CopiedRuleEntryPoints {
13
- readonly antiSlop: string;
14
- readonly antiSlopEffect: string;
15
- readonly timmoEffect: string;
16
- }
17
-
18
- function packageRoot() {
19
- const current = dirname(fileURLToPath(import.meta.url));
20
- return current.endsWith(join("src", "install"))
21
- ? resolve(current, "../..")
22
- : resolve(current, "..");
23
- }
24
-
25
- async function copyTree(source: string, destination: string) {
26
- await cp(source, destination, {
27
- recursive: true,
28
- filter: (path) =>
29
- !path.endsWith(".test.ts") && !path.includes(`${join("", ".git")}`),
30
- });
31
- }
32
-
33
- export async function copyRules(
34
- destination: string,
35
- options: CopyRulesOptions = {},
36
- ): Promise<CopiedRuleEntryPoints> {
37
- const target = resolve(destination);
38
- const entries = await readdir(dirname(target), { withFileTypes: true }).catch(
39
- () => [],
40
- );
41
- if (entries.some((entry) => entry.name === target.split(/[\\/]/u).at(-1))) {
42
- if (!options.force) {
43
- throw new Error(
44
- `Destination already exists: ${target}. Pass --force to replace it.`,
45
- );
46
- }
47
- await rm(target, { force: true, recursive: true });
48
- }
49
-
50
- const root = options.sourceRoot ?? packageRoot();
51
- await mkdir(join(target, "upstream"), { recursive: true });
52
- await copyTree(
53
- join(root, "vendor/anti-slop/src"),
54
- join(target, "upstream/anti-slop"),
55
- );
56
- await cp(
57
- join(root, "vendor/anti-slop/LICENSE"),
58
- join(target, "upstream/anti-slop/LICENSE"),
59
- );
60
- await rm(join(target, "upstream/anti-slop/effect"), {
61
- force: true,
62
- recursive: true,
63
- });
64
- await copyTree(
65
- join(root, "vendor/anti-slop/src/effect"),
66
- join(target, "upstream/effect"),
67
- );
68
- await copyTree(join(root, "src/effect"), join(target, "effect"));
69
-
70
- const displayRoot = relative(process.cwd(), target) || ".";
71
- const entryPoint = (path: string) => `./${path.split(sep).join("/")}`;
72
- return {
73
- antiSlop: entryPoint(join(displayRoot, "upstream/anti-slop/index.ts")),
74
- antiSlopEffect: entryPoint(join(displayRoot, "upstream/effect/index.ts")),
75
- timmoEffect: entryPoint(join(displayRoot, "effect/index.ts")),
76
- };
77
- }
@@ -1,7 +0,0 @@
1
- import type { OxlintConfig } from "oxlint";
2
-
3
- import bundledConfig from "../../dist/configs/effect.js";
4
-
5
- const config: OxlintConfig = bundledConfig;
6
-
7
- export default config;
package/src/jsr/effect.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { Plugin } from "@oxlint/plugins";
2
-
3
- import bundledPlugin from "../../dist/effect/index.js";
4
-
5
- const plugin: Plugin = bundledPlugin;
6
-
7
- export default plugin;
@@ -1,7 +0,0 @@
1
- import type { OxlintConfig } from "oxlint";
2
-
3
- import bundledConfig from "../../dist/configs/recommended.js";
4
-
5
- const config: OxlintConfig = bundledConfig;
6
-
7
- export default config;
@@ -1,7 +0,0 @@
1
- import type { Plugin } from "@oxlint/plugins";
2
-
3
- import bundledPlugin from "../../dist/upstream/anti-slop.js";
4
-
5
- const plugin: Plugin = bundledPlugin;
6
-
7
- export default plugin;
@@ -1,7 +0,0 @@
1
- import type { Plugin } from "@oxlint/plugins";
2
-
3
- import bundledPlugin from "../../dist/upstream/effect.js";
4
-
5
- const plugin: Plugin = bundledPlugin;
6
-
7
- export default plugin;
@@ -1 +0,0 @@
1
- export { default } from "../../vendor/anti-slop/src/index.ts";
@@ -1 +0,0 @@
1
- export { default } from "../../vendor/anti-slop/src/effect/index.ts";