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

jsegd-fluig-lint

v1.1.0

Published

Plugin de lint para projetos Fluig utilizando ESLint.

Readme

jsegd-fluig-lint

Plugin ESLint para validar arquivos JavaScript executados no Rhino (Java 11) da plataforma Fluig, garantindo compatibilidade com ES5 e expondo automaticamente os globais declarados em jsegd-fluig-types.

🎯 Objetivo

O Fluig executa scripts JavaScript em um runtime Rhino, que suporta apenas ES5 e possui particularidades na interoperabilidade com Java. Este plugin:

  • Avalia somente arquivos .js localizados nos diretórios oficiais de scripts Fluig:
    • datasets/
    • mechanisms/
    • workflow/scripts/
    • src/events/backend/
  • Configura o parser para ecmaVersion: 5 e sourceType: "script", falhando em qualquer sintaxe pós-ES5.
  • Disponibiliza, por padrão, os símbolos globais de jsegd-fluig-types (DatasetFactory, hAPI, log, java, com, etc.).

📦 Instalação

Instale o plugin e o pacote de tipos como dependências de desenvolvimento — ambos são peerDependencies obrigatórias:

npm install -D jsegd-fluig-lint jsegd-fluig-types eslint

ou com yarn:

yarn add -D jsegd-fluig-lint jsegd-fluig-types eslint

ou com pnpm:

pnpm add -D jsegd-fluig-lint jsegd-fluig-types eslint

🚀 Uso (ESLint Flat Config)

Configuração recomendada

Em eslint.config.mjs:

import jsegdFluigLint from "jsegd-fluig-lint";

export default [
  {
    plugins: {
      "jsegd-fluig-lint": jsegdFluigLint,
    },
  },
  ...jsegdFluigLint.configs.recommended,
];

A configuração já inclui:

| Bloco | Pastas avaliadas | O que aplica | | ---------------------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------- | | jsegd-fluig-lint/rhino-es5 | datasets/**/*.js, mechanisms/**/*.js, workflow/scripts/**/*.js, src/events/backend/**/*.js | Parser ES5 + todas as regras | | jsegd-fluig-lint/globals-dataset | datasets/**/*.js | Globais de Dataset | | jsegd-fluig-lint/globals-backend | mechanisms/**/*.js, workflow/scripts/**/*.js, src/events/backend/**/*.js | Globais de Backend/Workflow |

Arquivos fora desses diretórios são ignorados pelo plugin — combine com seus próprios configs ESLint para o restante do projeto.

Configuração manual

Se quiser controlar regras e globals separadamente:

import jsegdFluigLint from "jsegd-fluig-lint";

const FLUIG_FILES = [
  "datasets/**/*.js",
  "mechanisms/**/*.js",
  "workflow/scripts/**/*.js",
  "src/events/backend/**/*.js",
];

export default [
  {
    plugins: { "jsegd-fluig-lint": jsegdFluigLint },
  },
  {
    files: FLUIG_FILES,
    languageOptions: {
      ecmaVersion: 5,
      sourceType: "script",
      globals: jsegdFluigLint.globals.backend, // ou .dataset
    },
    rules: {
      "jsegd-fluig-lint/no-const-let": "error",
      "jsegd-fluig-lint/no-for-of": "error",
      "jsegd-fluig-lint/no-strict-equality": "error",
      "jsegd-fluig-lint/no-arrow-functions": "error",
      "jsegd-fluig-lint/no-modern-es": "error",
      "jsegd-fluig-lint/no-optional-chaining": "error",
      "jsegd-fluig-lint/no-promises": "error",
    },
  },
];

📋 Regras

Todas as regras só agem em arquivos .js dentro do escopo Fluig descrito acima.

no-const-let

Proíbe const/let (ES6+). Auto-fix: substitui por var.

// ❌ Errado
const total = 10;
let nome = "x";

// ✅ Correto
var total = 10;
var nome = "x";

no-for-of

