Skip to content

Commit

Permalink
FIX #73
Browse files Browse the repository at this point in the history
  • Loading branch information
francoismassart committed Jan 13, 2022
1 parent 3871823 commit 572ebcd
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/util/groupMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const length = require('./types/length');
* @returns {String} Escaped version
*/
function escapeSpecialChars(str) {
return str.replace(/[\-\.\/]/g, '\\$&');
// return str.replace(/[\-\.\/]/g, '\\$&');
return str.replace(/\W/g, '\\$&');
}

/**
Expand Down
81 changes: 81 additions & 0 deletions tests/lib/rules/no-custom-classname.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,87 @@ ruleTester.run("no-custom-classname", rule, {
font-mono is a valid classname
</div>`,
},
{
code: `<div class="tw-inset-0">with prefix</div>`,
options: [
{
config: {
prefix: "tw-",
},
},
],
},
{
code: `<div class="tw/inset-0">with prefix</div>`,
options: [
{
config: {
prefix: "tw/",
},
},
],
},
{
code: `<div class="[tw]inset-0">with prefix</div>`,
options: [
{
config: {
prefix: "[tw]",
},
},
],
},
{
code: `<div class="[tw!]inset-0">with prefix</div>`,
options: [
{
config: {
prefix: "[tw!]",
},
},
],
},
{
code: `<div class="[.tw!]inset-0">with prefix</div>`,
options: [
{
config: {
prefix: "[.tw!]",
},
},
],
},
{
code: `<div class="[-tw!-]inset-0">with prefix</div>`,
options: [
{
config: {
prefix: "[-tw!-]",
},
},
],
},
{
code: `<div class="p/r[e].f!-x_inset-0">with prefix</div>`,
options: [
{
config: {
prefix: "p/r[e].f!-x_",
},
},
],
},
// {
// code: `
// <div class="p/r[e].f!-x_flex">Nasty prefix</div>`,
// options: [
// {
// config: {
// prefix: "p/r[e].f!-x_",
// },
// },
// ],
// },
],

invalid: [
Expand Down

0 comments on commit 572ebcd

Please sign in to comment.