@venizia/dev-configs 0.3.1 → 0.3.3
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 +18 -6
- package/dist/compilers/bun.d.ts +2 -0
- package/dist/compilers/bun.d.ts.map +1 -1
- package/dist/compilers/bun.js +2 -1
- package/dist/compilers/bun.js.map +1 -1
- package/dist/compilers/index.js.map +1 -1
- package/dist/formatters/index.js.map +1 -1
- package/dist/formatters/oxfmt.js.map +1 -1
- package/dist/formatters/prettier.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/linters/browser.d.ts +1 -1
- package/dist/linters/browser.js +1 -1
- package/dist/linters/browser.js.map +1 -1
- package/dist/linters/eslint.js.map +1 -1
- package/dist/linters/house/common.js.map +1 -1
- package/dist/linters/house/configs.js +4 -4
- package/dist/linters/house/configs.js.map +1 -1
- package/dist/linters/house/const-class-values.rule.js.map +1 -1
- package/dist/linters/house/index.js.map +1 -1
- package/dist/linters/house/max-params-own.rule.js.map +1 -1
- package/dist/linters/house/no-leaked-render.rule.js.map +1 -1
- package/dist/linters/house/no-new-error.rule.js.map +1 -1
- package/dist/linters/house/plugin.js.map +1 -1
- package/dist/linters/ignore.js.map +1 -1
- package/dist/linters/index.d.ts +2 -5
- package/dist/linters/index.d.ts.map +1 -1
- package/dist/linters/index.js +2 -5
- package/dist/linters/index.js.map +1 -1
- package/dist/linters/jsx-files.d.ts +3 -0
- package/dist/linters/jsx-files.d.ts.map +1 -0
- package/dist/linters/jsx-files.js +6 -0
- package/dist/linters/jsx-files.js.map +1 -0
- package/dist/linters/oxlint-presets.d.ts +6 -0
- package/dist/linters/oxlint-presets.d.ts.map +1 -0
- package/dist/linters/oxlint-presets.js +27 -0
- package/dist/linters/oxlint-presets.js.map +1 -0
- package/dist/linters/oxlint.d.ts +2 -2
- package/dist/linters/oxlint.js +2 -2
- package/dist/linters/oxlint.js.map +1 -1
- package/dist/linters/{react.d.ts → react-eslint.d.ts} +1 -23
- package/dist/linters/react-eslint.d.ts.map +1 -0
- package/dist/linters/{react.js → react-eslint.js} +5 -89
- package/dist/linters/react-eslint.js.map +1 -0
- package/dist/linters/react-oxlint.d.ts +23 -0
- package/dist/linters/react-oxlint.d.ts.map +1 -0
- package/dist/linters/react-oxlint.js +90 -0
- package/dist/linters/react-oxlint.js.map +1 -0
- package/dist/linters/rules/common.js.map +1 -1
- package/dist/linters/rules/eqeqeq.rule.js.map +1 -1
- package/dist/linters/rules/index.js.map +1 -1
- package/dist/linters/rules/naming-convention.rule.js.map +1 -1
- package/dist/linters/rules/no-restricted-imports.rule.js.map +1 -1
- package/dist/linters/rules/no-restricted-properties.rule.js.map +1 -1
- package/dist/linters/rules/no-unused-vars.rule.js.map +1 -1
- package/dist/linters/rules/prefer-nullish-coalescing.rule.js.map +1 -1
- package/dist/linters/rules/switch-case-braces.rule.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/rejection.helper.js.map +1 -1
- package/package.json +5 -1
- package/dist/linters/react.d.ts.map +0 -1
- package/dist/linters/react.js.map +0 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Each tool takes one file. IGNIS keeps them in a `.configs/` folder and passes `-
|
|
|
21
21
|
```typescript
|
|
22
22
|
// .configs/oxlint.config.mts
|
|
23
23
|
import { defineConfig } from 'oxlint';
|
|
24
|
-
import { oxlintConfigs } from '@venizia/dev-configs/linters';
|
|
24
|
+
import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
25
25
|
|
|
26
26
|
export default defineConfig(oxlintConfigs);
|
|
27
27
|
```
|
|
@@ -116,6 +116,7 @@ Every IGNIS package and example does.
|
|
|
116
116
|
| `@venizia/dev-configs/formatters` | `oxfmtConfigs`, `browserOxfmtConfigs`, `prettierConfigs` |
|
|
117
117
|
| `@venizia/dev-configs/testing` | `rejectionOf`, `expectRejection` - test helpers for a promise that must reject (imports `bun:test`; tests only) |
|
|
118
118
|
| `@venizia/dev-configs/linters` | `oxlintConfigs`, `OxlintConfigs`, `BrowserOxlintConfigs`, `ReactOxlintConfigs`, `LintIgnore`, `namingConventionConfigs`, `reactNamingConventionConfigs`, `houseConfigs`, `reactHouseConfigs`, `eslintConfigs`, `ReactEslintConfigs`, the rule classes and their types |
|
|
119
|
+
| `@venizia/dev-configs/linters/oxlint` | `oxlintConfigs`, `OxlintConfigs`, `IOxlintPresetOptions`, `BrowserOxlintConfigs`, `ReactOxlintConfigs`, `LintIgnore`, the rule classes and their types: everything an oxlint config needs, and nothing that loads ESLint. Loads in milliseconds: `/linters` also loads ESLint and its plugins, which an oxlint config never uses |
|
|
119
120
|
| `@venizia/dev-configs/tsconfig.base.json` | Target and lib ES2025, `module` Node16, strict mode (`noImplicitAny` and `useUnknownInCatchVariables` on) with `strictPropertyInitialization` off (DI-injected properties have no initializer), `noEmitOnError`, tests excluded |
|
|
120
121
|
| `@venizia/dev-configs/tsconfig.common.json` | Extends the base and switches `module` and `moduleResolution` to `nodenext` |
|
|
121
122
|
| `@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` |
|
|
@@ -158,7 +159,7 @@ where `''` and `0` fall back on purpose opts out in one line:
|
|
|
158
159
|
```ts
|
|
159
160
|
// .configs/oxlint.config.mts
|
|
160
161
|
import { defineConfig } from 'oxlint';
|
|
161
|
-
import { OxlintConfigs } from '@venizia/dev-configs/linters';
|
|
162
|
+
import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
162
163
|
|
|
163
164
|
export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
|
|
164
165
|
```
|
|
@@ -216,7 +217,7 @@ import {
|
|
|
216
217
|
EqeqeqRule,
|
|
217
218
|
NoRestrictedImportsRule,
|
|
218
219
|
oxlintConfigs,
|
|
219
|
-
} from '@venizia/dev-configs/linters';
|
|
220
|
+
} from '@venizia/dev-configs/linters/oxlint';
|
|
220
221
|
|
|
221
222
|
export default defineConfig({
|
|
222
223
|
...oxlintConfigs,
|
|
@@ -313,7 +314,7 @@ does not use React.
|
|
|
313
314
|
```ts
|
|
314
315
|
// .configs/oxlint.config.mts
|
|
315
316
|
import { defineConfig } from 'oxlint';
|
|
316
|
-
import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
317
|
+
import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
317
318
|
|
|
318
319
|
export default defineConfig(BrowserOxlintConfigs.create());
|
|
319
320
|
```
|
|
@@ -326,7 +327,7 @@ nothing is passed in. Pair it with `reactNamingConventionConfigs` on the ESLint
|
|
|
326
327
|
```ts
|
|
327
328
|
// .configs/oxlint.config.mts
|
|
328
329
|
import { defineConfig } from 'oxlint';
|
|
329
|
-
import { ReactOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
330
|
+
import { ReactOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
330
331
|
|
|
331
332
|
export default defineConfig(ReactOxlintConfigs.create());
|
|
332
333
|
|
|
@@ -384,7 +385,8 @@ instead: `LintIgnore.oxlint({ config, patterns: LINT_IGNORE })`.
|
|
|
384
385
|
### BunCompiler
|
|
385
386
|
|
|
386
387
|
`BunCompiler.compile()` builds one Bun executable: minified, with a linked source map. The
|
|
387
|
-
compile target comes from `BUN_TARGET` and defaults to `bun-linux-x64`.
|
|
388
|
+
compile target comes from `BUN_TARGET` and defaults to `bun-linux-x64`. `define` passes compile-time
|
|
389
|
+
constants to `Bun.build`; a compile script uses it to bake the build stamp.
|
|
388
390
|
|
|
389
391
|
```typescript
|
|
390
392
|
import { BunCompiler } from '@venizia/dev-configs';
|
|
@@ -392,6 +394,16 @@ import { BunCompiler } from '@venizia/dev-configs';
|
|
|
392
394
|
await BunCompiler.compile({ entrypoint: './src/index.ts', outfile: './dist/app' });
|
|
393
395
|
```
|
|
394
396
|
|
|
397
|
+
Bake a value into the binary with `define`. Each value is a JSON-encoded expression:
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
await BunCompiler.compile({
|
|
401
|
+
entrypoint: './src/index.ts',
|
|
402
|
+
outfile: './dist/app',
|
|
403
|
+
define: { APP_FLAVOUR: JSON.stringify('blue') },
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
395
407
|
## Where it sits
|
|
396
408
|
|
|
397
409
|
The root of the chain, with no IGNIS dependency: **dev-configs** -> inversion -> {filter, helpers}
|
package/dist/compilers/bun.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare class BunCompiler {
|
|
|
10
10
|
outfile?: string;
|
|
11
11
|
target?: string;
|
|
12
12
|
plugins?: Bun.BunPlugin[];
|
|
13
|
+
/** Compile-time constants: each key is replaced by its value, a JSON-encoded expression, wherever the bundle reads it. */
|
|
14
|
+
define?: Record<string, string>;
|
|
13
15
|
}): Promise<void>;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=bun.d.ts.map
|
|
@@ -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;
|
|
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;QAC1B,0HAA0H;QAC1H,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5B,GACL,OAAO,CAAC,IAAI,CAAC;CAmCjB"}
|
package/dist/compilers/bun.js
CHANGED
|
@@ -12,7 +12,7 @@ class BunCompiler {
|
|
|
12
12
|
* `platformaticKafkaPlugins()` from `helpers`, which would invert that chain.
|
|
13
13
|
*/
|
|
14
14
|
static async compile(opts = {}) {
|
|
15
|
-
const { entrypoint = DEFAULT_ENTRYPOINT, outfile = DEFAULT_OUTFILE, target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET, plugins = [], } = opts;
|
|
15
|
+
const { entrypoint = DEFAULT_ENTRYPOINT, outfile = DEFAULT_OUTFILE, target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET, plugins = [], define = {}, } = opts;
|
|
16
16
|
const built = await Bun.build({
|
|
17
17
|
entrypoints: [entrypoint],
|
|
18
18
|
target: 'bun',
|
|
@@ -23,6 +23,7 @@ class BunCompiler {
|
|
|
23
23
|
target: target,
|
|
24
24
|
outfile,
|
|
25
25
|
},
|
|
26
|
+
define,
|
|
26
27
|
plugins,
|
|
27
28
|
});
|
|
28
29
|
if (!built.success) {
|
|
@@ -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,
|
|
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,OAOI,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,EACZ,MAAM,GAAG,EAAE,GACZ,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,MAAM;YACN,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;AAlDD,kCAkDC","sourcesContent":["const DEFAULT_ENTRYPOINT = './dist/index.js';\nconst DEFAULT_OUTFILE = './dist/bin';\nconst DEFAULT_COMPILE_TARGET = 'bun-linux-x64';\n\n/** Bundles and compiles a single Bun executable: minified, linked sourcemaps, target read from `BUN_TARGET`. */\nexport class BunCompiler {\n /**\n * `plugins` is a parameter, never resolved here - `dev-configs` sits below every other IGNIS\n * package (see the Makefile chain) and must not import a plugin factory such as\n * `platformaticKafkaPlugins()` from `helpers`, which would invert that chain.\n */\n static async compile(\n opts: {\n entrypoint?: string;\n outfile?: string;\n target?: string;\n plugins?: Bun.BunPlugin[];\n /** Compile-time constants: each key is replaced by its value, a JSON-encoded expression, wherever the bundle reads it. */\n define?: Record<string, string>;\n } = {},\n ): Promise<void> {\n const {\n entrypoint = DEFAULT_ENTRYPOINT,\n outfile = DEFAULT_OUTFILE,\n target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET,\n plugins = [],\n define = {},\n } = opts;\n\n const built = await Bun.build({\n entrypoints: [entrypoint],\n target: 'bun',\n minify: { whitespace: true, syntax: true },\n sourcemap: 'linked',\n throw: false,\n compile: {\n target: target as Bun.Build.CompileTarget,\n outfile,\n },\n define,\n plugins,\n });\n\n if (!built.success) {\n // `getError` lives in `inversion`, which depends on `dev-configs` - importing it here would\n // create a circular workspace dependency, so a failed compile throws a plain `Error` instead.\n // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle\n throw new Error(\n [\n `[BunCompiler] compile failed for entrypoint \"${entrypoint}\":`,\n ...built.logs.map(log => `[${log.level}] ${log.message}`),\n ].join('\\n'),\n );\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compilers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compilers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB","sourcesContent":["export * from './bun';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B","sourcesContent":["export * from './oxfmt';\nexport * from './prettier';\n"]}
|
|
@@ -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;AAEF;;;;;;;;;;;;GAYG;AACU,QAAA,mBAAmB,GAAgB;IAC9C,GAAG,oBAAY;IACf,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,IAAI;CACtB,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","sourcesContent":["import type { OxfmtConfig } from 'oxfmt';\n\n/**\n * The oxfmt port of `prettierConfigs` - the same seven options, so the output matches Prettier's.\n *\n * ```ts\n * // .configs/oxfmt.config.mts\n * import { defineConfig } from 'oxfmt';\n * import { oxfmtConfigs } from '@venizia/dev-configs/formatters';\n *\n * export default defineConfig(oxfmtConfigs);\n * ```\n */\nexport const oxfmtConfigs: OxfmtConfig = {\n bracketSpacing: true,\n singleQuote: true,\n printWidth: 100,\n tabWidth: 2,\n trailingComma: 'all',\n arrowParens: 'avoid',\n semi: true,\n};\n\n/**\n * `oxfmtConfigs` for browser and React code: arrow parameters always in parentheses (`(x) => x`),\n * and the closing `>` of a multi-line JSX element on its last attribute line, which keeps JSX diffs\n * small. `bracketSameLine` changes nothing outside JSX.\n *\n * ```ts\n * // .configs/oxfmt.config.mts\n * import { defineConfig } from 'oxfmt';\n * import { browserOxfmtConfigs } from '@venizia/dev-configs/formatters';\n *\n * export default defineConfig(browserOxfmtConfigs);\n * ```\n */\nexport const browserOxfmtConfigs: OxfmtConfig = {\n ...oxfmtConfigs,\n arrowParens: 'always',\n bracketSameLine: true,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../../src/formatters/prettier.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAW;IACrC,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":"prettier.js","sourceRoot":"","sources":["../../src/formatters/prettier.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAW;IACrC,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","sourcesContent":["import type { Config } from 'prettier';\n\nexport const prettierConfigs: Config = {\n bracketSpacing: true,\n singleQuote: true,\n printWidth: 100,\n tabWidth: 2,\n trailingComma: 'all',\n arrowParens: 'avoid',\n semi: true,\n};\n"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,4CAA0B","sourcesContent":["export * from './compilers';\nexport * from './formatters';\nexport * from './linters';\n"]}
|
|
@@ -8,7 +8,7 @@ import { type IOxlintPresetOptions } from './oxlint';
|
|
|
8
8
|
* ```ts
|
|
9
9
|
* // .configs/oxlint.config.mts
|
|
10
10
|
* import { defineConfig } from 'oxlint';
|
|
11
|
-
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
11
|
+
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
12
12
|
*
|
|
13
13
|
* export default defineConfig(BrowserOxlintConfigs.create());
|
|
14
14
|
* ```
|
package/dist/linters/browser.js
CHANGED
|
@@ -12,7 +12,7 @@ const rules_1 = require("./rules");
|
|
|
12
12
|
* ```ts
|
|
13
13
|
* // .configs/oxlint.config.mts
|
|
14
14
|
* import { defineConfig } from 'oxlint';
|
|
15
|
-
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
15
|
+
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
16
16
|
*
|
|
17
17
|
* export default defineConfig(BrowserOxlintConfigs.create());
|
|
18
18
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":";;;AACA,qCAAsC;AACtC,qCAAoE;AACpE,mCAAqD;AAErD;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,MAAM,WAAW,GAAG,sBAAa,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAEpF,OAAO,mBAAU,CAAC,MAAM,CAAC;YACvB,MAAM,EAAE;gBACN,GAAG,WAAW;gBACd,KAAK,EAAE;oBACL,GAAG,WAAW,CAAC,KAAK;oBACpB,CAAC,kCAA0B,CAAC,IAAI,CAAC,EAAE,kCAA0B,CAAC,KAAK,EAAE;iBACtE;aACF;YACD,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;CACF;AAfD,oDAeC"}
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/linters/browser.ts"],"names":[],"mappings":";;;AACA,qCAAsC;AACtC,qCAAoE;AACpE,mCAAqD;AAErD;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAoB;IAC/B,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,MAAM,WAAW,GAAG,sBAAa,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAEpF,OAAO,mBAAU,CAAC,MAAM,CAAC;YACvB,MAAM,EAAE;gBACN,GAAG,WAAW;gBACd,KAAK,EAAE;oBACL,GAAG,WAAW,CAAC,KAAK;oBACpB,CAAC,kCAA0B,CAAC,IAAI,CAAC,EAAE,kCAA0B,CAAC,KAAK,EAAE;iBACtE;aACF;YACD,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;CACF;AAfD,oDAeC","sourcesContent":["import type { OxlintConfig } from 'oxlint';\nimport { LintIgnore } from './ignore';\nimport { type IOxlintPresetOptions, OxlintConfigs } from './oxlint';\nimport { NoRestrictedPropertiesRule } from './rules';\n\n/**\n * `oxlintConfigs` for code that runs in a browser, React or not: the base rules plus the\n * secure-context ban (`crypto.randomUUID` is `undefined` on a plain-http origin). Nothing in the base\n * is relaxed. `ReactOxlintConfigs` builds on this preset. Takes the same options as `OxlintConfigs`.\n *\n * ```ts\n * // .configs/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(BrowserOxlintConfigs.create());\n * ```\n */\nexport class BrowserOxlintConfigs {\n static create(opts: IOxlintPresetOptions = {}): OxlintConfig {\n const baseConfigs = OxlintConfigs.create({ lenientFallback: opts.lenientFallback });\n\n return LintIgnore.oxlint({\n config: {\n ...baseConfigs,\n rules: {\n ...baseConfigs.rules,\n [NoRestrictedPropertiesRule.NAME]: NoRestrictedPropertiesRule.build(),\n },\n },\n patterns: opts.ignore ?? [],\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../src/linters/eslint.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,0CAA6C;AAC7C,sEAAgC;AAChC,qFAAqE;AACrE,kFAA4C;AAC5C,0EAAyC;AACzC,mCAKiB;AAEjB,mCAAmC;AACnC,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;CACX,CAAC;AAEF,qGAAqG;AACrG,MAAM,SAAS,GAAuB;IACpC,uBAAuB,EAAE,KAAK;IAC9B,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,KAAK;IAC3B,uBAAuB,EAAE,KAAK;IAC9B,uBAAuB,EAAE,KAAK;IAC9B,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,KAAK;IACxB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AE;KACrE;CACF,CAAC","sourcesContent":["import js from '@eslint/js';\nimport type { Linter } from 'eslint';\nimport { defineConfig } from 'eslint/config';\nimport n from 'eslint-plugin-n';\nimport prettierRecommended from 'eslint-plugin-prettier/recommended';\nimport unicorn from 'eslint-plugin-unicorn';\nimport tseslint from 'typescript-eslint';\nimport {\n NamingConventionRule,\n NoRestrictedImportsRule,\n NoUnusedVarsRule,\n SwitchCaseBracesRule,\n} from './rules';\n\n/** Every file the preset lints. */\nconst SOURCE_FILES = [\n '**/*.js',\n '**/*.cjs',\n '**/*.mjs',\n '**/*.jsx',\n '**/*.ts',\n '**/*.cts',\n '**/*.mts',\n '**/*.tsx',\n];\n\n/** Rules that stay off: the type checker, the formatter or the framework's own style covers them. */\nconst OFF_RULES: Linter.RulesRecord = {\n 'no-constant-condition': 'off',\n 'no-undef': 'off',\n 'no-unused-vars': 'off',\n 'no-mixed-operators': 'off',\n 'no-inner-declarations': 'off',\n 'no-dupe-class-members': 'off',\n 'no-redeclare': 'off',\n 'no-invalid-this': 'off',\n 'no-shadow': 'off',\n 'no-return-await': 'off',\n camelcase: 'off',\n '@typescript-eslint/no-explicit-any': 'off',\n '@typescript-eslint/no-unsafe-function-type': 'off',\n '@typescript-eslint/no-this-alias': 'off',\n '@typescript-eslint/no-empty-object-type': 'off',\n '@typescript-eslint/no-invalid-void-type': 'off',\n '@typescript-eslint/no-confusing-void-expression': 'off',\n '@typescript-eslint/no-extraneous-class': 'off',\n '@typescript-eslint/no-require-imports': 'off',\n '@typescript-eslint/strict-boolean-expressions': 'off',\n '@typescript-eslint/explicit-function-return-type': 'off',\n '@typescript-eslint/explicit-member-accessibility': 'off',\n '@typescript-eslint/explicit-module-boundary-types': 'off',\n '@typescript-eslint/array-type': 'off',\n '@typescript-eslint/no-non-null-assertion': 'off',\n '@typescript-eslint/no-empty-function': 'off',\n '@typescript-eslint/consistent-type-assertions': 'off',\n '@typescript-eslint/no-misused-promises': 'off',\n};\n\n/** The LoopBack 4 rule set, on top of the recommended presets. */\nconst STRICT_RULES: Linter.RulesRecord = {\n 'prefer-const': 'error',\n 'no-var': 'error',\n curly: ['error', 'all'],\n 'no-new-wrappers': 'error',\n 'no-throw-literal': 'error',\n 'no-unused-expressions': 'error',\n eqeqeq: ['error', 'smart'],\n 'no-void': 'error',\n 'no-useless-escape': 'warn',\n 'no-caller': 'error',\n 'n/prefer-node-protocol': ['error'],\n '@typescript-eslint/adjacent-overload-signatures': 'error',\n '@typescript-eslint/prefer-for-of': 'error',\n '@typescript-eslint/unified-signatures': 'error',\n '@typescript-eslint/no-invalid-this': ['error'],\n '@typescript-eslint/no-use-before-define': 'error',\n '@typescript-eslint/no-shadow': 'error',\n '@typescript-eslint/ban-ts-comment': 'error',\n '@typescript-eslint/no-namespace': 'error',\n '@typescript-eslint/await-thenable': 'error',\n '@typescript-eslint/no-floating-promises': 'error',\n '@typescript-eslint/prefer-optional-chain': 'error',\n '@typescript-eslint/prefer-nullish-coalescing': [\n 'error',\n { allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: true },\n ],\n '@typescript-eslint/return-await': 'error',\n};\n\n/**\n * The full ESLint preset, owned here: the LoopBack 4 rule set on the ESLint, typescript-eslint and\n * Prettier recommended presets, type-aware through the project service. A project on oxlint uses\n * `oxlintConfigs` + `namingConventionConfigs` instead.\n */\nexport const eslintConfigs: Linter.Config[] = defineConfig([\n js.configs.recommended,\n tseslint.configs.recommended,\n // Last of the presets, so it turns off every stylistic rule that would fight the formatter.\n prettierRecommended,\n {\n files: SOURCE_FILES,\n languageOptions: {\n parserOptions: {\n // Finds each file's tsconfig; the default project covers root-level scripts and configs.\n projectService: { allowDefaultProject: ['*.js', '*.cjs', '*.mjs', '.*.js'] },\n },\n },\n plugins: { n, unicorn },\n rules: {\n ...OFF_RULES,\n ...STRICT_RULES,\n '@typescript-eslint/no-unused-vars': NoUnusedVarsRule.build() as Linter.RuleEntry,\n [NoRestrictedImportsRule.NAME]: NoRestrictedImportsRule.build() as Linter.RuleEntry,\n [SwitchCaseBracesRule.NAME]: SwitchCaseBracesRule.build() as Linter.RuleEntry,\n [NamingConventionRule.NAME]: NamingConventionRule.build(),\n },\n },\n {\n ignores: [\n '**/node_modules/',\n '**/*.d.ts',\n '**/build/',\n '**/dist/',\n '**/release/',\n '**/babel.config.*',\n '**/.babelrc.*',\n '**/eslint.config.*',\n '**/.eslintrc.*',\n '**/.prettierrc.*',\n ],\n },\n]);\n\n/**\n * The one rule of `eslintConfigs` that oxlint cannot run yet, as a standalone ESLint preset to run\n * next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.\n *\n * ```js\n * // .configs/eslint.config.mjs\n * import { namingConventionConfigs } from '@venizia/dev-configs/linters';\n *\n * export default namingConventionConfigs;\n * ```\n */\nexport const namingConventionConfigs: Linter.Config[] = [\n // Global: ESLint does not read .gitignore, and still walks plain .js files no config claims.\n { ignores: ['**/dist/**', '**/build/**', '**/coverage/**', '**/*.d.ts', '**/*.{js,cjs,mjs}'] },\n {\n files: ['**/*.{ts,tsx,mts,cts}'],\n languageOptions: { parser: tseslint.parser as Linter.Parser },\n plugins: { '@typescript-eslint': tseslint.plugin as never },\n // oxlint owns every other rule, so the disable comments for them are not ESLint's to judge.\n linterOptions: { reportUnusedDisableDirectives: 'off' },\n rules: { [NamingConventionRule.NAME]: NamingConventionRule.build() },\n },\n];\n"]}
|
|
@@ -1 +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;aACtD,6BAAwB,GAAG,wBAAwB,CAAC;;AANtE,oCAOC;AAED,yEAAyE;AAC5D,QAAA,sBAAsB,GA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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","sourcesContent":["/** The estree node types the house rules visit - computed visitor keys, so the names stay PascalCase as ESLint needs them. */\nexport class AstNodeTypes {\n static readonly NEW_EXPRESSION = 'NewExpression';\n static readonly CALL_EXPRESSION = 'CallExpression';\n static readonly FUNCTION_DECLARATION = 'FunctionDeclaration';\n static readonly FUNCTION_EXPRESSION = 'FunctionExpression';\n static readonly ARROW_FUNCTION_EXPRESSION = 'ArrowFunctionExpression';\n static readonly EXPORT_NAMED_DECLARATION = 'ExportNamedDeclaration';\n}\n\n/** The ESLint namespace the house rules live under: `venizia/<rule>`. */\nexport const HOUSE_PLUGIN_NAMESPACE = 'venizia';\n\n/** A field of an AST node, read without trusting its type: TypeScript nodes carry fields estree does not declare. */\nexport const readField = (opts: { node: unknown; key: string }): unknown => {\n const { node, key } = opts;\n return typeof node === 'object' && node !== null && key in node\n ? Reflect.get(node, key)\n : undefined;\n};\n\n/** The node's `type`, or `undefined` for anything that is not an AST node. */\nexport const nodeType = (opts: { node: unknown }): string | undefined => {\n const type = readField({ node: opts.node, key: 'type' });\n return typeof type === 'string' ? type : undefined;\n};\n"]}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reactHouseConfigs = exports.houseConfigs = void 0;
|
|
4
4
|
const eslint_1 = require("../eslint");
|
|
5
|
-
const
|
|
5
|
+
const jsx_files_1 = require("../jsx-files");
|
|
6
|
+
const react_eslint_1 = require("../react-eslint");
|
|
6
7
|
const common_1 = require("./common");
|
|
7
8
|
const max_params_own_rule_1 = require("./max-params-own.rule");
|
|
8
9
|
const no_leaked_render_rule_1 = require("./no-leaked-render.rule");
|
|
9
10
|
const no_new_error_rule_1 = require("./no-new-error.rule");
|
|
10
11
|
const plugin_1 = require("./plugin");
|
|
11
12
|
const SOURCE_FILES = ['**/*.{ts,tsx,mts,cts}'];
|
|
12
|
-
const JSX_FILES = ['**/*.{jsx,tsx}'];
|
|
13
13
|
const TEST_FILES = ['**/__tests__/**', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'];
|
|
14
14
|
/**
|
|
15
15
|
* The house rules: at most 5 positional parameters on a function we write, and errors thrown through
|
|
@@ -45,14 +45,14 @@ exports.houseConfigs = [...eslint_1.namingConventionConfigs, ...houseRuleConfigs
|
|
|
45
45
|
*/
|
|
46
46
|
const reactRuleConfigs = [
|
|
47
47
|
{
|
|
48
|
-
files: JSX_FILES,
|
|
48
|
+
files: jsx_files_1.JSX_FILES,
|
|
49
49
|
plugins: { [common_1.HOUSE_PLUGIN_NAMESPACE]: plugin_1.houseEslintPlugin },
|
|
50
50
|
rules: { [no_leaked_render_rule_1.NoLeakedRenderRule.NAME]: no_leaked_render_rule_1.NoLeakedRenderRule.build() },
|
|
51
51
|
},
|
|
52
52
|
];
|
|
53
53
|
/** `houseConfigs` for a React project: `reactNamingConventionConfigs`, the house rules and `no-leaked-render`. */
|
|
54
54
|
exports.reactHouseConfigs = [
|
|
55
|
-
...
|
|
55
|
+
...react_eslint_1.reactNamingConventionConfigs,
|
|
56
56
|
...houseRuleConfigs,
|
|
57
57
|
...reactRuleConfigs,
|
|
58
58
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.js","sourceRoot":"","sources":["../../../src/linters/house/configs.ts"],"names":[],"mappings":";;;AACA,sCAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"configs.js","sourceRoot":"","sources":["../../../src/linters/house/configs.ts"],"names":[],"mappings":";;;AACA,sCAAoD;AACpD,4CAAyC;AACzC,kDAA+D;AAC/D,qCAAkD;AAClD,+DAAyD;AACzD,mEAA6D;AAC7D,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;;;GAGG;AACH,MAAM,gBAAgB,GAAoB;IACxC;QACE,KAAK,EAAE,qBAAS;QAChB,OAAO,EAAE,EAAE,CAAC,+BAAsB,CAAC,EAAE,0BAAiB,EAAE;QACxD,KAAK,EAAE,EAAE,CAAC,0CAAkB,CAAC,IAAI,CAAC,EAAE,0CAAkB,CAAC,KAAK,EAAE,EAAE;KACjE;CACF,CAAC;AAEF,kHAAkH;AACrG,QAAA,iBAAiB,GAAoB;IAChD,GAAG,2CAA4B;IAC/B,GAAG,gBAAgB;IACnB,GAAG,gBAAgB;CACpB,CAAC","sourcesContent":["import type { Linter } from 'eslint';\nimport { namingConventionConfigs } from '../eslint';\nimport { JSX_FILES } from '../jsx-files';\nimport { reactNamingConventionConfigs } from '../react-eslint';\nimport { HOUSE_PLUGIN_NAMESPACE } from './common';\nimport { MaxParamsOwnRule } from './max-params-own.rule';\nimport { NoLeakedRenderRule } from './no-leaked-render.rule';\nimport { NoNewErrorRule } from './no-new-error.rule';\nimport { houseEslintPlugin } from './plugin';\n\nconst SOURCE_FILES = ['**/*.{ts,tsx,mts,cts}'];\nconst TEST_FILES = ['**/__tests__/**', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'];\n\n/**\n * The house rules: at most 5 positional parameters on a function we write, and errors thrown through\n * `getError` only. Tests are exempt from `no-new-error`: a test throws a plain `Error` on purpose, to\n * stand in for what a driver or a third-party library throws.\n */\nconst houseRuleConfigs: Linter.Config[] = [\n {\n files: SOURCE_FILES,\n plugins: { [HOUSE_PLUGIN_NAMESPACE]: houseEslintPlugin },\n rules: {\n [MaxParamsOwnRule.NAME]: MaxParamsOwnRule.build(),\n [NoNewErrorRule.NAME]: NoNewErrorRule.build(),\n },\n },\n { files: TEST_FILES, rules: { [NoNewErrorRule.NAME]: 'off' } },\n];\n\n/**\n * The ESLint side of a project that lints with oxlint: the naming convention plus the house rules -\n * everything oxlint cannot express. Run it next to `oxlintConfigs`.\n *\n * ```js\n * // .configs/eslint.config.mjs\n * import { houseConfigs } from '@venizia/dev-configs/linters';\n *\n * export default houseConfigs;\n * ```\n */\nexport const houseConfigs: Linter.Config[] = [...namingConventionConfigs, ...houseRuleConfigs];\n\n/**\n * The React house rule: a JSX child is drawn with `cond ? <X /> : null`, never `cond && <X />`, which\n * draws `0` when `cond` is `0`.\n */\nconst reactRuleConfigs: Linter.Config[] = [\n {\n files: JSX_FILES,\n plugins: { [HOUSE_PLUGIN_NAMESPACE]: houseEslintPlugin },\n rules: { [NoLeakedRenderRule.NAME]: NoLeakedRenderRule.build() },\n },\n];\n\n/** `houseConfigs` for a React project: `reactNamingConventionConfigs`, the house rules and `no-leaked-render`. */\nexport const reactHouseConfigs: Linter.Config[] = [\n ...reactNamingConventionConfigs,\n ...houseRuleConfigs,\n ...reactRuleConfigs,\n];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const-class-values.rule.js","sourceRoot":"","sources":["../../../src/linters/house/const-class-values.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAqF;AAErF;;;;;GAKG;AACH,MAAa,oBAAoB;aACf,SAAI,GAAG,GAAG,+BAAsB,qBAAqB,CAAC;aAEtD,yBAAoB,GAAG,sCAAsC,CAAC;aAE9D,SAAI,GAAoB;QACtC,IAAI,EAAE;YACJ,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;YAC7E,QAAQ,EAAE;gBACR,UAAU,EACR,mGAAmG;aACtG;SACF;QACD,MAAM,EAAE,OAAO,CAAC,EAAE;YAChB,MAAM,OAAO,GAAY,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5C,MAAM,UAAU,GAAG,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC;YACpE,MAAM,WAAW,GAAG,IAAI,MAAM,CAC5B,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,oBAAoB,CAAC,oBAAoB,CACxF,CAAC;YAEF,MAAM,eAAe,GAAG,CAAC,MAAe,EAAE,EAAE,CAC1C,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAA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{ TRuleSeverity } from '../rules/common';\nimport { AstNodeTypes, HOUSE_PLUGIN_NAMESPACE, nodeType, readField } from './common';\n\n/**\n * `venizia/const-class-values`. An enumerable string is a const class plus `TConstValue<typeof X>`,\n * never an exported union of string literals. Only a type whose name ends like a logic value is\n * checked (`State`, `Status`, `Stage`, `Mode`, `Kind`, `Type` by default): any other string union may\n * be a plain parameter type.\n */\nexport class ConstClassValuesRule {\n static readonly NAME = `${HOUSE_PLUGIN_NAMESPACE}/const-class-values`;\n\n static readonly DEFAULT_NAME_PATTERN = '(State|Status|Stage|Mode|Kind|Type)$';\n\n static readonly RULE: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n schema: [{ type: 'object', properties: { namePattern: { type: 'string' } } }],\n messages: {\n constClass:\n 'An enumerable string is a const class plus TConstValue<typeof X>, not a union of string literals.',\n },\n },\n create: context => {\n const options: unknown = context.options[0];\n const configured = readField({ node: options, key: 'namePattern' });\n const namePattern = new RegExp(\n typeof configured === 'string' ? configured : ConstClassValuesRule.DEFAULT_NAME_PATTERN,\n );\n\n const isStringLiteral = (member: unknown) =>\n nodeType({ node: member }) === 'TSLiteralType' &&\n typeof readField({ node: readField({ node: member, key: 'literal' }), key: 'value' }) ===\n 'string';\n\n return {\n [`${AstNodeTypes.EXPORT_NAMED_DECLARATION} > TSTypeAliasDeclaration`]: (\n node: Rule.Node,\n ) => {\n const id = readField({ node, key: 'id' });\n const name = readField({ node: id, key: 'name' });\n const typeAnnotation = readField({ node, key: 'typeAnnotation' });\n const members = readField({ node: typeAnnotation, key: 'types' });\n\n if (\n typeof name === 'string' &&\n namePattern.test(name) &&\n nodeType({ node: typeAnnotation }) === 'TSUnionType' &&\n Array.isArray(members) &&\n members.every(isStringLiteral)\n ) {\n context.report({ node, messageId: 'constClass' });\n }\n },\n };\n },\n };\n\n static build(opts: { severity?: TRuleSeverity; namePattern?: string } = {}): Linter.RuleEntry {\n const { severity = 'error', namePattern = ConstClassValuesRule.DEFAULT_NAME_PATTERN } = opts;\n return [severity, { namePattern }];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/linters/house/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4DAA0C;AAC1C,wDAAsC;AACtC,0DAAwC;AACxC,sDAAoC;AACpC,2CAAyB;AACzB,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/linters/house/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4DAA0C;AAC1C,wDAAsC;AACtC,0DAAwC;AACxC,sDAAoC;AACpC,2CAAyB;AACzB,4CAA0B","sourcesContent":["export * from './common';\nexport * from './const-class-values.rule';\nexport * from './max-params-own.rule';\nexport * from './no-leaked-render.rule';\nexport * from './no-new-error.rule';\nexport * from './plugin';\nexport * from './configs';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-params-own.rule.js","sourceRoot":"","sources":["../../../src/linters/house/max-params-own.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAqF;AAErF,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,IAAsC,EAAE,EAAE,CACnE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5D,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,EAAE;IACnC,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAA,kBAAS,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,MAAM,GAAG,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAClD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;oBACnD,OAAO;gBACT,CAAC;gBAED,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,qBAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC1F,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,SAAS;oBACpB,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE;iBACzD,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,OAAO;gBACL,CAAC,qBAAY,CAAC,oBAAoB,CAAC,EAAE,KAAK;gBAC1C,CAAC,qBAAY,CAAC,mBAAmB,CAAC,EAAE,KAAK;gBACzC,CAAC,qBAAY,CAAC,yBAAyB,CAAC,EAAE,KAAK;aAChD,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,OAAmD,EAAE;QAChE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,GAAG,gBAAgB,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;QACxE,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;;AA7FH,4CA8FC","sourcesContent":["import type { Linter, Rule } from 'eslint';\nimport type { TRuleSeverity } from '../rules/common';\nimport { AstNodeTypes, HOUSE_PLUGIN_NAMESPACE, nodeType, readField } from './common';\n\nconst HOOK_NAME = /^use[A-Z]/;\nconst CALL_TYPES = new Set(['CallExpression', 'NewExpression']);\n\nconst isArrayContaining = (opts: { list: unknown; item: unknown }) =>\n Array.isArray(opts.list) && opts.list.includes(opts.item);\n\n/** `useX(...)`: a hook's callback is ours, so it counts. */\nconst isHookCall = (call: unknown) => {\n const callee = readField({ node: call, key: 'callee' });\n const name = readField({ node: callee, key: 'name' });\n return (\n nodeType({ node: callee }) === 'Identifier' && typeof name === 'string' && HOOK_NAME.test(name)\n );\n};\n\n/** `node` is an argument of a call or `new` that is not a hook. */\nconst isLibraryArgument = (opts: { node: unknown; parent: unknown }) =>\n CALL_TYPES.has(nodeType({ node: opts.parent }) ?? '') &&\n isArrayContaining({\n list: readField({ node: opts.parent, key: 'arguments' }),\n item: opts.node,\n }) &&\n !isHookCall(opts.parent);\n\n/**\n * An object literal whose shape something else declares: a typed variable, `satisfies`, or an argument\n * of a non-hook call (a library option bag). A nested literal inherits it.\n */\nconst hasDeclaredShape = (object: unknown): boolean => {\n let current = object;\n\n while (current) {\n const parent = readField({ node: current, key: 'parent' });\n const parentType = nodeType({ node: parent });\n const isTypedVariable =\n parentType === 'VariableDeclarator' &&\n Boolean(readField({ node: readField({ node: parent, key: 'id' }), key: 'typeAnnotation' }));\n\n if (\n isTypedVariable ||\n parentType === 'TSSatisfiesExpression' ||\n isLibraryArgument({ node: current, parent })\n ) {\n return true;\n }\n\n const isNestedValue =\n parentType === 'Property' && readField({ node: parent, key: 'value' }) === current;\n current = isNestedValue ? readField({ node: parent, key: 'parent' }) : undefined;\n }\n\n return false;\n};\n\n/**\n * `venizia/max-params-own`. A function we write takes at most `max` (default 5) positional parameters;\n * beyond that it takes one options object. A signature that belongs to someone else is not counted: an\n * inline callback handed to a call (map, reduce, sort, a library handler) or to a JSX prop, a function a\n * declared type fixes (`const x: TFn = (...)`, a member of a typed or `satisfies` object), and a\n * constructor whose every parameter is injected (`@inject`). A hook's callback (`useCallback(...)`) is ours.\n */\nexport class MaxParamsOwnRule {\n static readonly NAME = `${HOUSE_PLUGIN_NAMESPACE}/max-params-own`;\n\n static readonly DEFAULT_MAX = 5;\n\n static readonly RULE: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n schema: [{ type: 'integer', minimum: 0 }],\n messages: {\n tooMany:\n 'A function we write takes up to {{max}} positional parameters, not {{count}}: take one options object.',\n },\n },\n create: context => {\n const max =\n typeof context.options[0] === 'number' ? context.options[0] : MaxParamsOwnRule.DEFAULT_MAX;\n\n const isCallback = (node: Rule.Node) => {\n const parent = node.parent;\n const isJsxProp =\n nodeType({ node: parent }) === 'JSXExpressionContainer' &&\n nodeType({ node: readField({ node: parent, key: 'parent' }) }) === 'JSXAttribute';\n return isJsxProp || isLibraryArgument({ node, parent });\n };\n\n const isInjectedConstructor = (opts: { node: Rule.Node; params: unknown[] }) => {\n const parent = opts.node.parent;\n const isDecorated = (param: unknown) => {\n const own = readField({ node: param, key: 'decorators' });\n const property = readField({\n node: readField({ node: param, key: 'parameter' }),\n key: 'decorators',\n });\n return (\n (Array.isArray(own) && own.length > 0) ||\n (Array.isArray(property) && property.length > 0)\n );\n };\n\n return (\n nodeType({ node: parent }) === 'MethodDefinition' &&\n readField({ node: parent, key: 'kind' }) === 'constructor' &&\n opts.params.every(isDecorated)\n );\n };\n\n const isTypedByContext = (node: Rule.Node) => {\n const parent = node.parent;\n const parentType = nodeType({ node: parent });\n const isTypedInit =\n parentType === 'VariableDeclarator' &&\n readField({ node: parent, key: 'init' }) === node &&\n Boolean(\n readField({ node: readField({ node: parent, key: 'id' }), key: 'typeAnnotation' }),\n );\n const grandParent = readField({ node: parent, key: 'parent' });\n const isMember =\n parentType === 'Property' &&\n readField({ node: parent, key: 'value' }) === node &&\n nodeType({ node: grandParent }) === 'ObjectExpression';\n\n return isTypedInit || (isMember && hasDeclaredShape(grandParent));\n };\n\n const check = (node: Rule.Node) => {\n const params = readField({ node, key: 'params' });\n if (!Array.isArray(params) || params.length <= max) {\n return;\n }\n\n if (isCallback(node) || isInjectedConstructor({ node, params }) || isTypedByContext(node)) {\n return;\n }\n\n context.report({\n node,\n messageId: 'tooMany',\n data: { count: String(params.length), max: String(max) },\n });\n };\n\n return {\n [AstNodeTypes.FUNCTION_DECLARATION]: check,\n [AstNodeTypes.FUNCTION_EXPRESSION]: check,\n [AstNodeTypes.ARROW_FUNCTION_EXPRESSION]: check,\n };\n },\n };\n\n static build(opts: { severity?: TRuleSeverity; max?: number } = {}): Linter.RuleEntry {\n const { severity = 'error', max = MaxParamsOwnRule.DEFAULT_MAX } = opts;\n return [severity, max];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-leaked-render.rule.js","sourceRoot":"","sources":["../../../src/linters/house/no-leaked-render.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAkD;AAElD,4FAA4F;AAC5F,MAAM,sBAAsB,GAAG,CAAC,YAAY,EAAE,aAAa,CAAC;KACzD,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,8DAA8D,CAAC;KACtF,IAAI,CAAC,IAAI,CAAC,CAAC;AAEd;;;;GAIG;AACH,MAAa,kBAAkB;aACb,SAAI,GAAG,GAAG,+BAAsB,mBAAmB,CAAC;aAEpD,SAAI,GAAoB;QACtC,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE;gBACR,MAAM,EAAE,uEAAuE;aAChF;SACF;QACD,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;YAClB,CAAC,sBAAsB,CAAC,EAAE,CAAC,IAAe,EAAE,EAAE;gBAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;oBACtC,OAAO;gBACT,CAAC;gBAED,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;gBAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;gBAChF,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AAsB,CAAC,EAAE,CAAC,IAAe,EAAE,EAAE;gBAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;oBACtC,OAAO;gBACT,CAAC;gBAED,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;gBAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;gBAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,OAAO;gBACT,CAAC;gBAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBAC3E,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,QAAQ;oBACnB,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;iBACxF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,OAAqC,EAAE;QAClD,OAAO,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;IAClC,CAAC;;AApCH,gDAqCC","sourcesContent":["import type { Rule } from 'eslint';\nimport type { TRuleSeverity } from '../rules/common';\nimport { HOUSE_PLUGIN_NAMESPACE } from './common';\n\n/** `&&` directly under a JSX child: `disabled={a && b}` is a value, not something drawn. */\nconst LEAKED_RENDER_SELECTOR = ['JSXElement', 'JSXFragment']\n .map(parent => `${parent} > JSXExpressionContainer > LogicalExpression[operator='&&']`)\n .join(', ');\n\n/**\n * `venizia/no-leaked-render`. `{count && <X />}` draws `0` when `count` is `0`; draw nothing with\n * `cond ? <X /> : null`. Only a child of JSX is checked. The fix rewrites it to the ternary and keeps\n * any comment between `&&` and the drawn part.\n */\nexport class NoLeakedRenderRule {\n static readonly NAME = `${HOUSE_PLUGIN_NAMESPACE}/no-leaked-render`;\n\n static readonly RULE: Rule.RuleModule = {\n meta: {\n type: 'problem',\n fixable: 'code',\n schema: [],\n messages: {\n leaked: 'Draw nothing with `cond ? <X /> : null`; `&&` draws 0 when cond is 0.',\n },\n },\n create: context => ({\n [LEAKED_RENDER_SELECTOR]: (node: Rule.Node) => {\n if (node.type !== 'LogicalExpression') {\n return;\n }\n\n const source = context.sourceCode;\n const operator = source.getTokenAfter(node.left, token => token.value === '&&');\n if (!operator) {\n return;\n }\n\n const drawn = source.text.slice(operator.range[1], node.range?.[1]).trim();\n context.report({\n node,\n messageId: 'leaked',\n fix: fixer => fixer.replaceText(node, `${source.getText(node.left)} ? ${drawn} : null`),\n });\n },\n }),\n };\n\n static build(opts: { severity?: TRuleSeverity } = {}): TRuleSeverity {\n return opts.severity ?? 'error';\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-new-error.rule.js","sourceRoot":"","sources":["../../../src/linters/house/no-new-error.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAqF;AAErF;;;;GAIG;AACH,MAAa,cAAc;aACT,SAAI,GAAG,GAAG,+BAAsB,eAAe,CAAC;aAEhD,SAAI,GAAoB;QACtC,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE;gBACR,QAAQ,EACN,2IAA2I;aAC9I;SACF;QACD,MAAM,EAAE,OAAO,CAAC,EAAE;YAChB,MAAM,MAAM,GAAG,CAAC,IAAuC,EAAE,EAAE,CACzD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,EAA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CAAC,KAAK,CAAC,OAAqC,EAAE;QAClD,OAAO,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;IAClC,CAAC;;AArCH,wCAsCC","sourcesContent":["import type { Rule } from 'eslint';\nimport type { TRuleSeverity } from '../rules/common';\nimport { AstNodeTypes, HOUSE_PLUGIN_NAMESPACE, nodeType, readField } from './common';\n\n/**\n * `venizia/no-new-error`. An error is thrown through `getError({ message })` (or an `ApplicationError`),\n * never `new Error(...)` or `Error(...)`: only an ApplicationError carries the status, the message code and\n * args, and the `extra` every IGNIS layer reads.\n */\nexport class NoNewErrorRule {\n static readonly NAME = `${HOUSE_PLUGIN_NAMESPACE}/no-new-error`;\n\n static readonly RULE: Rule.RuleModule = {\n meta: {\n type: 'problem',\n schema: [],\n messages: {\n newError:\n 'Throw through getError({ message }) (or an ApplicationError), not `{{form}}`: only an ApplicationError carries the status, code and args.',\n },\n },\n create: context => {\n const report = (opts: { node: Rule.Node; form: string }) =>\n context.report({ node: opts.node, messageId: 'newError', data: { form: opts.form } });\n\n const isErrorIdentifier = (callee: unknown) =>\n nodeType({ node: callee }) === 'Identifier' &&\n readField({ node: callee, key: 'name' }) === 'Error';\n\n return {\n [AstNodeTypes.NEW_EXPRESSION]: (node: Rule.Node) => {\n if (isErrorIdentifier(readField({ node, key: 'callee' }))) {\n report({ node, form: 'new Error(...)' });\n }\n },\n [AstNodeTypes.CALL_EXPRESSION]: (node: Rule.Node) => {\n if (isErrorIdentifier(readField({ node, key: 'callee' }))) {\n report({ node, form: 'Error(...)' });\n }\n },\n };\n },\n };\n\n static build(opts: { severity?: TRuleSeverity } = {}): TRuleSeverity {\n return opts.severity ?? 'error';\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/linters/house/plugin.ts"],"names":[],"mappings":";;;AACA,qCAAkD;AAClD,uEAAiE;AACjE,+DAAyD;AACzD,mEAA6D;AAC7D,2DAAqD;AAErD,qGAAqG;AACxF,QAAA,iBAAiB,GAAkB;IAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,+BAAsB,EAAE,EAAE;IACzD,KAAK,EAAE;QACL,oBAAoB,EAAE,8CAAoB,CAAC,IAAI;QAC/C,gBAAgB,EAAE,sCAAgB,CAAC,IAAI;QACvC,kBAAkB,EAAE,0CAAkB,CAAC,IAAI;QAC3C,cAAc,EAAE,kCAAc,CAAC,IAAI;KACpC;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/linters/house/plugin.ts"],"names":[],"mappings":";;;AACA,qCAAkD;AAClD,uEAAiE;AACjE,+DAAyD;AACzD,mEAA6D;AAC7D,2DAAqD;AAErD,qGAAqG;AACxF,QAAA,iBAAiB,GAAkB;IAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,+BAAsB,EAAE,EAAE;IACzD,KAAK,EAAE;QACL,oBAAoB,EAAE,8CAAoB,CAAC,IAAI;QAC/C,gBAAgB,EAAE,sCAAgB,CAAC,IAAI;QACvC,kBAAkB,EAAE,0CAAkB,CAAC,IAAI;QAC3C,cAAc,EAAE,kCAAc,CAAC,IAAI;KACpC;CACF,CAAC","sourcesContent":["import type { ESLint } from 'eslint';\nimport { HOUSE_PLUGIN_NAMESPACE } from './common';\nimport { ConstClassValuesRule } from './const-class-values.rule';\nimport { MaxParamsOwnRule } from './max-params-own.rule';\nimport { NoLeakedRenderRule } from './no-leaked-render.rule';\nimport { NoNewErrorRule } from './no-new-error.rule';\n\n/** The ESLint plugin that carries the house rules oxlint cannot express, registered as `venizia`. */\nexport const houseEslintPlugin: ESLint.Plugin = {\n meta: { name: `eslint-plugin-${HOUSE_PLUGIN_NAMESPACE}` },\n rules: {\n 'const-class-values': ConstClassValuesRule.RULE,\n 'max-params-own': MaxParamsOwnRule.RULE,\n 'no-leaked-render': NoLeakedRenderRule.RULE,\n 'no-new-error': NoNewErrorRule.RULE,\n },\n};\n"]}
|
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AG,MAAM;YACT,SAAS,EAAE;gBACT,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;gBAC3B;oBACE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC9D,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;iBACjE;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAjCD,gCAiCC","sourcesContent":["import type { Linter } from 'eslint';\nimport type { OxlintConfig } from 'oxlint';\n\n/**\n * Project paths a lint run skips: generated files, vendored code, bundles. The same list feeds both\n * tools, because each reads it differently.\n *\n * - oxlint: `ignorePatterns` resolve against the folder of the config file, so one in `.configs/` can\n * never name a project path. `LintIgnore.oxlint` turns every rule off for the paths instead.\n * - ESLint: `LintIgnore.eslint` is a flat-config `ignores` entry, relative to where eslint runs.\n *\n * ```ts\n * const LINT_IGNORE = ['src/components/shadcn/**', 'dev-dist/**'];\n * defineConfig(ReactOxlintConfigs.create({ ignore: LINT_IGNORE })); // oxlint.config.mts\n * export default [LintIgnore.eslint({ patterns: LINT_IGNORE }), ...reactHouseConfigs]; // eslint.config.mjs\n * ```\n */\nexport class LintIgnore {\n /** A project path such as `src/gen/**`, as an override glob: it is matched from anywhere under the project. */\n static toGlob(opts: { pattern: string }): string {\n const pattern = opts.pattern.replace(/^\\.?\\//, '');\n return pattern.startsWith('**/') ? pattern : `**/${pattern}`;\n }\n\n static eslint(opts: { patterns: string[] }): Linter.Config {\n return { ignores: opts.patterns };\n }\n\n static oxlint(opts: { config: OxlintConfig; patterns: string[] }): OxlintConfig {\n const { config, patterns } = opts;\n if (patterns.length === 0) {\n return config;\n }\n\n const rules = new Set([\n ...Object.keys(config.rules ?? {}),\n ...(config.overrides ?? []).flatMap(override => Object.keys(override.rules ?? {})),\n ]);\n\n return {\n ...config,\n overrides: [\n ...(config.overrides ?? []),\n {\n files: patterns.map(pattern => LintIgnore.toGlob({ pattern })),\n rules: Object.fromEntries([...rules].map(name => [name, 'off'])),\n },\n ],\n };\n }\n}\n"]}
|
package/dist/linters/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export * from './browser';
|
|
2
1
|
export * from './eslint';
|
|
3
2
|
export * from './house';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './react';
|
|
7
|
-
export * from './rules';
|
|
3
|
+
export * from './oxlint-presets';
|
|
4
|
+
export * from './react-eslint';
|
|
8
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
package/dist/linters/index.js
CHANGED
|
@@ -14,11 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./browser"), exports);
|
|
18
17
|
__exportStar(require("./eslint"), exports);
|
|
19
18
|
__exportStar(require("./house"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./react"), exports);
|
|
23
|
-
__exportStar(require("./rules"), exports);
|
|
19
|
+
__exportStar(require("./oxlint-presets"), exports);
|
|
20
|
+
__exportStar(require("./react-eslint"), exports);
|
|
24
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,mDAAiC;AACjC,iDAA+B","sourcesContent":["export * from './eslint';\nexport * from './house';\nexport * from './oxlint-presets';\nexport * from './react-eslint';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-files.d.ts","sourceRoot":"","sources":["../../src/linters/jsx-files.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,eAAO,MAAM,SAAS,UAA2B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSX_FILES = void 0;
|
|
4
|
+
/** The files that can hold JSX. Shared by the oxlint and ESLint presets, so it imports neither tool. */
|
|
5
|
+
exports.JSX_FILES = ['**/*.jsx', '**/*.tsx'];
|
|
6
|
+
//# sourceMappingURL=jsx-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-files.js","sourceRoot":"","sources":["../../src/linters/jsx-files.ts"],"names":[],"mappings":";;;AAAA,wGAAwG;AAC3F,QAAA,SAAS,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC","sourcesContent":["/** The files that can hold JSX. Shared by the oxlint and ESLint presets, so it imports neither tool. */\nexport const JSX_FILES = ['**/*.jsx', '**/*.tsx'];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxlint-presets.d.ts","sourceRoot":"","sources":["../../src/linters/oxlint-presets.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
exports.ReactOxlintConfigs = void 0;
|
|
18
|
+
// The entry of `@venizia/dev-configs/linters/oxlint`: everything an oxlint config needs and nothing that
|
|
19
|
+
// imports ESLint at runtime, so evaluating the config does not load `eslint` or `typescript-eslint`.
|
|
20
|
+
// The rule classes import ESLint types only, which the build erases.
|
|
21
|
+
__exportStar(require("./browser"), exports);
|
|
22
|
+
__exportStar(require("./ignore"), exports);
|
|
23
|
+
__exportStar(require("./oxlint"), exports);
|
|
24
|
+
var react_oxlint_1 = require("./react-oxlint");
|
|
25
|
+
Object.defineProperty(exports, "ReactOxlintConfigs", { enumerable: true, get: function () { return react_oxlint_1.ReactOxlintConfigs; } });
|
|
26
|
+
__exportStar(require("./rules"), exports);
|
|
27
|
+
//# sourceMappingURL=oxlint-presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oxlint-presets.js","sourceRoot":"","sources":["../../src/linters/oxlint-presets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yGAAyG;AACzG,qGAAqG;AACrG,qEAAqE;AACrE,4CAA0B;AAC1B,2CAAyB;AACzB,2CAAyB;AACzB,+CAAoD;AAA3C,kHAAA,kBAAkB,OAAA;AAC3B,0CAAwB","sourcesContent":["// The entry of `@venizia/dev-configs/linters/oxlint`: everything an oxlint config needs and nothing that\n// imports ESLint at runtime, so evaluating the config does not load `eslint` or `typescript-eslint`.\n// The rule classes import ESLint types only, which the build erases.\nexport * from './browser';\nexport * from './ignore';\nexport * from './oxlint';\nexport { ReactOxlintConfigs } from './react-oxlint';\nexport * from './rules';\n"]}
|
package/dist/linters/oxlint.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { OxlintConfig } from 'oxlint';
|
|
|
10
10
|
* ```ts
|
|
11
11
|
* // .configs/oxlint.config.mts
|
|
12
12
|
* import { defineConfig } from 'oxlint';
|
|
13
|
-
* import { oxlintConfigs } from '@venizia/dev-configs/linters';
|
|
13
|
+
* import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
14
14
|
*
|
|
15
15
|
* export default defineConfig(oxlintConfigs);
|
|
16
16
|
* ```
|
|
@@ -39,7 +39,7 @@ export interface IOxlintPresetOptions {
|
|
|
39
39
|
* ```ts
|
|
40
40
|
* // .configs/oxlint.config.mts
|
|
41
41
|
* import { defineConfig } from 'oxlint';
|
|
42
|
-
* import { OxlintConfigs } from '@venizia/dev-configs/linters';
|
|
42
|
+
* import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
43
43
|
*
|
|
44
44
|
* export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
|
|
45
45
|
* ```
|
package/dist/linters/oxlint.js
CHANGED
|
@@ -17,7 +17,7 @@ const JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES]
|
|
|
17
17
|
* ```ts
|
|
18
18
|
* // .configs/oxlint.config.mts
|
|
19
19
|
* import { defineConfig } from 'oxlint';
|
|
20
|
-
* import { oxlintConfigs } from '@venizia/dev-configs/linters';
|
|
20
|
+
* import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
21
21
|
*
|
|
22
22
|
* export default defineConfig(oxlintConfigs);
|
|
23
23
|
* ```
|
|
@@ -184,7 +184,7 @@ exports.oxlintConfigs = {
|
|
|
184
184
|
* ```ts
|
|
185
185
|
* // .configs/oxlint.config.mts
|
|
186
186
|
* import { defineConfig } from 'oxlint';
|
|
187
|
-
* import { OxlintConfigs } from '@venizia/dev-configs/linters';
|
|
187
|
+
* import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
188
188
|
*
|
|
189
189
|
* export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
|
|
190
190
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":";;;AACA,qCAAsC;AACtC,mCAMiB;AAEjB,0CAA0C;AAC1C,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,aAAa,GAAiB;IACzC,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;IAClC,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IAClC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtB,c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AC,OAAO,EAAE,KAAK,CAAC;gBACvB,CAAC,+BAAuB,CAAC,IAAI,CAAC,EAAE,+BAAuB,CAAC,KAAK,EAAE;gBAC/D,oCAAoC,EAAE,KAAK;gBAC3C,0BAA0B,EAAE,KAAK;gBACjC,iCAAiC,EAAE,KAAK;aACzC;SACF;KACF;CACF,CAAC;AAiBF;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IACxB,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,MAAM,MAAM,GAAiB,IAAI,CAAC,eAAe;YAC/C,CAAC,CAAC;gBACE,GAAG,qBAAa;gBAChB,KAAK,EAAE;oBACL,GAAG,qBAAa,CAAC,KAAK;oBACtB,CAAC,mCAA2B,CAAC,IAAI,CAAC,EAAE,mCAA2B,CAAC,KAAK,CAAC;wBACpE,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;qBACjD,CAAC;iBACH;aACF;YACH,CAAC,CAAC,qBAAa,CAAC;QAElB,OAAO,mBAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAhBD,sCAgBC","sourcesContent":["import type { OxlintConfig } from 'oxlint';\nimport { LintIgnore } from './ignore';\nimport {\n EqeqeqRule,\n NoRestrictedImportsRule,\n NoUnusedVarsRule,\n PreferNullishCoalescingRule,\n SwitchCaseBracesRule,\n} from './rules';\n\n/** File globs the rules are scoped to. */\nconst TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];\nconst JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES];\n\n/**\n * The oxlint port of `eslintConfigs`, generated with `@oxlint/migrate` and kept rule for rule.\n * Type-aware rules (`no-floating-promises`, `return-await`, ...) need `oxlint-tsgolint` installed.\n *\n * Not ported: `@typescript-eslint/naming-convention` (oxlint has no equivalent yet - keep it in\n * ESLint), `@typescript-eslint/prefer-optional-chain` (oxlint nursery), `no-invalid-this` (covered\n * by `noImplicitThis` in `tsconfig.base.json`). `n/prefer-node-protocol` maps to the unicorn rule.\n *\n * ```ts\n * // .configs/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(oxlintConfigs);\n * ```\n *\n * `OxlintConfigs.create({ lenientFallback: true })` is the same preset with `||` allowed on string\n * and number operands.\n */\nexport const oxlintConfigs: OxlintConfig = {\n plugins: ['typescript', 'unicorn'],\n categories: { correctness: 'off' },\n options: { typeAware: true },\n env: { builtin: true },\n ignorePatterns: ['**/node_modules/', '**/*.d.ts', '**/build/', '**/dist/', '**/release/'],\n rules: {\n // eslint:recommended\n 'constructor-super': 'error',\n 'for-direction': 'error',\n 'getter-return': 'error',\n 'no-async-promise-executor': 'error',\n 'no-case-declarations': 'error',\n 'no-class-assign': 'error',\n 'no-compare-neg-zero': 'error',\n 'no-cond-assign': 'error',\n 'no-const-assign': 'error',\n 'no-constant-binary-expression': 'error',\n 'no-constant-condition': 'error',\n 'no-control-regex': 'error',\n 'no-debugger': 'error',\n 'no-delete-var': 'error',\n 'no-dupe-else-if': 'error',\n 'no-dupe-keys': 'error',\n 'no-duplicate-case': 'error',\n 'no-empty': 'error',\n 'no-empty-character-class': 'error',\n 'no-empty-pattern': 'error',\n 'no-empty-static-block': 'error',\n 'no-ex-assign': 'error',\n 'no-extra-boolean-cast': 'error',\n 'no-fallthrough': 'error',\n 'no-func-assign': 'error',\n 'no-global-assign': 'error',\n 'no-import-assign': 'error',\n 'no-invalid-regexp': 'error',\n 'no-irregular-whitespace': 'error',\n 'no-loss-of-precision': 'error',\n 'no-misleading-character-class': 'error',\n 'no-new-native-nonconstructor': 'error',\n 'no-nonoctal-decimal-escape': 'error',\n 'no-obj-calls': 'error',\n 'no-prototype-builtins': 'error',\n 'no-regex-spaces': 'error',\n 'no-self-assign': 'error',\n 'no-setter-return': 'error',\n 'no-shadow-restricted-names': 'error',\n 'no-sparse-arrays': 'error',\n 'no-this-before-super': 'error',\n 'no-unassigned-vars': 'error',\n 'no-unreachable': 'error',\n 'no-unsafe-finally': 'error',\n 'no-unsafe-negation': 'error',\n 'no-unsafe-optional-chaining': 'error',\n 'no-unused-labels': 'error',\n 'no-unused-private-class-members': 'error',\n 'no-useless-backreference': 'error',\n 'no-useless-catch': 'error',\n 'no-with': 'error',\n 'preserve-caught-error': 'error',\n 'require-yield': 'error',\n 'use-isnan': 'error',\n 'valid-typeof': 'error',\n 'no-array-constructor': 'error',\n\n // Strict rules on top\n [NoUnusedVarsRule.NAME]: NoUnusedVarsRule.build(),\n 'no-useless-escape': 'warn',\n 'no-unused-expressions': 'error',\n 'no-new-wrappers': 'error',\n 'no-throw-literal': 'error',\n [EqeqeqRule.NAME]: EqeqeqRule.build(),\n 'no-void': 'error',\n 'no-caller': 'error',\n 'no-shadow': 'error',\n 'no-use-before-define': 'error',\n [SwitchCaseBracesRule.NAME]: SwitchCaseBracesRule.build(),\n 'unicorn/prefer-node-protocol': 'error',\n\n // typescript-eslint\n 'typescript/ban-ts-comment': 'error',\n 'typescript/no-duplicate-enum-values': 'error',\n 'typescript/no-empty-object-type': 'error',\n 'typescript/no-extra-non-null-assertion': 'error',\n 'typescript/no-misused-new': 'error',\n 'typescript/no-namespace': 'error',\n 'typescript/no-non-null-asserted-optional-chain': 'error',\n 'typescript/no-this-alias': 'error',\n 'typescript/no-unnecessary-type-constraint': 'error',\n 'typescript/no-unsafe-declaration-merging': 'error',\n 'typescript/no-unsafe-function-type': 'error',\n 'typescript/no-wrapper-object-types': 'error',\n 'typescript/prefer-as-const': 'error',\n 'typescript/prefer-namespace-keyword': 'error',\n 'typescript/triple-slash-reference': 'error',\n 'typescript/adjacent-overload-signatures': 'error',\n 'typescript/prefer-for-of': 'error',\n 'typescript/unified-signatures': 'error',\n\n // typescript-eslint, type-aware\n 'typescript/await-thenable': 'error',\n 'typescript/no-floating-promises': 'error',\n [PreferNullishCoalescingRule.NAME]: PreferNullishCoalescingRule.build(),\n 'typescript/return-await': 'error',\n },\n overrides: [\n {\n // TypeScript itself reports these.\n files: TS_FILES,\n rules: {\n 'constructor-super': 'off',\n 'getter-return': 'off',\n 'no-class-assign': 'off',\n 'no-const-assign': 'off',\n 'no-dupe-keys': 'off',\n 'no-func-assign': 'off',\n 'no-import-assign': 'off',\n 'no-new-native-nonconstructor': 'off',\n 'no-obj-calls': 'off',\n 'no-setter-return': 'off',\n 'no-this-before-super': 'off',\n 'no-unreachable': 'off',\n 'no-unsafe-negation': 'off',\n 'no-with': 'off',\n 'no-var': 'error',\n 'prefer-const': 'error',\n 'prefer-rest-params': 'error',\n 'prefer-spread': 'error',\n // A value import of a type becomes a runtime import when Bun runs a decorated class's source\n // (emitDecoratorMetadata) and fails with `Export named 'X' not found`. `import('pkg').T` type\n // annotations stay allowed: they are type-only by construction, and type an optional peer.\n 'typescript/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n fixStyle: 'inline-type-imports',\n disallowTypeAnnotations: false,\n },\n ],\n },\n },\n {\n files: JS_TS_FILES,\n rules: {\n 'no-constant-condition': 'off',\n 'prefer-const': 'error',\n 'no-var': 'error',\n curly: ['error', 'all'],\n [NoRestrictedImportsRule.NAME]: NoRestrictedImportsRule.build(),\n 'typescript/no-unsafe-function-type': 'off',\n 'typescript/no-this-alias': 'off',\n 'typescript/no-empty-object-type': 'off',\n },\n },\n ],\n};\n\nexport interface IOxlintPresetOptions {\n /**\n * Allow `||` / `||=` where the left side is a string or a number, so `name || 'guest'` and\n * `limit || 20` pass: `''` and `0` fall back on purpose. Off by default - the base catches a real\n * `''` or `0` swallowed by `||`.\n */\n lenientFallback?: boolean;\n /**\n * Project paths to skip - generated files, vendored code - as in `--ignore-pattern`: `src/gen/**`.\n * Every rule is turned off for them (oxlint cannot ignore a project path from `.configs/`).\n * Share the list with ESLint through `LintIgnore`.\n */\n ignore?: string[];\n}\n\n/**\n * Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.\n *\n * ```ts\n * // .configs/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));\n * ```\n */\nexport class OxlintConfigs {\n static create(opts: IOxlintPresetOptions = {}): OxlintConfig {\n const config: OxlintConfig = opts.lenientFallback\n ? {\n ...oxlintConfigs,\n rules: {\n ...oxlintConfigs.rules,\n [PreferNullishCoalescingRule.NAME]: PreferNullishCoalescingRule.build({\n ignorePrimitives: { string: true, number: true },\n }),\n },\n }\n : oxlintConfigs;\n\n return LintIgnore.oxlint({ config, patterns: opts.ignore ?? [] });\n }\n}\n"]}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ESLint, Linter } from 'eslint';
|
|
2
|
-
import type { OxlintConfig } from 'oxlint';
|
|
3
|
-
import type { IOxlintPresetOptions } from './oxlint';
|
|
4
2
|
/** Without `configs`: each plugin types its presets its own way, and only the rules are used here. */
|
|
5
3
|
type TRulesPlugin = Omit<ESLint.Plugin, 'configs'>;
|
|
6
4
|
export interface IReactEslintPlugins {
|
|
@@ -31,30 +29,10 @@ export declare class ReactEslintConfigs {
|
|
|
31
29
|
reactVersion?: string;
|
|
32
30
|
}): Linter.Config[];
|
|
33
31
|
}
|
|
34
|
-
/**
|
|
35
|
-
* The oxlint counterpart of `ReactEslintConfigs`: `BrowserOxlintConfigs` (the base rules plus the
|
|
36
|
-
* secure-context ban) plus the React, hooks and accessibility rules and `consistent-type-imports`.
|
|
37
|
-
* oxlint runs these plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
38
|
-
* port and is left out.
|
|
39
|
-
*
|
|
40
|
-
* Nothing in the base is relaxed - frontend code meets the backend's standard - and
|
|
41
|
-
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
42
|
-
*
|
|
43
|
-
* ```ts
|
|
44
|
-
* // .configs/oxlint.config.mts
|
|
45
|
-
* import { defineConfig } from 'oxlint';
|
|
46
|
-
* import { ReactOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
47
|
-
*
|
|
48
|
-
* export default defineConfig(ReactOxlintConfigs.create());
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export declare class ReactOxlintConfigs {
|
|
52
|
-
static create(opts?: IOxlintPresetOptions): OxlintConfig;
|
|
53
|
-
}
|
|
54
32
|
/**
|
|
55
33
|
* `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and
|
|
56
34
|
* .tsx files, where a component is declared as `function App()`.
|
|
57
35
|
*/
|
|
58
36
|
export declare const reactNamingConventionConfigs: Linter.Config[];
|
|
59
37
|
export {};
|
|
60
|
-
//# sourceMappingURL=react.d.ts.map
|
|
38
|
+
//# sourceMappingURL=react-eslint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-eslint.d.ts","sourceRoot":"","sources":["../../src/linters/react-eslint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAM7C,sGAAsG;AACtG,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE;CA2E9F;AAKD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAYvD,CAAC"}
|
|
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.reactNamingConventionConfigs = exports.
|
|
6
|
+
exports.reactNamingConventionConfigs = exports.ReactEslintConfigs = void 0;
|
|
7
7
|
const typescript_eslint_1 = __importDefault(require("typescript-eslint"));
|
|
8
|
-
const browser_1 = require("./browser");
|
|
9
|
-
const ignore_1 = require("./ignore");
|
|
10
8
|
const eslint_1 = require("./eslint");
|
|
9
|
+
const jsx_files_1 = require("./jsx-files");
|
|
11
10
|
const rules_1 = require("./rules");
|
|
12
11
|
/**
|
|
13
12
|
* The base preset plus what a React frontend needs on top: the React, hooks and accessibility rules.
|
|
@@ -33,7 +32,7 @@ class ReactEslintConfigs {
|
|
|
33
32
|
return [
|
|
34
33
|
...eslint_1.eslintConfigs,
|
|
35
34
|
{
|
|
36
|
-
files:
|
|
35
|
+
files: jsx_files_1.JSX_FILES,
|
|
37
36
|
plugins: { react, 'jsx-a11y': jsxA11y },
|
|
38
37
|
settings: { react: { version: reactVersion } },
|
|
39
38
|
rules: {
|
|
@@ -101,91 +100,8 @@ class ReactEslintConfigs {
|
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
exports.ReactEslintConfigs = ReactEslintConfigs;
|
|
104
|
-
const JSX_FILES = ['**/*.jsx', '**/*.tsx'];
|
|
105
|
-
const SOURCE_FILES = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
|
|
106
103
|
/** A component is declared as `function App()`, so functions may be PascalCase too. */
|
|
107
104
|
const COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase', 'PascalCase'] };
|
|
108
|
-
/**
|
|
109
|
-
* The oxlint counterpart of `ReactEslintConfigs`: `BrowserOxlintConfigs` (the base rules plus the
|
|
110
|
-
* secure-context ban) plus the React, hooks and accessibility rules and `consistent-type-imports`.
|
|
111
|
-
* oxlint runs these plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
112
|
-
* port and is left out.
|
|
113
|
-
*
|
|
114
|
-
* Nothing in the base is relaxed - frontend code meets the backend's standard - and
|
|
115
|
-
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
116
|
-
*
|
|
117
|
-
* ```ts
|
|
118
|
-
* // .configs/oxlint.config.mts
|
|
119
|
-
* import { defineConfig } from 'oxlint';
|
|
120
|
-
* import { ReactOxlintConfigs } from '@venizia/dev-configs/linters';
|
|
121
|
-
*
|
|
122
|
-
* export default defineConfig(ReactOxlintConfigs.create());
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
class ReactOxlintConfigs {
|
|
126
|
-
static create(opts = {}) {
|
|
127
|
-
const browserConfigs = browser_1.BrowserOxlintConfigs.create({ lenientFallback: opts.lenientFallback });
|
|
128
|
-
const config = {
|
|
129
|
-
...browserConfigs,
|
|
130
|
-
plugins: [...new Set([...(browserConfigs.plugins ?? []), 'react', 'jsx-a11y'])],
|
|
131
|
-
overrides: [
|
|
132
|
-
...(browserConfigs.overrides ?? []),
|
|
133
|
-
{
|
|
134
|
-
files: JSX_FILES,
|
|
135
|
-
rules: {
|
|
136
|
-
// Correctness rules from react's recommended set, as in ReactEslintConfigs.
|
|
137
|
-
'react/display-name': 'error',
|
|
138
|
-
'react/jsx-boolean-value': 'error',
|
|
139
|
-
'react/jsx-key': 'error',
|
|
140
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
141
|
-
'react/jsx-no-target-blank': 'error',
|
|
142
|
-
'react/no-children-prop': 'error',
|
|
143
|
-
'react/no-danger-with-children': 'error',
|
|
144
|
-
'react/no-direct-mutation-state': 'error',
|
|
145
|
-
'react/no-find-dom-node': 'error',
|
|
146
|
-
'react/no-is-mounted': 'error',
|
|
147
|
-
'react/no-render-return-value': 'error',
|
|
148
|
-
'react/no-string-refs': 'error',
|
|
149
|
-
'react/require-render-return': 'error',
|
|
150
|
-
'jsx-a11y/alt-text': 'error',
|
|
151
|
-
'jsx-a11y/anchor-has-content': 'error',
|
|
152
|
-
'jsx-a11y/aria-props': 'error',
|
|
153
|
-
'jsx-a11y/aria-proptypes': 'error',
|
|
154
|
-
'jsx-a11y/aria-role': 'error',
|
|
155
|
-
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
156
|
-
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
157
|
-
'jsx-a11y/role-supports-aria-props': 'error',
|
|
158
|
-
'jsx-a11y/tabindex-no-positive': 'error',
|
|
159
|
-
'jsx-a11y/anchor-is-valid': 'error',
|
|
160
|
-
'jsx-a11y/click-events-have-key-events': 'error',
|
|
161
|
-
'jsx-a11y/heading-has-content': 'error',
|
|
162
|
-
'jsx-a11y/label-has-associated-control': 'error',
|
|
163
|
-
'jsx-a11y/no-noninteractive-element-interactions': 'error',
|
|
164
|
-
'jsx-a11y/no-static-element-interactions': 'error',
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
// Custom hooks live in .ts files too.
|
|
169
|
-
files: SOURCE_FILES,
|
|
170
|
-
rules: {
|
|
171
|
-
'react/rules-of-hooks': 'error',
|
|
172
|
-
'react/exhaustive-deps': 'error',
|
|
173
|
-
'typescript/consistent-type-imports': [
|
|
174
|
-
'error',
|
|
175
|
-
{
|
|
176
|
-
prefer: 'type-imports',
|
|
177
|
-
fixStyle: 'inline-type-imports',
|
|
178
|
-
disallowTypeAnnotations: false,
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
};
|
|
185
|
-
return ignore_1.LintIgnore.oxlint({ config, patterns: opts.ignore ?? [] });
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
exports.ReactOxlintConfigs = ReactOxlintConfigs;
|
|
189
105
|
/**
|
|
190
106
|
* `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and
|
|
191
107
|
* .tsx files, where a component is declared as `function App()`.
|
|
@@ -193,7 +109,7 @@ exports.ReactOxlintConfigs = ReactOxlintConfigs;
|
|
|
193
109
|
exports.reactNamingConventionConfigs = [
|
|
194
110
|
...eslint_1.namingConventionConfigs,
|
|
195
111
|
{
|
|
196
|
-
files: JSX_FILES,
|
|
112
|
+
files: jsx_files_1.JSX_FILES,
|
|
197
113
|
languageOptions: { parser: typescript_eslint_1.default.parser },
|
|
198
114
|
plugins: { '@typescript-eslint': typescript_eslint_1.default.plugin },
|
|
199
115
|
rules: {
|
|
@@ -203,4 +119,4 @@ exports.reactNamingConventionConfigs = [
|
|
|
203
119
|
},
|
|
204
120
|
},
|
|
205
121
|
];
|
|
206
|
-
//# sourceMappingURL=react.js.map
|
|
122
|
+
//# sourceMappingURL=react-eslint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-eslint.js","sourceRoot":"","sources":["../../src/linters/react-eslint.ts"],"names":[],"mappings":";;;;;;AACA,0EAAyC;AACzC,qCAAkE;AAClE,2CAAwC;AACxC,mCAA2E;AAW3E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAA6D;QACzE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACpD,MAAM,EAAE,YAAY,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEzC,OAAO;YACL,GAAG,sBAAa;YAChB;gBACE,KAAK,EAAE,qBAAS;gBAChB,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE;gBACvC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;gBAC9C,KAAK,EAAE;oBACL,6FAA6F;oBAC7F,CAAC,4BAAoB,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BACvC;aACF;YACD;gBACE,KAAK,EAAE;oBACL,4CAA4C,EAAE;wBAC5C,OAAO;wBACP;4BACE,MAAM,EAAE,cAAc;4BACtB,QAAQ,EAAE,qBAAqB;4BAC/B,uBAAuB,EAAE,KAAK;yBAC/B;qBACF;oBACD,CAAC,kCAA0B,CAAC,IAAI,CAAC,EAAE,kCAA0B,CAAC,KAAK,EAAsB;iBAC1F;aACF;SACF,CAAC;IACJ,CAAC;CACF;AA5ED,gDA4EC;AAED,uFAAuF;AACvF,MAAM,2BAA2B,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;AAElG;;;GAGG;AACU,QAAA,4BAA4B,GAAoB;IAC3D,GAAG,gCAAuB;IAC1B;QACE,KAAK,EAAE,qBAAS;QAChB,eAAe,EAAE,EAAE,MAAM,EAAE,2BAAQ,CAAC,MAAuB,EAAE;QAC7D,OAAO,EAAE,EAAE,oBAAoB,EAAE,2BAAQ,CAAC,MAAe,EAAE;QAC3D,KAAK,EAAE;YACL,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,CAAC;gBACtD,cAAc,EAAE,CAAC,2BAA2B,CAAC;aAC9C,CAAC;SACH;KACF;CACF,CAAC","sourcesContent":["import type { ESLint, Linter } from 'eslint';\nimport tseslint from 'typescript-eslint';\nimport { eslintConfigs, namingConventionConfigs } from './eslint';\nimport { JSX_FILES } from './jsx-files';\nimport { NamingConventionRule, NoRestrictedPropertiesRule } from './rules';\n\n/** Without `configs`: each plugin types its presets its own way, and only the rules are used here. */\ntype TRulesPlugin = Omit<ESLint.Plugin, 'configs'>;\n\nexport interface IReactEslintPlugins {\n react: TRulesPlugin;\n reactHooks: TRulesPlugin;\n jsxA11y: TRulesPlugin;\n}\n\n/**\n * The base preset plus what a React frontend needs on top: the React, hooks and accessibility rules.\n * Frontend code is held to the backend's standard - no floating promise, no `void`, no use before\n * declaration - so nothing in the base is relaxed. The plugins come in as options, so a backend that\n * never calls this installs none of them.\n *\n * ```js\n * import react from 'eslint-plugin-react';\n * import reactHooks from 'eslint-plugin-react-hooks';\n * import jsxA11y from 'eslint-plugin-jsx-a11y';\n *\n * export default ReactEslintConfigs.create({ plugins: { react, reactHooks, jsxA11y } });\n * ```\n *\n * `reactVersion` defaults to `detect`. Under ESLint 10, eslint-plugin-react 7 cannot detect it and\n * aborts, so pass the version there (`reactVersion: '19.2'`).\n */\nexport class ReactEslintConfigs {\n static create(opts: { plugins: IReactEslintPlugins; reactVersion?: string }): Linter.Config[] {\n const { react, reactHooks, jsxA11y } = opts.plugins;\n const { reactVersion = 'detect' } = opts;\n\n return [\n ...eslintConfigs,\n {\n files: JSX_FILES,\n plugins: { react, 'jsx-a11y': jsxA11y },\n settings: { react: { version: reactVersion } },\n rules: {\n // The base naming rule, plus PascalCase functions: a component declared as `function App()`.\n [NamingConventionRule.NAME]: NamingConventionRule.build({\n extraSelectors: [{ selector: 'function', format: ['camelCase', 'PascalCase'] }],\n }),\n\n // Correctness rules from react's recommended set. Left out: what the automatic JSX runtime or\n // tsc already covers (react-in-jsx-scope, jsx-uses-react, prop-types, jsx-no-undef,\n // jsx-no-duplicate-props, no-unknown-property).\n 'react/display-name': 'error',\n 'react/jsx-boolean-value': 'error',\n 'react/jsx-key': 'error',\n 'react/jsx-no-comment-textnodes': 'error',\n 'react/jsx-no-target-blank': 'error',\n 'react/no-children-prop': 'error',\n 'react/no-danger-with-children': 'error',\n 'react/no-deprecated': 'error',\n 'react/no-direct-mutation-state': 'error',\n 'react/no-find-dom-node': 'error',\n 'react/no-is-mounted': 'error',\n 'react/no-render-return-value': 'error',\n 'react/no-string-refs': 'error',\n 'react/require-render-return': 'error',\n\n 'jsx-a11y/alt-text': 'error',\n 'jsx-a11y/anchor-has-content': 'error',\n 'jsx-a11y/aria-props': 'error',\n 'jsx-a11y/aria-proptypes': 'error',\n 'jsx-a11y/aria-role': 'error',\n 'jsx-a11y/aria-unsupported-elements': 'error',\n 'jsx-a11y/role-has-required-aria-props': 'error',\n 'jsx-a11y/role-supports-aria-props': 'error',\n 'jsx-a11y/tabindex-no-positive': 'error',\n 'jsx-a11y/anchor-is-valid': 'error',\n 'jsx-a11y/click-events-have-key-events': 'error',\n 'jsx-a11y/heading-has-content': 'error',\n 'jsx-a11y/label-has-associated-control': 'error',\n 'jsx-a11y/no-noninteractive-element-interactions': 'error',\n 'jsx-a11y/no-static-element-interactions': 'error',\n },\n },\n {\n // Custom hooks live in .ts files too.\n files: ['**/*.{js,jsx,ts,tsx}'],\n plugins: { 'react-hooks': reactHooks },\n rules: {\n 'react-hooks/rules-of-hooks': 'error',\n 'react-hooks/exhaustive-deps': 'error',\n },\n },\n {\n rules: {\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n fixStyle: 'inline-type-imports',\n disallowTypeAnnotations: false,\n },\n ],\n [NoRestrictedPropertiesRule.NAME]: NoRestrictedPropertiesRule.build() as Linter.RuleEntry,\n },\n },\n ];\n }\n}\n\n/** A component is declared as `function App()`, so functions may be PascalCase too. */\nconst COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase', 'PascalCase'] };\n\n/**\n * `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and\n * .tsx files, where a component is declared as `function App()`.\n */\nexport const reactNamingConventionConfigs: Linter.Config[] = [\n ...namingConventionConfigs,\n {\n files: JSX_FILES,\n languageOptions: { parser: tseslint.parser as Linter.Parser },\n plugins: { '@typescript-eslint': tseslint.plugin as never },\n rules: {\n [NamingConventionRule.NAME]: NamingConventionRule.build({\n extraSelectors: [COMPONENT_FUNCTION_SELECTOR],\n }),\n },\n },\n];\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OxlintConfig } from 'oxlint';
|
|
2
|
+
import type { IOxlintPresetOptions } from './oxlint';
|
|
3
|
+
/**
|
|
4
|
+
* The oxlint counterpart of `ReactEslintConfigs`: `BrowserOxlintConfigs` (the base rules plus the
|
|
5
|
+
* secure-context ban) plus the React, hooks and accessibility rules and `consistent-type-imports`.
|
|
6
|
+
* oxlint runs these plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
7
|
+
* port and is left out.
|
|
8
|
+
*
|
|
9
|
+
* Nothing in the base is relaxed - frontend code meets the backend's standard - and
|
|
10
|
+
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* // .configs/oxlint.config.mts
|
|
14
|
+
* import { defineConfig } from 'oxlint';
|
|
15
|
+
* import { ReactOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
16
|
+
*
|
|
17
|
+
* export default defineConfig(ReactOxlintConfigs.create());
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class ReactOxlintConfigs {
|
|
21
|
+
static create(opts?: IOxlintPresetOptions): OxlintConfig;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=react-oxlint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-oxlint.d.ts","sourceRoot":"","sources":["../../src/linters/react-oxlint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAgE7D"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReactOxlintConfigs = void 0;
|
|
4
|
+
const browser_1 = require("./browser");
|
|
5
|
+
const ignore_1 = require("./ignore");
|
|
6
|
+
const jsx_files_1 = require("./jsx-files");
|
|
7
|
+
// This file imports no ESLint package, so a config that only needs the oxlint preset does not load them.
|
|
8
|
+
const SOURCE_FILES = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
|
|
9
|
+
/**
|
|
10
|
+
* The oxlint counterpart of `ReactEslintConfigs`: `BrowserOxlintConfigs` (the base rules plus the
|
|
11
|
+
* secure-context ban) plus the React, hooks and accessibility rules and `consistent-type-imports`.
|
|
12
|
+
* oxlint runs these plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
13
|
+
* port and is left out.
|
|
14
|
+
*
|
|
15
|
+
* Nothing in the base is relaxed - frontend code meets the backend's standard - and
|
|
16
|
+
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* // .configs/oxlint.config.mts
|
|
20
|
+
* import { defineConfig } from 'oxlint';
|
|
21
|
+
* import { ReactOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
22
|
+
*
|
|
23
|
+
* export default defineConfig(ReactOxlintConfigs.create());
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
class ReactOxlintConfigs {
|
|
27
|
+
static create(opts = {}) {
|
|
28
|
+
const browserConfigs = browser_1.BrowserOxlintConfigs.create({ lenientFallback: opts.lenientFallback });
|
|
29
|
+
const config = {
|
|
30
|
+
...browserConfigs,
|
|
31
|
+
plugins: [...new Set([...(browserConfigs.plugins ?? []), 'react', 'jsx-a11y'])],
|
|
32
|
+
overrides: [
|
|
33
|
+
...(browserConfigs.overrides ?? []),
|
|
34
|
+
{
|
|
35
|
+
files: jsx_files_1.JSX_FILES,
|
|
36
|
+
rules: {
|
|
37
|
+
// Correctness rules from react's recommended set, as in ReactEslintConfigs.
|
|
38
|
+
'react/display-name': 'error',
|
|
39
|
+
'react/jsx-boolean-value': 'error',
|
|
40
|
+
'react/jsx-key': 'error',
|
|
41
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
42
|
+
'react/jsx-no-target-blank': 'error',
|
|
43
|
+
'react/no-children-prop': 'error',
|
|
44
|
+
'react/no-danger-with-children': 'error',
|
|
45
|
+
'react/no-direct-mutation-state': 'error',
|
|
46
|
+
'react/no-find-dom-node': 'error',
|
|
47
|
+
'react/no-is-mounted': 'error',
|
|
48
|
+
'react/no-render-return-value': 'error',
|
|
49
|
+
'react/no-string-refs': 'error',
|
|
50
|
+
'react/require-render-return': 'error',
|
|
51
|
+
'jsx-a11y/alt-text': 'error',
|
|
52
|
+
'jsx-a11y/anchor-has-content': 'error',
|
|
53
|
+
'jsx-a11y/aria-props': 'error',
|
|
54
|
+
'jsx-a11y/aria-proptypes': 'error',
|
|
55
|
+
'jsx-a11y/aria-role': 'error',
|
|
56
|
+
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
57
|
+
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
58
|
+
'jsx-a11y/role-supports-aria-props': 'error',
|
|
59
|
+
'jsx-a11y/tabindex-no-positive': 'error',
|
|
60
|
+
'jsx-a11y/anchor-is-valid': 'error',
|
|
61
|
+
'jsx-a11y/click-events-have-key-events': 'error',
|
|
62
|
+
'jsx-a11y/heading-has-content': 'error',
|
|
63
|
+
'jsx-a11y/label-has-associated-control': 'error',
|
|
64
|
+
'jsx-a11y/no-noninteractive-element-interactions': 'error',
|
|
65
|
+
'jsx-a11y/no-static-element-interactions': 'error',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
// Custom hooks live in .ts files too.
|
|
70
|
+
files: SOURCE_FILES,
|
|
71
|
+
rules: {
|
|
72
|
+
'react/rules-of-hooks': 'error',
|
|
73
|
+
'react/exhaustive-deps': 'error',
|
|
74
|
+
'typescript/consistent-type-imports': [
|
|
75
|
+
'error',
|
|
76
|
+
{
|
|
77
|
+
prefer: 'type-imports',
|
|
78
|
+
fixStyle: 'inline-type-imports',
|
|
79
|
+
disallowTypeAnnotations: false,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
return ignore_1.LintIgnore.oxlint({ config, patterns: opts.ignore ?? [] });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.ReactOxlintConfigs = ReactOxlintConfigs;
|
|
90
|
+
//# sourceMappingURL=react-oxlint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-oxlint.js","sourceRoot":"","sources":["../../src/linters/react-oxlint.ts"],"names":[],"mappings":";;;AACA,uCAAiD;AACjD,qCAAsC;AACtC,2CAAwC;AAGxC,yGAAyG;AACzG,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE5F;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,MAAM,cAAc,GAAG,8BAAoB,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAE9F,MAAM,MAAM,GAAiB;YAC3B,GAAG,cAAc;YACjB,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC,CAAC;YACxF,SAAS,EAAE;gBACT,GAAG,CAAC,cAAc,CAAC,SAAS,IAAI,EAAE,CAAC;gBACnC;oBACE,KAAK,EAAE,qBAAS;oBAChB,KAAK,EAAE;wBACL,4EAA4E;wBAC5E,oBAAoB,EAAE,OAAO;wBAC7B,yBAAyB,EAAE,OAAO;wBAClC,eAAe,EAAE,OAAO;wBACxB,gCAAgC,EAAE,OAAO;wBACzC,2BAA2B,EAAE,OAAO;wBACpC,wBAAwB,EAAE,OAAO;wBACjC,+BAA+B,EAAE,OAAO;wBACxC,gCAAgC,EAAE,OAAO;wBACzC,wBAAwB,EAAE,OAAO;wBACjC,qBAAqB,EAAE,OAAO;wBAC9B,8BAA8B,EAAE,OAAO;wBACvC,sBAAsB,EAAE,OAAO;wBAC/B,6BAA6B,EAAE,OAAO;wBAEtC,mBAAmB,EAAE,OAAO;wBAC5B,6BAA6B,EAAE,OAAO;wBACtC,qBAAqB,EAAE,OAAO;wBAC9B,yBAAyB,EAAE,OAAO;wBAClC,oBAAoB,EAAE,OAAO;wBAC7B,oCAAoC,EAAE,OAAO;wBAC7C,uCAAuC,EAAE,OAAO;wBAChD,mCAAmC,EAAE,OAAO;wBAC5C,+BAA+B,EAAE,OAAO;wBACxC,0BAA0B,EAAE,OAAO;wBACnC,uCAAuC,EAAE,OAAO;wBAChD,8BAA8B,EAAE,OAAO;wBACvC,uCAAuC,EAAE,OAAO;wBAChD,iDAAiD,EAAE,OAAO;wBAC1D,yCAAyC,EAAE,OAAO;qBACnD;iBACF;gBACD;oBACE,sCAAsC;oBACtC,KAAK,EAAE,YAAY;oBACnB,KAAK,EAAE;wBACL,sBAAsB,EAAE,OAAO;wBAC/B,uBAAuB,EAAE,OAAO;wBAChC,oCAAoC,EAAE;4BACpC,OAAO;4BACP;gCACE,MAAM,EAAE,cAAc;gCACtB,QAAQ,EAAE,qBAAqB;gCAC/B,uBAAuB,EAAE,KAAK;6BAC/B;yBACF;qBACF;iBACF;aACF;SACF,CAAC;QAEF,OAAO,mBAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAjED,gDAiEC","sourcesContent":["import type { OxlintConfig } from 'oxlint';\nimport { BrowserOxlintConfigs } from './browser';\nimport { LintIgnore } from './ignore';\nimport { JSX_FILES } from './jsx-files';\nimport type { IOxlintPresetOptions } from './oxlint';\n\n// This file imports no ESLint package, so a config that only needs the oxlint preset does not load them.\nconst SOURCE_FILES = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];\n\n/**\n * The oxlint counterpart of `ReactEslintConfigs`: `BrowserOxlintConfigs` (the base rules plus the\n * secure-context ban) plus the React, hooks and accessibility rules and `consistent-type-imports`.\n * oxlint runs these plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint\n * port and is left out.\n *\n * Nothing in the base is relaxed - frontend code meets the backend's standard - and\n * `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.\n *\n * ```ts\n * // .configs/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { ReactOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(ReactOxlintConfigs.create());\n * ```\n */\nexport class ReactOxlintConfigs {\n static create(opts: IOxlintPresetOptions = {}): OxlintConfig {\n const browserConfigs = BrowserOxlintConfigs.create({ lenientFallback: opts.lenientFallback });\n\n const config: OxlintConfig = {\n ...browserConfigs,\n plugins: [...new Set([...(browserConfigs.plugins ?? []), 'react', 'jsx-a11y'] as const)],\n overrides: [\n ...(browserConfigs.overrides ?? []),\n {\n files: JSX_FILES,\n rules: {\n // Correctness rules from react's recommended set, as in ReactEslintConfigs.\n 'react/display-name': 'error',\n 'react/jsx-boolean-value': 'error',\n 'react/jsx-key': 'error',\n 'react/jsx-no-comment-textnodes': 'error',\n 'react/jsx-no-target-blank': 'error',\n 'react/no-children-prop': 'error',\n 'react/no-danger-with-children': 'error',\n 'react/no-direct-mutation-state': 'error',\n 'react/no-find-dom-node': 'error',\n 'react/no-is-mounted': 'error',\n 'react/no-render-return-value': 'error',\n 'react/no-string-refs': 'error',\n 'react/require-render-return': 'error',\n\n 'jsx-a11y/alt-text': 'error',\n 'jsx-a11y/anchor-has-content': 'error',\n 'jsx-a11y/aria-props': 'error',\n 'jsx-a11y/aria-proptypes': 'error',\n 'jsx-a11y/aria-role': 'error',\n 'jsx-a11y/aria-unsupported-elements': 'error',\n 'jsx-a11y/role-has-required-aria-props': 'error',\n 'jsx-a11y/role-supports-aria-props': 'error',\n 'jsx-a11y/tabindex-no-positive': 'error',\n 'jsx-a11y/anchor-is-valid': 'error',\n 'jsx-a11y/click-events-have-key-events': 'error',\n 'jsx-a11y/heading-has-content': 'error',\n 'jsx-a11y/label-has-associated-control': 'error',\n 'jsx-a11y/no-noninteractive-element-interactions': 'error',\n 'jsx-a11y/no-static-element-interactions': 'error',\n },\n },\n {\n // Custom hooks live in .ts files too.\n files: SOURCE_FILES,\n rules: {\n 'react/rules-of-hooks': 'error',\n 'react/exhaustive-deps': 'error',\n 'typescript/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n fixStyle: 'inline-type-imports',\n disallowTypeAnnotations: false,\n },\n ],\n },\n },\n ],\n };\n\n return LintIgnore.oxlint({ config, patterns: opts.ignore ?? [] });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/linters/rules/common.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/linters/rules/common.ts"],"names":[],"mappings":"","sourcesContent":["import type { OxlintConfig } from 'oxlint';\n\n/** A rule's severity, as both oxlint and ESLint accept it. */\nexport type TRuleSeverity = 'off' | 'warn' | 'error';\n\n/** The entry oxlint's own types allow for rule `TName`, options included. */\nexport type TOxlintRuleEntry<TName extends string> = NonNullable<\n NonNullable<OxlintConfig['rules']>[TName]\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eqeqeq.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/eqeqeq.rule.ts"],"names":[],"mappings":";;;AAEA,2EAA2E;AAC3E,MAAa,UAAU;aACL,SAAI,GAAG,QAAQ,CAAC;IAEhC,MAAM,CAAC,KAAK,CACV,OAAgE,EAAE;QAElE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QACpD,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;;AARH,gCASC"}
|
|
1
|
+
{"version":3,"file":"eqeqeq.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/eqeqeq.rule.ts"],"names":[],"mappings":";;;AAEA,2EAA2E;AAC3E,MAAa,UAAU;aACL,SAAI,GAAG,QAAQ,CAAC;IAEhC,MAAM,CAAC,KAAK,CACV,OAAgE,EAAE;QAElE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QACpD,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;;AARH,gCASC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** `eqeqeq`. `smart` still allows `== null` and comparing two literals. */\nexport class EqeqeqRule {\n static readonly NAME = 'eqeqeq';\n\n static build(\n opts: { severity?: TRuleSeverity; mode?: 'always' | 'smart' } = {},\n ): TOxlintRuleEntry<'eqeqeq'> {\n const { severity = 'error', mode = 'smart' } = opts;\n return [severity, mode];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/linters/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gDAA8B;AAC9B,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,wDAAsC;AACtC,mEAAiD;AACjD,4DAA0C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/linters/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gDAA8B;AAC9B,2DAAyC;AACzC,+DAA6C;AAC7C,kEAAgD;AAChD,wDAAsC;AACtC,mEAAiD;AACjD,4DAA0C","sourcesContent":["export * from './common';\nexport * from './eqeqeq.rule';\nexport * from './naming-convention.rule';\nexport * from './no-restricted-imports.rule';\nexport * from './no-restricted-properties.rule';\nexport * from './no-unused-vars.rule';\nexport * from './prefer-nullish-coalescing.rule';\nexport * from './switch-case-braces.rule';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming-convention.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/naming-convention.rule.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,MAAa,oBAAoB;aACf,SAAI,GAAG,sCAAsC,CAAC;aAE9C,cAAS,GAA+B;QACtD,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE;QAC9C,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE;QAC3E,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;QACrD,qGAAqG;QACrG;YACE,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;YACrC,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE;QAClE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE;QAC5E;YACE,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD;YACE,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iB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,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE;QACtF;YACE,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,SAAS,CAAC;YACtB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,iBAAiB,EAAE,OAAO;SAC3B;QACD;YACE,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,WAAW,CAAC;YACxB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,iBAAiB,EAAE,OAAO;SAC3B;QACD,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE;QAChD;YACE,QAAQ,EAAE;gBACR,uBAAuB;gBACvB,qBAAqB;gBACrB,cAAc;gBACd,YAAY;gBACZ,eAAe;gBACf,aAAa;gBACb,YAAY;aACb;YACD,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,CAAC,gBAAgB,CAAC;SAC9B;QACD,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE;QAC3D,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;KACpD,CAAC;IAEF,+EAA+E;IAC/E,MAAM,CAAC,KAAK,CACV,OAAyE,EAAE;QAE3E,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACzD,OAAO,CAAC,QAAQ,EAAE,GAAG,oBAAoB,CAAC,SAAS,EAAE,GAAG,cAAc,CAAC,CAAC;IAC1E,CAAC;;AAhEH,oDAiEC","sourcesContent":["import type { Linter } from 'eslint';\nimport type { TRuleSeverity } from './common';\n\n/** One selector of `@typescript-eslint/naming-convention`, as its documentation types it. */\nexport type TNamingSelector = Record<string, unknown> & { selector: string | string[] };\n\n/**\n * `@typescript-eslint/naming-convention`, owned here. oxlint has no port of it, so it runs in ESLint.\n * The selectors are the LoopBack 4 set the base preset carried, kept one for one.\n */\nexport class NamingConventionRule {\n static readonly NAME = '@typescript-eslint/naming-convention';\n\n static readonly SELECTORS: readonly TNamingSelector[] = [\n { selector: 'default', format: ['camelCase'] },\n { selector: 'variable', format: ['camelCase', 'UPPER_CASE', 'PascalCase'] },\n { selector: 'variable', format: null, filter: '^_$' },\n // A `_name` variable names an omitted value (`{ page: _page, ...rest }`); its case is still checked.\n {\n selector: 'variable',\n filter: { regex: '^_.', match: true },\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'function', format: ['PascalCase'], filter: 'Mixin$' },\n { selector: 'parameter', format: ['camelCase'], leadingUnderscore: 'allow' },\n {\n selector: 'enumMember',\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n {\n selector: 'property',\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'method', format: ['camelCase'], leadingUnderscore: 'allow' },\n { selector: 'memberLike', modifiers: ['static'], format: ['camelCase', 'UPPER_CASE'] },\n {\n selector: 'memberLike',\n modifiers: ['private'],\n format: ['camelCase'],\n leadingUnderscore: 'allow',\n },\n {\n selector: 'memberLike',\n modifiers: ['protected'],\n format: ['camelCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'typeLike', format: ['PascalCase'] },\n {\n selector: [\n 'objectLiteralProperty',\n 'objectLiteralMethod',\n 'typeProperty',\n 'typeMethod',\n 'classProperty',\n 'classMethod',\n 'enumMember',\n ],\n format: null,\n modifiers: ['requiresQuotes'],\n },\n { selector: 'import', format: ['camelCase', 'PascalCase'] },\n { selector: 'import', format: null, filter: '^_$' },\n ];\n\n /** `extraSelectors` go last, so they win over a base selector they overlap. */\n static build(\n opts: { severity?: TRuleSeverity; extraSelectors?: TNamingSelector[] } = {},\n ): Linter.RuleEntry {\n const { severity = 'error', extraSelectors = [] } = opts;\n return [severity, ...NamingConventionRule.SELECTORS, ...extraSelectors];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-restricted-imports.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-restricted-imports.rule.ts"],"names":[],"mappings":";;;AASA,iGAAiG;AACjG,MAAa,uBAAuB;aAClB,SAAI,GAAG,uBAAuB,CAAC;aAE/B,UAAK,GAAqC;QACxD;YACE,IAAI,EAAE,QAAQ;YACd,OAAO,EACL,iGAAiG;SACpG;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CACV,OAA2E,EAAE;QAE7E,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACrD,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,uBAAuB,CAAC,KAAK,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;;AAhBH,0DAiBC"}
|
|
1
|
+
{"version":3,"file":"no-restricted-imports.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-restricted-imports.rule.ts"],"names":[],"mappings":";;;AASA,iGAAiG;AACjG,MAAa,uBAAuB;aAClB,SAAI,GAAG,uBAAuB,CAAC;aAE/B,UAAK,GAAqC;QACxD;YACE,IAAI,EAAE,QAAQ;YACd,OAAO,EACL,iGAAiG;SACpG;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CACV,OAA2E,EAAE;QAE7E,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACrD,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,uBAAuB,CAAC,KAAK,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;;AAhBH,0DAiBC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** One forbidden import path, with the message the author sees. */\nexport interface IRestrictedImportPath {\n name: string;\n message: string;\n importNames?: string[];\n}\n\n/** `no-restricted-imports`. The base forbids the whole of lodash, which defeats tree-shaking. */\nexport class NoRestrictedImportsRule {\n static readonly NAME = 'no-restricted-imports';\n\n static readonly PATHS: readonly IRestrictedImportPath[] = [\n {\n name: 'lodash',\n message:\n \"Please import 'fn' from 'lodash/fn' instead of * from lodash | Ex: import get from 'lodash/get'\",\n },\n ];\n\n static build(\n opts: { severity?: TRuleSeverity; extraPaths?: IRestrictedImportPath[] } = {},\n ): TOxlintRuleEntry<'no-restricted-imports'> {\n const { severity = 'error', extraPaths = [] } = opts;\n return [severity, { paths: [...NoRestrictedImportsRule.PATHS, ...extraPaths] }];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-restricted-properties.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-restricted-properties.rule.ts"],"names":[],"mappings":";;;AASA;;;;;GAKG;AACH,MAAa,0BAA0B;aACrB,SAAI,GAAG,0BAA0B,CAAC;aAElC,mBAAc,GAAmC;QAC/D;YACE,QAAQ,EAAE,YAAY;YACtB,OAAO,EACL,6JAA6J;SAChK;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CACV,OAA8E,EAAE;QAEhF,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QAC1D,OAAO,CAAC,QAAQ,EAAE,GAAG,0BAA0B,CAAC,cAAc,EAAE,GAAG,eAAe,CAAC,CAAC;IACtF,CAAC;;AAhBH,gEAiBC"}
|
|
1
|
+
{"version":3,"file":"no-restricted-properties.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-restricted-properties.rule.ts"],"names":[],"mappings":";;;AASA;;;;;GAKG;AACH,MAAa,0BAA0B;aACrB,SAAI,GAAG,0BAA0B,CAAC;aAElC,mBAAc,GAAmC;QAC/D;YACE,QAAQ,EAAE,YAAY;YACtB,OAAO,EACL,6JAA6J;SAChK;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CACV,OAA8E,EAAE;QAEhF,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QAC1D,OAAO,CAAC,QAAQ,EAAE,GAAG,0BAA0B,CAAC,cAAc,EAAE,GAAG,eAAe,CAAC,CAAC;IACtF,CAAC;;AAhBH,gEAiBC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** One forbidden property access, with the message the author sees. */\nexport interface IRestrictedProperty {\n property: string;\n object?: string;\n message: string;\n}\n\n/**\n * `no-restricted-properties`. The default bans what exists only in a secure context (https,\n * localhost): on a plain-http LAN origin or in a WebView, `crypto.randomUUID` is `undefined` and the\n * first call throws. Catches the call, `globalThis.crypto.randomUUID`, the bracket form and\n * destructuring; leaves `getRandomValues` alone.\n */\nexport class NoRestrictedPropertiesRule {\n static readonly NAME = 'no-restricted-properties';\n\n static readonly SECURE_CONTEXT: readonly IRestrictedProperty[] = [\n {\n property: 'randomUUID',\n message:\n 'crypto.randomUUID exists only in a secure context (https, localhost) - on a plain-http origin it is undefined. Use uuidV4 from @venizia/ignis-helpers/uuid.',\n },\n ];\n\n static build(\n opts: { severity?: TRuleSeverity; extraProperties?: IRestrictedProperty[] } = {},\n ): TOxlintRuleEntry<'no-restricted-properties'> {\n const { severity = 'error', extraProperties = [] } = opts;\n return [severity, ...NoRestrictedPropertiesRule.SECURE_CONTEXT, ...extraProperties];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-unused-vars.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":";;;AAEA,+KAA+K;AAC/K,MAAa,gBAAgB;aACX,SAAI,GAAG,gBAAgB,CAAC;IAExC,MAAM,CAAC,KAAK,CACV,OAUI,EAAE;QAEN,MAAM,EACJ,QAAQ,GAAG,OAAO,EAClB,IAAI,GAAG,KAAK,EACZ,IAAI,GAAG,MAAM,EACb,kBAAkB,GAAG,KAAK,EAC1B,iBAAiB,GAAG,IAAI,EACxB,GAAG,QAAQ,EACZ,GAAG,IAAI,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;IACxF,CAAC;;AAzBH,4CA0BC"}
|
|
1
|
+
{"version":3,"file":"no-unused-vars.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":";;;AAEA,+KAA+K;AAC/K,MAAa,gBAAgB;aACX,SAAI,GAAG,gBAAgB,CAAC;IAExC,MAAM,CAAC,KAAK,CACV,OAUI,EAAE;QAEN,MAAM,EACJ,QAAQ,GAAG,OAAO,EAClB,IAAI,GAAG,KAAK,EACZ,IAAI,GAAG,MAAM,EACb,kBAAkB,GAAG,KAAK,EAC1B,iBAAiB,GAAG,IAAI,EACxB,GAAG,QAAQ,EACZ,GAAG,IAAI,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;IACxF,CAAC;;AAzBH,4CA0BC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** `no-unused-vars`. Unused arguments pass by default: an override keeps its signature. A `_name` variable is an omitted value (`{ page: _page, ...rest }`) and passes too. */\nexport class NoUnusedVarsRule {\n static readonly NAME = 'no-unused-vars';\n\n static build(\n opts: {\n severity?: TRuleSeverity;\n vars?: 'all' | 'local';\n args?: 'all' | 'after-used' | 'none';\n ignoreRestSiblings?: boolean;\n /** Names that may stay unused, e.g. `^_` - a placeholder a signature needs. */\n argsIgnorePattern?: string;\n varsIgnorePattern?: string;\n caughtErrorsIgnorePattern?: string;\n destructuredArrayIgnorePattern?: string;\n } = {},\n ): TOxlintRuleEntry<'no-unused-vars'> {\n const {\n severity = 'error',\n vars = 'all',\n args = 'none',\n ignoreRestSiblings = false,\n varsIgnorePattern = '^_',\n ...patterns\n } = opts;\n return [severity, { vars, args, ignoreRestSiblings, varsIgnorePattern, ...patterns }];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-nullish-coalescing.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":";;;AAEA,gGAAgG;AAChG,MAAa,2BAA2B;aACtB,SAAI,GAAG,sCAAsC,CAAC;IAE9D,MAAM,CAAC,KAAK,CACV,OAYI,EAAE;QAEN,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAChD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;;AApBH,kEAqBC"}
|
|
1
|
+
{"version":3,"file":"prefer-nullish-coalescing.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":";;;AAEA,gGAAgG;AAChG,MAAa,2BAA2B;aACtB,SAAI,GAAG,sCAAsC,CAAC;IAE9D,MAAM,CAAC,KAAK,CACV,OAYI,EAAE;QAEN,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAChD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;;AApBH,kEAqBC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** `typescript/prefer-nullish-coalescing`, type-aware. Options are oxlint's, passed through. */\nexport class PreferNullishCoalescingRule {\n static readonly NAME = 'typescript/prefer-nullish-coalescing';\n\n static build(\n opts: {\n severity?: TRuleSeverity;\n ignoreConditionalTests?: boolean;\n ignoreMixedLogicalExpressions?: boolean;\n ignoreTernaryTests?: boolean;\n /** Allow `||` / `||=` where the left side is this primitive, e.g. `{ string: true, number: true }`. */\n ignorePrimitives?: {\n bigint?: boolean;\n boolean?: boolean;\n number?: boolean;\n string?: boolean;\n };\n } = {},\n ): TOxlintRuleEntry<'typescript/prefer-nullish-coalescing'> {\n const { severity = 'error', ...options } = opts;\n return Object.keys(options).length === 0 ? severity : [severity, options];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch-case-braces.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/switch-case-braces.rule.ts"],"names":[],"mappings":";;;AAEA,mFAAmF;AACnF,MAAa,oBAAoB;aACf,SAAI,GAAG,4BAA4B,CAAC;IAEpD,MAAM,CAAC,KAAK,CACV,OAAgE,EAAE;QAElE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;QACrD,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;;AARH,oDASC"}
|
|
1
|
+
{"version":3,"file":"switch-case-braces.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/switch-case-braces.rule.ts"],"names":[],"mappings":";;;AAEA,mFAAmF;AACnF,MAAa,oBAAoB;aACf,SAAI,GAAG,4BAA4B,CAAC;IAEpD,MAAM,CAAC,KAAK,CACV,OAAgE,EAAE;QAElE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;QACrD,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;;AARH,oDASC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** `unicorn/switch-case-braces`. `always` gives every case its own block scope. */\nexport class SwitchCaseBracesRule {\n static readonly NAME = 'unicorn/switch-case-braces';\n\n static build(\n opts: { severity?: TRuleSeverity; mode?: 'always' | 'avoid' } = {},\n ): TOxlintRuleEntry<'unicorn/switch-case-braces'> {\n const { severity = 'error', mode = 'always' } = opts;\n return [severity, mode];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC","sourcesContent":["export * from './rejection.helper';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejection.helper.js","sourceRoot":"","sources":["../../src/testing/rejection.helper.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAElC;;;;;;;;GAQG;AACI,MAAM,WAAW,GAAG,KAAK,EAAE,IAAsB,EAAoB,EAAE;IAC5E,IAAI,CAAC;QACH,MAAM,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,iBAAM,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC;AAC5E,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB;AAEF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,IAGrC,EAAiB,EAAE;IAClB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;IAEvC,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,IAAA,iBAAM,EAAC,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACrF,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B"}
|
|
1
|
+
{"version":3,"file":"rejection.helper.js","sourceRoot":"","sources":["../../src/testing/rejection.helper.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAElC;;;;;;;;GAQG;AACI,MAAM,WAAW,GAAG,KAAK,EAAE,IAAsB,EAAoB,EAAE;IAC5E,IAAI,CAAC;QACH,MAAM,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,iBAAM,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC;AAC5E,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB;AAEF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,IAGrC,EAAiB,EAAE;IAClB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;IAEvC,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,IAAA,iBAAM,EAAC,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACrF,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B","sourcesContent":["import { expect } from 'bun:test';\n\n/**\n * Awaits a task that must reject and returns what it rejected with; throws when the task resolves.\n *\n * bun types the async matchers (`expect(task).rejects` / `.resolves`) as `void`, so\n * `await expect(task).rejects.toThrow()` is refused by `await-thenable` - and left un-awaited the\n * assertion never runs. Awaiting the task itself needs no matcher and no cast:\n * `expectRejection({ task, message })` or `expect(await rejectionOf(task)).toBeInstanceOf(Error)`,\n * and for a resolution `expect(await task).toMatchObject(...)`.\n */\nexport const rejectionOf = async (task: Promise<unknown>): Promise<unknown> => {\n try {\n await task;\n } catch (error) {\n return error;\n }\n\n return expect.unreachable('Expected the task to reject, but it resolved');\n};\n\n/**\n * The task rejects with an Error whose message contains `message` (a string) or matches it (a\n * RegExp). The message is compared as a string on purpose: bun 1.4.2 `toMatchObject` with an\n * asymmetric matcher overwrites the matched property on the object it checks, so a later read of\n * `error.message` gets the matcher back.\n */\nexport const expectRejection = async (opts: {\n task: Promise<unknown>;\n message: string | RegExp;\n}): Promise<void> => {\n const { task, message } = opts;\n const reason = await rejectionOf(task);\n\n expect(reason).toBeInstanceOf(Error);\n expect(reason instanceof Error ? reason.message : String(reason)).toMatch(message);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/dev-configs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Shareable development configurations for TypeScript projects: oxlint and oxfmt presets with per-rule builders, the ESLint naming-convention rule, the legacy ESLint flat config and Prettier presets, and TypeScript compiler options with critical decorator support (experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields). Single source of truth for consistent code style, type checking, and build settings across monorepo packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build-tools",
|
|
@@ -78,6 +78,10 @@
|
|
|
78
78
|
"types": "./dist/linters/index.d.ts",
|
|
79
79
|
"default": "./dist/linters/index.js"
|
|
80
80
|
},
|
|
81
|
+
"./linters/oxlint": {
|
|
82
|
+
"types": "./dist/linters/oxlint-presets.d.ts",
|
|
83
|
+
"default": "./dist/linters/oxlint-presets.js"
|
|
84
|
+
},
|
|
81
85
|
"./testing": {
|
|
82
86
|
"types": "./dist/testing/index.d.ts",
|
|
83
87
|
"default": "./dist/testing/index.js"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIrD,sGAAsG;AACtG,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE;CA2E9F;AAQD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAgE7D;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAYvD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAyC;AACzC,uCAAiD;AACjD,qCAAsC;AAEtC,qCAAkE;AAClE,mCAA2E;AAW3E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,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