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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createElement as preactH } from 'preact';
import React, { createElement, render, cloneElement } from 'preact/compat';
import { createElement, render, cloneElement } from 'preact/compat';
import { setupScratch, teardown } from '../../../test/_util/helpers';

describe('compat cloneElement', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { vnodeSpy, eventSpy } from '../../../test/_util/optionSpies';
import React, {
import {
createElement,
render,
Component,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { render, Component } from 'preact/compat';
import { createElement, render, Component } from 'preact/compat';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { act } from 'preact/test-utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { setupRerender } from 'preact/test-utils';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import React, {
import {
render,
createElement,
Fragment,
createContext,
Component,
useState,
Expand Down Expand Up @@ -45,7 +46,7 @@ describe('components', () => {
}

/**
* @extends {React.Component<{children: any}, {location: string}>}
* @extends {Component<{children: any}, {location: string}>}
*/
class Router extends Component {
constructor(props) {
Expand All @@ -70,7 +71,7 @@ describe('components', () => {
}

/**
* @extends {React.Component<{children: any}>}
* @extends {Component<{children: any}>}
*/
class Route extends Component {
render() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createElement, render } from 'preact/compat';
import { createElement, render } from 'preact/compat';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { getSymbol } from './testUtils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { render, createElement, createFactory } from 'preact/compat';
import { render, createElement, createFactory } from 'preact/compat';
import { setupScratch, teardown } from '../../../test/_util/helpers';

describe('createFactory', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
supportsPassiveEvents
} from '../../../test/_util/helpers';

import React, { createElement } from 'preact/compat';
import { createElement } from 'preact/compat';
import { vi } from 'vitest';

describe('preact/compat events', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {
import {
createElement,
render,
createRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext } from 'preact';
import React, {
import {
createElement,
useDeferredValue,
useInsertionEffect,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { hydrate } from 'preact/compat';
import { createElement, hydrate } from 'preact/compat';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { vi } from 'vitest';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { setupScratch, teardown } from '../../../test/_util/helpers';
import React, { createElement, render } from 'preact/compat';
import { createElement, render } from 'preact/compat';

describe('Select', () => {
let scratch;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { render, hydrate, useState } from 'preact/compat';
import React, { createElement, render, hydrate, useState } from 'preact/compat';
import ReactDOMServer from 'preact/compat/server';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { act } from 'preact/test-utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'preact/debug';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */

// This test is not part of component-stack.test.js to avoid it being
// transpiled with '@babel/plugin-transform-react-jsx-source' enabled.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'preact/debug';
import { vi } from 'vitest';
import { setupScratch, teardown } from '../../../test/_util/helpers';

/** @jsx createElement */

describe('component stack', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { forwardRef, createPortal } from 'preact/compat';
import { vi } from 'vitest';

const h = createElement;
/** @jsx createElement */

describe('debug compat', () => {
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { act } from 'preact/test-utils';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */

describe('debug with hooks', () => {
let scratch;
let errors = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
} from '../../../test/_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */

describe('debug with suspense', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import 'preact/debug';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */

describe('debug options', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { setupRerender } from 'preact/test-utils';
import { vi } from 'vitest';

const h = createElement;
/** @jsx createElement */

describe('debug', () => {
/** @type {HTMLDivElement} */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { createElement, Component } from 'preact';
import { serializeVNode } from '../../src/debug';

/** @jsx createElement */

describe('serializeVNode', () => {
it("should prefer a function component's displayName", () => {
function Foo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { setupScratch, teardown } from '../../../test/_util/helpers';
import 'preact/debug';
import { vi } from 'vitest';

/** @jsx createElement */

describe('Hook argument validation', () => {
/**
* @param {string} name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { useState } from 'preact/hooks';
import { addHookName } from 'preact/devtools';
import { vi } from 'vitest';

/** @jsx createElement */

describe('addHookName', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import {
import { scheduleEffectAssert } from '../_util/useEffectUtil';
import { vi } from 'vitest';

/** @jsx createElement */

describe('combinations', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { act } from 'preact/test-utils';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { useEffect } from 'preact/hooks';

/** @jsx createElement */

describe('errorInfo', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { useErrorBoundary, useLayoutEffect, useState } from 'preact/hooks';
import { setupRerender } from 'preact/test-utils';
import { vi } from 'vitest';

/** @jsx createElement */

describe('errorBoundary', () => {
/** @type {HTMLDivElement} */
let scratch, rerender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import {
} from 'preact/hooks';
import { vi } from 'vitest';

/** @jsx createElement */

describe('hook options', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { createElement, render } from 'preact';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { useCallback } from 'preact/hooks';

/** @jsx createElement */

describe('useCallback', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { setupScratch, teardown } from '../../../test/_util/helpers';
import { useContext, useEffect, useState } from 'preact/hooks';
import { vi } from 'vitest';

/** @jsx createElement */

describe('useContext', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { setupScratch, teardown } from '../../../test/_util/helpers';
import { useDebugValue, useState } from 'preact/hooks';
import { vi } from 'vitest';

/** @jsx createElement */

describe('useDebugValue', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { useEffectAssertions } from './useEffectAssertions';
import { scheduleEffectAssert } from '../_util/useEffectUtil';
import { vi } from 'vitest';

/** @jsx createElement */

describe('useEffect', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { createElement, render } from 'preact';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */

// Common behaviors between all effect hooks
export function useEffectAssertions(useEffect, scheduleEffectAssert) {
/** @type {HTMLDivElement} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { setupRerender } from 'preact/test-utils';
import { render as rts } from 'preact-render-to-string';
import { setupScratch, teardown } from '../../../test/_util/helpers';

/** @jsx createElement */

describe('useId', () => {
/** @type {HTMLDivElement} */
let scratch, rerender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { useImperativeHandle, useRef, useState } from 'preact/hooks';
import { setupRerender } from 'preact/test-utils';
import { vi } from 'vitest';

/** @jsx createElement */

describe('useImperativeHandle', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { useEffectAssertions } from './useEffectAssertions';
import { useLayoutEffect, useRef, useState } from 'preact/hooks';
import { vi } from 'vitest';

/** @jsx createElement */

describe('useLayoutEffect', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { useMemo, useState } from 'preact/hooks';
import { act } from 'preact/test-utils';
import { vi } from 'vitest';

/** @jsx createElement */

describe('useMemo', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { createElement, render, createContext } from 'preact';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { useReducer, useEffect, useContext } from 'preact/hooks';

/** @jsx createElement */

describe('useReducer', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { createElement, render } from 'preact';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { useRef } from 'preact/hooks';

/** @jsx createElement */

describe('useRef', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { vi } from 'vitest';
import { useState, useContext, useEffect } from 'preact/hooks';
import { setupScratch, teardown } from '../../../test/_util/helpers';

/** @jsx createElement */

describe('useState', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
2 changes: 1 addition & 1 deletion jsconfig-lint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"skipLibCheck": true,
"noEmit": true,
"typeRoots": ["./node_modules/@types", "./types"]
"typeRoots": ["./node_modules/@types", "./node_modules", "./types"]
},
"include": [
"src/**/*",
Expand Down
3 changes: 2 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"target": "es5",
"noEmit": true,
"skipLibCheck": false
"skipLibCheck": false,
"types": ["vitest/globals"]
Copy link
Member Author

@rschristian rschristian Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this not an issue for everyone else btw? In every single file (beyond our TS tests, which also set this in their tsconfig.json files) I get hundreds of Cannot fine name 'describe'/'expect'. Do you need to install type definitions...

I'd almost have to assume folks are using other editor setups than me as it makes mine light up like a christmas tree without this

},
"exclude": ["**/node_modules/**", "**/dist/**", "coverage", "demo"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { act } from 'preact/test-utils';
import { setupScratch, teardown } from '../../../test/_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */

// IE11 doesn't support `new Event()`
function createEvent(name) {
if (typeof Event == 'function') return new Event(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { options, createElement, render, Component } from 'preact';
import { teardown, setupRerender } from 'preact/test-utils';
import { vi } from 'vitest';

/** @jsx createElement */

describe('setupRerender & teardown', () => {
/** @type {HTMLDivElement} */
let scratch;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { createElement, cloneElement, createRef } from 'preact';

/** @jsx createElement */

describe('cloneElement', () => {
it('should clone components', () => {
function Comp() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from '../_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */
const h = createElement;

function getAttributes(node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { createElement, render, Component, Fragment } from 'preact';
import { setupScratch, teardown } from '../_util/helpers';
import { vi } from 'vitest';

/** @jsx createElement */

describe('context', () => {
let scratch;

Expand Down
Loading
Loading