-
-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
After applying quick fix, the multiline classnames at still not sorted and now have indentation issues
To Reproduce
Steps to reproduce the behavior:
- Invalid Tailwind CSS classnames order:
import ctl from '@netlify/classnames-template-literals'
export const ButtonType = {
primary: ctl(
`hover:bg-purple-600 rounded-full py-1 text-sm font-semibold
border border-purple-200 text-purple-600 bg-white
px-4 hover:text-white`
),
}- Apply quick fix
- See
export const ButtonType = {
primary: ctl(
` px-4 hover:text-white
hover:bg-purple-600 rounded-full py-1 text-sm font-semibold
border border-purple-200 text-purple-600 bg-white `
),
}- The first line now has additional indentation while second line doesn't have any
- Classnames are still not sorted
Expected behavior
Order classnames as a whole first, then preserve the number of items per line
export const ButtonType = {
primary: ctl(
`py-1 px-4 text-sm font-semibold text-purple-600
hover:text-white bg-white hover:bg-purple-600 rounded-full
border border-purple-200`
),
}Environment (please complete the following information):
- OS: WSL Ubuntu 20.04 on Win 10 x64
- Softwares + version used:
- VSCode 1.60.1
- npm v7.24.0
- node v16.9.1
Additional context
Also, a single space at the end is triggering invalid order as well
Before:

After fix:

eslint config file or live demo
eslintrc
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": [
"import",
"@typescript-eslint",
"react-hooks",
"prettier",
"classnames",
"tailwindcss"
],
"extends": [
"react-app",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:tailwindcss/recommended"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
"react/self-closing-comp": ["warn", {
"component": true,
"html": true
}],
"@typescript-eslint/explicit-module-boundary-types": "off",
"prettier/prettier": [
"warn",
{
"printWidth": 100
}
]
},
"overrides": [{
"files": ["*.ts"],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": ["error"]
}
}],
"settings": {
"react": {
"pragma": "React",
"version": "detect"
},
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"],
"moduleDirectory": ["node_modules", "src/"]
}
},
"tailwindcss": {
"groupByResponsive": true
}
}
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

