Skip to content

Commit

Permalink
fix: flat config issues (#311)
Browse files Browse the repository at this point in the history
* fix: flat config issues

* fix

* Create polite-pumpkins-tickle.md

* fix
  • Loading branch information
ota-meshi committed Mar 18, 2024
1 parent 03d4cfa commit 417604d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
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,
})),
[],
);
});
});

0 comments on commit 417604d

Please sign in to comment.