eslint-sh 0.0.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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/eslint-sh.d.ts +5 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mike North
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# eslint-sh
|
|
2
|
+
|
|
3
|
+
Shell script parsing and syntax-error reporting for ESLint, with custom-rule authoring over a
|
|
4
|
+
typed shell AST.
|
|
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
|
+
|
|
9
|
+
**Roadmap:** built-in lint rules and shared configs are planned but not implemented yet.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install --save-dev eslint-sh
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
This release reports shell syntax (parse) errors only — no lint rules ship yet, so a "0 problems"
|
|
20
|
+
result means the script parsed without a syntax error, not that it is problem-free.
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
// eslint.config.mjs
|
|
24
|
+
import { defineConfig } from 'eslint/config';
|
|
25
|
+
import sh from 'eslint-sh'; // equivalent to: import sh from '@eslint-sh/eslint-plugin'
|
|
26
|
+
|
|
27
|
+
export default defineConfig([
|
|
28
|
+
{
|
|
29
|
+
files: ['**/*.sh', '**/*.bash'],
|
|
30
|
+
plugins: { sh },
|
|
31
|
+
language: 'sh/sh',
|
|
32
|
+
languageOptions: { dialect: 'bash', shellVersion: '3.2' },
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
```
|
|
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
|
+
|
|
64
|
+
## Status
|
|
65
|
+
|
|
66
|
+
Thin umbrella re-exporting `@eslint-sh/eslint-plugin`'s plugin object unchanged as this
|
|
67
|
+
package's default export — `import sh from "eslint-sh"` and `import sh from "@eslint-sh/eslint-plugin"`
|
|
68
|
+
refer to the same object. `@eslint-sh/eslint-plugin` currently ships `ShellLanguage`/
|
|
69
|
+
`ShellSourceCode` only; rules and shared configs are not implemented yet. Disable directives /
|
|
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/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import sh from '@eslint-sh/eslint-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* `eslint-sh` — the unscoped umbrella package (design/PACKAGES.md's Naming
|
|
4
|
+
* decision). Re-exports `@eslint-sh/eslint-plugin`'s plugin object
|
|
5
|
+
* unchanged as this package's default export, so `import sh from
|
|
6
|
+
* "eslint-sh"` and `import sh from "@eslint-sh/eslint-plugin"` are
|
|
7
|
+
* equivalent.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export default sh;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAE1C;;;;;;;;GAQG;AACH,eAAe,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import sh from '@eslint-sh/eslint-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* `eslint-sh` — the unscoped umbrella package (design/PACKAGES.md's Naming
|
|
4
|
+
* decision). Re-exports `@eslint-sh/eslint-plugin`'s plugin object
|
|
5
|
+
* unchanged as this package's default export, so `import sh from
|
|
6
|
+
* "eslint-sh"` and `import sh from "@eslint-sh/eslint-plugin"` are
|
|
7
|
+
* equivalent.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export default sh;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAE1C;;;;;;;;GAQG;AACH,eAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-sh",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"description": "Shell script parsing and syntax-error reporting for ESLint, with custom-rule authoring over a typed shell AST",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"author": "Mike North <michael.l.north@gmail.com>",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@eslint-sh/eslint-plugin": "0.1.1"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"eslint": "^10.7.0"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"eslint": "^10.0.0"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/eslint-sh.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
8
20
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"nx": {
|
|
27
|
+
"targets": {
|
|
28
|
+
"check:api-report": {
|
|
29
|
+
"outputs": [
|
|
30
|
+
"{projectRoot}/api-report",
|
|
31
|
+
"{projectRoot}/temp",
|
|
32
|
+
"{projectRoot}/dist/eslint-sh.d.ts"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"uplevel-api-reports": {
|
|
36
|
+
"dependsOn": [
|
|
37
|
+
"check:api-report"
|
|
38
|
+
],
|
|
39
|
+
"cache": true,
|
|
40
|
+
"inputs": [
|
|
41
|
+
"{projectRoot}/api-report/**",
|
|
42
|
+
"{projectRoot}/temp/**"
|
|
43
|
+
],
|
|
44
|
+
"outputs": [
|
|
45
|
+
"{workspaceRoot}/api-report-combined/eslint-sh.api.md",
|
|
46
|
+
"{workspaceRoot}/api-docs-temp/eslint-sh.api.json"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"type": "module",
|
|
55
|
+
"types": "./dist/eslint-sh.d.ts",
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc -p tsconfig.json",
|
|
58
|
+
"check": "concurrently -n lint,types,api-report \"pnpm run check:lint-ts\" \"pnpm run check:typecheck\" \"pnpm run check:api-report\"",
|
|
59
|
+
"check:api-report": "api-extractor run",
|
|
60
|
+
"check:lint-ts": "eslint .",
|
|
61
|
+
"check:typecheck": "tsc --noEmit",
|
|
62
|
+
"clean": "rimraf --glob dist \"temp/*\" \"*.tsbuildinfo\"",
|
|
63
|
+
"fix:api-report": "api-extractor run --local",
|
|
64
|
+
"fix:lint-ts": "eslint . --fix",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"uplevel-api-reports": "mkdir -p ../../api-report-combined ../../api-docs-temp && cp api-report/eslint-sh.api.md ../../api-report-combined/ && cp temp/eslint-sh.api.json ../../api-docs-temp/"
|
|
67
|
+
}
|
|
68
|
+
}
|