@murky-web/oxc-config 0.1.1 → 0.2.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.
@@ -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,21 @@
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
+ "jsPlugins": [
16
+ "@murky-web/oxlint-plugin",
17
+ "@murky-web/oxlint-plugin-solid",
18
+ "@murky-web/typebuddy/oxlint",
19
+ "@murky-web/simplelog/oxlint"
27
20
  ]
28
21
  }
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
+ ```
@@ -106,7 +106,23 @@
106
106
  "eslint/no-lonely-if": "error",
107
107
  "eslint/no-loop-func": "error",
108
108
  "eslint/no-loss-of-precision": "error",
109
- "eslint/no-magic-numbers": "error",
109
+ // 0, 1, 2 and -1 are not magic; neither are defaults, enum values,
110
+ // literal types or readonly class fields. Array indexes are reported
111
+ // (match[3] should be a named capture group). solid.jsonc replaces
112
+ // this rule with solid/no-magic-numbers, a fork with the same options
113
+ // and an agent-ready message; projects without it keep this one.
114
+ "eslint/no-magic-numbers": [
115
+ "error",
116
+ {
117
+ "ignore": [-1, 0, 1, 2],
118
+ "ignoreDefaultValues": true,
119
+ "ignoreClassFieldInitialValues": true,
120
+ "ignoreEnums": true,
121
+ "ignoreNumericLiteralTypes": true,
122
+ "ignoreReadonlyClassProperties": true,
123
+ "ignoreTypeIndexes": true
124
+ }
125
+ ],
110
126
  "eslint/no-misleading-character-class": "error",
111
127
  "eslint/no-multi-assign": "error",
112
128
  "eslint/no-multi-str": "error",
@@ -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
+ }
@@ -16,6 +16,29 @@
16
16
  "solid/no-cleanup-in-effect-apply": "error",
17
17
  "solid/no-destructure": "error",
18
18
  "solid/no-innerhtml": "error",
19
+ // Replaces eslint/no-magic-numbers (eslint.jsonc) wherever this file
20
+ // is extended, so a number is reported once.
21
+ "eslint/no-magic-numbers": "off",
22
+ // Fork of eslint/no-magic-numbers. 0, 1, 2 and
23
+ // -1 are not magic (items[0], count + 1, length / 2,
24
+ // indexOf(...) === -1); neither are defaults, enum values, literal
25
+ // types or readonly class fields. Array indexes are NOT ignored:
26
+ // match[3] should be a named capture group or a destructured name.
27
+ // 1000, 60, 24 stay reported and become named constants with their
28
+ // unit (RETRY_DELAY_MS). A server project can add
29
+ // "allowHttpStatusCodes": true for c.json(body, 404) and the like.
30
+ "solid/no-magic-numbers": [
31
+ "error",
32
+ {
33
+ "ignore": [-1, 0, 1, 2],
34
+ "ignoreDefaultValues": true,
35
+ "ignoreClassFieldInitialValues": true,
36
+ "ignoreEnums": true,
37
+ "ignoreNumericLiteralTypes": true,
38
+ "ignoreReadonlyClassProperties": true,
39
+ "ignoreTypeIndexes": true
40
+ }
41
+ ],
19
42
  "solid/no-module-scope-reactive-primitive": "error",
20
43
  "solid/no-owned-primitives-in-ref": "error",
21
44
  // Only for targets without Proxy; createStore and createProjection are
@@ -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.1",
3
+ "version": "0.2.0",
4
4
  "description": "Shared oxfmt and oxlint configuration",
5
5
  "license": "ISC",
6
6
  "repository": {
@@ -10,6 +10,7 @@
10
10
  },
11
11
  "files": [
12
12
  ".oxfmtrc.jsonc",
13
+ ".oxlintrc.base.jsonc",
13
14
  ".oxlintrc.jsonc",
14
15
  "linting",
15
16
  "README.md"
@@ -21,8 +22,15 @@
21
22
  "scripts": {
22
23
  "test": "bun ./check_prefixes.mjs"
23
24
  },
25
+ "dependencies": {
26
+ "@murky-web/oxlint-plugin": "^0.1.0",
27
+ "@murky-web/oxlint-plugin-solid": "^1.7.0",
28
+ "@murky-web/simplelog": "^3.1.2",
29
+ "@murky-web/typebuddy": "^3.1.0"
30
+ },
24
31
  "peerDependencies": {
25
32
  "oxfmt": ">=0.79.0",
26
- "oxlint": ">=1.94.0"
33
+ "oxlint": ">=1.94.0",
34
+ "oxlint-tsgolint": ">=7.0.2007"
27
35
  }
28
36
  }