@mkvlrn/config 3.0.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) 2025 Mike Valeriano <mkvlrn@gmail.com>
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 ADDED
@@ -0,0 +1,63 @@
1
+ # @mkvlrn/config
2
+
3
+ Custom, opinionated configurations for biome and typescript (tsconfig.json).
4
+
5
+ To be used in my node projects - aimed at modern, type-safe, non-spaghetti codebases.
6
+
7
+ They'll work well in most base node, nest, and react (non next) projects without changes, just by extending these configs.
8
+
9
+ [![npm](https://img.shields.io/npm/v/@mkvlrn/config)](https://www.npmjs.com/package/@mkvlrn/config)
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pnpm add @mkvlrn/config -D
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Obs: Both biome and typescript need to be installed separately and be available in the project.
20
+
21
+ ### biome
22
+
23
+ Create your configuration file (`biome.json` or `biome.jsonc`):
24
+
25
+ <details>
26
+ <summary><code>biome.jsonc</code></summary>
27
+
28
+ ```jsonc
29
+ {
30
+ "$schema": "node_modules/@biomejs/biome/configuration_schema.json",
31
+ "root": true, // if this is the root of your project, false otherwise
32
+ "extends": ["@mkvlrn/config/biome"],
33
+ "overrides": [
34
+ // any overrides, see biome docs
35
+ ]
36
+ }
37
+ ```
38
+
39
+ </details>
40
+
41
+ ### typescript (tsconfig.json)
42
+
43
+ Create your configuration file:
44
+
45
+ <details>
46
+ <summary><code>tsconfig.json</code></summary>
47
+
48
+ ```jsonc
49
+ {
50
+ "extends": "@mkvlrn/config/tsconfig",
51
+ "compilerOptions": {
52
+ // add your custom rules here
53
+ }
54
+ }
55
+ ```
56
+
57
+ </details>
58
+
59
+ Obs: anything related to files needs to be set: rootDir, outDir, baseUrl, paths, etc - this prevents path confusion because the "original" tsconfig will be in node_modules.
60
+
61
+ ## License
62
+
63
+ MIT
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@mkvlrn/config",
3
+ "description": "Opinionated configurations for biome and typescript",
4
+ "version": "3.0.0",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "author": "Mike Valeriano <mkvlrn@proton.me>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git@github.com:mkvlrn/tools"
11
+ },
12
+ "keywords": [
13
+ "node",
14
+ "typescript",
15
+ "biome",
16
+ "tsconfig"
17
+ ],
18
+ "engines": {
19
+ "node": "22.x"
20
+ },
21
+ "files": [
22
+ "src"
23
+ ],
24
+ "exports": {
25
+ "./biome": "./src/biome.jsonc",
26
+ "./tsconfig": "./src/tsconfig.json"
27
+ },
28
+ "devDependencies": {
29
+ "lint-staged": "^16.2.7"
30
+ }
31
+ }
@@ -0,0 +1,89 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
3
+ "root": false,
4
+ "assist": {
5
+ "actions": {
6
+ "source": {
7
+ "organizeImports": "on",
8
+ "useSortedAttributes": "on",
9
+ "useSortedKeys": "off",
10
+ "useSortedProperties": "on"
11
+ }
12
+ }
13
+ },
14
+ "javascript": {
15
+ "parser": {
16
+ // for nest decorators
17
+ "unsafeParameterDecoratorsEnabled": true
18
+ }
19
+ },
20
+ "formatter": {
21
+ "enabled": true,
22
+ "formatWithErrors": true,
23
+ "lineEnding": "lf",
24
+ "lineWidth": 100,
25
+ "indentStyle": "space",
26
+ "indentWidth": 2
27
+ },
28
+ "linter": {
29
+ "domains": {
30
+ "project": "all",
31
+ "test": "all",
32
+ "react": "all",
33
+ "next": "none",
34
+ "solid": "none",
35
+ "qwik": "none"
36
+ },
37
+ "enabled": true,
38
+ "rules": {
39
+ "a11y": "on",
40
+ "complexity": "on",
41
+ "correctness": "on",
42
+ "nursery": "off",
43
+ "performance": "on",
44
+ "security": "on",
45
+ "style": "on",
46
+ "suspicious": "on"
47
+ }
48
+ },
49
+ "overrides": [
50
+ {
51
+ "includes": ["**/*"],
52
+ "linter": {
53
+ "rules": {
54
+ "complexity": {
55
+ // because of typescript's noPropertyAccessFromIndexSignature
56
+ "useLiteralKeys": "off"
57
+ },
58
+ "correctness": {
59
+ // bundler mode for imports, no need for extensions
60
+ "useImportExtensions": "off"
61
+ }
62
+ }
63
+ }
64
+ },
65
+ {
66
+ // test files, config files, and some scripts
67
+ // should be able to import from node
68
+ "includes": ["**/*.config.ts", "**/*.test.ts", "**/*.spec.ts"],
69
+ "linter": {
70
+ "rules": {
71
+ "correctness": {
72
+ "noNodejsModules": "off"
73
+ }
74
+ }
75
+ }
76
+ },
77
+ {
78
+ // config files should be able to export defaults as per tooling requirements
79
+ "includes": ["**/*.config.ts"],
80
+ "linter": {
81
+ "rules": {
82
+ "style": {
83
+ "noDefaultExport": "off"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ ]
89
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "compilerOptions": {
3
+ // no emit by default, using bundler
4
+ "noEmit": true,
5
+ // typescript QOL
6
+ "allowImportingTsExtensions": true,
7
+ // very strict
8
+ "allowJs": false,
9
+ "erasableSyntaxOnly": true,
10
+ "verbatimModuleSyntax": true,
11
+ "exactOptionalPropertyTypes": true,
12
+ "noPropertyAccessFromIndexSignature": true,
13
+ "noUncheckedIndexedAccess": true,
14
+ "strict": true,
15
+ "strictNullChecks": true,
16
+ "noUncheckedSideEffectImports": true,
17
+ // esm
18
+ "esModuleInterop": true,
19
+ "isolatedModules": true,
20
+ "lib": ["ESNext"],
21
+ "module": "esnext",
22
+ "moduleResolution": "bundler",
23
+ "moduleDetection": "force",
24
+ "target": "esnext",
25
+ // pnpm compatibility
26
+ "preserveSymlinks": false,
27
+ // self explanatory
28
+ "resolveJsonModule": true,
29
+ // don't try to check for errors on imported libs
30
+ "skipLibCheck": true,
31
+ // nest still uses these old experimental decorators
32
+ "experimentalDecorators": true,
33
+ "emitDecoratorMetadata": true,
34
+ // react
35
+ "jsx": "react-jsx"
36
+ }
37
+ }