catlint 1.2.1 → 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 +1 -1
- package/dist/cli/index.d.cts +1 -0
- package/dist/index.d.cts +80 -0
- package/package.json +1 -1
- package/src/cli/index.ts +1 -1
- package/tsup.config.ts +1 -1
- package/dist/chunk-XMKWAQ3V.js +0 -4934
- package/dist/cli/index.js +0 -22995
- package/dist/index.js +0 -50
package/dist/cli/index.cjs
CHANGED
|
@@ -27893,4 +27893,4 @@ var program = new import_commander.Command();
|
|
|
27893
27893
|
program.name("catlint").description("A linter for detecting code bad practices").version("0.0.1");
|
|
27894
27894
|
program.command("init").description("Inits CatLint in your current project folder").action(async () => await init());
|
|
27895
27895
|
program.command("lint").description("Lints the current project").action(async () => await lint());
|
|
27896
|
-
program.parse();
|
|
27896
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
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 };
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED