Files
TeyvatGuide/eslint/ymlEslint.js
2026-05-19 23:19:07 +08:00

26 lines
710 B
JavaScript

/**
* YAML 文件的 ESLint 配置
* @since Beta v0.10.2
*/
import pluginYml from "eslint-plugin-yml";
import * as ymlParser from "yaml-eslint-parser";
const eslintConfigYml = [
{
files: ["**/*.yml", "**/*.yaml", "pnpm-workspace.yaml", ".stylelintrc.yml", ".prettierrc.yml"],
plugins: { yml: pluginYml },
languageOptions: {
parser: ymlParser,
parserOptions: { defaultYAMLVersion: "1.2", extraFileExtensions: [".yaml", ".yml"] },
},
rules: {
"yml/indent": ["error", 2],
"yml/key-spacing": ["error"],
"yml/quotes": ["error", { prefer: "double", avoidEscape: true }],
"yml/sort-keys": ["error", "asc"],
},
},
];
export default eslintConfigYml;