@minimalstuff/tooling 0.1.2 → 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 CHANGED
@@ -29,8 +29,8 @@ pnpm add -D oxlint oxfmt @minimalstuff/tooling
29
29
 
30
30
  ```ts
31
31
  // oxlint.config.ts
32
- import { defineConfig } from "oxlint";
33
- import { minimalstuffPreset } from "@minimalstuff/tooling/oxc/lint";
32
+ import { defineConfig } from 'oxlint';
33
+ import { minimalstuffPreset } from '@minimalstuff/tooling/oxc/lint';
34
34
 
35
35
  export default defineConfig({
36
36
  extends: [minimalstuffPreset()],
@@ -57,7 +57,7 @@ export default defineConfig({
57
57
 
58
58
  ```ts
59
59
  // oxfmt.config.ts
60
- import { minimalstuffPreset } from "@minimalstuff/tooling/oxc/fmt";
60
+ import { minimalstuffPreset } from '@minimalstuff/tooling/oxc/fmt';
61
61
 
62
62
  export default minimalstuffPreset();
63
63
  ```
@@ -1,5 +1,5 @@
1
1
  //#region src/cli/index.d.ts
2
- type ConfigTool = 'editorconfig' | 'tsconfig' | 'oxc';
2
+ type ConfigTool = 'editorconfig' | 'oxc';
3
3
  declare const DEFAULT_SELECTED_TOOLS: ConfigTool[];
4
4
  interface PromptResult {
5
5
  tools: ConfigTool[];
@@ -32,12 +32,13 @@ const vscodeSettings = {
32
32
  };
33
33
  const oxcScripts = {
34
34
  format: "oxfmt --write .",
35
- lint: "oxlint",
36
- "lint:fix": "oxlint --fix"
35
+ lint: "oxlint --type-aware",
36
+ "lint:fix": "oxlint --type-aware --fix"
37
37
  };
38
38
  const oxcPackages = [
39
39
  "oxfmt",
40
40
  "oxlint",
41
+ "oxlint-tsgolint",
41
42
  TOOLING_PACKAGE_NAME
42
43
  ];
43
44
  async function updateOxc(result) {
@@ -67,41 +68,27 @@ async function updateVscodeSettings(cwd) {
67
68
  }
68
69
  async function addScriptsToPackageJson(cwd) {
69
70
  const pkgPath = join(cwd, "package.json");
70
- const pkg = JSON.parse(await readFile(pkgPath, "utf-8"));
71
+ const raw = await readFile(pkgPath, "utf-8");
72
+ const pkg = JSON.parse(raw);
71
73
  pkg.scripts ??= {};
72
74
  for (const [key, value] of Object.entries(oxcScripts)) pkg.scripts[key] = value;
73
75
  await writeFile(pkgPath, JSON.stringify(pkg, null, 2));
74
76
  }
75
77
  //#endregion
76
78
  //#region package.json
77
- var version = "0.1.2";
79
+ var version = "0.2.0";
78
80
  //#endregion
79
81
  //#region src/cli/update_pkg.json.ts
80
82
  async function updatePkgJson(_) {
81
83
  const pathPackageJSON = join(process.cwd(), "package.json");
82
- const userPkgJson = JSON.parse(await readFile(pathPackageJSON, "utf-8"));
84
+ const raw = await readFile(pathPackageJSON, "utf-8");
85
+ const userPkgJson = JSON.parse(raw);
83
86
  userPkgJson.devDependencies ??= {};
84
87
  userPkgJson.devDependencies[TOOLING_PACKAGE_NAME] = `^${version}`;
85
88
  await writeFile(pathPackageJSON, JSON.stringify(userPkgJson, null, 2));
86
89
  p.log.success("Package.json updated 🤠");
87
90
  }
88
91
  //#endregion
89
- //#region src/cli/update_tsconfig.ts
90
- const tsConfigContent = `
91
- {
92
- "extends": "${TOOLING_PACKAGE_NAME}/tsconfigs/tsconfig.node",
93
- "compilerOptions": {
94
- "rootDir": "./",
95
- "outDir": "./build"
96
- }
97
- }
98
- `;
99
- async function updateTsconfig(result) {
100
- if (!result.tools.includes("tsconfig")) return;
101
- await writeFile(join(process.cwd(), "tsconfig.json"), tsConfigContent);
102
- p.log.success("Typescript configured 👹");
103
- }
104
- //#endregion
105
92
  //#region src/cli/update_editorconfig.ts
106
93
  const presetPath = fileURLToPath(new URL("../../preset/.editorconfig", import.meta.url));
107
94
  async function updateEditorConfig(result) {
@@ -113,11 +100,7 @@ async function updateEditorConfig(result) {
113
100
  }
114
101
  //#endregion
115
102
  //#region src/cli/index.ts
116
- const DEFAULT_SELECTED_TOOLS = [
117
- "editorconfig",
118
- "tsconfig",
119
- "oxc"
120
- ];
103
+ const DEFAULT_SELECTED_TOOLS = ["editorconfig", "oxc"];
121
104
  function exit() {
122
105
  cancel("Cancelled");
123
106
  return process.exit(0);
@@ -129,27 +112,19 @@ async function main() {
129
112
  if (isCancel(await confirm({ message: `Continue ?` }))) return exit();
130
113
  const tools = await multiselect({
131
114
  message: "Select tools to configure",
132
- options: [
133
- {
134
- value: "editorconfig",
135
- label: "EditorConfig"
136
- },
137
- {
138
- value: "tsconfig",
139
- label: "TypeScript"
140
- },
141
- {
142
- value: "oxc",
143
- label: "OXC (oxlint + oxfmt)"
144
- }
145
- ],
115
+ options: [{
116
+ value: "editorconfig",
117
+ label: "EditorConfig"
118
+ }, {
119
+ value: "oxc",
120
+ label: "OXC (oxlint + oxfmt)"
121
+ }],
146
122
  initialValues: DEFAULT_SELECTED_TOOLS,
147
123
  required: true
148
124
  });
149
125
  if (isCancel(tools)) return exit();
150
126
  await updatePkgJson({ tools });
151
127
  await updateEditorConfig({ tools });
152
- await updateTsconfig({ tools });
153
128
  await updateOxc({ tools });
154
129
  log.success("All done. Make sure to install the dependencies with `pnpm install`.");
155
130
  }
package/dist/oxc/lint.mjs CHANGED
@@ -1,6 +1,26 @@
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 STRICT_TYPE_AWARE_RULES = {
5
+ "typescript/await-thenable": "error",
6
+ "typescript/no-floating-promises": "error",
7
+ "typescript/no-misused-promises": "error",
8
+ "typescript/no-unnecessary-condition": "error",
9
+ "typescript/no-unnecessary-type-assertion": "error",
10
+ "typescript/no-unsafe-argument": "error",
11
+ "typescript/no-unsafe-assignment": "error",
12
+ "typescript/no-unsafe-call": "error",
13
+ "typescript/no-unsafe-member-access": "error",
14
+ "typescript/no-unsafe-return": "error",
15
+ "typescript/prefer-nullish-coalescing": "error",
16
+ "typescript/prefer-optional-chain": "error",
17
+ "typescript/strict-boolean-expressions": ["error", {
18
+ allowNullableBoolean: true,
19
+ allowNullableObject: true,
20
+ allowNullableString: true
21
+ }],
22
+ "typescript/switch-exhaustiveness-check": "error"
23
+ };
4
24
  function reactPreset() {
5
25
  return defineConfig({
6
26
  plugins: ["react", "react-perf"],
@@ -71,7 +91,11 @@ function defaultPreset() {
71
91
  "eslint",
72
92
  "oxc"
73
93
  ],
74
- rules: {}
94
+ rules: { ...STRICT_TYPE_AWARE_RULES },
95
+ options: {
96
+ typeAware: true,
97
+ typeCheck: true
98
+ }
75
99
  });
76
100
  }
77
101
  function minimalstuffPreset(config = {}) {
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "@minimalstuff/tooling",
3
- "version": "0.1.2",
4
- "description": "Shared tooling configs: EditorConfig, TSConfig, OXC (oxlint + oxfmt)",
3
+ "version": "0.2.0",
4
+ "description": "Shared tooling configs: EditorConfig, OXC (oxlint + oxfmt)",
5
5
  "keywords": [
6
6
  "editorconfig",
7
7
  "oxc",
8
8
  "oxfmt",
9
9
  "oxlint",
10
- "react",
11
- "tsconfig"
10
+ "react"
12
11
  ],
13
12
  "license": "MIT",
14
13
  "author": "Sonny93 <sonnyasdev@gmail.com>",
@@ -24,7 +23,6 @@
24
23
  "type": "module",
25
24
  "exports": {
26
25
  "./editorconfig": "./preset/.editorconfig",
27
- "./tsconfigs/*": "./dist/tsconfigs/*.json",
28
26
  "./oxc/lint": "./dist/oxc/lint.mjs",
29
27
  "./oxc/fmt": "./dist/oxc/fmt.mjs"
30
28
  },
@@ -33,8 +31,9 @@
33
31
  "provenance": true
34
32
  },
35
33
  "scripts": {
36
- "lint": "oxlint",
37
- "format": "oxfmt --write .",
34
+ "lint": "oxlint --type-aware",
35
+ "lint:fix": "oxlint --type-aware --fix",
36
+ "format": "oxfmt --write . && oxlint --type-aware --fix",
38
37
  "build": "tsdown",
39
38
  "release": "release-it",
40
39
  "typecheck": "tsc --noEmit",
@@ -52,13 +51,15 @@
52
51
  "@types/node": "^25.2.3",
53
52
  "oxfmt": "^0.40.0",
54
53
  "oxlint": "^1.55.0",
54
+ "oxlint-tsgolint": "^0.20.0",
55
55
  "release-it": "^19.2.4",
56
56
  "tsdown": "^0.21.3",
57
57
  "typescript": "^5.9.3"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "oxfmt": ">=0.40.0",
61
- "oxlint": ">=1.55.0"
61
+ "oxlint": ">=1.55.0",
62
+ "oxlint-tsgolint": ">=0.20.0"
62
63
  },
63
64
  "peerDependenciesMeta": {
64
65
  "oxfmt": {
@@ -66,6 +67,9 @@
66
67
  },
67
68
  "oxlint": {
68
69
  "optional": true
70
+ },
71
+ "oxlint-tsgolint": {
72
+ "optional": true
69
73
  }
70
74
  },
71
75
  "packageManager": "pnpm@10.29.3",
@@ -16,4 +16,6 @@ indent_style = unset
16
16
  insert_final_newline = unset
17
17
 
18
18
  [*.md]
19
+ indent_style = space
20
+ indent_size = 2
19
21
  trim_trailing_whitespace = false
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "experimentalDecorators": true,
4
- "checkJs": true,
5
- "strict": true,
6
- "allowUnreachableCode": false,
7
- "allowUnusedLabels": false,
8
- "exactOptionalPropertyTypes": true,
9
- "noFallthroughCasesInSwitch": true,
10
- "noImplicitAny": true,
11
- "noImplicitOverride": true,
12
- "noImplicitReturns": true,
13
- "noImplicitThis": true,
14
- "noUnusedLocals": true,
15
- "noUnusedParameters": true,
16
- "allowImportingTsExtensions": true,
17
- "rewriteRelativeImportExtensions": true,
18
- "useUnknownInCatchVariables": true,
19
- "allowSyntheticDefaultImports": true,
20
- "esModuleInterop": true,
21
- "forceConsistentCasingInFileNames": true,
22
- "isolatedModules": true,
23
- "verbatimModuleSyntax": true,
24
- "skipLibCheck": true
25
- },
26
- "ts-node": {
27
- "swc": true
28
- }
29
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "extends": "./tsconfig.node.json",
4
- "compilerOptions": {
5
- "rewriteRelativeImportExtensions": true
6
- }
7
- }
@@ -1,15 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "extends": "./tsconfig.base.json",
4
- "compilerOptions": {
5
- "target": "ESNext",
6
- "lib": ["ESNext"],
7
- "emitDecoratorMetadata": true,
8
- "experimentalDecorators": true,
9
- "module": "NodeNext",
10
- "moduleResolution": "NodeNext",
11
- "resolveJsonModule": true,
12
- "sourceMap": true,
13
- "allowSyntheticDefaultImports": true
14
- }
15
- }
@@ -1,16 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "extends": "./tsconfig.base.json",
4
- "compilerOptions": {
5
- "target": "ESNext",
6
- "lib": ["DOM", "DOM.Iterable", "ESNext", "ES2020"],
7
- "jsx": "react-jsx",
8
- "useDefineForClassFields": true,
9
- "module": "NodeNext",
10
- "moduleResolution": "Bundler",
11
- "resolveJsonModule": true,
12
- "allowSyntheticDefaultImports": true,
13
- "esModuleInterop": true,
14
- "verbatimModuleSyntax": true
15
- }
16
- }