In my project (vite powered) I use aliases. I have configured it, and they work for build and jump in .ts.
I have problem when I try to jump in src/app.scss files.
// case 1: vite OK, vscode: Fail
#import '$bs/bootstrap';
// case 2: vite Fail, vscode OK
#import '~bootstrap/scss/bootstrap';
case 1
When I try to go through an alias to a file with Ctrl + Click, vscode doesn't find the file and asks if I want to create it.
case 2
For vscode there is an alias ~ on node_modules, but then you cannot compile the project in vite.
I tried
Vite + tsconfig.json
vite: {
resolve: {
alias: {
'$bs': path.resolve('./node_modules/bootstrap/scss'),
}
}
And in tsconfig.joson (and I create jsonfig.json):
"paths": {
"$lib": ["src/lib"],
"$lib/*": ["src/lib/*"],
"$bs/*": ["node_modules/bootstrap/scss/*"],
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
Couple vscode extensions:
"wudy.vs-alias-jump",
"paulgui.alias-jump",
"svelte.svelte-vscode",
"mariocadenas.alias-resolver"
"vs-alias-jump.alias": {
"$lib": "${folder}/src/lib",
"$bs": "${folder}/node_modules/bootstrap/scss",
},
"aliasJump.alias": {
"$bs": "/node_modules/bootstrap/scss",
},
"jumpToAliasFile.alias": {
"$bs": "D:/dev/node/layout-test/sveltekit-attractions-ui-test/node_modules/bootstrap/scss",
}
~~//edit 1~~
~~I found a working solution, but I'm not entirely happy with it.~~
Is it possible to somehow change the vscode resolver?
resolve.alias: {
'~bootstrap': path.resolve( './node_modules/bootstrap')
}
edit 2
I don't know what happen, but on other PC this don't works. (I saw some vite message about discovering new dependency and this starts work...)
Receiving the error Could not load file 'worker.js' for content script. It isn't UTF-8 encoded.
> file -I chrome/worker.js
chrome/worker.js: text/plain; charset=utf-8
With to-utf8-unix
> to-utf8-unix chrome/worker.js
chrome/worker.js
----------------
Detected charset:
UTF-8
Confidence of charset detection:
100
Result:
Conversion not needed.
----------------
I also tried converting the file with Sublime Text back and forth without any luck.
manifest:
"content_scripts": [{
"matches": ["http://foo.com/*"],
"js": ["worker.js"]
}],
The file in question: https://www.dropbox.com/s/kcv23ooh06wlxg3/worker.js?dl=1
It is a compiled javascript file spit out from clojurescript with cljsbuild:
{:id "chrome-worker"
:source-paths ["src/chrome/worker"],
:compiler {:output-to "chrome/worker.js",
:optimizations :simple,
:pretty-print false}}
]}
Other files (options page, background) are compiled the same way and don't generate this error. I tried getting rid of weird characters like Emojis but that didn't fix the problem.
In case you are using Webpack you can solve it by replacing the default minifier Uglify with Terser, which won´t produce those encoding issues.
in your webpack.conf.js add
const TerserPlugin = require('terser-webpack-plugin');
// add this into your config object
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
terserOptions: {
ecma: 6,
output: {
ascii_only: true
},
},
}),
],
},
It turns out this is a problem within the google closure compiler that clojurescript uses to generate javascript - https://github.com/google/closure-compiler/issues/1704
A workaround is to set compilation to "US-ASCII"
:closure-output-charset "US-ASCII"
Thanks a to to pesterhazy from the clojurians slack for helping with this!
Had this error get thrown after editing working source code in WordPad. When I saved the file in WordPad, the encoding was lost. To fix it, open the same file in NotePad, Save as, and specify "UTF-8" in the Encoding drop down menu next to the save button.
In case anyone has this issue with Parcel, just add a .terserrc file with this content.
{
"ecma": 6,
"output": {
"ascii_only": true
}
}
This is an adaptation of #marian-klühspies response https://stackoverflow.com/a/58528858/2920671
In sublime text 3 with the sublimelinter plugin (linter / css) how to disable these warnings IDs and padding specifically
warnings
.csslintrc
CSSLint allows you to disable its rules using the .csslintrc in your project root.
Example:
{
"ids": false
}
.sublimelinterrc
The same thing can be achieved using Sublime Linter's own configuration file, which is basically making use of CSSLint's --ignore command-line parameter.
Example:
{
"linters": {
"csslint": {
"ignore": ["ids]
}
}
}
I am using VScode with latest version of Eslint. It is my first time using a linter.
I keep getting this linting error when using a tab as indentation:
severity: 'Error'
message: 'Expected indentation of 1 tab but found 4 spaces. (indent)'
at: '4,5'
source: 'eslint'
Here is my config file
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
I don't understand why this error is being thrown as I indicated tabs for indentation. It is obviously calculating my 1 tab as 4 spaced but I don't understand why it is doing that when I am pressing tab for indentation.
update: The reason is because in VScode using ctrl + shift + i to beautify code will actually use spaces and not tabs. That is the reason.
Try to disable indent inside .eslintrc.js file
rules: {
'indent': 'off'
}
this works fine for me
In VSCODE, go to menu:
File / Preferences / Settings then Text Editor (or just search for 'tab' in the search settings box)
Then remove the tick from the following settings:
Insert Spaces
Detect Indentation
Also to auto format the document with the default VSCode keyboard shortcut use:
Shift+Alt+f
If you use both eslint and prettier, don't disable indent by using {'indent': 'off'} in rules object. To ensure the consistency of your code style, you have to use this rule.
Solution:
This issue is probably happened because of eslint & prettier conflict.
Try to play with different options of eslint in .eslintrc file.
If you hover the error lines in vsCode, at the end of error description you can click on that link to see eslint docs.
For example, in case of indent docs is in this link:
Eslint Indent Docs
For me, error resolved by adding this line (for ternary expressions):
...
rules: {
indent: [
'error',
2,
{
SwitchCase: 1,
ignoredNodes: ['ConditionalExpression'], <-- I add this line
},
],
...
You can also try flatTernaryExpressions or offsetTernaryExpressions for ternary expressions.
You can automaticaly fix the problems with
npm run lint -- --fix
I used VScode to solve this problem. All you have to do is hold the mouse over the part where there is an error.
and...
Wee, that exactly what it says. You have in your config "indent": [ "error", "tab" ], So it expects tab as indent. But found in your file 4 spaces. Remove spaces and put tab in you file
I had a similar problem and solved with this code:
rules: {
...
indent: [2, "tab"],
"no-tabs": 0,
...
}
change "editor.tabSize": 4
to "editor.tabSize": 2 in VS Code Settings
If you are using VSCODE follow the next steps.
Access the settings by clicking: code > preferences > settings, as shown in the following image.
In the settings, click: Text Editor after that, uncheck the Insert Space option and the Detect Indentation option as shown in the following image.
Restart VSCODE and your dev server.
There was a conflict between plugins in my example. I'm using eslint version 8.24.0. To fix, i just removed the rule plugin:prettier/recommended and added prettier at last position from extends as explained in eslint-config-prettier documentation. See: https://github.com/prettier/eslint-config-prettier#arrow-body-style-and-prefer-arrow-callback
Before:
"extends": [
"eslint:recommended",
"plugin:#typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:storybook/recommended",
]
After:
"extends": [
"eslint:recommended",
"plugin:#typescript-eslint/recommended",
"plugin:storybook/recommended",
"prettier"
]
I was having the same problem and I solved my problem with documentation. Instead of disabling eslint indent, you can add it as shown in the documentation.
Docs
Simple:
rules: {
indent: ['error', 2, { "MemberExpression": 1 }],
}
In file
settings.json
remove this line if have:
"editor.defaultFormatter": "esbenp.prettier-vscode",
eslint conflict with prettier
It worked for me, if error is coming then just solve it line by line simply in your code,
like :
1.)Expected indentation of 2 spaces but found 8 -> then put only 2 spaces from the starting of the line
2.)Unexpected tab character -> don't use tabs, use spaces
3.)Trailing spaces not allowed -> don't give any spaces after lines end.
4.)Missing space before value for key 'name' -> put 1 space after ":" in object value
5.)A space is required after ',' -> put 1 space after "," in parameter of the function
6.)Opening curly brace does not appear on the same line as controlling statement -> just put the opening curly brace where function starts in the same line
7.)Closing curly brace should be on the same line as opening curly brace or on the line after the previous block -> put the closing curly brace just below where the function starts.
Please add the below comment at the first line of the JS file that you are customizing.
/* eslint-disable */
If I type in the CMD.exe
slimrb -p SashaSlim.slim>SashaSlim.html
the contents of the my valid file, for example, SashaSlim.slim correct compiled into SashaSlim.html. But I can not make the build system for Sublime Text, which would do the same.
Example of my code:
{
"path": "$file_path",
"selector": "text.slim",
"shell_cmd": "slimrb -p $file_name>$file_base_name.html",
}
When I run my build system, create blank file SashaSlim.html without the result of compiling.
Where I made a mistakes in my .sublime-build file?
Windows 10
Sublime Text Build 3114
Thanks.
{
"cmd": ["slimrb"],
"working_dir": "${file_path:${folder}}",
"selector": "text.slim",
"quiet": true,
"windows": {
"cmd": ["slimrb", "-p", "--trace", "$file", "$file_base_name.html"],
"shell": true
}
}
Re: https://gist.github.com/Kristinita/f49eca1aa44545b5fcacaceeb8eaaee4