@alint-js/languages 0.1.5

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alint contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # `@alint-js/languages`
2
+
3
+ > [!IMPORTANT]
4
+ > This package is a WIP. APIs may be subject to major changes.
5
+
6
+ First-party language support for alint, beyond the JavaScript and TypeScript that core has built in.
7
+ Adds Go, Python and Rust.
8
+
9
+ ## What it does
10
+
11
+ A plugin that declares languages and nothing else — no rules, no processors. Registering it means
12
+ every rule in the run, from every plugin, starts receiving function targets for `.go`, `.py` and
13
+ `.rs` files. A rule needs no parser of its own and no dependency on this package.
14
+
15
+ Each function target carries a `FunctionInfo` under `metadata.function`: which statements the body
16
+ holds, whether it is a single expression, where its comments are, which names it declares, which
17
+ identifiers may be renamed, and whether it is reachable from outside its file. The file target
18
+ carries every call site under `metadata.calls`, including calls made outside any function.
19
+
20
+ `FunctionInfo` is core's contract, and core's own JavaScript producer fills in the same fields, so
21
+ a rule reads one shape whatever parsed the file.
22
+
23
+ ## How to use
24
+
25
+ ```bash
26
+ npm install -D @alint-js/languages
27
+ ```
28
+
29
+ ```ts
30
+ import languages from '@alint-js/languages'
31
+
32
+ import { defineConfig } from '@alint-js/cli'
33
+
34
+ export default defineConfig([
35
+ {
36
+ files: ['**/*.{go,py,rs}'],
37
+ plugins: { languages },
38
+ },
39
+ ])
40
+ ```
41
+
42
+ The alias is arbitrary: languages register under their own names, not the plugin's.
43
+
44
+ A rule opts in to what it can read by declaring `languages`:
45
+
46
+ ```ts
47
+ defineRule({
48
+ create: () => ({ onTargetFunction: (target) => { /* ... */ } }),
49
+ languages: 'any', // or ['go', 'rust'] to scope, which fails the run if nothing provides them
50
+ })
51
+ ```
52
+
53
+ From a static (TOML) config, point a directory specifier at your own installed copy:
54
+
55
+ ```toml
56
+ plugin_languages = "./node_modules/@alint-js/languages"
57
+ ```
58
+
59
+ The directory lock records physical identity, so upgrading the package re-locks it. Re-run
60
+ `alint plugin install` when it says the target changed.
61
+
62
+ ## When to use
63
+
64
+ - Your project has Go, Python or Rust files and you want rules to see functions in them rather than
65
+ raw text.
66
+ - You are writing a rule that works from `FunctionInfo` and want it to cover more than JavaScript
67
+ without importing a parser.
68
+
69
+ ## When not to use
70
+
71
+ - You only lint JavaScript and TypeScript. Core's built-in oxc producer already covers those, and
72
+ this package would add roughly 6 MB of grammars for nothing.
73
+ - You want to distribute it through the plugin store. The store installs one tarball and no
74
+ dependencies, and the grammars are resolved from `node_modules` at runtime. Install it with your
75
+ package manager instead — the same way agent adapters are installed.
76
+
77
+ ## Notes
78
+
79
+ - Parsing is done with [tree-sitter](https://tree-sitter.github.io/tree-sitter/), which is an
80
+ implementation detail: nothing in the public surface names it, and a language could move to a
81
+ different parser without the config changing.
82
+ - Pinned to `web-tree-sitter` 0.24.x. 0.25 rewrote the WASM loader and rejects the prebuilt
83
+ `tree-sitter-wasms` grammars, which still carry the legacy `dylink` section.
84
+ - Extensions core already owns (`.js`, `.jsx`, `.ts`, `.tsx`, and the rest) are deliberately not
85
+ claimed here. Two plugins claiming one extension is an error, not a fallback.