šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-readable-tailwind

Package Overview
Dependencies
Maintainers
0
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-readable-tailwind - npm Package Compare versions

Comparing version

to
1.8.1

14

lib/cjs/configs/config.js

@@ -13,5 +13,5 @@ "use strict";

rules: {
[`${pluginName}/${readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.name}`]: "error",
[`${pluginName}/${readable_tailwind_rules_tailwind_no_unnecessary_whitespace_js_1.tailwindNoUnnecessaryWhitespace.name}`]: "error",
[`${pluginName}/${readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.name}`]: "error",
[`${pluginName}/${readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.name}`]: "error"
[`${pluginName}/${readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.name}`]: "error"
}

@@ -21,5 +21,5 @@ },

rules: {
[`${pluginName}/${readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.name}`]: "warn",
[`${pluginName}/${readable_tailwind_rules_tailwind_no_unnecessary_whitespace_js_1.tailwindNoUnnecessaryWhitespace.name}`]: "warn",
[`${pluginName}/${readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.name}`]: "warn",
[`${pluginName}/${readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.name}`]: "warn"
[`${pluginName}/${readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.name}`]: "warn"
}

@@ -29,8 +29,8 @@ }

rules: {
[readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.name]: readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.rule,
[readable_tailwind_rules_tailwind_no_duplicate_classes_js_1.tailwindNoDuplicateClasses.name]: readable_tailwind_rules_tailwind_no_duplicate_classes_js_1.tailwindNoDuplicateClasses.rule,
[readable_tailwind_rules_tailwind_no_unnecessary_whitespace_js_1.tailwindNoUnnecessaryWhitespace.name]: readable_tailwind_rules_tailwind_no_unnecessary_whitespace_js_1.tailwindNoUnnecessaryWhitespace.rule,
[readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.name]: readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.rule,
[readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.name]: readable_tailwind_rules_tailwind_multiline_js_1.tailwindMultiline.rule,
[readable_tailwind_rules_tailwind_no_duplicate_classes_js_1.tailwindNoDuplicateClasses.name]: readable_tailwind_rules_tailwind_no_duplicate_classes_js_1.tailwindNoDuplicateClasses.rule
[readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.name]: readable_tailwind_rules_tailwind_sort_classes_js_1.tailwindSortClasses.rule
}
};
//# sourceMappingURL=config.js.map

@@ -16,3 +16,3 @@ import type { Rule } from "eslint";

}
export declare function isESObjectKey(node: Node | ESBaseNode & Rule.NodeParentExtension): boolean;
export declare function isESObjectKey(node: ESBaseNode & Rule.NodeParentExtension | Node): boolean;
export declare function isInsideObjectValue(node: ESBaseNode & Partial<Rule.NodeParentExtension>): boolean;

@@ -19,0 +19,0 @@ export declare function isESSimpleStringLiteral(node: ESBaseNode): node is ESSimpleStringLiteral;

@@ -6,5 +6,5 @@ import type { CalleeOption, ClassAttributeOption, ESLintRule, VariableOption } from "../types/rule.js";

group?: "emptyLine" | "never" | "newLine";
indent?: "tab" | number;
lineBreakStyle?: "unix" | "windows";
preferSingleLine?: boolean;
indent?: number | "tab";
lineBreakStyle?: "unix" | "windows";
printWidth?: number;

@@ -11,0 +11,0 @@ }>

@@ -375,3 +375,4 @@ "use strict";

data: {
notReadable: literal.content
notReadable: (0, readable_tailwind_utils_utils_js_1.display)(literal.raw),
readable: (0, readable_tailwind_utils_utils_js_1.display)(fixedClasses)
},

@@ -382,3 +383,3 @@ fix(fixer) {

loc: literal.loc,
message: "Unnecessary line wrapping: \"{{ notReadable }}\"."
message: "Unnecessary line wrapping. Expected\n\n{{ notReadable }}\n\nto be\n\n{{ readable }}"
});

@@ -435,3 +436,4 @@ return;

data: {
notReadable: literal.content
notReadable: (0, readable_tailwind_utils_utils_js_1.display)(literal.raw),
readable: (0, readable_tailwind_utils_utils_js_1.display)(fixedClasses)
},

