Jalal
Jalal

Reputation: 3644

error Parsing error: Unexpected character '#' in md file

Everything was fine, until I added lint-staged using husky.

I got error related to README.md

packages\README.md
1:1  error  Parsing error: Unexpected character '#'

> 1 | # @folo/forms
  | ^

In package.json:

  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,jsx,md}": [
      "eslint --fix",
      "prettier --write",
      "git add"
    ]
  }

What I am missing? Why this only happening when I run eslint and doesn't throw error inside my Atom editor?

Upvotes: 3

Views: 4557

Answers (1)

Jalal
Jalal

Reputation: 3644

Here's my humble solution for this:

  "lint-staged": {
    "*.{js,jsx}": [
      "eslint --fix",
      "prettier --write",
      "git add"
    ],
    "*.{md}": [
      "prettier --write",
      "git add"
    ]
  }

I don't need to lint my .md files. Just run prettier.

Upvotes: 7

Related Questions