Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Autogenerated new docs and demo at Fri May 19 2017 14:43:59
Browse files Browse the repository at this point in the history
  • Loading branch information
not-an-aardvark committed May 19, 2017
1 parent ee72353 commit 0a65882
Show file tree
Hide file tree
Showing 13 changed files with 634 additions and 36 deletions.
82 changes: 82 additions & 0 deletions _posts/2017-05-19-eslint-v4.0.0-beta.0-released.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
layout: post
title: ESLint v4.0.0-beta.0 released
tags:
- release
- major
---
# ESLint v4.0.0-beta.0 released

We just pushed ESLint v4.0.0-beta.0, which is a major release upgrade of ESLint. This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes, so please read the following closely.




## Breaking Changes


* [3ec436ee](https://github.com/eslint/eslint/commit/3ec436ee) Breaking: New Linter API (fixes [#8454](https://github.com/eslint/eslint/issues/8454)) ([#8465](https://github.com/eslint/eslint/issues/8465)) (Gyandeep Singh)




## Features


* [2f7015b6](https://github.com/eslint/eslint/commit/2f7015b6) New: [semi-style](/docs/rules/semi-style) rule (fixes [#8169](https://github.com/eslint/eslint/issues/8169)) ([#8542](https://github.com/eslint/eslint/issues/8542)) (Toru Nagashima)
* [a93a2f95](https://github.com/eslint/eslint/commit/a93a2f95) New: [padding-line-between-statements](/docs/rules/padding-line-between-statements) rule (fixes [#7356](https://github.com/eslint/eslint/issues/7356)) ([#8099](https://github.com/eslint/eslint/issues/8099)) (Toru Nagashima)
* [0ef09ea0](https://github.com/eslint/eslint/commit/0ef09ea0) New: [for-direction](/docs/rules/for-direction) rule (fixes [#8387](https://github.com/eslint/eslint/issues/8387)) ([#8519](https://github.com/eslint/eslint/issues/8519)) (薛定谔的猫)
* [482d5720](https://github.com/eslint/eslint/commit/482d5720) New: [switch-colon-spacing](/docs/rules/switch-colon-spacing) rule (fixes [#7981](https://github.com/eslint/eslint/issues/7981)) ([#8540](https://github.com/eslint/eslint/issues/8540)) (Toru Nagashima)




## Enhancements


* [3418479a](https://github.com/eslint/eslint/commit/3418479a) Update: improve [indent](/docs/rules/indent) of `flatTernaryExpressions` (fixes [#8481](https://github.com/eslint/eslint/issues/8481)) ([#8587](https://github.com/eslint/eslint/issues/8587)) (Toru Nagashima)
* [268d52ef](https://github.com/eslint/eslint/commit/268d52ef) Update: Use sane defaults for JSX indentation (fixes [#8425](https://github.com/eslint/eslint/issues/8425)) ([#8593](https://github.com/eslint/eslint/issues/8593)) (Teddy Katz)
* [afa35c68](https://github.com/eslint/eslint/commit/afa35c68) Update: check allman-style classes correctly in [indent](/docs/rules/indent) (fixes [#8493](https://github.com/eslint/eslint/issues/8493)) ([#8569](https://github.com/eslint/eslint/issues/8569)) (Teddy Katz)
* [456f519b](https://github.com/eslint/eslint/commit/456f519b) Update: make [indent](/docs/rules/indent) MemberExpression handling more robust (fixes [#8552](https://github.com/eslint/eslint/issues/8552)) ([#8554](https://github.com/eslint/eslint/issues/8554)) (Teddy Katz)




## Bug Fixes


* [eb14584a](https://github.com/eslint/eslint/commit/eb14584a) Fix: [no-unneeded-ternary](/docs/rules/no-unneeded-ternary) change code behavior after fix (fixes [#8507](https://github.com/eslint/eslint/issues/8507)) ([#8624](https://github.com/eslint/eslint/issues/8624)) (Jan Peer Stöcklmair)
* [3fc9653a](https://github.com/eslint/eslint/commit/3fc9653a) Fix: Call expression consistency in variable declaration (fixes [#8607](https://github.com/eslint/eslint/issues/8607)) ([#8619](https://github.com/eslint/eslint/issues/8619)) (Reyad Attiyat)
* [a73e6c09](https://github.com/eslint/eslint/commit/a73e6c09) Fix: Fix failing uknown node test since [#8569](https://github.com/eslint/eslint/issues/8569) indents class bodies ([#8588](https://github.com/eslint/eslint/issues/8588)) (Reyad Attiyat)
* [c6c639d6](https://github.com/eslint/eslint/commit/c6c639d6) Fix: Ignore unknown nodes for Indent rule (fixes [#8440](https://github.com/eslint/eslint/issues/8440)) ([#8504](https://github.com/eslint/eslint/issues/8504)) (Reyad Attiyat)
* [df17bc87](https://github.com/eslint/eslint/commit/df17bc87) Fix: [object-shorthand](/docs/rules/object-shorthand) crash on some computed keys (fixes [#8576](https://github.com/eslint/eslint/issues/8576)) ([#8577](https://github.com/eslint/eslint/issues/8577)) (Teddy Katz)
* [de0b4ad7](https://github.com/eslint/eslint/commit/de0b4ad7) Fix: Indent Ignore Variable Declaration init operator (fixes [#8546](https://github.com/eslint/eslint/issues/8546)) ([#8563](https://github.com/eslint/eslint/issues/8563)) (Reyad Attiyat)
* [927ca0dc](https://github.com/eslint/eslint/commit/927ca0dc) Fix: invalid syntax from [prefer-arrow-callback](/docs/rules/prefer-arrow-callback) autofixer (fixes [#8541](https://github.com/eslint/eslint/issues/8541)) ([#8555](https://github.com/eslint/eslint/issues/8555)) (Teddy Katz)
* [873310e5](https://github.com/eslint/eslint/commit/873310e5) Fix: run [no-unexpected-multiline](/docs/rules/no-unexpected-multiline) only if needed (fixes [#8550](https://github.com/eslint/eslint/issues/8550)) ([#8551](https://github.com/eslint/eslint/issues/8551)) (Ruben Bridgewater)
* [833a0cad](https://github.com/eslint/eslint/commit/833a0cad) Fix: confusing RuleTester error message when options is not an array ([#8557](https://github.com/eslint/eslint/issues/8557)) (Teddy Katz)




## Documentation


* [5b6093ef](https://github.com/eslint/eslint/commit/5b6093ef) Docs: Remove .eslintignore reference to transpiled file filtering ([#8622](https://github.com/eslint/eslint/issues/8622)) (Alex Summer)
* [11493781](https://github.com/eslint/eslint/commit/11493781) Docs: Rephrase in about section ([#8609](https://github.com/eslint/eslint/issues/8609)) (Sudarsan G P)








## Chores


* [729bbcdb](https://github.com/eslint/eslint/commit/729bbcdb) Chore: Fix lgtm alerts. ([#8611](https://github.com/eslint/eslint/issues/8611)) (Max Schaefer)
* [d21f5283](https://github.com/eslint/eslint/commit/d21f5283) Chore: make shelljs a devDependency instead of a dependency ([#8608](https://github.com/eslint/eslint/issues/8608)) (Teddy Katz)
* [23401626](https://github.com/eslint/eslint/commit/23401626) Chore: remove strip-bom dependency (refs [#8603](https://github.com/eslint/eslint/issues/8603)) ([#8606](https://github.com/eslint/eslint/issues/8606)) (Teddy Katz)
* [25db3d22](https://github.com/eslint/eslint/commit/25db3d22) Chore: avoid skipping test for env overrides (refs [#8291](https://github.com/eslint/eslint/issues/8291)) ([#8556](https://github.com/eslint/eslint/issues/8556)) (Teddy Katz)


4 changes: 2 additions & 2 deletions docs/4.0.0/about/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Everything is pluggable:
Every rule:

* Is standalone
* Can be able to be turned off or on (nothing can be deemed "too important to turn off")
* Can be set to be a warning or error individually
* Can be turned off or on (nothing can be deemed "too important to turn off")
* Can be set to a warning or error individually

Additionally:

Expand Down
32 changes: 26 additions & 6 deletions docs/4.0.0/developer-guide/nodejs-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ var codeLines = SourceCode.splitLines(code);
*/
```

## linter
## Linter

The `linter` object does the actual evaluation of the JavaScript code. It doesn't do any filesystem operations, it simply parses and reports on the code. In particular, the `linter` object does not process configuration objects or files. You can retrieve `linter` like this:
The `Linter` object does the actual evaluation of the JavaScript code. It doesn't do any filesystem operations, it simply parses and reports on the code. In particular, the `Linter` object does not process configuration objects or files. You can retrieve instances of `Linter` like this:

```js
var linter = require("eslint").linter;
var Linter = require("eslint").Linter;
var linter = new Linter();
```

The most important method on `linter` is `verify()`, which initiates linting of the given text. This method accepts four arguments:
The most important method on `Linter` is `verify()`, which initiates linting of the given text. This method accepts four arguments:

* `code` - the source code to lint (a string or instance of `SourceCode`).
* `config` - a configuration object that has been processed and normalized by CLIEngine using eslintrc files and/or other configuration arguments.
Expand All @@ -77,7 +78,8 @@ The most important method on `linter` is `verify()`, which initiates linting of
You can call `verify()` like this:

```js
var linter = require("eslint").linter;
var Linter = require("eslint").Linter;
var linter = new Linter();

var messages = linter.verify("var foo;", {
rules: {
Expand Down Expand Up @@ -135,7 +137,8 @@ The information available for each linting message is:
You can also get an instance of the `SourceCode` object used inside of `linter` by using the `getSourceCode()` method:

```js
var linter = require("eslint").linter;
var Linter = require("eslint").Linter;
var linter = new Linter();

var messages = linter.verify("var foo = bar;", {
rules: {
Expand All @@ -150,6 +153,22 @@ console.log(code.text); // "var foo = bar;"

In this way, you can retrieve the text and AST used for the last run of `linter.verify()`.

## linter

The `eslint.linter` object (deprecated) is an instance of the `Linter` class as defined [above](#Linter). `eslint.linter` exists for backwards compatibility, but we do not recommend using it because any mutations to it are shared among every module that uses `eslint`. Instead, please create your own instance of `eslint.Linter`.

```js
var linter = require("eslint").linter;

var messages = linter.verify("var foo;", {
rules: {
semi: 2
}
}, { filename: "foo.js" });
```

Note: This API is deprecated as of 4.0.0.

## CLIEngine

The primary Node.js API is `CLIEngine`, which is the underlying utility that runs the ESLint command line interface. This object will read the filesystem for configuration and file information but will not output any results. Instead, it allows you direct access to the important information so you can deal with the output yourself.
Expand Down Expand Up @@ -572,3 +591,4 @@ CLIEngine.outputFixes(report);
## Deprecated APIs

* `cli` - the `cli` object has been deprecated in favor of `CLIEngine`. As of v1.0.0, `cli` is no longer exported and should not be used by external tools.
* `linter` - the `linter` object has has been deprecated in favor of `Linter`, as of v4.0.0
39 changes: 39 additions & 0 deletions docs/4.0.0/rules/for-direction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: for-direction - Rules
layout: doc
---
<!-- Note: No pull requests accepted for this file. See README.md in the root directory for details. -->

# Enforce "for" loop update clause moving the counter in the right direction. (for-direction)

## Rule Details

A `for` loop with a stop condition that can never be reached, such as one with a counter that moves in the wrong direction, will run infinitely. While there are occasions when an infinite loop is intended, the convention is to construct such loops as `while` loops. More typically, an infinite for loop is a bug.

Examples of **incorrect** code for this rule:

```js
/*eslint for-direction: "error"*/
for (var i = 0; i < 10; i--) {
}

for (var i = 10; i >= 0; i++) {
}
```

Examples of **correct** code for this rule:

```js
/*eslint for-direction: "error"*/
for (var i = 0; i < 10; i++) {
}
```

## Version

This rule was introduced in ESLint 4.0.0-beta.0.

## Resources

* [Rule source](https://github.com/eslint/eslint/tree/master/lib/rules/for-direction.js)
* [Documentation source](https://github.com/eslint/eslint/tree/master/docs/rules/for-direction.md)
36 changes: 16 additions & 20 deletions docs/4.0.0/rules/indent.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,47 +538,43 @@ Examples of **incorrect** code for this rule with the default `4, { "flatTernary
```js
/*eslint indent: ["error", 4, { "flatTernaryExpressions": false }]*/

foo
? bar
: baz
? qux
: boop;
var a =
foo ? bar :
baz ? qux :
boop;
```

Examples of **correct** code for this rule with the default `4, { "flatTernaryExpressions": false }` option:

```js
/*eslint indent: ["error", 4, { "flatTernaryExpressions": false }]*/

foo
? bar
: baz
? qux
: boop;
var a =
foo ? bar :
baz ? qux :
boop;
```

Examples of **incorrect** code for this rule with the `4, { "flatTernaryExpressions": true }` option:

```js
/*eslint indent: ["error", 4, { "flatTernaryExpressions": true }]*/

foo
? bar
: baz
? qux
: boop;
var a =
foo ? bar :
baz ? qux :
boop;
```

Examples of **correct** code for this rule with the `4, { "flatTernaryExpressions": true }` option:

```js
/*eslint indent: ["error", 4, { "flatTernaryExpressions": true }]*/

foo
? bar
: baz
? qux
: boop;
var a =
foo ? bar :
baz ? qux :
boop;
```


Expand Down
2 changes: 2 additions & 0 deletions docs/4.0.0/rules/lines-around-directive.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ layout: doc

(fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fix) can automatically fix some of the problems reported by this rule.

This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements) rule.

Directives are used in JavaScript to indicate to the execution environment that a script would like to opt into a feature such as `"strict mode"`. Directives are grouped together in a [directive prologue](http://www.ecma-international.org/ecma-262/7.0/#directive-prologue) at the top of either a file or function block and are applied to the scope in which they occur.

```js
Expand Down
2 changes: 2 additions & 0 deletions docs/4.0.0/rules/newline-after-var.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ layout: doc

(fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fix) can automatically fix some of the problems reported by this rule.

This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements) rule.

As of today there is no consistency in separating variable declarations from the rest of the code. Some developers leave an empty line between var statements and the rest of the code like:

```js
Expand Down
2 changes: 2 additions & 0 deletions docs/4.0.0/rules/newline-before-return.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ layout: doc

(fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fix) can automatically fix some of the problems reported by this rule.

This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements) rule.

There is no hard and fast rule about whether empty lines should precede `return` statements in JavaScript. However, clearly delineating where a function is returning can greatly increase the readability and clarity of the code. For example:

```js
Expand Down
Loading

0 comments on commit 0a65882

Please sign in to comment.