🌟 JavaScript Style Guide, with linter & automatic code fixer
🌟 JavaScript Style Guide, with linter & automatic code fixer
English • Español (Latinoamérica) • Français • Bahasa Indonesia • Italiano (Italian) • 日本語 (Japanese) • 한국어 (Korean) • Português (Brasil) • 简体中文 (Simplified Chinese) • 繁體中文 (Taiwanese Mandarin)
This module saves you (and others!) time in three ways:
.eslintrc files to manage. It just works.standard --fix and say goodbye to
messy or inconsistent code.Give it a try by running npx standard --fix right now!
pre-commit hook?The easiest way to use JavaScript Standard Style is to install it globally as a Node command line program. Run the following command in Terminal:
$ npm install standard --globalOr, you can install standard locally, for use in a single project:
$ npm install standard --save-devNote: To run the preceding commands, Node.js and npm must be installed.
After you've installed standard, you should be able to use the standard program. The
simplest use case would be checking the style of all JavaScript files in the
current working directory:
$ standard
Error: Use JavaScript Standard Style
lib/torrent.js:950:11: Expected '===' and instead saw '=='.If you've installed standard locally, run with npx instead:
$ npx standardYou can optionally pass in a directory (or directories) using the glob pattern. Be
sure to quote paths containing glob patterns so that they are expanded by
standard instead of your shell:
$ standard "src/util/**/*.js" "test/**/*.js"Note: by default standard will look for all files matching the patterns:
**/*.js, **/*.jsx.
Add it to package.json
{
"name": "my-cool-package",
"devDependencies": {
"standard": "*"
},
"scripts": {
"test": "standard && node my-tests.js"
}
}Style is checked automatically when you run npm test
$ npm test
Error: Use JavaScript Standard Style
lib/torrent.js:950:11: Expected '===' and instead saw '=='.Never give style feedback on a pull request again!
The beauty of JavaScript Standard Style is that it's simple. No one wants to maintain multiple hundred-line style configuration files for every module/project they work on. Enough of this madness!
This module saves you (and others!) time in three ways:
standard --fix and say goodbye to
messy or inconsistent code.Adopting standard style means ranking the importance of code clarity and
community conventions higher than personal style. This might not make sense for
100% of projects and development cultures, however open source can be a hostile
place for newbies. Setting up clear, automated contributor expectations makes a
project healthier.
For more info, see the conference talk "Write Perfect Code with Standard and
ESLint". In this talk, you'll learn
about linting, when to use standard versus eslint, and how prettier compares
to standard.
JSX but not React in scope
Rule suggestion: Forbid cyclic dependencies
Lint all JavaScript in markdown files by default
indentation/alignment in jsx (react/jsx-curly-newline)
Disallow returning values from Promise executor functions (no-promise-executor-return)
Parsing error when using import attributes
open
Deprecated dependencies on installation
Provide a github action
Please get rid of 2-space indent lint