How to lint .cshtml files? - asp.net-core-mvc

Using ESLint, it's easy to lint *.js files. Using a plugin like html or script-tag, it's also simple to lint JavaScript code inside tags in *.html files.
However, when it comes to script tags inside *.cshtml files, I'm stuck.
Does anyone know how to lint *.cshtml files or recommend a different linting tool for that?

Related

How to get source-mapped folders and files. There are no bundler/compiler retains source maps

The previous quitter couldn't contact anyone and made the file like that.
There are no original files in directories.
So, anyway no one answered my past same questions. /
I have only source files that are no Scss and no bundler. /
I couldn't upload that files via Github .. sorry
I think... this project was using 'webpack'. And that project used 'inline' as the 'source map' option.
there are scss files in Chrome browser /
there are no files in that directories

SonarCloud requiring code coverage for files ignored with Istanbul

I have a JavaScript app where we generate a code coverage report using Istanbul and use SonarCloud for static analysis.
There are two ways we exclude code from the Istanbul. The first is to set exclusion paths. In jest.config.js we have this to exclude patterns:
"coveragePathIgnorePatterns": [
"source/legacy"
]
The second way is to use Istanbul ignore comments in source files like /* istanbul ignore file */. In either case the ignored file will not be part of the generated report file.
In our Sonar configuration we set it to use the generated lcov.info report file with the sonar.javascript.lcov.reportPaths property. However we then also need to set sonar.coverage.exclusions to exclude patterns like source/legacy because it is not treating the lcov.info report as the source of truth. This is acceptable but duplicates configuration, which is unfortunate. The real problem is that I cannot find any way to get Sonar to handle the files excluded with /* istanbul ignore file */.
Is there some way to make Sonar treat the lcov.info file as its source of truth, such that any file that is not included in the file is excluded from coverage?
Alternately, is there a way with Istanbul where I can make it list ignored files but say that they are ignored? Maybe that way Sonar will see that they are ignored.
For those looking for a solution, you unfortunately need to tell sonarqube to ignore this file explicitly. Not an ideal solution, but what I ended up with.
docs: https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/
I put my filename in sonar.coverage.exclusions.
What my organization ended up doing was making a policy to just not use istanbul ignore file comments, and instead ignore each function on a file. Also not ideal.

NativeScript exclude *.js from /src

Base on the tutorial, after execute the tns run ios. Compiled *js will allocate the /src folder.
How do I exclude the *.js compiled at /src folder?
Put it at webpack.config.js ?
As Nick mentioned *.js files are what NativeScript uses to run your program, so you can't get rid of them. However when using an editor such as NativeScript, you can configure your settings to ignore and not display the .js files - makes for much easier navigation of your code!
Open Code > Preferences > Settings and add the following lines
"files.exclude": {
"**/*.js": true
}
Hope this helps.

how to configure sphinx to use local mathjax

I'm having some trouble getting Sphinx to build pages with a local mathjax library. In the documentation here, it says just to add the following mathjax_path = "MathJax-2.7.4/MathJax.js" to conf.py, but after building the files, I still get <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
Is there something else I need to do, besides run make html to get the configuration to load?
I just added the mathjax_path = "MathJax-2.7.4/MathJax.js" to the end of my conf.py file.
I figured out that Sphinx doesn't rebuild your files unless your .rst source files changed. Because the configuration file doesn't touch the .rst files, it won't cause a rebuild. I ended up just removing all the files from the build directory and letting it recreate all the files.

compile stylus sheets to a single file

I am trying to write a watch script for my app. I have a stylus sheet for each feature of my app and I'd like to compile them into a single one.
stylus -u nib src/*/*/**.styl -o out/css/ --include-css -w
But this brings as many files as there are features. Is there a way to ensure that each newly compiled css file is appended to my out/css/main.css file rather than written as a new out/css/feature.css file?
Many thanks
You can import all the features in one file (main.styl) and watch only it (stylus -w main.styl), isn't it? Any changes to these files will be detected by Stylus and main.styl file will be recompiled as well. There is a reason why you don't do it this way?

Resources