I'm using Prettier in VSCode, but it appears to be flagging mistakes that I think are ok.
Specifically, if I test a variable like:
if (myObject?.property1?.property2) {
....
}
(Not sure of the correct name for using questions marks like this) then it flags the question marks as invalid.
I can see there is an ecmaVersion setting in .prettierrc but this doesn't seem to do anything, and anyway, as I understand it, Node versions don't exactly follow ECMA versions anyway.
What can I do to make Prettier correctly lint my code?
Related
I know it can be done, but I'm having trouble getting it working. I'm still finding my feet with Haskell.
I tried using postgresql-typed, but it wouldn't compile. They don't enable the QuasiQuotes extension, so I don't understand how their code would ever compile. It also fails with an error on the useTPGDatabase statement. I cloned the library's source code from Github, but their tests failed to compile using stack with exactly the same errors.
I considered using hasql-th, but it's not on stackage.org, which immediately puts it in the "too hard basket.". I considered switching to nix but that seems like even more effort.
Does somebody have a reliable recipe for getting an environment working that type-checks SQL at compile time in Haskell?
I considered using hasql-th, but it's not on stackage.org, which immediately puts it in the "too hard basket."
All you need to do is add the latest version of hasql-th to the extra-deps section of your stack.yaml file and all other deps that Stack will suggest to you when you build.
In the end your stack.yaml file should look something like this:
resolver: lts-17.9
extra-deps:
- hasql-th-0.4.0.8
- headed-megaparsec-0.1.0.4
- postgresql-syntax-0.3.0.3
Anticipating a question in the spirit of "Why is it not listed on Stackage?" It's just that nobody has gotten to list these packages yet.
The Issue at Hand:
While using VSCode I am being notified twice of problems that occur inside of my documents. I found that other people were have problems that sounded similar, but I couldn't find a Q&A with a solution that helped. The most obvious place to look is in the VSCode settings. I tried several different settings that I read had help others in similar situations, but to no avail. Below is the list of settings I attempted to configure in hopes of finding a solution.
{
"typescript.format.enable": false,
"typescript.validate.enable": false,
"js/ts.implicitProjectConfig.checkJs": false,
"js/ts.implicitProjectConfig.strictFunctionTypes": false,
"js/ts.implicitProjectConfig.experimentalDecorators": false,
"js/ts.implicitProjectConfig.strictNullChecks": false,
}
More Detailed Explanation
Every forum/Q&A I visited, I never found someone who I felt was try to solve exactly the same issue that I am experiencing, I feel this is in part because it doesn't cause any hindrance, only annoyance. Some people probably rely on the problem notifications that I am trying to get rid of.
The issue due to the fact that I use ESLint, and Prettier. I equip ESLint with a plugin that gives the linter the ability to communicate with Prettier, which in turn, allows both Prettier and ESLint to communicate harmoniously to me through VSCode. ESLint & Prettier notify of every problem in my code I need to be aware of, therefore; I don't need to be notified by some other mechanism. The unwanted notifications come with a TS code every time they pop-up, because of this & the fact its VSCode, I am guessing it is a TypeScript/JavaScript formatter that comes with VSCode out-of-the-box, though I am pretty confident that, that is what it is, at this point I don't truly know. It is odd I don't see other people asking about "unwanted TS codes in the VSCode editor".
Demonstration of the Issue:
Below is a screenshot of my VSCode problems panel that demonstrates what is happening. In the screenshot I am intentionally causing an error by typing the Keyword function into the editor, followed by nothing else. You can see that ESLint is working as it should, it notifies me that there is a problem with entering the keyword function without any other code following. You'll notice it says there are 2 problems, though their is clearly only one, and that some mechanism other than my linter, and formatter is notifying me of the same problem. This annoys the hell-O out of me, because I can't trust the badges when they pop-up with a problem count, and I have to look through two sets of error codes to figure out why the editor is complaining.
In Final: Making the Question Being Asked Concise:
What I am asking, or what i would like to know, is this:
"How can I turn off the problem notifications that display the TS codes as shown in the image above. How can I configure VSCode so that only the formatter &/or linter of my choice notifies me of problems, so that I am not being notified of a single problem multiple times, by multiple processes ???"
Set "typescript.validate.enable": false for TS files and "javascript.validate.enable": false for JS files
This disables errors from the built-in JS/TS extension
Kotlin Repl does not open ,nothing happens on clicking it
My solution/workaround. What happens is, and by the way the Intellij ide warns you about this, that you create the project and when naming it you use a space or similar unsupported character and the ide still seems to create the project just fine but actually it doesn't. Your project comes out misconfigured and you can't use Kotlin Repl. The simplest solution is to replace any spaces (or similar forbidden characters) with a hyphen "-" or an underscore "_" or simply use cammelCase. Best of luck to everybody and hope future learners of kotlin see this and spend less time troubleshooting such a simple issue.
Do you have a project open when you click it? This post states: "At this time the Kotlin REPL requires you to have a project open. You don't need to configure anything specific in the project; a Java project with the default settings will run just fine.
If you want to try Kotlin without configuring anything, you can use the online IDE at http://try.kotlinlang.org/"
Is there a lint for Elixir (like for Javascript) which checks that every function has a type specification?
There is an Erlang compiler switch, +warn_missing_spec, which does this, but I'm having trouble getting it to work with Elixir at the moment, I think there is a bug with it's parsing of the ELIXIR_ERL_OPTS environment variable which is converting +warn_missing_spec into -warn_missing_spec which isn't a valid compiler option. I'm going to open an issue on the tracker, but thought you might like to know that this does indeed exist.
EDIT: As José mentioned below, the correct flag is ERL_COMPILER_OPTIONS. You can enable the missing spec warning during compilation by doing the following:
ERL_COMPILER_OPTIONS="warn_missing_spec" mix compile
Keep in mind you may get superfluous warnings from Elixir itself, for functions like __MODULE__. It should still be useful though. One last thing to note, I discovered this morning that there is a problem using this flag with mix compile, and that it's currently only warning about mix.exs. This is being fixed, and may even be fixed by the time you see this, but it's something to be aware of.
We are trying to use grunt-lesslint in our project, as our UI developer is comfortable fix errors in less file. grunt-recess seems more powerful but not sure if it can point errors in less file itself. I am unable to comprehend enough from lesslint page, and there do not seem to be many examples. Does anyone know the following:
How to prevent lesslint from displaying on the console. I use formatters and the report file is generated, but it also prints on console, which I do not want to.
How to make lesslint fail only in the case of errors (not warnings). Also csslint seems to report errors also, while lesslint mostly gives warnings only, why is that so? Does lesslint throw errors as well? How to make it fail only in case of errors?
I tried using 'checkstyle-xml' formatter, but it does not seem to use it (I have used in jshint and it gives a properly formatted xml, which it does not give for lesslint).
Is it possible to compile less (many files or directories) in conjunction with lesslint? Any example?
Thanks,
Paddy
I'd say it's more of a common practice to display stdout for this kind of thing; the JSHint plugin does it, as does any other linting plugin that I've used. If you get in another developer that uses Grunt they'll probably expect stdout too. If you really want to override this, use grunt-verbosity: https://npmjs.org/package/grunt-verbosity
Again, this is a convention in Grunt; if a task has any warnings then it fails. The reason being if you lint a file and the linter flags something up it should be dealt with straight away, rather than delay it; six months time you have 500 errors that you haven't fixed and you're less likely to fix them then. Most linting plugins allow you to specify custom options (I've used CSS Lint and that is very customisable), so if you don't like a rule you can always disable it.
This should work. If there's a bug with this feature you should report it on the issue tracker, where it will be noticed by the developers of the plugin. https://github.com/kevinsawicki/grunt-lesslint/issues
Yes. You can set up a custom task that runs both your linter and compile in one step: something like grunt.registerTask('buildless', 'Lint and compile LESS files.', ['lesslint', 'less']); note that you'll have to install https://github.com/gruntjs/grunt-contrib-less to get that to work. Also note that, failing linting will not compile your LESS files; mandate that your code always passes the lint check; you'll help everyone involved in the project.