@minimalstuff/tooling 0.3.0 → 0.4.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 -0
- package/dist/cli/index.mjs +8 -2
- package/dist/oxc/fmt.d.mts +3 -1
- package/dist/oxc/fmt.mjs +8 -2
- package/dist/oxc/lint.d.mts +2 -1
- package/dist/oxc/lint.mjs +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,10 +46,19 @@ Options:
|
|
|
46
46
|
| `perfectionist` | `boolean` | `false` | Enable import sorting via perfectionist |
|
|
47
47
|
|
|
48
48
|
```ts
|
|
49
|
+
import {
|
|
50
|
+
ADONISJS_DEFAULT_IGNORE_PATTERNS,
|
|
51
|
+
minimalstuffPreset,
|
|
52
|
+
} from '@minimalstuff/tooling/oxc/lint';
|
|
53
|
+
|
|
49
54
|
export default defineConfig({
|
|
55
|
+
ignorePatterns: [...ADONISJS_DEFAULT_IGNORE_PATTERNS, 'tmp/**'],
|
|
50
56
|
extends: [
|
|
51
57
|
minimalstuffPreset({ react: true, adonisjs: true, perfectionist: true }),
|
|
52
58
|
],
|
|
59
|
+
rules: {
|
|
60
|
+
'no-unused-vars': 'error',
|
|
61
|
+
},
|
|
53
62
|
});
|
|
54
63
|
```
|
|
55
64
|
|
|
@@ -68,6 +77,23 @@ You can override any option:
|
|
|
68
77
|
export default minimalstuffPreset({ printWidth: 120, semi: true });
|
|
69
78
|
```
|
|
70
79
|
|
|
80
|
+
For Adonis projects, you can extend ignore patterns:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import {
|
|
84
|
+
ADONISJS_DEFAULT_IGNORE_PATTERNS,
|
|
85
|
+
minimalstuffPreset,
|
|
86
|
+
OXFMT_DEFAULT_IGNORE_PATTERNS,
|
|
87
|
+
} from '@minimalstuff/tooling/oxc/fmt';
|
|
88
|
+
|
|
89
|
+
export default minimalstuffPreset({
|
|
90
|
+
ignorePatterns: [
|
|
91
|
+
...OXFMT_DEFAULT_IGNORE_PATTERNS,
|
|
92
|
+
...ADONISJS_DEFAULT_IGNORE_PATTERNS,
|
|
93
|
+
],
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
71
97
|
Defaults: `printWidth: 100`, `semi: false`, `singleQuote: true`, `trailingComma: 'all'`, `arrowParens: 'avoid'`.
|
|
72
98
|
|
|
73
99
|
#### Scripts
|
package/dist/cli/index.mjs
CHANGED
|
@@ -28,7 +28,6 @@ export default minimalstuffPreset()
|
|
|
28
28
|
`;
|
|
29
29
|
const vscodeSettings = {
|
|
30
30
|
"oxc.typeAware": true,
|
|
31
|
-
"oxc.fmt.experimental": true,
|
|
32
31
|
"editor.defaultFormatter": "oxc.oxc-vscode"
|
|
33
32
|
};
|
|
34
33
|
const oxcScripts = {
|
|
@@ -86,7 +85,7 @@ async function addScriptsToPackageJson(cwd) {
|
|
|
86
85
|
}
|
|
87
86
|
//#endregion
|
|
88
87
|
//#region package.json
|
|
89
|
-
var version = "0.
|
|
88
|
+
var version = "0.4.0";
|
|
90
89
|
//#endregion
|
|
91
90
|
//#region src/cli/update_pkg.json.ts
|
|
92
91
|
async function updatePkgJson(_) {
|
|
@@ -95,6 +94,13 @@ async function updatePkgJson(_) {
|
|
|
95
94
|
const userPkgJson = JSON.parse(raw);
|
|
96
95
|
userPkgJson.devDependencies ??= {};
|
|
97
96
|
userPkgJson.devDependencies[TOOLING_PACKAGE_NAME] = `^${version}`;
|
|
97
|
+
userPkgJson.scripts ??= {};
|
|
98
|
+
userPkgJson.scripts.lint = "oxlint .";
|
|
99
|
+
userPkgJson.scripts["lint:fix"] = "oxlint . --fix --fix-suggestions --fix-dangerously";
|
|
100
|
+
userPkgJson.scripts.format = "pnpm lint:fix; oxfmt .";
|
|
101
|
+
userPkgJson.scripts["format:check"] = "oxfmt . --check";
|
|
102
|
+
userPkgJson.scripts.typecheck = "tsc --noEmit";
|
|
103
|
+
userPkgJson.scripts.check = "pnpm run lint && pnpm run format:check && pnpm run typecheck";
|
|
98
104
|
await writeFile(pathPackageJSON, JSON.stringify(userPkgJson, null, 2));
|
|
99
105
|
p.log.success("Package.json updated 🤠");
|
|
100
106
|
}
|
package/dist/oxc/fmt.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { defineConfig } from "oxfmt";
|
|
2
2
|
|
|
3
3
|
//#region src/oxc/fmt.d.ts
|
|
4
|
+
declare const OXFMT_DEFAULT_IGNORE_PATTERNS: string[];
|
|
5
|
+
declare const ADONISJS_DEFAULT_IGNORE_PATTERNS: string[];
|
|
4
6
|
type OxfmtOptions = Partial<Parameters<typeof defineConfig>[0]>;
|
|
5
7
|
declare function minimalstuffPreset(config?: OxfmtOptions): ReturnType<typeof defineConfig>;
|
|
6
8
|
//#endregion
|
|
7
|
-
export { minimalstuffPreset };
|
|
9
|
+
export { ADONISJS_DEFAULT_IGNORE_PATTERNS, OXFMT_DEFAULT_IGNORE_PATTERNS, minimalstuffPreset };
|
package/dist/oxc/fmt.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { t as IGNORE_PATTERNS } from "../shared-CoSP_HvN.mjs";
|
|
2
2
|
import { defineConfig } from "oxfmt";
|
|
3
3
|
//#region src/oxc/fmt.ts
|
|
4
|
+
const OXFMT_DEFAULT_IGNORE_PATTERNS = [...IGNORE_PATTERNS];
|
|
5
|
+
const ADONISJS_DEFAULT_IGNORE_PATTERNS = [
|
|
6
|
+
".adonisjs/**",
|
|
7
|
+
"pnpm-*.yaml",
|
|
8
|
+
"bin/*"
|
|
9
|
+
];
|
|
4
10
|
function minimalstuffPreset(config = {}) {
|
|
5
11
|
return defineConfig({
|
|
6
12
|
printWidth: 80,
|
|
@@ -12,10 +18,10 @@ function minimalstuffPreset(config = {}) {
|
|
|
12
18
|
bracketSpacing: true,
|
|
13
19
|
arrowParens: "always",
|
|
14
20
|
trailingComma: "es5",
|
|
15
|
-
ignorePatterns:
|
|
21
|
+
ignorePatterns: OXFMT_DEFAULT_IGNORE_PATTERNS,
|
|
16
22
|
htmlWhitespaceSensitivity: "ignore",
|
|
17
23
|
...config
|
|
18
24
|
});
|
|
19
25
|
}
|
|
20
26
|
//#endregion
|
|
21
|
-
export { minimalstuffPreset };
|
|
27
|
+
export { ADONISJS_DEFAULT_IGNORE_PATTERNS, OXFMT_DEFAULT_IGNORE_PATTERNS, minimalstuffPreset };
|
package/dist/oxc/lint.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OxlintConfig } from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxc/lint.d.ts
|
|
4
|
+
declare const ADONISJS_DEFAULT_IGNORE_PATTERNS: string[];
|
|
4
5
|
interface MinimalstuffOxlintConfig {
|
|
5
6
|
adonisjs?: boolean;
|
|
6
7
|
perfectionist?: boolean;
|
|
@@ -11,4 +12,4 @@ declare function minimalstuffPreset(config?: MinimalstuffOxlintConfig): {
|
|
|
11
12
|
rules: {};
|
|
12
13
|
};
|
|
13
14
|
//#endregion
|
|
14
|
-
export { minimalstuffPreset };
|
|
15
|
+
export { ADONISJS_DEFAULT_IGNORE_PATTERNS, minimalstuffPreset };
|
package/dist/oxc/lint.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { t as IGNORE_PATTERNS } from "../shared-CoSP_HvN.mjs";
|
|
2
2
|
import { defineConfig } from "oxlint";
|
|
3
3
|
//#region src/oxc/lint.ts
|
|
4
|
+
const ADONISJS_DEFAULT_IGNORE_PATTERNS = [
|
|
5
|
+
".adonisjs/**",
|
|
6
|
+
"pnpm-*.yaml",
|
|
7
|
+
"bin/*"
|
|
8
|
+
];
|
|
4
9
|
const STRICT_TYPE_AWARE_RULES = {
|
|
5
10
|
"typescript/await-thenable": "error",
|
|
6
11
|
"typescript/no-floating-promises": "error",
|
|
@@ -106,4 +111,4 @@ function minimalstuffPreset(config = {}) {
|
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
113
|
//#endregion
|
|
109
|
-
export { minimalstuffPreset };
|
|
114
|
+
export { ADONISJS_DEFAULT_IGNORE_PATTERNS, minimalstuffPreset };
|