@minimalstuff/tooling 0.7.0 → 0.8.0-next.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sonny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -12,9 +12,10 @@
12
12
  - Node >= 26
13
13
  - `oxlint`, `oxfmt` and `oxlint-tsgolint` (optional peer dependencies, for the OXC presets)
14
14
  - `knip` >= 6.42.1 (optional peer dependency, for the Knip preset)
15
+ - `@adonisjs/eslint-plugin` ^2.2.2 (optional peer dependency, required when `adonisjs: true` is used in the oxlint preset; the CLI installs it)
15
16
 
16
17
  > [!IMPORTANT]
17
- > New/updated rules will not be considered as breaking changes. Only API changes will be considered as breaking changes.
18
+ > API changes are breaking changes. Before 1.0, new or stricter `error`-level rules are breaking too: they ship in a minor release, which `^0.x` ranges never pick up automatically. New `warn`-level rules and relaxed rules are not breaking.
18
19
 
19
20
  ## Setup
20
21
 
@@ -44,6 +45,8 @@ With Knip and OXC selected, `check` also runs `pnpm knip` at the end. Knip alone
44
45
 
45
46
  ```bash
46
47
  pnpm add -D oxlint oxfmt oxlint-tsgolint @minimalstuff/tooling
48
+ # optional, for the AdonisJS oxlint preset
49
+ pnpm add -D @adonisjs/eslint-plugin
47
50
  # optional, for the Knip preset
48
51
  pnpm add -D knip
49
52
  ```
