11// @ts -ignore
2- import type { AttrDoubleQuoted , AttrSingleQuoted } from '@shopify/prettier-plugin-liquid/dist/types.js'
2+ import type {
3+ AttrDoubleQuoted ,
4+ AttrSingleQuoted ,
5+ } from '@shopify/prettier-plugin-liquid/dist/types.js'
36import * as astTypes from 'ast-types'
47// @ts -ignore
58import jsesc from 'jsesc'
@@ -14,7 +17,13 @@ import { getTailwindConfig } from './config.js'
1417import { createMatcher , type Matcher } from './options.js'
1518import { loadPlugins } from './plugins.js'
1619import { sortClasses , sortClassList } from './sorting.js'
17- import type { Customizations , StringChange , TransformerContext , TransformerEnv , TransformerMetadata } from './types'
20+ import type {
21+ Customizations ,
22+ StringChange ,
23+ TransformerContext ,
24+ TransformerEnv ,
25+ TransformerMetadata ,
26+ } from './types'
1827import { spliceChangesIntoString , visit , type Path } from './utils.js'
1928
2029let base = await loadPlugins ( )
@@ -339,7 +348,11 @@ function transformGlimmer(ast: any, { env }: TransformerContext) {
339348 }
340349
341350 let concat = path . find ( ( entry ) => {
342- return entry . parent && entry . parent . type === 'SubExpression' && entry . parent . path . original === 'concat'
351+ return (
352+ entry . parent &&
353+ entry . parent . type === 'SubExpression' &&
354+ entry . parent . path . original === 'concat'
355+ )
343356 } )
344357
345358 node . value = sortClasses ( node . value , {
@@ -507,7 +520,9 @@ function sortStringLiteral(
507520}
508521
509522function isStringLiteral ( node : any ) {
510- return node . type === 'StringLiteral' || ( node . type === 'Literal' && typeof node . value === 'string' )
523+ return (
524+ node . type === 'StringLiteral' || ( node . type === 'Literal' && typeof node . value === 'string' )
525+ )
511526}
512527
513528function sortTemplateLiteral (
@@ -568,7 +583,9 @@ function sortTemplateLiteral(
568583}
569584
570585function isSortableTemplateExpression (
571- node : import ( '@babel/types' ) . TaggedTemplateExpression | import ( 'ast-types' ) . namedTypes . TaggedTemplateExpression ,
586+ node :
587+ | import ( '@babel/types' ) . TaggedTemplateExpression
588+ | import ( 'ast-types' ) . namedTypes . TaggedTemplateExpression ,
572589 matcher : Matcher ,
573590) : boolean {
574591 return isSortableExpression ( node . tag , matcher )
@@ -910,7 +927,8 @@ function transformTwig(ast: any, { env, changes }: TransformerContext) {
910927 const concat = path . find ( ( entry ) => {
911928 return (
912929 entry . parent &&
913- ( entry . parent . type === 'BinaryConcatExpression' || entry . parent . type === 'BinaryAddExpression' )
930+ ( entry . parent . type === 'BinaryConcatExpression' ||
931+ entry . parent . type === 'BinaryAddExpression' )
914932 )
915933 } )
916934
@@ -938,7 +956,11 @@ function transformPug(ast: any, { env }: TransformerContext) {
938956 // First sort the classes in attributes
939957 for ( const token of ast . tokens ) {
940958 if ( token . type === 'attribute' && matcher . hasStaticAttr ( token . name ) ) {
941- token . val = [ token . val . slice ( 0 , 1 ) , sortClasses ( token . val . slice ( 1 , - 1 ) , { env } ) , token . val . slice ( - 1 ) ] . join ( '' )
959+ token . val = [
960+ token . val . slice ( 0 , 1 ) ,
961+ sortClasses ( token . val . slice ( 1 , - 1 ) , { env } ) ,
962+ token . val . slice ( - 1 ) ,
963+ ] . join ( '' )
942964 }
943965 }
944966
0 commit comments