heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.39k stars 45 forks source link

Tailwind prefix option implemented. #79

Closed langfeld closed 4 years ago

langfeld commented 4 years ago

I have added the possibility for a tailwind prefix. This should solve the following problem: https://github.com/heybourn/headwind/issues/57

heybourn commented 4 years ago

Thanks for the PR! Before I can merge you'll need to address the errors, attached is the CircleCI log:

headwind@1.6.5 test /home/circleci/project jest

FAIL tests/utils.spec.ts ● Test suite failed to run

TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
tests/utils.spec.ts:17:68 - error TS2345: Argument of type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: false; }' is not assignable to parameter of type 'Options'.
  Property 'customTailwindPrefix' is missing in type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: false; }' but required in type 'Options'.

17      const result = sortClassString(randomizedClassString, sortOrder, {
                                                                         ~
18          shouldRemoveDuplicates: true,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19          shouldPrependCustomClasses: false,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20      });
   ~~~

  src/utils.ts:4:2
    4  customTailwindPrefix: string;
       ~~~~~~~~~~~~~~~~~~~~
    'customTailwindPrefix' is declared here.
tests/utils.spec.ts:25:78 - error TS2345: Argument of type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: false; }' is not assignable to parameter of type 'Options'.
  Property 'customTailwindPrefix' is missing in type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: false; }' but required in type 'Options'.

25      const result = sortClassString(randomizedClassStringWithCustom, sortOrder, {
                                                                                   ~
26          shouldRemoveDuplicates: true,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27          shouldPrependCustomClasses: false,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28      });
   ~~~

  src/utils.ts:4:2
    4  customTailwindPrefix: string;
       ~~~~~~~~~~~~~~~~~~~~
    'customTailwindPrefix' is declared here.
tests/utils.spec.ts:33:78 - error TS2345: Argument of type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: true; }' is not assignable to parameter of type 'Options'.
  Property 'customTailwindPrefix' is missing in type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: true; }' but required in type 'Options'.

33      const result = sortClassString(randomizedClassStringWithCustom, sortOrder, {
                                                                                   ~
34          shouldRemoveDuplicates: true,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35          shouldPrependCustomClasses: true,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36      });
   ~~~

  src/utils.ts:4:2
    4  customTailwindPrefix: string;
       ~~~~~~~~~~~~~~~~~~~~
    'customTailwindPrefix' is declared here.
tests/utils.spec.ts:49:4 - error TS2345: Argument of type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: false; }' is not assignable to parameter of type 'Options'.
  Property 'customTailwindPrefix' is missing in type '{ shouldRemoveDuplicates: true; shouldPrependCustomClasses: false; }' but required in type 'Options'.

49          {
            ~
50              shouldRemoveDuplicates: true,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51              shouldPrependCustomClasses: false,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52          }
   ~~~~

  src/utils.ts:4:2
    4  customTailwindPrefix: string;
       ~~~~~~~~~~~~~~~~~~~~
    'customTailwindPrefix' is declared here.
tests/utils.spec.ts:64:4 - error TS2345: Argument of type '{ shouldRemoveDuplicates: false; shouldPrependCustomClasses: false; }' is not assignable to parameter of type 'Options'.
  Property 'customTailwindPrefix' is missing in type '{ shouldRemoveDuplicates: false; shouldPrependCustomClasses: false; }' but required in type 'Options'.

64          {
            ~
65              shouldRemoveDuplicates: false,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66              shouldPrependCustomClasses: false,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67          }
   ~~~~

  src/utils.ts:4:2
    4  customTailwindPrefix: string;
       ~~~~~~~~~~~~~~~~~~~~
    'customTailwindPrefix' is declared here.

Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 1.808s Ran all test suites. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! headwind@1.6.5 test: jest npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the headwind@1.6.5 test script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/circleci/.npm/_logs/2020-06-19T09_26_39_272Z-debug.log

Exited with code exit status 1

langfeld commented 4 years ago

Done :)

vesper8 commented 4 years ago

@langfeld @heybourn Hello.. I wanted to say that I did add "headwind.customTailwindPrefix": "tw-" to my settings but it still isn't working.

It will order tw-bg-red-500 container tw-mx-auto tw-text-white to container tw-bg-red-500 tw-mx-auto tw-text-white

But it should be ordering it to container tw-mx-auto tw-text-white tw-bg-red-500

It basically is ignoring the prefixed tailwind classes.. am I missing something?