Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-babel

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-babel - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

rules/func-params-comma-dangle.js

2

index.js

@@ -13,2 +13,3 @@ 'use strict';

'flow-object-type': require('./rules/flow-object-type'),
'func-params-comma-dangle': require('./rules/func-params-comma-dangle'),
},

@@ -24,3 +25,4 @@ rulesConfig: {

'flow-object-type': 0,
'func-params-comma-dangle': 0,
}
};

2

package.json
{
"name": "eslint-plugin-babel",
"version": "3.2.0",
"version": "3.3.0",
"description": "an eslint rule plugin companion to babel-eslint",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -36,3 +36,4 @@ # eslint-plugin-babel

"babel/no-await-in-loop": 1,
"babel/flow-object-type": 1
"babel/flow-object-type": 1,
"babel/func-params-comma-dangle": 1
}

@@ -45,8 +46,10 @@ }

🛠 : means it's autofixable with `--fix`.
- `babel/generator-star-spacing`: Handles async/await functions correctly
- `babel/new-cap`: Ignores capitalized decorators (`@Decorator`)
- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parameters
- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";`
- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parameters (🛠 )
- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠 )
- `babel/object-shorthand`: doesn't fail when using object spread (`...obj`)
- `babel/arrow-parens`: Handles async functions correctly
- `babel/arrow-parens`: Handles async functions correctly (🛠 )

@@ -57,4 +60,5 @@ The following rules are not in `eslint`, but are relevant only to syntax that is not specified by

- `babel/no-await-in-loop`: guard against awaiting async functions inside of a loop
- `babel/flow-object-type`: Require a particular separator between properties in Flow object types.
- `babel/flow-object-type`: Require a particular separator between properties in Flow object types. (🛠 )
- Use the option `semicolon` to require semicolons (e.g. `type Foo = { bar: number; baz: string }`).
- Use the option `comma` to require commas (e.g. `type Foo = { bar: number, baz: string }`).
- `babel/func-params-comma-dangle`: Require or forbid trailing commas for function paramater lists. Behaves like, and takes the same options as, `eslint`'s [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle). (🛠 )

@@ -31,3 +31,14 @@ /**

if (token.type === "Punctuator" && token.value === "(") {
context.report(node, asNeededMessage);
context.report({
node: node,
message: asNeededMessage,
fix: function(fixer) {
var paramToken = context.getTokenAfter(token);
var closingParenToken = context.getTokenAfter(paramToken);
return fixer.replaceTextRange([
token.range[0],
closingParenToken.range[1]
], paramToken.value);
}
});
}

@@ -42,3 +53,9 @@ return;

if (after.value !== ")") {
context.report(node, message);
context.report({
node: node,
message: message,
fix: function(fixer) {
return fixer.replaceText(token, '(' + token.value + ')');
}
});
}

@@ -45,0 +62,0 @@ }

@@ -21,5 +21,6 @@ /* eslint-disable */

function err(code, errors, args){
function err(code, output, errors, args){
var e = ok(code, args)
e.errors = errors
e.output = output
return e

@@ -78,2 +79,3 @@ }

code: "a => {}",
output: "(a) => {}",
ecmaFeatures: { arrowFunctions: true },

@@ -89,2 +91,3 @@ errors: [{

code: "a => a",
output: "(a) => a",
ecmaFeatures: { arrowFunctions: true },

@@ -100,2 +103,3 @@ errors: [{

code: "a => {\n}",
output: "(a) => {\n}",
ecmaFeatures: { arrowFunctions: true },

@@ -111,2 +115,3 @@ errors: [{

code: "a.then(foo => {});",
output: "a.then((foo) => {});",
ecmaFeatures: { arrowFunctions: true },

@@ -122,2 +127,3 @@ errors: [{

code: "a.then(foo => a);",
output: "a.then((foo) => a);",
ecmaFeatures: { arrowFunctions: true },

@@ -133,2 +139,3 @@ errors: [{

code: "a(foo => { if (true) {}; });",
output: "a((foo) => { if (true) {}; });",
ecmaFeatures: { arrowFunctions: true },

@@ -146,2 +153,3 @@ errors: [{

code: "(a) => a",
output: "a => a",
options: ["as-needed"],

@@ -158,2 +166,3 @@ ecmaFeatures: { arrowFunctions: true },

code: "(b) => b",
output: "b => b",
options: ["as-needed"],

@@ -170,11 +179,11 @@ ecmaFeatures: { arrowFunctions: true },

// async
err('async a => {}', [
err('async a => {}', 'async (a) => {}', [
{ message: 'Expected parentheses around arrow function argument.' },
]),
err('async a => a', [
err('async a => a', 'async (a) => a', [
{ message: 'Expected parentheses around arrow function argument.' },
]),
err('async (a) => a', [
err('async (a) => a', 'async a => a', [
{ message: 'Unexpected parentheses around single function argument' },

@@ -181,0 +190,0 @@ ],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc