New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-prefer-arrow-functions

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-prefer-arrow-functions - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

1

dist/config.d.ts

@@ -25,2 +25,3 @@ import { TSESTree } from '@typescript-eslint/types';

allowNamedFunctions: boolean;
allowObjectProperties: boolean;
classPropertiesAllowed: boolean;

@@ -27,0 +28,0 @@ disallowPrototype: boolean;

@@ -7,2 +7,3 @@ "use strict";

allowNamedFunctions: false,
allowObjectProperties: false,
classPropertiesAllowed: false,

@@ -9,0 +10,0 @@ disallowPrototype: false,

@@ -37,3 +37,4 @@ import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/utils';

isIgnored(fn: AnyFunction): boolean;
isObjectProperty(fn: AnyFunction): boolean;
isSafeTransformation(fn: TSESTree.Node): fn is AnyFunction;
}

@@ -130,2 +130,10 @@ "use strict";

}
isObjectProperty(fn) {
return this.sourceCode
.getAncestors(fn)
.reverse()
.some((ancestor) => {
return ancestor.type === utils_1.AST_NODE_TYPES.Property;
});
}
isSafeTransformation(fn) {

@@ -150,2 +158,4 @@ const isSafe = this.isAnyFunction(fn) &&

return false;
if (this.isObjectProperty(fn) && this.options.allowObjectProperties)
return false;
if (this.hasNameAndIsExportedAsDefaultExport(fn))

@@ -152,0 +162,0 @@ return false;

@@ -33,2 +33,6 @@ "use strict";

},
allowObjectProperties: {
default: config_1.DEFAULT_OPTIONS.allowObjectProperties,
type: 'boolean',
},
classPropertiesAllowed: {

@@ -35,0 +39,0 @@ default: config_1.DEFAULT_OPTIONS.classPropertiesAllowed,

2

package.json
{
"name": "eslint-plugin-prefer-arrow-functions",
"description": "Convert functions to arrow functions",
"version": "3.5.0",
"version": "3.6.0",
"author": "Jamie Mason (https://github.com/JamieMason)",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions/issues",

@@ -24,2 +24,3 @@ # eslint-plugin-prefer-arrow-functions

"allowNamedFunctions": false,
"allowObjectProperties": false,
"classPropertiesAllowed": false,

@@ -45,2 +46,12 @@ "disallowPrototype": false,

### `allowObjectProperties`
If set to true, the rule won't report named methods such as
```js
const myObj = {
hello() {}
}
```
### `classPropertiesAllowed`

@@ -47,0 +58,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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