Skip to content

Commit

Permalink
more lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed May 7, 2024
1 parent a15e11a commit d1bf028
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 80 deletions.
4 changes: 2 additions & 2 deletions @types/fsify/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export interface Options {
*/
cwd?: string;
/**
* A persistent fsify tree remains on the file system after the process exits.
* Defaults to true.
* A persistent fsify tree remains on the file system after the process
* exits. Defaults to true.
*/
persistent?: boolean;
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/react/react/src/hooks/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ interface ScheduledHandler {
* Creates a {@linkcode ScheduledHandler} that will keep track of the
* synchronization functions to run.
*
* This function sets up a `useEffect` to run the handlers. This `useEffect` has
* a dependency on a `useState` that represents the set of handlers. The
* This function sets up a `useEffect` to run the handlers. This `useEffect`
* has a dependency on a `useState` that represents the set of handlers. The
* `useState` invalidates whenever a handler is added or whenever
* {@linkcode scheduleDep} is explicitly run.
*
Expand Down
8 changes: 4 additions & 4 deletions packages/react/use-strict-lifecycle/src/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
*
* ## The Solution
*
* The `useLifecycle` hook gives you a way to create a new instance of something
* when the component is first instantiated, clean it up when the component is
* unmounted, and create a brand **new** instance when the component is
* reactivated.
* The `useLifecycle` hook gives you a way to create a new instance of
* something when the component is first instantiated, clean it up when the
* component is unmounted, and create a brand **new** instance when the
* component is reactivated.
*
* TL;DR It works almost the same way that per-component state in React works,
* but gives you a fresh copy whenever React re-attaches the component.
Expand Down
8 changes: 4 additions & 4 deletions packages/universal/debug/src/call-stack/debug/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function stripLeadingSlash(path: string) {

/**
* The whole `Stack` system is only intended to be used for logging, so the
* edge-cases where this normalization wouldn't work (verbatim paths on Windows)
* shouldn't matter.
* edge-cases where this normalization wouldn't work (verbatim paths on
* Windows) shouldn't matter.
*/
function normalizePath(...pathParts: (string | null | undefined)[]): string {
return pathParts
Expand All @@ -48,8 +48,8 @@ function normalizePath(...pathParts: (string | null | undefined)[]): string {
}

/**
* This function takes two paths and returns the suffix of the target that comes
* after any shared prefix with the source.
* This function takes two paths and returns the suffix of the target that
* comes after any shared prefix with the source.
*
* For example, if the source is `/src/app/foo/bar` and the target is
* `/src/app/baz/qux`, this function will return `baz/qux`.
Expand Down
4 changes: 2 additions & 2 deletions packages/universal/interfaces/src/debug/debug-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export interface DebugRuntime {
readonly callerStack: CallerStackFn;

/**
* Mark the current function as a debug entry point. The immediate caller of a
* debug entry point becomes the call stack associated with any debug
* Mark the current function as a debug entry point. The immediate caller of
* a debug entry point becomes the call stack associated with any debug
* information generated for that entry point.
*
* @param options.caller Optionally specify an explicit caller. By default,
Expand Down
10 changes: 5 additions & 5 deletions packages/universal/interfaces/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export interface FormulaTag extends TagMethods {
* necessarily mean that the formula is static, because a formula has no
* children before it was first initialized.
*
* Data structures built on `FormulaTag` should always read the formula before
* attempting to read the children if they plan to rely on the absence of
* children as a strong indicator of staticness.
* Data structures built on `FormulaTag` should always read the formula
* before attempting to read the children if they plan to rely on the absence
* of children as a strong indicator of staticness.
*/
children: () => ReadonlySet<Tag>;
}
Expand Down Expand Up @@ -137,8 +137,8 @@ export type SubscriptionTarget = CellTag | FormulaTag;
*
* NOTE: In previous versions of Starbeam, it was legal to change the tag after
* the tagged object was initially created. However, this made it impossible to
* use an tagged object's tag as a key in a WeakMap, which meant that the tagged
* object itself had to be passed around even when it was semantically
* use an tagged object's tag as a key in a WeakMap, which meant that the
* tagged object itself had to be passed around even when it was semantically
* unimportant.
*
* These days, the `[TAG]` property must not change once it has been read. For
Expand Down
12 changes: 6 additions & 6 deletions packages/universal/interfaces/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { Timestamp } from "./timestamp.js";
import type { Unsubscribe } from "./utils.js";

/**
* The runtime is the interface that defines the core operations of the reactive
* system.
* The runtime is the interface that defines the core operations of the
* reactive system.
*
* ## Cells and Formulas
*
Expand All @@ -24,8 +24,8 @@ import type { Unsubscribe } from "./utils.js";
*
* ## Lifetime Management
*
* - `onFinalize(object, handler)`: Registers a finalizer handler for an object.
* - `finalize(object)`: Finalizes an object.
* - `onFinalize(object, handler)`: Registers a finalizer handler for an
* object. - `finalize(object)`: Finalizes an object.
* - `link(parent, child)`: Link two objects together: when the parent is
* finalized, the child will be finalized as well.
*/
Expand All @@ -50,8 +50,8 @@ export interface Runtime {
readonly update: (formula: FormulaTag) => void;

/**
* Subscribe to notifications that the given tag has updates ready ("readiness
* notifications").
* Subscribe to notifications that the given tag has updates ready
* ("readiness notifications").
*
* The second parameter to `subscribe` is a callback that will be called
* *immediately* when the tag is updated.
Expand Down
10 changes: 5 additions & 5 deletions packages/universal/interfaces/src/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import type { Timestamp } from "./timestamp.js";
export type TagSnapshot = ReadonlySet<Tag>;

/**
* Cell is the fundamental mutable reactive value. All subscriptions in Starbeam
* are ultimately subscriptions to cells, and all mutations in Starbeam are
* ultimately mutations to cells.
* Cell is the fundamental mutable reactive value. All subscriptions in
* Starbeam are ultimately subscriptions to cells, and all mutations in
* Starbeam are ultimately mutations to cells.
*
* If a cell has `undefined` dependencies, that means that the cell cannot
* change anymore. This allows it to be removed from any formulas that depend on
* it.
* change anymore. This allows it to be removed from any formulas that depend
* on it.
*/
export interface CellTag {
readonly type: "cell";
Expand Down
4 changes: 2 additions & 2 deletions packages/universal/interfaces/src/tagged.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export type HasTag<T extends Tag = Tag> = T | Tagged<T>;
*
* NOTE: In previous versions of Starbeam, it was legal to change the tag after
* the tagged object was initially created. However, this made it impossible to
* use an tagged object's tag as a key in a WeakMap, which meant that the tagged
* object itself had to be passed around even when it was semantically
* use an tagged object's tag as a key in a WeakMap, which meant that the
* tagged object itself had to be passed around even when it was semantically
* unimportant.
*/
export interface Tagged<I extends Tag = Tag> {
Expand Down
8 changes: 4 additions & 4 deletions packages/universal/renderer/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import type { IntoResourceBlueprint } from "./resource.js";
* and returns a value.
*
* In the simplest case, you can simply call setup with a function with no
* parameters. The function will run during the setup phase, and return a stable
* result for the lifetime of the component.
* parameters. The function will run during the setup phase, and return a
* stable result for the lifetime of the component.
*
* You can also make use of the {@linkcode Lifecycle} to use resources, get
* services or register code to run during the _idle_ or _layout_ phase.
Expand All @@ -26,8 +26,8 @@ export type SetupBlueprint<T> = (lifecycle: Lifecycle) => T;
* `ReactiveBlueprint` is a function that takes a {@linkcode Lifecycle} and
* returns an optionally reactive value. You can pass it to
* {@linkcode useReactive} or {@linkcode setupReactive}. These functions will
* instantiate the blueprint during the setup phase and return a stable reactive
* value.
* instantiate the blueprint during the setup phase and return a stable
* reactive value.
*
* If you pass a `ReactiveBlueprint` to {@linkcode useReactive}, you must also
* pass dependencies to {@linkcode useReactive}. If the dependencies change,
Expand Down
4 changes: 2 additions & 2 deletions packages/universal/resource/tests/resource.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ class ResourceWrapper<T, U> {
};

/**
* The `act` method takes an action definition and thoroughly tests the action
* by performing this sequence of steps **twice**:
* The `act` method takes an action definition and thoroughly tests the
* action by performing this sequence of steps **twice**:
*
* 1. Verify that the event list is empty.
* 2. Run the action.
Expand Down
4 changes: 2 additions & 2 deletions packages/universal/shared/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export interface Lifetime {
/**
* Like {@linkcode pushFinalizationScope}, but does not add the scope to the
* parent scope when complete. This is useful for scopes that represent
* long-lived stacks, such as async functions or reactive resources (which can
* have nested scopes that evolve over time).
* long-lived stacks, such as async functions or reactive resources (which
* can have nested scopes that evolve over time).
*/
mountFinalizationScope: (child?: object) => () => FinalizationScope;

Expand Down
4 changes: 2 additions & 2 deletions packages/universal/shared/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* A registration function takes a handler function and returns a function that,
* when called, removes the handler.
* A registration function takes a handler function and returns a function
* that, when called, removes the handler.
*/
export type Unregister = () => void;
2 changes: 1 addition & 1 deletion packages/universal/verify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export {
export { type TypeOf } from "./src/assertions/types.js";
export { type Expectation, VerificationError } from "./src/verify.js";

export const expected: typeof expectedDev = import.meta.env.DEV ? expectedDev : null as any
export const expected: typeof expectedDev = import.meta.env.DEV ? expectedDev : null as unknown as typeof expectedDev
export const hasType: typeof hasTypeDev = import.meta.env.DEV ? hasTypeDev : (noop as typeof hasTypeDev)
export const isOneOf: typeof isOneOfDev = import.meta.env.DEV ? isOneOfDev : (noop as typeof isOneOfDev)

Expand Down
12 changes: 6 additions & 6 deletions packages/vue/vue-testing-utils/src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ function defComponent<Props extends PropTypes>(
/**
* Define a Vue component for testing with specified props.
*
* This component should not be rendered directly in testing. Instead, it should
* be invoked from the app (specified via {@linkcode App}) or a descendant of
* the app.
* This component should not be rendered directly in testing. Instead, it
* should be invoked from the app (specified via {@linkcode App}) or a
* descendant of the app.
*
* @param props The props of the component, as passed to
* {@linkcode defineComponent} in Vue.
* @param definition The setup function of the component.
*
* The `definition` parameter may be may either be specified as a plain function
* that takes props as specified by the `props` parameter, or it may be
* specified as:
* The `definition` parameter may be may either be specified as a plain
* function that takes props as specified by the `props` parameter, or it may
* be specified as:
*
* `{ setup: (props) => () => VNodeChild }`
*/
Expand Down
22 changes: 12 additions & 10 deletions workspace/dev-compile/src/rollup/plugins/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import type { RollupPlugin } from "../utils.js";
* import is "inline", it is combined with the built package's main file and
* further optimized.
*
* In general, it's better to inline an import if any of the following are true:
* In general, it's better to inline an import if any of the following are
* true:
*
* 1. It is only used by this package.
* 2. Its exports are easy to optimize by a minifier in production builds (e.g.
Expand All @@ -40,12 +41,13 @@ import type { RollupPlugin } from "../utils.js";
* 1. Relative imports: If the import starts with a `.`, then it is an inline
* import.
* 2. Custom rules: If the `starbeam:inline` key in `package.json` specifies a
* rule for a dependency, use it. You can use custom rules to override any of
* the default rules below.
* rule for a dependency, use it. You can use custom rules to override any
* of the default rules below.
* 3. [TODO] Custom workspace rules: If the `starbeam:inline` key in the
* `package.json` for the workspace root specifies a rule for a dependency,
* use it.
* 4. Helper libraries: If the import is one of the well-known helper libraries,
* 4. Helper libraries: If the import is one of the well-known helper
* libraries,
* then it is an inline import.
* 5. Absolute imports: If the import starts with `/`, then it is an inline
* import. This is because absolute imports are usually relative imports
Expand Down Expand Up @@ -108,8 +110,8 @@ import type { RollupPlugin } from "../utils.js";
*
* ### Rules Object
*
* Each key in the object is a rule pattern, and the value is either "inline" or
* "external".
* Each key in the object is a rule pattern, and the value is either "inline"
* or "external".
*
* Example:
*
Expand All @@ -129,8 +131,8 @@ import type { RollupPlugin } from "../utils.js";
* In this example, the `react` dependency is externalized, and the `lodash`
* dependency is inlined.
*
* The default behavior is to externalize all dependencies, so you don't need to
* specify "external" in a rules object unless you want to supersede a later
* The default behavior is to externalize all dependencies, so you don't need
* to specify "external" in a rules object unless you want to supersede a later
* rule.
*
* Example:
Expand All @@ -157,8 +159,8 @@ import type { RollupPlugin } from "../utils.js";
* ### Rule Objects in a Rules Array
*
* When you have a lot of inline rules and only a handful of externals
* overrides, it's nice to be able to avoid repeating `: "inline"` over and over
* again.
* overrides, it's nice to be able to avoid repeating `: "inline"` over and
* over again.
*
* In this situation, you can include rule objects in a rules array.
*
Expand Down
11 changes: 6 additions & 5 deletions workspace/dev-compile/src/rollup/plugins/import-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import { createReplacePlugin } from "./replace.js";
*
* Replacements:
*
* | source | replacement rule |
* | ---------------------- | ------------------------------------------------ |
* | `import.meta.env.MODE` | the specified mode (string) |
* | `import.meta.env.DEV` | true if the mode is "development" (boolean) |
* | `import.meta.env.PROD` | true if the mode is "production" (boolean) |
* | source | replacement rule
* | | ---------------------- |
* ------------------------------------------------ | | `import.meta.env.MODE`
* | the specified mode (string) | | `import.meta.env.DEV`
* | true if the mode is "development" (boolean) | |
* `import.meta.env.PROD` | true if the mode is "production" (boolean) |
*
* It is possible for both `DEV` and `PROD` to be false (if the specified mode
* is something other than `"development"` or `"production"`). In general, this
Expand Down
8 changes: 4 additions & 4 deletions workspace/dev-compile/src/rollup/plugins/replace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const { default: MagicString } = await import("magic-string");
* };
* ```
*
* This will replace any instances of `import.meta.hello` in source modules with
* the content `"world"`.
* This will replace any instances of `import.meta.hello` in source modules
* with the content `"world"`.
*
* The main purpose of this plugin is to replace dynamic variables with
* build-time constant values, which can then be further processed by a
Expand All @@ -36,8 +36,8 @@ const { default: MagicString } = await import("magic-string");
* For example, the `importMeta` plugin replaces `import.meta.env.DEV` with
* `true` in development mode and `false` in production mode. In production,
* source code guarded with `if (import.meta.env.DEV)` will be emitted as `if
* (false)`. The subsequent minification pass will remove the entire `if` block,
* including its contents.
* (false)`. The subsequent minification pass will remove the entire `if`
* block, including its contents.
*
* @param {(id: string) => boolean} test
* @param {Record<string, string>} replacements @param {boolean} sourcemap
Expand Down
21 changes: 11 additions & 10 deletions workspace/dev-compile/src/rollup/plugins/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const rollupTS =
* into normal enums.
* - All import paths that refer to non-existent JavaScript modules (type-only
* modules) are imported using `import type`.
* - All imports that do not refer to a JavaScript value are imported as part of
* - All imports that do not refer to a JavaScript value are imported as part
* of
* an `import type` statement or are annotated with `type` (i.e. `import {
* map, type MapFn } from "map"`).
*
Expand All @@ -48,11 +49,11 @@ const rollupTS =
* </dd>
* </dl>
*
* We also recommend the use of `@typescript-eslint/consistent-type-imports` and
* `@typescript-eslint/no-import-type-side-effects`. These auto-fixable lints
* will error if you don't use `import type` on an import statement that is
* never used as a value. These lints will also ensure that any named imports
* that are only used as types are annotated with `type`.
* We also recommend the use of `@typescript-eslint/consistent-type-imports`
* and `@typescript-eslint/no-import-type-side-effects`. These auto-fixable
* lints will error if you don't use `import type` on an import statement that
* is never used as a value. These lints will also ensure that any named
* imports that are only used as types are annotated with `type`.
*
* If you're using vscode, you can enable "source.fixAll" in
* `editor.codeActionOnSave` and imports will automatically be updated if you
Expand All @@ -61,8 +62,8 @@ const rollupTS =
* ## Type Checking
*
* > **TL;DR** This plugin does **not** typecheck your code. It is intended to
* > be run after verifying your code using tools such as `tsc` and `eslint` and
* > after successfully running your tests.
* > be run after verifying your code using tools such as `tsc` and `eslint`
* and > after successfully running your tests.
*
* Now for the longer version...
*
Expand All @@ -84,8 +85,8 @@ const rollupTS =
*
* > Adding to the confusion, the tool that you use to *verify* your TypeScript
* > code is called `tsc`. Even more confusingly, `tsc` is intended to be a
* > good-enough reference compiler for TypeScript code. In practice, though, it
* > makes more sense to use `tsc` as part of a comprehensive *verification*
* > good-enough reference compiler for TypeScript code. In practice, though,
* it > makes more sense to use `tsc` as part of a comprehensive *verification*
* > strategy and to use other tools (such as `esbuild` or `swc`) to compile
* > your TypeScript code.
*
Expand Down
Loading

0 comments on commit d1bf028

Please sign in to comment.