open-index/open-npm huggingface dataset:
npm package: @gooonzick/typesafe-assets-eslint
Description: ESLint plugin that enforces generated asset helpers instead of raw static-asset strings.
Latest version: 1.0.0

# @gooonzick/typesafe-assets-eslint

ESLint plugin that enforces generated asset helpers instead of raw static-asset strings.

## Install

```bash
pnpm add -D @gooonzick/typesafe-assets-eslint eslint
```

Peer dependency:

- `eslint >= 9`

## Rule

- `typesafe-assets/prefer-generated-asset-helper`

The rule reports direct asset strings in `src`/`srcSet` and allows helper calls imported from `*.gen` files.

## Flat config usage

```js
import typesafeAssets from "@gooonzick/typesafe-assets-eslint";
import tsParser from "@typescript-eslint/parser";

export default [
  {
    files: ["**/*.{ts,tsx,js,jsx}"],
    languageOptions: {
      parser: tsParser,
    },
    plugins: {
      "typesafe-assets": typesafeAssets,
    },
    rules: {
      "typesafe-assets/prefer-generated-asset-helper": "error",
    },
  },
];
```

Or use the bundled config:

```js
import typesafeAssets from "@gooonzick/typesafe-assets-eslint";

export default [...typesafeAssets.configs.recommended];
```

## Rule options

```js
{
  "typesafe-assets/prefer-generated-asset-helper": [
    "error",
    {
      attributes: ["src", "srcSet"],
      extensions: [".png", ".jpg", ".svg"]
    }
  ]
}
```

Option defaults:

- `attributes`: `["src", "srcSet"]`
- `extensions`: `[]` (match any absolute path beginning with `/`)

## Framework support

The rule handles:

- JSX/TSX attributes
- Vue templates (`.vue`)
- Svelte templates (`.svelte`)

For `.vue` and `.svelte`, configure the corresponding parser (`vue-eslint-parser` / `svelte-eslint-parser`).
npm package: @gooonzick/typesafe-assets-vite
Description: Vite plugin that generates type-safe static asset helpers from configured directories.
Latest version: 1.0.0

# @gooonzick/typesafe-assets-vite

Vite plugin that generates type-safe static asset helpers from configured directories.

## Install

```bash
pnpm add -D @gooonzick/typesafe-assets-vite
```

Peer dependency:

- `vite >= 5`

## Usage

```ts
import { defineConfig } from "vite";
import staticAssets from "@gooonzick/typesafe-assets-vite";

export default defineConfig({
  plugins: [
    staticAssets({
      dirs: ["public"],
      outDir: "src/generated",
    }),
  ],
});
```

Use the generated helper in app code:

```ts
import { asset } from "./generated/public.gen";

const logo = asset("/images/logo.png");
```

## Options

Accepts `StaticAssetsOptions` from `@gooonzick/typesafe-assets-core`:

- `dirs?: Array<string | DirEntry>`
- `outDir?: string`
- `extensions?: string[]`
- `exclude?: string[]`
- `fnName?: string`
- `typeName?: string`

## Behavior

- Generates on `buildStart`.
- In dev server mode, watches configured directories and regenerates on `add`, `unlink`, and `unlinkDir`.
- Logs changed generated files to stdout.