{"_id":"algolia-standard","_rev":"274-3d8d081d2918dec76697aeb2fd4f2171","name":"algolia-standard","dist-tags":{"latest":"4.6.1"},"versions":{"4.6.1":{"name":"algolia-standard","version":"4.6.1","keywords":["JavaScript Standard Style","check","checker","code","code checker","code linter","code standards","code style","enforce","eslint","hint","jscs","jshint","lint","policy","quality","simple","standard","standard style","style","style checker","style linter","verify"],"author":{"url":"http://feross.org/","name":"Feross Aboukhadijeh","email":"feross@feross.org"},"license":"MIT","_id":"algolia-standard@4.6.1","maintainers":[{"name":"vvo","email":"vincent.voyer@gmail.com"}],"homepage":"https://github.com/algolia/standard","bugs":{"url":"https://github.com/feross/standard/issues"},"bin":{"standard":"./bin/cmd.js","algolia-standard":"./bin/cmd.js"},"dist":{"shasum":"ffada5dc9079b2a3ed7b342a237052e1b77941e5","tarball":"https://registry.npmjs.org/algolia-standard/-/algolia-standard-4.6.1.tgz","integrity":"sha512-NxwLP0HMgcD22w0dlMduTmtsUIP1MpNY8nj8cUHLltoRo38J6DvUawEc/y9rai9BYloOsJ1LNXlnIpzpzmKg4A==","signatures":[{"sig":"MEUCIQC6gtfUEFxJUWCHjxCRnPsDBKOZZ9w+uw+zcrehDy/UOgIgHOw0YsUEQBKUvbYmeNLh3j5cTQGGzBRI3vMGSSv70Ys=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"ffada5dc9079b2a3ed7b342a237052e1b77941e5","gitHead":"0614f36686f3ea62278b8b480fd2731e55a8169c","scripts":{"test":"node ./bin/cmd.js && tape test/*.js","test-quick":"node ./bin/cmd.js"},"_npmUser":{"name":"vvo","email":"vincent.voyer@gmail.com"},"deprecated":"This is not necessary anymore, since we now use https://yarn.pm/eslint-config-algolia","repository":{"url":"git://github.com/algolia/standard.git","type":"git"},"_npmVersion":"2.11.2","description":"JavaScript Standard Style","directories":{},"_nodeVersion":"0.12.5","dependencies":{"glob":"^5.0.0","uniq":"^1.0.1","xtend":"^4.0.0","eslint":"^0.24.0","ignore":"^2.2.15","dezalgo":"^1.0.1","minimist":"^1.1.0","find-root":"^0.1.1","get-stdin":"^4.0.1","pkg-config":"^1.0.1","run-parallel":"^1.0.0","standard-format":"^1.3.3","eslint-plugin-react":"^2.1.0","eslint-config-standard":"3.4.0","eslint-config-standard-react":"1.0.0"},"devDependencies":{"tape":"^4.0.0","mkdirp":"^0.5.0","run-parallel-limit":"^1.0.1"}}},"time":{"created":"2015-07-02T15:34:12.975Z","modified":"2026-09-16T10:11:40.906Z","4.6.1":"2015-07-02T15:34:12.975Z","4.6.2":"2015-07-02T15:55:17.162Z"},"bugs":{"url":"https://github.com/feross/standard/issues"},"author":{"url":"http://feross.org/","name":"Feross Aboukhadijeh","email":"feross@feross.org"},"license":"MIT","homepage":"https://github.com/algolia/standard","keywords":["JavaScript Standard Style","check","checker","code","code checker","code linter","code standards","code style","enforce","eslint","hint","jscs","jshint","lint","policy","quality","simple","standard","standard style","style","style checker","style linter","verify"],"repository":{"url":"git://github.com/algolia/standard.git","type":"git"},"description":"JavaScript Standard Style","maintainers":[{"email":"hello@haroen.me","name":"haroenv"},{"email":"contact@ymammar.com","name":"tkrugg"},{"email":"cyril.descossy@algolia.com","name":"cyril.descossy"},{"email":"emmanuel.fortin@algolia.com","name":"emmanuel.fortin"},{"email":"robert.mogos@algolia.com","name":"robertmogos"},{"email":"stephane.jin@algolia.com","name":"jinste"},{"email":"team-event-experiences-engineering@algolia.com","name":"eventexperiences_algolia"},{"email":"admin@algolia.com","name":"alg-admin"},{"email":"michael.bramwell@algolia.com","name":"mbramwell-algolia"},{"email":"vincentalindogan@gmail.com","name":"vincentalindogan"}],"readme":"# JavaScript Standard Style\n[![travis][travis-image]][travis-url]\n[![npm][npm-image]][npm-url]\n[![downloads][downloads-image]][downloads-url]\n\n[travis-image]: https://img.shields.io/travis/feross/standard.svg?style=flat\n[travis-url]: https://travis-ci.org/feross/standard\n[npm-image]: https://img.shields.io/npm/v/standard.svg?style=flat\n[npm-url]: https://npmjs.org/package/standard\n[downloads-image]: https://img.shields.io/npm/dm/standard.svg?style=flat\n[downloads-url]: https://npmjs.org/package/standard\n\n### One Style to Rule Them All\n\nNo decisions to make. No `.eslintrc`, `.jshintrc`, or `.jscsrc` files to manage. It just\nworks.\n\nThis module saves you (and others!) time in two ways:\n\n- **No configuration.** The easiest way to enforce consistent style in your project. Just\n  drop it in.\n- **Catch style errors before they're submitted in PRs.** Saves precious code review time\n  by eliminating back-and-forth between maintainer and contributor.\n\n## Install\n\n```bash\nnpm install standard\n```\n\n## Rules\n\n- **2 spaces** – for indentation\n- **Single quotes for strings** – except to avoid escaping\n- **No unused variables** – this one catches *tons* of bugs!\n- **No semicolons** – [It's][1] [fine.][2] [Really!][3]\n- **Never start a line with `(` or `[`**\n  - This is the **only** gotcha with omitting semicolons – *automatically checked for you!*\n  - [More details][4]\n- **Space after keywords** `if (condition) { ... }`\n- **Space after function name** `function name (arg) { ... }`\n- Name the context variable `self` – `var self = this`\n  - Accidental [`window.self`][5] usage is dissallowed (happens when `var self = this` is\n    omitted)\n- Always use `===` instead of `==` – but `obj == null` is allowed to check `null || undefined`.\n- Always handle the node.js `err` function parameter\n- Always prefix browser globals with `window` – except `document` and `navigator` are okay\n  - Prevents accidental use of poorly-named browser globals like `open`, `length`,\n    `event`, and `name`.\n- **And [more goodness][6]** – *give `standard` a try today!*\n\n[1]: http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding\n[2]: http://inimino.org/~inimino/blog/javascript_semicolons\n[3]: https://github.com/maxogden/messages/issues/18\n[4]: RULES.md#automatic-semicolon-insertion-asi\n[5]: https://developer.mozilla.org/en-US/docs/Web/API/Window.self\n[6]: RULES.md#javascript-standard-style\n\nTo get a better idea, take a look at\n[a sample file](https://github.com/feross/bittorrent-dht/blob/master/client.js) written\nin JavaScript Standard Style, or check out some of\n[the repositories](https://github.com/feross/standard/blob/master/test/clone.js) that use\n`standard`.\n\n## Badge\n\nUse this in one of your projects? Include one of these badges in your readme to\nlet people know that your code is using the standard style.\n\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\n```markdown\n[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n```\n\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\n```markdown\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n```\n\n## Usage\n\nThe easiest way to use JavaScript Standard Style to check your code is to install it\nglobally as a Node command line program. To do so, simply run the following command in\nyour terminal (flag `-g` installs `standard` globally on your system, omit it if you want\nto install in the current working directory):\n\n```bash\nnpm install standard -g\n```\n\nAfter you've done that you should be able to use the `standard` program. The simplest use\ncase would be checking the style of all JavaScript files in the current working directory:\n\n```bash\n$ standard\nError: Use JavaScript Standard Style\n  lib/torrent.js:950:11: Expected '===' and instead saw '=='.\n```\n\nYou can optionally pass in a directory using the glob pattern:\n\n```bash\n$ standard src/util/**/*.js\n```\n\n**Note:** by default `standard` will look for all files matching the patterns: `**/*.js`, `**/*.jsx`.\n\n### Editor plugins\n\nFirst, install `standard`. Then, install the appropriate plugin for your editor:\n\n- **[Sublime Text](https://www.sublimetext.com/)** - Install\n  [Package Control](https://packagecontrol.io/),\n  [SublimeLinter](http://www.sublimelinter.com/en/latest/), and\n  [SublimeLinter-contrib-standard](https://packagecontrol.io/packages/SublimeLinter-contrib-standard).\n- **[Atom](https://atom.io)** - Install [Linter](https://atom.io/packages/linter)\n  and [linter-js-standard](https://atom.io/packages/linter-js-standard).\n- **[Vim](http://www.vim.org/)** - Install\n  [Syntastic](https://github.com/scrooloose/syntastic) and add\n  `let g:syntastic_javascript_checkers = ['standard']` to your `.vimrc`.\n- **[Emacs](https://www.gnu.org/software/emacs/)** - Install\n  [Flycheck](http://www.flycheck.org) and check out the\n  [manual](http://www.flycheck.org/manual/latest/index.html) to learn how\n  to enable it in your projects.\n\n### What you might do if you're clever\n\n1. Add it to `package.json`\n\n  ```json\n  {\n    \"name\": \"my-cool-package\",\n    \"devDependencies\": {\n      \"standard\": \"^3.0.0\"\n    },\n    \"scripts\": {\n      \"test\": \"standard && node my-tests.js\"\n    }\n  }\n  ```\n\n2. Check style automatically when you run `npm test`\n\n  ```\n  $ npm test\n  Error: Use JavaScript Standard Style\n    lib/torrent.js:950:11: Expected '===' and instead saw '=='.\n  ```\n\n3. Never give style feedback on a pull request again!\n\n## FAQ\n\n### Why would I use JavaScript Standard Style?\n\nThe beauty of JavaScript Standard Style is that it's simple. No one wants to maintain\nmultiple hundred-line style configuration files for every module/project they work on.\nEnough of this madness!\n\nThis module saves you time in two ways:\n\n- **No configuration.** The easiest way to enforce consistent style in your project. Just\n  drop it in.\n- **Catch style errors before they're submitted in PRs.** Saves precious code review time\n  by eliminating back-and-forth between maintainer and contributor.\n\nAdopting `standard` style means ranking the importance of code clarity and community\nconventions higher than personal style. This might not make sense for 100% of projects and\ndevelopment cultures, however open source can be a hostile place for newbies. Setting up\nclear, automated contributor expectations makes a project healthier.\n\n### I disagree with rule X, can you change it?\n\nNo. The the whole point of `standard` is to avoid [bikeshedding][bikeshedding] about\nstyle. There are lots of debates online about tabs vs. spaces, etc. that will never be\nresolved. These debates just distract from getting stuff done. At the end of the day you\nhave to 'just pick something', and that's the whole philosophy of `standard` -- its a\nbunch of sensible 'just pick something' opinions. Hopefully, users see the value in that\nover defending their own opinions.\n\n[bikeshedding]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/misc.html#idp60694736\n\n### But this isn't a real web standard!\n\nOf course it's not! The style laid out here is not affiliated with any official web\nstandards groups, which is why this repo is called `feross/standard` and not\n`ECMA/standard`.\n\nThe word \"standard\" has more meanings than just \"web standard\" :-) For example:\n\n- This module helps hold our code to a high *standard of quality*.\n- This module ensures that new contributors follow some basic *style standards*.\n\n### Is there an automatic formatter?\n\nYes! Just run `standard --format filename.js`. This uses\n[Max Ogden][max]'s automatic formatter\n[`standard-format`][standard-format], which can automatically\nfix most code issues.\n\nWhile most issues can be fixed, some, like not handling errors in node-style callbacks,\nmust be fixed manually.\n\n[max]: https://github.com/maxogden\n[standard-format]: https://github.com/maxogden/standard-format\n\n### How do I ignore files?\n\nThe paths `node_modules/**`, `*.min.js`, `bundle.js`, `coverage/**`, hidden files/folders\n(beginning with `.`), and all patterns in a project's root `.gitignore` file are\nautomatically excluded when looking for `.js` files to check.\n\nSometimes you need to ignore additional folders or specific minfied files. To do that, add\na `standard.ignore` property to `package.json`:\n\n```json\n\"standard\": {\n  \"ignore\": [\n    \"**/out/\",\n    \"/lib/select2/\",\n    \"/lib/ckeditor/\",\n    \"tmp.js\"\n  ]\n}\n```\n\n### How do I hide a certain warning?\n\nIn rare cases, you'll need to break a rule and hide the warning generated by `standard`.\n\nJavaScript Standard Style uses [`eslint`](http://eslint.org/) under-the-hood and you can\nhide warnings as you normally would if you used `eslint` directly.\n\nTo get verbose output (so you can find the particular rule name to ignore), run:\n\n```bash\n$ standard --verbose\nError: Use JavaScript Standard Style\n  routes/error.js:20:36: 'file' was used before it was defined. (no-use-before-define)\n```\n\nDisable **all rules** on a specific line:\n\n```js\nfile = 'I know what I am doing' // eslint-disable-line\n```\n\nOr, disable **only** the `\"no-use-before-define\"` rule:\n\n```js\nfile = 'I know what I am doing' // eslint-disable-line no-use-before-define\n```\n\nOr, disable the `\"no-use-before-define\"` rule for **multiple lines**:\n\n```js\n/*eslint-disable no-use-before-define */\n// offending code here...\n// offending code here...\n// offending code here...\n/*eslint-enable no-use-before-define */\n```\n\n### I use a library that pollutes the global namespace. How do I prevent \"variable is not defined\" errors?\n\nSome packages (e.g. `mocha`) put their functions (e.g. `describe`, `it`) on the global\nobject (poor form!). Since these functions are not defined or `require`d anywhere in your\ncode, `standard` will warn that you're using a variable that is not defined (usually, this\nrule is really useful for catching typos!). But we want to disable it for these global\nvariables.\n\nTo let `standard` (as well as humans reading your code) know that certain variables are\nglobal in your code, add this to the top of your file:\n\n```\n/* global myVar1, myVar2 */\n```\n\nIf you have hundreds of files, adding comments to every file can be tedious. In these\ncases, you can add this to `package.json`:\n\n```js\n{\n  \"standard\": {\n    \"global\": [ \"myVar1\", \"myVar2\" ]\n  }\n}\n```\n\n### Can I use a custom JS parser for bleeding-edge ES6 or ES7 support?\n\n`standard` supports custom JS parsers. To use a custom parser, install it from npm\n(example: `npm install babel-eslint`) and add this to your `package.json`:\n\n```js\n{\n  \"standard\": {\n    \"parser\": \"babel-eslint\"\n  }\n}\n```\n\n### Can you make rule X configurable?\n\nNo. Use `eslint` and\n[this shareable config](https://github.com/feross/eslint-config-standard) if you want to\nconfigure hundreds of options individually.\n\nPro tip: Just use `standard` and move on. There are actual real problems that you could\nspend your time solving! :P\n\n### What about Web Workers?\n\nWeb workers have a magic global variable called `self`. In regular JS files, `standard`\nwon't let you use `self` directly, as it wants to prevent accidental use of\n`window.self`. But `standard` has no way of knowing when you are in a `worker` and\ntherefore does not know when to allow usage of `self` directly.\n\nUntil we figure out a better solution, we recommend adding this to the top of workers:\n\n```\n/* global self */\n```\n\nThis lets `standard` (as well as humans reading your code) know that `self` is a global\nin web worker code.\n\n### Is there a Git `pre-commit` hook for `standard`?\n\nFunny you should ask!\n\n```sh\n#!/bin/sh\n# Ensure all javascript files staged for commit pass standard code style\ngit diff --name-only --cached --relative | grep '\\.js$' | xargs standard\nexit $?\n```\n\nAlternatively, [overcommit](https://github.com/brigade/overcommit) is a Git hook\nmanager that includes support for running `standard` as a Git pre-commit hook.\nTo enable this, add the following to your `.overcommit.yml` file:\n\n```yaml\nPreCommit:\n  Standard:\n    enabled: true\n```\n\n### I want to hack on `standard`. What packages should I know about?\n\n- [eslint](https://github.com/eslint/eslint)\n- [standard](https://github.com/feross/standard)\n  - [eslint-config-standard](https://github.com/feross/eslint-config-standard)\n  - [eslint-config-standard-react](https://github.com/feross/eslint-config-standard-react)\n- [semistandard](https://github.com/Flet/semistandard)\n  - [eslint-config-semistandard](https://github.com/Flet/eslint-config-semistandard)\n- [standard-format](https://github.com/maxogden/standard-format)\n- [standard-engine](https://github.com/flet/standard-engine)\n\nThere are also many [editor plugins](https://github.com/feross/standard#editor-plugins).\n\n## License\n\nMIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).\n","readmeFilename":"README.md"}