@configg/bases 0.1.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 +21 -0
- package/README.md +78 -0
- package/package.json +89 -0
- package/packages/oxc/src/fmt.ts +46 -0
- package/packages/oxc/src/lint.ts +137 -0
- package/packages/tsconfig/src/bun.json +4 -0
- package/packages/tsconfig/src/client.json +7 -0
- package/packages/tsconfig/src/vite.json +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Crutches&Bicycles
|
|
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,78 @@
|
|
|
1
|
+
# configg ⚙️
|
|
2
|
+
|
|
3
|
+
[](https://github.com/crutchcrew/configg/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@configg/bases)
|
|
5
|
+
[](https://www.npmjs.com/package/@configg/bases)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
Shared configuration presets for code tooling. One package per tool, or all of them in a single install.
|
|
9
|
+
|
|
10
|
+
The presets ship as TypeScript and JSON source. There is no build step, so use them from a runtime or tool that can load `.ts` files from `node_modules` (Bun, or the tool's own loader).
|
|
11
|
+
|
|
12
|
+
## Packages
|
|
13
|
+
|
|
14
|
+
| Package | Version | What it configures |
|
|
15
|
+
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
|
|
16
|
+
| [`@configg/oxc`](./packages/oxc) | [](https://www.npmjs.com/package/@configg/oxc) | `oxfmt` (`/fmt`) and `oxlint` (`/lint`) presets |
|
|
17
|
+
| [`@configg/tsconfig`](./packages/tsconfig) | [](https://www.npmjs.com/package/@configg/tsconfig) | Strictest `tsconfig` presets for Bun and Vite |
|
|
18
|
+
| `@configg/bases` (this repo's root) | [](https://www.npmjs.com/package/@configg/bases) | All of the above under one name, straight from `packages/*` |
|
|
19
|
+
|
|
20
|
+
Install only what you use, or install `@configg/bases` and import everything from it:
|
|
21
|
+
|
|
22
|
+
| `@configg/bases/…` | Same as |
|
|
23
|
+
| ---------------------------- | ------------------------------------- |
|
|
24
|
+
| `oxfmt` | `@configg/oxc/fmt` |
|
|
25
|
+
| `oxlint` | `@configg/oxc/lint` |
|
|
26
|
+
| `tsconfig/{bun,client,vite}` | `@configg/tsconfig/{bun,client,vite}` |
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Tools are `peerDependencies`: you install `oxfmt`, `oxlint` and `typescript` yourself and pin the versions you want. The packages only supply the presets.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
bun add -d @configg/bases oxfmt oxlint oxlint-tsgolint typescript
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// oxfmt.config.ts
|
|
38
|
+
import { defineConfig } from 'oxfmt'
|
|
39
|
+
import { configs } from '@configg/bases/oxfmt'
|
|
40
|
+
|
|
41
|
+
export default defineConfig(configs.client)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// oxlint.config.ts
|
|
46
|
+
import { defineConfig } from 'oxlint'
|
|
47
|
+
import { configs } from '@configg/bases/oxlint'
|
|
48
|
+
|
|
49
|
+
export default defineConfig(configs.client)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```jsonc
|
|
53
|
+
// tsconfig.json
|
|
54
|
+
{ "extends": "@configg/bases/tsconfig/client" }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Installing a single package works the same way, for example `@configg/oxc/fmt` and `@configg/oxc/lint`.
|
|
58
|
+
|
|
59
|
+
### Presets
|
|
60
|
+
|
|
61
|
+
- `oxfmt` exports `configs`: `client` (Tailwind class sorting, import grouping), `scripts` (shared base for tooling and config files) and `server` (shared base).
|
|
62
|
+
- `oxlint` exports `configs`: `client` (browser env, React, and a `**/*.spec.{ts,tsx}` override with Vitest and Testing Library rules) and `scripts` (Node env).
|
|
63
|
+
- `tsconfig/bun` (`strictest` + Bun), `tsconfig/vite` (`strictest` + Vite/React) and `tsconfig/client` (`vite` with ambient `types` cleared, so a package only picks up the `@types/*` it asks for).
|
|
64
|
+
|
|
65
|
+
`eslint-plugin-testing-library` is only needed for `configs.client` in the oxlint preset.
|
|
66
|
+
|
|
67
|
+
## Development
|
|
68
|
+
|
|
69
|
+
The repo uses its own packages through the workspace, so there is nothing to build.
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
bun install
|
|
73
|
+
bun run check # fmt + lint (with type-check) + lockfile, in parallel
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
[MIT](./LICENSE)
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@configg/bases",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "All @configg presets in one package: oxc and tsconfig",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"config",
|
|
7
|
+
"oxc",
|
|
8
|
+
"oxfmt",
|
|
9
|
+
"oxlint",
|
|
10
|
+
"tsconfig"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/crutchcrew/configg#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/crutchcrew/configg/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/crutchcrew/configg.git"
|
|
20
|
+
},
|
|
21
|
+
"workspaces": [
|
|
22
|
+
"packages/*"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"packages/*/src/**"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"exports": {
|
|
30
|
+
"./oxfmt": "./packages/oxc/src/fmt.ts",
|
|
31
|
+
"./oxlint": "./packages/oxc/src/lint.ts",
|
|
32
|
+
"./tsconfig/bun": "./packages/tsconfig/src/bun.json",
|
|
33
|
+
"./tsconfig/client": "./packages/tsconfig/src/client.json",
|
|
34
|
+
"./tsconfig/vite": "./packages/tsconfig/src/vite.json",
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"provenance": true
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"check": "bun run --parallel fmt:check lint lockfile:check",
|
|
43
|
+
"fmt": "oxfmt --write .",
|
|
44
|
+
"fmt:check": "oxfmt --check .",
|
|
45
|
+
"lint": "oxlint",
|
|
46
|
+
"lint:fix": "oxlint --fix",
|
|
47
|
+
"lockfile:check": "bun install --frozen-lockfile",
|
|
48
|
+
"prepare": "lefthook install",
|
|
49
|
+
"publish:packages": "bun scripts/publish.ts",
|
|
50
|
+
"version:check": "bun scripts/versions.ts check",
|
|
51
|
+
"version:set": "bun scripts/versions.ts set"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@tsconfig/bases": "^1.0.28"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@configg/oxc": "workspace:*",
|
|
58
|
+
"@configg/tsconfig": "workspace:*",
|
|
59
|
+
"@types/bun": "^1.4.2",
|
|
60
|
+
"eslint-plugin-testing-library": "^7.16.2",
|
|
61
|
+
"lefthook": "^2.1.14",
|
|
62
|
+
"oxfmt": "^0.68.0",
|
|
63
|
+
"oxlint": "^1.83.0",
|
|
64
|
+
"oxlint-tsgolint": "^7.0.2002",
|
|
65
|
+
"typescript": "7"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"eslint-plugin-testing-library": "^7.16",
|
|
69
|
+
"oxfmt": ">=0.65.0",
|
|
70
|
+
"oxlint": "^1",
|
|
71
|
+
"oxlint-tsgolint": "^7",
|
|
72
|
+
"typescript": "^7"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"eslint-plugin-testing-library": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"oxfmt": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"oxlint": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"oxlint-tsgolint": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"packageManager": "bun@1.4.2"
|
|
89
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { OxfmtConfig } from 'oxfmt'
|
|
2
|
+
|
|
3
|
+
const base = {
|
|
4
|
+
arrowParens: 'always',
|
|
5
|
+
bracketSameLine: false,
|
|
6
|
+
bracketSpacing: true,
|
|
7
|
+
embeddedLanguageFormatting: 'auto',
|
|
8
|
+
endOfLine: 'lf',
|
|
9
|
+
experimentalOperatorPosition: 'end',
|
|
10
|
+
insertFinalNewline: true,
|
|
11
|
+
objectWrap: 'preserve',
|
|
12
|
+
printWidth: 100,
|
|
13
|
+
proseWrap: 'preserve',
|
|
14
|
+
quoteProps: 'as-needed',
|
|
15
|
+
semi: false,
|
|
16
|
+
singleAttributePerLine: false,
|
|
17
|
+
singleQuote: true,
|
|
18
|
+
sortPackageJson: true,
|
|
19
|
+
tabWidth: 2,
|
|
20
|
+
trailingComma: 'all',
|
|
21
|
+
useTabs: true,
|
|
22
|
+
} satisfies OxfmtConfig
|
|
23
|
+
|
|
24
|
+
export const configs = {
|
|
25
|
+
client: {
|
|
26
|
+
...base,
|
|
27
|
+
endOfLine: 'lf',
|
|
28
|
+
htmlWhitespaceSensitivity: 'css',
|
|
29
|
+
insertFinalNewline: true,
|
|
30
|
+
jsxSingleQuote: false,
|
|
31
|
+
sortImports: {
|
|
32
|
+
customGroups: [
|
|
33
|
+
{ elementNamePattern: ['react', 'react/**', 'react-*', 'react-*/**'], groupName: 'react' },
|
|
34
|
+
{ elementNamePattern: ['**/components/**', '**/components'], groupName: 'components' },
|
|
35
|
+
{ elementNamePattern: ['**/utils/**', '**/utils'], groupName: 'utils' },
|
|
36
|
+
],
|
|
37
|
+
groups: ['react', 'external', 'components', 'utils', ['parent', 'sibling', 'index']],
|
|
38
|
+
},
|
|
39
|
+
sortTailwindcss: {
|
|
40
|
+
attributes: ['class', 'className'],
|
|
41
|
+
functions: ['cx', 'createVariants'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
scripts: base,
|
|
45
|
+
server: base,
|
|
46
|
+
} satisfies Record<string, OxfmtConfig>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { OxlintConfig } from 'oxlint'
|
|
2
|
+
|
|
3
|
+
export const configs = {
|
|
4
|
+
client: {
|
|
5
|
+
categories: {
|
|
6
|
+
correctness: 'error',
|
|
7
|
+
nursery: 'warn',
|
|
8
|
+
pedantic: 'warn',
|
|
9
|
+
perf: 'error',
|
|
10
|
+
restriction: 'error',
|
|
11
|
+
style: 'warn',
|
|
12
|
+
suspicious: 'warn',
|
|
13
|
+
},
|
|
14
|
+
env: {
|
|
15
|
+
browser: true,
|
|
16
|
+
builtin: true,
|
|
17
|
+
},
|
|
18
|
+
options: {
|
|
19
|
+
typeAware: true,
|
|
20
|
+
typeCheck: true,
|
|
21
|
+
},
|
|
22
|
+
overrides: [
|
|
23
|
+
{
|
|
24
|
+
env: {
|
|
25
|
+
vitest: true,
|
|
26
|
+
},
|
|
27
|
+
files: ['**/*.spec.{ts,tsx}'],
|
|
28
|
+
jsPlugins: ['eslint-plugin-testing-library'],
|
|
29
|
+
plugins: ['eslint', 'oxc', 'react', 'typescript', 'unicorn', 'vitest'],
|
|
30
|
+
rules: {
|
|
31
|
+
'max-lines-per-function': 'off',
|
|
32
|
+
'no-async-await': 'off',
|
|
33
|
+
'no-restricted-imports': [
|
|
34
|
+
'error',
|
|
35
|
+
{
|
|
36
|
+
paths: [
|
|
37
|
+
{
|
|
38
|
+
importNames: ['fireEvent'],
|
|
39
|
+
message:
|
|
40
|
+
'Use `@testing-library/user-event` instead — it dispatches the full sequence of events a real user triggers, where `fireEvent` only dispatches a single DOM event.',
|
|
41
|
+
name: '@testing-library/react',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
'testing-library/await-async-events': ['error', { eventModule: 'userEvent' }],
|
|
47
|
+
'testing-library/await-async-queries': 'error',
|
|
48
|
+
'testing-library/await-async-utils': 'error',
|
|
49
|
+
'testing-library/no-await-sync-events': ['error', { eventModules: ['fire-event'] }],
|
|
50
|
+
'testing-library/no-await-sync-queries': 'error',
|
|
51
|
+
'testing-library/no-container': 'error',
|
|
52
|
+
'testing-library/no-debugging-utils': 'warn',
|
|
53
|
+
'testing-library/no-dom-import': ['error', 'react'],
|
|
54
|
+
'testing-library/no-global-regexp-flag-in-query': 'error',
|
|
55
|
+
'testing-library/no-node-access': 'error',
|
|
56
|
+
'testing-library/no-promise-in-fire-event': 'error',
|
|
57
|
+
'testing-library/no-render-in-lifecycle': 'error',
|
|
58
|
+
'testing-library/no-unnecessary-act': 'error',
|
|
59
|
+
'testing-library/no-wait-for-multiple-assertions': 'error',
|
|
60
|
+
'testing-library/no-wait-for-side-effects': 'error',
|
|
61
|
+
'testing-library/no-wait-for-snapshot': 'error',
|
|
62
|
+
'testing-library/prefer-find-by': 'error',
|
|
63
|
+
'testing-library/prefer-presence-queries': 'error',
|
|
64
|
+
'testing-library/prefer-query-by-disappearance': 'error',
|
|
65
|
+
'testing-library/prefer-screen-queries': 'error',
|
|
66
|
+
'testing-library/render-result-naming-convention': 'error',
|
|
67
|
+
'vitest/no-importing-vitest-globals': 'off',
|
|
68
|
+
'vitest/no-standalone-expect': 'error',
|
|
69
|
+
'vitest/prefer-expect-assertions': 'off',
|
|
70
|
+
'vitest/require-test-timeout': 'off',
|
|
71
|
+
'vitest/require-top-level-describe': 'off',
|
|
72
|
+
'vitest/valid-title': 'off',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
files: ['**/*.tsx'],
|
|
77
|
+
rules: {
|
|
78
|
+
'react/only-export-components': 'error',
|
|
79
|
+
'typescript/explicit-module-boundary-types': 'off',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
plugins: ['eslint', 'oxc', 'react', 'typescript', 'unicorn'],
|
|
84
|
+
rules: {
|
|
85
|
+
'func-style': ['error', 'declaration'],
|
|
86
|
+
'no-magic-numbers': 'off',
|
|
87
|
+
'no-rest-spread-properties': 'off',
|
|
88
|
+
'no-ternary': 'off',
|
|
89
|
+
'no-undefined': 'off',
|
|
90
|
+
'no-use-before-define': 'off',
|
|
91
|
+
'one-var': 'off',
|
|
92
|
+
'oxc/no-optional-chaining': 'off',
|
|
93
|
+
'react/jsx-filename-extension': 'off',
|
|
94
|
+
'react/jsx-max-depth': 'off',
|
|
95
|
+
'react/jsx-no-literals': 'off',
|
|
96
|
+
'react/no-multi-comp': 'off',
|
|
97
|
+
'react/react-in-jsx-scope': 'off',
|
|
98
|
+
'sort-imports': 'off',
|
|
99
|
+
'sort-keys': 'off',
|
|
100
|
+
'sort-vars': 'off',
|
|
101
|
+
'typescript/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
|
|
102
|
+
'typescript/explicit-function-return-type': 'off',
|
|
103
|
+
'typescript/no-import-type-side-effects': 'off',
|
|
104
|
+
'typescript/prefer-readonly-parameter-types': 'off',
|
|
105
|
+
'unicorn/no-null': 'off',
|
|
106
|
+
'vitest/consistent-test-filename': ['error', { pattern: '.*\\.spec\\.tsx?$' }],
|
|
107
|
+
'vitest/no-hooks': 'off',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
scripts: {
|
|
111
|
+
categories: {
|
|
112
|
+
correctness: 'error',
|
|
113
|
+
nursery: 'warn',
|
|
114
|
+
pedantic: 'warn',
|
|
115
|
+
perf: 'error',
|
|
116
|
+
restriction: 'error',
|
|
117
|
+
style: 'warn',
|
|
118
|
+
suspicious: 'warn',
|
|
119
|
+
},
|
|
120
|
+
env: {
|
|
121
|
+
builtin: true,
|
|
122
|
+
node: true,
|
|
123
|
+
},
|
|
124
|
+
options: {
|
|
125
|
+
typeAware: true,
|
|
126
|
+
typeCheck: true,
|
|
127
|
+
},
|
|
128
|
+
rules: {
|
|
129
|
+
'func-style': ['error', 'declaration'],
|
|
130
|
+
'no-magic-numbers': 'off',
|
|
131
|
+
'no-rest-spread-properties': 'off',
|
|
132
|
+
'one-var': 'off',
|
|
133
|
+
'sort-imports': 'off',
|
|
134
|
+
'typescript/prefer-readonly-parameter-types': 'off',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
} as const satisfies Record<string, OxlintConfig>
|