ota-meshi / eslint-plugin-yml

This ESLint plugin provides linting rules for YAML.
https://ota-meshi.github.io/eslint-plugin-yml/
MIT License
122 stars 13 forks source link

docs request: example with flat configs and eslint ^8.9.0 #370

Open JessicaSachs opened 1 month ago

JessicaSachs commented 1 month ago

Hello! I have a modern Nuxt project which uses the new eslint flat config syntax. The documentation you currently have shows off parsing options that are for the deprecated .eslintrc and nested options.

I was trying to figure it out but the ESlint documentation isn't too helpful. Could you help me figure out how to specify a parser that works well with Yaml files? I also tried to read the other eslint-plugin-yaml documentation, but because I'm writing a Vue project - your support of yaml within SFCs is attractive.

ota-meshi commented 1 month ago

I don't know why it doesn't work in your environment. Did you try specifying the following and it didn't work?

import eslintPluginYml from 'eslint-plugin-yml';
export default [
  ...eslintPluginYml.configs['flat/base'], // or eslintPluginYml.configs['flat/recommended']
  {
    rules: {
      // Add rules settings here, such as:
      // 'yml/block-mapping': 'error'
    }
  }
];

https://ota-meshi.github.io/eslint-plugin-yml/user-guide/#new-config-eslint-config-js