Skip to content

Commit

Permalink
feat: allow _destroy as a property
Browse files Browse the repository at this point in the history
The `_destroy: true` property is used as a special key in monolith/ruby-on-rails APIs to indicate that the sub-record should be destroyed so we should allow this specific exception.
  • Loading branch information
SimeonC committed Apr 1, 2024
1 parent 1abc1a6 commit 0c200d7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ dist
.prettierignore
styleguide
CHANGELOG.md
.all-contributorsrc
9 changes: 9 additions & 0 deletions packages/eslint-config/src/rules/namingConvention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ export const namingRules: Linter.RulesRecord = {
match: false,
},
},
{
selector: ['property', 'parameterProperty'],
format: null,
types: ['boolean'],
filter: {
regex: '^_destroy$', // _destroy is used in monolith APIs as a convention
match: true,
},
},
{
selector: ['property', 'parameterProperty'],
format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ function SomeComponent({ icon: Icon, command }) {
const { other: Other } = command;
const iconComponentRef = null;
}

/** _destroy: true special property */
saveValue({ id: 'id', _destroy: true });

0 comments on commit 0c200d7

Please sign in to comment.