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

@magicspace/tslint-rules

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magicspace/tslint-rules - npm Package Compare versions

Comparing version 0.1.17 to 0.1.19

44

bld/rules/emptyLineAroundBlocksRule.js

@@ -9,4 +9,6 @@ "use strict";

const REGEX_EMPTY_LINE_IN_NON_CODE = /^\s*\n\s*\n+((.|\s)*)/;
const BlockIncludedNodeValidators = [isBlockIncludedStatement];
const BlockIncludedStatementValidators = [
const BlockIncludingNodeValidators = [
isBlockIncludingStatement,
];
const BlockIncludingStatementValidators = [
isNotInElsePartIfStatement,

@@ -19,2 +21,3 @@ tsutils_1.isDoStatement,

tsutils_1.isTryStatement,
tsutils_1.isLabeledStatement,
tsutils_1.isFunctionDeclaration,

@@ -27,2 +30,3 @@ tsutils_1.isClassDeclaration,

tsutils_1.isModuleDeclaration,
isArrowFunctionInitializedPropertyDeclaration,
isPlainBlock,

@@ -51,2 +55,3 @@ ];

if (tsutils_1.isFunctionDeclaration(node) || tsutils_1.isMethodDeclaration(node)) {
// to allow leaving no empty line between methods in ObjectLiteralExpression
if (!tsutils_1.isObjectLiteralExpression(node.parent)) {

@@ -56,4 +61,4 @@ this.walkFunctionOrMethodDeclaration(node);

}
else if (isBlockIncludedStatement(node)) {
this.walkBlockIncludedStatement(node);
else if (isBlockIncludingStatement(node)) {
this.walkBlockIncludingStatement(node);
}

@@ -78,4 +83,4 @@ typescript_1.forEachChild(node, this.walkNode);

}
walkBlockIncludedStatement(node) {
if (!this.checkBlockIncludedStatement(node)) {
walkBlockIncludingStatement(node) {
if (!this.checkBlockIncludingStatement(node)) {
this.failureManager.append({

@@ -93,3 +98,3 @@ node,

if (firstSignature) {
if (!this.checkBlockIncludedStatement(firstSignature)) {
if (!this.checkBlockIncludingStatement(firstSignature)) {
this.failureManager.append({

@@ -104,3 +109,3 @@ node: firstSignature,

}
this.walkBlockIncludedStatement(node);
this.walkBlockIncludingStatement(node);
}

@@ -117,3 +122,6 @@ }

}
checkBlockIncludedStatement(node) {
checkBlockIncludingStatement(node) {
if (tsutils_1.isLabeledStatement(node.parent)) {
return true;
}
let parentSyntaxList = getParentSyntaxList(node);

@@ -141,6 +149,6 @@ if (parentSyntaxList && firstInSyntaxList(node, parentSyntaxList)) {

function isBlockIncludedNode(node) {
return validate(node, BlockIncludedNodeValidators);
return validate(node, BlockIncludingNodeValidators);
}
function isBlockIncludedStatement(node) {
return validate(node, BlockIncludedStatementValidators);
function isBlockIncludingStatement(node) {
return validate(node, BlockIncludingStatementValidators);
}

@@ -153,2 +161,10 @@ function isNotInElsePartIfStatement(node) {

}
function isArrowFunctionInitializedPropertyDeclaration(node) {
if (tsutils_1.isPropertyDeclaration(node) &&
node.initializer &&
tsutils_1.isArrowFunction(node.initializer)) {
return true;
}
return false;
}
function isPlainBlock(node) {

@@ -223,5 +239,3 @@ if (tsutils_1.isBlock(node) && tsutils_1.isBlockLike(node.parent)) {

function firstInSyntaxList(node, syntaxList) {
return (syntaxList &&
syntaxList.getChildCount() > 0 &&
syntaxList.getChildAt(0) === node);
return syntaxList.getChildCount() > 0 && syntaxList.getChildAt(0) === node;
}

@@ -228,0 +242,0 @@ function emptyLineExistsBeforeNode(node) {

{
"name": "@magicspace/tslint-rules",
"version": "0.1.17",
"version": "0.1.19",
"description": "Custom TSLint rules for MagicSpace.",

@@ -5,0 +5,0 @@ "repository": "https://github.com/makeflow/magicspace.git",

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