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

flatlint

v4.0.0

Published

JavaScript tokens-based linter

Readme

FlatLintLicense NPM version Build Status Coverage Status

Token-based JavaScript linter that fixes Syntax Errors

Install

npm i flatlint

Available fixes

-import {readFile}, fs from 'node:fs';
+import fs, {readFile} from 'node:fs';
-import fs form 'node:fs';
+import fs from 'node:fs';
-a && b = c;
+a && (b = c);
-import a from 'a' assert {type: 'json'}
+import a from 'a' with {type: 'json'}
-const a = 5,
+const a = 5;

function x() {
-   return m,
+   return m;
}

-import a from 'a',
+import a from 'a';

-const a = 3,
+const a = 3;
module.exports = 2;
-console.log(a, b):
+console.log(a, b);
export const rules = [
-   ['apply-nesting': applyNesting],
+   ['apply-nesting', applyNesting],
];
-import {simpleImport: _simpleImport} from './simple-import.js';
+import {simpleImport as _simpleImport} from './simple-import.js';
-const a = from 'a';
+const a = require('a');
-function a({b, c) {}
-function a({b, c}) {}

-const {a = b;
+const {a} = b;
-if a > 5 {
+if (a > 5) {
    alert();
}

-if (a.b() {
+if (a.b()) {
}

-a('hello'
+a('hello');

const m = {
-    z: z('hello'
+    z: z('hello')
}

-{hello} = world;
+({hello} = world);

-assign(oldPath, currentPath;
+assign(oldPath, currentPath);
-const a 5;
+const a = 5;

-module.exports {};
+module.exports = {};
import {
-   a
+   a,
    b,
} from 'c';

t.transform('declare-imports-first', {
-   'declare-imports-first': declareImportsFirst
+   'declare-imports-first': declareImportsFirst,
    'convert-esm-to-commonjs': convertEsmToCommonJs,
});
-const a = (b, c) {};
+const a = (b, c) => {};
-export x = 5;
+export const x = 5;
-const a = ['hello', 'world';
+const a = ['hello', 'world'];
-const a = 5);
+const a = 5;

-import a from 'a');
+import a from 'a';

if (a) {
-})
+}
-const a = [1, 2, 3]];
+const a = [1, 2, 3];
const a = {
-    b: 'hello';
+    b: 'hello',
}

const b = [
    1,
-   2;
+   2,
    3,
]
function x() {
    return m;
-},
+}

-const expected = [],
+const expected = [];
t.equal(expected, []);
-fn([]);
+fn([].);
-const {¬
-····is,¬
-····sArgsStr,¬
-····isTypeParamsStr,¬
-} = require('./is');¬
+const {
+    is,
+    isArgsStr,
+    isTypeParamsStr,
+} = require('./is');
-const a = 'hello
+const a = 'hello'

-fn('hello);
+fn('hello');
-function parse(source) => {
+function parse(source) {
    return source;
}
-import {readFile, readdir} = from 'node:fs/promises';
+import {readFile, readdir} from 'node:fs/promises';
const a = class {
-    b() {},
+    b() {}
}
-const a = 5
+const a = 5;
    if (a < 0)
        console.log('hello');
-    else (a > 3)
+    else if (a > 3)
        console.log('world');

Template literals

FlatLint uses language similar to 🐊PutoutScript.

It can look similar, but has a couple differences:

  • ✅ it may not be valid JavaScript, it can be couple tokens that can be fixed;
  • ✅ it counts each symbol as a token;

__a

From __a to __z is usually identifiers, but can also be strings if used with quotes '__a' they can be single or double, it can be only one quote '__a - this is valid, since FlatLint is tokens based.

__array

Collects everything that looks like array elements, it can start from squire brace [__array;, but that's not important to end with it, since it used to fix error patterns.

__args

Collects arguments of function when exists.

__expr

Collects everything that looks like expression.

API

import {lint, plugins} from 'flatlint/with-plugins';

const [code] = flatlint(`a && b = c`, {
    plugins,
});

// returns
`
a && (b = c);
`;

Without fix:

import {lint, plugins} from 'flatlint/with-plugins';

const [, places] = flatlint(`a && b = c`, {
    fix: false,
    plugins,
});

// returns
[{
    column: 1,
    line: 1,
    message: `Wrap the assignment in parentheses after '&&'`,
    rule: 'wrap-assignment-in-parens',
}];

When you want to use custom plugins:

import {lint} from 'flatlint';

const [code] = lint(`a && b = c`, {
    startLine: 1,
    plugins: [
        ['wrap-assignment-in-parens', {
            report: () => `Wrap the assignment in parentheses after '&&'`,
            replace: () => ({
                '__a && __b = __c': '__a && (__b = __c)',
            }),
        }],
    ],
});

License

MIT