@@ -65,16 +68,22 @@ export default minimalstuffPreset({
65
68
 
66
69
  `minimalstuffPreset` returns the root config. Any oxlint option (`rules`, `overrides`, `plugins`, `extends`, ...) can be passed next to the preset options:
67
70
 
68
- | Option | Type | Default | Enables |
69
- | ---------- | --------- | ------- | --------------------------------------------------------------------------------------------------------- |
70
- | `react` | `boolean` | `false` | `react` and `jsx-a11y` plugins, `react/rules-of-hooks` and `react/only-export-components` |
71
- | `adonisjs` | `boolean` | `false` | `@adonisjs/eslint-plugin` lazy import rules, Lucid-aware `no-floating-promises`, AdonisJS ignore patterns |
72
- | `vitest` | `boolean` | `false` | `vitest` plugin |
71
+ | Option | Type | Default | Enables |
72
+ | ---------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
73
+ | `react` | `boolean` | `false` | `react` and `jsx-a11y` plugins, `react/rules-of-hooks` and `react/only-export-components` |
74
+ | `adonisjs` | `boolean` | `false` | `@adonisjs/eslint-plugin` lazy import rules, Lucid-aware `no-floating-promises`, AdonisJS ignore patterns (needs `@adonisjs/eslint-plugin` as a dev dependency, the CLI installs it) |
75
+ | `vitest` | `boolean` | `false` | `vitest` plugin |
73
76
 
74
77
  With both `adonisjs` and `react`, the Inertia rules (`no-backend-import-in-frontend`, `prefer-adonisjs-inertia-link`, `prefer-adonisjs-inertia-form`) are enabled on `**/inertia/**/*.{ts,tsx}`.
75
78
 
76
79
  The base preset enables the `typescript`, `unicorn` and `oxc` plugins, the `correctness` category as `error`, and type-aware linting with type checking (`typeAware`, `typeCheck`) with a set of strict `typescript/*` rules.
77
80
 
81
+ It also enables the `promise` plugin and these async rules:
82
+
83
+ - `no-await-in-loop`: `warn`, turned off for test files (`**/*.{test,spec}.{ts,tsx,js,jsx}` and `**/tests/**`)
84
+ - `error`: `promise/param-names`, `promise/no-return-in-finally`, `promise/no-multiple-resolved`, `promise/no-new-statics`, `promise/valid-params`
85
+ - `warn`: `promise/no-nesting`
86
+
78
87
  ### Merge semantics
79
88
 
80
89
  - `rules`: yours override the preset's
@@ -144,6 +153,17 @@ For the targeted workspace(s):
144
153
 
145
154
  With `adonisjs: true`, the preset is merged into the root keys. If you define `workspaces['.']` yourself, knip ignores the root keys: use `adonisjs: ['.']` instead. With a list of paths, the root keys are left untouched and each listed workspace gets the preset merged with its own `workspaces[path]` entry.
146
155
 
156
+ ## Migrating from 0.7
157
+
158
+ In 0.x a minor bump is breaking, so `^0.7.0` never resolves to 0.8: upgrade explicitly.
159
+
160
+ ```bash
161
+ pnpm add -D @minimalstuff/tooling@^0.8.0
162
+ ```
163
+
164
+ - AdonisJS projects (`adonisjs: true`) must install the plugin themselves: `pnpm add -D @adonisjs/eslint-plugin`. It is now an optional peer dependency instead of a dependency of this package.
165
+ - The base oxlint preset now enables the `promise` plugin and the async rules listed in [oxlint](#oxlint): the error-level ones may surface new errors.
166
+
147
167
  ## Migrating from 0.6
148
168
 
149
169
  In 0.x a minor bump is breaking, so `^0.6.0` never resolves to 0.7: upgrade explicitly.
@@ -204,6 +224,6 @@ Other changes:
204
224
 
205
225
  Publishing uses npm [trusted publishing](https://docs.npmjs.com/trusted-publishers) (OIDC), no token needed. On npmjs.com, `@minimalstuff/tooling` > **Settings > Trusted publishing** must list GitHub Actions with organization `minimalstuff`, repository `tooling` and workflow `publish.yml`. Publishing a GitHub release triggers the workflow.
206
226
 
207
- ---
227
+ ## License
208
228
 
209
- > source: https://github.com/Julien-R44/tooling
229
+ [MIT](LICENSE)
@@ -95,23 +95,16 @@ function toPresetFlags(names) {
95
95
  vitest: names.includes("vitest")
96
96
  };
97
97
  }
98
+ async function listDirectoryManifestLocations(cwd, workspaceDirectory) {
99
+ const directoryPath = join(cwd, workspaceDirectory);
100
+ if (!existsSync(directoryPath)) return [];
101
+ return (await readdir(directoryPath, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => ({
102
+ workspacePath: `${workspaceDirectory}/${entry.name}`,
103
+ manifestPath: join(directoryPath, entry.name, "package.json")
104
+ })).filter(({ manifestPath }) => existsSync(manifestPath));
105
+ }
98
106
  async function listWorkspaceManifestLocations(cwd) {
99
- const locations = [];
100
- for (const workspaceDirectory of WORKSPACE_DIRECTORIES) {
101
- const directoryPath = join(cwd, workspaceDirectory);
102
- if (!existsSync(directoryPath)) continue;
103
- const entries = await readdir(directoryPath, { withFileTypes: true });
104
- for (const entry of entries) {
105
- if (!entry.isDirectory()) continue;
106
- const manifestPath = join(directoryPath, entry.name, "package.json");
107
- if (!existsSync(manifestPath)) continue;
108
- locations.push({
109
- workspacePath: `${workspaceDirectory}/${entry.name}`,
110
- manifestPath
111
- });
112
- }
113
- }
114
- return locations;
107
+ return (await Promise.all(WORKSPACE_DIRECTORIES.map((workspaceDirectory) => listDirectoryManifestLocations(cwd, workspaceDirectory)))).flat();
115
108
  }
116
109
  async function readWorkspaceManifests(cwd) {
117
110
  const rootManifestPath = join(cwd, "package.json");
@@ -259,6 +252,18 @@ async function updateKnip(result) {
259
252
  });
260
253
  log.success("Knip configured");
261
254
  }
255
+ // src/cli/list_oxc_packages.ts
256
+ const BASE_OXC_PACKAGES = [
257
+ "oxfmt",
258
+ "oxlint",
259
+ "oxlint-tsgolint",
260
+ TOOLING_PACKAGE_NAME
261
+ ];
262
+ const ADONISJS_ESLINT_PLUGIN_PACKAGE = "@adonisjs/eslint-plugin";
263
+ function listOxcPackages(presetFlags) {
264
+ if (!presetFlags.adonisjs) return [...BASE_OXC_PACKAGES];
265
+ return [...BASE_OXC_PACKAGES, ADONISJS_ESLINT_PLUGIN_PACKAGE];
266
+ }
262
267
  // src/cli/oxc_config_content.ts
263
268
  const OXLINT_PRESET_ORDER = [
264
269
  "adonisjs",
@@ -300,12 +305,6 @@ async function updateVscodeSettings(cwd) {
300
305
  log.success(".vscode/settings.json updated");
301
306
  }
302
307
  // src/cli/update_oxc.ts
303
- const OXC_PACKAGES = [
304
- "oxfmt",
305
- "oxlint",
306
- "oxlint-tsgolint",
307
- TOOLING_PACKAGE_NAME
308
- ];
309
308
  const OXLINT_CONFIG_FILE = "oxlint.config.ts";
310
309
  const OXFMT_CONFIG_FILE = "oxfmt.config.ts";
311
310
  const CONFLICTING_OXLINT_CONFIG_FILES = [".oxlintrc.json", ".oxlintrc.jsonc"];
@@ -321,7 +320,7 @@ async function updateOxc(result) {
321
320
  await writeGeneratedFile(join(cwd, OXLINT_CONFIG_FILE), buildOxlintConfigContent(result.presetFlags));
322
321
  await writeGeneratedFile(join(cwd, OXFMT_CONFIG_FILE), buildOxfmtConfigContent(result.presetFlags));
323
322
  if (result.tools.includes("vscode")) await updateVscodeSettings(cwd);
324
- await installPackage(OXC_PACKAGES, {
323
+ await installPackage(listOxcPackages(result.presetFlags), {
325
324
  dev: true,
326
325
  cwd
327
326
  });
package/dist/oxc/lint.mjs CHANGED
@@ -2,12 +2,14 @@ import { n as COMMON_IGNORE_PATTERNS, t as ADONISJS_IGNORE_PATTERNS } from "../s
2
2
  import { defineConfig } from "oxlint";
3
3
  // src/oxc/lint.ts
4
4
  const INERTIA_FRONTEND_FILES = ["**/inertia/**/*.{ts,tsx}"];
5
+ const TEST_FILES = ["**/*.{test,spec}.{ts,tsx,js,jsx}", "**/tests/**"];
5
6
  function createBasePreset() {
6
7
  return defineConfig({
7
8
  plugins: [
8
9
  "typescript",
9
10
  "unicorn",
10
- "oxc"
11
+ "oxc",
12
+ "promise"
11
13
  ],
12
14
  categories: { correctness: "error" },
13
15
  options: {
@@ -15,6 +17,13 @@ function createBasePreset() {
15
17
  typeCheck: true
16
18
  },
17
19
  rules: {
20
+ "no-await-in-loop": "warn",
21
+ "promise/param-names": "error",
22
+ "promise/no-return-in-finally": "error",
23
+ "promise/no-multiple-resolved": "error",
24
+ "promise/no-new-statics": "error",
25
+ "promise/valid-params": "error",
26
+ "promise/no-nesting": "warn",
18
27
  "typescript/await-thenable": "error",
19
28
  "typescript/no-floating-promises": "error",
20
29
  "typescript/no-misused-promises": "error",
@@ -27,7 +36,11 @@ function createBasePreset() {
27
36
  "typescript/prefer-promise-reject-errors": "error",
28
37
  "typescript/consistent-type-imports": "error",
29
38
  "typescript/no-deprecated": "warn"
30
- }
39
+ },
40
+ overrides: [{
41
+ files: TEST_FILES,
42
+ rules: { "no-await-in-loop": "off" }
43
+ }]
31
44
  });
32
45
  }
33
46
  function createReactPreset() {
package/package.json CHANGED
@@ -1,115 +1,131 @@
1
1
  {
2
- "name": "@minimalstuff/tooling",
3
- "version": "0.7.0",
4
- "description": "Shared tooling configs: EditorConfig, OXC (oxlint + oxfmt), Knip",
5
- "keywords": [
6
- "editorconfig",
7
- "knip",
8
- "oxc",
9
- "oxfmt",
10
- "oxlint",
11
- "react"
12
- ],
13
- "license": "MIT",
14
- "author": "Sonny93 <sonnyasdev@gmail.com>",
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/minimalstuff/tooling"
18
- },
19
- "bin": "./dist/cli/index.mjs",
20
- "files": [
21
- "dist",
22
- "preset"
23
- ],
24
- "type": "module",
25
- "exports": {
26
- "./editorconfig": "./preset/.editorconfig",
27
- "./oxc/lint": "./dist/oxc/lint.mjs",
28
- "./oxc/fmt": "./dist/oxc/fmt.mjs",
29
- "./knip": "./dist/knip/knip.mjs"
30
- },
31
- "publishConfig": {
32
- "access": "public",
33
- "provenance": true
34
- },
35
- "scripts": {
36
- "knip": "knip",
37
- "lint": "oxlint",
38
- "lint:fix": "oxlint --fix",
39
- "format": "oxfmt && oxlint --fix",
40
- "format:check": "oxfmt --check",
41
- "typecheck": "tsc --noEmit",
42
- "test": "vitest run",
43
- "build": "tsdown",
44
- "checks": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm knip && pnpm test && pnpm build",
45
- "release": "release-it"
46
- },
47
- "dependencies": {
48
- "@adonisjs/eslint-plugin": "^2.2.2",
49
- "@antfu/install-pkg": "^2.1.0",
50
- "@clack/prompts": "^1.8.1",
51
- "jsonc-parser": "^3.3.1",
52
- "picocolors": "^1.1.1"
53
- },
54
- "devDependencies": {
55
- "@release-it/conventional-changelog": "^12.0.2",
56
- "@types/node": "^26.6.5",
57
- "knip": "6.42.1",
58
- "oxfmt": "^0.74.0",
59
- "oxlint": "^1.89.0",
60
- "oxlint-tsgolint": "^7.0.2004",
61
- "release-it": "^21.1.1",
62
- "tsdown": "^0.23.1",
63
- "typescript": "^7.0.2",
64
- "vitest": "^5.0.5"
65
- },
66
- "peerDependencies": {
67
- "knip": ">=6.42.1",
68
- "oxfmt": ">=0.74.0",
69
- "oxlint": ">=1.89.0",
70
- "oxlint-tsgolint": ">=7.0.2004"
71
- },
72
- "peerDependenciesMeta": {
73
- "knip": {
74
- "optional": true
75
- },
76
- "oxfmt": {
77
- "optional": true
78
- },
79
- "oxlint": {
80
- "optional": true
81
- },
82
- "oxlint-tsgolint": {
83
- "optional": true
84
- }
85
- },
86
- "engines": {
87
- "node": ">=26"
88
- },
89
- "packageManager": "pnpm@12.15.0",
90
- "release-it": {
91
- "git": {
92
- "requireCleanWorkingDir": true,
93
- "requireUpstream": true,
94
- "commitMessage": "chore(release): ${version}",
95
- "tagAnnotation": "v${version}",
96
- "push": true,
97
- "tagName": "v${version}"
98
- },
99
- "github": {
100
- "release": true
101
- },
102
- "npm": {
103
- "publish": false
104
- },
105
- "plugins": {
106
- "@release-it/conventional-changelog": {
107
- "infile": "CHANGELOG.md",
108
- "preset": {
109
- "name": "conventionalcommits",
110
- "preMajor": true
111
- }
112
- }
113
- }
114
- }
115
- }
2
+ "name": "@minimalstuff/tooling",
3
+ "version": "0.8.0-next.0",
4
+ "description": "Shared tooling configs: EditorConfig, OXC (oxlint + oxfmt), Knip",
5
+ "keywords": [
6
+ "editorconfig",
7
+ "knip",
8
+ "oxc",
9
+ "oxfmt",
10
+ "oxlint",
11
+ "react"
12
+ ],
13
+ "license": "MIT",
14
+ "author": "Sonny93 <sonnyasdev@gmail.com>",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/minimalstuff/tooling"
18
+ },
19
+ "bin": {
20
+ "tooling": "./dist/cli/index.mjs"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "preset"
25
+ ],
26
+ "type": "module",
27
+ "exports": {
28
+ "./editorconfig": "./preset/.editorconfig",
29
+ "./oxc/lint": "./dist/oxc/lint.mjs",
30
+ "./oxc/fmt": "./dist/oxc/fmt.mjs",
31
+ "./knip": "./dist/knip/knip.mjs"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "provenance": true
36
+ },
37
+ "dependencies": {
38
+ "@antfu/install-pkg": "^2.1.0",
39
+ "@clack/prompts": "^1.8.1",
40
+ "jsonc-parser": "^3.3.1",
41
+ "picocolors": "^1.1.1"
42
+ },
43
+ "devDependencies": {
44
+ "@adonisjs/eslint-plugin": "^2.2.2",
45
+ "@release-it/conventional-changelog": "^12.0.2",
46
+ "@types/node": "^26.6.6",
47
+ "knip": "6.44.1",
48
+ "oxfmt": "^0.75.0",
49
+ "oxlint": "^1.90.0",
50
+ "oxlint-tsgolint": "^7.0.2005",
51
+ "release-it": "^21.1.2",
52
+ "tsdown": "^0.23.4",
53
+ "typescript": "^7.0.2",
54
+ "vitest": "^5.0.5"
55
+ },
56
+ "peerDependencies": {
57
+ "@adonisjs/eslint-plugin": "^2.2.2",
58
+ "knip": ">=6.42.1",
59
+ "oxfmt": ">=0.74.0",
60
+ "oxlint": ">=1.89.0",
61
+ "oxlint-tsgolint": ">=7.0.2004"
62
+ },
63
+ "peerDependenciesMeta": {
64
+ "@adonisjs/eslint-plugin": {
65
+ "optional": true
66
+ },
67
+ "knip": {
68
+ "optional": true
69
+ },
70
+ "oxfmt": {
71
+ "optional": true
72
+ },
73
+ "oxlint": {
74
+ "optional": true
75
+ },
76
+ "oxlint-tsgolint": {
77
+ "optional": true
78
+ }
79
+ },
80
+ "engines": {
81
+ "node": ">=26"
82
+ },
83
+ "release-it": {
84
+ "hooks": {
85
+ "before:init": "pnpm checks"
86
+ },
87
+ "git": {
88
+ "requireCleanWorkingDir": true,
89
+ "requireUpstream": true,
90
+ "commitMessage": "chore(release): ${version}",
91
+ "tagAnnotation": "v${version}",
92
+ "push": true,
93
+ "tagName": "v${version}",
94
+ "tagExclude": "*.*.*-*"
95
+ },
96
+ "github": {
97
+ "release": true
98
+ },
99
+ "npm": {
100
+ "publish": false
101
+ },
102
+ "plugins": {
103
+ "@release-it/conventional-changelog": {
104
+ "infile": "CHANGELOG.md",
105
+ "preset": {
106
+ "name": "conventionalcommits",
107
+ "preMajor": true
108
+ },
109
+ "tagOpts": {
110
+ "skipUnstable": true
111
+ },
112
+ "writerOpts": {
113
+ "generateOn": null
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "scripts": {
119
+ "knip": "knip",
120
+ "lint": "oxlint",
121
+ "lint:fix": "oxlint --fix",
122
+ "format": "oxfmt && oxlint --fix",
123
+ "format:check": "oxfmt --check",
124
+ "typecheck": "tsc --noEmit",
125
+ "test": "vitest run",
126
+ "test:package": "vitest run --config vitest.package.config.ts",
127
+ "build": "tsdown",
128
+ "checks": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm knip && pnpm test && pnpm build",
129
+ "release": "release-it"
130
+ }
131
+ }