TypeError: t.match is not a function
See original GitHub issueSummary
When running Prettier in VSCode, the following exception is thrown:
["INFO" - 1:43:42 PM] Loaded module 'prettier@1.17.0' from 'C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier'
["INFO" - 1:43:42 PM] Using ignore file (if present) at d:\Documents\Projects\moorecodes\.prettierignore
["INFO" - 1:43:42 PM] File Info:
{
"ignored": false,
"inferredParser": "typescript"
}
["INFO" - 1:43:42 PM] No local configuration (i.e. .prettierrc or .editorconfig) detected, falling back to VS Code configuration
["INFO" - 1:43:42 PM] Prettier Options:
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "d:\\Documents\\Projects\\moorecodes\\src\\SomeProject\\Header\\index.tsx",
"parser": "typescript"
}
["INFO" - 1:43:42 PM] Loaded module 'prettier@1.17.0' from 'C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier'
["INFO" - 1:43:42 PM] Formatting using 'prettier-tslint'
["ERROR" - 1:43:42 PM] Error formatting document.
t.match is not a function
TypeError: t.match is not a function
at Object.e.extract (C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier\parser-babylon.js:1:1119)
at Object.h [as hasPragma] (C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier\parser-babylon.js:1:2691)
at format (C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier\index.js:14030:63)
at formatWithCursor (C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier\index.js:14117:12)
at C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier\index.js:42518:15
at format (C:\Users\nate2\AppData\Roaming\npm\node_modules\prettier\index.js:42537:12)
at c:\Users\nate2\.vscode\extensions\esbenp.prettier-vscode-3.13.0\dist\extension.js:1:352591
at t.default.safeExecution (c:\Users\nate2\.vscode\extensions\esbenp.prettier-vscode-3.13.0\dist\extension.js:1:353582)
at t.default.<anonymous> (c:\Users\nate2\.vscode\extensions\esbenp.prettier-vscode-3.13.0\dist\extension.js:1:352554)
at Generator.next (<anonymous>)
at s (c:\Users\nate2\.vscode\extensions\esbenp.prettier-vscode-3.13.0\dist\extension.js:1:347571)
["INFO" - 1:43:42 PM] Formatting completed in 17.5141ms.
This happens with both auto-format on save and when running the format command.
VS Code Version:
Version: 1.41.0 (system setup)
Commit: 9579eda04fdb3a9bba2750f15193e5fafe16b959
Date: 2019-12-11T18:37:42.077Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362
Prettier Extension Version:
Name: Prettier - Code formatter
Id: esbenp.prettier-vscode
Description: Code formatter using prettier
Version: 3.13.0
Publisher: Esben Petersen
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
OS and version:
Windows 10
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:26 (11 by maintainers)
Top Results From Across the Web
JavaScript error: "val.match is not a function" - Stack Overflow
I would say that val is not a string. I get the. val.match is not function. error for the following var val=12; if(val.match(/^s+$/)...
Read more >Uncaught TypeError: t.match is not a function , in production ...
Needs definetely fix! npm run server:dev. still works.
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >Encountered Uncaught TypeError: a.match is not a function ...
Hi guys,. I have been trying to implement horizontal scroll for my datatable, but i keep getting this error - Uncaught TypeError: a.match...
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can downgrade to the previous version (3.12.0) from VSCode which will revert the breaking changes introduced in 3.13.0.
You have to reload the window (or restart VSCode) for the changes to take effect.
I think i fixed it, try updating to 3.14.0. I accidentally left a hard-coded string in that was supposed to be a variable. See: https://github.com/prettier/prettier-vscode/blob/69af3e2713c0e0411b0e1deaf18bfd21dca220c1/src/ModuleResolver.ts#L148
Not sure how tests didn’t get this. I need to investigate, but don’t have time right now. My wife gave birth to our second kid last night so just doing a bit of work while they are both sleeping. 😉
Let me at least know that this fixed the problem.