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

prefer-unquoted-property-names linter rule incorrectly flags keywords #13347

Closed
anthony-c-martin opened this issue Feb 15, 2024 · 0 comments · Fixed by #14360
Closed

prefer-unquoted-property-names linter rule incorrectly flags keywords #13347

anthony-c-martin opened this issue Feb 15, 2024 · 0 comments · Fixed by #14360
Labels
bug Something isn't working
Milestone

Comments

@anthony-c-martin
Copy link
Member

anthony-c-martin commented Feb 15, 2024

The following is valid Bicep:

var test = {
  'null': 'asdf'
  'true': 'asdf'
  'false': 'asdf'
}

This linter rule tries to encourage the following, which is invalid Bicep:

var test = {
  null: 'asdf'
  true: 'asdf'
  false: 'asdf'
}

Similar issue with property access:

var foo = [
  test['null']
  test['true']
  test['false']
]

Is converted to:

var foo = [
  test.null
  test.true
  test.false
]

The decompiler also generates incorrect code for this

@stephaniezyen stephaniezyen added the bug Something isn't working label Feb 28, 2024
@stephaniezyen stephaniezyen added this to the v1.0 milestone Feb 28, 2024
polatengin pushed a commit that referenced this issue Jun 17, 2024
Convert `none` from a dedicated token, to an identifier token, as per
the other keywords we have implemented in the language.

The problem with parsing as a dedicated token is that it results in
`none` being unusable elsewhere in Bicep (e.g. `var none = 'none'` would
fail compilation).

(unrelated) I think this explains #13347!
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/14358)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants