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

fix: flat config issues #311

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/polite-pumpkins-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-yml": patch
---

fix: flat config issues
4 changes: 3 additions & 1 deletion src/configs/flat/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/meta.ts
Original file line number Diff line number Diff line change
@@ -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";
12 changes: 12 additions & 0 deletions tests/src/configs/standard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})),
[],
);
});
});
Loading