Unexpected character encountered while parsing value: =. Path '', line 0, position 0.
Closed this issue · 9 comments
We have installed this extension in VS2019 and whenever we make a change to file and save it we are getting the error
Unexpected character encountered while parsing value: =. Path '', line 0, position 0.
However the errors are displayed in the error list. Dont know which is causing the issue.
this is the config file we have
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/recommended' // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
rules: {
"@typescript-eslint/interface-name-prefix": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/array-type": "error"
}
};
Thanks
Hey @rbmanian75 thanks for the report. Could you share the source code for the file throwing the error?
Oh sorry we cant share the source. Since it is part of big project. But when i run eslint from command line it works without any errors.
but i get this in the output
[{"filePath":"C:\S\SGC\Sgc.Web\Sgc.Web\Scripts\Default.ts","messages":[{"ruleId":"@typescript-eslint/prefer-namespace-keyword","severity":2,"message":"Use 'namespace' instead of 'module' to declare custom TypeScript modules.","line":1,"column":1,"nodeType":"TSModuleDeclaration","messageId":"useNamespace","endLine":485,"endColumn":2,"fix":{"range":[0,6],"text":"namespace"}},{"ruleId":"@typescript-eslint/no-namespace","severity":2,"message":"ES2015 module syntax is preferred over custom TypeScript modules and namespaces.","line":1,"column":1,"nodeType":"TSModuleDeclaration","messageId":"moduleSyntaxIsPreferred","endLine":485,"endColumn":2},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":5,"column":38,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":5,"endColumn":41},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":28,"column":40,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":28,"endColumn":43},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":43,"column":35,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":43,"endColumn":38},{"ruleId":"@typescript-eslint/explicit-member-accessibility","severity":2,"message":"Missing accessibility modifier on method definition constructor.","line":89,"column":9,"nodeType":"MethodDefinition","messageId":"missingAccessibility","endLine":105,"endColumn":10},{"ruleId":"@typescript-eslint/array-type","severity":2,"message":"Array type using 'Array' is forbidden. Use 'any[]' instead.","line":89,"column":42,"nodeType":"TSTypeReference","messageId":"errorStringArray","endLine":89,"endColumn":52,"fix":{"range":[2641,2651],"text":"any[]"}},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":89,"column":48,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":89,"endColumn":51},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":114,"column":35,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":120,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":122,"column":30,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":124,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":126,"column":24,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":130,"endColumn":10},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":126,"column":61,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":126,"endColumn":64},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":143,"column":26,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":167,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":173,"column":31,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":185,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":192,"column":31,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":230,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":237,"column":37,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":256,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":262,"column":32,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":269,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":271,"column":36,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":285,"endColumn":10},{"ruleId":"@typescript-eslint/no-unused-vars","severity":1,"message":"'event' is defined but never used.","line":271,"column":37,"nodeType":"Identifier","endLine":271,"endColumn":48},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":271,"column":45,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":271,"endColumn":48},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":287,"column":35,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":301,"endColumn":10},{"ruleId":"@typescript-eslint/no-unused-vars","severity":1,"message":"'event' is defined but never used.","line":287,"column":36,"nodeType":"Identifier","endLine":287,"endColumn":47},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":287,"column":44,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":287,"endColumn":47},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":303,"column":35,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":305,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":307,"column":28,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":324,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":335,"column":43,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":339,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":341,"column":34,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":370,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":353,"column":17,"nodeType":"ArrowFunctionExpression","messageId":"missingReturnType","endLine":353,"endColumn":91},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":372,"column":36,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":391,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":393,"column":31,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":414,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":416,"column":40,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":443,"endColumn":10},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":433,"column":21,"nodeType":"ArrowFunctionExpression","messageId":"missingReturnType","endLine":441,"endColumn":22},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":439,"column":29,"nodeType":"ArrowFunctionExpression","messageId":"missingReturnType","endLine":439,"endColumn":60},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":448,"column":39,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":456,"endColumn":10},{"ruleId":"@typescript-eslint/array-type","severity":2,"message":"Array type using 'Array' is forbidden. Use 'any[]' instead.","line":448,"column":61,"nodeType":"TSTypeReference","messageId":"errorStringArray","endLine":448,"endColumn":71,"fix":{"range":[16587,16597],"text":"any[]"}},{"ruleId":"@typescript-eslint/no-explicit-any","severity":1,"message":"Unexpected any. Specify a different type.","line":448,"column":67,"nodeType":"TSAnyKeyword","messageId":"unexpectedAny","endLine":448,"endColumn":70},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":465,"column":25,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":474,"endColumn":10},{"ruleId":"@typescript-eslint/no-unused-vars","severity":1,"message":"'y' is assigned a value but never used.","line":468,"column":19,"nodeType":"Identifier","endLine":468,"endColumn":20},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":470,"column":20,"nodeType":"ArrowFunctionExpression","messageId":"missingReturnType","endLine":473,"endColumn":14},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":472,"column":43,"nodeType":"ArrowFunctionExpression","messageId":"missingReturnType","endLine":472,"endColumn":55},{"ruleId":"@typescript-eslint/explicit-function-return-type","severity":2,"message":"Missing return type on function.","line":476,"column":52,"nodeType":"FunctionExpression","messageId":"missingReturnType","endLine":481,"endColumn":10}],"errorCount":30,"warningCount":11,"fixableErrorCount":3,"fixableWarningCount":0,"source":"module Pages {\r\n\r\n "use strict";\r\n\r\n declare let libMenuSidebarReact: any;\r\n\r\n /\r\n * Script file associated with Default.aspx.\r\n */\r\n export class Default extends Pages.SuperPage {\r\n\r\n //#region Static Variables\r\n\r\n public static Page: Default;\r\n\r\n //#endregion\r\n\r\n //#region Instance Variables\r\n\r\n /\r\n * Is the contentFrame still loading ?\r\n */\r\n public isContentFrameLoading: boolean = false;\r\n\r\n /\r\n * Class instance for MenuSiebar's App entry point class\r\n */\r\n public libMenuSidebarReactApp: any = null;\r\n\r\n /\r\n * Is the jqxSplitter collapsed ?\r\n */\r\n private isSplitterCollapsed: boolean = false;\r\n\r\n /\r\n * the top container (SGC top image + superfish menu)\r\n */\r\n private $headerContainer: JQuery = null;\r\n\r\n /\r\n * the central container (menu sidebar + splitter + content frame)\r\n */\r\n private $centerContainer: any = null;\r\n\r\n /\r\n * the container
Unexpected character encountered while parsing value: =. Path '', line 0, position 0.
I am not sure whether the problem is the config file or source.
Thanks
Ok. I'll have a look tomorrow. You can edit your comment above as it contains some information you might not want to share. Just a heads up.
I have what I need to debug this issue though. Thanks!
@rbmanian75 Could you share your package json, including versions for installed dependencies?
Thanks!
Hi @rbmanian75
The cause of this error is because the typescript-eslint
dependency typescript-estree
is using stdout to warn about an unsupported TypeScript version. See below:
exception: error trying to deserialize output:
=============
WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.2.1 <3.5.0
YOUR TYPESCRIPT VERSION: 3.5.1
Please only submit bug reports when using the officially supported version.
=============
[{ ... json }]
VisualLinter expect the output to be json, but since the warning message is part of the stdout stream, we cannot deserialize the output. See this line:
https://github.com/jwldnr/VisualLinter/blob/master/src/VisualLinter/Linting/Linter.cs#L58
You can disable this warning (once you've acknowledged it of course) by setting warnOnUnsupportedTypeScriptVersion: false
in your eslint config file (e.g. .eslintrc.js
) under parserOptions
.
See the documentation for more information:
https://github.com/typescript-eslint/typescript-eslint/blob/f513a143f549f8ccc8ec4851f245364c4542af73/packages/parser/README.md#configuration
Hope I've shed some light to resolving this issue. I'm going to close this issue, but if there's anything else- don't hesitate to ask!
thanks for the reply. It helped us in solving the issue.
but small correction
warnOnUnsupportedTypeScriptVersion: false in your package.json under parserOptions
this has to be done in the eslint configuration file and not in package.json.
@rbmanian75 of course! I've edited the response above. Thanks!