@vvedantb/config 0.15.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +2 -1
- package/dist/android-release-cli.js +0 -40
- package/dist/android-release-version.d.ts +0 -20
- package/dist/android-release-version.js +0 -15
- package/dist/android-release.d.ts +0 -54
- package/dist/android-release.js +0 -20
- package/dist/check-asar-cli.js +0 -1
- package/dist/check-asar.d.ts +0 -2
- package/dist/check-asar.js +0 -7
- package/dist/check-no-comments.js +2 -3
- package/dist/check-no-source-text.js +0 -1
- package/dist/check-shared-ui.d.ts +0 -12
- package/dist/check-shared-ui.js +0 -1
- package/dist/clerk-allow.js +0 -6
- package/dist/doctor.d.ts +0 -7
- package/dist/doctor.js +0 -14
- package/dist/expo.d.ts +0 -14
- package/dist/expo.js +0 -5
- package/dist/extension.d.ts +0 -18
- package/dist/extension.js +0 -2
- package/dist/oxlint-anti-slop/define.js +0 -2
- package/dist/oxlint-anti-slop/index.d.ts +0 -1
- package/dist/oxlint-anti-slop/index.js +0 -1
- package/dist/release-signing.d.ts +0 -36
- package/dist/release-signing.js +0 -7
- package/dist/sync.d.ts +0 -3
- package/dist/versions.d.ts +0 -2
- package/dist/versions.js +0 -2
- package/dist/vite.d.ts +0 -16
- package/dist/vitest-shared-setup.js +0 -8
- package/dist/vitest-shared.d.ts +0 -9
- package/dist/vitest-shared.js +0 -15
- package/oxlint/base.json +7 -1
- package/oxlint/plugin.mjs +2 -20
- package/oxlint/rules/no-comments.mjs +142 -0
- package/oxlint/rules/no-conditional-tests.mjs +0 -2
- package/oxlint/rules/no-double-cast.mjs +0 -1
- package/oxlint/rules/no-inline-zod-schema.mjs +0 -3
- package/oxlint/rules/no-is-record.mjs +0 -5
- package/oxlint/rules/no-json-parse.mjs +0 -6
- package/oxlint/rules/no-settings-description.mjs +0 -5
- package/oxlint/rules/no-source-text-in-tests.mjs +0 -7
- package/oxlint/rules/no-unknown-shape-probing.mjs +0 -6
- package/oxlint/rules/no-value-block-in-try.mjs +0 -23
- package/oxlint/rules/prefer-schema-inferred-types.mjs +0 -5
- package/oxlint/utils.mjs +0 -2
- package/package.json +1 -1
|
@@ -44,7 +44,6 @@ const isBlockInsideFunction = (block) => {
|
|
|
44
44
|
);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
/** Module scope = not inside functions/methods/control-flow blocks. */
|
|
48
47
|
const isAtModuleScope = (node) => {
|
|
49
48
|
let current = node.parent;
|
|
50
49
|
while (current && current.type !== "Program") {
|
|
@@ -52,7 +51,6 @@ const isAtModuleScope = (node) => {
|
|
|
52
51
|
if (current.type === "BlockStatement" && isBlockInsideFunction(current)) {
|
|
53
52
|
return false;
|
|
54
53
|
}
|
|
55
|
-
// Chained schema methods: z.string().optional().catch(null)
|
|
56
54
|
if (
|
|
57
55
|
current.type === "MemberExpression" &&
|
|
58
56
|
current.parent?.type === "CallExpression"
|
|
@@ -65,7 +63,6 @@ const isAtModuleScope = (node) => {
|
|
|
65
63
|
return current?.type === "Program";
|
|
66
64
|
};
|
|
67
65
|
|
|
68
|
-
/** True if expression is `z.<method>(...)` or chained `z.object(...).strict()`. */
|
|
69
66
|
const isZodSchemaExpression = (node) => {
|
|
70
67
|
if (node?.type !== "CallExpression") return false;
|
|
71
68
|
const callee = node.callee;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message shown when the banned `isRecord` identifier is found anywhere. It is
|
|
3
|
-
* deliberately written as an instruction to whoever (human or agent) is editing
|
|
4
|
-
* the code: the generic `unknown`-narrowing guard is a symptom, not the fix.
|
|
5
|
-
*/
|
|
6
1
|
const message =
|
|
7
2
|
"BANNED: `isRecord`. If you are writing or using `isRecord`, an `unknown` has " +
|
|
8
3
|
"leaked somewhere it should never reach — that `unknown` is the actual bug. " +
|
|
@@ -41,9 +41,6 @@ export default {
|
|
|
41
41
|
create(context) {
|
|
42
42
|
const allowUnknown = context.options?.[0]?.allowUnknownEscapeHatch === true;
|
|
43
43
|
const message = allowUnknown ? lenientMessage : strictMessage;
|
|
44
|
-
// JSON.parse nodes that sit in a disciplined position. Enclosing nodes are
|
|
45
|
-
// visited before the inner JSON.parse (top-down), so this is populated in
|
|
46
|
-
// time for the check below.
|
|
47
44
|
const allowed = new Set();
|
|
48
45
|
const allow = (node) => {
|
|
49
46
|
if (isJsonParse(node)) allowed.add(node);
|
|
@@ -52,7 +49,6 @@ export default {
|
|
|
52
49
|
const visitors = {
|
|
53
50
|
CallExpression(node) {
|
|
54
51
|
const callee = node.callee;
|
|
55
|
-
// `schema.safeParse(JSON.parse(...))` / `schema.parse(JSON.parse(...))`
|
|
56
52
|
if (
|
|
57
53
|
callee?.type === "MemberExpression" &&
|
|
58
54
|
!isIdentifier(callee.object, "JSON") &&
|
|
@@ -69,13 +65,11 @@ export default {
|
|
|
69
65
|
};
|
|
70
66
|
|
|
71
67
|
if (allowUnknown) {
|
|
72
|
-
// `const x: unknown = JSON.parse(...)`
|
|
73
68
|
visitors.VariableDeclarator = (node) => {
|
|
74
69
|
if (isUnknownKeyword(node.id?.typeAnnotation?.typeAnnotation)) {
|
|
75
70
|
allow(node.init);
|
|
76
71
|
}
|
|
77
72
|
};
|
|
78
|
-
// `JSON.parse(...) as unknown`
|
|
79
73
|
visitors.TSAsExpression = (node) => {
|
|
80
74
|
if (isUnknownKeyword(node.typeAnnotation)) allow(node.expression);
|
|
81
75
|
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// Flags a `description` prop on the settings layout components. A section or
|
|
2
|
-
// row shows a title only; helper text under it is extra reading for the user.
|
|
3
|
-
// Options: `{ "components": ["ProfileCard"] }` adds component names to the
|
|
4
|
-
// built-in list.
|
|
5
|
-
|
|
6
1
|
const DEFAULT_COMPONENTS = ["SettingsSection", "SettingsToggleRow", "LabeledSwitchRow"];
|
|
7
2
|
|
|
8
3
|
function elementName(name) {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message shown when a test reads a repo source file. Written as an
|
|
3
|
-
* instruction to whoever (human or agent) is editing the test.
|
|
4
|
-
*/
|
|
5
1
|
const message =
|
|
6
2
|
"BANNED: tests that read source files as text. A regex over source breaks " +
|
|
7
3
|
"on every refactor and passes on real logic bugs. Import the code and assert " +
|
|
@@ -10,9 +6,7 @@ const message =
|
|
|
10
6
|
|
|
11
7
|
const TEST_FILE =
|
|
12
8
|
/(\.(test|spec)\.[cm]?[jt]sx?$)|(\/__tests__\/)|(\/tests\/[^/]+\.[cm]?[jt]sx?$)/;
|
|
13
|
-
/** A path or file name ending in a source extension, not a bare extension. */
|
|
14
9
|
const SOURCE_PATH = /[^/.][^/]*\.(ts|tsx|mts|css|html)$/;
|
|
15
|
-
/** File reads, plus helpers that wrap them (`read`, `readSource`, `sourceOf`). */
|
|
16
10
|
const READ_CALL = /^(read|source)|Source$/;
|
|
17
11
|
|
|
18
12
|
function calleeName(call) {
|
|
@@ -24,7 +18,6 @@ function calleeName(call) {
|
|
|
24
18
|
return "";
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
/** True when the string is (part of) an argument to a file-read call. */
|
|
28
21
|
function isReadArgument(node) {
|
|
29
22
|
let child = node;
|
|
30
23
|
for (let parent = node.parent; parent; parent = parent.parent) {
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { isIdentifier } from "../utils.mjs";
|
|
2
2
|
|
|
3
|
-
// NOTE: intentionally does NOT flag `"key" in x`. In this codebase `in` is the
|
|
4
|
-
// idiomatic, sanctioned way to narrow discriminated unions (`"error" in auth`),
|
|
5
|
-
// walk Errors (`"code" in err`), and refine typed SDK unions (Notion, TipTap) —
|
|
6
|
-
// the eslint `isRecord` ban explicitly prefers that over `Reflect.get` ceremony.
|
|
7
|
-
// Only `Reflect.get` (dynamic property access that defeats the type system in
|
|
8
|
-
// domain code) is flagged here.
|
|
9
3
|
const message =
|
|
10
4
|
"Do not use `Reflect.get` to read properties in domain code. Narrow a typed " +
|
|
11
5
|
"value directly, or parse external input at its boundary with a zod schema " +
|
|
@@ -27,14 +27,12 @@ const noCatchMessage =
|
|
|
27
27
|
"It cannot compile a `try` without a `catch`. Add a `catch` clause — use " +
|
|
28
28
|
"`catch { }` if there is genuinely nothing to handle.";
|
|
29
29
|
|
|
30
|
-
/** Value blocks: expression-level control flow the compiler cannot lower here. */
|
|
31
30
|
const VALUE_BLOCKS = new Set([
|
|
32
31
|
"ConditionalExpression",
|
|
33
32
|
"LogicalExpression",
|
|
34
33
|
"ChainExpression",
|
|
35
34
|
]);
|
|
36
35
|
|
|
37
|
-
/** Loops bail too — their test expression is itself lowered as a value block. */
|
|
38
36
|
const LOOPS = new Set([
|
|
39
37
|
"ForStatement",
|
|
40
38
|
"ForInStatement",
|
|
@@ -43,7 +41,6 @@ const LOOPS = new Set([
|
|
|
43
41
|
"DoWhileStatement",
|
|
44
42
|
]);
|
|
45
43
|
|
|
46
|
-
/** `&&=` / `||=` / `??=` desugar to a value block just like their operators. */
|
|
47
44
|
const LOGICAL_ASSIGN = new Set(["&&=", "||=", "??="]);
|
|
48
45
|
|
|
49
46
|
const FUNCTIONS = new Set([
|
|
@@ -52,10 +49,8 @@ const FUNCTIONS = new Set([
|
|
|
52
49
|
"ArrowFunctionExpression",
|
|
53
50
|
]);
|
|
54
51
|
|
|
55
|
-
/** Wrappers that keep the component name on the outer binding. */
|
|
56
52
|
const NAME_PRESERVING_CALLS = new Set(["memo", "forwardRef", "observer"]);
|
|
57
53
|
|
|
58
|
-
/** React Compiler only lowers components (`Foo`) and hooks (`useFoo`). */
|
|
59
54
|
const isCompiledName = (name) =>
|
|
60
55
|
typeof name === "string" && /^(use[A-Z]|[A-Z])/.test(name);
|
|
61
56
|
|
|
@@ -63,13 +58,11 @@ function isOffending(node) {
|
|
|
63
58
|
if (VALUE_BLOCKS.has(node.type)) return true;
|
|
64
59
|
if (LOOPS.has(node.type)) return true;
|
|
65
60
|
if (node.type === "AssignmentExpression") return LOGICAL_ASSIGN.has(node.operator);
|
|
66
|
-
// Optional chaining, when the parser emits no wrapping ChainExpression.
|
|
67
61
|
if (node.type === "MemberExpression" || node.type === "CallExpression")
|
|
68
62
|
return node.optional === true;
|
|
69
63
|
return false;
|
|
70
64
|
}
|
|
71
65
|
|
|
72
|
-
/** Generic child iteration, so no per-node-type traversal table is needed. */
|
|
73
66
|
function* children(node) {
|
|
74
67
|
for (const key of Object.keys(node)) {
|
|
75
68
|
if (key === "parent") continue;
|
|
@@ -82,10 +75,6 @@ function* children(node) {
|
|
|
82
75
|
}
|
|
83
76
|
}
|
|
84
77
|
|
|
85
|
-
/**
|
|
86
|
-
* Report every value block or loop directly in a bailing block, stopping at
|
|
87
|
-
* nested function boundaries — those get their own lowering and do not bail.
|
|
88
|
-
*/
|
|
89
78
|
function scanTryBlock(node, report) {
|
|
90
79
|
if (!node || FUNCTIONS.has(node.type)) return;
|
|
91
80
|
if (node.type === "ThrowStatement") report(node, throwMessage);
|
|
@@ -93,11 +82,6 @@ function scanTryBlock(node, report) {
|
|
|
93
82
|
for (const child of children(node)) scanTryBlock(child, report);
|
|
94
83
|
}
|
|
95
84
|
|
|
96
|
-
/**
|
|
97
|
-
* Walk looking for `try` statements, tracking whether we are inside a function
|
|
98
|
-
* React Compiler actually compiles. `compiled` latches on: everything lexically
|
|
99
|
-
* within a component or hook is lowered as part of it.
|
|
100
|
-
*/
|
|
101
85
|
function walk(node, report, compiled, nameHint) {
|
|
102
86
|
if (FUNCTIONS.has(node.type)) {
|
|
103
87
|
const name = node.id?.name ?? nameHint;
|
|
@@ -107,17 +91,11 @@ function walk(node, report, compiled, nameHint) {
|
|
|
107
91
|
}
|
|
108
92
|
|
|
109
93
|
if (node.type === "TryStatement" && compiled) {
|
|
110
|
-
// A finalizer or a missing catch bails on its own, whatever the contents,
|
|
111
|
-
// so those are reported against the clause rather than scanned.
|
|
112
94
|
if (node.finalizer) report(node.finalizer, finallyMessage);
|
|
113
95
|
if (!node.handler) report(node, noCatchMessage);
|
|
114
96
|
scanTryBlock(node.block, report);
|
|
115
|
-
// Still descend: the catch body, and nested functions anywhere in the
|
|
116
|
-
// statement, can hold their own `try` blocks.
|
|
117
97
|
}
|
|
118
98
|
|
|
119
|
-
// Carry the binding name onto the function it names, so `const Foo = () => {}`
|
|
120
|
-
// and `const Foo = memo(() => {})` are both recognised as components.
|
|
121
99
|
let hint = null;
|
|
122
100
|
if (node.type === "VariableDeclarator") hint = node.id?.name;
|
|
123
101
|
else if (node.type === "PropertyDefinition" || node.type === "Property")
|
|
@@ -150,7 +128,6 @@ export default {
|
|
|
150
128
|
|
|
151
129
|
return {
|
|
152
130
|
Program(program) {
|
|
153
|
-
// Whole-file opt-out; nothing in the file is compiled.
|
|
154
131
|
const optedOut = (program.body ?? []).some(
|
|
155
132
|
(statement) =>
|
|
156
133
|
statement.type === "ExpressionStatement" &&
|
|
@@ -12,14 +12,11 @@ const schemaBaseName = (name) => {
|
|
|
12
12
|
return base.length > 0 && base !== name ? base : undefined;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
/** True if expression is `z.<method>(...)` or nested `z.object(...).…`. */
|
|
16
15
|
const isZodSchemaExpression = (node) => {
|
|
17
16
|
if (node?.type !== "CallExpression") return false;
|
|
18
17
|
const callee = node.callee;
|
|
19
18
|
if (callee?.type === "MemberExpression") {
|
|
20
|
-
// z.object / z.array / z.string / …
|
|
21
19
|
if (isIdentifier(callee.object, "z")) return true;
|
|
22
|
-
// chained: z.object(...).strict() etc — walk left
|
|
23
20
|
return isZodSchemaExpression(callee.object);
|
|
24
21
|
}
|
|
25
22
|
return false;
|
|
@@ -29,7 +26,6 @@ const isObjectTypeAlias = (node) =>
|
|
|
29
26
|
node.typeAnnotation?.type === "TSTypeLiteral";
|
|
30
27
|
|
|
31
28
|
const isZodInferredType = (node) => {
|
|
32
|
-
// type X = z.infer<typeof schema>
|
|
33
29
|
const ann = node.typeAnnotation;
|
|
34
30
|
if (ann?.type !== "TSTypeReference") return false;
|
|
35
31
|
const nameNode = ann.typeName;
|
|
@@ -55,7 +51,6 @@ export default {
|
|
|
55
51
|
if (!isIdentifier(node.id) || !isZodSchemaExpression(node.init)) return;
|
|
56
52
|
const base = schemaBaseName(node.id.name);
|
|
57
53
|
if (base) schemaBases.add(base);
|
|
58
|
-
// Also accept camelCase: fooSchema → Foo (case-insensitive match later)
|
|
59
54
|
schemaBases.add(node.id.name.replace(schemaSuffixPattern, ""));
|
|
60
55
|
},
|
|
61
56
|
TSInterfaceDeclaration(node) {
|
package/oxlint/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared tsconfig bases, oxlint base, Vite, Vitest, Babel and Metro presets, a WXT preset and host-permission helper for Chrome extensions, pinned tool versions, a sync CLI for Claude commands, CLAUDE.md, Cursor environment and Convex tsconfig, a packaged Electron app.asar module check, a shared header and footer check, a no-source-text-in-tests check, a no-comments check with a ratchet baseline, shared oxlint JS plugins and a CLI that adds an extension to Clerk's allowed origins.",
|
|
6
6
|
"type": "module",
|