dukeluo / eslint-plugin-check-file

ESLint rules for consistent filename and folder. Allows you to enforce a consistent naming pattern for the filename and folder.

Home Page:https://www.npmjs.com/package/eslint-plugin-check-file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markdown file support

joris-fonck-loreal opened this issue · comments

Describe the bug

When I configure the filename rule to be able to add a rule on .md files, the rule does not work.

Expected behavior

.md files are linted.

Plugin configuration

'check-fike/filename-naming-convention': ['error', {
  '**/*.{md}': '+([a-z])',
}],

Project structure

.
└── my-app/
    └── READme.md

Desktop (please complete the following information):

  • OS: Windows

Additional context

When I set the READme.md extension to .js, it works.

Seems like it's only works for js, jsx, ts and tsx extensions.

commented

@joris-fonck-loreal ESLint is a tool designed for analyzing and checking JavaScript code for syntax and stylistic errors. If you want to lint markdown file, you need to install a another parser for ESLint https://www.npmjs.com/package/markdown-eslint-parser. You can do like this:

{
  "plugins": ["check-file"],
  "overrides": [
    {
      "files": ["**/*.md"],
      "parser": "markdown-eslint-parser"
    }
  ],
  "rules": {
    "check-file/filename-naming-convention": [
      "error",
      {
        "**/*.{js,md}": "KEBAB_CASE"
      }
    ]
  }
}