@eslint-sh/eslint-plugin 0.8.0 → 0.10.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 (116) hide show
  1. package/README.md +58 -57
  2. package/dist/api.d.ts +92 -0
  3. package/dist/api.js +83 -0
  4. package/dist/command-harvest/builtins/bats.d.ts +1 -1
  5. package/dist/command-harvest/harvest-commands.d.ts +18 -7
  6. package/dist/command-harvest/harvest-commands.js +11 -10
  7. package/dist/command-harvest/wrapper-table.d.ts +1 -1
  8. package/dist/command-harvest/wrapper-table.js +1 -1
  9. package/dist/configs/posix-portable.d.ts +6 -10
  10. package/dist/configs/posix-portable.js +4 -6
  11. package/dist/configuration-message.d.ts +14 -0
  12. package/dist/configuration-message.js +33 -0
  13. package/dist/declaration-conventions/get-declared-commands.d.ts +41 -0
  14. package/dist/declaration-conventions/{read-declared-commands.js → get-declared-commands.js} +43 -43
  15. package/dist/eslint-plugin-api.d.ts +1516 -0
  16. package/dist/eslint-plugin.d.ts +16 -1560
  17. package/dist/index.d.ts +14 -81
  18. package/dist/index.js +22 -76
  19. package/dist/language/command-resolution.d.ts +47 -13
  20. package/dist/language/command-resolution.js +48 -18
  21. package/dist/language/selector-classes.d.ts +7 -3
  22. package/dist/language/selector-classes.js +13 -4
  23. package/dist/language/shell-language-options.d.ts +3 -3
  24. package/dist/language/shell-language-options.js +12 -17
  25. package/dist/language/shell-language.d.ts +3 -1
  26. package/dist/language/shell-language.js +6 -11
  27. package/dist/language/shell-source-code.d.ts +77 -77
  28. package/dist/language/shell-source-code.js +107 -98
  29. package/dist/language/source-coordinates.d.ts +2 -0
  30. package/dist/language/source-coordinates.js +8 -4
  31. package/dist/language/syntax-view.d.ts +1 -1
  32. package/dist/language/syntax-view.js +19 -7
  33. package/dist/language/word-resolution.d.ts +4 -3
  34. package/dist/language/word-resolution.js +10 -5
  35. package/dist/rules/compat/declaration-options.js +2 -2
  36. package/dist/rules/compat/no-brace-sequence-padding-step.js +1 -1
  37. package/dist/rules/compat/no-mapfile.js +2 -2
  38. package/dist/rules/compat/no-negative-array-index.js +2 -2
  39. package/dist/rules/compat/no-printf-time-format.js +2 -2
  40. package/dist/rules/compat/no-test-v.js +2 -2
  41. package/dist/rules/compat/no-wait-n.js +2 -2
  42. package/dist/rules/compat/posix-absent-command.js +2 -2
  43. package/dist/rules/compat/shopt-options.js +2 -2
  44. package/dist/rules/create-wrapper-rule.d.ts +4 -4
  45. package/dist/rules/create-wrapper-rule.js +19 -13
  46. package/dist/rules/define-shell-rule.js +1 -1
  47. package/dist/rules/no-dynamic-invocation.d.ts +1 -1
  48. package/dist/rules/no-dynamic-invocation.js +12 -4
  49. package/dist/rules/no-eval.js +6 -2
  50. package/dist/rules/no-masked-exit-status.d.ts +4 -3
  51. package/dist/rules/no-masked-exit-status.js +4 -3
  52. package/dist/rules/no-secret-env-reads.d.ts +2 -0
  53. package/dist/rules/no-secret-env-reads.js +14 -3
  54. package/dist/rules/no-secret-flags.d.ts +2 -0
  55. package/dist/rules/no-secret-flags.js +14 -3
  56. package/dist/rules/no-unchecked-cd.js +4 -3
  57. package/dist/rules/no-undeclared-commands.js +10 -4
  58. package/dist/rules/no-unused-declarations.js +13 -4
  59. package/dist/rules/prefer-local.d.ts +3 -2
  60. package/dist/rules/prefer-local.js +4 -2
  61. package/dist/rules/quote-expansions.js +1 -1
  62. package/dist/rules/require-network-wrapper.d.ts +2 -2
  63. package/dist/rules/require-network-wrapper.js +21 -11
  64. package/dist/rules/require-strict-mode.d.ts +5 -46
  65. package/dist/rules/require-strict-mode.js +17 -107
  66. package/dist/rules/require-tty-guard.d.ts +2 -0
  67. package/dist/rules/require-tty-guard.js +9 -2
  68. package/dist/rules/resolve-declaration-convention.d.ts +9 -88
  69. package/dist/rules/resolve-declaration-convention.js +19 -71
  70. package/dist/rules/resolve-network-wrapper.d.ts +3 -4
  71. package/dist/rules/resolve-network-wrapper.js +23 -19
  72. package/dist/rules/resolve-transparent-wrappers.d.ts +3 -8
  73. package/dist/rules/resolve-transparent-wrappers.js +21 -11
  74. package/dist/rules/set-options.d.ts +1 -1
  75. package/dist/rules/set-options.js +1 -1
  76. package/dist/rules/strict-mode-prologue.d.ts +43 -0
  77. package/dist/rules/strict-mode-prologue.js +91 -0
  78. package/dist/rules/transparent-wrappers.d.ts +3 -3
  79. package/dist/rules/transparent-wrappers.js +1 -1
  80. package/dist/rules/user-pattern.d.ts +4 -3
  81. package/dist/rules/user-pattern.js +10 -8
  82. package/dist/shell-dialect.d.ts +8 -0
  83. package/dist/shell-dialect.js +22 -0
  84. package/dist/version.js +2 -1
  85. package/docs/compat.md +5 -6
  86. package/docs/custom-rule-tutorial.md +55 -51
  87. package/docs/declaration-conventions.md +20 -23
  88. package/docs/error-codes.md +94 -0
  89. package/docs/examples/no-backticks-rule.mjs +1 -1
  90. package/docs/examples/no-curl-in-functions-rule.mjs +2 -2
  91. package/docs/examples/no-listed-commands-rule.ts +1 -1
  92. package/docs/examples/no-rm-rf-rule.mjs +8 -10
  93. package/docs/examples/sorted-declarations-rule.mjs +6 -9
  94. package/docs/examples/tsconfig.json +10 -0
  95. package/docs/rules/README.md +12 -4
  96. package/docs/rules/compat/no-nounset-empty-array.md +1 -1
  97. package/docs/rules/no-dynamic-invocation.md +5 -0
  98. package/docs/rules/no-masked-exit-status.md +2 -2
  99. package/docs/rules/no-secret-env-reads.md +13 -3
  100. package/docs/rules/no-secret-flags.md +14 -5
  101. package/docs/rules/no-unchecked-cd.md +15 -2
  102. package/docs/rules/no-undeclared-commands.md +4 -0
  103. package/docs/rules/no-unused-declarations.md +4 -0
  104. package/docs/rules/require-network-wrapper.md +6 -6
  105. package/docs/rules/require-strict-mode.md +25 -23
  106. package/docs/rules/require-tty-guard.md +12 -3
  107. package/docs/selectors.md +7 -2
  108. package/docs/wrapper-rules.md +3 -1
  109. package/package.json +9 -20
  110. package/dist/declaration-conventions/read-declared-commands.d.ts +0 -70
  111. package/dist/eslint-plugin-syntax-analyze.d.ts +0 -23
  112. package/dist/eslint-plugin-syntax.d.ts +0 -31
  113. package/dist/syntax/analyze.d.ts +0 -19
  114. package/dist/syntax/analyze.js +0 -21
  115. package/dist/syntax/index.d.ts +0 -27
  116. package/dist/syntax/index.js +0 -29
