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

@ramadan04/eslint-plugin-baseline

v1.2.4

Published

Plugin ESLint para detectar el uso de features de JavaScript según la base de compatibilidad "Baseline" (integrado con TypeScript para comprobaciones con información de tipos).

Readme

@ramadan04/eslint-plugin-baseline

Plugin ESLint para detectar el uso de features de JavaScript según la base de compatibilidad "Baseline" (integrado con TypeScript para comprobaciones con información de tipos).

Este plugin expone reglas centradas en identificar APIs y métodos que no están ampliamente soportados en determinados años de Baseline y reportarlos en tiempo de lint.

Características

  • Regla principal: no-unsupported — Detecta llamadas a métodos y accesos a propiedades de prototipos que Baseline marca como no suficientemente soportados para un año objetivo.
  • Funciona con TypeScript y aprovecha la información de tipos (typed linting) para resolver el tipo del objeto y mapearlo correctamente a la entrada de Baseline (por ejemplo: String.prototype.replaceAll()).

Instalación

Instala el paquete desde npm y las dependencias recomendadas para TypeScript linting:

# Desde la carpeta de tu proyecto que consume el plugin
npm install --save-dev @ramadan04/eslint-plugin-baseline
npm install --save-dev typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin

Si usas pnpm o yarn, usa el gestor equivalente.

Uso

En un archivo de configuración de ESLint (ej: .eslintrc.js, eslint.config.mjs o eslint.config.mts) registra el plugin y activa la regla:

Ejemplo minimal con la configuración "flat" (eslint.config.mjs / eslint.config.mts):

import globals from "globals";
import tsplugin from "@typescript-eslint/eslint-plugin";
const baseline = require("@ramadan04/eslint-plugin-baseline");

export default [
  {
    files: ["**/*.{ts,tsx,js,jsx,mjs,cjs,mts,cts}"],
    languageOptions: {
      parser: require.resolve("@typescript-eslint/parser"),
      parserOptions: {
        project: "./tsconfig.json",
        tsconfigRootDir: __dirname,
        sourceType: "module"
      },
      globals: globals.browser
    },
    plugins: {
      "@ramadan04/baseline": baseline
    },
    rules: {
      "@ramadan04/baseline/no-unsupported": ["error", { year: 2024 }]
    }
  }
];

Si usas la configuración tradicional (.eslintrc.js) registra el plugin normalmente:

module.exports = {
  parser: "@typescript-eslint/parser",
  parserOptions: {
    project: "./tsconfig.json",
  },
  plugins: ["@ramadan04/baseline"],
  rules: {
    "@ramadan04/baseline/no-unsupported": ["error", { year: 2024 }]
  }
};

Configuración de TypeScript (typed linting)

La regla no-unsupported necesita información de tipos para resolver correctamente el tipo del objeto. Para habilitarlo debes:

  1. Tener un tsconfig.json en el proyecto consumidor.
  2. En la configuración de ESLint setear parserOptions.project apuntando a ese tsconfig.json.

Ejemplo:

// tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "strict": true
  },
  "include": ["src/**/*", "test/**/*"]
}

Y en ESLint:

parserOptions: { project: "./tsconfig.json" }

Si no proporcionas parserOptions.project, la regla no reportará nada que dependa de información de tipos y ESLint mostrará un mensaje indicando que habilites typed linting.

Ejemplos

Código que será reportado como no soportado si year es 2023 (pero no en 2024):

const s = "hello";
// String.prototype.replaceAll fue añadido ampliamente en Baseline 2024
s.replaceAll("l", "L");

Código soportado en Baseline 2024:

const arr = [1,2,3];
arr.at(0); // Array.prototype.at también está en Baseline 2024

API / Reglas

  • @ramadan04/baseline/no-unsupported — regla que detecta features no soportadas.
    • Opciones: objeto { year: number } (por defecto el año actual)

Publicación en npm

Antes de publicar, asegúrate de que package.json tenga los campos name = @ramadan04/eslint-plugin-baseline, version, main (apunta al index.js) y types si incluyes declaraciones. Un ejemplo mínimo:

{
  "name": "@ramadan04/eslint-plugin-baseline",
  "version": "0.0.0",
  "main": "index.js",
  "types": "index.d.ts",
  "files": ["lib/**/*", "index.js", "index.d.ts"]
}

Si no incluyes index.d.ts, los consumidores TypeScript verán un warning; puedes crear un archivo index.d.ts que declare el módulo con any como tipo para evitar ese mensaje.

Notas internas y limitaciones

  • La regla utiliza la librería web-features para mapear nombres de features. La cobertura depende de los datos de esa librería.
  • Para detectar correctamente prototipos (String.prototype.replaceAll) la regla resuelve el tipo del objeto y construye el nombre desde la combinación tipo + propiedad.
  • Actualmente la regla solo informa sobre MemberExpression y llamadas de métodos; podrías extenderla para NewExpression u otros patrones.

Contribuciones

Pull requests y issues bienvenidos. Asegúrate de incluir tests y ejemplos reproducibles.

Licencia

MIT