Flint Linter

repository·main·Indexed 43 days ago

https://github.com/flint-fyi/flint

An experimental, high-performance hybrid linter for JavaScript, TypeScript, and other languages. Flint focuses on developer ergonomics and performance by combining JavaScript/TypeScript rule definitions with native code for bottleneck operations and type-aware caching. It includes a system of experimental plugins for Astro, Next.js, Nuxt, React, SolidJS, CSS, JSX, and browser-side logic.

Tokens
222.1K
Snippets
773
Records
1.3K
Agent score
54%

What's inside Flint

  1. Overview of Flint

    main

    Flint is an experimental "hybrid" linter designed for JavaScript, TypeScript, and other languages. It aims to balance developer ergonomics with high performance by combining the ease of writing rules in JavaScript/TypeScript with native code for bottleneck operations and intelligent caching.

    Key features include:

    • Ergonomics: Rules are written in JavaScript or TypeScript.
    • Performance: Utilizes native code for performance-critical operations and type-aware caching to speed up linting in large repositories.
    • Streamlined Configuration: Flexible and readable configuration files.
    • Unified Core: Popular rules are integrated into the core project for better reliability.
  2. Understand Flint's current development stage

    main

    Flint is currently in an extremely early stage and experimental phase.

    Key considerations for users:

    • API Stability: The project is subject to frequent iteration and frequent API breakages.
    • Production Readiness: Flint is not yet considered ready for use in real software projects. The team aims to be "alpha-ready" by the end of 2026.
    • Usage Recommendation: It is recommended to use Flint for experimentation or contribution rather than as a stable dependency in production environments.
  3. Use the anchorAmbiguousText rule in JSX

    main

    The anchorAmbiguousText rule identifies anchor (<a>) elements that use vague or ambiguous text (such as "click here", "here", "link", or "read more") instead of descriptive text that explains the link's destination. This is critical for accessibility, particularly for screen reader users who navigate via lists of links.

    Incorrect Usage

    Avoid using generic phrases that provide no context about the target URL:

    <a href="/about">click here</a>
    <a href="/docs">here</a>
    <a href="/contact">link</a>
    <a href="/pricing">read more</a>

    Correct Usage

    Ensure the link text clearly describes the destination or action:

    <a href="/about">About Us</a>
    <a href="/docs">View Documentation</a>
    <a href="/contact">Contact Information</a>
    <a href="/pricing">See Pricing Details</a>
    <a href="/about">About Us</a>
  4. What is Flint and how does hybrid linting work?

    main

    Flint is an experimental "hybrid" linter designed to combine the approachability of JavaScript/TypeScript-based linters (like ESLint) with the performance of native-speed linters (like Biome or Oxlint).

    How Hybrid Linting Works

    Flint's core and lint rules are written in TypeScript, but it achieves high performance through several key architectural choices:

    • Native Delegation: While the core is TypeScript, Flint delegates performance-critical tasks like parsing and type checking to native-speed tools (e.g., typescript-go).
    • Dependency-Aware Caching: Flint's caching mechanism recognizes cross-file dependencies, allowing it to reuse results from unchanged files between runs.
    • Modern Optimization APIs: It utilizes advanced techniques like Oxlint's createOnce API to improve memory usage and execution time.

    This architecture aims to provide a developer experience where contributing rules is easy (using TS), while execution remains fast.