@teacss/linter 0.0.0-stage → 0.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +457 -2
- package/dist/estree.d.ts +168 -0
- package/dist/estree.js +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/preset.d.ts +18 -0
- package/dist/preset.js +63 -0
- package/dist/project.d.ts +28 -0
- package/dist/project.js +128 -0
- package/dist/rules.d.ts +40 -0
- package/dist/rules.js +524 -0
- package/dist/sites.d.ts +42 -0
- package/dist/sites.js +383 -0
- package/dist/tokens.d.ts +15 -0
- package/dist/tokens.js +99 -0
- package/package.json +54 -4
package/dist/estree.d.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
interface Base {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
parent: Node | null;
|
|
5
|
+
}
|
|
6
|
+
export interface Literal extends Base {
|
|
7
|
+
type: "Literal";
|
|
8
|
+
value: unknown;
|
|
9
|
+
raw: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TemplateElement extends Base {
|
|
12
|
+
type: "TemplateElement";
|
|
13
|
+
value: {
|
|
14
|
+
raw: string;
|
|
15
|
+
cooked: string | null;
|
|
16
|
+
};
|
|
17
|
+
tail: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface TemplateLiteral extends Base {
|
|
20
|
+
type: "TemplateLiteral";
|
|
21
|
+
quasis: TemplateElement[];
|
|
22
|
+
expressions: Node[];
|
|
23
|
+
}
|
|
24
|
+
export interface TaggedTemplateExpression extends Base {
|
|
25
|
+
type: "TaggedTemplateExpression";
|
|
26
|
+
tag: Node;
|
|
27
|
+
quasi: TemplateLiteral;
|
|
28
|
+
}
|
|
29
|
+
export interface ConditionalExpression extends Base {
|
|
30
|
+
type: "ConditionalExpression";
|
|
31
|
+
consequent: Node;
|
|
32
|
+
alternate: Node;
|
|
33
|
+
}
|
|
34
|
+
export interface LogicalExpression extends Base {
|
|
35
|
+
type: "LogicalExpression";
|
|
36
|
+
operator: "&&" | "||" | "??";
|
|
37
|
+
left: Node;
|
|
38
|
+
right: Node;
|
|
39
|
+
}
|
|
40
|
+
export interface ArrayExpression extends Base {
|
|
41
|
+
type: "ArrayExpression";
|
|
42
|
+
elements: Array<Node | null>;
|
|
43
|
+
}
|
|
44
|
+
export interface ObjectExpression extends Base {
|
|
45
|
+
type: "ObjectExpression";
|
|
46
|
+
properties: Array<Property | SpreadElement>;
|
|
47
|
+
}
|
|
48
|
+
export interface Property extends Base {
|
|
49
|
+
type: "Property";
|
|
50
|
+
key: Node;
|
|
51
|
+
value: Node;
|
|
52
|
+
computed: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface SpreadElement extends Base {
|
|
55
|
+
type: "SpreadElement";
|
|
56
|
+
argument: Node;
|
|
57
|
+
}
|
|
58
|
+
export interface Identifier extends Base {
|
|
59
|
+
type: "Identifier";
|
|
60
|
+
name: string;
|
|
61
|
+
}
|
|
62
|
+
export interface MemberExpression extends Base {
|
|
63
|
+
type: "MemberExpression";
|
|
64
|
+
object: Node;
|
|
65
|
+
computed: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface CallExpression extends Base {
|
|
68
|
+
type: "CallExpression";
|
|
69
|
+
callee: Node;
|
|
70
|
+
arguments: Node[];
|
|
71
|
+
}
|
|
72
|
+
export interface Wrapper extends Base {
|
|
73
|
+
type: "TSAsExpression" | "TSSatisfiesExpression" | "TSNonNullExpression" | "TSTypeAssertion" | "ParenthesizedExpression" | "ChainExpression";
|
|
74
|
+
expression: Node;
|
|
75
|
+
}
|
|
76
|
+
export interface AssignmentPattern extends Base {
|
|
77
|
+
type: "AssignmentPattern";
|
|
78
|
+
left: Node;
|
|
79
|
+
right: Node;
|
|
80
|
+
}
|
|
81
|
+
export interface UnaryExpression extends Base {
|
|
82
|
+
type: "UnaryExpression";
|
|
83
|
+
operator: string;
|
|
84
|
+
}
|
|
85
|
+
export interface ThisExpression extends Base {
|
|
86
|
+
type: "ThisExpression";
|
|
87
|
+
}
|
|
88
|
+
export interface VariableDeclaration extends Base {
|
|
89
|
+
type: "VariableDeclaration";
|
|
90
|
+
kind: string;
|
|
91
|
+
}
|
|
92
|
+
export interface VariableDeclarator extends Base {
|
|
93
|
+
type: "VariableDeclarator";
|
|
94
|
+
id: Node;
|
|
95
|
+
init: Node | null;
|
|
96
|
+
}
|
|
97
|
+
export interface JsxIdentifier extends Base {
|
|
98
|
+
type: "JSXIdentifier";
|
|
99
|
+
name: string;
|
|
100
|
+
}
|
|
101
|
+
export interface JsxExpressionContainer extends Base {
|
|
102
|
+
type: "JSXExpressionContainer";
|
|
103
|
+
expression: Node;
|
|
104
|
+
}
|
|
105
|
+
export interface JsxAttribute extends Base {
|
|
106
|
+
type: "JSXAttribute";
|
|
107
|
+
name: Node;
|
|
108
|
+
value: Node | null;
|
|
109
|
+
}
|
|
110
|
+
export interface JsxMemberExpression extends Base {
|
|
111
|
+
type: "JSXMemberExpression";
|
|
112
|
+
object: Node;
|
|
113
|
+
property: Node;
|
|
114
|
+
}
|
|
115
|
+
export interface JsxOpeningElement extends Base {
|
|
116
|
+
type: "JSXOpeningElement";
|
|
117
|
+
name: Node;
|
|
118
|
+
}
|
|
119
|
+
export interface Other extends Base {
|
|
120
|
+
type: "Other";
|
|
121
|
+
}
|
|
122
|
+
export type Node = Literal | TemplateElement | TemplateLiteral | TaggedTemplateExpression | ConditionalExpression | LogicalExpression | ArrayExpression | ObjectExpression | Property | SpreadElement | Identifier | MemberExpression | CallExpression | Wrapper | AssignmentPattern | UnaryExpression | ThisExpression | VariableDeclaration | VariableDeclarator | JsxIdentifier | JsxExpressionContainer | JsxAttribute | JsxMemberExpression | JsxOpeningElement | Other;
|
|
123
|
+
export interface Definition {
|
|
124
|
+
type: string;
|
|
125
|
+
node: Node;
|
|
126
|
+
parent: Node | null;
|
|
127
|
+
name: Node;
|
|
128
|
+
}
|
|
129
|
+
export interface Scope {
|
|
130
|
+
set: Map<string, {
|
|
131
|
+
defs: Definition[];
|
|
132
|
+
}>;
|
|
133
|
+
upper: Scope | null;
|
|
134
|
+
}
|
|
135
|
+
export interface Position {
|
|
136
|
+
line: number;
|
|
137
|
+
column: number;
|
|
138
|
+
}
|
|
139
|
+
export interface SourceCode {
|
|
140
|
+
getText(): string;
|
|
141
|
+
getScope(node: Node): Scope;
|
|
142
|
+
getLocFromIndex(index: number): Position;
|
|
143
|
+
}
|
|
144
|
+
export interface Context {
|
|
145
|
+
id: string;
|
|
146
|
+
filename: string;
|
|
147
|
+
cwd: string;
|
|
148
|
+
options: readonly unknown[];
|
|
149
|
+
settings: Readonly<Record<string, unknown>>;
|
|
150
|
+
sourceCode: SourceCode;
|
|
151
|
+
report(diagnostic: {
|
|
152
|
+
message: string;
|
|
153
|
+
loc: {
|
|
154
|
+
start: Position;
|
|
155
|
+
end: Position;
|
|
156
|
+
};
|
|
157
|
+
}): void;
|
|
158
|
+
}
|
|
159
|
+
export type Visitor = Record<string, (node: Node) => void>;
|
|
160
|
+
export interface Rule {
|
|
161
|
+
meta: {
|
|
162
|
+
type: "problem";
|
|
163
|
+
schema: object[];
|
|
164
|
+
};
|
|
165
|
+
create(context: Context): Visitor;
|
|
166
|
+
}
|
|
167
|
+
export {};
|
|
168
|
+
//# sourceMappingURL=estree.d.ts.map
|
package/dist/estree.js
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/preset.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RestyleOptions } from "./rules.js";
|
|
2
|
+
export declare const OFFICIAL: {
|
|
3
|
+
colors: {
|
|
4
|
+
steps: {
|
|
5
|
+
primary: string[];
|
|
6
|
+
success: string[];
|
|
7
|
+
warning: string[];
|
|
8
|
+
failure: string[];
|
|
9
|
+
general: string[];
|
|
10
|
+
focused: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
arbitrary: {
|
|
14
|
+
allow: string[];
|
|
15
|
+
};
|
|
16
|
+
restyle: RestyleOptions;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=preset.d.ts.map
|
package/dist/preset.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const STATE_STEPS = ["200", "900", "950"];
|
|
2
|
+
const colors = {
|
|
3
|
+
steps: {
|
|
4
|
+
primary: ["000", "200", "300", "800", "850", "900", "950"],
|
|
5
|
+
success: STATE_STEPS,
|
|
6
|
+
warning: STATE_STEPS,
|
|
7
|
+
failure: STATE_STEPS,
|
|
8
|
+
general: STATE_STEPS,
|
|
9
|
+
focused: ["900", "950"],
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const arbitrary = {
|
|
13
|
+
allow: [
|
|
14
|
+
"/^@\\[\\.[\\w-]+_?&\\]$/",
|
|
15
|
+
"@aria-[*]",
|
|
16
|
+
"@in-aria-[*]",
|
|
17
|
+
"@group-aria-[*]",
|
|
18
|
+
"@[&:not([aria-current=page])]",
|
|
19
|
+
"@[:focus-visible>&]",
|
|
20
|
+
"@[&:has(>:is(input,textarea,select):focus-visible)]",
|
|
21
|
+
"@[&:has(>:first-child>:checked)]",
|
|
22
|
+
"@[&_a:focus-visible]",
|
|
23
|
+
"@[&_>_.avatar]",
|
|
24
|
+
"@[&:where(:dir(rtl))]",
|
|
25
|
+
"transition-property:[scale]",
|
|
26
|
+
"flex:[1_1_12ch]",
|
|
27
|
+
"/^\\$frame-offset:[^@]+$/",
|
|
28
|
+
"/^\\$site-content-width:[^@]+$/",
|
|
29
|
+
"/^\\$site-gutter:[^@]+$/",
|
|
30
|
+
"font-size:24px",
|
|
31
|
+
"/^grid-columns:\\[repeat\\([^@]+\\)\\]$/",
|
|
32
|
+
"grid-column:[1/-1]",
|
|
33
|
+
"max-w:[65ch]",
|
|
34
|
+
"rd:9999px",
|
|
35
|
+
"/^rd:\\[calc\\(var\\(--radius-\\w+\\)_-_[^@]+\\)\\]$/",
|
|
36
|
+
"p-b:[env(safe-area-inset-bottom)]",
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
const any = (...names) => ({ names, conditions: "any" });
|
|
40
|
+
const restyle = {
|
|
41
|
+
contracts: [
|
|
42
|
+
{ pattern: "btn", exclusive: [any("btn--primary", "btn--outline", "btn--neutral", "btn--minimal", "btn--general", "btn--success", "btn--warning", "btn--failure")] },
|
|
43
|
+
{ pattern: "surface-*", exclusive: [any("surface-panel", "surface-sunken", "surface-tooltip", "surface-menu", "surface-dialog", "surface-fullscreen")] },
|
|
44
|
+
{
|
|
45
|
+
pattern: "outlined",
|
|
46
|
+
exclusive: ["surface-panel", "surface-sunken", "surface-tooltip", "surface-menu", "surface-dialog", "surface-fullscreen", "toolbar", "tab-list", "sheet", "tooltip-content", "modal", "mockup-code"].map((surface) => any("outlined", surface)),
|
|
47
|
+
},
|
|
48
|
+
{ pattern: "ring", exclusive: [["ring", "ring-flat", "ring-inset", "ring-solid", "ring-shadow", "ring-shadow-flat"]] },
|
|
49
|
+
{ pattern: "dropdown-panel", exclusive: [any("dropdown-panel--popover", "dropdown-panel--floating")] },
|
|
50
|
+
{ pattern: "dropdown-content", deny: [{ shortcut: "dropdown-panel--*" }] },
|
|
51
|
+
{ pattern: "collapse-motion", exclusive: [any("collapse-motion", "collapse"), any("collapse-motion", "collapse-folds")] },
|
|
52
|
+
{ pattern: "calendar-grid", exclusive: [any("calendar-grid", "table")] },
|
|
53
|
+
{ pattern: "toggle", deny: [{ declares: "padding*", value: "/^(?!\\[?0[a-z%]*\\]?$)/", message: "{{class}} adds padding to the toggle track. Keep the track padding at zero." }] },
|
|
54
|
+
{ pattern: "icon-crossfade", deny: [{ property: "blur" }, { declares: "scale" }, { declares: "filter", value: "*blur(*" }, { declares: "transform", value: "*scale*" }] },
|
|
55
|
+
],
|
|
56
|
+
requireBase: true,
|
|
57
|
+
standalone: [
|
|
58
|
+
{ name: "toast--shown", beside: "toast-motion" },
|
|
59
|
+
{ name: "modal--backdrop-motion", beside: "sheet" },
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
export const OFFICIAL = { colors, arbitrary, restyle };
|
|
63
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Engine, type TokenClass } from "@teacss/engine";
|
|
2
|
+
export interface Settings {
|
|
3
|
+
root: string | null;
|
|
4
|
+
entry: string | null;
|
|
5
|
+
functions: ReadonlySet<string>;
|
|
6
|
+
note: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function readSettings(settings: Readonly<Record<string, unknown>>): Settings;
|
|
9
|
+
export declare const expandGroup: (group: string) => string[];
|
|
10
|
+
export declare class Project {
|
|
11
|
+
#private;
|
|
12
|
+
readonly root: string;
|
|
13
|
+
constructor(root: string, engine: Engine);
|
|
14
|
+
classify(tokens: readonly string[]): Array<TokenClass | null>;
|
|
15
|
+
example(property: string): string | null;
|
|
16
|
+
boundTo(family: string): string[];
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface Slot {
|
|
20
|
+
checkedAt: number;
|
|
21
|
+
stamp: string;
|
|
22
|
+
watched: string[];
|
|
23
|
+
project: Project | null;
|
|
24
|
+
failure: string | null;
|
|
25
|
+
reported: Set<string>;
|
|
26
|
+
}
|
|
27
|
+
export declare function findSlot(filename: string, cwd: string, settings: Settings): Slot | null;
|
|
28
|
+
//# sourceMappingURL=project.d.ts.map
|
package/dist/project.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
3
|
+
import { Engine, expandClassGroups, parseEntry, splitClassTokens } from "@teacss/engine";
|
|
4
|
+
const CANDIDATES = ["package.json", "index.css", "src/index.css"];
|
|
5
|
+
const RECHECK_MS = 1000;
|
|
6
|
+
const ALIAS_TARGET = /^var\(--color-(.+)-\d+\)$/;
|
|
7
|
+
export function readSettings(settings) {
|
|
8
|
+
const own = (typeof settings.teacss === "object" && settings.teacss !== null ? settings.teacss : {});
|
|
9
|
+
const functions = Array.isArray(own.functions) ? own.functions.filter((name) => typeof name === "string") : [];
|
|
10
|
+
return {
|
|
11
|
+
root: typeof own.root === "string" ? own.root : null,
|
|
12
|
+
entry: typeof own.entry === "string" ? own.entry : null,
|
|
13
|
+
functions: new Set(["cn", "recipe", ...functions]),
|
|
14
|
+
note: typeof own.note === "string" ? own.note.replace(/\r\n|[\r\n]/g, " ").trim() : "",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export const expandGroup = (group) => splitClassTokens(expandClassGroups(group));
|
|
18
|
+
export class Project {
|
|
19
|
+
root;
|
|
20
|
+
#engine;
|
|
21
|
+
#classes = new Map();
|
|
22
|
+
#examples = new Map();
|
|
23
|
+
#bound = null;
|
|
24
|
+
constructor(root, engine) {
|
|
25
|
+
this.root = root;
|
|
26
|
+
this.#engine = engine;
|
|
27
|
+
}
|
|
28
|
+
classify(tokens) {
|
|
29
|
+
const missing = [...new Set(tokens.filter((token) => !this.#classes.has(token)))];
|
|
30
|
+
if (missing.length > 0)
|
|
31
|
+
for (const [index, result] of this.#engine.classify(missing).entries())
|
|
32
|
+
this.#classes.set(missing[index], result);
|
|
33
|
+
return tokens.map((token) => this.#classes.get(token) ?? null);
|
|
34
|
+
}
|
|
35
|
+
example(property) {
|
|
36
|
+
const known = this.#examples.get(property);
|
|
37
|
+
if (known !== undefined)
|
|
38
|
+
return known;
|
|
39
|
+
const candidates = this.classify(this.#engine.suggest(`${property}:`, { strict: true, limit: 64 }).map(({ text }) => text)).filter((candidate) => candidate?.property === property);
|
|
40
|
+
const pick = candidates.find((candidate) => candidate?.value?.kind === "step") ?? candidates.find((candidate) => candidate?.value?.kind === "number" && candidate.value.raw !== "0");
|
|
41
|
+
const example = pick?.token ?? null;
|
|
42
|
+
this.#examples.set(property, example);
|
|
43
|
+
return example;
|
|
44
|
+
}
|
|
45
|
+
boundTo(family) {
|
|
46
|
+
this.#bound ??= this.#bindings();
|
|
47
|
+
return this.#bound.get(family) ?? [];
|
|
48
|
+
}
|
|
49
|
+
dispose() {
|
|
50
|
+
this.#engine.dispose();
|
|
51
|
+
}
|
|
52
|
+
#bindings() {
|
|
53
|
+
const bound = new Map();
|
|
54
|
+
const bind = (family, name) => {
|
|
55
|
+
const names = bound.get(family) ?? [];
|
|
56
|
+
if (!names.includes(name))
|
|
57
|
+
bound.set(family, [...names, name]);
|
|
58
|
+
};
|
|
59
|
+
for (const [name, steps] of Object.entries(this.#engine.configView().theme.colors ?? {})) {
|
|
60
|
+
const first = typeof steps === "object" && steps !== null ? Object.values(steps)[0] : null;
|
|
61
|
+
const family = typeof first === "string" ? ALIAS_TARGET.exec(first)?.[1] : undefined;
|
|
62
|
+
if (family !== undefined)
|
|
63
|
+
bind(family, name);
|
|
64
|
+
}
|
|
65
|
+
for (const file of this.#engine.configFiles()) {
|
|
66
|
+
for (const [role, families] of Object.entries(parseEntry(readFileSync(file, "utf8"), file).rolePalettes ?? {}))
|
|
67
|
+
for (const family of families)
|
|
68
|
+
bind(family, role);
|
|
69
|
+
}
|
|
70
|
+
return bound;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const slots = new Map();
|
|
74
|
+
const stampOf = (files) => files.map((file) => statSync(file, { throwIfNoEntry: false })?.mtimeMs ?? 0).join(" ");
|
|
75
|
+
function load(root, entry) {
|
|
76
|
+
const candidates = entry === null ? CANDIDATES.map((name) => join(root, name)) : [entry];
|
|
77
|
+
const slot = { checkedAt: Date.now(), stamp: "", watched: candidates, project: null, failure: null, reported: new Set() };
|
|
78
|
+
if (entry !== null || candidates.some((file) => existsSync(file))) {
|
|
79
|
+
const engine = new Engine();
|
|
80
|
+
try {
|
|
81
|
+
const info = engine.loadProjectFromRoot({ root, entry, envMode: "build", unmatched: "off" });
|
|
82
|
+
if (info.entryPath !== null) {
|
|
83
|
+
slot.project = new Project(root, engine);
|
|
84
|
+
slot.watched = [...new Set([...candidates, ...engine.configFiles(), ...info.declarationFiles])];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const message = (error instanceof Error ? error.message : String(error)).replace(/\s+/g, " ");
|
|
89
|
+
const path = error.details?.path;
|
|
90
|
+
slot.failure = typeof path === "string" && !message.includes(path) ? `${message}: ${path}` : message;
|
|
91
|
+
}
|
|
92
|
+
if (slot.project === null)
|
|
93
|
+
engine.dispose();
|
|
94
|
+
}
|
|
95
|
+
slot.stamp = stampOf(slot.watched);
|
|
96
|
+
return slot;
|
|
97
|
+
}
|
|
98
|
+
function slotAt(root, entry) {
|
|
99
|
+
const key = `${root}\0${entry ?? ""}`;
|
|
100
|
+
const known = slots.get(key);
|
|
101
|
+
if (known !== undefined) {
|
|
102
|
+
const now = Date.now();
|
|
103
|
+
if (now - known.checkedAt < RECHECK_MS)
|
|
104
|
+
return known;
|
|
105
|
+
known.checkedAt = now;
|
|
106
|
+
if (stampOf(known.watched) === known.stamp)
|
|
107
|
+
return known;
|
|
108
|
+
known.project?.dispose();
|
|
109
|
+
}
|
|
110
|
+
const slot = load(root, entry);
|
|
111
|
+
slots.set(key, slot);
|
|
112
|
+
return slot;
|
|
113
|
+
}
|
|
114
|
+
const found = (slot) => slot.project !== null || slot.failure !== null;
|
|
115
|
+
export function findSlot(filename, cwd, settings) {
|
|
116
|
+
if (settings.root !== null || settings.entry !== null) {
|
|
117
|
+
const root = resolve(cwd, settings.root ?? ".");
|
|
118
|
+
return slotAt(root, settings.entry === null ? null : resolve(root, settings.entry));
|
|
119
|
+
}
|
|
120
|
+
for (let dir = dirname(filename);; dir = dirname(dir)) {
|
|
121
|
+
const slot = slotAt(basename(dir) === "src" && found(slotAt(dirname(dir), null)) ? dirname(dir) : dir, null);
|
|
122
|
+
if (found(slot))
|
|
123
|
+
return slot;
|
|
124
|
+
if (dirname(dir) === dir)
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=project.js.map
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ClassCategory } from "@teacss/engine";
|
|
2
|
+
import type { Rule } from "./estree.js";
|
|
3
|
+
export interface SelectorOption {
|
|
4
|
+
category?: ClassCategory;
|
|
5
|
+
property?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
kind?: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
declares?: string;
|
|
10
|
+
shortcut?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Lists {
|
|
14
|
+
allow?: Array<string | SelectorOption>;
|
|
15
|
+
deny?: Array<string | SelectorOption>;
|
|
16
|
+
}
|
|
17
|
+
export type ExclusiveOption = string[] | {
|
|
18
|
+
names: string[];
|
|
19
|
+
conditions?: "same" | "any";
|
|
20
|
+
};
|
|
21
|
+
export type StandaloneOption = string | {
|
|
22
|
+
name: string;
|
|
23
|
+
beside: string;
|
|
24
|
+
};
|
|
25
|
+
export interface ContractOption extends Lists {
|
|
26
|
+
pattern?: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
exclusive?: ExclusiveOption[];
|
|
29
|
+
message?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface RestyleOptions {
|
|
32
|
+
preset?: string;
|
|
33
|
+
without?: string[];
|
|
34
|
+
contracts?: ContractOption[];
|
|
35
|
+
components?: ContractOption[];
|
|
36
|
+
requireBase?: boolean;
|
|
37
|
+
standalone?: StandaloneOption[];
|
|
38
|
+
}
|
|
39
|
+
export declare const rules: Record<string, Rule>;
|
|
40
|
+
//# sourceMappingURL=rules.d.ts.map
|