@@ -1204,9 +1204,71 @@ eslintTester.run('stylex-sort-keys', rule.default, {
12041204 import { create, when } from '@stylexjs/stylex';
12051205 const styles = create({
12061206 base: {
1207+ display: 'flex',
1208+ width: {
1209+ ':hover': 10,
1210+ default: 20,
1211+ },
1212+ },
1213+ });
1214+ ` ,
1215+ output : `
1216+ import { create, when } from '@stylexjs/stylex';
1217+ const styles = create({
1218+ base: {
1219+ display: 'flex',
1220+ width: {
1221+ default: 20,
1222+ ':hover': 10,
1223+ },
1224+ },
1225+ });
1226+ ` ,
1227+ errors : [
1228+ {
1229+ message : 'StyleX property key "default" should be above ":hover"' ,
1230+ } ,
1231+ ] ,
1232+ } ,
1233+ {
1234+ code : `
1235+ import { create, when } from '@stylexjs/stylex';
1236+ const styles = create({
1237+ base: {
1238+ display: 'flex',
12071239 width: {
1208- [when.siblingAfter(":active")]: 30,
1209- [when.descendant(":focus")]: 20,
1240+ ':focus': 10,
1241+ ':hover': 20,
1242+ },
1243+ },
1244+ });
1245+ ` ,
1246+ output : `
1247+ import { create, when } from '@stylexjs/stylex';
1248+ const styles = create({
1249+ base: {
1250+ display: 'flex',
1251+ width: {
1252+ ':hover': 20,
1253+ ':focus': 10,
1254+ },
1255+ },
1256+ });
1257+ ` ,
1258+ errors : [
1259+ {
1260+ message : 'StyleX property key ":hover" should be above ":focus"' ,
1261+ } ,
1262+ ] ,
1263+ } ,
1264+ {
1265+ code : `
1266+ import { create, when } from '@stylexjs/stylex';
1267+ const styles = create({
1268+ base: {
1269+ width: {
1270+ [when.siblingAfter(':active')]: 30,
1271+ [when.descendant(':focus')]: 20,
12101272 },
12111273 display: 'flex',
12121274 },
@@ -1218,17 +1280,82 @@ eslintTester.run('stylex-sort-keys', rule.default, {
12181280 base: {
12191281 display: 'flex',
12201282 width: {
1221- [when.siblingAfter(" :active" )]: 30,
1222- [when.descendant(" :focus" )]: 20,
1283+ [when.siblingAfter(' :active' )]: 30,
1284+ [when.descendant(' :focus' )]: 20,
12231285 },
12241286 },
12251287 });
12261288 ` ,
12271289 errors : [
1290+ {
1291+ message : 'StyleX property key ":focus" should be above ":active"' ,
1292+ } ,
12281293 {
12291294 message : 'StyleX property key "display" should be above "width"' ,
12301295 } ,
12311296 ] ,
12321297 } ,
1298+ {
1299+ code : `
1300+ import { create, when } from '@stylexjs/stylex';
1301+ const styles = create({
1302+ base: {
1303+ display: 'flex',
1304+ width: {
1305+ [when.siblingAfter(':active')]: 30,
1306+ [when.descendant(':focus')]: 20,
1307+ },
1308+ },
1309+ });
1310+ ` ,
1311+ output : `
1312+ import { create, when } from '@stylexjs/stylex';
1313+ const styles = create({
1314+ base: {
1315+ display: 'flex',
1316+ width: {
1317+ [when.descendant(':focus')]: 20,
1318+ [when.siblingAfter(':active')]: 30,
1319+ },
1320+ },
1321+ });
1322+ ` ,
1323+ errors : [
1324+ {
1325+ message : 'StyleX property key ":focus" should be above ":active"' ,
1326+ } ,
1327+ ] ,
1328+ } ,
1329+ {
1330+ code : `
1331+ import { create, when } from '@stylexjs/stylex';
1332+ const styles = create({
1333+ base: {
1334+ display: 'flex',
1335+ width: {
1336+ [when[api](\`:active\`)]: 30,
1337+ [when[api](\`:focus\`)]: 20,
1338+ },
1339+ },
1340+ });
1341+ ` ,
1342+ output : `
1343+ import { create, when } from '@stylexjs/stylex';
1344+ const styles = create({
1345+ base: {
1346+ display: 'flex',
1347+ width: {
1348+ [when[api](\`:focus\`)]: 20,
1349+ [when[api](\`:active\`)]: 30,
1350+ },
1351+ },
1352+ });
1353+ ` ,
1354+ errors : [
1355+ {
1356+ message : 'StyleX property key ":focus" should be above ":active"' ,
1357+ } ,
1358+ ] ,
1359+ } ,
12331360 ] ,
12341361} ) ;
0 commit comments