{"id":641,"hash":"8007df0078563b35ac94f6eb5e125e0cfe15bc9698bc0c35cb4e1defd6ac1602","pattern":"Parsing error: Unexpected token prettier/prettier caused by &quot;&lt;!DOCTYPE html&gt;&quot;","full_message":"I have this vue app which I create using vue cli and the version I use is vue2 (with eslint and prettier).\n\nI could run npm run serve and load my page. But in Visual Studio Code, I notice this error:\n\n{\n    \"resource\": \"/c:/vue/app2/public/index.html\",\n    \"owner\": \"eslint\",\n    \"code\": {\n        \"value\": \"prettier/prettier\",\n        \"target\": {\n            \"$mid\": 1,\n            \"external\": \"https://github.com/prettier/eslint-plugin-prettier#options\",\n            \"path\": \"/prettier/eslint-plugin-prettier\",\n            \"scheme\": \"https\",\n            \"authority\": \"github.com\",\n            \"fragment\": \"options\"\n        }\n    },\n    \"severity\": 4,\n    \"message\": \"Parsing error: Unexpected token\",\n    \"source\": \"eslint\",\n    \"startLineNumber\": 1,\n    \"startColumn\": 2,\n    \"endLineNumber\": 1,\n    \"endColumn\": 2\n}\n\nand this is my .eslintrc.js which is auto generated when I create the app and I didn't make any changes to it since then.\n\nmodule.exports = {  \n  root: true,\n  env: {\n    node: true\n  },\n  extends: [\"plugin:vue/essential\", \"eslint:recommended\", \"@vue/prettier\"],\n  parserOptions: {\n    ecmaVersion: 2020\n  },\n  rules: {\n    \"no-console\": process.env.NODE_ENV === \"production\" ? \"warn\" : \"off\",\n    \"no-debugger\": process.env.NODE_ENV === \"production\" ? \"warn\" : \"off\"\n  }\n};\n\nI notice that the error is actually referring to this line instead. Anyone knows what's wrong with this?\n\n<!DOCTYPE html>","ecosystem":"npm","package_name":"eslint","package_version":null,"solution":"I've met a similar issue. It was caused by <!DOCTYPE html>.\n\nThe fix is quite easy, we need to specify a parser in prettierrc, although it is obvious:\n\noverrides:\n  - files: '*.html'\n    options:\n      parser: 'html'\n  - files: '*.component.html'\n    options:\n      parser: 'angular'\n\nAfter that prettier is able to format files with <!DOCTYPE html>.\n\nCreds go to krave1986","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/64834991/parsing-error-unexpected-token-prettier-prettier-caused-by-doctype-html","votes":23,"created_at":"2026-04-19T04:51:25.713330+00:00","updated_at":"2026-04-19T04:51:25.713330+00:00"}