eslint-sh 0.1.0 → 0.1.1
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 +37 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,24 +3,17 @@
|
|
|
3
3
|
Shell script parsing and syntax-error reporting for ESLint, with custom-rule authoring over a
|
|
4
4
|
typed shell AST.
|
|
5
5
|
|
|
6
|
+
This is the canonical quickstart for the `eslint-sh` / `@eslint-sh/eslint-plugin` project — start
|
|
7
|
+
here regardless of which of the two packages you install.
|
|
8
|
+
|
|
6
9
|
**Roadmap:** built-in lint rules and shared configs are planned but not implemented yet.
|
|
7
10
|
|
|
8
11
|
## Installation
|
|
9
12
|
|
|
10
|
-
This package is not yet published. Once it is, install it as a dev dependency:
|
|
11
|
-
|
|
12
13
|
```sh
|
|
13
14
|
npm install --save-dev eslint-sh
|
|
14
15
|
```
|
|
15
16
|
|
|
16
|
-
## `languageOptions` reference
|
|
17
|
-
|
|
18
|
-
| Option | Allowed values | Default | Effect |
|
|
19
|
-
| ----------------- | ----------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
20
|
-
| `dialect` | `"bash"`, `"posix"`, `"mksh"`, `"bats"`, `"zsh"` | `"bash"` | Selects which shell grammar the parser accepts; parsing a construct outside the chosen dialect produces a parse error. |
|
|
21
|
-
| `shellVersion` | A numeric `MAJOR` or `MAJOR.MINOR` string, e.g. `"5"` or `"3.2"` | unset | Reserved for the rule layer (e.g. a future bash-3.2 compatibility check); has no effect on parsing today since no rules ship yet. |
|
|
22
|
-
| `directivePrefix` | Lowercase, hyphen-separated words, e.g. `"eslint"` or `"shellcheck-sh"` | `"eslint"` | The prefix directive/inline-config comments must start with — e.g. the default recognizes `# eslint-disable-next-line ...`. |
|
|
23
|
-
|
|
24
17
|
## Usage
|
|
25
18
|
|
|
26
19
|
This release reports shell syntax (parse) errors only — no lint rules ship yet, so a "0 problems"
|
|
@@ -41,13 +34,43 @@ export default defineConfig([
|
|
|
41
34
|
]);
|
|
42
35
|
```
|
|
43
36
|
|
|
37
|
+
## `languageOptions` reference
|
|
38
|
+
|
|
39
|
+
| Option | Allowed values | Default | Effect |
|
|
40
|
+
| ----------------- | ----------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| `dialect` | `"bash"`, `"posix"`, `"mksh"`, `"bats"`, `"zsh"` | `"bash"` | Selects which shell grammar the parser accepts; parsing a construct outside the chosen dialect produces a parse error. |
|
|
42
|
+
| `shellVersion` | A numeric `MAJOR` or `MAJOR.MINOR` string, e.g. `"5"` or `"3.2"` | unset | Reserved for the rule layer (e.g. a future bash-3.2 compatibility check); has no effect on parsing today since no rules ship yet. |
|
|
43
|
+
| `directivePrefix` | Lowercase, hyphen-separated words, e.g. `"eslint"` or `"shellcheck-sh"` | `"eslint"` | The prefix directive/inline-config comments must start with — e.g. the default recognizes `# eslint-disable-next-line ...`. |
|
|
44
|
+
|
|
45
|
+
## Troubleshooting
|
|
46
|
+
|
|
47
|
+
- **ESLint doesn't seem to look at my `.sh`/`.bash` files at all.** Confirm the config object's
|
|
48
|
+
`files` glob actually matches them, and that `language: 'sh/sh'` is set alongside
|
|
49
|
+
`plugins: { sh }` — without both, ESLint won't route the file through this plugin's language.
|
|
50
|
+
- **A script I believe is valid reports a parse error.** The parser is dialect-sensitive: a
|
|
51
|
+
construct that's valid in one shell grammar (e.g. `[[ ... ]]` in bash) is a parse error in
|
|
52
|
+
another (e.g. `posix`). Set `languageOptions.dialect` to match the shell the script is actually
|
|
53
|
+
written for.
|
|
54
|
+
- **Setting `shellVersion` doesn't change anything.** That's expected today — see the
|
|
55
|
+
`languageOptions` reference table above: `shellVersion` is reserved for a future rule layer and
|
|
56
|
+
has no effect on parsing while no lint rules ship.
|
|
57
|
+
- **`# eslint-disable-next-line ...` comments don't seem to do anything.** No lint rules ship yet
|
|
58
|
+
in this release, so there's nothing for a disable comment to suppress until you register a
|
|
59
|
+
custom rule (see the `@eslint-sh/eslint-plugin` README's "Writing your own rules" section). If
|
|
60
|
+
you've registered a custom rule and the directive still isn't recognized, check
|
|
61
|
+
`languageOptions.directivePrefix` — it must match the prefix your comment uses (the default
|
|
62
|
+
`"eslint"` only recognizes `# eslint-disable-next-line ...`, not a custom prefix).
|
|
63
|
+
|
|
44
64
|
## Status
|
|
45
65
|
|
|
46
66
|
Thin umbrella re-exporting `@eslint-sh/eslint-plugin`'s plugin object unchanged as this
|
|
47
67
|
package's default export — `import sh from "eslint-sh"` and `import sh from "@eslint-sh/eslint-plugin"`
|
|
48
68
|
refer to the same object. `@eslint-sh/eslint-plugin` currently ships `ShellLanguage`/
|
|
49
69
|
`ShellSourceCode` only; rules and shared configs are not implemented yet. Disable directives /
|
|
50
|
-
inline config are implemented and live. No lint rules ship yet, so the rule id
|
|
51
|
-
after you register a custom rule as
|
|
52
|
-
`# eslint-disable-next-line sh/your-rule -- justification` suppresses it on the
|
|
53
|
-
|
|
70
|
+
inline config are implemented and live. No lint rules ship yet, so the rule id in the
|
|
71
|
+
troubleshooting section above is illustrative: after you register a custom rule as
|
|
72
|
+
`sh/your-rule`, `# eslint-disable-next-line sh/your-rule -- justification` suppresses it on the
|
|
73
|
+
following line.
|
|
74
|
+
|
|
75
|
+
For the plugin's public API reference (types, exports, selector cookbook, and a custom-rule
|
|
76
|
+
authoring tutorial), see the `@eslint-sh/eslint-plugin` package's README.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-sh",
|
|
3
3
|
"description": "Shell script parsing and syntax-error reporting for ESLint, with custom-rule authoring over a typed shell AST",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"author": "Mike North <michael.l.north@gmail.com>",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@eslint-sh/eslint-plugin": "0.1.
|
|
7
|
+
"@eslint-sh/eslint-plugin": "0.1.1"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"eslint": "^10.7.0"
|