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

prettier-plugin-eex

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-eex - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

## v0.4.0 - 24 February 2021
### Bug Fixes
- Properly formats regular form_for expressions and the liveview ones (with </form> tags)
## v0.3.0 - 11 February 2021

@@ -7,0 +13,0 @@

4

lib/liveview.js

@@ -6,4 +6,6 @@ const liveViewFormForPlaceholder = '<form>';

const textWithPlaceholders = text.replace(/(<%=?[^%>]*=\s+form_for[\s\S]*?%>|<form>)/gm, (match) => {
if (match.match(/->\s*%>$/gm)) {
return match;
}
liveViewFormExpressions.push(match);
return liveViewFormForPlaceholder;

@@ -10,0 +12,0 @@ });

@@ -6,4 +6,9 @@ const { tokenizeHTML } = require('prettier-html-templates');

function parse(text, parsers, options) {
const { liveViewFormExpressions, textWithPlaceholders } = encodeFormForExpressions(text);
let liveViewFormExpressions = [];
let textWithPlaceholders = text;
if (options.filepath.endsWith('.leex') && text.includes('</form>')) {
({ liveViewFormExpressions, textWithPlaceholders } = encodeFormForExpressions(text));
}
return {

@@ -10,0 +15,0 @@ tokens: tokenizeHTML(textWithPlaceholders, /<%[\s\S]*?%>/gm, expressionTypeMatcher),

@@ -25,3 +25,3 @@ const prettier = require('prettier');

let newDoc = doc;
if (doc === liveViewFormForPlaceholder) {
if (doc === liveViewFormForPlaceholder && liveViewFormExpressions.length) {
newDoc = liveViewFormExpressions.shift();

@@ -28,0 +28,0 @@ }

{
"name": "prettier-plugin-eex",
"version": "0.3.0",
"version": "0.4.0",
"license": "MIT",

@@ -50,3 +50,3 @@ "description": "Prettier plugin for .html.eex and .html.leex files",

"eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0",
"eslint-config-prettier": "^8.0.0",
"eslint-plugin-import": "^2.22.1",

@@ -53,0 +53,0 @@ "eslint-plugin-prettier": "^3.3.1",

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