prettier-plugin-eex
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -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 @@ |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1055710
201