Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/rules/enforce-consistent-class-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ Enforce the order of tailwind classes. It is possible to sort classes alphabetic
**Type**: `string`
**Default**: `undefined`

<br/>

### `tsconfig`

The path to the `tsconfig.json` file. If not specified, the plugin will try to find it automatically.
This can also be set globally via the [`settings` object](../settings/settings.md#tsconfig).

The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.

**Type**: `string`
**Default**: `undefined`

</details>

<br/>
Expand Down
12 changes: 12 additions & 0 deletions docs/rules/enforce-consistent-important-position.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ Controls where the important modifier (`!`) should be placed in class names.
**Type**: `string`
**Default**: `undefined`

<br/>

### `tsconfig`

The path to the `tsconfig.json` file. If not specified, the plugin will try to find it automatically.
This can also be set globally via the [`settings` object](../settings/settings.md#tsconfig).

The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.

**Type**: `string`
**Default**: `undefined`

</details>

<br/>
Expand Down
12 changes: 12 additions & 0 deletions docs/rules/enforce-consistent-line-wrapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ Enforce tailwind classes to be broken up into multiple lines. It is possible to
**Type**: `string`
**Default**: `undefined`

<br/>

### `tsconfig`

The path to the `tsconfig.json` file. If not specified, the plugin will try to find it automatically.
This can also be set globally via the [`settings` object](../settings/settings.md#tsconfig).

The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.

**Type**: `string`
**Default**: `undefined`

</details>

<br/>
Expand Down
12 changes: 12 additions & 0 deletions docs/rules/no-conflicting-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ Disallow conflicting classes in tailwindcss class strings. Conflicting classes a
**Type**: `string`
**Default**: `undefined`

<br/>

### `tsconfig`

The path to the `tsconfig.json` file. If not specified, the plugin will try to find it automatically.
This can also be set globally via the [`settings` object](../settings/settings.md#tsconfig).

The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.

**Type**: `string`
**Default**: `undefined`

</details>

<br/>
Expand Down
23 changes: 18 additions & 5 deletions docs/rules/no-deprecated-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ The following classes will be reported as deprecated:

<br/>

### `entryPoint`

The path to the entry file of the css based tailwind config (eg: `src/global.css`).
If not specified, the plugin will fall back to the default configuration.

**Type**: `string`
**Default**: `undefined`

<br/>

### `tailwindConfig`

Tailwind config file path.
Expand All @@ -92,12 +102,15 @@ The following classes will be reported as deprecated:

<br/>

### `entryPoint`
### `tsconfig`

Main CSS file that imports Tailwind CSS.

**Type**: string
**Default**: Default CSS lookup
The path to the `tsconfig.json` file. If not specified, the plugin will try to find it automatically.
This can also be set globally via the [`settings` object](../settings/settings.md#tsconfig).

The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.

**Type**: `string`
**Default**: `undefined`

</details>

Expand Down
12 changes: 12 additions & 0 deletions docs/rules/no-unregistered-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ Disallow unregistered classes in tailwindcss class strings. Unregistered classes
**Type**: `string`
**Default**: `undefined`

<br/>

### `tsconfig`

The path to the `tsconfig.json` file. If not specified, the plugin will try to find it automatically.
This can also be set globally via the [`settings` object](../settings/settings.md#tsconfig).

The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.

**Type**: `string`
**Default**: `undefined`

</details>

<br/>
Expand Down
13 changes: 13 additions & 0 deletions docs/settings/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [entryPoint](#entrypoint)
- [tailwindConfig](#tailwindconfig)
- [tsconfig](#tsconfig)
- [attributes](#attributes)
- [callees](#callees)
- [variables](#variables)
Expand Down Expand Up @@ -55,6 +56,18 @@ To set the settings object, add a `settings` key to the eslint config.
For tailwindcss v4 and the css based config, use the [`entryPoint`](#entrypoint) option instead.

**Type**: `string`

<br/>

### `tsconfig`

The path to the `tsconfig.json` file. If not specified, the plugin will try to find it automatically.
This can also be set globally via the [`settings` object](../settings/settings.md#tsconfig).

The tsconfig is used to resolve tsconfig [`path`](https://www.typescriptlang.org/tsconfig/#paths) aliases.

**Type**: `string`
**Default**: `undefined`

<br/>

Expand Down
97 changes: 92 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"postcss": "^8.5.6",
"postcss-import": "^16.1.1",
"synckit": "^0.11.8",
"tailwind-csstree": "^0.1.1"
"tailwind-csstree": "^0.1.1",
"tsconfig-paths-webpack-plugin": "^4.2.0"
},
"devDependencies": {
"@angular/compiler": "^20.1.0",
Expand Down
19 changes: 12 additions & 7 deletions src/async-utils/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@ import { env } from "node:process";
import { getModifiedDate } from "./fs.js";


const CACHE = new Map<string, { date: Date; value: any; }>();
interface CacheItem {
date: Date;
value: any;
}

const CACHE = new Map<string, CacheItem>();

export function invalidateByModifiedDate(cacheDate: Date, path: string): boolean {
export function invalidateByModifiedDate(cache: CacheItem, path: string): boolean {
const modified = getModifiedDate(path);
return !modified || modified > cacheDate;
return !modified || modified > cache.date;
}

export function withCache<Result>(key: string, callback: () => Result, invalidate?: (cacheDate: Date, cacheKey: string) => boolean): Result;
export function withCache<Result>(key: string, callback: () => Promise<Result>, invalidate?: (cacheDate: Date, cacheKey: string) => boolean): Promise<Result>;
export function withCache<Result>(key: string, callback: () => Promise<Result> | Result, invalidate: (cacheDate: Date, cacheKey: string) => boolean = invalidateByModifiedDate): Promise<Result> | Result {
export function withCache<Result>(key: string, callback: () => Result, invalidate?: (cache: CacheItem, cacheKey: string) => boolean): Result;
export function withCache<Result>(key: string, callback: () => Promise<Result>, invalidate?: (cache: CacheItem, cacheKey: string) => boolean): Promise<Result>;
export function withCache<Result>(key: string, callback: () => Promise<Result> | Result, invalidate: (cache: CacheItem, cacheKey: string) => boolean = invalidateByModifiedDate): Promise<Result> | Result {
const cached = CACHE.get(key);

if(env.NODE_ENV !== "test" && cached && !invalidate(cached.date, key)){
if(env.NODE_ENV !== "test" && cached && !invalidate(cached, key)){
return cached.value;
}

Expand Down
Loading
Loading