TypeScript: static class properties invalid
From @nwehrle on February 9, 2016 21:17
I use eslint to lint my jsx files. Before I switched to salsa, the linting inside the editor worked fine. After switching to salsa the linting fails inside the editor.

Salsa is enabled:

Linting from the shell still works without any errors or warnings. I expect vscode to not show any linting errors.
System: OSX 10.11.2 vscode 0.10.8 db71ac615ddf9f33b133ff2536f5d33a77d4774e
jsconfig.json:
{
"compilerOptions": {
"target": "ES6",
"module": "system",
"experimentalDecorators": true
},
"exclude": [
"node_modules"
]
}
User settings:
{
"javascript.validate.enable": false,
"editor.tabSize": 2,
"files.trimTrailingWhitespace": true,
// Migrated from previous "File | Auto Save" setting:
"files.autoSave": "onFocusChange"
}
Partial eslintrc:
"rules": {
"func-names": 0,
"no-unused-expressions": 0,
"id-length": 0,
"no-multi-spaces": 0,
"no-mixed-spaces-and-tabs": 2,
"no-unused-vars": [1, {"vars": "all", "args": "none"}],
"react/jsx-uses-react": 1,
"react/prop-types": 0,
"no-console": 0
},
"plugins": [
"react"
]
Copied from original issue: Microsoft/vscode#2866
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 32 (14 by maintainers)
Seems like we should allow any syntax that the TypeScript parser is capable of recognizing and is part of a JavaScript standards proposal (regardless of stage), and leave it up to the user to figure out if their target engine is capable of supporting it (just as they have to for classes, arrow functions, etc…).
Writing code which does not make sense is not a good workaround for bad syntax highlighting in text editor 😉
This got fixed in TS 2.0. VS Code 1.5.1 ships with TS 1.8.1. To use TS 2.0 pls see https://code.visualstudio.com/docs/languages/typescript#_using-newer-typescript-versions
@robcaldecott @davezuko
"javascript.validate.enable"is now available again in the version available on the insiders channel (release notes)Thanks. I’ve added a jsconfig.json file at root directory containing:
It seems it had remove salsa validation, while eslint is still enabled. Just perfect for my use case.
I think the problem here is that many React templates are using Flow syntax here and there. Many of the default bootstrap React templates have Flow as a babel preset. This is using Flow Class declarations, which is a proposal for ES, currently in stage 2.
I don’t believe the right answer for this is to allow class declarations in .js files, yet, though there is a proposal for it. There is a larger issue, I suppose, of allowing TypeScript/VS Code/Salsa/etc. to play nicely with Flow and all its reliance on babel plugins on regular .js files.
The current fix for this is to install the Flow tooling for VS Code and set a workspace setting for
"javascript.validate.enable": false. This addressed my problem.the issue has not been fixed, and is still open. hopefully we will get to it soon. sorry for the trouble.
I don’t own the package; this is the sample code generated by Ignite for Reactive Native. So I could change it on my local system, but that seems like a poor workaround for something which should work.
I like Facebook Flow approach on this. The compiler says that some syntax is experimental, but in order to suppress this message add some config to the
.flowconfig. tsc parser recognizes the syntax, but the behaviour is hardcoded. Bad.@Charmatzis until this issue has been addressed you can disable the syntax errors, pls see the following doc
@robcaldecott pls see this comment https://github.com/Microsoft/vscode/issues/3804#issuecomment-194250393. This will be in the march update.
The warning comes from Salsa - moving.