Permalink
Browse files

Update: Add ES7 support (fixes #5401)

  • Loading branch information...
btmills committed Feb 26, 2016
1 parent be8bd8a commit 4a67b9ae1b2588b4807b22ecad3ad4550b91b6aa
Showing with 16 additions and 4 deletions.
  1. +2 −2 docs/user-guide/configuring.md
  2. +1 −1 lib/rules/space-infix-ops.js
  3. +1 −1 package.json
  4. +12 −0 tests/lib/rules/space-infix-ops.js
@@ -15,11 +15,11 @@ All of these options give you fine-grained control over how ESLint treats your c
## Specifying Parser Options
ESLint allows you to specify the JavaScript language options you want to support. By default, ESLint supports only ECMAScript 5 syntax. You can override that setting to enable support for ECMAScript 6 as well as [JSX](http://facebook.github.io/jsx/) by using parser options.
ESLint allows you to specify the JavaScript language options you want to support. By default, ESLint supports only ECMAScript 5 syntax. You can override that setting to enable support for ECMAScript 6 and 7 as well as [JSX](http://facebook.github.io/jsx/) by using parser options.
Parser options are set in your `.eslintrc.*` file by using the `parserOptions` property. The available options are:
* `ecmaVersion` - set to 3, 5 (default), or 6 to specify the version of ECMAScript you want to use.
* `ecmaVersion` - set to 3, 5 (default), 6, or 7 to specify the version of ECMAScript you want to use.
* `sourceType` - set to `"script"` (default) or `"module"` if your code is in ECMAScript modules.
* `ecmaFeatures` - an object indicating which additional language features you'd like to use:
* `globalReturn` - allow `return` statements in the global scope
@@ -15,7 +15,7 @@ module.exports = function(context) {
"*", "/", "%", "+", "-", "<<", ">>", ">>>", "<", "<=", ">", ">=", "in",
"instanceof", "==", "!=", "===", "!==", "&", "^", "|", "&&", "||", "=",
"+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "&=", "^=", "|=",
"?", ":", ","
"?", ":", ",", "**"
];
/**
View
@@ -42,7 +42,7 @@
"doctrine": "^1.2.0",
"es6-map": "^0.1.3",
"escope": "^3.4.0",
"espree": "^3.0.0",
"espree": "^3.1.1",
"estraverse": "^4.1.1",
"estraverse-fb": "^1.3.1",
"esutils": "^2.0.2",
@@ -28,6 +28,7 @@ ruleTester.run("space-infix-ops", rule, {
{ code: "const my_object = {key: 'value'};", parserOptions: { ecmaVersion: 6 } },
{ code: "var {a = 0} = bar;", parserOptions: { ecmaVersion: 6 } },
{ code: "function foo(a = 0) { }", parserOptions: { ecmaVersion: 6 } },
{ code: "a ** b", parserOptions: { ecmaVersion: 7 } },
{ code: "a|0", options: [{ int32Hint: true }] },
{ code: "a |0", options: [{ int32Hint: true }] }
],
@@ -312,6 +313,17 @@ ruleTester.run("space-infix-ops", rule, {
column: 15,
nodeType: "AssignmentPattern"
}]
},
{
code: "a**b",
output: "a ** b",
parserOptions: { ecmaVersion: 7 },
errors: [{
message: "Infix operators must be spaced.",
line: 1,
column: 2,
nodeType: "BinaryExpression"
}]
}
]
});

0 comments on commit 4a67b9a

Please sign in to comment.