Skip to content

Commit d24d0b4

Browse files
author
Ashley Baldwin-Hunter
committed
Merge pull request #6 from codeclimate/abh-upstream-v1.10.3
Abh upstream v1.10.3
2 parents cdf7fce + fd49900 commit d24d0b4

File tree

124 files changed

+4057
-1332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+4057
-1332
lines changed

.eslintrc renamed to .eslintrc.yml

File renamed without changes.

CHANGELOG.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,75 @@
1+
v1.10.3 - December 1, 2015
2+
3+
* Docs: Update strict rule docs (fixes #4583) (Nicholas C. Zakas)
4+
* Docs: Reference .eslintrc.* in contributing docs (fixes #4532) (Kai Cataldo)
5+
* Fix: Add for-of to `curly` rule (fixes #4571) (Kai Cataldo)
6+
* Fix: Ignore space before function in array start (fixes #4569) (alberto)
7+
8+
v1.10.2 - November 27, 2015
9+
10+
* Upgrade: [email protected] (refs #4485) (Nicholas C. Zakas)
11+
* Upgrade: Pinned down js-yaml to avoid breaking dep (fixes #4553) (alberto)
12+
* Fix: lines-around-comment with multiple comments (fixes #3509) (alberto)
13+
* Upgrade: [email protected] (fixes #4545) (Kevin Partington)
14+
* Fix: Bugfix for eqeqeq autofix (fixes #4540) (Kevin Partington)
15+
* Fix: Add for-in to `curly` rule (fixes #4436) (Kai Cataldo)
16+
* Fix: `valid-jsdoc` unneeded require check fix (fixes #4527) (Gyandeep Singh)
17+
* Fix: `brace-style` ASI fix for if-else condition (fixes #4520) (Gyandeep Singh)
18+
* Build: Add branch update during release process (fixes #4491) (Gyandeep Singh)
19+
* Build: Allow revert commits in commit messages (fixes #4452) (alberto)
20+
* Fix: Incorrect location in no-fallthrough (fixes #4516) (alberto)
21+
* Fix: `no-spaced-func` had been crashed (fixes #4508) (Toru Nagashima)
22+
* Fix: Add a RestProperty test of `no-undef` (fixes #3271) (Toru Nagashima)
23+
* Docs: Load badge from HTTPS (Brian J Brennan)
24+
* Build: Update eslint bot messages (fixes #4497) (Nicholas C. Zakas)
25+
26+
v1.10.1 - November 20, 2015
27+
28+
* Fix: Revert freezing context object (refs #4495) (Nicholas C. Zakas)
29+
* 1.10.0 (Nicholas C. Zakas)
30+
31+
v1.10.0 - November 20, 2015
32+
33+
* Docs: Remove dupes from changelog (Nicholas C. Zakas)
34+
* Update: --init to create extensioned files (fixes #4476) (Nicholas C. Zakas)
35+
* Docs: Update description of exported comment (fixes #3916) (Nicholas C. Zakas)
36+
* Docs: Move legacy rules to stylistic (files #4111) (Nicholas C. Zakas)
37+
* Docs: Clean up description of recommended rules (fixes #4365) (Nicholas C. Zakas)
38+
* Docs: Fix home directory config description (fixes #4398) (Nicholas C. Zakas)
39+
* Update: Add class support to `require-jsdoc` rule (fixes #4268) (Gyandeep Singh)
40+
* Update: return type error in `valid-jsdoc` rule (fixes #4443) (Gyandeep Singh)
41+
* Update: Display errors at the place where fix should go (fixes #4470) (nightwing)
42+
* Docs: Fix typo in default `cacheLocation` value (Andrew Hutchings)
43+
* Fix: Handle comments in block-spacing (fixes #4387) (alberto)
44+
* Update: Accept array for `ignorePattern` (fixes #3982) (Jesse McCarthy)
45+
* Update: replace label and break with IIFE and return (fixes #4459) (Ilya Panasenko)
46+
* Fix: space-before-keywords false positive (fixes #4449) (alberto)
47+
* Fix: Improves performance (refs #3530) (Toru Nagashima)
48+
* Fix: Autofix quotes produces invalid javascript (fixes #4380) (nightwing)
49+
* Docs: Update indent.md (Nathan Brown)
50+
* New: Disable comment config option (fixes #3901) (Matthew Riley MacPherson)
51+
* New: Config files with extensions (fixes #4045, fixes #4263) (Nicholas C. Zakas)
52+
* Revert "Update: Add JSX exceptions to no-extra-parens (fixes #4229)" (Brandon Mills)
53+
* Update: Add JSX exceptions to no-extra-parens (fixes #4229) (Brandon Mills)
54+
* Docs: Replace link to deprecated rule with newer rule (Andrew Marshall)
55+
* Fix: `no-extend-native` crashed at empty defineProperty (fixes #4438) (Toru Nagashima)
56+
* Fix: Support empty if blocks in lines-around-comment (fixes #4339) (alberto)
57+
* Fix: `curly` warns wrong location for `else` (fixes #4362) (Toru Nagashima)
58+
* Fix: `id-length` properties never option (fixes #4347) (Toru Nagashima)
59+
* Docs: missing close rbracket in example (@storkme)
60+
* Revert "Update: Allow empty arrow body (fixes #4411)" (Nicholas C. Zakas)
61+
* Fix: eqeqeq autofix avoids clashes with space-infix-ops (fixes #4423) (Kevin Partington)
62+
* Docs: Document semi-spacing behaviour (fixes #4404) (alberto)
63+
* Update: Allow empty arrow body (fixes #4411) (alberto)
64+
* Fix: Handle comments in comma-spacing (fixes #4389) (alberto)
65+
* Update: Refactor eslint.verify args (fixes #4395) (Nicholas C. Zakas)
66+
* Fix: no-undef-init should ignore const (fixes #4284) (Nicholas C. Zakas)
67+
* Fix: Add the missing "as-needed" docs to the radix rule (fixes #4364) (Michał Gołębiowski)
68+
* Fix: Display singular/plural version of "line" in message (fixes #4359) (Marius Schulz)
69+
* Update: Add Popular Style Guides (fixes #4320) (Jamund Ferguson)
70+
* Fix: eslint.report can be called w/o node if loc provided (fixes #4220) (Kevin Partington)
71+
* Update: no-implicit-coercion validate AssignmentExpression (fixes #4348) (Ilya Panasenko)
72+
173
v1.9.0 - November 6, 2015
274

375
* Update: Make radix accept a "as-needed" option (fixes #4048) (Michał Gołębiowski)

Makefile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ function getReleaseType(version) {
182182
function release(type) {
183183
var newVersion;/* , changes;*/
184184

185+
exec("git checkout master && git fetch origin && git reset --hard origin/master");
186+
exec("npm install && npm prune");
187+
185188
target.test();
186189
echo("Generating new version");
187190
newVersion = execSilent("npm version " + type).trim();
@@ -944,7 +947,7 @@ target.checkGitCommit = function() {
944947
}
945948

946949
// Only check non-release messages
947-
if (!semver.valid(commitMsgs[0])) {
950+
if (!semver.valid(commitMsgs[0]) && !/^Revert /.test(commitMsgs[0])) {
948951
if (commitMsgs[0].slice(0, commitMsgs[0].indexOf("\n")).length > 72) {
949952
echo(" - First line of commit message must not exceed 72 characters");
950953
failed = true;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,5 @@ Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](ht
122122
[travis-url]: https://travis-ci.org/eslint/eslint
123123
[coveralls-image]: https://img.shields.io/coveralls/eslint/eslint/master.svg?style=flat-square
124124
[coveralls-url]: https://coveralls.io/r/eslint/eslint?branch=master
125-
[downloads-image]: http://img.shields.io/npm/dm/eslint.svg?style=flat-square
125+
[downloads-image]: https://img.shields.io/npm/dm/eslint.svg?style=flat-square
126126
[downloads-url]: https://www.npmjs.com/package/eslint

bin/eslint.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,13 @@ if (useStdIn) {
4646
}
4747
}));
4848
} else if (init) {
49-
var configInit = require("../lib/config-initializer");
49+
var configInit = require("../lib/config/config-initializer");
5050
configInit.initializeConfig(function(err) {
5151
if (err) {
5252
exitCode = 1;
5353
console.error(err.message);
5454
console.error(err.stack);
5555
} else {
56-
console.log("Successfully created .eslintrc file in " + process.cwd());
5756
exitCode = 0;
5857
}
5958
});

docs/developer-guide/nodejs-api.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ The most important method on `linter` is `verify()`, which initiates linting of
2828

2929
* `code` - the source code to lint (a string or instance of `SourceCode`).
3030
* `config` - a configuration object.
31-
* `filename` - (optional) the filename to associate with the source code.
32-
* `saveState` - (optional) set to true to maintain the internal state of `linter` after linting (mostly used for testing purposes).
31+
* `options` - (optional) Additional options for this run.
32+
* `filename` - (optional) the filename to associate with the source code.
33+
* `saveState` - (optional) set to true to maintain the internal state of `linter` after linting (mostly used for testing purposes).
34+
* `allowInlineConfig` - (optional) set to `false` to disable inline comments from changing eslint rules.
3335

3436
You can call `verify()` like this:
3537

@@ -40,7 +42,7 @@ var messages = linter.verify("var foo;", {
4042
rules: {
4143
semi: 2
4244
}
43-
}, "foo.js");
45+
}, { filename: "foo.js" });
4446

4547
// or using SourceCode
4648

@@ -53,7 +55,7 @@ var messages = linter.verify(code, {
5355
rules: {
5456
semi: 2
5557
}
56-
}, "foo.js");
58+
}, { filename: "foo.js" });
5759
```
5860

5961
The `verify()` method returns an array of objects containing information about the linting warnings and errors. Here's an example:
@@ -95,7 +97,7 @@ var messages = linter.verify("var foo = bar;", {
9597
rules: {
9698
semi: 2
9799
}
98-
}, "foo.js");
100+
}, { filename: "foo.js" });
99101

100102
var code = linter.getSourceCode();
101103

@@ -123,14 +125,15 @@ The `CLIEngine` is a constructor, and you can create a new instance by passing i
123125
* `fix` - True indicates that fixes should be applied to the text when possible.
124126
* `ignore` - False disables use of `.eslintignore` (default: true). Corresponds to `--no-ignore`.
125127
* `ignorePath` - The ignore file to use instead of `.eslintignore` (default: null). Corresponds to `--ignore-path`.
128+
* `ignorePattern` - Glob patterns for paths to ignore. String or array of strings.
126129
* `baseConfig` - Set to false to disable use of base config. Could be set to an object to override default base config as well.
127130
* `rulePaths` - An array of directories to load custom rules from (default: empty array). Corresponds to `--rulesdir`.
128131
* `rules` - An object of rules to use (default: null). Corresponds to `--rule`.
129132
* `useEslintrc` - Set to false to disable use of `.eslintrc` files (default: true). Corresponds to `--no-eslintrc`.
130133
* `parser` - Specify the parser to be used (default: `espree`). Corresponds to `--parser`.
131134
* `cache` - Operate only on changed files (default: `false`). Corresponds to `--cache`.
132135
* `cacheFile` - Name of the file where the cache will be stored (default: `.eslintcache`). Corresponds to `--cache-file`. Deprecated: use `cacheLocation` instead.
133-
* `cacheLocation` - Name of the file or directory where the cache will be stored (default: `.estlintcache`). Correspond to `--cache-location`
136+
* `cacheLocation` - Name of the file or directory where the cache will be stored (default: `.eslintcache`). Correspond to `--cache-location`
134137

135138
For example:
136139

docs/developer-guide/working-with-rules.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ The main method you'll use is `context.report()`, which publishes a warning or e
118118
* `data` - (optional) placeholder data for `message`.
119119
* `fix` - (optional) a function that applies a fix to resolve the problem.
120120

121+
Note that at least one of `node` or `loc` is required.
122+
121123
The simplest example is to use just `node` and `message`:
122124

123125
```js

docs/rules/README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Rules
22

3-
Rules in ESLint are divided into several categories to help you better understand their value. Though none are enabled by default, you can turn on rules that ESLint recommends by specifying your configuration to inherit from `eslint:recommended`. The rules that will be enabled when you inherit from `eslint:recommended` are indicated below as "(recommended)". For more information on how to configure rules and inherit from `eslint:recommended`, please see the [configuration documentation](../user-guide/configuring.md).
3+
Rules in ESLint are divided into several categories to help you better understand their value. All rules are disabled by default. ESLint recommends some rules to catch common problems, and you can use these recommended rules by including `extends: "eslint:recommended"` in your configuration file. The rules that will be enabled when you inherit from `eslint:recommended` are indicated below as "(recommended)". For more information on how to configure rules and use `extends`, please see the [configuration documentation](../user-guide/configuring.md).
44

55
Some rules are fixable using the `--fix` command line flag. Those rules are marked as "(fixable)" below.
66

@@ -158,11 +158,16 @@ These rules are purely matters of style and are quite subjective.
158158
* [key-spacing](key-spacing.md) - enforce spacing between keys and values in object literal properties
159159
* [linebreak-style](linebreak-style.md) - disallow mixed 'LF' and 'CRLF' as linebreaks
160160
* [lines-around-comment](lines-around-comment.md) - enforce empty lines around comments
161+
* [max-depth](max-depth.md) - specify the maximum depth that blocks can be nested
162+
* [max-len](max-len.md) - specify the maximum length of a line in your program
161163
* [max-nested-callbacks](max-nested-callbacks.md) - specify the maximum depth callbacks can be nested
164+
* [max-params](max-params.md) - limits the number of parameters that can be used in the function declaration.
165+
* [max-statements](max-statements.md) - specify the maximum number of statement allowed in a function
162166
* [new-cap](new-cap.md) - require a capital letter for constructors
163167
* [new-parens](new-parens.md) - disallow the omission of parentheses when invoking a constructor with no arguments
164168
* [newline-after-var](newline-after-var.md) - require or disallow an empty newline after variable declarations
165169
* [no-array-constructor](no-array-constructor.md) - disallow use of the `Array` constructor
170+
* [no-bitwise](no-bitwise.md) - disallow use of bitwise operators
166171
* [no-continue](no-continue.md) - disallow use of the `continue` statement
167172
* [no-inline-comments](no-inline-comments.md) - disallow comments inline after code
168173
* [no-lonely-if](no-lonely-if.md) - disallow `if` as the only statement in an `else` block
@@ -171,6 +176,7 @@ These rules are purely matters of style and are quite subjective.
171176
* [no-negated-condition](no-negated-condition.md) - disallow negated conditions
172177
* [no-nested-ternary](no-nested-ternary.md) - disallow nested ternary expressions
173178
* [no-new-object](no-new-object.md) - disallow the use of the `Object` constructor
179+
* [no-plusplus](no-plusplus.md) - disallow use of unary operators, `++` and `--`
174180
* [no-restricted-syntax](no-restricted-syntax.md) - disallow use of certain syntax in code
175181
* [no-spaced-func](no-spaced-func.md) - disallow space between function identifier and application (fixable)
176182
* [no-ternary](no-ternary.md) - disallow the use of ternary operators
@@ -222,16 +228,6 @@ These rules are only relevant to ES6 environments.
222228
* [prefer-template](prefer-template.md) - suggest using template literals instead of strings concatenation
223229
* [require-yield](require-yield.md) - disallow generator functions that do not have `yield`
224230

225-
## Legacy
226-
227-
The following rules are included for compatibility with [JSHint](http://jshint.com/) and [JSLint](http://jslint.com/). While the names of the rules may not match up with the JSHint/JSLint counterpart, the functionality is the same.
228-
229-
* [max-depth](max-depth.md) - specify the maximum depth that blocks can be nested
230-
* [max-len](max-len.md) - specify the maximum length of a line in your program
231-
* [max-params](max-params.md) - limits the number of parameters that can be used in the function declaration.
232-
* [max-statements](max-statements.md) - specify the maximum number of statement allowed in a function
233-
* [no-bitwise](no-bitwise.md) - disallow use of bitwise operators
234-
* [no-plusplus](no-plusplus.md) - disallow use of unary operators, `++` and `--`
235231

236232
## Removed
237233

docs/rules/indent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Level of indentation denotes the multiple of the indent specified. Example:
4646
* Indent of tabs with SwitchCase set to 2 will indent `SwitchCase` with 2 tabs with respect to switch.
4747

4848

49-
2 space indentation with enabled switch cases validation
49+
2 space indentation with enabled switch cases indentation
5050

5151
```json
5252
"indent": [2, 2, {"SwitchCase": 1}]

docs/rules/no-implicit-coercion.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var b = ~foo.indexOf(".");
1111
var n = +foo;
1212
var n = 1 * foo;
1313
var s = "" + foo;
14+
foo += "";
1415
```
1516

1617
Those can be replaced with the following code:
@@ -21,6 +22,7 @@ var b = foo.indexOf(".") !== -1;
2122
var n = Number(foo);
2223
var n = Number(foo);
2324
var s = String(foo);
25+
foo = String(foo);
2426
```
2527

2628
## Rule Details
@@ -96,6 +98,8 @@ The following patterns are considered problems:
9698
/*eslint no-implicit-coercion: 2*/
9799

98100
var n = "" + foo; /*error use `String(foo)` instead.*/
101+
102+
foo += ""; /*error use `foo = String(foo)` instead.*/
99103
```
100104

101105
The following patterns are not considered problems:

0 commit comments

Comments
 (0)