@@ -444,3 +446,3 @@ fix(fixer) {

loc: literal.loc,
message: "Incorrect line wrapping: \"{{ notReadable }}\"."
message: "Incorrect line wrapping. Expected\n\n{{ notReadable }}\n\nto be\n\n{{ readable }}"
});

@@ -447,0 +449,0 @@ }

@@ -138,3 +138,4 @@ "use strict";

data: {
unnecessaryWhitespace: literal.content
fixedClasses: (0, readable_tailwind_utils_utils_js_1.display)(fixedClasses),
unnecessaryWhitespace: (0, readable_tailwind_utils_utils_js_1.display)(literal.raw)
},

@@ -145,3 +146,3 @@ fix(fixer) {

loc: literal.loc,
message: "Unnecessary whitespace: \"{{ unnecessaryWhitespace }}\"."
message: "Unnecessary whitespace. Expected\n\n{{ unnecessaryWhitespace }}\n\nto be\n\n{{ fixedClasses }}"
});

@@ -148,0 +149,0 @@ }

@@ -91,3 +91,4 @@ "use strict";

data: {
notSorted: literal.content
notSorted: (0, readable_tailwind_utils_utils_js_1.display)(literal.raw),
sorted: (0, readable_tailwind_utils_utils_js_1.display)(fixedClasses)
},

@@ -98,3 +99,3 @@ fix(fixer) {

loc: literal.loc,
message: "Incorrect class order: \"{{ notSorted }}\"."
message: "Incorrect class order. Expected\n\n{{ notSorted }}\n\nto be\n\n{{ sorted }}"
});

@@ -101,0 +102,0 @@ }

@@ -9,2 +9,3 @@ import type { Rule } from "eslint";

export declare function splitClasses(classes: string): string[];
export declare function display(classes: string): string;
export declare function splitWhitespaces(classes: string): string[];

@@ -11,0 +12,0 @@ export declare function findLineStartPosition(ctx: Rule.RuleContext, node: Node): number;

@@ -6,2 +6,3 @@ "use strict";

exports.splitClasses = splitClasses;
exports.display = display;
exports.splitWhitespaces = splitWhitespaces;

@@ -33,2 +34,9 @@ exports.findLineStartPosition = findLineStartPosition;

}
function display(classes) {
return classes
.replaceAll(" ", "Ā·")
.replaceAll("\n", "↵\n")
.replaceAll("\r", "↩\r")
.replaceAll("\t", "→");
}
function splitWhitespaces(classes) {

@@ -35,0 +43,0 @@ return classes.split(/\S+/);

@@ -10,5 +10,5 @@ import { tailwindMultiline } from "../rules/tailwind-multiline.js";

rules: {
[`${pluginName}/${tailwindMultiline.name}`]: "error",
[`${pluginName}/${tailwindNoUnnecessaryWhitespace.name}`]: "error",
[`${pluginName}/${tailwindSortClasses.name}`]: "error",
[`${pluginName}/${tailwindMultiline.name}`]: "error"
[`${pluginName}/${tailwindSortClasses.name}`]: "error"
}

@@ -18,5 +18,5 @@ },

rules: {
[`${pluginName}/${tailwindMultiline.name}`]: "warn",
[`${pluginName}/${tailwindNoUnnecessaryWhitespace.name}`]: "warn",
[`${pluginName}/${tailwindSortClasses.name}`]: "warn",
[`${pluginName}/${tailwindMultiline.name}`]: "warn"
[`${pluginName}/${tailwindSortClasses.name}`]: "warn"
}

@@ -26,8 +26,8 @@ }

rules: {
[tailwindMultiline.name]: tailwindMultiline.rule,
[tailwindNoDuplicateClasses.name]: tailwindNoDuplicateClasses.rule,
[tailwindNoUnnecessaryWhitespace.name]: tailwindNoUnnecessaryWhitespace.rule,
[tailwindSortClasses.name]: tailwindSortClasses.rule,
[tailwindMultiline.name]: tailwindMultiline.rule,
[tailwindNoDuplicateClasses.name]: tailwindNoDuplicateClasses.rule
[tailwindSortClasses.name]: tailwindSortClasses.rule
}
};
//# sourceMappingURL=config.js.map

