WebStorm treats working statement $# as an error in .less file - less

I've created a mixin that looks like this:
.elem( #map1, #name ){
#color: #map1[color];
color: #map2[$#color];
}
WebStorm underlines dollar sign $ as an error (and all the path to the file). Everything works in the project, but this makes me anxious whether I've followed the best practices or not.
Does anybody know how to safely get rid of this?

This LESS feature is not yet supported, please follow WEB-39083 for updates

Related

Vue: Failed to compile (Strings must use singlequote)

I've been working with Visual Studio Code for two days now. I try to build a Vue-Application. But always when I run the application by npm run serve, I get the following errors:
9:9 error Strings must use singlequote quotes
9:15 error Missing trailing comma comma-dangle
✖ 2 problems (2 errors, 0 warnings)
2 errors and 0 warnings potentially fixable with the `--fix` option.
I understand what these errors say, and I tried to type in strings in singlequotes and insert commas at the end of every line. But Visual Studio Code always removes the comma and turns singlequotes to doublequotes... Here you can see which plugins I have installed:
I had the same problem. It is likely caused by the file being formatted twice - first by vs code and then by eslint built in into vue-cli. Set the formatOnSave setting in VS Code to false and check if this solves your problem. It might. Nonetheless if you work on various (non-Vue) projects you will have to enable and disable this setting.
Disclaimer: This is a workaround that works for me. There's probably a more professional approach, I was not able to find it though.
Just in case this helps someone else. I too ran into this issue. I have this line in a components script:
props: ["login-signup"]
Every time I save it would switch to a double quote. I want formatting on save so that I don't have to mess with spacing and tabs. For me, I use vue3snippets extension in vscode. Opening settings (File->Preferences->Settings I typically use workspace, not user so I clicked Workspace) and searching for "singlequote" showed that "Vue3snippets: Single Quote" has a setting called "if true, will use single instead of double quotes" that was unchecked.
Checking this fixed the issue where the single quote in my line above would not format on save to a double quote and in turn fixing this error for me.
go to your main folder open .eslintrc.js and add the following in the rules
"
quotes: [0, "double"]
and then restart the project and do npm serve run again
I have found another way to fix the problem for the current project: I just created a
.prettierrc
config file, in which it is possible to specify the quote style with
"singleQuote": true
This might be a more general approach to tackle such a problem, because the direct project config apparently overrides the global configuration

Clang format for banner style

An open-source project I contribute to uses banner style (also called Ratliff style). It looks like that:
// In C
for (i = 0; i < 10; i++) {
if (i % 2 == 0) {
doSomething(i);
}
else {
doSomethingElse(i);
}
}
Some IDE's like QtCreator have their own configurations for formatting, but others, like Visual Studio Code, require a .clang-format file.
I looked online for existing configurations, and couldn't find any. Then I tried to make one from scratch using this clang-format generator, but I couldn't manage to indent the braces right.
So, is it possible to create a clang-format file for Ratliff/Banner style, or is there some missing configuration that will force us to use some other generator?
This answer is not going to be the "answer" that you were looking for, but it is what I've discovered over the last two days of digging through the code for clang-format. I, too, have been looking for a way to auto-format a variant of banner style with clang-format.
clang-format seems to be missing some capabilities that would enable it to auto-format banner style.
For instance, you need to indent ending (right) braces for code blocks. clang-format does not even appear to track ending braces, but it does track starting (left) braces within its internals.
I started out my studying streak thinking I could understand the way clang-format implements its formatter system, so I could add the features needed to do it. Sadly it was way too complicated for me.
Perhaps someday we will be able to auto-format banner style with clang-format, but not today.
If someone out there knows this answer is inaccurate, please don't hesitate to correct me.
edit: Instead of giving you just a verification of what can't be done with clang-format, perhaps you might find http://astyle.sourceforge.net useful.

SCSS will not compile, SASS error, no .sass files

Using VueJS to build an application. Everything has gone pretty well, and much has been done already. Suddenly, this error is happening. I've rolled back as far as I can reasonably and still see this error - I do no know what could have changed in the configuration that would cause this to suddenly appear.
Invalid CSS after "/* banners */": expected expression (e.g. 1px, bold), was "#mixin banner-red-t"
in C:\Projects\MyTestVueProject\src\App.vue (line 1534, column 1)
The file in question with this error is .scss and starts like this:
/* banners */
#mixin banner-red-text{
font-family:$font-family-primary;
font-weight:$font-weight-regular;
font-size:42px;
color: $red;
line-height:50px;
}
I have not a single .sass file in the entire project. Every component has lang="scss", style-resource-loader is set to preProcessor: 'scss' and every file involved has the .scss extension.
And yet, I get this error otherwise attributed to trying to compile SCSS as SASS everywhere else someone has asked.
I am using the node-sass and sass-loader packages, but these appear to be the correct packages to use for scss compilation.
"node-sass": "^4.12.0",
"sass-loader": "^7.1.0",
Has anyone found another reason to see the above error, and hopefully how to fix it? Barring that, any pointers on what else to look at will be taken and used to expand this question.
Another file, loaded immediately before this one in the style-resources-loader, was missing a ; after its final declaration. When the files are pre-loaded it is causing the singular virtual chunk of scss to be malformed.
Leave it to me to figure it out 25 seconds after I posted the question.

compile error using openssl

I try to use openSSL on a app but I get a parse issue on the following line (in the rsa.h header file)
int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx);
error is : parse error expected ')'
Using XCode 5 on OSX 10.9 and openssl-1.0.1e
What can be the issue?
Thanks for your help.
For anyone who sees this in the future, it's an amazingly simple solution: on the line quoted in the question, just change BIGNUM *I to BIGNUM *i. (That is, change the capital "I" to lowercase "i".)
Recompile, and everything should work! I have no idea why that works, but I trusted the interwebs and once again my faith was rewarded.
It could be all sorts of things, either in the header or in the file before the point the header is included. If by looking at the region of source around the point it is not obvious you can try preprocessing the file.
In Xcode select Product -> Perform Action -> Preprocess "file" and you'll get an editor window containing the source the compiler actually sees after file inclusion and macro expansion. In that locate the point of the error, look around, and work backwards if needed, untill you spot the problem.

Weird coffeescript code style in Intellij IDEA

I have this line in my coffeescript file
if someVariable then no else yes
One of the most valuable feature in IDEA for me is code clean up. But it doesn't work as I expect here. After pressing Ctrl+Alt+L, IDEA reformats this line to ugly
if someVariable then {
no
} else yes
Which is not just bad style but error when compile from coffeescript to javascript.
Here is similar line which couldn't be formatted properly by IDEA.
return true if someVariable is 5
...becomes...
{
return true
} if someVariable is 5
Why is that?
It's a bug caused by the if() statement, Force braces: Always setting in JavaScript Wrapping and Braces.
Issue is submitted to YouTrack.
That looks like JavaScript code style. Try checking settings under File>Settings>Project Settings>Code Style.
If you can't manage to set the code style to a correct form, then you still have the option to customize it yourself..
Eventually take a look # http://www.jetbrains.com/webstorm/webhelp/coffeescript-support.html, you might find something interesting if you haven't gone over it all ready. Good luck!