@murky-web/oxc-config 0.1.2 → 0.2.1

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.
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "../../node_modules/oxlint/configuration_schema.json",
3
+ "extends": [
4
+ "./linting/base.jsonc",
5
+ "./linting/eslint.jsonc",
6
+ "./linting/typescript.jsonc",
7
+ "./linting/unicorn.jsonc",
8
+ "./linting/oxc.jsonc",
9
+ "./linting/import.jsonc",
10
+ "./linting/jsx_a11y.jsonc",
11
+ "./linting/vitest.jsonc",
12
+ "./linting/promise.jsonc",
13
+ "./linting/node.jsonc",
14
+ "./linting/jsdoc.jsonc"
15
+ ],
16
+ "plugins": [
17
+ "eslint",
18
+ "typescript",
19
+ "unicorn",
20
+ "oxc",
21
+ "import",
22
+ "jsx-a11y",
23
+ "vitest",
24
+ "promise",
25
+ "node",
26
+ "jsdoc"
27
+ ]
28
+ }
package/.oxlintrc.jsonc CHANGED
@@ -1,28 +1,24 @@
1
1
  {
2
2
  "$schema": "../../node_modules/oxlint/configuration_schema.json",
3
+ // The full stack: the built-in rules from .oxlintrc.base.jsonc plus the
4
+ // rules of the four @murky-web plugins. An app extends only this file and
5
+ // adds its own rules. The plugins are dependencies of this package and
6
+ // resolve from here. Packages of this repo that the stack depends on
7
+ // (typebuddy, simplelog) extend .oxlintrc.base.jsonc instead.
3
8
  "extends": [
4
- "./linting/base.jsonc",
5
- "./linting/eslint.jsonc",
6
- "./linting/typescript.jsonc",
7
- "./linting/unicorn.jsonc",
8
- "./linting/oxc.jsonc",
9
- "./linting/import.jsonc",
10
- "./linting/jsx_a11y.jsonc",
11
- "./linting/vitest.jsonc",
12
- "./linting/promise.jsonc",
13
- "./linting/node.jsonc",
14
- "./linting/jsdoc.jsonc"
9
+ "./.oxlintrc.base.jsonc",
10
+ "./linting/murky.jsonc",
11
+ "./linting/solid.jsonc",
12
+ "./linting/typebuddy.jsonc",
13
+ "./linting/simplelog.jsonc"
15
14
  ],
16
- "plugins": [
17
- "eslint",
18
- "typescript",
19
- "unicorn",
20
- "oxc",
21
- "import",
22
- "jsx-a11y",
23
- "vitest",
24
- "promise",
25
- "node",
26
- "jsdoc"
15
+ // Through plugins/*.mjs, not by package name: with an isolated install
16
+ // (bun workspaces, pnpm) the names do not resolve from the project's
17
+ // node_modules (plugins/README.md).
18
+ "jsPlugins": [
19
+ "./plugins/murky.mjs",
20
+ "./plugins/solid.mjs",
21
+ "./plugins/typebuddy.mjs",
22
+ "./plugins/simplelog.mjs"
27
23
  ]
28
24
  }
package/README.md CHANGED
@@ -10,18 +10,43 @@ oxfmt -c ./node_modules/@murky-web/oxc-config/.oxfmtrc.jsonc .
10
10
 
11
11
  ## oxlint
12
12
 
13
+ An app extends one file and adds only its own rules and overrides:
14
+
13
15
  ```jsonc
14
16
  // .oxlintrc.jsonc
15
17
  {
16
- "extends": ["./node_modules/@murky-web/oxc-config/.oxlintrc.jsonc"]
18
+ "extends": ["./node_modules/@murky-web/oxc-config/.oxlintrc.jsonc"],
19
+ "rules": {
20
+ // project rules and overrides
21
+ }
17
22
  }
18
23
  ```
19
24
 
20
- The rule sets for the JS plugins sit in `linting/` and need their plugin in your
21
- own `jsPlugins`:
25
+ `.oxlintrc.jsonc` is the full stack: the built-in plugins (eslint, typescript,
26
+ unicorn, oxc, import, jsx-a11y, vitest, promise, node, jsdoc) and the rules of
27
+ the four `@murky-web` JS plugins, which it loads itself through `jsPlugins`.
28
+ They are dependencies of this package, so installing it installs them:
22
29
 
23
30
  | File | Plugin |
24
31
  | ------------------------- | -------------------------------- |
32
+ | `linting/murky.jsonc` | `@murky-web/oxlint-plugin` |
25
33
  | `linting/solid.jsonc` | `@murky-web/oxlint-plugin-solid` |
26
34
  | `linting/typebuddy.jsonc` | `@murky-web/typebuddy/oxlint` |
27
35
  | `linting/simplelog.jsonc` | `@murky-web/simplelog/oxlint` |
36
+
37
+ The type-aware rules need `oxlint-tsgolint` in the project; it is a peer
38
+ dependency (`>=7.0.2007`, the range oxlint itself names), so install it next to
39
+ `oxlint`.
40
+
41
+ ### Base entry for libraries
42
+
43
+ A package the stack depends on (typebuddy, simplelog in this repo) cannot load
44
+ its own plugin before it is built. It extends `.oxlintrc.base.jsonc`, the
45
+ built-in plugins only, and adds single rule files from `linting/` with their
46
+ plugin in its own `jsPlugins` when it wants them:
47
+
48
+ ```jsonc
49
+ {
50
+ "extends": ["./node_modules/@murky-web/oxc-config/.oxlintrc.base.jsonc"]
51
+ }
52
+ ```
@@ -3,10 +3,13 @@
3
3
  "import/consistent-type-specifier-style": "error",
4
4
  "import/default": "error",
5
5
  "import/export": "error",
6
- "import/exports-last": "error",
6
+ // Exports stay at the declaration (`export function a() {}`): the
7
+ // reader sees at once what is public, and a rename or deletion needs
8
+ // no export list kept in step. No major preset turns these on.
9
+ "import/exports-last": "off",
7
10
  "import/extensions": "error",
8
11
  "import/first": "error",
9
- "import/group-exports": "error",
12
+ "import/group-exports": "off",
10
13
  "import/max-dependencies": "off",
11
14
  "import/named": "error",
12
15
  "import/namespace": "error",
@@ -0,0 +1,14 @@
1
+ {
2
+ // Generic rules from @murky-web/oxlint-plugin (prefix murky); needs the
3
+ // plugin in your own jsPlugins.
4
+ "rules": {
5
+ // Replaces unicorn/prefer-string-raw (unicorn.jsonc) wherever this
6
+ // file is extended, so a literal is reported once.
7
+ "unicorn/prefer-string-raw": "off",
8
+ // unicorn's rule plus the module-load exception: inside a function
9
+ // "a\\b" becomes String.raw`a\b`; at module load the plain literal
10
+ // stays and String.raw is reported, because a bundler cannot drop the
11
+ // tagged-template call from client chunks when the value is unused.
12
+ "murky/prefer-string-raw": "error"
13
+ }
14
+ }
@@ -115,6 +115,9 @@
115
115
  "unicorn/prefer-set-has": "error",
116
116
  "unicorn/prefer-set-size": "error",
117
117
  "unicorn/prefer-spread": "error",
118
+ // murky.jsonc replaces this rule with murky/prefer-string-raw, which
119
+ // keeps plain literals at module load (String.raw there is a call a
120
+ // bundler cannot drop); projects without it keep this one.
118
121
  "unicorn/prefer-string-raw": "error",
119
122
  "unicorn/prefer-string-replace-all": "error",
120
123
  "unicorn/prefer-string-slice": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@murky-web/oxc-config",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "Shared oxfmt and oxlint configuration",
5
5
  "license": "ISC",
6
6
  "repository": {
@@ -10,8 +10,10 @@
10
10
  },
11
11
  "files": [
12
12
  ".oxfmtrc.jsonc",
13
+ ".oxlintrc.base.jsonc",
13
14
  ".oxlintrc.jsonc",
14
15
  "linting",
16
+ "plugins",
15
17
  "README.md"
16
18
  ],
17
19
  "publishConfig": {
@@ -21,8 +23,15 @@
21
23
  "scripts": {
22
24
  "test": "bun ./check_prefixes.mjs"
23
25
  },
26
+ "dependencies": {
27
+ "@murky-web/oxlint-plugin": "^0.1.0",
28
+ "@murky-web/oxlint-plugin-solid": "^1.7.0",
29
+ "@murky-web/simplelog": "^3.1.2",
30
+ "@murky-web/typebuddy": "^3.1.0"
31
+ },
24
32
  "peerDependencies": {
25
33
  "oxfmt": ">=0.79.0",
26
- "oxlint": ">=1.94.0"
34
+ "oxlint": ">=1.94.0",
35
+ "oxlint-tsgolint": ">=7.0.2007"
27
36
  }
28
37
  }
@@ -0,0 +1,12 @@
1
+ # Plugin entries
2
+
3
+ `.oxlintrc.jsonc` loads its JS plugins through these files instead of by
4
+ package name.
5
+
6
+ oxlint resolves a `jsPlugins` package name from the config file's path as the
7
+ project sees it: `node_modules/@murky-web/oxc-config/`. With an isolated install
8
+ (bun workspaces, pnpm) the plugins are dependencies of this package and sit next
9
+ to its real folder in the store, not in the project's `node_modules`, so the
10
+ name does not resolve there. A relative path resolves from the same place and
11
+ reaches these files; the runtime that loads them resolves their `import` from
12
+ their real location, where the plugins are.
@@ -0,0 +1,2 @@
1
+ // Loads @murky-web/oxlint-plugin for `.oxlintrc.jsonc` (see plugins/README.md).
2
+ export { default } from "@murky-web/oxlint-plugin";
@@ -0,0 +1,2 @@
1
+ // Loads @murky-web/simplelog/oxlint for `.oxlintrc.jsonc` (see plugins/README.md).
2
+ export { default } from "@murky-web/simplelog/oxlint";
@@ -0,0 +1,2 @@
1
+ // Loads @murky-web/oxlint-plugin-solid for `.oxlintrc.jsonc` (see plugins/README.md).
2
+ export { default } from "@murky-web/oxlint-plugin-solid";
@@ -0,0 +1,2 @@
1
+ // Loads @murky-web/typebuddy/oxlint for `.oxlintrc.jsonc` (see plugins/README.md).
2
+ export { default } from "@murky-web/typebuddy/oxlint";