Skip to content

Suggest for enum-value-case to support more flexible enum style#782

Merged
maxh merged 5 commits into
loop-payments:mainfrom
yuta-ike:feature/support-flexible-enum-value-case
Nov 7, 2025
Merged

Suggest for enum-value-case to support more flexible enum style#782
maxh merged 5 commits into
loop-payments:mainfrom
yuta-ike:feature/support-flexible-enum-value-case

Conversation

@yuta-ike
Copy link
Copy Markdown
Contributor

Thank you for this useful tool!

In my project, we adhere to a rule where enum values must be defined using PascalCase. So I extended enum-value-snake-case to support camelCase and PascalCase.

@yuta-ike
Copy link
Copy Markdown
Contributor Author

yuta-ike commented Nov 5, 2025

@maxh Could you please review this pull request?

@maxh
Copy link
Copy Markdown
Collaborator

maxh commented Nov 5, 2025

thanks @yuta-ike ! let me merge #784 first and then we can deprecate the existing rule in favor of your flexible one

maxh added a commit that referenced this pull request Nov 6, 2025
For #782

## Overview

This PR adds support for deprecating rules in prisma-lint. Rule authors
can now mark rules as deprecated and provide helpful migration
information to users.

## Changes

- **Type definitions**: Added `RuleDeprecation` type and optional
`deprecated` field to all rule definition types
- **Parse rules**: Enhanced `parseRules` function to detect deprecated
rules and collect warnings
- **CLI**: Added deprecation warning output in yellow color (suppressed
in quiet mode)
- **Tests**: Added comprehensive test coverage for deprecated rule
scenarios
- **Documentation**: Updated DEVELOPMENT.md with instructions on how to
deprecate rules

## Usage

Rule authors can deprecate a rule by adding the `deprecated` field:

```typescript
export default {
  ruleName: 'my-old-rule',
  configSchema: Config,
  create: (config, context) => {
    // rule implementation
  },
  deprecated: {
    message: 'This rule is no longer maintained.',
    replacedBy: 'my-new-rule', // optional
  },
} satisfies ModelRuleDefinition<z.infer<typeof Config>>;
```

When users enable a deprecated rule, they'll see a warning:

```
Warning: Rule 'my-old-rule' is deprecated. This rule is no longer maintained. Use 'my-new-rule' instead.
```

The deprecated rule continues to function normally, allowing users to
migrate at their own pace.
@maxh maxh self-requested a review November 6, 2025 12:33
@maxh
Copy link
Copy Markdown
Collaborator

maxh commented Nov 6, 2025

@yuta-ike please:

once these changes are in I'll approve, merge and release a new version thanks!!

@yuta-ike
Copy link
Copy Markdown
Contributor Author

yuta-ike commented Nov 7, 2025

@maxh Thanks! I've done it

@maxh maxh merged commit 43910e1 into loop-payments:main Nov 7, 2025
2 checks passed
@maxh
Copy link
Copy Markdown
Collaborator

maxh commented Nov 7, 2025

release... let's see if github action succeeds after recent npm security lockdown #785

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