@venizia/dev-configs 0.3.0 → 0.3.1-1
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 +112 -31
- package/dist/compilers/bun.d.ts.map +1 -1
- package/dist/compilers/bun.js +1 -0
- package/dist/compilers/bun.js.map +1 -1
- package/dist/formatters/oxfmt.d.ts +14 -0
- package/dist/formatters/oxfmt.d.ts.map +1 -1
- package/dist/formatters/oxfmt.js +19 -1
- package/dist/formatters/oxfmt.js.map +1 -1
- package/dist/linters/browser.d.ts +19 -0
- package/dist/linters/browser.d.ts.map +1 -0
- package/dist/linters/browser.js +32 -0
- package/dist/linters/browser.js.map +1 -0
- package/dist/linters/eslint.d.ts +1 -1
- package/dist/linters/eslint.js +1 -1
- package/dist/linters/house/common.d.ts +20 -0
- package/dist/linters/house/common.d.ts.map +1 -0
- package/dist/linters/house/common.js +29 -0
- package/dist/linters/house/common.js.map +1 -0
- package/dist/linters/house/configs.d.ts +16 -0
- package/dist/linters/house/configs.d.ts.map +1 -0
- package/dist/linters/house/configs.js +45 -0
- package/dist/linters/house/configs.js.map +1 -0
- package/dist/linters/house/index.d.ts +6 -0
- package/dist/linters/house/index.d.ts.map +1 -0
- package/dist/linters/house/index.js +22 -0
- package/dist/linters/house/index.js.map +1 -0
- package/dist/linters/house/max-params-own.rule.d.ts +19 -0
- package/dist/linters/house/max-params-own.rule.d.ts.map +1 -0
- package/dist/linters/house/max-params-own.rule.js +122 -0
- package/dist/linters/house/max-params-own.rule.js.map +1 -0
- package/dist/linters/house/no-new-error.rule.d.ts +15 -0
- package/dist/linters/house/no-new-error.rule.d.ts.map +1 -0
- package/dist/linters/house/no-new-error.rule.js +43 -0
- package/dist/linters/house/no-new-error.rule.js.map +1 -0
- package/dist/linters/house/plugin.d.ts +4 -0
- package/dist/linters/house/plugin.d.ts.map +1 -0
- package/dist/linters/house/plugin.js +15 -0
- package/dist/linters/house/plugin.js.map +1 -0
- package/dist/linters/index.d.ts +2 -0
- package/dist/linters/index.d.ts.map +1 -1
- package/dist/linters/index.js +2 -0
- package/dist/linters/index.js.map +1 -1
- package/dist/linters/oxlint.d.ts +25 -0
- package/dist/linters/oxlint.d.ts.map +1 -1
- package/dist/linters/oxlint.js +43 -1
- package/dist/linters/oxlint.js.map +1 -1
- package/dist/linters/react.d.ts +7 -5
- package/dist/linters/react.d.ts.map +1 -1
- package/dist/linters/react.js +27 -12
- package/dist/linters/react.js.map +1 -1
- package/dist/linters/rules/no-unused-vars.rule.d.ts +5 -0
- package/dist/linters/rules/no-unused-vars.rule.d.ts.map +1 -1
- package/dist/linters/rules/no-unused-vars.rule.js +2 -2
- package/dist/linters/rules/no-unused-vars.rule.js.map +1 -1
- package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts +7 -0
- package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts.map +1 -1
- package/dist/linters/rules/prefer-nullish-coalescing.rule.js.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +18 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/rejection.helper.d.ts +21 -0
- package/dist/testing/rejection.helper.d.ts.map +1 -0
- package/dist/testing/rejection.helper.js +37 -0
- package/dist/testing/rejection.helper.js.map +1 -0
- package/package.json +7 -6
- package/src/tsconfig/tsconfig.browser.json +11 -0
- package/src/tsconfig/tsconfig.react.json +7 -0
package/README.md
CHANGED
|
@@ -6,12 +6,12 @@ it as a dev dependency in an application that wants the same rules.
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
bun add -d @venizia/dev-configs oxlint oxlint-tsgolint oxfmt eslint
|
|
9
|
+
bun add -d @venizia/dev-configs oxlint oxlint-tsgolint oxfmt eslint typescript
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
`oxlint` (>=1.88.0), `oxlint-tsgolint` (>=7.0.2004), `oxfmt` (>=0.73.0), `eslint` (9 or 10),
|
|
13
|
-
`
|
|
14
|
-
|
|
13
|
+
`prettier` (3) and `typescript` (5 or 6) are optional peers. Install only the tools you use. Keep the
|
|
14
|
+
ESLint config `.mjs`: a TypeScript one (`.mts`) makes ESLint require `jiti`, one more dependency. A
|
|
15
15
|
project that still runs ESLint and Prettier installs `eslint prettier` and skips the oxc tools.
|
|
16
16
|
|
|
17
17
|
## Use it
|
|
@@ -35,15 +35,15 @@ export default defineConfig(oxfmtConfigs);
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
// .configs/eslint.config.
|
|
39
|
-
import {
|
|
38
|
+
// .configs/eslint.config.mjs - what oxlint cannot run: naming convention + house rules
|
|
39
|
+
import { houseConfigs } from '@venizia/dev-configs/linters';
|
|
40
40
|
|
|
41
|
-
export default
|
|
41
|
+
export default houseConfigs;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
oxlint -c .configs/oxlint.config.mts --deny-warnings
|
|
46
|
-
eslint -c .configs/eslint.config.
|
|
46
|
+
eslint -c .configs/eslint.config.mjs .
|
|
47
47
|
oxfmt -c .configs/oxfmt.config.mts --check "**/*.{ts,tsx,mts,js,mjs}"
|
|
48
48
|
```
|
|
49
49
|
|
|
@@ -58,25 +58,53 @@ there.
|
|
|
58
58
|
"outDir": "dist",
|
|
59
59
|
"rootDir": "src",
|
|
60
60
|
"experimentalDecorators": true,
|
|
61
|
-
"
|
|
61
|
+
"useDefineForClassFields": false
|
|
62
62
|
},
|
|
63
63
|
"include": ["src"]
|
|
64
64
|
}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
The two options in `compilerOptions` repeat the base on purpose - see
|
|
68
|
+
[Restate the runtime options](#restate-the-runtime-options-in-your-own-tsconfig).
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
when it runs your source. Parameter decorators are then dropped with no error, and an `@inject`
|
|
71
|
-
value is `undefined` at run time.
|
|
70
|
+
### Browser and React projects
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
The presets above target a Bun or Node backend. Code that runs in a browser swaps each one for its
|
|
73
|
+
browser version. A React project swaps it for the React version, which builds on the browser one.
|
|
74
|
+
|
|
75
|
+
| Tool | Backend | Browser | React |
|
|
76
|
+
| :--- | :--- | :--- | :--- |
|
|
77
|
+
| oxlint | `oxlintConfigs` | `BrowserOxlintConfigs.create()` | `ReactOxlintConfigs.create()` |
|
|
78
|
+
| oxfmt | `oxfmtConfigs` | `browserOxfmtConfigs` | `browserOxfmtConfigs` |
|
|
79
|
+
| ESLint | `houseConfigs` | `houseConfigs` | `reactHouseConfigs` |
|
|
80
|
+
| tsconfig | `tsconfig.common.json` | `tsconfig.browser.json` | `tsconfig.react.json` |
|
|
81
|
+
|
|
82
|
+
## Restate the runtime options in your own tsconfig
|
|
83
|
+
|
|
84
|
+
Bun ignores an `extends` that names a package. With `"extends": "@venizia/dev-configs/tsconfig.common.json"`,
|
|
85
|
+
`bun run` and `bun test` see none of the preset's options - even one level deep (measured on Bun 1.4.2).
|
|
86
|
+
Bun then compiles TC39 decorators: a parameter decorator such as `@inject` is dropped with no error,
|
|
87
|
+
and a method decorator such as `@provide` receives the wrong arguments. Class fields get define
|
|
88
|
+
semantics, while the `tsc` build uses assign semantics.
|
|
89
|
+
|
|
90
|
+
`tsc` follows the whole chain, so typecheck and build stay green. Only what Bun runs diverges, which
|
|
91
|
+
is why nothing reports it.
|
|
92
|
+
|
|
93
|
+
In every `tsconfig.json` that Bun runs - an application, a package whose tests run under
|
|
94
|
+
`bun test`, a browser or React project tested with Bun - restate the options that change the emitted
|
|
95
|
+
code:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
"experimentalDecorators": true,
|
|
99
|
+
"useDefineForClassFields": false
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Every IGNIS package and example does.
|
|
75
103
|
|
|
76
104
|
| Flag | Base value | Why |
|
|
77
105
|
| :--- | :--- | :--- |
|
|
78
106
|
| `experimentalDecorators` | `true` | `@inject`, `@controller`, `@repository` and the other decorators need it |
|
|
79
|
-
| `emitDecoratorMetadata` | `true` | Optional. IGNIS reads `design:paramtypes` once, to validate a `@repository` constructor, and skips the check when the metadata is absent |
|
|
107
|
+
| `emitDecoratorMetadata` | `true` | Optional - restate it only if your code reads `design:*` metadata. IGNIS reads `design:paramtypes` once, to validate a `@repository` constructor, and skips the check when the metadata is absent. Under Bun it turns an interface-typed constructor parameter into a runtime import (`Export named 'X' not found`), so import such names with `import type`; `tsc --noEmit --isolatedModules` (TS1272) finds most of them, loading `src/index.ts` under Bun the rest |
|
|
80
108
|
| `useDefineForClassFields` | `false` | Class fields are assigned, not defined, so a subclass field initializer does not shadow a value the base constructor set |
|
|
81
109
|
|
|
82
110
|
## Entry points
|
|
@@ -85,10 +113,13 @@ earlier. Every IGNIS example does.
|
|
|
85
113
|
| :--- | :--- |
|
|
86
114
|
| `@venizia/dev-configs` | Everything below, re-exported |
|
|
87
115
|
| `@venizia/dev-configs/compilers` | `BunCompiler` |
|
|
88
|
-
| `@venizia/dev-configs/formatters` | `oxfmtConfigs`, `prettierConfigs` |
|
|
89
|
-
| `@venizia/dev-configs/
|
|
116
|
+
| `@venizia/dev-configs/formatters` | `oxfmtConfigs`, `browserOxfmtConfigs`, `prettierConfigs` |
|
|
117
|
+
| `@venizia/dev-configs/testing` | `rejectionOf`, `expectRejection` - test helpers for a promise that must reject (imports `bun:test`; tests only) |
|
|
118
|
+
| `@venizia/dev-configs/linters` | `oxlintConfigs`, `OxlintConfigs`, `BrowserOxlintConfigs`, `ReactOxlintConfigs`, `namingConventionConfigs`, `reactNamingConventionConfigs`, `eslintConfigs`, `ReactEslintConfigs`, the rule classes and their types |
|
|
90
119
|
| `@venizia/dev-configs/tsconfig.base.json` | Target and lib ES2025, `module` Node16, strict mode with `noImplicitAny`, `strictPropertyInitialization` and `useUnknownInCatchVariables` off, `noEmitOnError`, tests excluded |
|
|
91
120
|
| `@venizia/dev-configs/tsconfig.common.json` | Extends the base and switches `module` and `moduleResolution` to `nodenext` |
|
|
121
|
+
| `@venizia/dev-configs/tsconfig.browser.json` | Extends the base for a browser library built with a bundler: `module` ESNext, `moduleResolution` bundler, lib ES2025 + `DOM` + `DOM.Iterable`, `types: []` so no Bun types reach `dist` |
|
|
122
|
+
| `@venizia/dev-configs/tsconfig.react.json` | Extends `tsconfig.browser.json` and sets `jsx: react-jsx` |
|
|
92
123
|
|
|
93
124
|
## What each config sets
|
|
94
125
|
|
|
@@ -96,7 +127,10 @@ earlier. Every IGNIS example does.
|
|
|
96
127
|
|
|
97
128
|
`oxlintConfigs` (type `OxlintConfig`) is a static port of the `eslintConfigs` rules, generated with
|
|
98
129
|
`@oxlint/migrate`. It enables the `typescript` and `unicorn` plugins and type-aware linting, so it needs
|
|
99
|
-
`oxlint-tsgolint`.
|
|
130
|
+
`oxlint-tsgolint`. It also enforces `typescript/consistent-type-imports` (`prefer: type-imports`,
|
|
131
|
+
`fixStyle: inline-type-imports`; `import('pkg').T` annotations stay allowed): a value import of a type
|
|
132
|
+
becomes a runtime import when Bun runs a decorated class's source, and loading fails with
|
|
133
|
+
`Export named 'X' not found`. `oxlint --fix` rewrites them.
|
|
100
134
|
|
|
101
135
|
Not ported:
|
|
102
136
|
|
|
@@ -107,6 +141,35 @@ Not ported:
|
|
|
107
141
|
| `no-invalid-this` | `noImplicitThis` in `tsconfig.base.json` covers it |
|
|
108
142
|
| `n/prefer-node-protocol` | Maps to `unicorn/prefer-node-protocol` |
|
|
109
143
|
|
|
144
|
+
#### lenientFallback
|
|
145
|
+
|
|
146
|
+
`prefer-nullish-coalescing` flags `||` on any nullable left side, so `opts.name || 'guest'` fails when
|
|
147
|
+
`name` is `string | undefined`. That is the default: `||` also swallows a real `''` or `0`. A project
|
|
148
|
+
where `''` and `0` fall back on purpose opts out in one line:
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
// .configs/oxlint.config.mts
|
|
152
|
+
import { defineConfig } from 'oxlint';
|
|
153
|
+
import { OxlintConfigs } from '@venizia/dev-configs/linters';
|
|
154
|
+
|
|
155
|
+
export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
It allows `||` where the left side is a string or a number, and still flags it on objects and
|
|
159
|
+
booleans. `BrowserOxlintConfigs.create()` and `ReactOxlintConfigs.create()` take the same option.
|
|
160
|
+
`OxlintConfigs.create()` with no option is `oxlintConfigs`.
|
|
161
|
+
|
|
162
|
+
### houseConfigs and the house rules
|
|
163
|
+
|
|
164
|
+
`houseConfigs` is `namingConventionConfigs` plus the house rules oxlint cannot express;
|
|
165
|
+
`reactHouseConfigs` is the same over `reactNamingConventionConfigs`. The rules ship as the ESLint plugin
|
|
166
|
+
`houseEslintPlugin`, registered as `venizia`:
|
|
167
|
+
|
|
168
|
+
| Class | Rule | Default | What it enforces |
|
|
169
|
+
| :--- | :--- | :--- | :--- |
|
|
170
|
+
| `MaxParamsOwnRule` | `venizia/max-params-own` | `build({ max: 5 })` | A function we write takes at most `max` positional parameters. Not counted: an inline callback passed to a call or a JSX prop, a signature a declared type fixes, a constructor whose parameters are all `@inject`. A hook callback counts. |
|
|
171
|
+
| `NoNewErrorRule` | `venizia/no-new-error` | `error` | Throw through `getError` (or an `ApplicationError`), never `new Error(...)` / `Error(...)`. Off in tests. |
|
|
172
|
+
|
|
110
173
|
### namingConventionConfigs
|
|
111
174
|
|
|
112
175
|
`namingConventionConfigs` (type `Linter.Config[]`) sets only `@typescript-eslint/naming-convention`, with
|
|
@@ -122,11 +185,11 @@ entry with the IGNIS defaults. Every `severity` defaults to `'error'`.
|
|
|
122
185
|
| Class | Rule name | `build` options (default) |
|
|
123
186
|
| :--- | :--- | :--- |
|
|
124
187
|
| `EqeqeqRule` | `eqeqeq` | `mode`: `'always' \| 'smart'` (`'smart'`) |
|
|
125
|
-
| `NoUnusedVarsRule` | `no-unused-vars` | `vars` (`'all'`), `args` (`'none'`), `ignoreRestSiblings` (`false`) |
|
|
188
|
+
| `NoUnusedVarsRule` | `no-unused-vars` | `vars` (`'all'`), `args` (`'none'`), `ignoreRestSiblings` (`false`), `argsIgnorePattern` / `varsIgnorePattern` / `caughtErrorsIgnorePattern` / `destructuredArrayIgnorePattern` (none) |
|
|
126
189
|
| `SwitchCaseBracesRule` | `unicorn/switch-case-braces` | `mode`: `'always' \| 'avoid'` (`'always'`) |
|
|
127
190
|
| `NoRestrictedImportsRule` | `no-restricted-imports` | `extraPaths`: `IRestrictedImportPath[]` (none), added to `PATHS` (lodash) |
|
|
128
191
|
| `NoRestrictedPropertiesRule` | `no-restricted-properties` | `extraProperties`: `IRestrictedProperty[]` (none), added to `SECURE_CONTEXT` (`crypto.randomUUID`) |
|
|
129
|
-
| `PreferNullishCoalescingRule` | `typescript/prefer-nullish-coalescing` | `ignoreConditionalTests`, `ignoreMixedLogicalExpressions`, `ignoreTernaryTests` (oxlint's own defaults) |
|
|
192
|
+
| `PreferNullishCoalescingRule` | `typescript/prefer-nullish-coalescing` | `ignoreConditionalTests`, `ignoreMixedLogicalExpressions`, `ignoreTernaryTests`, `ignorePrimitives` (`{ string: true, ... }`; oxlint's own defaults) |
|
|
130
193
|
| `NamingConventionRule` | `@typescript-eslint/naming-convention` | `extraSelectors`: `TNamingSelector[]` (none), added after `SELECTORS` |
|
|
131
194
|
|
|
132
195
|
Types: `TRuleSeverity`, `TOxlintRuleEntry`, `TNamingSelector`, `IRestrictedImportPath`.
|
|
@@ -169,6 +232,13 @@ matches. oxfmt differs from Prettier on long union types, which it breaks with a
|
|
|
169
232
|
| `bracketSpacing` | `true` |
|
|
170
233
|
| `arrowParens` | `'avoid'` |
|
|
171
234
|
|
|
235
|
+
`browserOxfmtConfigs` is `oxfmtConfigs` with two changes for browser and React code:
|
|
236
|
+
|
|
237
|
+
| Setting | Value | Effect |
|
|
238
|
+
| :--- | :--- | :--- |
|
|
239
|
+
| `arrowParens` | `'always'` | `(x) => x` instead of `x => x` |
|
|
240
|
+
| `bracketSameLine` | `true` | The closing `>` of a multi-line JSX element stays on its last attribute line, which keeps JSX diffs small |
|
|
241
|
+
|
|
172
242
|
### eslintConfigs
|
|
173
243
|
|
|
174
244
|
`eslintConfigs` keeps its shape and resolves to the same rules as before, but is now owned here instead
|
|
@@ -205,7 +275,7 @@ export default [
|
|
|
205
275
|
| React correctness (`jsx-key`, `no-children-prop`, `no-deprecated`, ... - 14 rules) | `error`, `.jsx`/`.tsx` |
|
|
206
276
|
| `jsx-a11y` basics (`alt-text`, `aria-props`, `aria-role`, ... - 9 rules) | `error`, `.jsx`/`.tsx` |
|
|
207
277
|
| `react-hooks/rules-of-hooks` / `exhaustive-deps` | `error`, every source file |
|
|
208
|
-
| `@typescript-eslint/consistent-type-imports` | `['error', { prefer: 'type-imports' }]` |
|
|
278
|
+
| `@typescript-eslint/consistent-type-imports` | `['error', { prefer: 'type-imports', fixStyle: 'inline-type-imports', disallowTypeAnnotations: false }]` |
|
|
209
279
|
| `naming-convention` | the base rule, plus PascalCase functions (`function App()`), `.jsx`/`.tsx` |
|
|
210
280
|
| `no-restricted-properties` | `NoRestrictedPropertiesRule.build()` - bans `crypto.randomUUID` |
|
|
211
281
|
|
|
@@ -218,8 +288,22 @@ Rules the automatic JSX runtime or `tsc` already enforce (`react-in-jsx-scope`,
|
|
|
218
288
|
- `reactVersion` defaults to `'detect'`. Under ESLint 10, eslint-plugin-react 7 cannot detect it and
|
|
219
289
|
aborts - pass the version: `create({ plugins, reactVersion: '19.2' })`.
|
|
220
290
|
- In an `eslint.config.ts`, `eslint-plugin-jsx-a11y` needs `@types/eslint-plugin-jsx-a11y`.
|
|
221
|
-
- `consistent-type-imports`
|
|
222
|
-
|
|
291
|
+
- `consistent-type-imports` uses `fixStyle: inline-type-imports`, the same as the base preset.
|
|
292
|
+
|
|
293
|
+
### BrowserOxlintConfigs
|
|
294
|
+
|
|
295
|
+
`BrowserOxlintConfigs.create()` is `oxlintConfigs` plus `NoRestrictedPropertiesRule.build()`. That
|
|
296
|
+
rule bans `crypto.randomUUID`, which exists only in a secure context (https, localhost). On a
|
|
297
|
+
plain-http origin or in a WebView, the method is `undefined`. Use this preset for browser code that
|
|
298
|
+
does not use React.
|
|
299
|
+
|
|
300
|
+
```ts
|
|
301
|
+
// .configs/oxlint.config.mts
|
|
302
|
+
import { defineConfig } from 'oxlint';
|
|
303
|
+
import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
304
|
+
|
|
305
|
+
export default defineConfig(BrowserOxlintConfigs.create());
|
|
306
|
+
```
|
|
223
307
|
|
|
224
308
|
### ReactOxlintConfigs and reactNamingConventionConfigs
|
|
225
309
|
|
|
@@ -233,16 +317,14 @@ import { ReactOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
|
233
317
|
|
|
234
318
|
export default defineConfig(ReactOxlintConfigs.create());
|
|
235
319
|
|
|
236
|
-
// .configs/eslint.config.
|
|
320
|
+
// .configs/eslint.config.mjs
|
|
237
321
|
import { reactNamingConventionConfigs } from '@venizia/dev-configs/linters';
|
|
238
322
|
|
|
239
323
|
export default reactNamingConventionConfigs;
|
|
240
324
|
```
|
|
241
325
|
|
|
242
|
-
`ReactOxlintConfigs.create()` is `
|
|
243
|
-
strict as the base. `react/no-deprecated` is left out: oxlint has no port of it.
|
|
244
|
-
is banned because it exists only in a secure context (https, localhost), and is `undefined` on a
|
|
245
|
-
plain-http origin or in a WebView.
|
|
326
|
+
`ReactOxlintConfigs.create()` is `BrowserOxlintConfigs.create()` plus the same rules as the ESLint
|
|
327
|
+
table above, as strict as the base. `react/no-deprecated` is left out: oxlint has no port of it.
|
|
246
328
|
|
|
247
329
|
The presets start strict. An application that wants less overrides the rule after the preset:
|
|
248
330
|
|
|
@@ -256,8 +338,7 @@ export default defineConfig({
|
|
|
256
338
|
```
|
|
257
339
|
|
|
258
340
|
`reactNamingConventionConfigs` is `namingConventionConfigs` plus PascalCase functions in `.jsx` and
|
|
259
|
-
`.tsx` files.
|
|
260
|
-
`[NoRestrictedPropertiesRule.NAME]: NoRestrictedPropertiesRule.build()` to its rules.
|
|
341
|
+
`.tsx` files.
|
|
261
342
|
|
|
262
343
|
### BunCompiler
|
|
263
344
|
|
|
@@ -273,7 +354,7 @@ await BunCompiler.compile({ entrypoint: './src/index.ts', outfile: './dist/app'
|
|
|
273
354
|
## Where it sits
|
|
274
355
|
|
|
275
356
|
The root of the chain, with no IGNIS dependency: **dev-configs** -> inversion -> {filter, helpers}
|
|
276
|
-
-> {boot, kernel} -> connectors -> {core-worker, core-server}
|
|
357
|
+
-> {boot, kernel} -> connectors -> {core-worker, core-server}.
|
|
277
358
|
|
|
278
359
|
## Links
|
|
279
360
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":"AAIA,gHAAgH;AAChH,qBAAa,WAAW;IACtB;;;;OAIG;WACU,OAAO,CAClB,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;KACtB,GACL,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":"AAIA,gHAAgH;AAChH,qBAAa,WAAW;IACtB;;;;OAIG;WACU,OAAO,CAClB,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;KACtB,GACL,OAAO,CAAC,IAAI,CAAC;CAiCjB"}
|
package/dist/compilers/bun.js
CHANGED
|
@@ -28,6 +28,7 @@ class BunCompiler {
|
|
|
28
28
|
if (!built.success) {
|
|
29
29
|
// `getError` lives in `inversion`, which depends on `dev-configs` - importing it here would
|
|
30
30
|
// create a circular workspace dependency, so a failed compile throws a plain `Error` instead.
|
|
31
|
+
// eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle
|
|
31
32
|
throw new Error([
|
|
32
33
|
`[BunCompiler] compile failed for entrypoint "${entrypoint}":`,
|
|
33
34
|
...built.logs.map(log => `[${log.level}] ${log.message}`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAC7C,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAE/C,gHAAgH;AAChH,MAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,OAKI,EAAE;QAEN,MAAM,EACJ,UAAU,GAAG,kBAAkB,EAC/B,OAAO,GAAG,eAAe,EACzB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EACrD,OAAO,GAAG,EAAE,GACb,GAAG,IAAI,CAAC;QAET,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,CAAC,UAAU,CAAC;YACzB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YAC1C,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,MAAM,EAAE,MAAiC;gBACzC,OAAO;aACR;YACD,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,4FAA4F;YAC5F,8FAA8F;YAC9F,MAAM,IAAI,KAAK,CACb;gBACE,gDAAgD,UAAU,IAAI;gBAC9D,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;aAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAC7C,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAE/C,gHAAgH;AAChH,MAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,OAKI,EAAE;QAEN,MAAM,EACJ,UAAU,GAAG,kBAAkB,EAC/B,OAAO,GAAG,eAAe,EACzB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EACrD,OAAO,GAAG,EAAE,GACb,GAAG,IAAI,CAAC;QAET,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,CAAC,UAAU,CAAC;YACzB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YAC1C,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,MAAM,EAAE,MAAiC;gBACzC,OAAO;aACR;YACD,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,4FAA4F;YAC5F,8FAA8F;YAC9F,sGAAsG;YACtG,MAAM,IAAI,KAAK,CACb;gBACE,gDAAgD,UAAU,IAAI;gBAC9D,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;aAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA9CD,kCA8CC"}
|
|
@@ -11,4 +11,18 @@ import type { OxfmtConfig } from 'oxfmt';
|
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
export declare const oxfmtConfigs: OxfmtConfig;
|
|
14
|
+
/**
|
|
15
|
+
* `oxfmtConfigs` for browser and React code: arrow parameters always in parentheses (`(x) => x`),
|
|
16
|
+
* and the closing `>` of a multi-line JSX element on its last attribute line, which keeps JSX diffs
|
|
17
|
+
* small. `bracketSameLine` changes nothing outside JSX.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* // .configs/oxfmt.config.mts
|
|
21
|
+
* import { defineConfig } from 'oxfmt';
|
|
22
|
+
* import { browserOxfmtConfigs } from '@venizia/dev-configs/formatters';
|
|
23
|
+
*
|
|
24
|
+
* export default defineConfig(browserOxfmtConfigs);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const browserOxfmtConfigs: OxfmtConfig;
|
|
14
28
|
//# sourceMappingURL=oxfmt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxfmt.d.ts","sourceRoot":"","sources":["../../src/formatters/oxfmt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,WAQ1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"oxfmt.d.ts","sourceRoot":"","sources":["../../src/formatters/oxfmt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,WAQ1B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAIjC,CAAC"}
|
package/dist/formatters/oxfmt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oxfmtConfigs = void 0;
|
|
3
|
+
exports.browserOxfmtConfigs = exports.oxfmtConfigs = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The oxfmt port of `prettierConfigs` - the same seven options, so the output matches Prettier's.
|
|
6
6
|
*
|
|
@@ -21,4 +21,22 @@ exports.oxfmtConfigs = {
|
|
|
21
21
|
arrowParens: 'avoid',
|
|
22
22
|
semi: true,
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* `oxfmtConfigs` for browser and React code: arrow parameters always in parentheses (`(x) => x`),
|
|
26
|
+
* and the closing `>` of a multi-line JSX element on its last attribute line, which keeps JSX diffs
|
|
27
|
+
* small. `bracketSameLine` changes nothing outside JSX.
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* // .configs/oxfmt.config.mts
|
|
31
|
+
* import { defineConfig } from 'oxfmt';
|
|
32
|
+
* import { browserOxfmtConfigs } from '@venizia/dev-configs/formatters';
|
|
33
|
+
*
|
|
34
|
+
* export default defineConfig(browserOxfmtConfigs);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
exports.browserOxfmtConfigs = {
|
|
38
|
+
...exports.oxfmtConfigs,
|
|
39
|
+
arrowParens: 'always',
|
|
40
|
+
bracketSameLine: true,
|
|
41
|
+
};
|
|
24
42
|
//# sourceMappingURL=oxfmt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxfmt.js","sourceRoot":"","sources":["../../src/formatters/oxfmt.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACU,QAAA,YAAY,GAAgB;IACvC,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,GAAG;IACf,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,IAAI;CACX,CAAC"}
|
|
1
|
+
{"version":3,"file":"oxfmt.js","sourceRoot":"","sources":["../../src/formatters/oxfmt.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACU,QAAA,YAAY,GAAgB;IACvC,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,GAAG;IACf,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,IAAI;CACX,CAAC;AAEF;;;;;;;;;;;;GAYG;AACU,QAAA,mBAAmB,GAAgB;IAC9C,GAAG,oBAAY;IACf,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,IAAI;CACtB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { OxlintConfig } from 'oxlint';
|
|
2
|
+
import { type IOxlintPresetOptions } from './oxlint';
|
|
3
|
+
/**
|
|
4
|
+
* `oxlintConfigs` for code that runs in a browser, React or not: the base rules plus the
|
|
5
|
+
* secure-context ban (`crypto.randomUUID` is `undefined` on a plain-http origin). Nothing in the base
|
|
6
|
+
* is relaxed. `ReactOxlintConfigs` builds on this preset. Takes the same options as `OxlintConfigs`.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* // .configs/oxlint.config.mts
|
|
10
|
+
* import { defineConfig } from 'oxlint';
|
|
11
|
+
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
12
|
+
*
|
|
13
|
+
* export default defineConfig(BrowserOxlintConfigs.create());
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class BrowserOxlintConfigs {
|
|
17
|
+
static create(opts?: IOxlintPresetOptions): OxlintConfig;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,KAAK,oBAAoB,EAAiB,MAAM,UAAU,CAAC;AAGpE;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAW7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserOxlintConfigs = void 0;
|
|
4
|
+
const oxlint_1 = require("./oxlint");
|
|
5
|
+
const rules_1 = require("./rules");
|
|
6
|
+
/**
|
|
7
|
+
* `oxlintConfigs` for code that runs in a browser, React or not: the base rules plus the
|
|
8
|
+
* secure-context ban (`crypto.randomUUID` is `undefined` on a plain-http origin). Nothing in the base
|
|
9
|
+
* is relaxed. `ReactOxlintConfigs` builds on this preset. Takes the same options as `OxlintConfigs`.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* // .configs/oxlint.config.mts
|
|
13
|
+
* import { defineConfig } from 'oxlint';
|
|
14
|
+
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
15
|
+
*
|
|
16
|
+
* export default defineConfig(BrowserOxlintConfigs.create());
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class BrowserOxlintConfigs {
|
|
20
|
+
static create(opts = {}) {
|
|
21
|
+
const baseConfigs = oxlint_1.OxlintConfigs.create(opts);
|
|
22
|
+
return {
|
|
23
|
+
...baseConfigs,
|
|
24
|
+
rules: {
|
|
25
|
+
...baseConfigs.rules,
|
|
26
|
+
[rules_1.NoRestrictedPropertiesRule.NAME]: rules_1.NoRestrictedPropertiesRule.build(),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.BrowserOxlintConfigs = BrowserOxlintConfigs;
|
|
32
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":";;;AACA,qCAAoE;AACpE,mCAAqD;AAErD;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,MAAM,WAAW,GAAG,sBAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE/C,OAAO;YACL,GAAG,WAAW;YACd,KAAK,EAAE;gBACL,GAAG,WAAW,CAAC,KAAK;gBACpB,CAAC,kCAA0B,CAAC,IAAI,CAAC,EAAE,kCAA0B,CAAC,KAAK,EAAE;aACtE;SACF,CAAC;IACJ,CAAC;CACF;AAZD,oDAYC"}
|
package/dist/linters/eslint.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const eslintConfigs: Linter.Config[];
|
|
|
10
10
|
* next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.
|
|
11
11
|
*
|
|
12
12
|
* ```js
|
|
13
|
-
* // .configs/eslint.config.
|
|
13
|
+
* // .configs/eslint.config.mjs
|
|
14
14
|
* import { namingConventionConfigs } from '@venizia/dev-configs/linters';
|
|
15
15
|
*
|
|
16
16
|
* export default namingConventionConfigs;
|
package/dist/linters/eslint.js
CHANGED
|
@@ -131,7 +131,7 @@ exports.eslintConfigs = (0, config_1.defineConfig)([
|
|
|
131
131
|
* next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.
|
|
132
132
|
*
|
|
133
133
|
* ```js
|
|
134
|
-
* // .configs/eslint.config.
|
|
134
|
+
* // .configs/eslint.config.mjs
|
|
135
135
|
* import { namingConventionConfigs } from '@venizia/dev-configs/linters';
|
|
136
136
|
*
|
|
137
137
|
* export default namingConventionConfigs;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The estree node types the house rules visit - computed visitor keys, so the names stay PascalCase as ESLint needs them. */
|
|
2
|
+
export declare class AstNodeTypes {
|
|
3
|
+
static readonly NEW_EXPRESSION = "NewExpression";
|
|
4
|
+
static readonly CALL_EXPRESSION = "CallExpression";
|
|
5
|
+
static readonly FUNCTION_DECLARATION = "FunctionDeclaration";
|
|
6
|
+
static readonly FUNCTION_EXPRESSION = "FunctionExpression";
|
|
7
|
+
static readonly ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression";
|
|
8
|
+
}
|
|
9
|
+
/** The ESLint namespace the house rules live under: `venizia/<rule>`. */
|
|
10
|
+
export declare const HOUSE_PLUGIN_NAMESPACE = "venizia";
|
|
11
|
+
/** A field of an AST node, read without trusting its type: TypeScript nodes carry fields estree does not declare. */
|
|
12
|
+
export declare const readField: (opts: {
|
|
13
|
+
node: unknown;
|
|
14
|
+
key: string;
|
|
15
|
+
}) => unknown;
|
|
16
|
+
/** The node's `type`, or `undefined` for anything that is not an AST node. */
|
|
17
|
+
export declare const nodeType: (opts: {
|
|
18
|
+
node: unknown;
|
|
19
|
+
}) => string | undefined;
|
|
20
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/linters/house/common.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,cAAc,mBAAmB;IACjD,MAAM,CAAC,QAAQ,CAAC,eAAe,oBAAoB;IACnD,MAAM,CAAC,QAAQ,CAAC,oBAAoB,yBAAyB;IAC7D,MAAM,CAAC,QAAQ,CAAC,mBAAmB,wBAAwB;IAC3D,MAAM,CAAC,QAAQ,CAAC,yBAAyB,6BAA6B;CACvE;AAED,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,qHAAqH;AACrH,eAAO,MAAM,SAAS,GAAI,MAAM;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,KAAG,OAKhE,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,GAAI,MAAM;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,KAAG,MAAM,GAAG,SAG3D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeType = exports.readField = exports.HOUSE_PLUGIN_NAMESPACE = exports.AstNodeTypes = void 0;
|
|
4
|
+
/** The estree node types the house rules visit - computed visitor keys, so the names stay PascalCase as ESLint needs them. */
|
|
5
|
+
class AstNodeTypes {
|
|
6
|
+
static { this.NEW_EXPRESSION = 'NewExpression'; }
|
|
7
|
+
static { this.CALL_EXPRESSION = 'CallExpression'; }
|
|
8
|
+
static { this.FUNCTION_DECLARATION = 'FunctionDeclaration'; }
|
|
9
|
+
static { this.FUNCTION_EXPRESSION = 'FunctionExpression'; }
|
|
10
|
+
static { this.ARROW_FUNCTION_EXPRESSION = 'ArrowFunctionExpression'; }
|
|
11
|
+
}
|
|
12
|
+
exports.AstNodeTypes = AstNodeTypes;
|
|
13
|
+
/** The ESLint namespace the house rules live under: `venizia/<rule>`. */
|
|
14
|
+
exports.HOUSE_PLUGIN_NAMESPACE = 'venizia';
|
|
15
|
+
/** A field of an AST node, read without trusting its type: TypeScript nodes carry fields estree does not declare. */
|
|
16
|
+
const readField = (opts) => {
|
|
17
|
+
const { node, key } = opts;
|
|
18
|
+
return typeof node === 'object' && node !== null && key in node
|
|
19
|
+
? Reflect.get(node, key)
|
|
20
|
+
: undefined;
|
|
21
|
+
};
|
|
22
|
+
exports.readField = readField;
|
|
23
|
+
/** The node's `type`, or `undefined` for anything that is not an AST node. */
|
|
24
|
+
const nodeType = (opts) => {
|
|
25
|
+
const type = (0, exports.readField)({ node: opts.node, key: 'type' });
|
|
26
|
+
return typeof type === 'string' ? type : undefined;
|
|
27
|
+
};
|
|
28
|
+
exports.nodeType = nodeType;
|
|
29
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/linters/house/common.ts"],"names":[],"mappings":";;;AAAA,8HAA8H;AAC9H,MAAa,YAAY;aACP,mBAAc,GAAG,eAAe,CAAC;aACjC,oBAAe,GAAG,gBAAgB,CAAC;aACnC,yBAAoB,GAAG,qBAAqB,CAAC;aAC7C,wBAAmB,GAAG,oBAAoB,CAAC;aAC3C,8BAAyB,GAAG,yBAAyB,CAAC;;AALxE,oCAMC;AAED,yEAAyE;AAC5D,QAAA,sBAAsB,GAAG,SAAS,CAAC;AAEhD,qHAAqH;AAC9G,MAAM,SAAS,GAAG,CAAC,IAAoC,EAAW,EAAE;IACzE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI;QAC7D,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC;QACxB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB;AAEF,8EAA8E;AACvE,MAAM,QAAQ,GAAG,CAAC,IAAuB,EAAsB,EAAE;IACtE,MAAM,IAAI,GAAG,IAAA,iBAAS,EAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC,CAAC;AAHW,QAAA,QAAQ,YAGnB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* The ESLint side of a project that lints with oxlint: the naming convention plus the house rules -
|
|
4
|
+
* everything oxlint cannot express. Run it next to `oxlintConfigs`.
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* // .configs/eslint.config.mjs
|
|
8
|
+
* import { houseConfigs } from '@venizia/dev-configs/linters';
|
|
9
|
+
*
|
|
10
|
+
* export default houseConfigs;
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare const houseConfigs: Linter.Config[];
|
|
14
|
+
/** `houseConfigs` for a React project: `reactNamingConventionConfigs` plus the house rules. */
|
|
15
|
+
export declare const reactHouseConfigs: Linter.Config[];
|
|
16
|
+
//# sourceMappingURL=configs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../../src/linters/house/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA4BrC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAsD,CAAC;AAE/F,+FAA+F;AAC/F,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAG5C,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reactHouseConfigs = exports.houseConfigs = void 0;
|
|
4
|
+
const eslint_1 = require("../eslint");
|
|
5
|
+
const react_1 = require("../react");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const max_params_own_rule_1 = require("./max-params-own.rule");
|
|
8
|
+
const no_new_error_rule_1 = require("./no-new-error.rule");
|
|
9
|
+
const plugin_1 = require("./plugin");
|
|
10
|
+
const SOURCE_FILES = ['**/*.{ts,tsx,mts,cts}'];
|
|
11
|
+
const TEST_FILES = ['**/__tests__/**', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'];
|
|
12
|
+
/**
|
|
13
|
+
* The house rules: at most 5 positional parameters on a function we write, and errors thrown through
|
|
14
|
+
* `getError` only. Tests are exempt from `no-new-error`: a test throws a plain `Error` on purpose, to
|
|
15
|
+
* stand in for what a driver or a third-party library throws.
|
|
16
|
+
*/
|
|
17
|
+
const houseRuleConfigs = [
|
|
18
|
+
{
|
|
19
|
+
files: SOURCE_FILES,
|
|
20
|
+
plugins: { [common_1.HOUSE_PLUGIN_NAMESPACE]: plugin_1.houseEslintPlugin },
|
|
21
|
+
rules: {
|
|
22
|
+
[max_params_own_rule_1.MaxParamsOwnRule.NAME]: max_params_own_rule_1.MaxParamsOwnRule.build(),
|
|
23
|
+
[no_new_error_rule_1.NoNewErrorRule.NAME]: no_new_error_rule_1.NoNewErrorRule.build(),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{ files: TEST_FILES, rules: { [no_new_error_rule_1.NoNewErrorRule.NAME]: 'off' } },
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* The ESLint side of a project that lints with oxlint: the naming convention plus the house rules -
|
|
30
|
+
* everything oxlint cannot express. Run it next to `oxlintConfigs`.
|
|
31
|
+
*
|
|
32
|
+
* ```js
|
|
33
|
+
* // .configs/eslint.config.mjs
|
|
34
|
+
* import { houseConfigs } from '@venizia/dev-configs/linters';
|
|
35
|
+
*
|
|
36
|
+
* export default houseConfigs;
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
exports.houseConfigs = [...eslint_1.namingConventionConfigs, ...houseRuleConfigs];
|
|
40
|
+
/** `houseConfigs` for a React project: `reactNamingConventionConfigs` plus the house rules. */
|
|
41
|
+
exports.reactHouseConfigs = [
|
|
42
|
+
...react_1.reactNamingConventionConfigs,
|
|
43
|
+
...houseRuleConfigs,
|
|
44
|
+
];
|
|
45
|
+
//# sourceMappingURL=configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configs.js","sourceRoot":"","sources":["../../../src/linters/house/configs.ts"],"names":[],"mappings":";;;AACA,sCAAoD;AACpD,oCAAwD;AACxD,qCAAkD;AAClD,+DAAyD;AACzD,2DAAqD;AACrD,qCAA6C;AAE7C,MAAM,YAAY,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AAEnF;;;;GAIG;AACH,MAAM,gBAAgB,GAAoB;IACxC;QACE,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,EAAE,CAAC,+BAAsB,CAAC,EAAE,0BAAiB,EAAE;QACxD,KAAK,EAAE;YACL,CAAC,sCAAgB,CAAC,IAAI,CAAC,EAAE,sCAAgB,CAAC,KAAK,EAAE;YACjD,CAAC,kCAAc,CAAC,IAAI,CAAC,EAAE,kCAAc,CAAC,KAAK,EAAE;SAC9C;KACF;IACD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,kCAAc,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;CAC/D,CAAC;AAEF;;;;;;;;;;GAUG;AACU,QAAA,YAAY,GAAoB,CAAC,GAAG,gCAAuB,EAAE,GAAG,gBAAgB,CAAC,CAAC;AAE/F,+FAA+F;AAClF,QAAA,iBAAiB,GAAoB;IAChD,GAAG,oCAA4B;IAC/B,GAAG,gBAAgB;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/linters/house/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./common"), exports);
|
|
18
|
+
__exportStar(require("./max-params-own.rule"), exports);
|
|
19
|
+
__exportStar(require("./no-new-error.rule"), exports);
|
|
20
|
+
__exportStar(require("./plugin"), exports);
|
|
21
|
+
__exportStar(require("./configs"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/linters/house/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,wDAAsC;AACtC,sDAAoC;AACpC,2CAAyB;AACzB,4CAA0B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Linter, Rule } from 'eslint';
|
|
2
|
+
import type { TRuleSeverity } from '../rules/common';
|
|
3
|
+
/**
|
|
4
|
+
* `venizia/max-params-own`. A function we write takes at most `max` (default 5) positional parameters;
|
|
5
|
+
* beyond that it takes one options object. A signature that belongs to someone else is not counted: an
|
|
6
|
+
* inline callback handed to a call (map, reduce, sort, a library handler) or to a JSX prop, a function a
|
|
7
|
+
* declared type fixes (`const x: TFn = (...)`, a member of a typed or `satisfies` object), and a
|
|
8
|
+
* constructor whose every parameter is injected (`@inject`). A hook's callback (`useCallback(...)`) is ours.
|
|
9
|
+
*/
|
|
10
|
+
export declare class MaxParamsOwnRule {
|
|
11
|
+
static readonly NAME = "venizia/max-params-own";
|
|
12
|
+
static readonly DEFAULT_MAX = 5;
|
|
13
|
+
static readonly RULE: Rule.RuleModule;
|
|
14
|
+
static build(opts?: {
|
|
15
|
+
severity?: TRuleSeverity;
|
|
16
|
+
max?: number;
|
|
17
|
+
}): Linter.RuleEntry;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=max-params-own.rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max-params-own.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/house/max-params-own.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAyDrD;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,IAAI,4BAA8C;IAElE,MAAM,CAAC,QAAQ,CAAC,WAAW,KAAK;IAEhC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAmFnC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,MAAM,CAAC,SAAS;CAItF"}
|