Skip to content

Commit 777e290

Browse files
Merge pull request #68 from biswalom22/documentation/doc-feat-update
Added docusarus with eslint-report and node-express rules
2 parents 0f67cb6 + 7d9c0f5 commit 777e290

File tree

3 files changed

+649
-1
lines changed

3 files changed

+649
-1
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# ESLint Report Generator
2+
## Overview
3+
4+
To provide a comprehensive overview of code quality and maintain a historical record of linting issues, the ESLint Plugin Hub includes a built-in report generation tool. This tool introduces a new command, eslint-report, that analyzes your project and generates detailed reports of all ESLint errors and warnings in both PDF and CSV formats.
5+
6+
These reports are invaluable for code reviews, quality assurance audits, and tracking improvements to your codebase over time.
7+
8+
Features
9+
Feature
10+
11+
Description
12+
13+
PDF & CSV Output
14+
15+
Generates two distinct report files: a human-readable, branded PDF and a data-friendly CSV.
16+
17+
Automatic Grouping
18+
19+
The PDF report automatically groups all issues under "Errors" and "Warnings" for quick assessment.
20+
21+
Customizable Logo
22+
23+
The PDF report can be branded with your company logo by placing a logo.png in the static/img folder.
24+
25+
Standalone CLI
26+
27+
A simple command-line interface that can be run on any project with a local ESLint installation.
28+
29+
Getting Started
30+
Installation
31+
The report generator is a command-line tool included with the eslint-plugin-hub package. To make the command available in your project, you must first install the plugin.
32+
33+
For local development across multiple projects, you can use npm link:
34+
35+
# In your eslint-plugin-hub project directory
36+
npm link
37+
38+
# In your target project directory (e.g., mern-ecom-api)
39+
npm link eslint-plugin-hub
40+
41+
For a single project or in a CI/CD environment, install it as a development dependency:
42+
43+
npm install @mindfiredigital/eslint-plugin-hub --save-dev
44+
45+
Running the Report Generator
46+
Once installed, you can run the report generator from the root of your project. The command accepts an optional path to the project you want to analyze. If no path is provided, it will analyze the current directory.
47+
48+
# Run on the current project
49+
npx eslint-report .
50+
51+
# Or run on a different project using a relative path
52+
npx eslint-report ../path/to/another-project
53+
54+
### Configuration
55+
For easier use, it is highly recommended to add the command to the scripts section of your project's package.json.
56+
57+
```json
58+
{
59+
"scripts": {
60+
"lint": "eslint . --fix",
61+
"lint:report": "eslint-report ."
62+
}
63+
}
64+
```
65+
66+
You can then generate a report at any time by running:
67+
68+
npm run lint:report
69+
70+
Including the Logo
71+
For the PDF report to correctly display your company logo, you must ensure the static folder is included when the eslint-plugin-hub package is published or linked. Add the following "files" array to your eslint-plugin-hub/package.json:
72+
73+
```json
74+
{
75+
"name": "eslint-plugin-hub",
76+
"version": "1.0.0",
77+
"main": "index.js",
78+
"bin": {
79+
"eslint-report": "./bin/report-generation-cli.js"
80+
},
81+
"files": [
82+
"bin",
83+
"lib",
84+
"rules",
85+
"static"
86+
]
87+
}
88+
89+
Output
90+
After running the command, a new directory named eslint-reports will be created in the root of the project you analyzed. This directory contains the following files:
91+
92+
File Name
93+
94+
Description
95+
96+
report.pdf
97+
98+
A professionally formatted, landscape-oriented PDF. It features your company logo, a summary of all issues grouped by severity, and clear tables.
99+
100+
report.csv
101+
102+
A Comma-Separated Values file containing all the raw issue data. This file is ideal for importing into spreadsheets or other data analysis tools.
103+
104+
Conclusion
105+
The ESLint Report Generator provides a powerful and convenient way to visualize and track the quality of your codebase. By integrating this tool into your development workflow, you can easily share detailed reports with your team, monitor progress, and maintain a high standard of code quality across all your projects.

0 commit comments

Comments
 (0)