在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:standard/standard开源软件地址:https://github.com/standard/standard开源编程语言:JavaScript 83.4%开源软件介绍:
|
Your Logo Here |
---|
In addition to companies, many community members use standard
on packages that
are too numerous
to list here.
standard
is also the top-starred linter in GitHub's
Clean Code Linter showcase.
First, install standard
. Then, install the appropriate plugin for your editor:
Using Package Control, install SublimeLinter and SublimeLinter-contrib-standard.
For automatic formatting on save, install StandardFormat.
Install linter-js-standard.
Alternatively, you can install linter-js-standard-engine. Instead of
bundling a version of standard
it will automatically use the version installed
in your current project. It will also work out of the box with other linters based
on standard-engine.
For automatic formatting, install standard-formatter. For snippets, install standardjs-snippets.
Install vscode-standard. (Includes support for automatic formatting.)
For JS snippets, install: vscode-standardjs-snippets. For React snippets, install vscode-react-standard.
Install ale. And add these lines to your .vimrc
file.
let g:ale_linters = {
\ 'javascript': ['standard'],
\}
let g:ale_fixers = {'javascript': ['standard']}
This sets standard as your only linter and fixer for javascript files and so prevents conflicts with eslint. For linting and automatic fixing on save, add these lines to .vimrc
:
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
Alternative plugins to consider include neomake and syntastic, both of which have built-in support for standard
(though configuration may be necessary).
Install Flycheck and check out the manual to learn how to enable it in your projects.
Search the extension registry for "Standard Code Style" and click "Install".
WebStorm recently announced native support
for standard
directly in the IDE.
If you still prefer to configure standard
manually, follow this guide. This applies to all JetBrains products, including PhpStorm, IntelliJ, RubyMine, etc.
Yes! If you use standard
in your project, you can include one of these badges in
your readme to let people know that your code is using the standard style.
[![JavaScript Style Guide](https://cdn.rawgit.com/standard/standard/master/badge.svg)](https://github.com/standard/standard)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
No. The whole point of standard
is to save you time by avoiding
bikeshedding about code style. There are lots of debates online about
tabs vs. spaces, etc. that will never be resolved. These debates just distract from
getting stuff done. At the end of the day you have to 'just pick something', and
that's the whole philosophy of standard
-- its a bunch of sensible 'just pick
something' opinions. Hopefully, users see the value in that over defending their
own opinions.
There are a couple of similar packages for anyone who does not want to completely accept standard
:
If you really want to configure hundreds of ESLint rules individually, you can
always use eslint
directly with
eslint-config-standard to
layer your changes on top.
standard-eject
can help
you migrate from standard
to eslint
and eslint-config-standard
.
Pro tip: Just use standard
and move on. There are actual real problems that you
could spend your time solving! :P
Of course it's not! The style laid out here is not affiliated with any official web
standards groups, which is why this repo is called standard/standard
and not
ECMA/standard
.
The word "standard" has more meanings than just "web standard" :-) For example:
Yes! You can use standard --fix
to fix most issues automatically.
standard --fix
is built into standard
for maximum convenience. Most problems
are fixable, but some errors (like forgetting to handle errors) must be fixed
manually.
To save you time, standard
outputs the message "Run standard --fix to automatically fix some problems
" when it detects problems that can be fixed
automatically.
Certain paths (node_modules/
, coverage/
, vendor/
, *.min.js
,
and files/folders that begin with .
like .git/
) are automatically ignored.
Paths in a project's root .gitignore
file are also automatically ignored.
Sometimes you need to ignore additional folders or specific minified files. To do
that, add a standard.ignore
property to package.json
:
"standard": {
"ignore": [
"**/out/",
"/lib/select2/",
"/lib/ckeditor/",
"tmp.js"
]
}