Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add relaxed rules #2

Merged
merged 1 commit into from
Jan 27, 2024
Merged

Conversation

mav-rik
Copy link
Contributor

@mav-rik mav-rik commented Jan 27, 2024

Add 'relaxedRules' Feature for Custom Rule Level Control

Overview

This pull request introduces a new feature to the do-me-lint library, enhancing its flexibility and usability. It currently lacks the ability to control the severity level of individual linting rules, defaulting all rules to the "error" level.

Feature Description

The proposed feature, named relaxedRules, allows users to specify certain rules to be demoted from "error" to "warn" level. This feature is implemented in a manner similar to the existing ignoredRules feature. While ignoredRules lets users completely skip specific rules, relaxedRules provides a more nuanced approach, reducing the severity of chosen rules without entirely disabling them.

Implementation

  • Relaxed Rules Logic: The logic for relaxedRules mirrors that of ignoredRules. Users can list the rules they wish to relax in their configuration.
  • Configuration Update: The eslint configuration generation logic has been updated to incorporate relaxedRules. When generating the eslint config, the tool now sets the listed rules to "warn" instead of "error".
  • Backward Compatibility: This update maintains backward compatibility. Existing functionality, including ignoredRules, remains unaffected.

Benefits

  • Increased Flexibility: Users can now tailor the linting severity to their project's needs, opting for warnings in cases where errors are too strict.
  • Improved Developer Experience: This feature allows developers to prioritize fixing critical issues by reducing the noise from less critical linting rules.
  • Customizable Workflow: Teams can adjust their linting strategy over time, starting with warnings for new rules and escalating them to errors as the codebase matures.

Usage Example

To use relaxedRules, simply add the desired rules to the configuration as shown below:

relaxedRules:
  - func-names

@nikolai-katkov nikolai-katkov merged commit 6f8d6eb into nikolai-katkov:master Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants