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

eslint-plugin-isotropic

v0.8.1

Published

ESLint rules for Isotropic

Readme

eslint-plugin-isotropic

npm version License

ESLint rules for Isotropic projects with sensible defaults and consistent conventions

Installation

You'll need ESLint v9.8.0 or above:

npm install eslint --save-dev

Next, install eslint-plugin-isotropic:

npm install eslint-plugin-isotropic --save-dev

Usage

Create an eslint.config.js file in your project root directory to use the isotropic configuration:

import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default [
    _eslintPluginIsotropic.configs.isotropic
];

Or if using CommonJS:

const _eslintPluginIsotropic = require('eslint-plugin-isotropic');

module.exports = [
    _eslintPluginIsotropic.configs.isotropic
];

Using Individual Rules

If you prefer to use only specific rules from the plugin without the entire preset:

import { defineConfig } from "eslint/config";
import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default defineConfig([
    {
        files: ["**/*.js"],
        plugins: {
            isotropic: _eslintPluginIsotropic
        },
        rules: {
            'isotropic/prefer-date-now': 'error',
            'isotropic/prefer-reflect-apply': 'error'
            // Add other rules as needed
        }
    }
]);

Features

This plugin provides a comprehensive set of rules and configurations:

Note: ESLint v9.x uses the new "flat config" format (eslint.config.js) instead of the deprecated .eslintrc.* configuration files. For more information, see the ESLint Configuration Files Documentation.

Custom Rules

filename-must-match-pattern

Enforces filename naming conventions through a configurable regular expression pattern.

// eslint.config.js
import { defineConfig } from "eslint/config";
import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default defineConfig([
    {
        files: ["**/*.js"],
        plugins: {
            isotropic: _eslintPluginIsotropic
        },
        rules: {
            'isotropic/filename-must-match-pattern': ['warn', {
                pattern: '^[\\da-z](?:[\\d\\-.a-z]*?[\\da-z])?$',
                flags: 'v'
            }]
        }
    }
]);

See documentation for more details.

filename-must-not-match-pattern

Enforces that filenames do not match a specific pattern.

// eslint.config.js
import { defineConfig } from "eslint/config";
import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default defineConfig([
    {
        files: ["**/*.js"],
        plugins: {
            isotropic: _eslintPluginIsotropic
        },
        rules: {
            'isotropic/filename-must-not-match-pattern': ['warn', {
                pattern: '^index$',
                flags: 'v'
            }]
        }
    }
]);

See documentation for more details.

prefer-date-now

Enforces using Date.now() instead of new Date().getTime() for better readability and performance.

// ❌ Incorrect
const now = new Date().getTime();

// ✅ Correct
const now = Date.now();

See documentation for more details.

prefer-reflect-apply

Encourages using Reflect.apply() over Function.prototype.apply() and Function.prototype.call().

// ❌ Incorrect
someFunction.call(object, ...args);
someFunction.apply(object, args);

// ✅ Correct
Reflect.apply(someFunction, object, args);

See documentation for more details.

sort-keys

Requires object keys to be sorted in a consistent order. This rule extends the functionality of ESLint's built-in sort-keys rule with natural sorting options.

// ❌ Incorrect
const object = {
    c: 3,
    b: 2,
    a: 1
};

// ✅ Correct
const object = {
    a: 1,
    b: 2,
    c: 3
};

Configuration example:

// eslint.config.js
import { defineConfig } from "eslint/config";
import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default defineConfig([
    {
        files: ["**/*.js"],
        plugins: {
            isotropic: _eslintPluginIsotropic
        },
        rules: {
            'isotropic/sort-keys': ['error', {
                caseSensitive: false,
                direction: 'asc',
                ignoreSpecialCharacters: true,
                prefixPositions: { _: 'last' }
            }]
        }
    }
]);

Options:

  • caseSensitive: Whether sorting should be case-sensitive (default: false)
  • direction: Sort direction, either 'asc' or 'desc' (default: 'asc')
  • ignoreSpecialCharacters: Whether to ignore special characters during sorting (default: true)
  • prefixPositions: Define positions for prefixed keys (default: { _: 'last' })

See documentation for more details.

sort-vars

Requires variable declarations to be sorted in a consistent order. This rule extends the functionality of ESLint's built-in sort-vars rule with natural sorting and handling of multiline declarations.

// ❌ Incorrect
const c = 3,
    b = 2,
    a = 1;

const {
    c,
    b,
    a
} = object;

// ✅ Correct
const a = 1,
    b = 2,
    c = 3;

const {
    a,
    b,
    c
} = object;

Configuration example:

// eslint.config.js
import { defineConfig } from "eslint/config";
import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default defineConfig([
    {
        files: ["**/*.js"],
        plugins: {
            isotropic: _eslintPluginIsotropic
        },
        rules: {
            'isotropic/sort-vars': ['error', {
                caseSensitive: false,
                direction: 'asc',
                ignoreSpecialCharacters: true,
                prefixPositions: {},
                strictEmptyLines: true
            }]
        }
    }
]);

Options:

  • caseSensitive: Whether sorting should be case-sensitive (default: false)
  • direction: Sort direction, either 'asc' or 'desc' (default: 'asc')
  • ignoreSpecialCharacters: Whether to ignore special characters during sorting (default: true)
  • prefixPositions: Define positions for prefixed variables (default: {})
  • strictEmptyLines: Whether to enforce rules about empty lines between variables (default: true)

See documentation for more details.

top-scope-prefix

Enforces that variables in the top scope of a module use a specific prefix, helping distinguish globals from local variables.

// ❌ Incorrect
const constVariable = null;
function functionVariable() {}

// ✅ Correct
const _constVariable = null;
function _functionVariable() {}

Configuration example:

// eslint.config.js
import { defineConfig } from "eslint/config";
import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default defineConfig([
    {
        files: ["**/*.js"],
        plugins: {
            isotropic: _eslintPluginIsotropic
        },
        rules: {
            'isotropic/top-scope-prefix': ['error', {
                prefix: '_'
            }]
        }
    }
]);

Options:

  • prefix: The prefix that must be used for top-scope variables (default: '_')

See documentation for more details.

Key Linting Decisions

Consistent Code Style

The plugin enforces a consistent code style through the Stylistic plugin, including:

  • Consistent indentation (4 spaces)
  • No semicolon-less code
  • Consistent spacing in code
  • Strict single quote preference for strings
  • Enforced curly braces for all blocks

Natural Sorting

For rules involving sorting (variables, object keys), the plugin uses isotropic-natural-sort which provides sensible ordering that matches human expectations.

Module Structure

The plugin encourages a clear module structure with:

  • Underscore-prefixed module-level variables to distinguish them from local variables
  • Consistent import ordering
  • Proper module export patterns

Modern JavaScript Features

The plugin encourages use of modern JavaScript features:

  • ES modules over CommonJS
  • Modern APIs like Reflect.apply() and Date.now()
  • Consistent use of ES6+ features

Combining with Other Configurations

You can combine the isotropic configuration with other configurations:

// eslint.config.js
import js from "@eslint/js";
import _eslintPluginIsotropic from 'eslint-plugin-isotropic';

export default [
    js.configs.recommended,
    _eslintPluginIsotropic.configs.isotropic,
    {
        files: ["**/*.js"],
        rules: {
            // Override specific rules
            "no-unused-vars": "warn"
        }
    }
];

Compatible ESLint Versions

This plugin requires ESLint 9.8.0 or later and uses ESLint's new flat config system.