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

@krknet/eslint-plugin

v2.1.0

Published

KRKnet Standard Rules

Readme

@krknet/eslint-plugin

KRKnet ESLint rules and flat-config helpers for Node, Vue frontend, and SuiteScript projects.

Requirements

  • Node.js >= 22.12
  • ESLint ^9

Installation

npm install --save-dev eslint @krknet/eslint-plugin

Quick Start (Flat Config)

Create or update your ESLint config:

// eslint.config.mjs
import {
    createBase,
    createNode,
    createFrontend,
    plugin
} from '@krknet/eslint-plugin'

export default [
    ...createBase(),
    ...createNode(),
    ...createFrontend({ tailwindPath: './app/frontend/layout/main.css' }),

    // Optional: manual rule setup for custom rule usage in other file groups.
    {
        files: ['**/*.vue'],
        plugins: {
            krk: plugin
        },
        rules: {
            'krk/vue-html-linebreak': 'warn',
            'krk/vue-sort-components': 'warn'
        }
    }
]

Exports

This package exports:

  • plugin: ESLint plugin object (rules, configs)
  • rules: custom rule map
  • configs: config factory map
  • createBase(options?) returns a config array
  • createNode(options?) returns three config entries (CJS, ESM, and tooling exceptions)
  • createNodeCjs(options?) returns one config object
  • createNodeEsm(options?) returns one config object
  • createFrontend(options?) returns a config array
  • frontendFiles
  • createSuiteScriptBase() returns one config object (deprecated compatibility helper)
  • createSuiteScriptBuild(options?) returns a config array
  • createSuiteScriptSource(options?) returns a config array

Spread array-returning factories into a flat config. Add object-returning factories directly.

Config Helpers

createBase

Shared baseline config. It always disables @stylistic/multiline-ternary and enables krk/ternary-line-length with { merge: 120, split: false }.

Options:

  • ignores adds ignore patterns.

Customize or disable the KRK rule with a later flat-config entry:

{
    rules: {
        'krk/ternary-line-length': ['warn', {
            merge: 100,
            split: 120
        }]
    }
}

createNode

Returns an array with dedicated configs for CommonJS and ESM Node files.

By default, it covers Node files under app, build, cli, tests, and tools, along with eslint.config.{js,cjs,mjs}.

Build scripts, tests, tools, and ESLint config files may import development dependencies. The generated config disables n/no-unpublished-import and n/no-unpublished-require for those conventional tooling paths while keeping application and CLI files strict.

Options:

  • cjsFiles overrides the CommonJS file patterns.
  • esmFiles overrides the ESM file patterns.
  • ignores adds ignore patterns to both entries.
  • aliases (default { '>': './app' })
  • rules (applies to both CJS and ESM entries)
  • cjsRules (CJS-only overrides)
  • esmRules (ESM-only overrides)
  • plugins
  • settings (merged with the generated resolver settings; n and import/resolver keys are merged one level deep, so adding settings.n.version keeps the generated alias resolverConfig)

createNodeCjs and createNodeEsm accept files and ignores directly, in addition to the shared options.

files, cjsFiles and esmFiles replace the defaults rather than adding to them. Import nodeCjsFiles and nodeEsmFiles to extend them instead:

import { createNode, nodeCjsFiles } from '@krknet/eslint-plugin'

createNode({ cjsFiles: [...nodeCjsFiles, 'server/**/*.js'] })

createFrontend

Vue-focused config with import ordering, Vue rules, Tailwind rules, and KRK custom rules.

Options:

  • files replaces the default frontend file patterns.
  • tailwindPath (optional better-tailwindcss entry point)
  • aliases (default { '@': './app/frontend/components', '>': './app' })
  • plugins
  • rules
  • settings

Import frontendFiles to extend the defaults instead:

import { createFrontend, frontendFiles } from '@krknet/eslint-plugin'

createFrontend({ files: [...frontendFiles, 'client/**/*.mjs'] })

Frontend imports are checked with import/no-unresolved. Extensionless .vue imports are supported alongside .mjs, .js, and .json.

Direct imports of globally registered v-* entry points are rejected. Nested subcomponents and supporting modules remain importable.

