Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
398 changes: 199 additions & 199 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/auth/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function buildTokenData(response, existingUser = null) {
* @returns {{ valid: boolean, error: Error|null }}
*/
export function validateTokens(auth, requiredField = 'accessToken') {
if (!auth || !auth[requiredField]) {
if (!auth?.[requiredField]) {
let message =
requiredField === 'refreshToken'
? 'No refresh token found. Please run "vizzly login" first.'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function logoutCommand(options = {}, globalOptions = {}) {
// Check if user is logged in
let auth = await getAuthTokens();

if (!auth || !auth.accessToken) {
if (!auth?.accessToken) {
if (globalOptions.json) {
output.data({ loggedOut: false, reason: 'not_logged_in' });
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/whoami.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function whoamiCommand(options = {}, globalOptions = {}) {
// Check if user is logged in
let auth = await getAuthTokens();

if (!auth || !auth.accessToken) {
if (!auth?.accessToken) {
if (globalOptions.json) {
output.data({ authenticated: false });
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/config/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export function serializeConfig(config, filepath) {
* @returns {{ config: Object|null, filepath: string|null }}
*/
export function extractCosmiconfigResult(result) {
if (!result || !result.config) {
if (!result?.config) {
return { config: null, filepath: null };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function ScreenshotDisplay({
const container = screenshotContainerRef.current;
const image = container?.querySelector('img');

if (!container || !image || !image.naturalWidth) return;
if (!container || !image?.naturalWidth) return;

// Always track natural size for overflow calculations
setNaturalImageSize({
Expand Down
2 changes: 1 addition & 1 deletion src/reporter/src/components/static-report-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ function Header({ timestamp }) {
}

export default function StaticReportView({ reportData }) {
if (!reportData || !reportData.comparisons) {
if (!reportData?.comparisons) {
return (
<div className="min-h-screen bg-slate-900 text-white flex items-center justify-center">
<div className="text-center">
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class VizzlySDK extends EventEmitter {
* @throws {VizzlyError} When file cannot be read due to permissions or I/O errors
*/
async screenshot(name, imageBuffer, options = {}) {
if (!this.server || !this.server.isRunning()) {
if (!this.server?.isRunning()) {
throw new VizzlyError(
'Server not running. Call start() first.',
'SERVER_NOT_RUNNING'
Expand Down
6 changes: 1 addition & 5 deletions src/tdd/core/hotspot-coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ export function calculateHotspotCoverage(diffClusters, hotspotAnalysis) {
return { coverage: 0, linesInHotspots: 0, totalLines: 0 };
}

if (
!hotspotAnalysis ||
!hotspotAnalysis.regions ||
hotspotAnalysis.regions.length === 0
) {
if (!hotspotAnalysis?.regions || hotspotAnalysis.regions.length === 0) {
return { coverage: 0, linesInHotspots: 0, totalLines: 0 };
}

Expand Down
2 changes: 1 addition & 1 deletion src/tdd/services/hotspot-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function downloadHotspots(options) {
try {
let response = await api.getHotspots(screenshotNames);

if (!response || !response.hotspots) {
if (!response?.hotspots) {
return { success: false, error: 'API returned no hotspot data' };
}

Expand Down
2 changes: 1 addition & 1 deletion src/tdd/services/region-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function downloadRegions(options) {
try {
let response = await api.getRegions(screenshotNames, { includeCandidates });

if (!response || !response.regions) {
if (!response?.regions) {
return { success: false, error: 'API returned no region data' };
}

Expand Down
14 changes: 7 additions & 7 deletions src/types/sdk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import { EventEmitter } from 'node:events';

// Re-export common types
export {
VizzlyConfig,
ScreenshotOptions,
UploadOptions,
UploadResult,
BaselineData,
ComparisonResult,
OutputUtils,
ScreenshotOptions,
TddResults,
BaselineData,
Uploader,
TddService,
OutputUtils,
Uploader,
UploadOptions,
UploadResult,
VizzlyConfig,
} from './index';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/utils/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function supportsColorDefault() {
}

// If stdout is not a TTY, assume no color
if (!process.stdout || !process.stdout.isTTY) return false;
if (!process.stdout?.isTTY) return false;

// Prefer getColorDepth when available
try {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/global-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export async function getUserPath() {
export async function getAuthTokens() {
const config = await loadGlobalConfig();

if (!config.auth || !config.auth.accessToken) {
if (!config.auth?.accessToken) {
return null;
}

Expand Down Expand Up @@ -175,7 +175,7 @@ export async function clearAuthTokens() {
export async function hasValidTokens() {
const auth = await getAuthTokens();

if (!auth || !auth.accessToken) {
if (!auth?.accessToken) {
return false;
}

Expand Down
Loading