I just installed sass-lint in my VS Code editor and I keep on getting this error for each and every property(line) I've set in my *.scss files:
[sass-lint] Mixed tabs and spaces
Indentation type in VS Code is set to tabs(4), it is set to indent using Tabs.
How can I disable mixing of tabs and spaces for sass-lint?
To close this one off, I later on found out that it is a best practice to use a EditorConfig file to pre-set all of your workflow settings.
This is a plugin-type settings file, which pre-configures desired settings to fit your workflow.
In my case, I use EditorConfig for VScode. After you add it to your editor of choice, simply create a .editorconfig file in your base(root) directory and fill it with the desired settings.
e.g. , my base setup looks like this:
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
The real reason is: SASS Lint isn't recognizing your indentation settings and it's using it default indentation (2 spaces). It's looking for 2 spaces and found tabs instead.
You can confirm it by removing all indentation and reading the hint.
As pointed on Pull#725, the correct syntax is:
indentation:
- 1
-
size: 'tab'
I found that sass-lint in Sublime Text 3 wasn't loading my config file.
I got it working after reading this GitHub issue:
In SublimeLinter preferences (Preferences -> Package Settings -> SublimeLinter -> Settings):
"linters": {
"sass": {
"working_dir": "${/home/myusername}"
}
},
Add the file .sasslintrc to your Home folder:
{
"rules": {
"indentation": [
1,
{
"size": "tab"
}
]
}
}
Related
I have old code in github which needs modification but whenever I change the code it prompts me for either Tabify or Untabify as the file has mixed tabs and spaces.
I can use the PowerTools to fix those few lines which are different but the problem is when I make changes using either Tabify or Untabify it shows those differences in code review changes as well.
for code reviewers it is really annoying to ignore those changes while doing a code review.
Is there any default settings in VS2017 which all developers can adopt so that everyone is using only either tabs or spaces?
There is better way to handle tabs and spaces in visual studio using Editor config file .editorconfig
You can define either tabs or spaces to be used in specific file extensions using a simple config entry as shown below.
check more formatting details on editorconfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.{cs,vb}]
charset = utf-8
# 4 space indentation
[*.cs]
indent_style = tab
indent_size = 2
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = tab
indent_size = 2
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = tab
indent_size = 2
I have a Laravel 5.8 project and my .editorconfig setup is based on PHP coding (with 4 spaces) and some other considerations. What I want to know if there is a way to set up a folder-specific configuration for my resources/js in order to adapt different coding rules (like 2 spaces).
Also, is there a way to setup eslint in this project to also lint my js code without any trouble?
Thanks in advance!
As far as I know, you can specify a path within the section name's square brackets:
# Rules specified in this section matching all files
[*]
end_of_line = lf
insert_final_newline = true
[*.php]
indent_style = space
indent_size = 4
# Rules in here only match .js files inside your resources/js folder.
[resources/js/**.js]
indent_style = space
indent_size = 2
Read more on the main page of editorconfig.com.
I am not completely sure if this not a plugin, but after starting a line comment in .js file, for example, when I hit enter the next line starts with "//" as well. This is kind of annoying. Is there a simple way to remove this?
In "Preferences -> Package Settings -> Doc Blockr -> Settings Default" you can find lines:
// If true, then pressing enter while in a double-slash comment (like this one)
// will automatically add two slashes to the next line as well
"jsdocs_extend_double_slash": true,
If you want to disable this behavior go to "Preferences -> Package Settings -> Doc Blockr -> Settings Default" and add
{
"jsdocs_extend_double_slash": false
}
This is indeed caused by the package DocBlockr.
When using this package, you can hit shift + enter to prevent the // from appearing on your new line.
is it possible to hide all the files with certain extension from the sidebar (lateral nav bar) in Sublime Text Editor 3?
Are you talking about the sidebar? For example, if you select File → Open and select a folder, then the folder and its contents are displayed along the left side, allowing you to navigate amongst its contents and sub-directories. If that is the case, then the answer is yes, files can be excluded.
Select Preferences → Settings – Default to open a tab called Preferences.sublime-settings – Default. This file is read-only, so you'll also need to open Preferences → Settings – User. The first time you open your user preferences it will be blank. It (and all Sublime config files) are in the JSON format, so you'll need opening and closing curly braces at the beginning and end of the file, respectively:
{
}
Activate the default preferences tab and search for file_exclude_patterns (which is on line 377 in ST3 build 3083) and also folder_exclude_patterns if desired. Copy its contents to your user preferences file, like so:
{
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db", "*.sublime-workspace"]
}
and feel free to add your own customizations. Please note that there is no comma (,) after the closing square bracket, as in this example this is the only customized preference. If you have multiple ones (changing fonts, window options, themes, or whatever) you'll need a comma after each item except the last one (trailing commas are illegal JSON):
{
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": true,
"wrap_width": 0
}
You can also set them up per project and ignore folders, in your .sublime-project file, e.g.:
{
"folders": [{
"path": ".",
"folder_exclude_patterns": [".svn", "._d", ".metadata", ".settings"],
"file_exclude_patterns": ["*.pyc", "*.pyo", ".project"]
}]
}
How does one enforce a newline at end of file in RubyMine (v 4.5.3, on Mac OS)?
e.g., similar to Sublime Text 2
Enable Ensure blank line before end of file on Save option in the Editor settings:
In RubyMine 6 or above (on Mac OSX):
Enable 'Ensure line feed at file end on Save' option in the Editor settings.
RubyMine 2021.2
"Ensure every saved file ends with a line break"
RubyMine alongside many other editors supports the EditorConfig standard for basic configuration.
You can enforce newlines at the end of every file by placing a file named .editorconfig at the root of your project:
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
It's possible to disable the setting for specific file types or filenames.
In RubyMine 2016.2.1 you have to go to Preferences > Editor > General > Other > Ensure line fedd at file end on Save.
Screenshot of the Preferences in RubyMine 2016.2.1