npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yfiles/eslint-plugin

v1.0.0

Published

Official ESLint plugin for yFiles for HTML

Readme

@yfiles/eslint-plugin

Official ESLint plugin for yFiles for HTML projects. This repository provides an ESLint plugin with rules and flat-config presets. The goal is to ship helpful best‑practice rules tailored for applications built with yFiles for HTML. The rules included here are especially helpful for LLMs writing yFiles for HTML apps as they have been mostly trained on yFiles 2.6. Many of the rules correct common mistakes that happen when writing code for the deprecated yFiles 2.6 API. Some rules also provide suggestions for the best practices and fix patterns that are syntactically correct in yFiles 3.0 but won't work properly at runtime.

Note: The npm package name is "@yfiles/eslint-plugin" and the ESLint plugin key (namespace) is "@yfiles". Below is the list of currently implemented rules.

Features

  • Works with ESLint v9 (flat config) and remains compatible with legacy .eslintrc via dual ESM/CJS builds.
  • Written with type definitions included.
  • Ships prebuilt flat-config presets (recommended, all, recommendedTypeChecked, allTypeChecked).

Installation

Peer requirements:

  • Node >= 20.11
  • ESLint ^8.57 or ^9

Install the plugin in your project:

npm i -D eslint typescript typescript-eslint @yfiles/eslint-plugin
  • If you don’t use TypeScript, you can omit typescript and typescript-eslint and use the non-type-checked yFiles presets instead.

If you use TypeScript, make sure typescript is installed and configured in your project. Some rules require type information. See typescript-eslint for enabling linting with type information.

Usage (Flat Config – ESLint v9)

Use the typescript-eslint helper to define your flat config and enable typed linting. Create or edit eslint.config.js (or .mjs) at the root of your project:

// eslint.config.mjs
import tseslint from "typescript-eslint";
import yfilesconfigs from "@yfiles/eslint-plugin/configs";

// Use tseslint.config (define-style) to compose configs
export default tseslint.config(
  // 1) Start with TypeScript rules (type-checked)
  ...tseslint.configs.recommendedTypeChecked,

  // 2) Add yFiles plugin preset (type-checked)
  yfilesconfigs.recommendedTypeChecked,

  // 3) Configure TypeScript project for typed linting
  {
    languageOptions: {
      parserOptions: {
        // Point ESLint at your TS config(s) so rules can use type information
        project: ["./tsconfig.json"],
        // Ensure relative paths resolve from this file’s directory
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },

  // 4) Optionally, customize/override individual rules
  // {
  //   rules: {
  //     "@yfiles/replace-legacy-imports": "error",
  //   },
  // }
);

Run ESLint:

npx eslint .

Usage (Legacy .eslintrc)

If you still use the legacy config system, the package also publishes a CommonJS entry that can be loaded by .eslintrc files.

.eslintrc.cjs:

module.exports = {
  plugins: ["@yfiles"],
  rules: {
    "@yfiles/replace-legacy-imports": "error",
    "@yfiles/replace-legacy-fqns": "error",
    "@yfiles/replace-legacy-event-listeners": "error",
    "@yfiles/suggest-setter-methods": "error",
    "@yfiles/migrate-type-names": "error",
    "@yfiles/migrate-member-names": "error",
    "@yfiles/fix-implements-using-baseclass": "error",
    "@yfiles/remove-legacy-dollar-class": "error",
  },
};

Current Rules

The following rules are currently implemented:

  • @yfiles/replace-legacy-imports
    • Rewrites imports from "yfiles" to "@yfiles/yfiles".
  • @yfiles/replace-legacy-fqns
    • Replaces fully-qualified names like yfiles.view.GraphComponent with named imports and bare identifiers.
  • @yfiles/replace-legacy-event-listeners
    • Rewrites addListener/removeListener calls to addEventListener/removeEventListener and swaps callback params to (event, sender).
  • @yfiles/suggest-setter-methods
    • Warns on assigning to readonly yFiles properties like INode.layout or IEdge.sourceNode; suggests the corresponding IGraph methods.
  • @yfiles/migrate-type-names
    • Renames legacy yFiles 2.6 type names to yFiles 3.0 names in type positions.
  • @yfiles/migrate-member-names
    • Renames legacy yFiles 2.6 member names to their yFiles 3.0 counterparts.
  • @yfiles/fix-implements-using-baseclass
    • Enforces using BaseClass(...) for yFiles interfaces instead of TypeScript implements, adding imports and fixing extends/implements as needed.
  • @yfiles/remove-legacy-dollar-class
    • Removes obsolete ".$class" from yFiles type references.

More yFiles-specific rules (e.g., graph component usage best practices, canvas/webgl mode checks, license/loader configuration hints) will be added.

Configs

  • configs.recommended
    • Enables a curated default rule set for typical yFiles for HTML apps.
  • configs.all
    • Enables all rules shipped by this plugin.
  • configs.recommendedTypeChecked
    • Enables a curated default rule set for typical yFiles for HTML apps including TypeScript type checking.
  • configs.allTypeChecked
    • Enables all rules shipped by this plugin including TypeScript type checking.

Example enabling the "all" profile in flat config:

import yfilesconfigs from "@yfiles/eslint-plugin/configs";
export default [yfilesconfigs.allTypeChecked];

TypeScript and typed linting

Many yFiles projects use TypeScript. Some rules in this plugin are type-aware and require ESLint to read your TypeScript Program. Follow the typed-linting guidance from typescript-eslint:

  • Use the typescript-eslint package and its flat-config helpers.
  • Point ESLint at your TS config(s) via languageOptions.parserOptions.project and set tsconfigRootDir.
  • Alternatively, enable the Project Service for multi-project repos.

Quick setup (single tsconfig):

import tseslint from "typescript-eslint";
import yfilesconfigs from "@yfiles/eslint-plugin";

export default tseslint.config(
  ...tseslint.configs.recommendedTypeChecked,
  yfilesconfigs.recommendedTypeChecked,
  {
    languageOptions: {
      parserOptions: {
        project: ["./tsconfig.json"],
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
);

Using a dedicated tsconfig for linting (recommended in monorepos):

  1. Create tsconfig.eslint.json next to your main tsconfig:
{
  "extends": "./tsconfig.json",
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ]
}
  1. Reference it in ESLint:
// inside your config:
const typedOptions = {
  languageOptions: {
    parserOptions: {
      project: ["./tsconfig.eslint.json"],
      tsconfigRootDir: import.meta.dirname,
    },
  },
};
export default tseslint.config(
  ...tseslint.configs.recommendedTypeChecked,
  yfilesconfigs.recommendedTypeChecked,
  typedOptions,
);

Project Service (alternative):

// inside your config:
const typedOptions = {
  languageOptions: {
    parserOptions: {
      projectService: true,
      tsconfigRootDir: import.meta.dirname,
    },
  },
};
export default tseslint.config(
  ...tseslint.configs.recommendedTypeChecked,
  yfilesconfigs.recommendedTypeChecked,
  typedOptions,
);

Notes:

  • Ensure your tsconfig includes all files you lint; missing files cause “File is not included in project” errors.
  • Typed linting is slower than syntax-only; consider running type-aware rules only in CI, or per-package.
  • If you don’t need type information, you can use the non-type-checked presets: yfilesconfigs.recommended or yfilesconfigs.all.

Releases

This package publishes dual ESM and CJS builds and type definitions. Consumers on ESLint v9 (flat config) should import the default export; legacy users can continue using .eslintrc with the CommonJS entry.

License

Copyright (c) 2025 yWorks GmbH. See the license terms for yFiles for HTML.