eslint-plugin-kirklin

raw JSON →
4.0.0 verified Sat May 09 auth: no javascript

eslint-plugin-kirklin is a collection of opinionated ESLint rules created by Kirk Lin, primarily used with the kirklin/eslint-config configuration. The current stable version is 4.0.0, which adds support for ESLint v10. The plugin releases new features and breaking changes periodically, with v2.0.0 dropping CJS support to become ESM-only. Key differentiators include custom rules like consistent-list-newline, top-level-function, no-top-level-await, consistent-chaining, and indent-unindent, which enforce a consistent code style specific to the author's preferences.

error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-plugin-kirklin/index.js from /path/to/.eslintrc.js not supported.
cause Plugin is ESM-only since v2.0.0, but config file is using CommonJS (require).
fix
Convert config to ESM (rename .eslintrc.js to eslint.config.js with "type": "module") or use dynamic import.
error ESLint: Failed to load plugin 'kirklin' declared in '.eslintrc.*': Cannot find module 'eslint-plugin-kirklin'
cause Plugin not installed or not in node_modules.
fix
Run: npm install eslint-plugin-kirklin --save-dev
error TypeError: plugin.config is not a function
cause Misleading: plugin.configs is an object, not a function; referring to it as config will cause a TypeError.
fix
Use plugin.configs.recommended (or plugin.configs itself) instead of plugin.config.
error ESLint could not find the plugin 'eslint-plugin-kirklin' in the config.
cause Flat config requires the plugin to be registered in the plugins object.
fix
Add plugins: { kirklin: plugin } to your config object.
breaking v2.0.0 dropped CommonJS (CJS) build; plugin is now ESM-only.
fix Ensure your project is using ES modules (set "type": "module" in package.json or use .mjs extension for config).
deprecated v1.x versions are deprecated; upgrade to v2+ for ESM support and latest rules.
fix Update to v4.0.0: npm install eslint-plugin-kirklin@latest
gotcha v4.0.0 requires ESLint v10. Using with older ESLint versions will fail.
fix Update ESLint to >=10: npm install eslint@latest
gotcha Plugin is designed for flat config (eslint.config.js). Legacy .eslintrc format is not supported since v2.
fix Migrate to flat config: https://eslint.org/docs/latest/use/configure/configuration-files-new
gotcha If using ESLint <9, you must use a compatibility layer like @eslint/eslintrc to use this plugin.
fix Consider upgrading to ESLint >=9 or use eslint-plugin-kirklin@1.x (but v1 is deprecated).
npm install eslint-plugin-kirklin
yarn add eslint-plugin-kirklin
pnpm add eslint-plugin-kirklin

Shows how to import the plugin and configure recommended rules in flat config (ESLint >=9).

// eslint.config.js
import plugin from 'eslint-plugin-kirklin';

export default [
  {
    plugins: {
      kirklin: plugin,
    },
    rules: {
      'kirklin/consistent-list-newline': 'error',
      'kirklin/top-level-function': 'error',
      'kirklin/no-top-level-await': 'error',
      'kirklin/consistent-chaining': 'warn',
    },
  },
];