I'm doing a project with a few other people and we have defined a .editorconfig file
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Even so I keep getting the message that line endings are not consistent. Why is this happening? Why isn't the .editorconfig file fixing the issue? Shouldn't that file make people automatically save files in the correct way?
Related
one is the .editorconfig file and other one is .ignore file, tell me , should i included it or not, other files are ignored as you can see below.
.ignore file
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.phpIntel
/.vscode
.editorconfig
.editorConfig file
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
Noob Coder
.editorconfig file is used to keep consistency in the coding environment when you work with multiple team members. It helps you to keep all the code in the same formating.
So as per my view, If you are working with multiple developers then you should not ignore it else you can ignore it.
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 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"
}
]
}
}
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