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

@effect/language-service

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/language-service - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

_mjs/refactors/pipeableToDatafirst.mjs

2

package.json
{
"name": "@effect/language-service",
"version": "0.0.17",
"version": "0.0.18",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

@@ -23,23 +23,2 @@ # language-service

## Configuration
The severity of diagnostics can be customized by providing additional configuration in your tsconfig.json.
Accepted values are: `"none" | "suggestion" | "warning" | "error"`
```json
{
"compilerOptions": {
"plugins": [
{
"name": "@effect/language-service",
"diagnostics": {
"1003": "warning",
"1002": "none"
}
}
]
}
}
```
## Provided refactors

@@ -55,12 +34,8 @@

### Remove pipe
### Pipeable to DataFirst
![](images/remove-pipe.gif)
![](images/pipeable-to-datafirst.gif)
Transform a pipe() call into a series of regular function calls.
Transform a pipe() call into a series of datafirst function calls (where available).
### Remove curry arrow
![](images/remove-curry-arrow.gif)
Removes useless arrow functions.

@@ -67,0 +42,0 @@

@@ -8,4 +8,5 @@ declare const _default: {

wrapWithPipe: import("./definition").RefactorDefinition;
pipeableToDatafirst: import("./definition").RefactorDefinition;
};
export default _default;
//# sourceMappingURL=index.d.ts.map

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

var _functionToArrow = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/functionToArrow"));
var _pipeableToDatafirst = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/pipeableToDatafirst"));
var _toggleReturnTypeAnnotation = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/toggleReturnTypeAnnotation"));

@@ -21,5 +22,6 @@ var _toggleTypeAnnotation = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/toggleTypeAnnotation"));

toggleReturnTypeAnnotation: _toggleReturnTypeAnnotation.default,
wrapWithPipe: _wrapWithPipe.default
wrapWithPipe: _wrapWithPipe.default,
pipeableToDatafirst: _pipeableToDatafirst.default
};
exports.default = _default;
//# sourceMappingURL=index.js.map

@@ -118,2 +118,4 @@ import * as O from "@effect/language-service/utils/Option";

export declare function simplifyTypeNode(ts: TypeScriptApi): (typeNode: ts.TypeNode) => ts.TypeNode;
export declare function isPipeCall(ts: TypeScriptApi): (node: ts.Node) => node is ts.CallExpression;
export declare function asDataFirstExpression(ts: TypeScriptApi, checker: ts.TypeChecker): (node: ts.Node, self: ts.Expression) => O.Option<ts.CallExpression>;
//# sourceMappingURL=AST.d.ts.map

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

exports.addReturnTypeAnnotation = addReturnTypeAnnotation;
exports.asDataFirstExpression = asDataFirstExpression;
exports.collectAll = collectAll;

@@ -18,2 +19,3 @@ exports.findModuleImportIdentifierName = findModuleImportIdentifierName;

exports.isNodeInRange = isNodeInRange;
exports.isPipeCall = isPipeCall;
exports.removeReturnTypeAnnotation = removeReturnTypeAnnotation;

@@ -211,2 +213,26 @@ exports.simplifyTypeNode = simplifyTypeNode;

}
function isPipeCall(ts) {
return node => {
if (!ts.isCallExpression(node)) return false;
const expression = node.expression;
if (!ts.isIdentifier(expression)) return false;
if (expression.getText(node.getSourceFile()) !== "pipe") return false;
return true;
};
}
function asDataFirstExpression(ts, checker) {
return (node, self) => {
if (!ts.isCallExpression(node)) return O.none;
const signature = checker.getResolvedSignature(node);
if (!signature) return O.none;
const callSignatures = checker.getTypeAtLocation(node.expression).getCallSignatures();
for (let i = 0; i < callSignatures.length; i++) {
const callSignature = callSignatures[i];
if (callSignature.parameters.length === node.arguments.length + 1) {
return O.some(ts.factory.createCallExpression(node.expression, [], [self].concat(node.arguments)));
}
}
return O.none;
};
}
//# sourceMappingURL=AST.js.map

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

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

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