RG Frontend Linters provides standardized configurations for ESLint, Stylelint, and CommitLint. This ensures consistent code quality, style, and commit message conventions across all projects.
- ESLint: Enforce consistent JavaScript code style and quality.
- Stylelint: Maintain uniform SCSS formatting and conventions.
- CommitLint: Validate commit messages against defined standards.
Include rg-frontend-linters
as a dependency:
"dependencies": {
"rg-frontend-linters": "git+https://github.com/raccoongang/rg-frontend-linters.git#<version>"
}
Add a configuration file for the desired linter in the root of your project. For example, to configure Stylelint:
touch .stylelintrc.js
Use the provided helper function to set up the linter configuration. For example:
Stylelint (.stylelintrc.js
):
const { createConfig } = require('rg-frontend-linters');
module.exports = createConfig('stylelint');
ESLint (.eslintrc.js
):
const { createConfig } = require('rg-frontend-linters');
module.exports = createConfig('eslint');
CommitLint (commitlint.config.js
):
const { createConfig } = require('rg-frontend-linters');
module.exports = createConfig('commitlint');
Extend the default configuration by adding custom rules or overriding existing ones.
const { createConfig } = require('rg-frontend-linters');
module.exports = createConfig('<configName>', {
// Custom rules go here
});