@@ -23,9 +23,12 @@ project's `"type"` field.
23
23
 
24
24
  ## 1. Pick a selector from the cookbook
25
25
 
26
- The cookbook's `:command` [launch class](./selectors.md#the-six-launch-classes) matches every
27
- `CallExpr` node — every shell command invocation. That's the selector this tutorial's rule listens
28
- on; `create()` then narrows further (is the command `rm`? does it pass recursive and force short
26
+ The cookbook's `:command` [launch class](./selectors.md#the-six-launch-classes) matches
27
+ `CallExpr` nodes with a command word, exactly the calls in `sourceCode.getCommandInventory().commands`.
28
+ An assignment-only statement such as `FOO=1` does not match; `FOO=1 jq .`, `true`, `:`, and
29
+ dynamic invocations such as `"$tool" file` do. Select `CallExpr` directly to include
30
+ assignment-only calls. This tutorial's rule listens on `:command`; `create()` then narrows further
31
+ (is the command `rm`? does it pass recursive and force short
29
32
  flags, such as `-rf`, `-fr`, or `-r -f`?) the same way a hand-written rule narrows any other
30
33
  selector-first ESLint rule.
31
34
 
@@ -46,15 +49,15 @@ selector-first ESLint rule.
46
49
  * for it, so ESLint refuses to run the rule on a file of any other language.
47
50
  *
48
51
  * Built on the `:command` launch class from the selector cookbook
49
- * (`../selectors.md`) — `:command` matches every `CallExpr`, so `create()`
52
+ * (`../selectors.md`) — `:command` matches calls with a command word, so `create()`
50
53
  * narrows further by inspecting the command word and its flag arguments,
51
54
  * exactly the pattern the cookbook's intro describes ("writing a rule as a
52
55
  * selector string rather than a `create()` full of manual type checks" —
53
56
  * here the selector does the node-type narrowing, `create()` only does the
54
57
  * domain-specific check).
55
58
  *
56
- * Flag words are resolved with `@eslint-sh/eslint-plugin`'s view-aware
57
- * `resolveWord` (backed by `sh-ast/analyze`) rather than a
59
+ * Flag words are resolved with `context.sourceCode.resolveWord`
60
+ * (backed by `sh-analysis`) rather than a
58
61
  * hand-rolled scan: a word is only treated as a short-option cluster
59
62
  * when it is *statically* that string (bare or
60
63
  * quoted literal concatenations). Recursive (`r`/`R`) and force (`f`)
@@ -64,16 +67,14 @@ selector-first ESLint rule.
64
67
  * A word containing a `ParamExp`/`CmdSubst`/`ArithmExp`/
65
68
  * `ProcSubst` resolves to `{ static: false, reason }` (`'expansion'`,
66
69
  * `'tilde'`, `'glob'`, …) rather than being silently erased into a static
67
- * match — see `resolveWord`'s API docs. Importing
68
- * it from the plugin package (rather than `sh-ast/analyze` directly) means
69
- * a project that installs only `@eslint-sh/eslint-plugin` has everything
70
- * this rule needs, with no separate `sh-ast` install or npm-hoisting
71
- * reliance.
70
+ * match — see `ShellSourceCode.resolveWord`'s API docs. The source instance
71
+ * comes from ESLint, so the rule needs no separate `sh-ast` install or
72
+ * dependency-hoisting reliance.
72
73
  *
73
74
  * @see ../custom-rule-tutorial.md — the tutorial this rule backs
74
75
  * @see ../selectors.md — the `:command` launch class
75
76
  */
76
- import { defineShellRule, resolveWord } from '@eslint-sh/eslint-plugin';
77
+ import { defineShellRule } from '@eslint-sh/eslint-plugin';
77
78
 
