How to prevent stylelint from generating error on first word of JS file? - stylelint

I just switched to stylelint. When I open a JS file, it registers an error on the first word in code:
import React from 'react';
It highlights "import" and flags it with Unknown word (CssSyntaxError)
OTW, it's great for my CSS.

Similar question here:
Can I stop stylelint extension from validating JavaScript file?
However, the selected answer is in the stylelint documents as a non-preferred method for skipping JS files:
https://github.com/stylelint/stylelint/blob/master/docs/user-guide/configuration.md#ignorefiles
The preferred answer is found in the docs here:
https://github.com/stylelint/stylelint/blob/master/docs/user-guide/configuration.md#ignorefiles
Create .stylelintignore file and set it up like .gitignore. I added **/*.js and stylelint ignores my JS files.
I am using React and I am not sure if stylint should look at JS files. However, this has fixed my problem for now. If stylelint is supposed to look at JS files, I'd be interested in how I should configure it to work correctly.

Related

Visual Studio Code - Live Server - Html Displays but no CSS markup

I have used VSC with LiveServer for some years with only 1 problem, back a few years ago when either LiveServer or Windows10 had an update installed, next time I opened my HTML file in LiveServer, the HTML was rendered in a "basic" layout, and did not include my CSS Styles.
On an Internet search I found a solution for either this site or similar where I needed to add a line of code to either LS or Windows, sorry but I cant remember which. And all was well again until, now. The very same problem has returned, and no matter how much I search, I cant fine the solution.
There are plenty where there were errors in HTML or CSS, but this is occurring on files which haven't changed, and on new ones from the same master I use for my new pages. The screenshot included shows the HTML, LS as basic HTML and how the page loads on the browser directly. I am using Chrome, but have tried on Firefox with same results.
How LS displays and how it should be
You need to open your VS Code project from a directory that contains your HTML and CSS.
Your HTML document is in the root directory of your project (hence the URL being /filename) but you are trying to load CSS from ../../css/filename.
The project needs to be two directories higher for the webserver to include that path.

VSC won't format code although eslint file exists and settings are set to fix on save

I'm using VSC for backend and frontend development with Express, Nest, Angular, React and Vue (JS and TS).
I removed my prettier extension because for Vue projects I'm using the Airbnb code style and it didn't work with the prettier extension.
Currently my VSC settings are
https://gist.github.com/matthiashermsen/425609b71c7f6d1907fced3eaf2a6021
VSC does not format the code on save. When I'm using double quotes in a .ts file I would expect it to format it based on the linter file so it would replace the double quotes with single quotes. Or it would break the line if there are too many characters per line.
So for example this line
import { ApiOkResponse, ApiCreatedResponse, ApiConflictResponse, ApiNotFoundResponse, ApiBadRequestResponse, ApiBody, ApiParam, ApiQuery, ApiTags, ApiOperation } from '#nestjs/swagger';
should be formatted on save because it's too long.
Would someone mind telling me how to configure VSC that it's able to deal with every code style and every linter file and formats on save?
The editor is able to format HTML code in Vue files on save but it's not able to format .ts files in my NestJs backend.
Try "eslint.autoFixOnSave": true
And possibly "editor.defaultFormatter": "dbaeumer.vscode-eslint"
You can also make this language specific, if you don't want ESLint to be your default formatter for all languages.
Finally, if the above don't work, try commenting out all of your other settings except for these, and then re-enable one by one to see if something is getting in the way.
Note of course that you have to have ESLint extension installed

How does GitHub's Gist embed work?

Let's suppose that I have a file named my_python_code.py, and I upload it to GitHub's gist. Now I embed that gist into my blog, using the code provided by GitHub on the corresponding page.
When I browse my blog and I check the source code for the page, I discover that:
the embed code calls a js file which performs some DocumentWrite commands, inserting the appropriate html tags (with css styles) on my page, and
the associated css file is linked to my page. This file contains css declarations for 'gist' class as well as other classes.
This is all very nice. But I wonder: starting from the same my_python_code.py file, what would I have to do to end up with the same final html code?
I've tried using pygments and rouge (via pygmentize and rougify commands) with reasonable options but none of them highlights the original code using 'gist' tags (among others) as is done when performing the GitHub embed.

Adding custom file extension to netbeans ide

I'm using NetBeans 7.2.1 for my developments with CodeIgniter/Bonfire.
In my controllers i'm loading my for the view needed JavaScripts via
Assets::add_js($this->load->view('admin/index_js', $data, true), 'inline');
to preparse some php variables in the JavaScript (like dynamic url's).
This forces me to save these JavaScript files witht he extension ".php" so that i can load it via
$this->load->view
All these JavaScript files are using the filename syntac
*_js.php
Since i load it via view and Assets with "inline" parameter i can't put the
<script>
</script>
tags in the script so NetBeans is not recognizing it as JavaScript and i have no syntax highlightning and no formatting options.
Any idea how i can get it that NetBeans can recognize it as JavaScript?
Thanks a lot.
Okay... got it...
One of my collegues made a change to the assets library to "erase" the script tags from assets::js inline included files:
http://forums.cibonfire.com/discussion/1134/assetsjs-inline_js-change-to-load-js-via-view#Item_1

change html output doxygen link

I am working on a project that is heavily documented with doxygen.
In a UI I have a list of all the classes available - I would like to be able to open the right documentation page of the class I select. In order to do that I need an easy to read link, so I can dynamically build it and run it.
Is it there any way I can control the generated link of the html file? Because the ones I have right now are impossible do be built dynamically.
You could use Doxygen's tag file mechanism for that (see GENERATE_TAGFILE in the config file).
A tag file is a reasonably easy to understand and parse XML file that basically lists all symbols in your project, with for each symbol the corresponding (relative) URL to the documentation.
So you could parse the tag file from your UI to resolve the links to the doxygen generated documentation in a robust way.