Is there any code formatter plugin for Atom Editor & Sublime Text that respect .editorconfig
& .jscsrc
files?
是否有任何代码格式化程序插件Atom Editor和Sublime Text尊重.editorconfig&.jscsrc文件?
For example, if my .editorconfig
has the following settings
例如,如果我的.editorconfig具有以下设置
# 4 space indentation
[*.js]
indent_style = space
indent_size = 4
and .jscsrc
does not state anything about indentation, I would like to see my code being indented with 4 spaces along with other rules specified at .jscsrc
when I format the code (not auto format).
和.jscsrc没有说明缩进的任何内容,我希望看到我的代码缩进4个空格以及.jscsrc中指定的其他规则,当我格式化代码(不是自动格式)时。
I would not prefer to maintain same configuration across multiple config files.
我不希望在多个配置文件中保持相同的配置。
1 个解决方案
#1
Both Editors have plugins available to both lint and auto fix files according to your .jscsrc
and .editorconfig
files:
根据.jscsrc和.editorconfig文件,两个编辑器都有可用于lint和自动修复文件的插件:
Sublime Text
.editorconfig
- EditorConfig will format files automatically.
.editorconfig - EditorConfig将自动格式化文件。
.jscsrc
- SublimeLinter-jscs will do in-line linting for you, and SublimeJSCSFormatter will auto-format with the keyboard shortcuts:
.jscsrc - SublimeLinter-jscs将为您进行内联linting,SublimeJSCSFormatter将使用键盘快捷键自动格式化:
- Linux/Windows:
Ctrl + Shift + H
- Mac:
Cmd + Shift + H
Linux / Windows:Ctrl + Shift + H.
Mac:Cmd + Shift + H.
Atom
.editorconfig
- EditorConfig will format files automatically (same name as the one for Sublime, different project).
.editorconfig - EditorConfig将自动格式化文件(与Sublime,不同项目的名称相同)。
.jscsrc
- linter-jscs will do in-line linting for you, and jscs-fixer allows you to auto-format a file:
.jscsrc - linter-jscs会为你做内联linting,jscs-fixer允许你自动格式化文件:
- From Command Palette invoke
jscs Fixer: Fix
- Right-click on one of the selected files and choose
Fix this file using jscs
- Use the keyboard shortcut -
Ctrl+⌂+J
从命令调色板调用jscs Fixer:Fix
右键单击其中一个选定文件,然后选择“使用jscs修复此文件”
使用键盘快捷键 - Ctrl +⌂+ J
#1
Both Editors have plugins available to both lint and auto fix files according to your .jscsrc
and .editorconfig
files:
根据.jscsrc和.editorconfig文件,两个编辑器都有可用于lint和自动修复文件的插件:
Sublime Text
.editorconfig
- EditorConfig will format files automatically.
.editorconfig - EditorConfig将自动格式化文件。
.jscsrc
- SublimeLinter-jscs will do in-line linting for you, and SublimeJSCSFormatter will auto-format with the keyboard shortcuts:
.jscsrc - SublimeLinter-jscs将为您进行内联linting,SublimeJSCSFormatter将使用键盘快捷键自动格式化:
- Linux/Windows:
Ctrl + Shift + H
- Mac:
Cmd + Shift + H
Linux / Windows:Ctrl + Shift + H.
Mac:Cmd + Shift + H.
Atom
.editorconfig
- EditorConfig will format files automatically (same name as the one for Sublime, different project).
.editorconfig - EditorConfig将自动格式化文件(与Sublime,不同项目的名称相同)。
.jscsrc
- linter-jscs will do in-line linting for you, and jscs-fixer allows you to auto-format a file:
.jscsrc - linter-jscs会为你做内联linting,jscs-fixer允许你自动格式化文件:
- From Command Palette invoke
jscs Fixer: Fix
- Right-click on one of the selected files and choose
Fix this file using jscs
- Use the keyboard shortcut -
Ctrl+⌂+J
从命令调色板调用jscs Fixer:Fix
右键单击其中一个选定文件,然后选择“使用jscs修复此文件”
使用键盘快捷键 - Ctrl +⌂+ J