78
79
  const noRmRf = defineShellRule({
79
80
  meta: {
@@ -91,7 +92,7 @@ const noRmRf = defineShellRule({
91
92
  ':command'(node) {
92
93
  const args = node.args ?? [];
93
94
  const words = args.map((arg) => {
94
- const resolved = resolveWord(arg, { context: 'command-argument' });
95
+ const resolved = context.sourceCode.resolveWord(arg);
95
96
  return resolved.static ? resolved.text : null;
96
97
  });
97
98
 
@@ -138,14 +139,15 @@ compile error. Everything else in `meta`, including your own `docs.url`, is kept
138
139
 
139
140
  A few things worth calling out:
140
141
 
141
- - `defineShellRule` and `resolveWord` both come from `@eslint-sh/eslint-plugin` (or the umbrella
142
- `eslint-sh`). A rule needs no other package: not `sh-ast`, and not `@eslint/core`.
142
+ - `defineShellRule` comes from `@eslint-sh/eslint-plugin` (or the umbrella `eslint-sh`).
143
+ ESLint supplies `context.sourceCode`, including its word-resolution method. A rule needs no
144
+ separate `sh-ast` or `@eslint/core` dependency.
143
145
  - The listener key, `':command'`, is a selector string — one of the [six launch
144
146
  classes](./selectors.md#the-six-launch-classes) — not a bare node-type name. ESLint's
145
147
  `esquery`-based rule-listener matching (via `ShellLanguage.matchesSelectorClass`) treats it
146
148
  exactly like any other selector key such as `CallExpr` or `CallExpr[args.0.parts.0.value='jq']`.
147
- - `resolveWord(arg, { context: 'command-argument' })` — exported from `@eslint-sh/eslint-plugin`
148
- (using the raw Word associated with the lint view) — is the correct way to ask "is this word statically the string X":
149
+ - `context.sourceCode.resolveWord(arg)` uses the raw Word associated with the lint view and
150
+ defaults to command-argument context for `CallExpr.args`. It is the way to ask "is this word statically the string X":
149
151
  it returns `{ static: true, text }` for a bare or
150
152
  quoted literal (`rm`, `'r'm`, `"-rf"` all resolve), and `{ static: false, reason }` the moment any
151
153
  part of the word depends on a `ParamExp`/`CmdSubst`/`ArithmExp`/`ProcSubst` — never inventing a
@@ -220,8 +222,9 @@ this package's test suite against a real `eslint` `Linter.verify()` run (not a h
220
222
 
221
223
  The `:command` listener above sees one `CallExpr` at a time. Some rules need every command in the
222
224
  file together with how each one is reached: inside which function, inside `$(…)`, in which
223
- pipeline stage. `context.sourceCode.getCommandSites()` returns that list, one entry per command in
224
- source order, from `enumerateCommands` (in `@eslint-sh/eslint-plugin/syntax/analyze`). Each
225
+ pipeline stage. `context.sourceCode.getCommandInventory().commands` returns that list, one entry per command in
226
+ source order, from `enumerateCommands` (in `sh-analysis`). This is the represented-command collection,
227
+ not a completeness claim; inspect `getCommandInventory().uncertainties` for opaque boundaries. Each
225
228
  entry has:
226
229
 
227
230
  - `node`: the `CallExpr` node, the same object a `CallExpr` listener receives, so you can report
@@ -249,7 +252,7 @@ An assignment-only statement such as `FOO=1` runs no command and has no entry.
249
252
  * It reports `curl` run anywhere inside a shell function, including through a
250
253
  * wrapper (`sudo curl …`) or inside a command substitution in that function.
251
254
  * Instead of tracking "am I inside a function?" while visiting nodes, it reads
252
- * every command once from `context.sourceCode.getCommandSites()`, whose
255
+ * every command once from `context.sourceCode.getCommandInventory().commands`, whose
253
256
  * `context` frames (outermost first) already say how each command is reached.
254
257
  *
255
258
  * @see ../custom-rule-tutorial.md — the tutorial this rule backs
@@ -270,7 +273,7 @@ const noCurlInFunctions = defineShellRule({
270
273
  create(context) {
271
274
  return {
272
275
  File() {
273
- for (const site of context.sourceCode.getCommandSites()) {
276
+ for (const site of context.sourceCode.getCommandInventory().commands) {
274
277
  const { effective } = site.resolveInvokedCommand();
275
278
  if (!effective.static || effective.text !== 'curl') {
276
279
  continue;
@@ -402,29 +405,28 @@ it reports once, on line 1 from column 13 to column 15: exactly the `&&`. A plai
402
405
 
403
406
  ## 7. Using sh-ast's own operations and types
404
407
 
405
- The records `getSyntax` returns are sh-ast records. A rule that needs sh-ast's own operations or
406
- types for them (to `walk` a record, print an edited copy with `printSync`, run `enumerateCommands`
407
- over a tree, or name a record type such as `BinaryCmd`) imports them from the plugin's subpaths,
408
- never from `sh-ast` directly:
409
-
410
- - `@eslint-sh/eslint-plugin/syntax` (or `eslint-sh/syntax`) has the complete public surface of
411
- `sh-ast`: `parseSync`, `walk`, `printSync`, `PrintOptions`, and the record types such as `Node`,
412
- `Word`, `CallExpr`, `SyntaxPos` and `GoString`.
413
- - `@eslint-sh/eslint-plugin/syntax/analyze` (or `eslint-sh/syntax/analyze`) has the complete
414
- public surface of `sh-ast/analyze`: `enumerateCommands`, `resolveArgv0` (its `chainIndices`
415
- locate a resolved command's arguments in the site's `argv`), `DEFAULT_TRANSPARENT_WRAPPERS`,
416
- `WrapperSpec`, the named operator constants with `rawOperator`, and a raw `resolveWord` that
417
- takes a sh-ast `Node` rather than a lint-view `ShellNode`.
418
-
419
- Both come from the plugin's own `sh-ast` dependency, the same module instance the language parses
420
- with, so you don't install `sh-ast` and its version always matches the records `getSyntax` returns.
421
- They track the plugin's pinned `sh-ast` minor: an `sh-ast` 0.x minor bump is a minor release of the
422
- plugin.
423
-
424
- The low-level `/syntax` export `printSync` retains upstream behavior: literal vertical tabs and
425
- form feeds can change during printing, including inside quotes. It does not apply the high-level
426
- content refusal used by `format` or `getPrintedReplacement`. For an ESLint printed fix, use
427
- `getPrintedReplacement`, which refuses these values with `TypeError`.
408
+ The records `getSyntax` returns belong to `sh-ast`. Install and import raw parser operations,
409
+ syntax types and constants from `sh-ast`; import reusable analysis from `sh-analysis`:
410
+
411
+ ```ts
412
+ import { walk, printSync, type Node, type PrintOptions } from 'sh-ast';
413
+ import { enumerateCommands, resolveArgv0, type CommandInventory } from 'sh-analysis';
414
+ ```
415
+
416
+ The supported dependency ranges are `sh-ast@^0.11.0` and `sh-analysis@^0.1.0`.
417
+ There are no plugin or umbrella syntax forwarding subpaths. Keep using source helpers when you
418
+ need ESLint nodes, UTF-16 locations or fixes: they map the original syntax by identity.
419
+
420
+ `getCommandInventory()` exposes both `commands` and `uncertainties`. The examples here
421
+ report only named, represented commands. They do not establish that a file runs no other code.
422
+ An uncertainty such as `opaque-zsh-subscript` retains the original `FlagsArithm` view and its
423
+ context; raw text is not reparsed as another shell grammar. A security policy requiring all
424
+ execution to be reviewable must handle those boundaries. The built-in
425
+ `no-dynamic-invocation` reports them even in an allowed dispatcher function, and
426
+ `no-unused-declarations` declines deletion whenever they exist.
427
+
428
+ Raw `printSync` preserves the selected Go printer's behavior. Prefer
429
+ `getPrintedReplacement` for checked source edits, including its text-content safeguards.
428
430
 
429
431
  ## 8. Printed fixes
430
432
 
@@ -436,7 +438,7 @@ into an ESLint fix:
436
438
  - `getEditableSyntax(node)` returns an independent copy of the sh-ast record `node` was parsed
437
439
  from. It is an ordinary `structuredClone` of that record, which sh-ast documents as the supported
438
440
  way to get an editable copy. Edit the copy freely: the original record that `getSyntax` returns,
439
- the lint view, and helpers such as `resolveWord` keep seeing the original source. It throws a
441
+ the lint view, and helpers such as `context.sourceCode.resolveWord` keep seeing the original source. It throws a
440
442
  `TypeError` for a node that has no record of its own, such as one you built yourself.
441
443
  - `getPrintedReplacement(node, edited, options)` prints `edited` with sh-ast's `printSync` and
442
444
  returns `{ range, text }`, ready for `fixer.replaceTextRange(range, text)`. The range is
@@ -461,7 +463,7 @@ into an ESLint fix:
461
463
  * new text with `getPrintedReplacement`. The original syntax every other rule
462
464
  * reads stays unchanged.
463
465
  *
464
- * @import { PrintOptions } from '@eslint-sh/eslint-plugin/syntax'
466
+ * @import { PrintOptions } from 'sh-ast'
465
467
  * @see ../custom-rule-tutorial.md — the tutorial this rule backs
466
468
  */
467
469
  import { defineShellRule } from '@eslint-sh/eslint-plugin';
@@ -548,12 +550,12 @@ out the statement's own leading and trailing comments, which lie outside its ran
548
550
  hand-formatted construct, step 9's position-based text edit is the better tool.
549
551
 
550
552
  `PrintOptions`, `Node` and the record types (`CmdSubst`, `Word`, …) are the types of
551
- `@eslint-sh/eslint-plugin/syntax` (step 7), and so is `printSync`, if you want to print a record
553
+ `sh-ast` (step 7), and so is `printSync`, if you want to print a record
552
554
  yourself, for example to compare it with the source before reporting:
553
555
 
554
556
  ```ts
555
- import { printSync } from '@eslint-sh/eslint-plugin/syntax';
556
- import type { Node, PrintOptions } from '@eslint-sh/eslint-plugin/syntax';
557
+ import { printSync } from 'sh-ast';
558
+ import type { Node, PrintOptions } from 'sh-ast';
557
559
  ```
558
560
 
559
561
  ## 9. Position-based text edits
@@ -684,7 +686,7 @@ TypeScript rule needs no `@eslint/core` import and no rule types of its own:
684
686
  - `defineShellRule<Options, MessageIds>(…)` takes the options tuple and message ids as type
685
687
  arguments, or infers the message ids from `meta.messages` when you leave them out. Either way,
686
688
  `context.options` has your options' type, and `context.report` accepts only declared message ids.
687
- - `context.sourceCode` is `ShellSourceCode`, so `getCommandSites()`, `getSyntax()` and the other
689
+ - `context.sourceCode` is `ShellSourceCode`, so `getCommandInventory().commands`, `getSyntax()` and the other
688
690
  helpers are typed without a cast, and a listener keyed by a node type (`CallExpr`, `Word:exit`)
689
691
  receives that node type, so its fields (`args`, `parts`, `cmd`, …) are typed; other selectors
690
692
  receive `ShellNode`, which you narrow on `type`. See [Reading nodes](./reading-nodes.md).
@@ -753,7 +755,7 @@ const noListedCommands = defineShellRule<Options, 'listed'>({
753
755
  const listed = new Set(context.options[0]?.commands ?? []);
754
756
  return {
755
757
  File() {
756
- for (const site of context.sourceCode.getCommandSites()) {
758
+ for (const site of context.sourceCode.getCommandInventory().commands) {
757
759
  reportIfListed(context, site, listed);
758
760
  }
759
761
  },
@@ -930,3 +932,5 @@ TypeError: ESLint configuration in rule-tester is invalid: Key "language": Could
930
932
 
931
933
  Both appear when the test file runs, before any case is checked. A rule built with `defineShellRule`
932
934
  declares `meta.languages: ['sh/sh']`, so ESLint refuses to run it under any other language.
935
+
936
+ See [error codes](error-codes.md) for stable failure identities, source-helper argument boundaries, and dependency pass-through behavior.
@@ -395,20 +395,20 @@ cache and the snapshot that invalidates it, are tested in this package's test su
395
395
  ## Reading the convention in your own rule
396
396
 
397
397
  `sh/no-undeclared-commands` and `sh/no-unused-declarations` are the built-in rules that read the
398
- bound convention. A rule of your own reads it through the same two functions from
399
- `@eslint-sh/eslint-plugin`, so it gets the same behavior without re-implementing it:
400
-
401
- - **`resolveDeclarationConvention(context)`**, from `create()`, returns the convention from the
402
- rule's own `declarationConvention` option, else from `settings.sh.declarationConvention`, else
403
- `null`. With `null`, return no listeners: there is nothing to check. A bound value that isn't a
404
- convention throws the configuration error the built-in rules throw, naming the setting:
405
- `Invalid settings.sh.declarationConvention: expected a declaration convention`, and so on.
406
- - **`readDeclaredCommands(convention, context)`**, from a listener, returns the declarations for
407
- the file `context` is linting. It hands the convention the `LintedFile`, so a sidecar
408
- convention works in your rule too, and it checks every declaration exactly as the built-in
409
- rules do. A missing or unknown `kind`, a missing field, or a `range` outside the text throws
410
- `Invalid settings.sh.declarationConvention: …`. Don't call `convention.declaredCommands` directly: you would get unchecked
411
- values.
398
+ bound convention. A rule of your own calls **`getDeclaredCommands(context)`** from a listener.
399
+ It resolves `settings.sh.declarationConvention` and returns validated declarations, or `null`
400
+ when no convention is bound. A bound convention that declares nothing returns `[]`.
401
+
402
+ The convention receives a frozen `LintedFile` with only `filename`, `physicalFilename` and
403
+ `cwd`, so sidecar conventions work in custom rules too. Invalid bindings or declarations
404
+ (missing or unknown `kind`, missing fields, invalid provenance or a `range` outside the text)
405
+ throw `Invalid settings.sh.declarationConvention: …`. Calling `declaredCommands` directly
406
+ would bypass those checks.
407
+
408
+ A rule that also needs a hook such as `removeDeclaration` can call
409
+ `resolveDeclarationConvention({ settings: context.settings })` to get the validated convention
410
+ object. Shared settings are the only binding route; rule options do not bind conventions.
411
+
412
412
  - Only in-script declarations have a `range`. Check `kind` before reading it: a declaration with
413
413
  `kind` `'file'` or `'described'` lives somewhere your rule can't point at.
414
414
 
@@ -426,8 +426,7 @@ this package's test suite runs it in CI with both `commentPragma` and the
426
426
  */
427
427
  import {
428
428
  defineShellRule,
429
- readDeclaredCommands,
430
- resolveDeclarationConvention,
429
+ getDeclaredCommands,
431
430
  } from '@eslint-sh/eslint-plugin';
432
431
 
433
432
  const sortedDeclarations = defineShellRule({
@@ -437,18 +436,16 @@ const sortedDeclarations = defineShellRule({
437
436
  messages: { unsorted: 'Declare `{{name}}` before `{{previous}}`.' },
438
437
  },
439
438
  create(context) {
440
- // The bound convention, checked exactly as the built-in rules check it;
441
- // `null` when none is bound, and then the rule has nothing to check.
442
- const convention = resolveDeclarationConvention(context);
443
- if (convention === null) {
444
- return {};
445
- }
446
439
  return {
447
440
  File() {
448
441
  const { sourceCode } = context;
449
442
  // The file's declarations, checked as the built-in rules check them.
450
443
  // Only those written in the script have a range to report at.
451
- const declared = readDeclaredCommands(convention, context).filter(
444
+ const declarations = getDeclaredCommands(context);
445
+ if (declarations === null) {
446
+ return;
447
+ }
448
+ const declared = declarations.filter(
452
449
  (each) => each.kind === 'script',
453
450
  );
454
451
  for (let i = 1; i < declared.length; i++) {
@@ -0,0 +1,94 @@
1
+ # Error codes
2
+
3
+ Every deliberate project error has a stable `ESLINT_SH_` code. Match `code` to
4
+ identify a failure; human message text may change. Plain argument/configuration
5
+ errors retain their native `TypeError`, `RangeError` or `Error` prototype. Named
6
+ classes exist where callers need structured data, as listed below.
7
+
8
+ Configuration messages have the shape `<where>: <what is wrong>; received <value>.`
9
+ The path names the binding the caller wrote, including a list index when one
10
+ entry is wrong. Rule-option paths use the configured rule ID, including plugin
11
+ registration aliases; shared settings retain the canonical `settings.sh` namespace.
12
+ Nonfinite numbers are shown as `NaN`, `Infinity` or `-Infinity`, rather than `null`.
13
+ Other values use a short JSON-first rendering, with a fallback for
14
+ undefined, bigint, symbols, functions and values that cannot be serialized.
15
+ Messages are diagnostics, not a serialization format.
16
+
17
+ ```js
18
+ try {
19
+ // Configure the shell language or call a source helper.
20
+ } catch (error) {
21
+ if (error instanceof Error && 'code' in error) {
22
+ console.error(error.code, error.message);
23
+ } else {
24
+ throw error;
25
+ }
26
+ }
27
+ ```
28
+
29
+ ## Project codes
30
+
31
+ | Code | Base/class | Meaning and boundary |
32
+ | --- | --- | --- |
33
+ | `ESLINT_SH_LANGUAGE_OPTION` | `TypeError` | A `languageOptions` value or combination cannot be honored. |
34
+ | `ESLINT_SH_STRICT_MODE_SETTING` | `Error` | The shared `settings.sh.strictModePrologue` fact or one of its fields is malformed. |
35
+ | `ESLINT_SH_WRAPPER_CONFIG` | `TypeError` | A `createWrapperRule config` binding is malformed. |
36
+ | `ESLINT_SH_WRAPPER_SETTING` | `Error` | A shared wrapper binding or spec field is malformed. |
37
+ | `ESLINT_SH_WRAPPER_CONFLICT` | `Error` | Wrapper policies contradict each other or repeat a project name. |
38
+ | `ESLINT_SH_DECLARATION_CONVENTION` | `Error` | The declaration convention or an optional hook has the wrong shape. |
39
+ | `ESLINT_SH_DECLARATION_OUTPUT` | `Error` | A convention returns invalid declarations or a malformed hint. A hook's own exception propagates unchanged. |
40
+ | `ESLINT_SH_PATTERN_SYNTAX` | `TypeError` | A rule option is not a valid Unicode regular expression. `cause` preserves the JavaScript compiler's error. |
41
+ | `ESLINT_SH_PATTERN_REPETITION` | `TypeError` | A valid pattern nests repeating quantifiers and is refused by the documented pattern policy. |
42
+ | `ESLINT_SH_FILE_NODE` | `TypeError` | A helper requires a file associated with this adapter's parse. |
43
+ | `ESLINT_SH_CALL_NODE` | `TypeError` | A command helper requires a parsed `CallExpr` view. |
44
+ | `ESLINT_SH_WORD_NODE` | `TypeError` | A word helper requires a parsed `Word` view. A dynamic word is a normal resolution result. |
45
+ | `ESLINT_SH_COMMAND_SITE_VIEW` | `Error` | An analyzed command site has no corresponding view in the supplied file. |
46
+ | `ESLINT_SH_COMMAND_UNCERTAINTY_VIEW` | `Error` | An analysis uncertainty has no original lint view in this file; inventory mapping fails rather than dropping it. |
47
+ | `ESLINT_SH_FOREIGN_VIEW_NODE` | `TypeError` | A printed-fix helper received a view with no original syntax in this file. |
48
+ | `ESLINT_SH_SYNTAX_POSITION` | `TypeError` | A position argument does not have the required `SyntaxPos` shape. |
49
+ | `ESLINT_SH_SOURCE_INDEX` | `TypeError` | A source index is not numeric. |
50
+ | `ESLINT_SH_SOURCE_LOCATION` | `TypeError` | A source location lacks numeric line/column fields. |
51
+ | `ESLINT_SH_SOURCE_RANGE` | `RangeError` | A position is inexact, outside the source, or inside a UTF-8 character. |
52
+ | `ESLINT_SH_SYNTAX_VIEW` | `TypeError` | Upstream records and their position snapshot cannot produce a faithful lint view. This is a projection invariant failure, not a syntax diagnostic. |
53
+ | `ESLINT_SH_PRINT_ROOT` | `TypeError` | Edited syntax is missing a record type or uses an unsupported printable root. |
54
+ | `ESLINT_SH_PRINT_ENCODING` | `TypeError` | Printed bytes cannot become a UTF-8 text fix without loss. |
55
+ | `ESLINT_SH_PRINT_UNSAFE_TEXT` | `TypeError` | Edited syntax contains literal vertical tabs or form feeds the printer changes. |
56
+ | `ESLINT_SH_PACKAGE_METADATA` | `Error` | The plugin package lacks a string version. Filesystem/JSON errors keep their native identity. |
57
+
58
+ Formatting/editor failures are documented by the independently maintained
59
+ [sh-codemod](https://github.com/mike-north/sh-codemod#readme) project and use its
60
+ `SH_CODEMOD_` namespace. They are not plugin errors.
61
+
62
+ ## Dependency boundaries
63
+
64
+ Direct `sh-ast` and `sh-analysis` imports retain their own errors and codes without aliases. The
65
+ plugin's source helpers also preserve analysis resource/invalid-wrapper failures,
66
+ and printed replacements preserve upstream printer errors. Returning a partial
67
+ command inventory on a depth refusal would silently omit real commands.
68
+
69
+ | Dependency code | Meaning |
70
+ | --- | --- |
71
+ | `SH_AST_SYNTAX_PARSE` | Invalid shell source. The language presents fatal diagnostics; raw syntax calls retain the error. |
72
+ | `SH_AST_SYNTAX_LANG` | Source is invalid in the selected dialect. Same boundary as parse errors. |
73
+ | `SH_AST_SYNTAX_INPUT` | The raw parser/printer rejects an input value. High-level project option validation happens before parsing; non-option input errors pass through. |
74
+ | `SH_AST_SYNTAX_PRINT` | Printer request cannot be honored. |
75
+ | `SH_AST_SYNTAX_PRINT_PANIC` | Upstream printer failure. |
76
+ | `SH_AST_WALK_PANIC` | Upstream syntax traversal failure. |
77
+ | `SH_AST_PARSE_MAX_DEPTH` | Parser resource limit; no partial tree or formatted output is returned. |
78
+ | `SH_ANALYSIS_MAX_DEPTH` | Analysis resource limit; no partial inventory is returned. |
79
+ | `SH_ANALYSIS_RESOURCE` | Analysis-owned brace-observation copying exceeded the host stack. The error retains operation `brace-observation-copy` and its original `RangeError` cause; source helpers propagate it unchanged. |
80
+ | `SH_ANALYSIS_INVALID_WRAPPER_SPEC` | A raw analysis wrapper table or model is invalid, including non-object entries and missing array elements. Shared settings also have their own project configuration validation. |
81
+ | `SH_AST_INTERNAL` | Upstream bridge/internal failure. |
82
+
83
+ ESLint wraps errors from language-option validation in its own `TypeError`.
84
+ Direct calls to `plugin.languages.sh.validateLanguageOptions` expose the project
85
+ code on the thrown error; an ESLint configuration failure preserves that error
86
+ and its code on `cause`. Shared-setting and rule-factory errors propagate through
87
+ ESLint rule loading with their project codes intact.
88
+
89
+ The language's `parse` entry point returns ESLint fatal diagnostics rather than
90
+ throwing. Syntax diagnostics retain their source positions, resource refusals
91
+ remain resource diagnostics, and runtime failures remain distinguished from
92
+ invalid shell. ESLint's own schema errors, third-party hook exceptions and native
93
+ runtime failures are not project-owned intentional errors and keep their
94
+ existing contracts. Check each method's `@throws` for its precise boundary.
@@ -11,7 +11,7 @@
11
11
  * new text with `getPrintedReplacement`. The original syntax every other rule
12
12
  * reads stays unchanged.
13
13
  *
14
- * @import { PrintOptions } from '@eslint-sh/eslint-plugin/syntax'
14
+ * @import { PrintOptions } from 'sh-ast'
15
15
  * @see ../custom-rule-tutorial.md — the tutorial this rule backs
16
16
  */
17
17
  import { defineShellRule } from '@eslint-sh/eslint-plugin';
@@ -7,7 +7,7 @@
7
7
  * It reports `curl` run anywhere inside a shell function, including through a
8
8
  * wrapper (`sudo curl …`) or inside a command substitution in that function.
9
9
  * Instead of tracking "am I inside a function?" while visiting nodes, it reads
10
- * every command once from `context.sourceCode.getCommandSites()`, whose
10
+ * every command once from `context.sourceCode.getCommandInventory().commands`, whose
11
11
  * `context` frames (outermost first) already say how each command is reached.
12
12
  *
13
13
  * @see ../custom-rule-tutorial.md — the tutorial this rule backs
@@ -28,7 +28,7 @@ const noCurlInFunctions = defineShellRule({
28
28
  create(context) {
29
29
  return {
30
30
  File() {
31
- for (const site of context.sourceCode.getCommandSites()) {
31
+ for (const site of context.sourceCode.getCommandInventory().commands) {
32
32
  const { effective } = site.resolveInvokedCommand();
33
33
  if (!effective.static || effective.text !== 'curl') {
34
34
  continue;
@@ -52,7 +52,7 @@ const noListedCommands = defineShellRule<Options, 'listed'>({
52
52
  const listed = new Set(context.options[0]?.commands ?? []);
53
53
  return {
54
54
  File() {
55
- for (const site of context.sourceCode.getCommandSites()) {
55
+ for (const site of context.sourceCode.getCommandInventory().commands) {
56
56
  reportIfListed(context, site, listed);
57
57
  }
58
58
  },
@@ -10,15 +10,15 @@
10
10
  * for it, so ESLint refuses to run the rule on a file of any other language.
11
11
  *
12
12
  * Built on the `:command` launch class from the selector cookbook
13
- * (`../selectors.md`) — `:command` matches every `CallExpr`, so `create()`
13
+ * (`../selectors.md`) — `:command` matches calls with a command word, so `create()`
14
14
  * narrows further by inspecting the command word and its flag arguments,
15
15
  * exactly the pattern the cookbook's intro describes ("writing a rule as a
16
16
  * selector string rather than a `create()` full of manual type checks" —
17
17
  * here the selector does the node-type narrowing, `create()` only does the
18
18
  * domain-specific check).
19
19
  *
20
- * Flag words are resolved with `@eslint-sh/eslint-plugin`'s view-aware
21
- * `resolveWord` (backed by `sh-ast/analyze`) rather than a
20
+ * Flag words are resolved with `context.sourceCode.resolveWord`
21
+ * (backed by `sh-analysis`) rather than a
22
22
  * hand-rolled scan: a word is only treated as a short-option cluster
23
23
  * when it is *statically* that string (bare or
24
24
  * quoted literal concatenations). Recursive (`r`/`R`) and force (`f`)
@@ -28,16 +28,14 @@
28
28
  * A word containing a `ParamExp`/`CmdSubst`/`ArithmExp`/
29
29
  * `ProcSubst` resolves to `{ static: false, reason }` (`'expansion'`,
30
30
  * `'tilde'`, `'glob'`, …) rather than being silently erased into a static
31
- * match — see `resolveWord`'s API docs. Importing
32
- * it from the plugin package (rather than `sh-ast/analyze` directly) means
33
- * a project that installs only `@eslint-sh/eslint-plugin` has everything
34
- * this rule needs, with no separate `sh-ast` install or npm-hoisting
35
- * reliance.
31
+ * match — see `ShellSourceCode.resolveWord`'s API docs. The source instance
32
+ * comes from ESLint, so the rule needs no separate `sh-ast` install or
33
+ * dependency-hoisting reliance.
36
34
  *
37
35
  * @see ../custom-rule-tutorial.md — the tutorial this rule backs
38
36
  * @see ../selectors.md — the `:command` launch class
39
37
  */
40
- import { defineShellRule, resolveWord } from '@eslint-sh/eslint-plugin';
38
+ import { defineShellRule } from '@eslint-sh/eslint-plugin';
41
39
 
42
40
  const noRmRf = defineShellRule({
43
41
  meta: {
@@ -55,7 +53,7 @@ const noRmRf = defineShellRule({
55
53
  ':command'(node) {
56
54
  const args = node.args ?? [];
57
55
  const words = args.map((arg) => {
58
- const resolved = resolveWord(arg, { context: 'command-argument' });
56
+ const resolved = context.sourceCode.resolveWord(arg);
59
57
  return resolved.static ? resolved.text : null;
60
58
  });
61
59
 
@@ -5,8 +5,7 @@
5
5
  */
6
6
  import {
7
7
  defineShellRule,
8
- readDeclaredCommands,
9
- resolveDeclarationConvention,
8
+ getDeclaredCommands,
10
9
  } from '@eslint-sh/eslint-plugin';
11
10
 
12
11
  const sortedDeclarations = defineShellRule({
@@ -16,18 +15,16 @@ const sortedDeclarations = defineShellRule({
16
15
  messages: { unsorted: 'Declare `{{name}}` before `{{previous}}`.' },
17
16
  },
18
17
  create(context) {
19
- // The bound convention, checked exactly as the built-in rules check it;
20
- // `null` when none is bound, and then the rule has nothing to check.
21
- const convention = resolveDeclarationConvention(context);
22
- if (convention === null) {
23
- return {};
24
- }
25
18
  return {
26
19
  File() {
27
20
  const { sourceCode } = context;
28
21
  // The file's declarations, checked as the built-in rules check them.
29
22
  // Only those written in the script have a range to report at.
30
- const declared = readDeclaredCommands(convention, context).filter(
23
+ const declarations = getDeclaredCommands(context);
24
+ if (declarations === null) {
25
+ return;
26
+ }
27
+ const declared = declarations.filter(
31
28
  (each) => each.kind === 'script',
32
29
  );
33
30
  for (let i = 1; i < declared.length; i++) {
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "composite": false
6
+ },
7
+ "include": [
8
+ "*.ts"
9
+ ]
10
+ }
@@ -27,7 +27,7 @@ See the [canonical quickstart](https://github.com/mike-north/eslint-sh/blob/main
27
27
  | [`sh/compat/no-mapfile`](./compat/no-mapfile.md) | `bash-3.2`, `posix-portable` | No | Yes | Disallow `mapfile` / `readarray` when the target shell lacks them, suggesting a read loop. |
28
28
  | [`sh/compat/no-nameref`](./compat/no-nameref.md) | `bash-3.2`, `posix-portable` | No | No | Disallow namerefs (`declare -n`, `local -n`) when the target shell lacks them. |
29
29
  | [`sh/compat/no-negative-array-index`](./compat/no-negative-array-index.md) | `bash-3.2`, `posix-portable` | No | Yes | Disallow negative array subscripts when the target shell lacks them, suggesting a length-based index. |
30
- | [`sh/compat/no-nounset-empty-array`](./compat/no-nounset-empty-array.md) | `posix-portable` | No | Yes | Disallow whole-array expansions under `set -u` when the target shell aborts on an empty array, suggesting a guarded form. |
30
+ | [`sh/compat/no-nounset-empty-array`](./compat/no-nounset-empty-array.md) | None (opt-in) | No | Yes | Disallow whole-array expansions under `set -u` when the target shell aborts on an empty array, suggesting a guarded form. |
31
31
  | [`sh/compat/no-parameter-transformation`](./compat/no-parameter-transformation.md) | `bash-3.2`, `posix-portable` | No | No | Disallow `${v@op}` transformations when the target shell lacks the operator. |
32
32
  | [`sh/compat/no-pipe-all`](./compat/no-pipe-all.md) | `bash-3.2`, `posix-portable` | No | Yes | Disallow the stderr-merging pipe (pipe-ampersand) when the target shell lacks it, suggesting an explicit `2>&1` before the pipe. |
33
33
  | [`sh/compat/no-printf-time-format`](./compat/no-printf-time-format.md) | `bash-3.2`, `posix-portable` | No | No | Disallow `printf`'s `%(fmt)T` date format when the target shell lacks it. |
@@ -48,7 +48,7 @@ See the [canonical quickstart](https://github.com/mike-north/eslint-sh/blob/main
48
48
  | [`sh/quote-expansions`](./quote-expansions.md) | `recommended`, `agent-authored` | No | Yes | Require double quotes around expansions in words the shell splits and globs. |
49
49
  | [`sh/require-network-wrapper`](./require-network-wrapper.md) | `agent-authored` | No | No | Require network commands to run through your configured wrapper. |
50
50
  | [`sh/require-shebang`](./require-shebang.md) | `recommended`, `agent-authored` | Yes (missing shebang only) | No | Require a recognized shell interpreter on line 1. |
51
- | [`sh/require-strict-mode`](./require-strict-mode.md) | `recommended`, `agent-authored`, `posix-portable` (with set -eu) | Yes (when insertion satisfies the rule) | No | Require strict-mode options near the start of the script. |
51
+ | [`sh/require-strict-mode`](./require-strict-mode.md) | `recommended`, `agent-authored` | Yes (when insertion satisfies the rule) | No | Require strict-mode options near the start of the script. |
52
52
  | [`sh/require-tty-guard`](./require-tty-guard.md) | `agent-authored` | No | Yes | Require `read`, `select` and configured interactive commands to be guarded by a TTY test or supplied input. |
53
53
  | [`sh/shebang-matches-dialect`](./shebang-matches-dialect.md) | `recommended`, `agent-authored`, `posix-portable` | No | No | Require the shebang to name the same kind of shell (bash or POSIX) as `languageOptions.dialect`. |
54
54
 
@@ -64,10 +64,10 @@ shell features that your target shell lacks, as set by `languageOptions.minBashV
64
64
  `dialect`. They report nothing when `minBashVersion` is unset, so the `bash-3.2` preset sets it to `3.2`
65
65
  and the `posix-portable` preset sets `dialect: "posix"`. `bash-3.2` enables all except
66
66
  `compat/no-nounset-empty-array`, which is opt-in for scripts using `set -u` on Bash below 4.4
67
- with arrays that can really be empty; `posix-portable` retains all of them.
67
+ with arrays that can really be empty; `posix-portable` omits that Bash-only check because it cannot fire there.
68
68
  See [version compatibility](../compat.md). `compat/*` means target gates only; `shebang-matches-dialect`
69
69
  compares the file with your config whatever the target, so it lives outside that namespace. `posix-portable` also enables
70
- `shebang-matches-dialect`, `require-strict-mode` (as `set -eu`) and the POSIX-only gates
70
+ `shebang-matches-dialect` (to check the target against the declared interpreter) and the POSIX-only gates
71
71
  `compat/no-double-bracket`, `compat/no-let` and `compat/no-source`, which report those constructs
72
72
  under `dialect: "posix"` because they fail on dash. It does not report `local`, `echo -e` or the
73
73
  other constructs listed under
@@ -80,6 +80,14 @@ To run these rules beside shellcheck, see [shellcheck](../shellcheck.md).
80
80
  [wrapper rules](../wrapper-rules.md)). Each linked rule page documents its options, limitations,
81
81
  and relationship to shellcheck.
82
82
 
83
+ ## Replacement and additive lists
84
+
85
+ For the secret rules, `patterns` replaces the defaults and `additionalPatterns` adds to the
86
+ replacement (or defaults when omitted). For the TTY and network wrapper rules, `commands` and
87
+ `additionalCommands` have the same relationship. An empty replacement removes defaults; an empty
88
+ addition changes nothing. Overlapping entries do not duplicate findings. Lists without defaults,
89
+ such as `allowedSinks`, retain their plain names. Shared wrapper settings follow their own contract.
90
+
83
91
  ## Regular-expression options
84
92
 
85
93
  Every regular-expression source in a rule option is compiled with JavaScript's `u` flag
@@ -6,7 +6,7 @@ ships as `/bin/bash`.
6
6
 
7
7
  | Configs | Fixable | Languages |
8
8
  | ------- | ------- | --------- |
9
- | `posix-portable` | suggestions | `sh/sh` |
9
+ | None (opt-in) | suggestions | `sh/sh` |
10
10
 
11
11
  ## Rule details
12
12
 
@@ -142,3 +142,8 @@ shellcheck has no equivalent. It treats a dynamic command word as legitimate she
142
142
  warns about how it is written, such as unquoted expansions (SC2086) or a string used where an
143
143
  array belongs (SC2089/SC2090). It can't express the policy that every command must be
144
144
  statically enumerable, which is what makes a script reviewable as a whole.
145
+
146
+ Opaque executable syntax is exposed separately in the source command inventory.
147
+ This rule reports `opaqueExecutable` at the original opaque construct, including
148
+ inside `allowInFunctions` dispatcher scopes. That exemption permits computed
149
+ command words; embedded executable text still requires review.
@@ -136,7 +136,7 @@ does not depend on `languageOptions`.
136
136
  | Option | Type | Default | Effect |
137
137
  | ----------------- | ---------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
138
138
  | `onlyWithErrexit` | `boolean` | `false` | Report only where `errexit` is known to be on (below). |
139
- | `allowShebangOnly` | `boolean` | `false` | With `onlyWithErrexit`, count options on the shebang line (`#!/bin/bash -e`, `#!/bin/sh -e`, `#!/usr/bin/env -S bash -e`) as enabled. Same meaning and default as the option of that name in [`require-strict-mode`](./require-strict-mode.md), and read by the same code. |
139
+ | `allowShebangOnly` | `boolean` | `false` | With `onlyWithErrexit`, count options on the shebang line (`#!/bin/bash -e`, `#!/bin/sh -e`, `#!/usr/bin/env -S bash -e`) as enabled. Uses the shared shebang parser. This rule retains its own sequential-state policy; [`require-strict-mode`](./require-strict-mode.md) uses the shared prologue setting. |
140
140
  | `builtins` | `string[]` | `["local", "declare", "typeset", "export", "readonly"]` | Which declaration builtins to check, for example `["local"]` for teams that accept `export X=$(…)` at the top level. |
141
141
 
142
142
  **Where `errexit` is on.** The rule reads the plain top-level `set` statements (`set -e`,
@@ -147,7 +147,7 @@ statements counts for the code after it. Unlike `require-strict-mode` there is n
147
147
  window, because the order is tracked. A function body is read at the point where it is defined, so
148
148
  `set -e` before `f() { … }` covers `f`.
149
149
 
150
- `allowShebangOnly` is off by default for the reason it is off in `require-strict-mode`: options on the
150
+ `allowShebangOnly` is off by default for the reason it is off in the shared prologue definition: options on the
151
151
  shebang line apply only when the script is run directly, and `bash script.sh` ignores them. Turn it
152
152
  on if your scripts are always executed directly.
153
153