eslint-sh 0.7.0 → 0.8.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.
- package/README.md +15 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ file lintable on its own, and ESLint skips the file without a warning. See
|
|
|
77
77
|
`languageOptions` reference table below). This README's own [custom-rule tutorial](https://github.com/mike-north/eslint-sh/blob/main/packages/eslint-plugin/docs/custom-rule-tutorial.md)
|
|
78
78
|
config omits `languageOptions` for exactly that reason — it targets bash, the default, so
|
|
79
79
|
there's nothing to override. Add `languageOptions: { dialect: 'posix' }` to your config entry
|
|
80
|
-
when targeting POSIX shell, or set a `
|
|
80
|
+
when targeting POSIX shell, or set a `minBashVersion` hint or custom `directivePrefix` as needed.
|
|
81
81
|
|
|
82
82
|
### CommonJS config
|
|
83
83
|
|
|
@@ -127,7 +127,7 @@ export default defineConfig([{ files: ['**/*.sh', 'bin/?*'], extends: [sh.config
|
|
|
127
127
|
(which caps function count, nesting depth and statement count).
|
|
128
128
|
`sh/no-secret-flags` and `sh/quote-expansions` are `error` here too.
|
|
129
129
|
- **`sh.configs['bash-3.2']`** is for scripts that must run on the Bash 3.2 macOS ships as
|
|
130
|
-
`/bin/bash`. It sets `languageOptions: { dialect: 'bash',
|
|
130
|
+
`/bin/bash`. It sets `languageOptions: { dialect: 'bash', minBashVersion: '3.2' }` and enables every
|
|
131
131
|
version-gated `compat/*` rule at `error`.
|
|
132
132
|
- **`sh.configs['posix-portable']`** reports Bash-only constructs that fail on dash, including
|
|
133
133
|
`[[`, `let` and `source`, but not `local`, `echo -e` or the others it leaves to shellcheck, so a
|
|
@@ -140,9 +140,11 @@ export default defineConfig([{ files: ['**/*.sh', 'bin/?*'], extends: [sh.config
|
|
|
140
140
|
|
|
141
141
|
Three `agent-authored` rules report nothing until you configure them. `sh/no-undeclared-commands`
|
|
142
142
|
and `sh/no-unused-declarations` need a declaration convention bound in
|
|
143
|
-
`settings
|
|
144
|
-
network commands must run through, set once in `settings
|
|
145
|
-
read that setting too, so they count `curl` in `with-retry curl …` as used
|
|
143
|
+
`settings: { sh: { declarationConvention: commentPragma } }`, and `sh/require-network-wrapper` needs the wrapper your
|
|
144
|
+
network commands must run through, set once in `settings: { sh: { networkWrapper: 'with-retry' } }`. The declaration rules
|
|
145
|
+
read that setting too, so they count `curl` in `with-retry curl …` as used. Every wrapper-following
|
|
146
|
+
rule also reads project facts from `settings: { sh: { transparentWrappers: ['with-lock'] } }`;
|
|
147
|
+
see [shared transparent wrappers](https://github.com/mike-north/eslint-sh/blob/main/packages/eslint-plugin/docs/transparent-wrappers.md):
|
|
146
148
|
|
|
147
149
|
```js
|
|
148
150
|
import { defineConfig } from 'eslint/config';
|
|
@@ -159,11 +161,11 @@ export default defineConfig([
|
|
|
159
161
|
|
|
160
162
|
## `languageOptions` reference
|
|
161
163
|
|
|
162
|
-
| Option | Allowed values | Default | Effect
|
|
163
|
-
| ----------------- | ----------------------------------------------------------------------- | ---------- |
|
|
164
|
-
| `dialect` | `"bash"`, `"posix"`, `"mksh"`, `"bats"`, `"zsh"` | `"bash"` | Selects which shell grammar the parser accepts. Enforcement is partial: some non-dialect constructs are rejected (e.g. bash array literals under `posix`), but others (e.g. `[[ ... ]]`, `let`) are accepted as ordinary commands — see the [per-dialect enforcement table](https://github.com/mike-north/sh-ast/blob/main/packages/sh-ast/README.md#dialect-enforcement).
|
|
165
|
-
| `
|
|
166
|
-
| `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 ...`.
|
|
164
|
+
| Option | Allowed values | Default | Effect |
|
|
165
|
+
| ----------------- | ----------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
166
|
+
| `dialect` | `"bash"`, `"posix"`, `"mksh"`, `"bats"`, `"zsh"` | `"bash"` | Selects which shell grammar the parser accepts. Enforcement is partial: some non-dialect constructs are rejected (e.g. bash array literals under `posix`), but others (e.g. `[[ ... ]]`, `let`) are accepted as ordinary commands — see the [per-dialect enforcement table](https://github.com/mike-north/sh-ast/blob/main/packages/sh-ast/README.md#dialect-enforcement). |
|
|
167
|
+
| `minBashVersion` | A numeric `MAJOR` or `MAJOR.MINOR` string, e.g. `"5"` or `"3.2"` | unset | The minimum Bash version your scripts must support, including every newer Bash; no upper limit is checked. Accepted only for `bash` (the default) or `bats`. The parser ignores it; `compat/*` rules report features unavailable at the floor. Unset means no Bash version constraint. See [version compatibility](https://github.com/mike-north/eslint-sh/blob/main/packages/eslint-plugin/docs/compat.md). |
|
|
168
|
+
| `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 ...`. |
|
|
167
169
|
|
|
168
170
|
## Continuous integration
|
|
169
171
|
|
|
@@ -454,8 +456,8 @@ from what the plugin actually does.
|
|
|
454
456
|
export default defineConfig([{ files: ['**/*.sh'], extends: [sh.configs.recommended] }]);
|
|
455
457
|
```
|
|
456
458
|
|
|
457
|
-
- **Setting `
|
|
458
|
-
and only the version-gated `compat/*` rules read it (`sh/compat/no-append-all-redirect`, `sh/compat/no-associative-arrays`, `sh/compat/no-brace-sequence-padding-step`, `sh/compat/no-case-attributes`, `sh/compat/no-case-fallthrough`, `sh/compat/no-case-modification`, `sh/compat/no-coproc`, `sh/compat/no-declare-g`, `sh/compat/no-epoch-variables`, `sh/compat/no-fd-variable`, `sh/compat/no-globstar`, `sh/compat/no-lastpipe-semantics`, `sh/compat/no-mapfile`, `sh/compat/no-nameref`, `sh/compat/no-negative-array-index`, `sh/compat/no-nounset-empty-array`, `sh/compat/no-parameter-transformation`, `sh/compat/no-pipe-all`, `sh/compat/no-printf-time-format`, `sh/compat/no-test-v`, `sh/compat/no-unicode-escape` and `sh/compat/no-wait-n`). The `bash-3.2` and `posix-portable` presets enable them; to pick rules yourself,
|
|
459
|
+
- **Setting `minBashVersion` doesn't change anything.** `minBashVersion` has no effect on parsing,
|
|
460
|
+
and only the version-gated `compat/*` rules read it (`sh/compat/no-append-all-redirect`, `sh/compat/no-associative-arrays`, `sh/compat/no-brace-sequence-padding-step`, `sh/compat/no-case-attributes`, `sh/compat/no-case-fallthrough`, `sh/compat/no-case-modification`, `sh/compat/no-coproc`, `sh/compat/no-declare-g`, `sh/compat/no-epoch-variables`, `sh/compat/no-fd-variable`, `sh/compat/no-globstar`, `sh/compat/no-lastpipe-semantics`, `sh/compat/no-mapfile`, `sh/compat/no-nameref`, `sh/compat/no-negative-array-index`, `sh/compat/no-nounset-empty-array`, `sh/compat/no-parameter-transformation`, `sh/compat/no-pipe-all`, `sh/compat/no-printf-time-format`, `sh/compat/no-test-v`, `sh/compat/no-unicode-escape` and `sh/compat/no-wait-n`). The `bash-3.2` and `posix-portable` presets enable them, except that `sh/compat/no-nounset-empty-array` requires explicit opt-in for `bash-3.2`. Enable that rule when a script uses `set -u` on Bash below 4.4 and its arrays can really be empty; to pick rules yourself,
|
|
459
461
|
enable the ones you want, for example `'sh/compat/no-mapfile': 'error'`. See
|
|
460
462
|
[version compatibility](https://github.com/mike-north/eslint-sh/blob/main/packages/eslint-plugin/docs/compat.md).
|
|
461
463
|
- **`# eslint-disable-next-line ...` comments don't seem to do anything.** First check that the
|
|
@@ -498,7 +500,7 @@ plugin's own `sh-ast` dependency, the same module instance its language parses w
|
|
|
498
500
|
`sh-ast` directly.
|
|
499
501
|
|
|
500
502
|
**Versioning.** `eslint-sh/syntax` and `eslint-sh/syntax/analyze` track the plugin's pinned
|
|
501
|
-
`sh-ast` minor (currently `sh-ast@^0.
|
|
503
|
+
`sh-ast` minor (currently `sh-ast@^0.9.0`). Under 0.x, a different `sh-ast` minor is a breaking
|
|
502
504
|
change, so an `sh-ast` 0.x minor bump is a minor bump of this package, and the changelog entry
|
|
503
505
|
names the new `sh-ast` version.
|
|
504
506
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-sh",
|
|
3
3
|
"description": "Shell script linting for ESLint, with built-in policy rules, shared presets, and custom rules over a typed shell AST",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"author": "Mike North <michael.l.north@gmail.com>",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@eslint-sh/eslint-plugin": "0.
|
|
7
|
+
"@eslint-sh/eslint-plugin": "0.8.0"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"eslint": "^10.7.0"
|