Proíbe for...of (ES6+). Auto-fix: converte para for tradicional.

// ❌ Errado
for (var item of lista) {
  /* ... */
}

// ✅ Correto
for (var i = 0; i < lista.length; i++) {
  var item = lista[i];
  /* ... */
}

no-strict-equality

Proíbe === e !== (não funcionam corretamente com interop Java ↔ JS no Rhino). Auto-fix.

// ❌ Errado
if (valor === null) {
  /* ... */
}

// ✅ Correto
if (valor == null) {
  /* ... */
}

no-arrow-functions

Proíbe arrow functions (ES6+ e quebram o this no interop com Java).

// ❌ Errado
var arrow = () => 1;

// ✅ Correto
function fn() {
  return 1;
}

no-modern-es

Proíbe identificadores globais ES6+ que o parser ES5 não captura (porque são nomes válidos em ES5) e que não existem no Rhino:

  • Construtores: Map, Set, WeakMap, WeakSet (apenas via new).
  • Identificadores: Symbol, BigInt, Reflect, Proxy, WeakRef, FinalizationRegistry, globalThis (qualquer referência — chamada, acesso a membro ou valor).

A regra ignora propriedades de objeto (obj.Symbol, { Symbol: 1 }) e referências a variáveis locais com o mesmo nome (shadowing).

// ❌ Errado
var m = new Map();
var s = new Set();
var sym = Symbol("x");
var big = BigInt(10);
Reflect.has(obj, "key");
var g = globalThis;

// ✅ Correto — use estruturas ES5 ou APIs equivalentes do Rhino/Java
var m = {};
var s = [];

no-optional-chaining

Proíbe optional chaining (?.).

// ❌ Errado
var nome = user?.profile?.name;

// ✅ Correto
var nome = user && user.profile && user.profile.name;

no-promises

Proíbe o uso de Promise (construtor e APIs estáticas). O Rhino do Fluig não fornece Promise nativo — use callbacks ou execução síncrona. A regra ignora propriedades (obj.Promise) e shadowing por variável local.

// ❌ Errado
var p = new Promise(function (resolve) { resolve(1); });
Promise.resolve(valor).then(handle);

// ✅ Correto — use callbacks
function buscar(callback) {
  var dados = DatasetFactory.getDataset("ds", null, null, null);
  callback(dados);
}

🌐 Globais de jsegd-fluig-types

Os globais não são duplicados em listas estáticas dentro do plugin: eles são extraídos em tempo de carga dos blocos declare global { ... } dos arquivos .d.ts de jsegd-fluig-types. Assim, qualquer símbolo novo adicionado ao pacote de tipos passa a ser reconhecido automaticamente após atualizar a dependência.

A configuração recomendada injeta automaticamente:

  • datasets/ → globais de fluig.dataset.d.ts + java.d.ts (ex.: DatasetFactory, DatasetBuilder, DefaultDataset, ConstraintType, AddColumn, setKey, addIndex, defineStructure, onSync, createDataset, onMobileSync, java, javax).
  • mechanisms/, workflow/scripts/, src/events/backend/ → globais de fluig.backend.d.ts + fluig.sdk.d.ts + fluig.dataset.d.ts + fluig.api.d.ts + fluig.webservice.d.ts + java.d.ts (ex.: globalVars, getValue, hAPI, log, ServiceManager, Service, JSONUtil, FormController, customHTML, displayFields, enableFields, inputFields, validateForm, DatasetFactory, java, com, …).

Esses símbolos também ficam disponíveis programaticamente em jsegdFluigLint.globals.dataset e jsegdFluigLint.globals.backend para configs personalizadas.

Como a derivação acontece em runtime, jsegd-fluig-types deve estar instalado — por isso é uma peerDependency obrigatória.

🔧 Scripts sugeridos no package.json

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

📄 Licença

Consulte LICENSE.md.


Desenvolvido com ❤️ pela EGD Tecnologia