ESLint Plugin Ghost

raw JSON →
3.5.0 verified Sat Apr 25 auth: no javascript

eslint-plugin-ghost provides shared ESLint configurations and custom rules for Ghost projects. As of version 3.5.0, it offers presets for Node, browser, Ember, TypeScript, and test environments, with style-disabled variants. It is actively maintained by the Ghost Foundation and follows Ghost's code style documented in base.js. Unlike generic ESLint configs, it is tightly coupled to the Ghost ecosystem, ensuring consistency across official Ghost repos. Release cadence is irregular, driven by changes in Ghost's code style or ESLint updates.

error Error: Cannot find module 'eslint-plugin-ghost'
cause Missing npm install of eslint-plugin-ghost in the project.
fix
Run 'npm install eslint-plugin-ghost --save-dev' or 'yarn add eslint-plugin-ghost --dev'.
error ESLint couldn't find the config "plugin:ghost/node". Error: Failed to load plugin 'ghost' from package 'eslint-plugin-ghost'
cause Typo in config name or missing 'plugin:' prefix.
fix
Ensure extends is 'plugin:ghost/node' not 'ghost/node' and that the plugin is installed.
error Invalid 'extends' configuration: 'ghost/node'. 'extends' must be a string or array of strings.
cause Omitting 'plugin:' prefix leads to ESLint trying to resolve a non-existent config.
fix
Change extends to 'plugin:ghost/node'.
breaking In v2.x, config names changed from 'plugin:ghost/[type]' to include 'plugin:' prefix. Using old format 'ghost/node' will not work.
fix Update extends to use 'plugin:ghost/[config]' format.
deprecated Config 'plugin:ghost/ember' is deprecated and will be removed in v4; use 'plugin:ghost/ember-no-style' or migrate to ember-specific plugin.
fix Switch to 'plugin:ghost/ember-no-style' or use @ember/eslint-plugin.
gotcha Style rules are included by default; use '-no-style' presets to disable them. If you don't, your code may fail style checks even if logic is correct.
fix Use configs like 'plugin:ghost/node-no-style' instead of 'plugin:ghost/node'.
gotcha The plugin assumes you are using ESLint >=5.11.0. Older versions may not support important features like 'plugin:' prefix.
fix Update ESLint to >=5.11.0.
npm install eslint-plugin-ghost
yarn add eslint-plugin-ghost
pnpm add eslint-plugin-ghost

Shows basic setup with 'ghost' plugin and 'plugin:ghost/node' config for a Node.js project.

// .eslintrc.js
module.exports = {
    plugins: ['ghost'],
    extends: [
        'plugin:ghost/node',
    ],
    rules: {
        // override rules here
    }
};