@@ -16,3 +16,3 @@ import type { Rule } from "eslint";

}
export declare function isESObjectKey(node: Node | ESBaseNode & Rule.NodeParentExtension): boolean;
export declare function isESObjectKey(node: ESBaseNode & Rule.NodeParentExtension | Node): boolean;
export declare function isInsideObjectValue(node: ESBaseNode & Partial<Rule.NodeParentExtension>): boolean;

@@ -19,0 +19,0 @@ export declare function isESSimpleStringLiteral(node: ESBaseNode): node is ESSimpleStringLiteral;

@@ -6,5 +6,5 @@ import type { CalleeOption, ClassAttributeOption, ESLintRule, VariableOption } from "../types/rule.js";

group?: "emptyLine" | "never" | "newLine";
indent?: "tab" | number;
lineBreakStyle?: "unix" | "windows";
preferSingleLine?: boolean;
indent?: number | "tab";
lineBreakStyle?: "unix" | "windows";
printWidth?: number;

@@ -11,0 +11,0 @@ }>

@@ -9,3 +9,3 @@ import { DEFAULT_ATTRIBUTE_NAMES, DEFAULT_CALLEE_NAMES, DEFAULT_VARIABLE_NAMES } from "../options/default-options.js";

import { escapeNestedQuotes } from "../utils/quotes.js";
import { findLineStartPosition, findLiteralStartPosition, splitClasses } from "../utils/utils.js";
import { display, findLineStartPosition, findLiteralStartPosition, splitClasses } from "../utils/utils.js";
export const tailwindMultiline = {

@@ -373,3 +373,4 @@ name: "multiline",

data: {
notReadable: literal.content
notReadable: display(literal.raw),
readable: display(fixedClasses)
},

@@ -380,3 +381,3 @@ fix(fixer) {

loc: literal.loc,
message: "Unnecessary line wrapping: \"{{ notReadable }}\"."
message: "Unnecessary line wrapping. Expected\n\n{{ notReadable }}\n\nto be\n\n{{ readable }}"
});

@@ -433,3 +434,4 @@ return;

data: {
notReadable: literal.content
notReadable: display(literal.raw),
readable: display(fixedClasses)
},

@@ -442,3 +444,3 @@ fix(fixer) {

loc: literal.loc,
message: "Incorrect line wrapping: \"{{ notReadable }}\"."
message: "Incorrect line wrapping. Expected\n\n{{ notReadable }}\n\nto be\n\n{{ readable }}"
});

@@ -445,0 +447,0 @@ }

@@ -9,3 +9,3 @@ import { DEFAULT_ATTRIBUTE_NAMES, DEFAULT_CALLEE_NAMES, DEFAULT_VARIABLE_NAMES } from "../options/default-options.js";

import { escapeNestedQuotes } from "../utils/quotes.js";
import { splitClasses, splitWhitespaces } from "../utils/utils.js";
import { display, splitClasses, splitWhitespaces } from "../utils/utils.js";
export const tailwindNoUnnecessaryWhitespace = {

@@ -136,3 +136,4 @@ name: "no-unnecessary-whitespace",

data: {
unnecessaryWhitespace: literal.content
fixedClasses: display(fixedClasses),
unnecessaryWhitespace: display(literal.raw)
},

@@ -143,3 +144,3 @@ fix(fixer) {

loc: literal.loc,
message: "Unnecessary whitespace: \"{{ unnecessaryWhitespace }}\"."
message: "Unnecessary whitespace. Expected\n\n{{ unnecessaryWhitespace }}\n\nto be\n\n{{ fixedClasses }}"
});

@@ -146,0 +147,0 @@ }

@@ -14,3 +14,3 @@ import { resolve } from "node:path";

import { escapeNestedQuotes } from "../utils/quotes.js";
import { splitClasses, splitWhitespaces } from "../utils/utils.js";
import { display, splitClasses, splitWhitespaces } from "../utils/utils.js";
const TAILWIND_CONFIG_CACHE = new Map();

