feat: 🎸 Add linting to code editor (#3211)

* feat: 🎸 Add linting to code editor

* refactor: 💡 add missing case for wildcard type & ids field

* refactor: 💡 simplify condition + add more tests

* refactor: 💡 cleanup ids validation logic and add more lint erro

* refactor: 💡 simplify logic and add actions linting cases

* feat: 🎸 Add autocompletion to code editor (#3207)

* refactor: 💡 apply PR feedback

* refactor: 💡 PR feedback

* refactor: 💡 add noop action

* fix: 🐛 noop should not be suggested with resource type format

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-18462

---------

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
This commit is contained in:
Lisbet AlvarezandZhihe Li authored and Zhihe Li committed 2026-05-14 15:21:29 -04:00
1 parent dc224268f5
commit 1d126dc074
7 files changed
+1078 -8

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ export default factory.extend({
'set-grant-scopes',
],
grant_strings: () => [
'ids=*;action=*',
'ids=*;actions=*',
'ids=*;type=host-catalog;actions=create,read',
],
@@ -670,6 +670,51 @@ role:
wildcard-actions: Wildcard - matches all actions
template-value: Template value
all-fields: All fields
linting-errors:
general:
whitespace-not-allowed: Whitespace is not allowed
leading-semicolon-not-allowed: Leading semicolon is not allowed
trailing-semicolon-not-allowed: Trailing semicolon is not allowed
invalid-character: Invalid character "{character}"
invalid-format: 'Invalid format: expected key=value'
invalid-syntax: Invalid syntax
fields:
duplicate-field: Duplicate field "{field}"
unknown-field: Unknown field "{field}"
empty-value: '"{field}" value cannot be empty'
missing-ids-or-type: Missing "ids" or "type" fields
missing-actions: Missing "actions" field
missing-actions-or-output-fields: Missing "actions" or "output_fields" fields
type:
invalid-type: Invalid resource type "{type}"
not-top-level: Type "{type}" is not a top-level type
not-child-type: Type "{type}" is not a child type of the pinned ID
missing-for-wildcard-ids: Missing "type" field for wildcard ids
wildcard-requires-ids: Missing "ids" field for wildcard type
ids:
empty-list: '"ids" field does not contain at least one id'
wildcard-cannot-combine: Wildcard id "*" cannot be combined with other ids
duplicate-template: Duplicate id "{primary}" and "{secondary}"
duplicate-id: Duplicate id "{id}"
unknown-template: Unknown template "{id}"
invalid-id: Invalid id "{id}"
mismatched-types: Ids do not have the same type. Invalid id "{id}"
must-support-child-types: Pinned IDs must support child types. Invalid id "{id}"
must-match-parent-type: Pinned IDs must be "{parentType}" ids. Invalid id "{id}"
actions:
empty-list: '"actions" field does not contain at least one action'
wildcard-cannot-combine: Wildcard action "*" cannot be combined with other actions
duplicate-action: Duplicate action "{action}"
invalid-action: Invalid action "{action}"
id-only: Only id actions for "{type}" type are allowed. Invalid action "{action}"
collection-only: Only collection actions are allowed. Invalid action "{action}"
noop-requires-list: '"no-op" action should only be used with "list" action'
list-requires-noop: '"list" action should be used with "no-op" action to have an effect'
noop-unnecessary: '"no-op" action is unnecessary when other actions are specified'
editor:
remove: Remove
remove-comma: Remove comma
add-noop: Add "no-op" action
editor:
title: Grant Editor
description: Add each new grant string on a different line