@marcrock22/veslint 0.36.0 → 0.38.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 (2) hide show
  1. package/README.md +20 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
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
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.
13
+ - **Same results as ESLint.** The rules of ESLint, typescript-eslint, eslint-plugin-unicorn, @stylistic/eslint-plugin, eslint-plugin-perfectionist, @eslint-community/eslint-plugin-eslint-comments, eslint-plugin-promise and @slipher/eslint-plugin are ported to V. They report the same problems, with the same messages, positions, fixes and suggestions.
14
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
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
16
  - **An editor extension** for VS Code shows the problems as you type, with quick fixes.
@@ -61,8 +61,8 @@ veslint <file.ts | directory>... [--config <file>] [--rule <rule> [--no-config-l
61
61
  |---|---|
62
62
  | `<directory>` | Lints the `.ts`, `.mts`, `.cts`, `.tsx`, `.vue` and `.svelte` files under it, as `eslint .` does: `node_modules`, `.git` and what the configuration ignores are left out. |
63
63
  | `<file.ts>` | Lints that file. JavaScript files are not linted: veslint only reads TypeScript. |
64
- | `<file.vue>` | Lints the TypeScript script of a Vue file (`<script lang="ts">` and `<script setup lang="ts">`) and, with the `vue/*` rules, its template, as ESLint does with vue-eslint-parser and typescript-eslint's parser: the rules see the script with the positions of the file, and the types are those typescript-eslint gives with `extraFileExtensions: ['.vue']`. A Vue file whose script is JavaScript is skipped with a warning. |
65
- | `<file.svelte>` | Lints the TypeScript script of a Svelte file (`<script lang="ts">`, `<script module lang="ts">`) and the `.svelte.ts` modules, as ESLint does with svelte-eslint-parser and typescript-eslint's parser: runes, stores (`$store`), `$:` statements, props and generics as svelte-eslint-parser models them, and the types typescript-eslint gives with `extraFileExtensions: ['.svelte']`. A Svelte file whose script is JavaScript is not linted (with a warning). With the `svelte/*` rules (all 86 of eslint-plugin-svelte's), its template and `<style>` too. `svelte.config.js` is read as svelte-eslint-parser reads it, statically (without running it: its `compilerOptions.runes` and `kit.files` when they are literals, `const`s or object literals), unless `parserOptions.svelteConfig` is given; the parse and the rules follow its `runes` after `parserOptions.svelteFeatures.runes` and `<svelte:options runes>`, as svelte-eslint-parser does. A `runes` function in the `parserOptions.svelteConfig` of an `eslint.config.*` is called for each Svelte file with its path, as svelte-eslint-parser and eslint-plugin-svelte call it (the resolved configuration keeps what it gave for each file); in `svelte.config.js` it is not, as svelte-eslint-parser does not run that file. |
64
+ | `<file.vue>` | Lints the TypeScript script of a Vue file (`<script lang="ts">` and `<script setup lang="ts">`) and, with the `vue/*` rules, its template, as ESLint does with vue-eslint-parser and typescript-eslint's parser: the rules see the script with the positions of the file, and the types are those typescript-eslint gives with `extraFileExtensions: ['.vue']`. JSX is read as typescript-estree reads it there: only with `parserOptions.ecmaFeatures.jsx`, whatever the `lang` (`lang="tsx"` alone is TypeScript without JSX), and in the template's expressions but not in the script when the parser has a program (`project`, `projectService`). A script TypeScript cannot parse is ESLint's fatal `Parsing error`, at the place vue-eslint-parser gives. A Vue file whose script is JavaScript is skipped with a warning. |
65
+ | `<file.svelte>` | Lints the TypeScript script of a Svelte file (`<script lang="ts">`, `<script module lang="ts">`) and the `.svelte.ts` modules, as ESLint does with svelte-eslint-parser and typescript-eslint's parser: runes, stores (`$store`), `$:` statements, props and generics as svelte-eslint-parser models them, and the types typescript-eslint gives with `extraFileExtensions: ['.svelte']`. JSX is read as svelte-eslint-parser and typescript-estree read it: only with `parserOptions.ecmaFeatures.jsx`, whatever the `lang` (`lang="tsx"` is TypeScript), in the script and the template's expressions, and the parse of its virtual code is TypeScript when the parser has a program (`project`, `projectService`); the template's expressions are the Svelte compiler's, which never takes JSX. A Svelte file whose script is JavaScript is not linted (with a warning). With the `svelte/*` rules (all 86 of eslint-plugin-svelte's), its template and `<style>` too. `svelte.config.js` is read as svelte-eslint-parser reads it, statically (without running it: its `compilerOptions.runes` and `kit.files` when they are literals, `const`s or object literals), unless `parserOptions.svelteConfig` is given; the parse and the rules follow its `runes` after `parserOptions.svelteFeatures.runes` and `<svelte:options runes>`, as svelte-eslint-parser does. A `runes` function in the `parserOptions.svelteConfig` of an `eslint.config.*` is called for each Svelte file with its path, as svelte-eslint-parser and eslint-plugin-svelte call it (the resolved configuration keeps what it gave for each file); in `svelte.config.js` it is not, as svelte-eslint-parser does not run that file. |
66
66
  | `--config <file>` | The configuration (see below). Without it and without `--rule`, a directory is linted with the closest `eslint.config.*`. |
67
67
  | `--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. |
68
68
  | `--no-config-lookup` | With `--rule`: the rule's default options, without looking for an `eslint.config.*`. |
@@ -114,7 +114,7 @@ Directive comments work as in ESLint 10: `eslint-disable`, `eslint-enable`, `esl
114
114
 
115
115
  ## Rules
116
116
 
117
- veslint has **800 rules**, each with all its options, fixes and suggestions:
117
+ veslint has **825 rules**, each with all its options, fixes and suggestions:
118
118
 
119
119
  <details>
120
120
  <summary><b>ESLint 10.15.0</b>: 139 rules</summary>
@@ -151,6 +151,20 @@ veslint has **800 rules**, each with all its options, fixes and suggestions:
151
151
 
152
152
  </details>
153
153
 
154
+ <details>
155
+ <summary><b>@eslint-community/eslint-plugin-eslint-comments 4.8.1</b>: 8 rules</summary>
156
+
157
+ `@eslint-community/eslint-comments/disable-enable-pair`, `@eslint-community/eslint-comments/no-aggregating-enable`, `@eslint-community/eslint-comments/no-duplicate-disable`, `@eslint-community/eslint-comments/no-restricted-disable`, `@eslint-community/eslint-comments/no-unlimited-disable`, `@eslint-community/eslint-comments/no-unused-enable`, `@eslint-community/eslint-comments/no-use`, `@eslint-community/eslint-comments/require-description` (`no-unused-disable`, deprecated since 4.7.0, is not ported: ESLint's own reports of unused directives replace it)
158
+
159
+ </details>
160
+
161
+ <details>
162
+ <summary><b>eslint-plugin-promise 7.3.0</b>: 17 rules</summary>
163
+
164
+ `promise/always-return`, `promise/avoid-new`, `promise/catch-or-return`, `promise/no-callback-in-promise`, `promise/no-multiple-resolved`, `promise/no-native`, `promise/no-nesting`, `promise/no-new-statics`, `promise/no-promise-in-callback`, `promise/no-return-in-finally`, `promise/no-return-wrap`, `promise/param-names`, `promise/prefer-await-to-callbacks`, `promise/prefer-await-to-then`, `promise/prefer-catch`, `promise/spec-only`, `promise/valid-params`
165
+
166
+ </details>
167
+
154
168
  <details>
155
169
  <summary><b>eslint-plugin-vue 10.12.1</b> (the templates and scripts of <code>.vue</code> files, and the components of TypeScript files): 256 rules</summary>
156
170
 
@@ -187,7 +201,7 @@ What each version added is in the [changelog](CHANGELOG.md).
187
201
 
188
202
  ### How it is checked
189
203
 
190
- 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, 206 of @marcrock22/eslintcf, 10,085 of eslint-plugin-vue and 1,090 of eslint-plugin-svelte (their JavaScript cases with `lang="ts"`, with what ESLint gives for them). 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).
204
+ 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, 204 of @eslint-community/eslint-plugin-eslint-comments, 522 of eslint-plugin-promise, 459 of @slipher/eslint-plugin, 206 of @marcrock22/eslintcf, 10,085 of eslint-plugin-vue and 1,090 of eslint-plugin-svelte (their JavaScript cases with `lang="ts"`, with what ESLint gives for them). 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).
191
205
 
192
206
  ## VS Code extension
193
207
 
@@ -200,6 +214,7 @@ The extension shows the problems of the TypeScript files you open and type, unde
200
214
  - **Linux x64 and Windows x64.** Other platforms need a build from source, which is not tested there.
201
215
  - **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`.
202
216
  - **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.
217
+ - **Parsing errors:** a file TypeScript's parser rejects is ESLint's fatal `Parsing error`, with TypeScript's first syntactic diagnostic as tsgo sorts them (by position): when the parser of TypeScript 6, which typescript-estree uses, reported two errors at the same position, the one ESLint prints may be the other (`const b = <` at the end of a file: `Type expected.` in ESLint, `Expression expected.` in veslint). Syntax only veslint's grammar does not read (see above) is linted on with a warning.
203
218
  - **Plugins:** only the rules listed above. Rules of other plugins are skipped with a warning.
204
219
 
205
220
  ## Building from source
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcrock22/veslint",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
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
5
  "bin": {
6
6
  "veslint": "bin/veslint.js"
@@ -9,8 +9,8 @@
9
9
  "bin"
10
10
  ],
11
11
  "optionalDependencies": {
12
- "@marcrock22/veslint-linux-x64": "0.36.0",
13
- "@marcrock22/veslint-win32-x64": "0.36.0"
12
+ "@marcrock22/veslint-linux-x64": "0.38.0",
13
+ "@marcrock22/veslint-win32-x64": "0.38.0"
14
14
  },
15
15
  "keywords": [
16
16
  "typescript",