@@ -62,3 +62,4 @@ const TAILWIND_CONTEXT_CACHE = new Map();

data: {
notSorted: literal.content
notSorted: display(literal.raw),
sorted: display(fixedClasses)
},

@@ -69,3 +70,3 @@ fix(fixer) {

loc: literal.loc,
message: "Incorrect class order: \"{{ notSorted }}\"."
message: "Incorrect class order. Expected\n\n{{ notSorted }}\n\nto be\n\n{{ sorted }}"
});

@@ -72,0 +73,0 @@ }

@@ -9,2 +9,3 @@ import type { Rule } from "eslint";

export declare function splitClasses(classes: string): string[];
export declare function display(classes: string): string;
export declare function splitWhitespaces(classes: string): string[];

@@ -11,0 +12,0 @@ export declare function findLineStartPosition(ctx: Rule.RuleContext, node: Node): number;

@@ -22,2 +22,9 @@ export function getWhitespace(classes) {

}
export function display(classes) {
return classes
.replaceAll(" ", "Ā·")
.replaceAll("\n", "↵\n")
.replaceAll("\r", "↩\r")
.replaceAll("\t", "→");
}
export function splitWhitespaces(classes) {

@@ -24,0 +31,0 @@ return classes.split(/\S+/);

{
"version": "1.8.0",
"version": "1.8.1",
"type": "module",

@@ -70,24 +70,23 @@ "name": "eslint-plugin-readable-tailwind",

"devDependencies": {
"@html-eslint/parser": "^0.26.0",
"@schoero/configs": "^1.1.1",
"@types/eslint": "^9.6.1",
"@html-eslint/parser": "^0.27.0",
"@schoero/configs": "^1.1.6",
"@types/estree-jsx": "^1.0.5",
"@types/node": "^22.5.2",
"@typescript-eslint/parser": "^8.3.0",
"changelogen": "^0.5.5",
"cspell": "^8.14.2",
"@types/node": "^22.7.4",
"@typescript-eslint/parser": "^8.8.0",
"changelogen": "^0.5.7",
"cspell": "^8.14.4",
"es-html-parser": "^0.0.9",
"eslint": "^9.9.1",
"eslint": "^9.11.1",
"eslint-plugin-eslint-plugin": "^6.2.0",
"glob": "^11.0.0",
"json-schema": "^0.4.0",
"markdownlint": "^0.34.0",
"markdownlint": "^0.35.0",
"proper-tags": "^2.0.2",
"svelte": "^4.2.19",
"svelte-eslint-parser": "^0.41.0",
"tailwindcss": "^3.4.10",
"svelte-eslint-parser": "^0.41.1",
"tailwindcss": "^3.4.13",
"tsc-alias": "^1.8.10",
"typescript": "^5.5.4",
"vite-node": "^2.0.5",
"vitest": "^2.0.5",
"typescript": "^5.6.2",
"vite-node": "^2.1.1",
"vitest": "^2.1.1",
"vue-eslint-parser": "^9.4.3"

@@ -94,0 +93,0 @@ },

@@ -26,3 +26,3 @@ <div align="center">

<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/npm/v/eslint-plugin-readable-tailwind?style=flat-square&labelColor=EBEEF2&color=000000">
<img alt="eslint-plugin-readable-tailwind logo" src="https://img.shields.io/npm/v/eslint-plugin-readable-tailwind?style=flat-square&labelColor=EBEEF2B&color=000000">
<img alt="eslint-plugin-readable-tailwind logo" src="https://img.shields.io/npm/v/eslint-plugin-readable-tailwind?style=flat-square&labelColor=EBEEF2&color=000000">
</picture>

@@ -86,2 +86,7 @@ </a>

<br/>
<br/>
[Buy me a coffee](https://buymeacoffee.com/schoero) | [GitHub Sponsors](https://github.com/sponsors/schoero)
This project is financed by the community.

@@ -88,0 +93,0 @@ If you or your company benefit from this project, please consider becoming a sponsor or making a one-time donation.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet