mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix(site): add astro check CI and reduce errors/hints (#1109)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
01c4c60848
commit
c3984f74d1
@@ -73,7 +73,7 @@ export function extractDefaultProps(
|
||||
|
||||
const defaultProps: Record<string, string> = {};
|
||||
|
||||
function visit(node: ts.Node) {
|
||||
const visit = (node: ts.Node) => {
|
||||
// Look for class declaration
|
||||
if (ts.isClassDeclaration(node) && node.name?.text === `${componentName}Core`) {
|
||||
for (const member of node.members) {
|
||||
@@ -103,7 +103,7 @@ export function extractDefaultProps(
|
||||
}
|
||||
|
||||
ts.forEachChild(node, visit);
|
||||
}
|
||||
};
|
||||
|
||||
visit(sourceFile);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export function extractCSSVars(filePath: string, program: ts.Program, componentN
|
||||
const vars: Array<{ name: string; description: string }> = [];
|
||||
const expectedName = `${componentName}CSSVars`;
|
||||
|
||||
function visit(node: ts.Node) {
|
||||
const visit = (node: ts.Node) => {
|
||||
if (ts.isVariableStatement(node)) {
|
||||
for (const decl of node.declarationList.declarations) {
|
||||
if (!ts.isIdentifier(decl.name) || decl.name.text !== expectedName || !decl.initializer) {
|
||||
@@ -74,7 +74,7 @@ export function extractCSSVars(filePath: string, program: ts.Program, componentN
|
||||
}
|
||||
|
||||
ts.forEachChild(node, visit);
|
||||
}
|
||||
};
|
||||
|
||||
visit(sourceFile);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export function extractDataAttrs(
|
||||
// Common naming patterns for data attributes exports
|
||||
const possibleNames = [`${componentName}DataAttrs`, `${componentName}DataAttributes`];
|
||||
|
||||
function visit(node: ts.Node) {
|
||||
const visit = (node: ts.Node) => {
|
||||
// Look for variable declaration like: export const PlayButtonDataAttrs = { ... }
|
||||
if (ts.isVariableStatement(node)) {
|
||||
for (const decl of node.declarationList.declarations) {
|
||||
@@ -136,7 +136,7 @@ export function extractDataAttrs(
|
||||
}
|
||||
|
||||
ts.forEachChild(node, visit);
|
||||
}
|
||||
};
|
||||
|
||||
visit(sourceFile);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ export function formatProperties(props: tae.PropertyNode[], allExports?: tae.Exp
|
||||
|
||||
const entry: PropDef = { type: abbreviated ?? expandedType };
|
||||
if (abbreviated && expandedType !== abbreviated) entry.detailedType = expandedType;
|
||||
if (prop.documentation?.defaultValue !== undefined) entry.default = prop.documentation.defaultValue;
|
||||
if (prop.documentation?.defaultValue !== undefined) entry.default = String(prop.documentation.defaultValue);
|
||||
if (!prop.optional) entry.required = true;
|
||||
if (prop.documentation?.description !== undefined) entry.description = prop.documentation.description;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -8,6 +8,6 @@ interface HtmlPlayerOptions {
|
||||
}
|
||||
|
||||
/** Create an HTML player instance. */
|
||||
export function createPlayer(options: HtmlPlayerOptions): HtmlPlayerInstance {
|
||||
export function createPlayer(_options: HtmlPlayerOptions): HtmlPlayerInstance {
|
||||
return {} as HtmlPlayerInstance;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -11,6 +11,6 @@ interface StoreState {
|
||||
/** Access the player store or select state from it. */
|
||||
export function usePlayer(): PlayerStore;
|
||||
export function usePlayer<R>(selector: (state: StoreState) => R): R;
|
||||
export function usePlayer<R>(selector?: (state: StoreState) => R): PlayerStore | R {
|
||||
export function usePlayer<R>(_selector?: (state: StoreState) => R): PlayerStore | R {
|
||||
return {} as PlayerStore | R;
|
||||
}
|
||||
|
||||
site/scripts/api-docs-builder/src/tests/fixtures/monorepo/packages/react/src/player/create-player.ts
Vendored
+1
-1
@@ -8,6 +8,6 @@ interface PlayerOptions {
|
||||
}
|
||||
|
||||
/** Create a React player instance. */
|
||||
export function createPlayer(options?: PlayerOptions): PlayerInstance {
|
||||
export function createPlayer(_options?: PlayerOptions): PlayerInstance {
|
||||
return {} as PlayerInstance;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ export class SnapshotController<S, R = S> implements ReactiveController {
|
||||
* @param state - The store to snapshot.
|
||||
*/
|
||||
constructor(host: ReactiveControllerHost, state: Store<S>);
|
||||
constructor(host: ReactiveControllerHost, state: Store<S>, selector?: (state: S) => R) {
|
||||
constructor(host: ReactiveControllerHost, _state: Store<S>, _selector?: (state: S) => R) {
|
||||
host.addController(this);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -5,6 +5,6 @@ interface Store<S> {
|
||||
/** Subscribe to a store. */
|
||||
export function useStore<S>(store: Store<S>): S;
|
||||
export function useStore<S, R>(store: Store<S>, selector: (state: S) => R): R;
|
||||
export function useStore<S, R>(store: Store<S>, selector?: (state: S) => R): S | R {
|
||||
export function useStore<S, R>(_store: Store<S>, _selector?: (state: S) => R): S | R {
|
||||
return {} as S | R;
|
||||
}
|
||||
|
||||
@@ -395,12 +395,15 @@ function extractPublicMembers(
|
||||
for (const member of classDecl.members) {
|
||||
// Skip private, protected, static, constructor
|
||||
if (
|
||||
member.modifiers?.some(
|
||||
(m) =>
|
||||
m.kind === ts.SyntaxKind.PrivateKeyword ||
|
||||
m.kind === ts.SyntaxKind.ProtectedKeyword ||
|
||||
m.kind === ts.SyntaxKind.StaticKeyword
|
||||
)
|
||||
ts.canHaveModifiers(member) &&
|
||||
ts
|
||||
.getModifiers(member)
|
||||
?.some(
|
||||
(m: ts.ModifierLike) =>
|
||||
m.kind === ts.SyntaxKind.PrivateKeyword ||
|
||||
m.kind === ts.SyntaxKind.ProtectedKeyword ||
|
||||
m.kind === ts.SyntaxKind.StaticKeyword
|
||||
)
|
||||
)
|
||||
continue;
|
||||
|
||||
@@ -502,7 +505,7 @@ function getNodeJSDoc(node: ts.Node): string | undefined {
|
||||
if (typeof doc.comment === 'string') return doc.comment;
|
||||
|
||||
// Handle JSDocComment array
|
||||
return doc.comment.map((c: ts.JSDocText | ts.JSDocLink) => ('text' in c ? c.text : '')).join('');
|
||||
return doc.comment.map((c: ts.JSDocComment) => ('text' in c ? c.text : '')).join('');
|
||||
}
|
||||
|
||||
function getJSDocParamDescription(node: ts.Node, paramName: string): string | undefined {
|
||||
@@ -517,7 +520,7 @@ function getJSDocParamDescription(node: ts.Node, paramName: string): string | un
|
||||
const raw =
|
||||
typeof tag.comment === 'string'
|
||||
? tag.comment
|
||||
: tag.comment.map((c: ts.JSDocText | ts.JSDocLink) => ('text' in c ? c.text : '')).join('');
|
||||
: tag.comment.map((c: ts.JSDocComment) => ('text' in c ? c.text : '')).join('');
|
||||
return raw.replace(/^\s*-\s+/, '');
|
||||
}
|
||||
}
|
||||
@@ -550,7 +553,7 @@ function getJSDocTagValue(node: ts.Node, tagName: string): string | undefined {
|
||||
if (!tag.comment) return undefined;
|
||||
if (typeof tag.comment === 'string') return tag.comment.trim();
|
||||
return tag.comment
|
||||
.map((c: ts.JSDocText | ts.JSDocLink) => ('text' in c ? c.text : ''))
|
||||
.map((c: ts.JSDocComment) => ('text' in c ? c.text : ''))
|
||||
.join('')
|
||||
.trim();
|
||||
}
|
||||
@@ -947,7 +950,7 @@ function discoverUtilExports(monorepoRoot: string, program: ts.Program): UtilEnt
|
||||
for (const modulePath of modulesToScan) {
|
||||
if (!fs.existsSync(modulePath)) continue;
|
||||
|
||||
let ast: tae.Module;
|
||||
let ast: tae.ModuleNode;
|
||||
try {
|
||||
ast = tae.parseFromProgram(modulePath, program);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user