@marcrock22/veslint 0.0.0-stage → 0.28.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.
Files changed (3) hide show
  1. package/README.md +187 -2
  2. package/bin/veslint.js +40 -0
  3. package/package.json +35 -4
package/README.md CHANGED
@@ -1,3 +1,188 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/veslint-logo-dark.svg">
4
+ <img alt="veslint" src="assets/veslint-logo.svg" height="72">
5
+ </picture>
6
+ </p>
7
+ <p align="center">A TypeScript linter in V that talks to TypeScript 7 (<code>tsc --api</code>) directly</p>
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # veslint
10
+
11
+ veslint lints TypeScript with ESLint's rules, without ESLint. It parses with tree-sitter, gets the types from the native TypeScript 7 compiler, and needs no JavaScript runtime to lint.
12
+
13
+ - **Same results as ESLint.** The rules of ESLint, typescript-eslint, eslint-plugin-unicorn, @stylistic/eslint-plugin, eslint-plugin-perfectionist and @slipher/eslint-plugin are ported to V. They report the same problems, with the same messages, positions, fixes and suggestions.
14
+ - **Your ESLint configuration.** veslint reads `eslint.config.*`, the directive comments (`// eslint-disable-next-line`, `/* eslint rule: … */`, `/* global */`) and rule options. A rule it does not have yet is skipped with a warning.
15
+ - **Fast.** On a Discord bot of 65 TypeScript files, the 105 typescript-eslint rules in one run take 3.2 s with veslint and 11.7 s with ESLint (one core of an old i3). In the editor, a file is linted again about 0.1 s after you type.
16
+ - **An editor extension** for VS Code shows the problems as you type, with quick fixes.
17
+
18
+ ## Install
19
+
20
+ ### VS Code
21
+
22
+ Install **veslint** from the Visual Studio Marketplace (`MARCROCK22.veslint`), then run **veslint: Update veslint** from the command palette. It downloads veslint for your platform and keeps it up to date: once a day at most it asks whether to install a newer release. See [the extension's README](editors/vscode/README.md) for its settings.
23
+
24
+ ### Command line
25
+
26
+ Download `veslint-<version>-linux-x64.tar.gz` or `veslint-<version>-win32-x64.zip` from the [releases](https://github.com/MARCROCK22/veslint/releases) and unpack it anywhere. It contains the `veslint` binary and the TypeScript 7 compiler it uses; keep them together. `veslint --version` prints the version.
27
+
28
+ ### npm
29
+
30
+ ```sh
31
+ npm install --save-dev @marcrock22/veslint # or: bun add -d, pnpm add -D, yarn add -D
32
+ npx veslint .
33
+ ```
34
+
35
+ It installs the `veslint` command with the binary of your platform and the TypeScript 7 compiler it uses. `npm install --global @marcrock22/veslint` puts `veslint` in your `PATH`.
36
+
37
+ veslint runs on **Linux x64** (glibc) and **Windows x64**. On other platforms, [build it from source](#building-from-source).
38
+
39
+ ## Quick start
40
+
41
+ ```sh
42
+ veslint . # lint the TypeScript files of the project with its eslint.config.*
43
+ veslint src --fix # apply the fixes, and print what is left
44
+ veslint . --summary # a table of the rules that report problems
45
+ veslint --rule @typescript-eslint/no-floating-promises src/index.ts
46
+ ```
47
+
48
+ Each problem is one line: `path:line:column`, the rule, its `messageId` and the message, separated by tabs.
49
+
50
+ ```
51
+ src/index.ts:12:3 @typescript-eslint/no-floating-promises floatingVoid Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.
52
+ ```
53
+
54
+ ## Command line
55
+
56
+ ```
57
+ veslint <file.ts | directory>... [--config <file>] [--rule <rule> [--no-config-lookup]] [--project <tsconfig.json>] [--fix] [--fixes | --summary]
58
+ ```
59
+
60
+ | Option | What it does |
61
+ |---|---|
62
+ | `<directory>` | Lints the `.ts`, `.mts`, `.cts` and `.tsx` files under it, as `eslint .` does: `node_modules`, `.git` and what the configuration ignores are left out. |
63
+ | `<file.ts>` | Lints that file. JavaScript files are not linted: veslint only reads TypeScript. |
64
+ | `--config <file>` | The configuration (see below). Without it and without `--rule`, a directory is linted with the closest `eslint.config.*`. |
65
+ | `--rule <rule>` | Lints with one rule, named as in ESLint: `no-var`, `@typescript-eslint/await-thenable`. Its options, and the files it lints, are the ones the closest `eslint.config.*` gives it (on with its default options when the configuration has it off); without a configuration, its default options. Directive comments for other rules are left alone: they are never reported as unused, and `--fix` keeps them. |
66
+ | `--no-config-lookup` | With `--rule`: the rule's default options, without looking for an `eslint.config.*`. |
67
+ | `--project <tsconfig.json>` | The tsconfig to use. Without it, the one the configuration names in `parserOptions.project`, or the closest `tsconfig.json`. |
68
+ | `--fix` | Applies the fixes and rewrites the files, like `eslint --fix`, and prints the problems that remain. |
69
+ | `--fixes` | Prints each problem with its fix, its suggestions and where it ends. |
70
+ | `--summary` | Instead of a line per problem, a table of the rules that reported problems: how many, errors, warnings and files. |
71
+ | `--print-config` | Prints the configuration resolved for the files, a JSON that `--config` reads without running JavaScript. |
72
+ | `--server` | A process for editors that stays alive between lints (the VS Code extension uses it). |
73
+ | `--version` | Prints the version. |
74
+
75
+ With files and neither `--config` nor `--rule`, veslint prints the type TypeScript infers for each declared name, a mode for debugging.
76
+
77
+ The exit code is 0 when there are no problems, 1 when there are (warnings do not count, as in ESLint) or veslint failed, and 2 for a usage error.
78
+
79
+ Environment variables: `VESLINT_TIMEOUT_MS` (how long to wait for each answer of the TypeScript compiler, 30000 by default), `VESLINT_CPUS` (how many CPUs veslint and the compiler use: 2 by default, which is fastest; 0 for all) and `VESLINT_CONFIG_CACHE` (`0` resolves the `eslint.config.*` again on every run, see [Configuration](#configuration)).
80
+
81
+ ## Configuration
82
+
83
+ `--config` takes one of these:
84
+
85
+ - **An ESLint configuration** (`eslint.config.js`, `.mjs`, `.cjs`, `.ts`, `.mts`, `.cts`). It is JavaScript, so veslint asks your project's own ESLint to resolve it, which needs [`bun`](https://bun.sh) and ESLint installed in the project. `files`, `ignores`, rules per folder, `linterOptions` and `languageOptions` work as in ESLint.
86
+
87
+ Resolving it loads ESLint and every plugin, often more than a second, so veslint saves what ESLint resolved in `node_modules/.cache/veslint` (the closest `node_modules`) and uses it again until something it came from changes: the configuration, a file or module it reads (including the plugins), an environment variable it reads, the files to lint, or the `eslint.config.*` that applies to a folder. `VESLINT_CONFIG_CACHE=0` turns that off.
88
+ - **The resolved configuration** that `--print-config` prints. It needs neither `bun` nor ESLint: save it once and lint with it. The paths in it are relative to its own folder, so save it inside the project, at the place you ran `--print-config` from or above it, for example next to the `eslint.config.*` (`veslint --print-config . > veslint.json`). Saved elsewhere, its files are not found.
89
+ - **A JSON with a `rules` section**, like the output of `eslint --print-config`:
90
+
91
+ ```json
92
+ {"rules": {"@typescript-eslint/no-floating-promises": "error", "eqeqeq": ["warn", "smart"]}}
93
+ ```
94
+
95
+ Rule options are validated like ESLint validates them, with the same error messages. Rules veslint does not have are skipped with a warning that names them.
96
+
97
+ Directive comments work as in ESLint 10: `eslint-disable`, `eslint-enable`, `eslint-disable-line` and `eslint-disable-next-line` (with a `-- reason` or not), `/* eslint rule: value */`, `/* global name */` and `/* exported name */`. Unused `eslint-disable` comments are reported, with a fix that removes them.
98
+
99
+ ## Rules
100
+
101
+ veslint has **458 rules**, each with all its options, fixes and suggestions:
102
+
103
+ <details>
104
+ <summary><b>ESLint 10.15.0</b>: 139 rules</summary>
105
+
106
+ `array-callback-return`, `arrow-body-style`, `block-scoped-var`, `consistent-this`, `constructor-super`, `curly`, `default-case-last`, `dot-notation`, `eqeqeq`, `for-direction`, `func-name-matching`, `func-names`, `getter-return`, `grouped-accessor-pairs`, `logical-assignment-operators`, `no-async-promise-executor`, `no-caller`, `no-case-declarations`, `no-class-assign`, `no-compare-neg-zero`, `no-cond-assign`, `no-const-assign`, `no-constant-binary-expression`, `no-constant-condition`, `no-constructor-return`, `no-control-regex`, `no-debugger`, `no-delete-var`, `no-div-regex`, `no-dupe-args`, `no-dupe-else-if`, `no-dupe-keys`, `no-duplicate-case`, `no-else-return`, `no-empty`, `no-empty-character-class`, `no-empty-pattern`, `no-empty-static-block`, `no-eq-null`, `no-ex-assign`, `no-extend-native`, `no-extra-bind`, `no-extra-boolean-cast`, `no-extra-label`, `no-fallthrough`, `no-func-assign`, `no-global-assign`, `no-implicit-coercion`, `no-implicit-globals`, `no-implied-eval`, `no-import-assign`, `no-inner-declarations`, `no-invalid-regexp`, `no-invalid-this`, `no-irregular-whitespace`, `no-iterator`, `no-label-var`, `no-labels`, `no-lone-blocks`, `no-lonely-if`, `no-loop-func`, `no-loss-of-precision`, `no-misleading-character-class`, `no-multi-str`, `no-negated-condition`, `no-new`, `no-new-func`, `no-new-native-nonconstructor`, `no-new-wrappers`, `no-nonoctal-decimal-escape`, `no-obj-calls`, `no-object-constructor`, `no-octal`, `no-octal-escape`, `no-promise-executor-return`, `no-proto`, `no-prototype-builtins`, `no-regex-spaces`, `no-restricted-exports`, `no-restricted-globals`, `no-restricted-imports`, `no-restricted-properties`, `no-restricted-syntax`, `no-return-assign`, `no-script-url`, `no-self-assign`, `no-self-compare`, `no-sequences`, `no-setter-return`, `no-shadow-restricted-names`, `no-sparse-arrays`, `no-template-curly-in-string`, `no-this-before-super`, `no-throw-literal`, `no-unassigned-vars`, `no-unexpected-multiline`, `no-unmodified-loop-condition`, `no-unreachable`, `no-unreachable-loop`, `no-unsafe-finally`, `no-unsafe-negation`, `no-unsafe-optional-chaining`, `no-unused-labels`, `no-useless-assignment`, `no-useless-backreference`, `no-useless-call`, `no-useless-catch`, `no-useless-computed-key`, `no-useless-concat`, `no-useless-escape`, `no-useless-rename`, `no-useless-return`, `no-var`, `no-warning-comments`, `no-with`, `object-shorthand`, `operator-assignment`, `prefer-arrow-callback`, `prefer-const`, `prefer-exponentiation-operator`, `prefer-numeric-literals`, `prefer-object-has-own`, `prefer-object-spread`, `prefer-regex-literals`, `prefer-rest-params`, `prefer-spread`, `prefer-template`, `preserve-caught-error`, `radix`, `require-atomic-updates`, `require-yield`, `sort-vars`, `strict`, `symbol-description`, `unicode-bom`, `use-isnan`, `valid-typeof`, `vars-on-top`, `yoda`
107
+
108
+ </details>
109
+
110
+ <details>
111
+ <summary><b>typescript-eslint 8.72.2</b>: 127 rules (63 of them use types)</summary>
112
+
113
+ `@typescript-eslint/adjacent-overload-signatures`, `@typescript-eslint/array-type`, `@typescript-eslint/await-thenable`, `@typescript-eslint/ban-ts-comment`, `@typescript-eslint/ban-tslint-comment`, `@typescript-eslint/class-literal-property-style`, `@typescript-eslint/class-methods-use-this`, `@typescript-eslint/consistent-generic-constructors`, `@typescript-eslint/consistent-indexed-object-style`, `@typescript-eslint/consistent-return`, `@typescript-eslint/consistent-type-assertions`, `@typescript-eslint/consistent-type-definitions`, `@typescript-eslint/consistent-type-exports`, `@typescript-eslint/consistent-type-imports`, `@typescript-eslint/default-param-last`, `@typescript-eslint/dot-notation`, `@typescript-eslint/explicit-function-return-type`, `@typescript-eslint/explicit-member-accessibility`, `@typescript-eslint/explicit-module-boundary-types`, `@typescript-eslint/init-declarations`, `@typescript-eslint/max-params`, `@typescript-eslint/member-ordering`, `@typescript-eslint/method-signature-style`, `@typescript-eslint/naming-convention`, `@typescript-eslint/no-array-constructor`, `@typescript-eslint/no-array-delete`, `@typescript-eslint/no-base-to-string`, `@typescript-eslint/no-confusing-non-null-assertion`, `@typescript-eslint/no-confusing-void-expression`, `@typescript-eslint/no-deprecated`, `@typescript-eslint/no-dupe-class-members`, `@typescript-eslint/no-duplicate-enum-values`, `@typescript-eslint/no-duplicate-type-constituents`, `@typescript-eslint/no-dynamic-delete`, `@typescript-eslint/no-empty-function`, `@typescript-eslint/no-empty-object-type`, `@typescript-eslint/no-explicit-any`, `@typescript-eslint/no-extra-non-null-assertion`, `@typescript-eslint/no-extraneous-class`, `@typescript-eslint/no-floating-promises`, `@typescript-eslint/no-for-in-array`, `@typescript-eslint/no-generated-empty-object-type`, `@typescript-eslint/no-implied-eval`, `@typescript-eslint/no-import-type-side-effects`, `@typescript-eslint/no-inferrable-types`, `@typescript-eslint/no-invalid-this`, `@typescript-eslint/no-invalid-void-type`, `@typescript-eslint/no-magic-numbers`, `@typescript-eslint/no-meaningless-void-operator`, `@typescript-eslint/no-misused-new`, `@typescript-eslint/no-misused-promises`, `@typescript-eslint/no-misused-spread`, `@typescript-eslint/no-mixed-enums`, `@typescript-eslint/no-namespace`, `@typescript-eslint/no-non-null-asserted-nullish-coalescing`, `@typescript-eslint/no-non-null-asserted-optional-chain`, `@typescript-eslint/no-non-null-assertion`, `@typescript-eslint/no-redeclare`, `@typescript-eslint/no-redundant-type-constituents`, `@typescript-eslint/no-require-imports`, `@typescript-eslint/no-restricted-types`, `@typescript-eslint/no-shadow`, `@typescript-eslint/no-this-alias`, `@typescript-eslint/no-unnecessary-boolean-literal-compare`, `@typescript-eslint/no-unnecessary-condition`, `@typescript-eslint/no-unnecessary-parameter-property-assignment`, `@typescript-eslint/no-unnecessary-qualifier`, `@typescript-eslint/no-unnecessary-template-expression`, `@typescript-eslint/no-unnecessary-type-arguments`, `@typescript-eslint/no-unnecessary-type-assertion`, `@typescript-eslint/no-unnecessary-type-constraint`, `@typescript-eslint/no-unnecessary-type-conversion`, `@typescript-eslint/no-unnecessary-type-parameters`, `@typescript-eslint/no-unsafe-argument`, `@typescript-eslint/no-unsafe-assignment`, `@typescript-eslint/no-unsafe-call`, `@typescript-eslint/no-unsafe-declaration-merging`, `@typescript-eslint/no-unsafe-enum-assignment`, `@typescript-eslint/no-unsafe-enum-comparison`, `@typescript-eslint/no-unsafe-function-type`, `@typescript-eslint/no-unsafe-member-access`, `@typescript-eslint/no-unsafe-return`, `@typescript-eslint/no-unsafe-type-assertion`, `@typescript-eslint/no-unsafe-unary-minus`, `@typescript-eslint/no-unused-expressions`, `@typescript-eslint/no-unused-private-class-members`, `@typescript-eslint/no-unused-vars`, `@typescript-eslint/no-use-before-define`, `@typescript-eslint/no-useless-constructor`, `@typescript-eslint/no-useless-default-assignment`, `@typescript-eslint/no-useless-empty-export`, `@typescript-eslint/no-wrapper-object-types`, `@typescript-eslint/non-nullable-type-assertion-style`, `@typescript-eslint/only-throw-error`, `@typescript-eslint/parameter-properties`, `@typescript-eslint/prefer-as-const`, `@typescript-eslint/prefer-destructuring`, `@typescript-eslint/prefer-enum-initializers`, `@typescript-eslint/prefer-find`, `@typescript-eslint/prefer-for-of`, `@typescript-eslint/prefer-function-type`, `@typescript-eslint/prefer-includes`, `@typescript-eslint/prefer-literal-enum-member`, `@typescript-eslint/prefer-namespace-keyword`, `@typescript-eslint/prefer-nullish-coalescing`, `@typescript-eslint/prefer-optional-chain`, `@typescript-eslint/prefer-promise-reject-errors`, `@typescript-eslint/prefer-readonly`, `@typescript-eslint/prefer-readonly-parameter-types`, `@typescript-eslint/prefer-reduce-type-parameter`, `@typescript-eslint/prefer-regexp-exec`, `@typescript-eslint/prefer-return-this-type`, `@typescript-eslint/prefer-string-starts-ends-with`, `@typescript-eslint/promise-function-async`, `@typescript-eslint/related-getter-setter-pairs`, `@typescript-eslint/require-array-sort-compare`, `@typescript-eslint/require-await`, `@typescript-eslint/restrict-plus-operands`, `@typescript-eslint/restrict-template-expressions`, `@typescript-eslint/return-await`, `@typescript-eslint/strict-boolean-expressions`, `@typescript-eslint/strict-void-return`, `@typescript-eslint/switch-exhaustiveness-check`, `@typescript-eslint/triple-slash-reference`, `@typescript-eslint/unbound-method`, `@typescript-eslint/unified-signatures`, `@typescript-eslint/use-unknown-in-catch-callback-variable`
114
+
115
+ </details>
116
+
117
+ <details>
118
+ <summary><b>eslint-plugin-unicorn 79.0.0</b>: 105 rules</summary>
119
+
120
+ `unicorn/better-regex`, `unicorn/consistent-assert`, `unicorn/consistent-date-clone`, `unicorn/consistent-empty-array-spread`, `unicorn/consistent-existence-index-check`, `unicorn/consistent-function-scoping`, `unicorn/consistent-template-literal-escape`, `unicorn/custom-error-definition`, `unicorn/error-message`, `unicorn/escape-case`, `unicorn/explicit-length-check`, `unicorn/isolated-functions`, `unicorn/new-for-builtins`, `unicorn/no-accessor-recursion`, `unicorn/no-anonymous-default-export`, `unicorn/no-array-callback-reference`, `unicorn/no-array-method-this-argument`, `unicorn/no-array-reverse`, `unicorn/no-array-sort`, `unicorn/no-await-expression-member`, `unicorn/no-await-in-promise-methods`, `unicorn/no-console-spaces`, `unicorn/no-for-each`, `unicorn/no-hex-escape`, `unicorn/no-immediate-mutation`, `unicorn/no-instanceof-builtins`, `unicorn/no-invalid-fetch-options`, `unicorn/no-keyword-prefix`, `unicorn/no-lonely-if`, `unicorn/no-named-default`, `unicorn/no-negated-condition`, `unicorn/no-negation-in-equality-check`, `unicorn/no-nested-ternary`, `unicorn/no-new-array`, `unicorn/no-new-buffer`, `unicorn/no-process-exit`, `unicorn/no-single-promise-in-promise-methods`, `unicorn/no-static-only-class`, `unicorn/no-thenable`, `unicorn/no-this-assignment`, `unicorn/no-typeof-undefined`, `unicorn/no-unnecessary-array-flat-depth`, `unicorn/no-unnecessary-array-splice-count`, `unicorn/no-unnecessary-await`, `unicorn/no-unnecessary-slice-end`, `unicorn/no-unreadable-array-destructuring`, `unicorn/no-unreadable-iife`, `unicorn/no-unused-properties`, `unicorn/no-useless-collection-argument`, `unicorn/no-useless-error-capture-stack-trace`, `unicorn/no-useless-fallback-in-spread`, `unicorn/no-useless-iterator-to-array`, `unicorn/no-useless-length-check`, `unicorn/no-useless-promise-resolve-reject`, `unicorn/no-useless-spread`, `unicorn/no-useless-switch-case`, `unicorn/no-useless-undefined`, `unicorn/no-zero-fractions`, `unicorn/prefer-array-flat`, `unicorn/prefer-array-flat-map`, `unicorn/prefer-array-index-of`, `unicorn/prefer-array-some`, `unicorn/prefer-bigint-literals`, `unicorn/prefer-blob-reading-methods`, `unicorn/prefer-class-fields`, `unicorn/prefer-code-point`, `unicorn/prefer-date-now`, `unicorn/prefer-default-parameters`, `unicorn/prefer-export-from`, `unicorn/prefer-import-meta-properties`, `unicorn/prefer-json-parse-buffer`, `unicorn/prefer-logical-operator-over-ternary`, `unicorn/prefer-math-min-max`, `unicorn/prefer-math-trunc`, `unicorn/prefer-modern-math-apis`, `unicorn/prefer-module`, `unicorn/prefer-native-coercion-functions`, `unicorn/prefer-negative-index`, `unicorn/prefer-node-protocol`, `unicorn/prefer-number-properties`, `unicorn/prefer-object-from-entries`, `unicorn/prefer-prototype-methods`, `unicorn/prefer-reflect-apply`, `unicorn/prefer-response-static-json`, `unicorn/prefer-set-size`, `unicorn/prefer-simple-condition-first`, `unicorn/prefer-single-call`, `unicorn/prefer-spread`, `unicorn/prefer-string-raw`, `unicorn/prefer-string-replace-all`, `unicorn/prefer-string-slice`, `unicorn/prefer-string-trim-start-end`, `unicorn/prefer-structured-clone`, `unicorn/prefer-switch`, `unicorn/prefer-ternary`, `unicorn/prefer-type-error`, `unicorn/relative-url-style`, `unicorn/require-array-join-separator`, `unicorn/require-module-attributes`, `unicorn/require-module-specifiers`, `unicorn/require-number-to-fixed-digits-argument`, `unicorn/switch-case-braces`, `unicorn/switch-case-break-position`, `unicorn/text-encoding-identifier-case`, `unicorn/throw-new-error`
121
+
122
+ </details>
123
+
124
+ <details>
125
+ <summary><b>@stylistic/eslint-plugin 6.0.1</b>: 54 rules</summary>
126
+
127
+ `@stylistic/array-bracket-spacing`, `@stylistic/arrow-parens`, `@stylistic/arrow-spacing`, `@stylistic/block-spacing`, `@stylistic/brace-style`, `@stylistic/comma-dangle`, `@stylistic/comma-spacing`, `@stylistic/comma-style`, `@stylistic/computed-property-spacing`, `@stylistic/dot-location`, `@stylistic/eol-last`, `@stylistic/exp-jsx-props-style`, `@stylistic/function-call-argument-newline`, `@stylistic/function-call-spacing`, `@stylistic/function-paren-newline`, `@stylistic/implicit-arrow-linebreak`, `@stylistic/key-spacing`, `@stylistic/keyword-spacing`, `@stylistic/lines-between-class-members`, `@stylistic/list-style`, `@stylistic/member-delimiter-style`, `@stylistic/multiline-ternary`, `@stylistic/new-parens`, `@stylistic/no-extra-parens`, `@stylistic/no-extra-semi`, `@stylistic/no-floating-decimal`, `@stylistic/no-mixed-spaces-and-tabs`, `@stylistic/no-multi-spaces`, `@stylistic/no-trailing-spaces`, `@stylistic/no-whitespace-before-property`, `@stylistic/nonblock-statement-body-position`, `@stylistic/object-curly-newline`, `@stylistic/object-curly-spacing`, `@stylistic/object-property-newline`, `@stylistic/one-var-declaration-per-line`, `@stylistic/quote-props`, `@stylistic/quotes`, `@stylistic/rest-spread-spacing`, `@stylistic/semi`, `@stylistic/semi-spacing`, `@stylistic/semi-style`, `@stylistic/space-before-blocks`, `@stylistic/space-before-function-paren`, `@stylistic/space-in-parens`, `@stylistic/space-infix-ops`, `@stylistic/space-unary-ops`, `@stylistic/spaced-comment`, `@stylistic/switch-colon-spacing`, `@stylistic/template-curly-spacing`, `@stylistic/template-tag-spacing`, `@stylistic/type-annotation-spacing`, `@stylistic/type-generic-spacing`, `@stylistic/type-named-tuple-spacing`, `@stylistic/yield-star-spacing`
128
+
129
+ </details>
130
+
131
+ <details>
132
+ <summary><b>eslint-plugin-perfectionist 5.13.0</b>: 14 rules</summary>
133
+
134
+ `perfectionist/sort-array-includes`, `perfectionist/sort-classes`, `perfectionist/sort-export-attributes`, `perfectionist/sort-exports`, `perfectionist/sort-heritage-clauses`, `perfectionist/sort-import-attributes`, `perfectionist/sort-imports`, `perfectionist/sort-intersection-types`, `perfectionist/sort-maps`, `perfectionist/sort-named-exports`, `perfectionist/sort-named-imports`, `perfectionist/sort-sets`, `perfectionist/sort-switch-case`, `perfectionist/sort-union-types`
135
+
136
+ </details>
137
+
138
+ <details>
139
+ <summary><b>@slipher/eslint-plugin 1.1.0</b> (Seyfert bots): 15 rules</summary>
140
+
141
+ `seyfert/autocomplete-respond`, `seyfert/config-default-export`, `seyfert/context-menu-declare`, `seyfert/declare-description`, `seyfert/decorator-on-command`, `seyfert/decorator-target`, `seyfert/group-exists`, `seyfert/i18n-resolve-with-get`, `seyfert/no-deep-imports`, `seyfert/no-hanging-middleware`, `seyfert/no-method-destructure`, `seyfert/options-use-builders`, `seyfert/prefer-typed-group`, `seyfert/require-declare`, `seyfert/required-options-order`
142
+
143
+ </details>
144
+
145
+ <details>
146
+ <summary><b>@marcrock22/eslintcf</b> (its own rules): 4 rules</summary>
147
+
148
+ `marcrock/no-newline-if-body-class-empty`, `marcrock/numeric-separators`, `marcrock/prefer-at`, `marcrock/uppercase-first-class-letter`
149
+
150
+ </details>
151
+
152
+ What each version added is in the [changelog](CHANGELOG.md).
153
+
154
+ ### How it is checked
155
+
156
+ Every rule passes all the cases of its own upstream tests, linted as TypeScript: 29,862 cases of typescript-eslint, 14,092 of ESLint, 14,962 of eslint-plugin-unicorn, 9,528 of @stylistic/eslint-plugin, 3,278 of eslint-plugin-perfectionist, 459 of @slipher/eslint-plugin and 206 of @marcrock22/eslintcf. On fixtures of its own, every rule gives exactly what ESLint gives: problems, messages, positions, fixes and suggestions. The rules are also compared with ESLint on real projects (a Discord bot, zod, recharts and the TypeScript compiler).
157
+
158
+ ## VS Code extension
159
+
160
+ The extension shows the problems of the TypeScript files you open and type, underlined where ESLint would underline them. It offers their fixes and suggestions as quick fixes, adds a comment that disables a rule for a line, and has a fix-all action. A veslint server per workspace folder keeps the project loaded, so the text you type is linted in about 0.1 s. Its commands, settings and limits are in [its README](editors/vscode/README.md).
161
+
162
+ ## Limits
163
+
164
+ - **TypeScript only.** JavaScript files are not linted, even in a project with `allowJs`.
165
+ - **Linux x64 and Windows x64.** Other platforms need a build from source, which is not tested there.
166
+ - **An `eslint.config.*` needs `bun`** to be read; the resolved configuration (`--print-config`) does not. A cached resolution is reused while the files and modules the configuration read and the environment variables it read stay the same: a configuration that depends on something else (the date, a file it lists but does not read, a new `tsconfig.json` a glob of `parserOptions.project` matches) needs `VESLINT_CONFIG_CACHE=0`.
167
+ - **The newest TypeScript syntax** may not be read yet: veslint warns when a file has syntax it does not understand, and some problems of that file may be missing.
168
+ - **Plugins:** only the rules listed above. Rules of other plugins are skipped with a warning.
169
+
170
+ ## Building from source
171
+
172
+ Requirements:
173
+
174
+ - [V](https://github.com/vlang/v) at commit `841595141fbb` (the release workflow builds it from the vlang/vc commit `45add16eb714`).
175
+ - GCC, `make`, `git`, `patch` and `npm`. npm only downloads two pinned binaries: TypeScript 7.1.0-beta and the tree-sitter 0.24.4 CLI.
176
+
177
+ ```sh
178
+ make deps # TypeScript 7, tree-sitter and the patched TypeScript grammar
179
+ make build V=<v> # ./veslint
180
+ make test V=<v> # the tests (JOBS=<n> checks at once; the CPUs by default)
181
+ VESLINT_MATRIX=1 make test V=<v> # also each rule alone on every fixture (before a release)
182
+ ```
183
+
184
+ **Windows:** run `pwsh ./build-windows.ps1` with PowerShell 7, Git for Windows, MSYS2's UCRT64 gcc in `PATH` (`pacman -S mingw-w64-ucrt-x86_64-gcc`) and Node.js. It builds V and the dependencies itself; the generated grammar is copied from a Linux checkout of the same commit (`build/tree-sitter-typescript`, which `make` writes).
185
+
186
+ ## Changelog
187
+
188
+ See [CHANGELOG.md](CHANGELOG.md). Each version is also a [GitHub release](https://github.com/MARCROCK22/veslint/releases) with its binaries and the extension.
package/bin/veslint.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ // Runs the veslint binary of this platform, which npm installs with the optional dependency
3
+ // @marcrock22/veslint-<platform>-<arch>, with the same arguments, stdio and exit code.
4
+ 'use strict';
5
+
6
+ const { spawn } = require('node:child_process');
7
+ const path = require('node:path');
8
+
9
+ const name = `@marcrock22/veslint-${process.platform}-${process.arch}`;
10
+ const exe = process.platform === 'win32' ? 'veslint.exe' : 'veslint';
11
+
12
+ let bin;
13
+ try {
14
+ bin = path.join(path.dirname(require.resolve(`${name}/package.json`)), exe);
15
+ } catch {
16
+ console.error(`veslint: the package ${name} is not installed. veslint runs on Linux x64 (glibc) and Windows x64; on those, install @marcrock22/veslint again without omitting its optional dependencies.`);
17
+ process.exit(1);
18
+ }
19
+
20
+ const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit' });
21
+ // A signal for this process is one for veslint too (the terminal sends Ctrl+C to both).
22
+ const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
23
+ for (const signal of signals) {
24
+ process.on(signal, () => child.kill(signal));
25
+ }
26
+ child.on('error', (error) => {
27
+ console.error(`veslint: could not run ${bin}: ${error.message}`);
28
+ process.exit(1);
29
+ });
30
+ child.on('exit', (code, signal) => {
31
+ if (signal) {
32
+ // End as veslint ended, by the same signal.
33
+ for (const each of signals) {
34
+ process.removeAllListeners(each);
35
+ }
36
+ process.kill(process.pid, signal);
37
+ return;
38
+ }
39
+ process.exit(code ?? 1);
40
+ });
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@marcrock22/veslint",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.28.0",
4
+ "description": "A TypeScript linter in V that talks to TypeScript 7 (tsc --api) directly: the rules of ESLint, typescript-eslint, unicorn, @stylistic, perfectionist and seyfert, with the same results.",
5
+ "bin": {
6
+ "veslint": "bin/veslint.js"
7
+ },
8
+ "files": [
9
+ "bin"
10
+ ],
11
+ "optionalDependencies": {
12
+ "@marcrock22/veslint-linux-x64": "0.28.0",
13
+ "@marcrock22/veslint-win32-x64": "0.28.0"
14
+ },
15
+ "keywords": [
16
+ "typescript",
17
+ "lint",
18
+ "linter",
19
+ "eslint",
20
+ "typescript-eslint"
21
+ ],
22
+ "author": "MARCROCK22",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/MARCROCK22/veslint.git"
26
+ },
27
+ "homepage": "https://github.com/MARCROCK22/veslint#readme",
28
+ "bugs": {
29
+ "url": "https://github.com/MARCROCK22/veslint/issues"
30
+ },
31
+ "engines": {
32
+ "node": ">=18"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ }
37
+ }