npm.io
2.4.6 • Published 2 months ago

eslint-plugin-belgradian

Licence
MIT
Version
2.4.6
Deps
0
Size
39 kB
Vulns
0
Weekly
0

eslint-plugin-belgradian

An ESLint plugin that enforces camelCase variable naming with scope prefixes:

  • m_ for field members
  • g_ for global variables (outside of the module or class)

Installation

npm install eslint eslint-plugin-belgradian --save-dev

Usage

ESLint flat config (eslint.config.js — ESLint 9+)
import belgradian from "eslint-plugin-belgradian";

export default [
  {
    plugins: { belgradian },
    rules: {
      "belgradian/member-prefix-rule": "error"
    }
  }
];
Legacy config (.eslintrc — ESLint 8 and below)

Add belgradian to the plugins section of your .eslintrc configuration file:

{
  "plugins": ["belgradian"],
  "rules": {
    "belgradian/member-prefix-rule": "error"
  }
}

Options

The rule accepts an options object with:

  • include — additional prefixes to allow (e.g. ["g_"])
  • exceptions — variable names to ignore
{
  "rules": {
    "belgradian/member-prefix-rule": [
      "error",
      { "include": ["g_"], "exceptions": ["reservedVariable"] }
    ]
  }
}

Development

npm test        # run tests with coverage
npm run lint    # lint source and test files

License

MIT


Inspired by Sander Verweij's budapestian.