From 417604d2351a2fe4fe19b77e611d514e94bfdf93 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Tue, 19 Mar 2024 07:04:46 +0900 Subject: [PATCH] fix: flat config issues (#311) * fix: flat config issues * fix * Create polite-pumpkins-tickle.md * fix --- .changeset/polite-pumpkins-tickle.md | 5 +++++ src/configs/flat/base.ts | 4 +++- src/index.ts | 2 +- src/meta.ts | 4 ++-- tests/src/configs/standard.ts | 12 ++++++++++++ 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .changeset/polite-pumpkins-tickle.md diff --git a/.changeset/polite-pumpkins-tickle.md b/.changeset/polite-pumpkins-tickle.md new file mode 100644 index 00000000..f63ba2c9 --- /dev/null +++ b/.changeset/polite-pumpkins-tickle.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-yml": patch +--- + +fix: flat config issues diff --git a/src/configs/flat/base.ts b/src/configs/flat/base.ts index 227472b9..761c3f08 100644 --- a/src/configs/flat/base.ts +++ b/src/configs/flat/base.ts @@ -2,13 +2,15 @@ import type { ESLint } from "eslint"; import * as parser from "yaml-eslint-parser"; export default [ { - files: ["*.yaml", "**/*.yaml", "*.yml", "**/*.yml"], plugins: { get yml(): ESLint.Plugin { // eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore return require("../../index"); }, }, + }, + { + files: ["*.yaml", "**/*.yaml", "*.yml", "**/*.yml"], languageOptions: { parser, }, diff --git a/src/index.ts b/src/index.ts index 5c259dc9..3faef57e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,7 @@ import base from "./configs/base"; import recommended from "./configs/recommended"; import standard from "./configs/standard"; import prettier from "./configs/prettier"; -import flatBase from "./configs/base"; +import flatBase from "./configs/flat/base"; import flatRecommended from "./configs/flat/recommended"; import flatStandard from "./configs/flat/standard"; import flatPrettier from "./configs/flat/prettier"; diff --git a/src/meta.ts b/src/meta.ts index 68595940..ae3d09bd 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1,5 +1,5 @@ // IMPORTANT! // This file has been automatically generated, // in order to update its content execute "npm run update" -export const name = "eslint-plugin-yml" as const; -export const version = "1.13.0" as const; +export const name = "eslint-plugin-yml"; +export const version = "1.13.0"; diff --git a/tests/src/configs/standard.ts b/tests/src/configs/standard.ts index b87a2af9..cd139e78 100644 --- a/tests/src/configs/standard.ts +++ b/tests/src/configs/standard.ts @@ -61,5 +61,17 @@ describe("`standard` config", () => { }, ], ); + + const resultWithJs = await linter.lintText(";", { filePath: "test.js" }); + const messagesWithJs = resultWithJs[0].messages; + + assert.deepStrictEqual( + messagesWithJs.map((m) => ({ + ruleId: m.ruleId, + line: m.line, + message: m.message, + })), + [], + ); }); });