@travetto/eslint 8.0.0-alpha.14 → 8.0.0-alpha.17
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/README.md +34 -10
- package/package.json +7 -7
- package/support/cli.eslint.ts +4 -1
- package/support/cli.eslint_register.ts +3 -1
package/README.md
CHANGED
|
@@ -16,18 +16,25 @@ yarn add @travetto/eslint
|
|
|
16
16
|
[ESLint](https://eslint.org/) is the standard for linting [Typescript](https://typescriptlang.org) and [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) code. This module provides some standard linting patterns and the ability to create custom rules. Due to the fact that the framework supports both [CommonJS](https://nodejs.org/api/modules.html) and [Ecmascript Module](https://nodejs.org/api/esm.html) formats, a novel solution was required to allow [ESLint](https://eslint.org/) to load [Ecmascript Module](https://nodejs.org/api/esm.html) files.
|
|
17
17
|
|
|
18
18
|
**Note**: The [ESLint](https://eslint.org/) has introduced [a new configuration format](https://eslint.org/blog/2022/08/new-config-system-part-3/) which allows for [Ecmascript Module](https://nodejs.org/api/esm.html) files.
|
|
19
|
-
|
|
20
|
-
## CLI - Register
|
|
21
19
|
In a new project, the first thing that will need to be done, post installation, is to create the eslint configuration file.
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
## CLI - eslint:register
|
|
22
|
+
|
|
23
|
+
**Terminal: Help for eslint:register**
|
|
24
24
|
```bash
|
|
25
|
-
$ trv eslint:register
|
|
25
|
+
$ trv eslint:register --help
|
|
26
|
+
|
|
27
|
+
Usage: eslint:register [options]
|
|
28
|
+
|
|
29
|
+
Generate the workspace ESLint configuration entry file.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
This bootstraps `eslint.config.js` to load framework-provided rule wiring.
|
|
32
|
+
|
|
33
|
+
Options:
|
|
34
|
+
--help display help for command
|
|
28
35
|
```
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
When registration completes, this is the file the linter will use, and any other tooling (e.g. IDEs).
|
|
31
38
|
|
|
32
39
|
**Code: Sample configuration**
|
|
33
40
|
```javascript
|
|
@@ -36,10 +43,8 @@ const { rules } = await import('./.trv/output/node_modules/@travetto/eslint/supp
|
|
|
36
43
|
export { rules as default };
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## CLI - Lint
|
|
42
|
-
Once installed, using the linter is as simple as invoking it via the cli:
|
|
46
|
+
## CLI - eslint
|
|
47
|
+
Once registered, using the linter is as simple as invoking it via the cli:
|
|
43
48
|
|
|
44
49
|
**Terminal: Running the Linter**
|
|
45
50
|
```bash
|
|
@@ -48,6 +53,25 @@ npx trv eslint
|
|
|
48
53
|
|
|
49
54
|
Or pointing your IDE to reference the registered configuration file.
|
|
50
55
|
|
|
56
|
+
**Terminal: Help for eslint**
|
|
57
|
+
```bash
|
|
58
|
+
$ trv eslint --help
|
|
59
|
+
|
|
60
|
+
Usage: eslint [options]
|
|
61
|
+
|
|
62
|
+
Run ESLint for the workspace or changed files.
|
|
63
|
+
|
|
64
|
+
Supports incremental mode (`changed`/`since`) and forwards formatting/fix
|
|
65
|
+
options to the underlying eslint invocation.
|
|
66
|
+
|
|
67
|
+
Options:
|
|
68
|
+
-c, --changed Only check changed modules (default: false)
|
|
69
|
+
-f, --format <string> Output format
|
|
70
|
+
-s, --since <string> Since a specific git commit
|
|
71
|
+
--fix Should we attempt to fix?
|
|
72
|
+
--help display help for command
|
|
73
|
+
```
|
|
74
|
+
|
|
51
75
|
## Custom Rules
|
|
52
76
|
It can be seen in the sample configuration, that the configuration is looking for files with the pattern of `support/eslint/.*`
|
|
53
77
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/eslint",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ES Linting Rules",
|
|
6
6
|
"keywords": [
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
29
|
-
"@travetto/runtime": "^8.0.0-alpha.
|
|
29
|
+
"@travetto/runtime": "^8.0.0-alpha.16",
|
|
30
30
|
"@types/eslint": "^9.6.1",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
32
|
-
"@typescript-eslint/parser": "^8.
|
|
33
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
34
|
-
"eslint": "^10.
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^8.60.1",
|
|
32
|
+
"@typescript-eslint/parser": "^8.60.1",
|
|
33
|
+
"@typescript-eslint/typescript-estree": "^8.60.1",
|
|
34
|
+
"eslint": "^10.4.1",
|
|
35
35
|
"eslint-plugin-unused-imports": "^4.4.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
38
|
+
"@travetto/cli": "^8.0.0-alpha.22"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@travetto/cli": {
|
package/support/cli.eslint.ts
CHANGED
|
@@ -4,7 +4,10 @@ import { Env, ExecUtil, Runtime } from '@travetto/runtime';
|
|
|
4
4
|
import { type CliCommandShape, CliCommand, CliModuleUtil } from '@travetto/cli';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Run ESLint for the workspace or changed files.
|
|
8
|
+
*
|
|
9
|
+
* Supports incremental mode (`changed`/`since`) and forwards formatting/fix
|
|
10
|
+
* options to the underlying eslint invocation.
|
|
8
11
|
*/
|
|
9
12
|
@CliCommand()
|
|
10
13
|
export class ESLintCommand implements CliCommandShape {
|
|
@@ -4,7 +4,9 @@ import { type CliCommandShape, CliCommand } from '@travetto/cli';
|
|
|
4
4
|
import { Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Generate the workspace ESLint configuration entry file.
|
|
8
|
+
*
|
|
9
|
+
* This bootstraps `eslint.config.js` to load framework-provided rule wiring.
|
|
8
10
|
*/
|
|
9
11
|
@CliCommand({})
|
|
10
12
|
export class ESLintConfigureCommand implements CliCommandShape {
|