catlint 1.2.0 → 1.3.0
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/dist/cli/index.cjs +27896 -0
- package/dist/cli/index.d.cts +1 -0
- package/package.json +10 -1
- package/src/cli/index.ts +1 -1
- package/tsup.config.ts +2 -2
- package/dist/index.d.ts +0 -80
- package/dist/index.js +0 -4930
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "catlint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"catlint": "./dist/cli/index.js"
|
|
10
|
+
},
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"import": "./dist/index.js",
|
|
@@ -26,5 +29,11 @@
|
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
31
|
"tsup": "^8.5.1"
|
|
32
|
+
},
|
|
33
|
+
"lint-staged": {
|
|
34
|
+
"*.{ts,js}": [
|
|
35
|
+
"eslint --fix",
|
|
36
|
+
"prettier --write"
|
|
37
|
+
]
|
|
29
38
|
}
|
|
30
39
|
}
|
package/src/cli/index.ts
CHANGED
package/tsup.config.ts
CHANGED
package/dist/index.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
declare enum IRKind {
|
|
2
|
-
Codeline = 0,
|
|
3
|
-
Literal = 1,
|
|
4
|
-
Function = 2,
|
|
5
|
-
Class = 3,
|
|
6
|
-
Variable = 4
|
|
7
|
-
}
|
|
8
|
-
interface IRNode {
|
|
9
|
-
line: number;
|
|
10
|
-
kind: IRKind;
|
|
11
|
-
name: string;
|
|
12
|
-
value: IRNode[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface IRFile {
|
|
16
|
-
name: string;
|
|
17
|
-
extensions: string[];
|
|
18
|
-
program: IRNode[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type IRParser = (filename: string, content: string) => IRFile;
|
|
22
|
-
|
|
23
|
-
declare enum Level {
|
|
24
|
-
Error = "ERROR",
|
|
25
|
-
Warning = "WARNING",
|
|
26
|
-
Info = "INFO"
|
|
27
|
-
}
|
|
28
|
-
interface Message {
|
|
29
|
-
message: string;
|
|
30
|
-
line: number;
|
|
31
|
-
level: Level;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type RuleFn = (file: IRFile) => Message[];
|
|
35
|
-
interface Rule {
|
|
36
|
-
name: string;
|
|
37
|
-
fn?: RuleFn;
|
|
38
|
-
subrules?: Rule[];
|
|
39
|
-
}
|
|
40
|
-
interface AdaptedRule extends Rule {
|
|
41
|
-
fn: RuleFn;
|
|
42
|
-
subrules: AdaptedRule[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface Config {
|
|
46
|
-
lint: {
|
|
47
|
-
includes: string[];
|
|
48
|
-
excludes: string[];
|
|
49
|
-
};
|
|
50
|
-
parsers: {
|
|
51
|
-
pattern: string;
|
|
52
|
-
parser: IRParser;
|
|
53
|
-
}[];
|
|
54
|
-
rules: Rule[];
|
|
55
|
-
}
|
|
56
|
-
interface NormalizedConfig extends Config {
|
|
57
|
-
rules: AdaptedRule[];
|
|
58
|
-
}
|
|
59
|
-
declare const defaultConfig: NormalizedConfig;
|
|
60
|
-
|
|
61
|
-
declare function defineConfig(config: Config): NormalizedConfig;
|
|
62
|
-
|
|
63
|
-
declare const loadConfigFromFile: (filePath: string) => Promise<NormalizedConfig | null>;
|
|
64
|
-
declare const loadConfig: (projectPath: string) => Promise<NormalizedConfig>;
|
|
65
|
-
|
|
66
|
-
type LintResult = {
|
|
67
|
-
name: string;
|
|
68
|
-
messages: Message[];
|
|
69
|
-
subrules: LintResult[];
|
|
70
|
-
isCorrect: boolean;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
declare function travelFile(file: IRFile): (rule: AdaptedRule) => LintResult;
|
|
74
|
-
declare function lintFile(file: IRFile, rules: AdaptedRule[]): LintResult[];
|
|
75
|
-
|
|
76
|
-
declare const lintProject: (config: NormalizedConfig, projectDir: string) => Promise<LintResult[][]>;
|
|
77
|
-
|
|
78
|
-
declare const createRule: (name: string, fn: (subrule: (subrule: Rule) => void) => RuleFn) => Rule;
|
|
79
|
-
|
|
80
|
-
export { type AdaptedRule, type Config, type IRFile, IRKind, type IRNode, type IRParser, Level, type LintResult, type Message, type NormalizedConfig, type Rule, type RuleFn, createRule, defaultConfig, defineConfig, lintFile, lintProject, loadConfig, loadConfigFromFile, travelFile };
|