standard
Advanced tools
Comparing version 11.0.1 to 12.0.0
@@ -116,2 +116,3 @@ # Authors | ||
- Joe Boyle (joe.boyle@jibo.com) | ||
- Adrian Trunzo (adrian@instoredoes.com) | ||
- Pablo Varela (pablovarela182@gmail.com) | ||
@@ -123,3 +124,12 @@ - Luan Vicente (hi@idlua.me) | ||
- Maarten Ackermans (maarten.ackermans@gmail.com) | ||
- ★★ (งツ)ว ★★ (theaichholzer@gmail.com) | ||
- Fahad Hossain (fa7ad@users.noreply.github.com) | ||
- kaijun (cadenho@hotmail.com) | ||
- Andre Sattler (andresattler.webdev@gmail.com) | ||
- Lucas Baldassari (lucasbaldassari@gmail.com) | ||
- WangJie (i@i8e.net) | ||
- Theophilus Omoregbee (theo4u@ymail.com) | ||
- Charlie Gerard (charlie.a.gerard@gmail.com) | ||
- Christopher J. Brody (chris.brody@gmail.com) | ||
#### Generated by bin/update-authors.sh. | ||
#### Generated by tools/update-authors.sh. |
@@ -6,2 +6,30 @@ # Change Log | ||
## 12.0.0 - 2018-08-28 | ||
New version of ESLint, new version of Standard! | ||
When you upgrade, consider running `standard --fix` to automatically format your code to match the newly added rules. | ||
### New features | ||
- Update `eslint` from `~4.19.0` to `~5.0.0`. | ||
- Support JSXFragment nodes (e.g. `<></>`) | ||
- Lots of minor changes to rules to catch more edge cases! | ||
- The README is now available in French! (Thanks [@charliegerard](https://github.com/charliegerard)!) | ||
- Other community contributed translations exist in Spanish, Italian, Korean, Portuguese, Simplified Chinese, and Taiwanese Mandarin. | ||
- More translations are welcome! | ||
### New rules | ||
*(Estimated % of affected standard users, based on test suite in parens)* | ||
- Require spacing inside of braces ([object-curly-spacing](https://eslint.org/docs/rules/object-curly-spacing)) [#609](https://github.com/standard/standard/issues/609) [eslint-config-standard/#35](https://github.com/standard/eslint-config-standard/issues/35) (29%) | ||
- Disallow APIs that were deprecated in Node 10 ([no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md)) [#1164](https://github.com/standard/standard/pull/1164) (15%) | ||
- e.g. `assert.equal()`, `assert.deepEqual()` and `assert.notEqual()` were deprecated in Node 10. | ||
- Disallow self assignment of properties ([no-self-assign](https://eslint.org/docs/rules/no-self-assign)) [#1186](https://github.com/standard/standard/issues/1186) (0%) | ||
### Changed rules | ||
None. | ||
## 11.0.0 - 2018-02-18 | ||
@@ -8,0 +36,0 @@ |
{ | ||
"name": "standard", | ||
"description": "JavaScript Standard Style", | ||
"version": "11.0.1", | ||
"version": "12.0.0", | ||
"author": { | ||
"email": "feross@feross.org", | ||
"name": "Feross Aboukhadijeh", | ||
"url": "http://feross.org/" | ||
"url": "https://feross.org/" | ||
}, | ||
@@ -15,14 +15,14 @@ "bin": "./bin/cmd.js", | ||
"dependencies": { | ||
"eslint": "~4.18.0", | ||
"eslint-config-standard": "11.0.0", | ||
"eslint-config-standard-jsx": "5.0.0", | ||
"eslint-plugin-import": "~2.9.0", | ||
"eslint-plugin-node": "~6.0.0", | ||
"eslint-plugin-promise": "~3.7.0", | ||
"eslint-plugin-react": "~7.7.0", | ||
"eslint-plugin-standard": "~3.0.1", | ||
"standard-engine": "~8.0.0" | ||
"eslint": "~5.4.0", | ||
"eslint-config-standard": "~12.0.0", | ||
"eslint-config-standard-jsx": "~6.0.2", | ||
"eslint-plugin-import": "~2.14.0", | ||
"eslint-plugin-node": "~7.0.1", | ||
"eslint-plugin-promise": "~4.0.0", | ||
"eslint-plugin-react": "~7.11.1", | ||
"eslint-plugin-standard": "~4.0.0", | ||
"standard-engine": "~9.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^8.0.3", | ||
"babel-eslint": "^9.0.0", | ||
"cross-spawn": "^6.0.3", | ||
@@ -76,4 +76,4 @@ "eslint-index": "^1.3.0", | ||
"test": "./bin/cmd.js --verbose && tape test/*.js", | ||
"update-authors": "./bin/update-authors.sh" | ||
"update-authors": "./tools/update-authors.sh" | ||
} | ||
} |
@@ -19,2 +19,3 @@ <h1 align="center"> | ||
<a href="/docs/README-esla.md">Español (Latinoamérica)</a> • | ||
<a href="/docs/README-fr.md">Français</a> • | ||
<a href="/docs/README-iteu.md">Italiano (Italian)</a> • | ||
@@ -52,2 +53,6 @@ <a href="/docs/README-kokr.md">한국어 (Korean)</a> • | ||
### Open Source Supporters | ||
<a href="https://nsrc.io/oss-feross" target='_blank'><img src='https://feross.org/images/supporters/nodesource.png' width=125></a> | ||
## StandardJS — The Rules | ||
@@ -59,4 +64,2 @@ | ||
- **No semicolons** – [It's][1] [fine.][2] [Really!][3] | ||
- **Never start a line with `(`, `[`, or `` ` ``** | ||
- This is the **only** gotcha with omitting semicolons – *automatically checked for you!* | ||
- [More details][4] | ||
@@ -67,5 +70,7 @@ - **Space after keywords** `if (condition) { ... }` | ||
- Always handle the node.js `err` function parameter | ||
- Always prefix browser globals with `window` – except `document` and `navigator` are okay | ||
- Prevents accidental use of poorly-named browser globals like `open`, `length`, | ||
- Declare browser globals with `/* global */` comment at top of file | ||
- Prevents accidental use of vaguely-named browser globals like `open`, `length`, | ||
`event`, and `name`. | ||
- Example: `/* global alert, prompt */` | ||
- Exceptions are: `window`, `document`, and `navigator` | ||
- **And [more goodness][5]** – *give `standard` a try today!* | ||
@@ -76,4 +81,4 @@ | ||
[3]: https://www.youtube.com/watch?v=gsfbh17Ax9I | ||
[4]: /docs/RULES-en.md#semicolons | ||
[5]: /docs/RULES-en.md#javascript-standard-style | ||
[4]: /RULES.md#semicolons | ||
[5]: /RULES.md#javascript-standard-style | ||
@@ -284,11 +289,18 @@ To get a better idea, take a look at | ||
Install **[ale][vim-1]**. | ||
Install **[ale][vim-1]**. And add these lines to your `.vimrc` file. | ||
For automatic formatting on save, add these lines to `.vimrc`: | ||
```vim | ||
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`: | ||
```vim | ||
autocmd bufwritepost *.js silent !standard --fix % | ||
set autoread | ||
let g:ale_lint_on_save = 1 | ||
let g:ale_fix_on_save = 1 | ||
``` | ||
Alternative plugins to consider include [neomake][vim-2] and [syntastic][vim-3], both of which have built-in support for `standard` (though configuration may be necessary). | ||
@@ -321,3 +333,3 @@ | ||
[webstorm-1]: webstorm.md | ||
[webstorm-1]: docs/webstorm.md | ||
@@ -616,8 +628,8 @@ ## Is there a readme badge? | ||
## What about Web Workers? | ||
## What about Web Workers and Service Workers? | ||
Add this to the top of worker files: | ||
Add this to the top of web worker files: | ||
```js | ||
/* eslint-env serviceworker */ | ||
/* eslint-env worker */ | ||
``` | ||
@@ -628,2 +640,8 @@ | ||
For Service workers, add this instead: | ||
```js | ||
/* eslint-env serviceworker */ | ||
``` | ||
## Can I check code inside of Markdown or HTML files? | ||
@@ -671,7 +689,7 @@ | ||
# prevents xargs from running if there are no input files. | ||
if IFS= read -r -d '' path; then | ||
{ echo -n "$path"; echo -ne "\0"; cat; } | xargs $@ | ||
if IFS= read -r -d $'\n' path; then | ||
{ echo "$path"; cat; } | xargs $@ | ||
fi | ||
} | ||
git diff -z --name-only --cached --relative | grep -z '\.jsx\?$' | xargs-r -0 -t standard | ||
git diff --name-only --cached --relative | grep '\.jsx\?$' | sed 's/[^[:alnum:]]/\\&/g' | xargs-r -E '' -t standard | ||
if [[ $? -ne 0 ]]; then | ||
@@ -788,2 +806,3 @@ echo 'JavaScript Standard Style errors were detected. Aborting commit.' | ||
- **[semistandard](https://github.com/Flet/semistandard)** - standard, with semicolons (if you must) | ||
- **[standardx](https://github.com/standard/standardx)** - standard, with custom tweaks | ||
@@ -797,2 +816,2 @@ There are also many **[editor plugins](#are-there-text-editor-plugins)**, a list of | ||
[MIT](LICENSE). Copyright (c) [Feross Aboukhadijeh](http://feross.org). | ||
[MIT](LICENSE). Copyright (c) [Feross Aboukhadijeh](https://feross.org). |
36
RULES.md
@@ -15,3 +15,3 @@ # JavaScript Standard Style | ||
This is a TL;DR of the [standard](https://github.com/standard/standard) JavaScript | ||
This is a summary of the [standard](https://github.com/standard/standard) JavaScript | ||
rules. | ||
@@ -184,5 +184,17 @@ | ||
* **Always prefix browser globals** with `window.`.<br> | ||
Exceptions are: `document`, `console` and `navigator`. | ||
* **Declare browser globals** with a `/* global */` comment.<br> | ||
Exceptions are: `window`, `document` and `navigator`.<br> | ||
Prevents accidental use of poorly-named browser globals like `open`, `length`, | ||
`event`, and `name`. | ||
```js | ||
/* global alert, prompt */ | ||
alert('hi') | ||
prompt('ok?') | ||
``` | ||
Explicitly referencing the function or property on `window` is okay too, though | ||
such code will not run in a Worker which uses `self` instead of `window`. | ||
eslint: [`no-undef`](http://eslint.org/docs/rules/no-undef) | ||
@@ -376,3 +388,3 @@ | ||
set name (value) { // ✗ avoid | ||
this.name = value | ||
this._name = value | ||
} | ||
@@ -383,6 +395,6 @@ } | ||
set name (value) { | ||
this.name = value | ||
this._name = value | ||
}, | ||
get name () { // ✓ ok | ||
return this.name | ||
return this._name | ||
} | ||
@@ -759,3 +771,7 @@ } | ||
function game () { | ||
score: 50 // ✗ avoid | ||
score: while (true) { // ✗ avoid | ||
score -= 10 | ||
if (score > 0) continue score | ||
break | ||
} | ||
} | ||
@@ -1305,4 +1321,8 @@ ``` | ||
* Never start a line with `(`, `[`, or `` ` ``. This is the only gotcha with omitting semicolons, and standard protects you from this potential issue. | ||
* Never start a line with `(`, `[`, `` ` ``, or a handful of other unlikely possibilities. | ||
This is the only gotcha with omitting semicolons, and `standard` protects you from this potential issue. | ||
(The full list is: `[`, `(`, `` ` ``, `+`, `*`, `/`, `-`, `,`, `.`, but most of these will never appear at the start of a line in real code.) | ||
eslint: [`no-unexpected-multiline`](http://eslint.org/docs/rules/no-unexpected-multiline) | ||
@@ -1309,0 +1329,0 @@ |
806
107817
10
+ Addedacorn@6.4.2(transitive)
+ Addedacorn-jsx@5.3.2(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedajv-keywords@3.5.2(transitive)
+ Addedcross-spawn@6.0.5(transitive)
+ Addedeslint@5.4.0(transitive)
+ Addedeslint-config-standard@12.0.0(transitive)
+ Addedeslint-config-standard-jsx@6.0.2(transitive)
+ Addedeslint-plugin-es@1.4.1(transitive)
+ Addedeslint-plugin-import@2.14.0(transitive)
+ Addedeslint-plugin-node@7.0.1(transitive)
+ Addedeslint-plugin-promise@4.0.1(transitive)
+ Addedeslint-plugin-react@7.11.1(transitive)
+ Addedeslint-plugin-standard@4.0.2(transitive)
+ Addedeslint-scope@4.0.3(transitive)
+ Addedeslint-utils@1.4.3(transitive)
+ Addedespree@4.1.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedignore@4.0.6(transitive)
+ Addedinquirer@5.2.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addednice-try@1.0.5(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedregexpp@2.0.1(transitive)
+ Addedrxjs@5.5.12(transitive)
+ Addedstandard-engine@9.0.0(transitive)
+ Addedsymbol-observable@1.0.1(transitive)
+ Addedtable@4.0.3(transitive)
+ Addeduri-js@4.4.1(transitive)
- Removedacorn@3.3.05.7.4(transitive)
- Removedacorn-jsx@3.0.1(transitive)
- Removedajv@5.5.2(transitive)
- Removedajv-keywords@2.1.1(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedbuiltin-modules@1.1.1(transitive)
- Removedco@4.6.0(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcross-spawn@5.1.0(transitive)
- Removedeslint@4.18.2(transitive)
- Removedeslint-config-standard@11.0.0(transitive)
- Removedeslint-config-standard-jsx@5.0.0(transitive)
- Removedeslint-plugin-import@2.9.0(transitive)
- Removedeslint-plugin-node@6.0.1(transitive)
- Removedeslint-plugin-promise@3.7.0(transitive)
- Removedeslint-plugin-react@7.7.0(transitive)
- Removedeslint-plugin-standard@3.0.1(transitive)
- Removedeslint-scope@3.7.3(transitive)
- Removedespree@3.5.4(transitive)
- Removedfast-deep-equal@1.1.0(transitive)
- Removedinquirer@3.3.0(transitive)
- Removedjson-schema-traverse@0.3.1(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedrx-lite@4.0.8(transitive)
- Removedrx-lite-aggregates@4.0.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstandard-engine@8.0.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedtable@4.0.2(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedyallist@2.1.2(transitive)
Updatedeslint@~5.4.0
Updatedeslint-plugin-import@~2.14.0
Updatedeslint-plugin-node@~7.0.1
Updatedeslint-plugin-promise@~4.0.0
Updatedeslint-plugin-react@~7.11.1
Updatedstandard-engine@~9.0.0