Socket
Socket
Sign inDemoInstall

@trivago/prettier-plugin-sort-imports

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trivago/prettier-plugin-sort-imports - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

2

lib/src/utils/__tests__/remove-nodes-from-original-code.spec.js

@@ -44,3 +44,3 @@ "use strict";

};
var code = "// first comment\n// second comment\nimport z from 'z';\nimport c from 'c';\nimport g from 'g';\nimport t from 't';\nimport k from 'k';\nimport a from 'a';\n";
var code = "// first comment\n// second comment\nimport z from 'z';\nimport c from 'c';\nimport g from 'g';\nimport t from 't';\nimport k from 'k';\n// import a from 'a';\n // import a from 'a';\nimport a from 'a';\n";
test('it should remove nodes from the original code', function () {

@@ -47,0 +47,0 @@ var importNodes = getImportNodes(code);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeNodesFromOriginalCode = void 0;
/** Escapes a string literal to be passed to new RegExp. See: https://stackoverflow.com/a/6969486/480608.
* @param s the string to escape
*/
var escapeRegExp = function (s) { return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); };
/**

@@ -16,3 +20,6 @@ * Removes imports from original file

if (Number.isSafeInteger(start) && Number.isSafeInteger(end)) {
text = text.replace(code.substring(start, end), '');
text = text.replace(
// only replace imports at the beginning of the line (ignoring whitespace)
// otherwise matching commented imports will be replaced
new RegExp('^\\s*' + escapeRegExp(code.substring(start, end)), 'm'), '');
}

@@ -19,0 +26,0 @@ }

{
"name": "@trivago/prettier-plugin-sort-imports",
"version": "2.0.3",
"version": "2.0.4",
"description": "A prettier plugins to sort imports in provided RegEx order",

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

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