Skip to content

SyntaxError: Sequence items are not allowed on the same line with map keys #10

Closed
@ikatyang

Description

@ikatyang

Sorry for the bad title, I'm not sure how to name this issue.

version:
1.0.0-beta.6

input:

(extract from https://github.com/prettier/prettier/blob/d0cd112/.circleci/config.yml)

aliases:
  - restore_cache:
      - v1-yarn-cache
  - save_cache:
      paths:
        - ~/.cache/yarn
  - &restore_deps_cache
    keys:
      - v1-deps-cache-{{ checksum "yarn.lock" }}

output:

SyntaxError: Sequence items are not allowed on the same line with map keys (7:3)
  5 |       paths:
  6 |         - ~/.cache/yarn
> 7 |   - &restore_deps_cache
    |   ^^^^^^^^^^^^^^^^^^^^
> 8 |     keys:
    | ^^^^^^^^^
> 9 |       - v1-deps-cache-{{ checksum "yarn.lock" }}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

expected:

no error.

P.S. It parses correctly if there's no indentation:

aliases:
- restore_cache:
    - v1-yarn-cache
- save_cache:
    paths:
      - ~/.cache/yarn
- &restore_deps_cache
  keys:
    - v1-deps-cache-{{ checksum "yarn.lock" }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions