@venizia/dev-configs 0.3.3 → 0.3.4
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 +13 -13
- package/dist/cli/clean.d.ts +7 -0
- package/dist/cli/clean.d.ts.map +1 -0
- package/dist/cli/clean.js +18 -0
- package/dist/cli/clean.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +22 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/lint.d.ts +37 -0
- package/dist/cli/lint.d.ts.map +1 -0
- package/dist/cli/lint.js +119 -0
- package/dist/cli/lint.js.map +1 -0
- package/dist/formatters/oxfmt.d.ts +2 -2
- package/dist/formatters/oxfmt.js +2 -2
- package/dist/formatters/oxfmt.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.d.ts +1 -1
- package/dist/linters/eslint.js +1 -1
- package/dist/linters/eslint.js.map +1 -1
- package/dist/linters/house/configs.d.ts +1 -1
- package/dist/linters/house/configs.js +1 -1
- package/dist/linters/house/configs.js.map +1 -1
- 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-oxlint.d.ts +1 -1
- package/dist/linters/react-oxlint.js +1 -1
- package/dist/linters/react-oxlint.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ project that still runs ESLint and Prettier installs `eslint prettier` and skips
|
|
|
19
19
|
Each tool takes one file. IGNIS keeps them in a `.configs/` folder and passes `-c` to each tool.
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
// .configs/oxlint.config.mts
|
|
22
|
+
// .configs/lints/oxlint.config.mts
|
|
23
23
|
import { defineConfig } from 'oxlint';
|
|
24
24
|
import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ export default defineConfig(oxlintConfigs);
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
|
-
// .configs/oxfmt.config.mts
|
|
30
|
+
// .configs/formatters/oxfmt.config.mts
|
|
31
31
|
import { defineConfig } from 'oxfmt';
|
|
32
32
|
import { oxfmtConfigs } from '@venizia/dev-configs/formatters';
|
|
33
33
|
|
|
@@ -35,16 +35,16 @@ export default defineConfig(oxfmtConfigs);
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
// .configs/eslint.config.mjs - what oxlint cannot run: naming convention + house rules
|
|
38
|
+
// .configs/lints/eslint.config.mjs - what oxlint cannot run: naming convention + house rules
|
|
39
39
|
import { houseConfigs } from '@venizia/dev-configs/linters';
|
|
40
40
|
|
|
41
41
|
export default houseConfigs;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
oxlint -c .configs/oxlint.config.mts --deny-warnings
|
|
46
|
-
eslint -c .configs/eslint.config.mjs .
|
|
47
|
-
oxfmt -c .configs/oxfmt.config.mts --check "**/*.{ts,tsx,mts,js,mjs}"
|
|
45
|
+
oxlint -c .configs/lints/oxlint.config.mts --deny-warnings
|
|
46
|
+
eslint -c .configs/lints/eslint.config.mjs .
|
|
47
|
+
oxfmt -c .configs/formatters/oxfmt.config.mts --check "**/*.{ts,tsx,mts,js,mjs}"
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
`tsconfig.json` stays at the project root. Bun, the editor and oxlint's type-aware engine only find it
|
|
@@ -157,7 +157,7 @@ Not ported:
|
|
|
157
157
|
where `''` and `0` fall back on purpose opts out in one line:
|
|
158
158
|
|
|
159
159
|
```ts
|
|
160
|
-
// .configs/oxlint.config.mts
|
|
160
|
+
// .configs/lints/oxlint.config.mts
|
|
161
161
|
import { defineConfig } from 'oxlint';
|
|
162
162
|
import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
163
163
|
|
|
@@ -211,7 +211,7 @@ Types: `TRuleSeverity`, `TOxlintRuleEntry`, `TNamingSelector`, `IRestrictedImpor
|
|
|
211
211
|
Replace a rule by key. This makes `==` an error everywhere and bans one more import:
|
|
212
212
|
|
|
213
213
|
```typescript
|
|
214
|
-
// .configs/oxlint.config.mts
|
|
214
|
+
// .configs/lints/oxlint.config.mts
|
|
215
215
|
import { defineConfig } from 'oxlint';
|
|
216
216
|
import {
|
|
217
217
|
EqeqeqRule,
|
|
@@ -312,7 +312,7 @@ plain-http origin or in a WebView, the method is `undefined`. Use this preset fo
|
|
|
312
312
|
does not use React.
|
|
313
313
|
|
|
314
314
|
```ts
|
|
315
|
-
// .configs/oxlint.config.mts
|
|
315
|
+
// .configs/lints/oxlint.config.mts
|
|
316
316
|
import { defineConfig } from 'oxlint';
|
|
317
317
|
import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
318
318
|
|
|
@@ -325,13 +325,13 @@ The oxlint version of the React preset. oxlint runs the React, hooks and `jsx-a1
|
|
|
325
325
|
nothing is passed in. Pair it with `reactNamingConventionConfigs` on the ESLint side:
|
|
326
326
|
|
|
327
327
|
```ts
|
|
328
|
-
// .configs/oxlint.config.mts
|
|
328
|
+
// .configs/lints/oxlint.config.mts
|
|
329
329
|
import { defineConfig } from 'oxlint';
|
|
330
330
|
import { ReactOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
331
331
|
|
|
332
332
|
export default defineConfig(ReactOxlintConfigs.create());
|
|
333
333
|
|
|
334
|
-
// .configs/eslint.config.mjs
|
|
334
|
+
// .configs/lints/eslint.config.mjs
|
|
335
335
|
import { reactNamingConventionConfigs } from '@venizia/dev-configs/linters';
|
|
336
336
|
|
|
337
337
|
export default reactNamingConventionConfigs;
|
|
@@ -371,10 +371,10 @@ Makefile can set `LINT_IGNORE` instead (`make/project.mk` passes it as `--ignore
|
|
|
371
371
|
// .configs/lint-ignore.mjs
|
|
372
372
|
export const LINT_IGNORE = ['src/components/shadcn/**', 'dev-dist/**'];
|
|
373
373
|
|
|
374
|
-
// .configs/oxlint.config.mts
|
|
374
|
+
// .configs/lints/oxlint.config.mts
|
|
375
375
|
export default defineConfig(ReactOxlintConfigs.create({ ignore: LINT_IGNORE }));
|
|
376
376
|
|
|
377
|
-
// .configs/eslint.config.mjs
|
|
377
|
+
// .configs/lints/eslint.config.mjs
|
|
378
378
|
export default [LintIgnore.eslint({ patterns: LINT_IGNORE }), ...reactHouseConfigs];
|
|
379
379
|
```
|
|
380
380
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/cli/clean.ts"],"names":[],"mappings":"AAMA,sFAAsF;AACtF,qBAAa,YAAY;IACvB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;CAO3C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CleanCommand = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
/** What a build and the checks generate, relative to the project root. */
|
|
7
|
+
const GENERATED_PATHS = ['dist', 'node_modules/.cache'];
|
|
8
|
+
/** `devz clean`: removes what the build and the checks generate, and nothing else. */
|
|
9
|
+
class CleanCommand {
|
|
10
|
+
static run(opts) {
|
|
11
|
+
for (const path of GENERATED_PATHS) {
|
|
12
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(opts.root, path), { recursive: true, force: true });
|
|
13
|
+
}
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CleanCommand = CleanCommand;
|
|
18
|
+
//# sourceMappingURL=clean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/cli/clean.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,yCAAiC;AAEjC,0EAA0E;AAC1E,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAExD,sFAAsF;AACtF,MAAa,YAAY;IACvB,MAAM,CAAC,GAAG,CAAC,IAAsB;QAC/B,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;YACnC,IAAA,gBAAM,EAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AARD,oCAQC","sourcesContent":["import { rmSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/** What a build and the checks generate, relative to the project root. */\nconst GENERATED_PATHS = ['dist', 'node_modules/.cache'];\n\n/** `devz clean`: removes what the build and the checks generate, and nothing else. */\nexport class CleanCommand {\n static run(opts: { root: string }): number {\n for (const path of GENERATED_PATHS) {\n rmSync(join(opts.root, path), { recursive: true, force: true });\n }\n\n return 0;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const clean_1 = require("./clean");
|
|
5
|
+
const lint_1 = require("./lint");
|
|
6
|
+
const USAGE = 'Usage: devz lint [--fix] [files] | devz clean';
|
|
7
|
+
const main = async (opts) => {
|
|
8
|
+
const [command, ...args] = opts.argv;
|
|
9
|
+
if (command === 'lint') {
|
|
10
|
+
return lint_1.LintCommand.run({ root: process.cwd(), args });
|
|
11
|
+
}
|
|
12
|
+
if (command === 'clean') {
|
|
13
|
+
return clean_1.CleanCommand.run({ root: process.cwd() });
|
|
14
|
+
}
|
|
15
|
+
console.error(`devz: unknown command "${command ?? ''}"\n${USAGE}`);
|
|
16
|
+
return 1;
|
|
17
|
+
};
|
|
18
|
+
main({ argv: process.argv.slice(2) }).then(exitCode => process.exit(exitCode), (error) => {
|
|
19
|
+
console.error(error);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AACA,mCAAuC;AACvC,iCAAqC;AAErC,MAAM,KAAK,GAAG,+CAA+C,CAAC;AAE9D,MAAM,IAAI,GAAG,KAAK,EAAE,IAAwB,EAAmB,EAAE;IAC/D,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;IAErC,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,OAAO,kBAAW,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,oBAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,0BAA0B,OAAO,IAAI,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC;IACpE,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CACxC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAClC,CAAC,KAAc,EAAE,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CACF,CAAC","sourcesContent":["#!/usr/bin/env bun\nimport { CleanCommand } from './clean';\nimport { LintCommand } from './lint';\n\nconst USAGE = 'Usage: devz lint [--fix] [files] | devz clean';\n\nconst main = async (opts: { argv: string[] }): Promise<number> => {\n const [command, ...args] = opts.argv;\n\n if (command === 'lint') {\n return LintCommand.run({ root: process.cwd(), args });\n }\n\n if (command === 'clean') {\n return CleanCommand.run({ root: process.cwd() });\n }\n\n console.error(`devz: unknown command \"${command ?? ''}\"\\n${USAGE}`);\n return 1;\n};\n\nmain({ argv: process.argv.slice(2) }).then(\n exitCode => process.exit(exitCode),\n (error: unknown) => {\n console.error(error);\n process.exit(1);\n },\n);\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** One tool call: the tool name and its arguments, run from the project root. */
|
|
2
|
+
export interface ILintStep {
|
|
3
|
+
tool: string;
|
|
4
|
+
args: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* `devz lint [--fix] [files]`: oxlint, then ESLint, then oxfmt, from the project's
|
|
8
|
+
* `.configs/lints/` and `.configs/formatters/`. With no file it checks the whole project; with
|
|
9
|
+
* files it handles only those, as a pre-commit hook passes them.
|
|
10
|
+
*/
|
|
11
|
+
export declare class LintCommand {
|
|
12
|
+
/**
|
|
13
|
+
* The patterns of an ignore file, one per line, `#` comments and blank lines skipped. An ignore
|
|
14
|
+
* file resolves its patterns from its own folder, so they go on the command line instead, which
|
|
15
|
+
* resolves from the project root.
|
|
16
|
+
*/
|
|
17
|
+
static readIgnore(opts: {
|
|
18
|
+
root: string;
|
|
19
|
+
file: string;
|
|
20
|
+
}): string[];
|
|
21
|
+
/** The tool calls for these arguments, in order; empty when a file list holds nothing to lint. */
|
|
22
|
+
static plan(opts: {
|
|
23
|
+
root: string;
|
|
24
|
+
args: string[];
|
|
25
|
+
}): ILintStep[];
|
|
26
|
+
/** The tool's binary in the nearest `node_modules/.bin`, else its bare name for PATH to find. */
|
|
27
|
+
static resolveTool(opts: {
|
|
28
|
+
root: string;
|
|
29
|
+
tool: string;
|
|
30
|
+
}): string;
|
|
31
|
+
/** Runs the plan in order and stops at the first tool that fails; returns the exit code. */
|
|
32
|
+
static run(opts: {
|
|
33
|
+
root: string;
|
|
34
|
+
args: string[];
|
|
35
|
+
}): Promise<number>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/cli/lint.ts"],"names":[],"mappings":"AAaA,iFAAiF;AACjF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,EAAE;IAYjE,kGAAkG;IAClG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,EAAE;IA0DhE,iGAAiG;IACjG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAgBhE,4FAA4F;WAC/E,GAAG,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAgB1E"}
|
package/dist/cli/lint.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LintCommand = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const LINT_CONFIG = '.configs/lints/oxlint.config.mts';
|
|
7
|
+
const ESLINT_CONFIG = '.configs/lints/eslint.config.mjs';
|
|
8
|
+
const FORMAT_CONFIG = '.configs/formatters/oxfmt.config.mts';
|
|
9
|
+
const LINT_IGNORE_FILE = '.configs/lints/.ignore';
|
|
10
|
+
const FORMAT_IGNORE_FILE = '.configs/formatters/.ignore';
|
|
11
|
+
const ESLINT_CACHE = ['--cache', '--cache-location', 'node_modules/.cache/eslint/'];
|
|
12
|
+
const LINTED_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.js', '.mjs']);
|
|
13
|
+
const FORMAT_GLOB = '**/*.{ts,tsx,mts,js,mjs}';
|
|
14
|
+
const FIX_FLAG = '--fix';
|
|
15
|
+
/**
|
|
16
|
+
* `devz lint [--fix] [files]`: oxlint, then ESLint, then oxfmt, from the project's
|
|
17
|
+
* `.configs/lints/` and `.configs/formatters/`. With no file it checks the whole project; with
|
|
18
|
+
* files it handles only those, as a pre-commit hook passes them.
|
|
19
|
+
*/
|
|
20
|
+
class LintCommand {
|
|
21
|
+
/**
|
|
22
|
+
* The patterns of an ignore file, one per line, `#` comments and blank lines skipped. An ignore
|
|
23
|
+
* file resolves its patterns from its own folder, so they go on the command line instead, which
|
|
24
|
+
* resolves from the project root.
|
|
25
|
+
*/
|
|
26
|
+
static readIgnore(opts) {
|
|
27
|
+
const path = (0, node_path_1.join)(opts.root, opts.file);
|
|
28
|
+
if (!(0, node_fs_1.existsSync)(path)) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return (0, node_fs_1.readFileSync)(path, 'utf8')
|
|
32
|
+
.split('\n')
|
|
33
|
+
.map(line => line.trim())
|
|
34
|
+
.filter(line => line !== '' && !line.startsWith('#'));
|
|
35
|
+
}
|
|
36
|
+
/** The tool calls for these arguments, in order; empty when a file list holds nothing to lint. */
|
|
37
|
+
static plan(opts) {
|
|
38
|
+
const fix = opts.args[0] === FIX_FLAG;
|
|
39
|
+
const paths = fix ? opts.args.slice(1) : opts.args;
|
|
40
|
+
const whole = paths.length === 0;
|
|
41
|
+
const files = paths.filter(path => LINTED_EXTENSIONS.has((0, node_path_1.extname)(path)));
|
|
42
|
+
if (!whole && files.length === 0) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const targets = whole ? ['.'] : files;
|
|
46
|
+
const lintIgnore = LintCommand.readIgnore({ root: opts.root, file: LINT_IGNORE_FILE }).flatMap(pattern => ['--ignore-pattern', pattern]);
|
|
47
|
+
const formatIgnore = LintCommand.readIgnore({ root: opts.root, file: FORMAT_IGNORE_FILE }).map(pattern => `!${pattern}`);
|
|
48
|
+
const unmatched = whole ? [] : ['--no-error-on-unmatched-pattern'];
|
|
49
|
+
const eslintQuiet = whole ? [] : ['--no-warn-ignored'];
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
tool: 'oxlint',
|
|
53
|
+
args: [
|
|
54
|
+
'-c',
|
|
55
|
+
LINT_CONFIG,
|
|
56
|
+
...lintIgnore,
|
|
57
|
+
...unmatched,
|
|
58
|
+
fix ? FIX_FLAG : '--deny-warnings',
|
|
59
|
+
...targets,
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
tool: 'eslint',
|
|
64
|
+
args: [
|
|
65
|
+
'-c',
|
|
66
|
+
ESLINT_CONFIG,
|
|
67
|
+
...ESLINT_CACHE,
|
|
68
|
+
...eslintQuiet,
|
|
69
|
+
...lintIgnore,
|
|
70
|
+
...(fix ? [FIX_FLAG] : []),
|
|
71
|
+
...targets,
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
tool: 'oxfmt',
|
|
76
|
+
args: [
|
|
77
|
+
'-c',
|
|
78
|
+
FORMAT_CONFIG,
|
|
79
|
+
...unmatched,
|
|
80
|
+
...(fix ? [] : ['--check']),
|
|
81
|
+
...(whole ? [FORMAT_GLOB] : files),
|
|
82
|
+
...formatIgnore,
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
/** The tool's binary in the nearest `node_modules/.bin`, else its bare name for PATH to find. */
|
|
88
|
+
static resolveTool(opts) {
|
|
89
|
+
let dir = opts.root;
|
|
90
|
+
while (true) {
|
|
91
|
+
const candidate = (0, node_path_1.join)(dir, 'node_modules', '.bin', opts.tool);
|
|
92
|
+
if ((0, node_fs_1.existsSync)(candidate)) {
|
|
93
|
+
return candidate;
|
|
94
|
+
}
|
|
95
|
+
const parent = (0, node_path_1.dirname)(dir);
|
|
96
|
+
if (parent === dir) {
|
|
97
|
+
return opts.tool;
|
|
98
|
+
}
|
|
99
|
+
dir = parent;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** Runs the plan in order and stops at the first tool that fails; returns the exit code. */
|
|
103
|
+
static async run(opts) {
|
|
104
|
+
for (const step of LintCommand.plan(opts)) {
|
|
105
|
+
const child = Bun.spawn({
|
|
106
|
+
cmd: [LintCommand.resolveTool({ root: opts.root, tool: step.tool }), ...step.args],
|
|
107
|
+
cwd: opts.root,
|
|
108
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
109
|
+
});
|
|
110
|
+
const exitCode = await child.exited;
|
|
111
|
+
if (exitCode !== 0) {
|
|
112
|
+
return exitCode;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.LintCommand = LintCommand;
|
|
119
|
+
//# sourceMappingURL=lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/cli/lint.ts"],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AAC;IACH,CAAC;IAED,4FAA4F;IAC5F,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAsC;QACrD,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;gBACtB,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;gBAClF,GAAG,EAAE,IAAI,CAAC,IAAI;gBACd,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;aACzC,CAAC,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;YAEpC,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;gBACnB,OAAO,QAAQ,CAAC;YAClB,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AA/GD,kCA+GC","sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, extname, join } from 'node:path';\n\nconst LINT_CONFIG = '.configs/lints/oxlint.config.mts';\nconst ESLINT_CONFIG = '.configs/lints/eslint.config.mjs';\nconst FORMAT_CONFIG = '.configs/formatters/oxfmt.config.mts';\nconst LINT_IGNORE_FILE = '.configs/lints/.ignore';\nconst FORMAT_IGNORE_FILE = '.configs/formatters/.ignore';\nconst ESLINT_CACHE = ['--cache', '--cache-location', 'node_modules/.cache/eslint/'];\nconst LINTED_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.js', '.mjs']);\nconst FORMAT_GLOB = '**/*.{ts,tsx,mts,js,mjs}';\nconst FIX_FLAG = '--fix';\n\n/** One tool call: the tool name and its arguments, run from the project root. */\nexport interface ILintStep {\n tool: string;\n args: string[];\n}\n\n/**\n * `devz lint [--fix] [files]`: oxlint, then ESLint, then oxfmt, from the project's\n * `.configs/lints/` and `.configs/formatters/`. With no file it checks the whole project; with\n * files it handles only those, as a pre-commit hook passes them.\n */\nexport class LintCommand {\n /**\n * The patterns of an ignore file, one per line, `#` comments and blank lines skipped. An ignore\n * file resolves its patterns from its own folder, so they go on the command line instead, which\n * resolves from the project root.\n */\n static readIgnore(opts: { root: string; file: string }): string[] {\n const path = join(opts.root, opts.file);\n if (!existsSync(path)) {\n return [];\n }\n\n return readFileSync(path, 'utf8')\n .split('\\n')\n .map(line => line.trim())\n .filter(line => line !== '' && !line.startsWith('#'));\n }\n\n /** The tool calls for these arguments, in order; empty when a file list holds nothing to lint. */\n static plan(opts: { root: string; args: string[] }): ILintStep[] {\n const fix = opts.args[0] === FIX_FLAG;\n const paths = fix ? opts.args.slice(1) : opts.args;\n const whole = paths.length === 0;\n const files = paths.filter(path => LINTED_EXTENSIONS.has(extname(path)));\n\n if (!whole && files.length === 0) {\n return [];\n }\n\n const targets = whole ? ['.'] : files;\n const lintIgnore = LintCommand.readIgnore({ root: opts.root, file: LINT_IGNORE_FILE }).flatMap(\n pattern => ['--ignore-pattern', pattern],\n );\n const formatIgnore = LintCommand.readIgnore({ root: opts.root, file: FORMAT_IGNORE_FILE }).map(\n pattern => `!${pattern}`,\n );\n const unmatched = whole ? [] : ['--no-error-on-unmatched-pattern'];\n const eslintQuiet = whole ? [] : ['--no-warn-ignored'];\n\n return [\n {\n tool: 'oxlint',\n args: [\n '-c',\n LINT_CONFIG,\n ...lintIgnore,\n ...unmatched,\n fix ? FIX_FLAG : '--deny-warnings',\n ...targets,\n ],\n },\n {\n tool: 'eslint',\n args: [\n '-c',\n ESLINT_CONFIG,\n ...ESLINT_CACHE,\n ...eslintQuiet,\n ...lintIgnore,\n ...(fix ? [FIX_FLAG] : []),\n ...targets,\n ],\n },\n {\n tool: 'oxfmt',\n args: [\n '-c',\n FORMAT_CONFIG,\n ...unmatched,\n ...(fix ? [] : ['--check']),\n ...(whole ? [FORMAT_GLOB] : files),\n ...formatIgnore,\n ],\n },\n ];\n }\n\n /** The tool's binary in the nearest `node_modules/.bin`, else its bare name for PATH to find. */\n static resolveTool(opts: { root: string; tool: string }): string {\n let dir = opts.root;\n while (true) {\n const candidate = join(dir, 'node_modules', '.bin', opts.tool);\n if (existsSync(candidate)) {\n return candidate;\n }\n\n const parent = dirname(dir);\n if (parent === dir) {\n return opts.tool;\n }\n dir = parent;\n }\n }\n\n /** Runs the plan in order and stops at the first tool that fails; returns the exit code. */\n static async run(opts: { root: string; args: string[] }): Promise<number> {\n for (const step of LintCommand.plan(opts)) {\n const child = Bun.spawn({\n cmd: [LintCommand.resolveTool({ root: opts.root, tool: step.tool }), ...step.args],\n cwd: opts.root,\n stdio: ['inherit', 'inherit', 'inherit'],\n });\n const exitCode = await child.exited;\n\n if (exitCode !== 0) {\n return exitCode;\n }\n }\n\n return 0;\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import type { OxfmtConfig } from 'oxfmt';
|
|
|
3
3
|
* The oxfmt port of `prettierConfigs` - the same seven options, so the output matches Prettier's.
|
|
4
4
|
*
|
|
5
5
|
* ```ts
|
|
6
|
-
* // .configs/oxfmt.config.mts
|
|
6
|
+
* // .configs/formatters/oxfmt.config.mts
|
|
7
7
|
* import { defineConfig } from 'oxfmt';
|
|
8
8
|
* import { oxfmtConfigs } from '@venizia/dev-configs/formatters';
|
|
9
9
|
*
|
|
@@ -17,7 +17,7 @@ export declare const oxfmtConfigs: OxfmtConfig;
|
|
|
17
17
|
* small. `bracketSameLine` changes nothing outside JSX.
|
|
18
18
|
*
|
|
19
19
|
* ```ts
|
|
20
|
-
* // .configs/oxfmt.config.mts
|
|
20
|
+
* // .configs/formatters/oxfmt.config.mts
|
|
21
21
|
* import { defineConfig } from 'oxfmt';
|
|
22
22
|
* import { browserOxfmtConfigs } from '@venizia/dev-configs/formatters';
|
|
23
23
|
*
|
package/dist/formatters/oxfmt.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.browserOxfmtConfigs = exports.oxfmtConfigs = void 0;
|
|
|
5
5
|
* The oxfmt port of `prettierConfigs` - the same seven options, so the output matches Prettier's.
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
|
-
* // .configs/oxfmt.config.mts
|
|
8
|
+
* // .configs/formatters/oxfmt.config.mts
|
|
9
9
|
* import { defineConfig } from 'oxfmt';
|
|
10
10
|
* import { oxfmtConfigs } from '@venizia/dev-configs/formatters';
|
|
11
11
|
*
|
|
@@ -27,7 +27,7 @@ exports.oxfmtConfigs = {
|
|
|
27
27
|
* small. `bracketSameLine` changes nothing outside JSX.
|
|
28
28
|
*
|
|
29
29
|
* ```ts
|
|
30
|
-
* // .configs/oxfmt.config.mts
|
|
30
|
+
* // .configs/formatters/oxfmt.config.mts
|
|
31
31
|
* import { defineConfig } from 'oxfmt';
|
|
32
32
|
* import { browserOxfmtConfigs } from '@venizia/dev-configs/formatters';
|
|
33
33
|
*
|
|
@@ -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","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
|
+
{"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/formatters/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/formatters/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"]}
|
|
@@ -6,7 +6,7 @@ import { type IOxlintPresetOptions } from './oxlint';
|
|
|
6
6
|
* is relaxed. `ReactOxlintConfigs` builds on this preset. Takes the same options as `OxlintConfigs`.
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
|
-
* // .configs/oxlint.config.mts
|
|
9
|
+
* // .configs/lints/oxlint.config.mts
|
|
10
10
|
* import { defineConfig } from 'oxlint';
|
|
11
11
|
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
12
12
|
*
|
package/dist/linters/browser.js
CHANGED
|
@@ -10,7 +10,7 @@ const rules_1 = require("./rules");
|
|
|
10
10
|
* is relaxed. `ReactOxlintConfigs` builds on this preset. Takes the same options as `OxlintConfigs`.
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
|
-
* // .configs/oxlint.config.mts
|
|
13
|
+
* // .configs/lints/oxlint.config.mts
|
|
14
14
|
* import { defineConfig } from 'oxlint';
|
|
15
15
|
* import { BrowserOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
16
16
|
*
|
|
@@ -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","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
|
+
{"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/lints/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"]}
|
package/dist/linters/eslint.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const eslintConfigs: Linter.Config[];
|
|
|
10
10
|
* next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.
|
|
11
11
|
*
|
|
12
12
|
* ```js
|
|
13
|
-
* // .configs/eslint.config.mjs
|
|
13
|
+
* // .configs/lints/eslint.config.mjs
|
|
14
14
|
* import { namingConventionConfigs } from '@venizia/dev-configs/linters';
|
|
15
15
|
*
|
|
16
16
|
* export default namingConventionConfigs;
|
package/dist/linters/eslint.js
CHANGED
|
@@ -131,7 +131,7 @@ exports.eslintConfigs = (0, config_1.defineConfig)([
|
|
|
131
131
|
* next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.
|
|
132
132
|
*
|
|
133
133
|
* ```js
|
|
134
|
-
* // .configs/eslint.config.mjs
|
|
134
|
+
* // .configs/lints/eslint.config.mjs
|
|
135
135
|
* import { namingConventionConfigs } from '@venizia/dev-configs/linters';
|
|
136
136
|
*
|
|
137
137
|
* export default namingConventionConfigs;
|
|
@@ -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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CAAC,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAE;IAC9F;QACE,KAAK,EAAE,CAAC,uBAAuB,CAAC;QAChC,eAAe,EAAE,EAAE,MAAM,EAAE,2BAAQ,CAAC,MAAuB,EAAE;QAC7D,OAAO,EAAE,EAAE,oBAAoB,EAAE,2BAAQ,CAAC,MAAe,EAAE;QAC3D,4FAA4F;QAC5F,aAAa,EAAE,EAAE,6BAA6B,EAAE,KAAK,EAAE;QACvD,KAAK,EAAE,EAAE,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,EAAE,EAAE;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
|
+
{"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,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,KAAK;IACxB,SAAS,EAAE,KAAK;IAChB,oCAAoC,EAAE,KAAK;IAC3C,4CAA4C,EAAE,KAAK;IACnD,kCAAkC,EAAE,KAAK;IACzC,yCAAyC,EAAE,KAAK;IAChD,yCAAyC,EAAE,KAAK;IAChD,iDAAiD,EAAE,KAAK;IACxD,wCAAwC,EAAE,KAAK;IAC/C,uCAAuC,EAAE,KAAK;IAC9C,+CAA+C,EAAE,KAAK;IACtD,kDAAkD,EAAE,KAAK;IACzD,kDAAkD,EAAE,KAAK;IACzD,mDAAmD,EAAE,KAAK;IAC1D,+BAA+B,EAAE,KAAK;IACtC,0CAA0C,EAAE,KAAK;IACjD,sCAAsC,EAAE,KAAK;IAC7C,+CAA+C,EAAE,KAAK;IACtD,wCAAwC,EAAE,KAAK;CAChD,CAAC;AAEF,kEAAkE;AAClE,MAAM,YAAY,GAAuB;IACvC,cAAc,EAAE,OAAO;IACvB,QAAQ,EAAE,OAAO;IACj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AAK,EAAsB;YACjF,CAAC,+BAAuB,CAAC,IAAI,CAAC,EAAE,+BAAuB,CAAC,KAAK,EAAsB;YACnF,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,EAAsB;YAC7E,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,EAAE;SAC1D;KACF;IACD;QACE,OAAO,EAAE;YACP,kBAAkB;YAClB,WAAW;YACX,WAAW;YACX,UAAU;YACV,aAAa;YACb,mBAAmB;YACnB,eAAe;YACf,oBAAoB;YACpB,gBAAgB;YAChB,kBAAkB;SACnB;KACF;CACF,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACU,QAAA,uBAAuB,GAAoB;IACtD,6FAA6F;IAC7F,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAE;IAC9F;QACE,KAAK,EAAE,CAAC,uBAAuB,CAAC;QAChC,eAAe,EAAE,EAAE,MAAM,EAAE,2BAAQ,CAAC,MAAuB,EAAE;QAC7D,OAAO,EAAE,EAAE,oBAAoB,EAAE,2BAAQ,CAAC,MAAe,EAAE;QAC3D,4FAA4F;QAC5F,aAAa,EAAE,EAAE,6BAA6B,EAAE,KAAK,EAAE;QACvD,KAAK,EAAE,EAAE,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,EAAE,EAAE;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/lints/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"]}
|
|
@@ -4,7 +4,7 @@ import type { Linter } from 'eslint';
|
|
|
4
4
|
* everything oxlint cannot express. Run it next to `oxlintConfigs`.
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
|
-
* // .configs/eslint.config.mjs
|
|
7
|
+
* // .configs/lints/eslint.config.mjs
|
|
8
8
|
* import { houseConfigs } from '@venizia/dev-configs/linters';
|
|
9
9
|
*
|
|
10
10
|
* export default houseConfigs;
|
|
@@ -32,7 +32,7 @@ const houseRuleConfigs = [
|
|
|
32
32
|
* everything oxlint cannot express. Run it next to `oxlintConfigs`.
|
|
33
33
|
*
|
|
34
34
|
* ```js
|
|
35
|
-
* // .configs/eslint.config.mjs
|
|
35
|
+
* // .configs/lints/eslint.config.mjs
|
|
36
36
|
* import { houseConfigs } from '@venizia/dev-configs/linters';
|
|
37
37
|
*
|
|
38
38
|
* export default houseConfigs;
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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/lints/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"]}
|
package/dist/linters/oxlint.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { OxlintConfig } from 'oxlint';
|
|
|
8
8
|
* by `noImplicitThis` in `tsconfig.base.json`). `n/prefer-node-protocol` maps to the unicorn rule.
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
|
-
* // .configs/oxlint.config.mts
|
|
11
|
+
* // .configs/lints/oxlint.config.mts
|
|
12
12
|
* import { defineConfig } from 'oxlint';
|
|
13
13
|
* import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
14
14
|
*
|
|
@@ -37,7 +37,7 @@ export interface IOxlintPresetOptions {
|
|
|
37
37
|
* Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.
|
|
38
38
|
*
|
|
39
39
|
* ```ts
|
|
40
|
-
* // .configs/oxlint.config.mts
|
|
40
|
+
* // .configs/lints/oxlint.config.mts
|
|
41
41
|
* import { defineConfig } from 'oxlint';
|
|
42
42
|
* import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
43
43
|
*
|
package/dist/linters/oxlint.js
CHANGED
|
@@ -15,7 +15,7 @@ const JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES]
|
|
|
15
15
|
* by `noImplicitThis` in `tsconfig.base.json`). `n/prefer-node-protocol` maps to the unicorn rule.
|
|
16
16
|
*
|
|
17
17
|
* ```ts
|
|
18
|
-
* // .configs/oxlint.config.mts
|
|
18
|
+
* // .configs/lints/oxlint.config.mts
|
|
19
19
|
* import { defineConfig } from 'oxlint';
|
|
20
20
|
* import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
21
21
|
*
|
|
@@ -182,7 +182,7 @@ exports.oxlintConfigs = {
|
|
|
182
182
|
* Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.
|
|
183
183
|
*
|
|
184
184
|
* ```ts
|
|
185
|
-
* // .configs/oxlint.config.mts
|
|
185
|
+
* // .configs/lints/oxlint.config.mts
|
|
186
186
|
* import { defineConfig } from 'oxlint';
|
|
187
187
|
* import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
188
188
|
*
|
|
@@ -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,cAAc,EAAE,CAAC,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC;IACzF,KAAK,EAAE;QACL,qBAAqB;QACrB,mBAAmB,EAAE,OAAO;QAC5B,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,OAAO;QACxB,2BAA2B,EAAE,OAAO;QACpC,sBAAsB,EAAE,OAAO;QAC/B,iBAAiB,EAAE,OAAO;QAC1B,qBAAqB,EAAE,OAAO;QAC9B,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,OAAO;QAC1B,+BAA+B,EAAE,OAAO;QACxC,uBAAuB,EAAE,OAAO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AC,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({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AE,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/lints/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/lints/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"]}
|
|
@@ -10,7 +10,7 @@ import type { IOxlintPresetOptions } from './oxlint';
|
|
|
10
10
|
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
|
-
* // .configs/oxlint.config.mts
|
|
13
|
+
* // .configs/lints/oxlint.config.mts
|
|
14
14
|
* import { defineConfig } from 'oxlint';
|
|
15
15
|
* import { ReactOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
16
16
|
*
|
|
@@ -16,7 +16,7 @@ const SOURCE_FILES = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mts',
|
|
|
16
16
|
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
|
-
* // .configs/oxlint.config.mts
|
|
19
|
+
* // .configs/lints/oxlint.config.mts
|
|
20
20
|
* import { defineConfig } from 'oxlint';
|
|
21
21
|
* import { ReactOxlintConfigs } from '@venizia/dev-configs/linters/oxlint';
|
|
22
22
|
*
|
|
@@ -1 +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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AAI,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
|
+
{"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,CA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C/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/lints/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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/dev-configs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
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",
|
|
@@ -58,6 +58,9 @@
|
|
|
58
58
|
"url": "https://venizia.ai"
|
|
59
59
|
},
|
|
60
60
|
"license": "MIT",
|
|
61
|
+
"bin": {
|
|
62
|
+
"devz": "./dist/cli/index.js"
|
|
63
|
+
},
|
|
61
64
|
"engines": {
|
|
62
65
|
"bun": ">=1.4"
|
|
63
66
|
},
|