@adguard/eslint-plugin-logger-context
Version:
ESLint plugin that requires AdGuard logger calls to start with a context tag.
35 lines (27 loc) • 635 B
Markdown
# @adguard/eslint-plugin-logger-context
A minimal ESLint plugin for AdGuard projects that requires logger calls to start with a context tag.
## Install
```bash
pnpm add -D @adguard/eslint-plugin-logger-context
```
## Quick Start
Add to your `.eslintrc.js`:
```js
module.exports = {
plugins: [
'@adguard/logger-context',
],
rules: {
'@adguard/logger-context/require-logger-context': ['error', {
// optional
contextModuleName: 'moduleName',
// optional
loggerVariableName: 'logger',
}],
},
};
```
**Example of correct usage:**
```js
logger.info('[ext.page-handler]: some message');
```