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 55b389a
Show file tree
Hide file tree
Showing 3 changed files with 19 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` and `_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,12 @@ function SomeComponent({ icon: Icon, command }) {
const { other: Other } = command;
const iconComponentRef = null;
}

/** _destroy: true special property */
saveValue({ id: 'id', _destroy: true });
cy.wait('@monolithSettings_PUT_/sections/1')
.its('request.body')
.should('deep.equal', {
name: 'section 1',
_destroy_background_image: true,
});

0 comments on commit 55b389a

Please sign in to comment.