@marcrock22/veslint 0.27.0 → 0.29.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 +9 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -59,8 +59,9 @@ veslint <file.ts | directory>... [--config <file>] [--rule <rule> [--no-config-l
59
59
 
60
60
  | Option | What it does |
61
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. |
62
+ | `<directory>` | Lints the `.ts`, `.mts`, `.cts`, `.tsx` and `.vue` 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">`) 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. |
64
65
  | `--config <file>` | The configuration (see below). Without it and without `--rule`, a directory is linted with the closest `eslint.config.*`. |
65
66
  | `--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
67
  | `--no-config-lookup` | With `--rule`: the rule's default options, without looking for an `eslint.config.*`. |
@@ -76,14 +77,16 @@ With files and neither `--config` nor `--rule`, veslint prints the type TypeScri
76
77
 
77
78
  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
 
79
- Environment variables: `VESLINT_TIMEOUT_MS` (how long to wait for each answer of the TypeScript compiler, 30000 by default) and `VESLINT_CPUS` (how many CPUs veslint and the compiler use: 2 by default, which is fastest; 0 for all).
80
+ 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
 
81
82
  ## Configuration
82
83
 
83
84
  `--config` takes one of these:
84
85
 
85
86
  - **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
- - **The resolved configuration** that `--print-config` prints. It needs neither `bun` nor ESLint: save it once and lint with it.
87
+
88
+ 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.
89
+ - **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.
87
90
  - **A JSON with a `rules` section**, like the output of `eslint --print-config`:
88
91
 
89
92
  ```json
@@ -159,9 +162,10 @@ The extension shows the problems of the TypeScript files you open and type, unde
159
162
 
160
163
  ## Limits
161
164
 
162
- - **TypeScript only.** JavaScript files are not linted, even in a project with `allowJs`.
165
+ - **TypeScript only.** JavaScript files are not linted, even in a project with `allowJs`, nor the JavaScript scripts of Vue files.
166
+ - **Vue files:** the rules of eslint-plugin-vue are not there yet: only the script of a `.vue` file is linted, not its template. Two scripts that are not modules (no `import` or `export`) see each other's globals in veslint, where typescript-eslint has the other `.vue` files of the program as the text of the file.
163
167
  - **Linux x64 and Windows x64.** Other platforms need a build from source, which is not tested there.
164
- - **An `eslint.config.*` needs `bun`** to be read; the resolved configuration (`--print-config`) does not.
168
+ - **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`.
165
169
  - **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.
166
170
  - **Plugins:** only the rules listed above. Rules of other plugins are skipped with a warning.
167
171
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcrock22/veslint",
3
- "version": "0.27.0",
3
+ "version": "0.29.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.27.0",
13
- "@marcrock22/veslint-win32-x64": "0.27.0"
12
+ "@marcrock22/veslint-linux-x64": "0.29.0",
13
+ "@marcrock22/veslint-win32-x64": "0.29.0"
14
14
  },
15
15
  "keywords": [
16
16
  "typescript",