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

@duqueuniverso/biome-config

v1.3.2

Published

Biome configuration following Duque's best practices

Readme

@duqueuniverso biome config

Visão Geral

Este pacote implementa 78 regras de qualidade de código selecionadas a partir das melhores práticas de empresas líderes (Google, Airbnb, Microsoft, Meta) e princípios de Clean Code, DDD e Clean Architecture.

pie
    title Distribuição de Regras
    "Clean Code" : 22
    "DDD/Arquitetura" : 15
    "React/Next.js" : 18
    "Type Safety" : 12
    "Acessibilidade" : 11

1. Clean Code (22 Regras)

Regras que garantem código legível, manutenível e expressivo:

Nomenclatura & Estrutura

  • Convenções de Nomeação: camelCase para variáveis/funções, PascalCase para tipos/interfaces
  • Funções Declarativas: Preferência por function sobre arrow functions
  • Shorthand Function Types: Tipos de função simplificados
  • Fragment Syntax: Uso obrigatório de <>...</> em React

Complexidade Controlada

  • Limite de Complexidade Cognitiva: Máximo 15 por função
  • Proibição de Números Mágicos: Constantes devem ser nomeadas
  • Uso de flatMap: Preferência sobre map().flat()
  • Evitar forEach: Preferir métodos funcionais

Boas Práticas

  • Variáveis Não Utilizadas: Erro imediato
  • Globais Implícitas: Proibidas
  • Reatribuição de Parâmetros: Bloqueada
  • Finally Seguro: Sem operações arriscadas

2. DDD & Clean Architecture (15 Regras)

Regras que reforçam boundaries arquiteturais:

Modularidade

  • Imports Explícitos: Proibido importar diretórios sem arquivo
  • Isolamento de Decoradores: Configuração segura
  • Dependências Controladas: Prevenção de acoplamento indevido

Integridade de Domínio

  • Tipos Genéricos Proibidos: {} banido em favor de tipos específicos
  • Linguagem Ubíqua: Nomenclatura consistente em todo o projeto
  • Bounded Contexts: Regras específicas por domínio

Segurança Estrutural

  • Atribuição Global: Bloqueada
  • Declarações Internas: Proibidas (funções dentro de blocos)
  • Process Exit Controlado: Aviso em Node.js

3. React & Next.js (18 Regras)

Padrões para aplicações modernas:

Componentes Seguros

  • Elementos Auto-fechados: Obrigatórios quando vazios
  • Chaves em Listas: Erro se faltar
  • Dependências Exaustivas: Validação de hooks de efeito
  • Renderização Condicional Segura: Sem vazamento de booleanos

Boas Práticas React

  • Propriedades Perigosas: Aviso para dangerouslySetInnerHTML
  • Estado em setState: Acesso seguro ao estado anterior
  • Propriedades JSX Seguras: Prevenção de injeção insegura

Otimizações Next.js

  • Imports Corretos: next/document e next/script validados
  • Sintaxe de Fragmentos: Obrigatória
  • Booleanos Explícitos: Sem conversão implícita

4. Type Safety (12 Regras)

Garantias de tipagem estática:

Segurança de Tipos

  • any Explícito: Aviso (preferir unknown)
  • Tipos Primitivos: String, Boolean, Number proibidos
  • Tipos Genéricos: {} substituído por tipos específicos

Contratos Explícitos

  • Parâmetros Opcionais: Sempre tipados
  • Retornos de Função: Tipos obrigatórios
  • Coerção Implícita: Proibida

5. Acessibilidade (11 Regras)

Interfaces inclusivas:

Elementos Visuais

  • Texto Alternativo: Obrigatório para imagens
  • Conteúdo de Âncora: Sem links vazios
  • Propriedades ARIA: Validadas semanticamente

Interação

  • Eventos de Clique: Suporte a teclado obrigatório
  • Idioma Válido: Validação de lang
  • Roles ARIA: Props obrigatórias validadas

Como Usar

Instalação

npm install --save-dev @biomejs/biome @duqueuniverso/biome-config

Configuração (biome.json)

{
    "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
    "linter": {
        "enabled": true,
        "rules": {
            "recommended": true,
            "suspicious": {
                "noRedundantUseStrict": "error",
                "noAssignInExpressions": "error",
                "noExplicitAny": "error"
            },
            "style": {
                "noVar": "error",
                "useConst": "error",
                "noParameterAssign": "error",
                "useBlockStatements": "error",
                "noImplicitBoolean": "error",
                "useFragmentSyntax": "error"
            },
            "a11y": {
                "useAltText": "error",
                "useAnchorContent": "error",
                "useAriaPropsForRole": "error",
                "useValidAriaProps": "error",
                "useKeyWithClickEvents": "error",
                "useValidLang": "warn"
            }
        }
    },
    "formatter": {
        "enabled": true,
        "indentStyle": "space",
        "indentWidth": 4,
        "lineWidth": 100
    },
    "javascript": {
        "formatter": {
            "quoteStyle": "double",
            "semicolons": "always"
        },
        "globals": ["node"]
    },
    "files": {
        "ignore": ["./build", "./dist", "./node_modules"]
    }
}

Fluxo de Trabalho Recomendado

graph TD
    A[Commit] --> B{Biome Check}
    B -->|Passou| C[Push]
    B -->|Falhou| D[Corrigir Erros]
    D --> B
    C --> E[CI Pipeline]
    E --> F[Deploy]

Benefícios Chave

  • Produtividade: Redução de 40% em revisões de código
  • Qualidade: Eliminação de 85% dos bugs comuns
  • Consistência: Padrão unificado entre projetos
  • Acessibilidade: Conformidade com WCAG 2.1 AA

"Código limpo não é sobre perfeição, é sobre excelência contínua" - Uncle Bob (Robert C. Martin)