Prefer Vue's expose option for properties and methods that parents access through component refs. For public members used through contracts that expose would misrepresent, use /** @public @mixin ... */ for mixin contracts or /** @public @dynamic ... */ for reflective access. On Options API methods and computed properties, krk/vue-prefer-expose reports plain @public annotations and redundant annotations on exposed members. The frontend config ignores documented public members when checking vue/no-unused-properties; ordinary unused members are still reported.

createSuiteScriptBuild / createSuiteScriptSource

createSuiteScriptBuild returns an array containing the Node ESM config for suitescripts/build.mjs. Resolver-dependent import cycle, duplicate, and ordering checks are disabled for the build script because the legacy alias resolver cannot load some ESM-only build dependencies. The build script may also import development dependencies such as Rollup plugins, so n/no-unpublished-import is disabled for it.

Pass files when the build script lives elsewhere; the default is exported as suiteScriptBuildFiles:

createSuiteScriptBuild({ files: ['tools/bundle-suitescripts.mjs'] })

createSuiteScriptSource returns a config array for SuiteScript source files. A single-target project rooted at suitescripts/src needs no options:

export default [
    ...createBase(),
    ...createNode(),
    ...createSuiteScriptBuild(),
    ...createSuiteScriptSource()
]

SuiteScript .mjs files are parsed as modules, .js files as scripts, and .cjs files as CommonJS. Node and browser globals are unavailable by default. Files matching **/*.{cs,CS}.js are treated as NetSuite ClientScripts and receive browser globals. Use clientFiles to replace that default when a project follows another naming convention:

createSuiteScriptSource({
    clientFiles: ['suitescripts/src/client/**/*.js']
})

For repositories containing multiple SuiteScript targets, list each target. Shared aliases remain available everywhere, while @ resolves to the matching target within target files:

export default [
    ...createBase(),
    ...createNode(),
    ...createSuiteScriptBuild(),
    ...createSuiteScriptSource({
        targets: ['SPE', 'SPUS'],
        aliases: {
            '@common': './suitescripts/src/common',
            '@lib': './suitescripts/src/lib'
        }
    })
]

Use root when SuiteScript source lives somewhere other than ./suitescripts/src. Absolute paths are resolved against the working directory. The normalized root is used for the file globs, and a project-relative form of it becomes the @ alias target.

Alias targets may be written with or without a leading ./, or as absolute paths. They are normalized before reaching eslint-import-resolver-alias, which would otherwise treat a target such as suitescripts/src/lib as a package name to look up in node_modules.

createSuiteScriptBase is deprecated. It remains available for legacy bundle entry points directly under suitescripts, but ignores source, distribution output, and suitescripts/build.mjs. Standard layouts should use createSuiteScriptBuild and createSuiteScriptSource.

Supported Rules

krk/ternary-line-length

Keeps short ternaries on one line and splits long ternaries with leading ? and : operators. It supports JavaScript and Vue template expressions.

Options:

  • merge: Merge a multiline ternary when the complete line is at or below this length. Use false to disable merging.
  • split: Split an inline or partially split ternary when the complete line exceeds this length. Use false to disable splitting.

Each omitted threshold defaults to 120. When merge is lower than split, layouts within the gap are left unchanged. A merge value above split is capped at the split threshold to prevent autofix loops.

{
    rules: {
        'krk/ternary-line-length': ['warn', {
            merge: 100,
            split: 120
        }]
    }
}

krk/vue-html-linebreak

Enforces splitting long Vue start tags into one-attribute-per-line form and merges short multiline tags back to one line.

Options:

  • split number (default 80)
  • merge number (default 50)

Example:

{
    rules: {
        'krk/vue-html-linebreak': ['warn', { split: 100, merge: 60 }]
    }
}

krk/vue-prefer-expose

Prefers Vue's expose option for Options API methods and computed properties used through parent refs. A plain @public annotation is reported; reserve @public @mixin and @public @dynamic for contracts that cannot be represented accurately by expose. An @public annotation is also reported when the same member is already listed in expose.

This rule has no options and does not autofix.

export default {
    expose: ['focus'],
    methods: {
        focus () {},

        /** @public @mixin Required by a mixin contract. */
        refresh () {}
    }
}

krk/vue-sort-components

Sorts component registration keys in Vue components objects.

Options:

  • 'asc' (default)
  • 'desc'

Example:

{
    rules: {
        'krk/vue-sort-components': ['warn', 'asc']
    }
}