@monke-together-strong/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.
- package/README.md +26 -3
- package/base.json +18 -0
- package/dist/oxfmt.mjs +6 -1
- package/dist/oxlint.mjs +86 -6
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
# `@monke-together-strong/oxc-config`
|
|
2
2
|
|
|
3
|
-
Shared Oxlint and Oxfmt presets maintained by Monke Together Strong.
|
|
3
|
+
Shared TypeScript, Oxlint, and Oxfmt presets maintained by Monke Together Strong.
|
|
4
|
+
|
|
5
|
+
## TypeScript
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bun add -D @monke-together-strong/oxc-config typescript
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"extends": "@monke-together-strong/oxc-config/base.json",
|
|
14
|
+
"compilerOptions": {
|
|
15
|
+
"module": "NodeNext",
|
|
16
|
+
"moduleResolution": "NodeNext",
|
|
17
|
+
"noEmit": true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The base preset contains runtime-neutral correctness and soundness settings. Consumers remain
|
|
23
|
+
responsible for environment-specific options such as `lib`, `module`, `moduleResolution`, JSX,
|
|
24
|
+
runtime types, and emit behavior.
|
|
25
|
+
|
|
26
|
+
## Oxc
|
|
4
27
|
|
|
5
28
|
The presets compose Ultracite's native Oxc configuration while allowing repository-specific settings to override shared defaults.
|
|
6
29
|
|
|
@@ -48,9 +71,9 @@ export { default } from "@monke-together-strong/oxc-config/oxfmt";
|
|
|
48
71
|
export { default } from "@monke-together-strong/oxc-config/oxlint";
|
|
49
72
|
```
|
|
50
73
|
|
|
51
|
-
The Oxfmt preset uses a print width of 100, ignores team-managed `skills/**` and `AGENTS.md`, and appends consumer `ignorePatterns` after its shared ignores. Other consumer fields override the shared formatter defaults.
|
|
74
|
+
The Oxfmt preset formats JSDoc, uses a print width of 100, ignores team-managed `skills/**` and `AGENTS.md`, and appends consumer `ignorePatterns` after its shared ignores. Other consumer fields override the shared formatter defaults.
|
|
52
75
|
|
|
53
|
-
The default Oxlint preset composes Ultracite's core and Vitest presets, enables type-aware linting and TypeScript type checking, and
|
|
76
|
+
The default Oxlint preset composes Ultracite's core and Vitest presets, enables type-aware linting and TypeScript type checking, rejects console calls and direct environment access, and requires explicit module boundary types. Environment variables should be read and validated through a centralized configuration boundary. It uses `eslint-plugin-perfectionist` to sort object literals, destructuring, object types, interfaces, JSX props, enums, and heritage clauses while treating comments as intentional object and enum partitions, and disables Ultracite's `sort-keys` rule. It also loads `eslint-plugin-jsdoc` through Oxlint's JavaScript-plugin compatibility layer to reject undefined JSDoc types that Oxlint does not yet implement natively. Files named `*.test.*`, `*.spec.*`, or stored under `__tests__` are assumed to use Vitest. Its framework-neutral test policy also covers files under `test/` and `tests/`, where `typescript/no-unsafe-type-assertion` is disabled because typed mock and fixture setup is not yet ergonomic enough to justify the churn.
|
|
54
77
|
|
|
55
78
|
Mixed-framework repositories can exclude framework-owned paths from the Vitest preset:
|
|
56
79
|
|
package/base.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowUnreachableCode": false,
|
|
5
|
+
"allowUnusedLabels": false,
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"noFallthroughCasesInSwitch": true,
|
|
10
|
+
"noImplicitOverride": true,
|
|
11
|
+
"noImplicitReturns": true,
|
|
12
|
+
"noUncheckedIndexedAccess": true,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"noUnusedParameters": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"strict": true
|
|
17
|
+
}
|
|
18
|
+
}
|
package/dist/oxfmt.mjs
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import ultracite from "ultracite/oxfmt";
|
|
2
2
|
//#region src/oxfmt.ts
|
|
3
|
-
const sharedIgnorePatterns = [
|
|
3
|
+
const sharedIgnorePatterns = [
|
|
4
|
+
"skills/**",
|
|
5
|
+
"AGENTS.md",
|
|
6
|
+
"**/routeTree.gen.ts"
|
|
7
|
+
];
|
|
4
8
|
function createOxfmtConfig(options = {}) {
|
|
5
9
|
const { ignorePatterns = [], ...config } = options;
|
|
6
10
|
return {
|
|
7
11
|
...ultracite,
|
|
12
|
+
jsdoc: true,
|
|
8
13
|
printWidth: 100,
|
|
9
14
|
proseWrap: "preserve",
|
|
10
15
|
trailingComma: "none",
|
package/dist/oxlint.mjs
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import core from "ultracite/oxlint/core";
|
|
2
3
|
import vitest from "ultracite/oxlint/vitest";
|
|
3
4
|
//#region src/oxlint.ts
|
|
4
|
-
const
|
|
5
|
+
const localRequire = createRequire(import.meta.url);
|
|
6
|
+
const jsdocPlugin = {
|
|
7
|
+
name: "jsdoc-js",
|
|
8
|
+
specifier: localRequire.resolve("eslint-plugin-jsdoc")
|
|
9
|
+
};
|
|
10
|
+
const perfectionistPlugin = {
|
|
11
|
+
name: "perfectionist",
|
|
12
|
+
specifier: localRequire.resolve("eslint-plugin-perfectionist")
|
|
13
|
+
};
|
|
14
|
+
const defaultTestFiles = [
|
|
15
|
+
"**/*.{test,spec}.{ts,tsx,js,jsx}",
|
|
16
|
+
"**/__tests__/**/*.{ts,tsx,js,jsx}",
|
|
17
|
+
"**/__mocks__/**/*.{ts,tsx,js,jsx}",
|
|
18
|
+
"**/{test,tests}/**/*.{ts,tsx,js,jsx}"
|
|
19
|
+
];
|
|
20
|
+
const executableTestFiles = ["**/*.{test,spec}.{ts,tsx,js,jsx}"];
|
|
21
|
+
const generatedFileIgnorePatterns = ["**/routeTree.gen.ts"];
|
|
5
22
|
function createOxlintConfig(options = {}) {
|
|
6
|
-
const { extends: extensions = [], ignorePatterns = [], options: lintOptions = {}, overrides = [], rules = {}, testFiles = defaultTestFiles, vitestExcludeFiles = [], ...config } = options;
|
|
23
|
+
const { extends: extensions = [], ignorePatterns = [], jsPlugins = [], options: lintOptions = {}, overrides = [], rules = {}, testFiles = defaultTestFiles, vitestExcludeFiles = [], ...config } = options;
|
|
7
24
|
const vitestOverrides = (vitest.overrides ?? []).map((override) => {
|
|
8
25
|
const excludeFiles = [...override.excludeFiles ?? [], ...vitestExcludeFiles];
|
|
9
26
|
return {
|
|
@@ -26,16 +43,46 @@ function createOxlintConfig(options = {}) {
|
|
|
26
43
|
vitestConfig,
|
|
27
44
|
...extensions
|
|
28
45
|
],
|
|
29
|
-
ignorePatterns: [
|
|
46
|
+
ignorePatterns: [
|
|
47
|
+
...core.ignorePatterns ?? [],
|
|
48
|
+
...generatedFileIgnorePatterns,
|
|
49
|
+
...ignorePatterns
|
|
50
|
+
],
|
|
51
|
+
jsPlugins: [
|
|
52
|
+
jsdocPlugin,
|
|
53
|
+
perfectionistPlugin,
|
|
54
|
+
...jsPlugins ?? []
|
|
55
|
+
],
|
|
30
56
|
options: {
|
|
31
57
|
typeAware: true,
|
|
32
58
|
typeCheck: true,
|
|
33
59
|
...lintOptions
|
|
34
60
|
},
|
|
35
61
|
overrides: [
|
|
62
|
+
{
|
|
63
|
+
files: executableTestFiles,
|
|
64
|
+
rules: { complexity: "off" }
|
|
65
|
+
},
|
|
36
66
|
{
|
|
37
67
|
files: [...testFiles],
|
|
38
|
-
rules: {
|
|
68
|
+
rules: {
|
|
69
|
+
"no-await-in-loop": "off",
|
|
70
|
+
"no-console": "off",
|
|
71
|
+
"no-inline-comments": "off",
|
|
72
|
+
"no-script-url": "off",
|
|
73
|
+
"node/no-process-env": "off",
|
|
74
|
+
"require-await": "off",
|
|
75
|
+
"typescript/no-dynamic-delete": "off",
|
|
76
|
+
"typescript/no-unsafe-type-assertion": "off",
|
|
77
|
+
"typescript/restrict-template-expressions": "off",
|
|
78
|
+
"typescript/unbound-method": "off",
|
|
79
|
+
"unicorn/consistent-function-scoping": "off",
|
|
80
|
+
"unicorn/no-object-as-default-parameter": "off"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
files: ["**/skills/**"],
|
|
85
|
+
rules: { "node/no-process-env": "off" }
|
|
39
86
|
},
|
|
40
87
|
{
|
|
41
88
|
files: ["**/*.{ts,tsx}"],
|
|
@@ -44,16 +91,49 @@ function createOxlintConfig(options = {}) {
|
|
|
44
91
|
...overrides
|
|
45
92
|
],
|
|
46
93
|
rules: {
|
|
94
|
+
"class-methods-use-this": "off",
|
|
95
|
+
eqeqeq: ["error", "smart"],
|
|
47
96
|
"func-style": "off",
|
|
97
|
+
"jsdoc-js/no-undefined-types": "error",
|
|
98
|
+
"max-classes-per-file": "off",
|
|
99
|
+
"no-console": "error",
|
|
100
|
+
"no-eq-null": "off",
|
|
101
|
+
"no-negated-condition": "off",
|
|
48
102
|
"no-nested-ternary": "off",
|
|
49
|
-
"no-use-before-define": ["error", {
|
|
103
|
+
"no-use-before-define": ["error", {
|
|
104
|
+
classes: false,
|
|
105
|
+
functions: false,
|
|
106
|
+
variables: false
|
|
107
|
+
}],
|
|
50
108
|
"no-warning-comments": "off",
|
|
109
|
+
"node/no-process-env": "error",
|
|
110
|
+
"perfectionist/sort-enums": ["error", {
|
|
111
|
+
partitionByComment: true,
|
|
112
|
+
sortByValue: "always"
|
|
113
|
+
}],
|
|
114
|
+
"perfectionist/sort-heritage-clauses": "error",
|
|
115
|
+
"perfectionist/sort-interfaces": "error",
|
|
116
|
+
"perfectionist/sort-jsx-props": "error",
|
|
117
|
+
"perfectionist/sort-object-types": "error",
|
|
118
|
+
"perfectionist/sort-objects": ["error", { partitionByComment: true }],
|
|
51
119
|
"prefer-regex-literals": "off",
|
|
52
120
|
"promise/avoid-new": "off",
|
|
53
121
|
"promise/prefer-await-to-callbacks": "off",
|
|
54
122
|
"promise/prefer-await-to-then": "off",
|
|
123
|
+
"sort-keys": "off",
|
|
124
|
+
"typescript/consistent-return": "off",
|
|
125
|
+
"typescript/explicit-module-boundary-types": "off",
|
|
126
|
+
"typescript/no-extraneous-class": ["error", { allowWithDecorator: true }],
|
|
127
|
+
"typescript/parameter-properties": "off",
|
|
128
|
+
"typescript/prefer-nullish-coalescing": ["error", { ignorePrimitives: { string: true } }],
|
|
55
129
|
"typescript/promise-function-async": "off",
|
|
56
|
-
"typescript/
|
|
130
|
+
"typescript/strict-boolean-expressions": ["error", {
|
|
131
|
+
allowNullableBoolean: true,
|
|
132
|
+
allowNullableObject: true,
|
|
133
|
+
allowNullableString: true
|
|
134
|
+
}],
|
|
135
|
+
"unicorn/no-array-reduce": "off",
|
|
136
|
+
"unicorn/no-negated-condition": "off",
|
|
57
137
|
"unicorn/no-nested-ternary": "off",
|
|
58
138
|
...rules
|
|
59
139
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monke-together-strong/oxc-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared Oxlint and Oxfmt presets.",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Shared TypeScript, Oxlint, and Oxfmt presets.",
|
|
5
5
|
"homepage": "https://github.com/monke-together-strong/monke-tools/tree/main/packages/oxc-config#readme",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/monke-together-strong/monke-tools/issues"
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
"directory": "packages/oxc-config"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
+
"base.json",
|
|
16
17
|
"dist",
|
|
17
18
|
"LICENSE",
|
|
18
19
|
"README.md"
|
|
19
20
|
],
|
|
20
21
|
"type": "module",
|
|
21
22
|
"exports": {
|
|
23
|
+
"./base.json": "./base.json",
|
|
22
24
|
"./oxfmt": {
|
|
23
25
|
"types": "./dist/oxfmt.d.mts",
|
|
24
26
|
"import": "./dist/oxfmt.mjs"
|
|
@@ -35,15 +37,17 @@
|
|
|
35
37
|
"prepack": "vp pack"
|
|
36
38
|
},
|
|
37
39
|
"dependencies": {
|
|
40
|
+
"eslint-plugin-jsdoc": "63.3.3",
|
|
41
|
+
"eslint-plugin-perfectionist": "5.10.1",
|
|
38
42
|
"ultracite": "7.9.4"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"oxfmt": "0.
|
|
42
|
-
"oxlint": "1.
|
|
45
|
+
"oxfmt": "0.62.0",
|
|
46
|
+
"oxlint": "1.77.0"
|
|
43
47
|
},
|
|
44
48
|
"peerDependencies": {
|
|
45
|
-
"oxfmt": "^0.
|
|
46
|
-
"oxlint": "^1.
|
|
49
|
+
"oxfmt": "^0.62.0",
|
|
50
|
+
"oxlint": "^1.77.0",
|
|
47
51
|
"oxlint-tsgolint": ">=7.0.2001"
|
|
48
52
|
}
|
|
49
53
|
}
|