diff --git a/src/linter/linter.ts b/src/linter/linter.ts index 3221733..f09a54f 100644 --- a/src/linter/linter.ts +++ b/src/linter/linter.ts @@ -43,7 +43,7 @@ class DCLinter { try { context.sourceCode = fs.readFileSync(file, 'utf8'); - const doc = parseDocument(context.sourceCode); + const doc = parseDocument(context.sourceCode, { merge: true }); if (doc.errors && doc.errors.length > 0) { doc.errors.forEach((error) => { diff --git a/tests/mocks/docker-compose.anchors.yml b/tests/mocks/docker-compose.anchors.yml new file mode 100644 index 0000000..b22a337 --- /dev/null +++ b/tests/mocks/docker-compose.anchors.yml @@ -0,0 +1,22 @@ +name: fragment-example +x-shared-links: &shared-links + links: + - "foo:foo.example.svc.cluster.local" + - "bar:bar.example.svc.cluster.local" +x-shared-image: &shared-image + image: traefik/whoami +x-shared-ports: &shared-ports + - '81' + - '80:80' +services: + app_bar: + image: traefik/whoami + <<: *shared-links + app_foo: + <<: *shared-links + image: traefik/whoami:v1.10 + bar: + <<: *shared-image + ports: *shared-ports + foo: + <<: [*shared-image, *shared-links]