lostconf 0.2.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/CHANGELOG.md +83 -0
- package/LICENSE +21 -0
- package/LICENSE.md +21 -0
- package/README.md +445 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +139 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/discovery.d.ts +23 -0
- package/dist/core/discovery.d.ts.map +1 -0
- package/dist/core/discovery.js +75 -0
- package/dist/core/discovery.js.map +1 -0
- package/dist/core/engine.d.ts +24 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/engine.js +86 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/severity.d.ts +25 -0
- package/dist/core/severity.d.ts.map +1 -0
- package/dist/core/severity.js +225 -0
- package/dist/core/severity.js.map +1 -0
- package/dist/core/types.d.ts +77 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +21 -0
- package/dist/core/types.js.map +1 -0
- package/dist/filetree/scanner.d.ts +26 -0
- package/dist/filetree/scanner.d.ts.map +1 -0
- package/dist/filetree/scanner.js +71 -0
- package/dist/filetree/scanner.js.map +1 -0
- package/dist/filetree/tree.d.ts +5 -0
- package/dist/filetree/tree.d.ts.map +1 -0
- package/dist/filetree/tree.js +5 -0
- package/dist/filetree/tree.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatter.d.ts +12 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +5 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/json.d.ts +9 -0
- package/dist/output/json.d.ts.map +1 -0
- package/dist/output/json.js +14 -0
- package/dist/output/json.js.map +1 -0
- package/dist/output/sarif.d.ts +9 -0
- package/dist/output/sarif.d.ts.map +1 -0
- package/dist/output/sarif.js +84 -0
- package/dist/output/sarif.js.map +1 -0
- package/dist/output/text.d.ts +9 -0
- package/dist/output/text.d.ts.map +1 -0
- package/dist/output/text.js +87 -0
- package/dist/output/text.js.map +1 -0
- package/dist/parsers/bandit.d.ts +8 -0
- package/dist/parsers/bandit.d.ts.map +1 -0
- package/dist/parsers/bandit.js +66 -0
- package/dist/parsers/bandit.js.map +1 -0
- package/dist/parsers/biome.d.ts +8 -0
- package/dist/parsers/biome.d.ts.map +1 -0
- package/dist/parsers/biome.js +74 -0
- package/dist/parsers/biome.js.map +1 -0
- package/dist/parsers/clang.d.ts +9 -0
- package/dist/parsers/clang.d.ts.map +1 -0
- package/dist/parsers/clang.js +99 -0
- package/dist/parsers/clang.js.map +1 -0
- package/dist/parsers/deno.d.ts +8 -0
- package/dist/parsers/deno.d.ts.map +1 -0
- package/dist/parsers/deno.js +73 -0
- package/dist/parsers/deno.js.map +1 -0
- package/dist/parsers/dotnet.d.ts +9 -0
- package/dist/parsers/dotnet.d.ts.map +1 -0
- package/dist/parsers/dotnet.js +89 -0
- package/dist/parsers/dotnet.js.map +1 -0
- package/dist/parsers/elixir.d.ts +7 -0
- package/dist/parsers/elixir.d.ts.map +1 -0
- package/dist/parsers/elixir.js +59 -0
- package/dist/parsers/elixir.js.map +1 -0
- package/dist/parsers/eslint.d.ts +7 -0
- package/dist/parsers/eslint.d.ts.map +1 -0
- package/dist/parsers/eslint.js +43 -0
- package/dist/parsers/eslint.js.map +1 -0
- package/dist/parsers/flake8.d.ts +10 -0
- package/dist/parsers/flake8.d.ts.map +1 -0
- package/dist/parsers/flake8.js +89 -0
- package/dist/parsers/flake8.js.map +1 -0
- package/dist/parsers/gitignore.d.ts +11 -0
- package/dist/parsers/gitignore.d.ts.map +1 -0
- package/dist/parsers/gitignore.js +72 -0
- package/dist/parsers/gitignore.js.map +1 -0
- package/dist/parsers/gitleaks.d.ts +8 -0
- package/dist/parsers/gitleaks.d.ts.map +1 -0
- package/dist/parsers/gitleaks.js +127 -0
- package/dist/parsers/gitleaks.js.map +1 -0
- package/dist/parsers/golangci.d.ts +7 -0
- package/dist/parsers/golangci.d.ts.map +1 -0
- package/dist/parsers/golangci.js +73 -0
- package/dist/parsers/golangci.js.map +1 -0
- package/dist/parsers/hadolint.d.ts +8 -0
- package/dist/parsers/hadolint.d.ts.map +1 -0
- package/dist/parsers/hadolint.js +95 -0
- package/dist/parsers/hadolint.js.map +1 -0
- package/dist/parsers/index.d.ts +38 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +154 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/java.d.ts +11 -0
- package/dist/parsers/java.d.ts.map +1 -0
- package/dist/parsers/java.js +75 -0
- package/dist/parsers/java.js.map +1 -0
- package/dist/parsers/jest.d.ts +7 -0
- package/dist/parsers/jest.d.ts.map +1 -0
- package/dist/parsers/jest.js +118 -0
- package/dist/parsers/jest.js.map +1 -0
- package/dist/parsers/kotlin.d.ts +7 -0
- package/dist/parsers/kotlin.d.ts.map +1 -0
- package/dist/parsers/kotlin.js +90 -0
- package/dist/parsers/kotlin.js.map +1 -0
- package/dist/parsers/markdown.d.ts +7 -0
- package/dist/parsers/markdown.d.ts.map +1 -0
- package/dist/parsers/markdown.js +40 -0
- package/dist/parsers/markdown.js.map +1 -0
- package/dist/parsers/php.d.ts +9 -0
- package/dist/parsers/php.d.ts.map +1 -0
- package/dist/parsers/php.js +92 -0
- package/dist/parsers/php.js.map +1 -0
- package/dist/parsers/prettier.d.ts +7 -0
- package/dist/parsers/prettier.d.ts.map +1 -0
- package/dist/parsers/prettier.js +43 -0
- package/dist/parsers/prettier.js.map +1 -0
- package/dist/parsers/pylint.d.ts +8 -0
- package/dist/parsers/pylint.d.ts.map +1 -0
- package/dist/parsers/pylint.js +92 -0
- package/dist/parsers/pylint.js.map +1 -0
- package/dist/parsers/pyproject.d.ts +7 -0
- package/dist/parsers/pyproject.d.ts.map +1 -0
- package/dist/parsers/pyproject.js +127 -0
- package/dist/parsers/pyproject.js.map +1 -0
- package/dist/parsers/pyright.d.ts +8 -0
- package/dist/parsers/pyright.d.ts.map +1 -0
- package/dist/parsers/pyright.js +63 -0
- package/dist/parsers/pyright.js.map +1 -0
- package/dist/parsers/rubocop.d.ts +7 -0
- package/dist/parsers/rubocop.d.ts.map +1 -0
- package/dist/parsers/rubocop.js +102 -0
- package/dist/parsers/rubocop.js.map +1 -0
- package/dist/parsers/rust.d.ts +9 -0
- package/dist/parsers/rust.d.ts.map +1 -0
- package/dist/parsers/rust.js +68 -0
- package/dist/parsers/rust.js.map +1 -0
- package/dist/parsers/scala.d.ts +9 -0
- package/dist/parsers/scala.d.ts.map +1 -0
- package/dist/parsers/scala.js +72 -0
- package/dist/parsers/scala.js.map +1 -0
- package/dist/parsers/semgrep.d.ts +10 -0
- package/dist/parsers/semgrep.d.ts.map +1 -0
- package/dist/parsers/semgrep.js +111 -0
- package/dist/parsers/semgrep.js.map +1 -0
- package/dist/parsers/shellcheck.d.ts +8 -0
- package/dist/parsers/shellcheck.d.ts.map +1 -0
- package/dist/parsers/shellcheck.js +49 -0
- package/dist/parsers/shellcheck.js.map +1 -0
- package/dist/parsers/stylelint.d.ts +9 -0
- package/dist/parsers/stylelint.d.ts.map +1 -0
- package/dist/parsers/stylelint.js +95 -0
- package/dist/parsers/stylelint.js.map +1 -0
- package/dist/parsers/swift.d.ts +7 -0
- package/dist/parsers/swift.d.ts.map +1 -0
- package/dist/parsers/swift.js +64 -0
- package/dist/parsers/swift.js.map +1 -0
- package/dist/parsers/tflint.d.ts +8 -0
- package/dist/parsers/tflint.d.ts.map +1 -0
- package/dist/parsers/tflint.js +59 -0
- package/dist/parsers/tflint.js.map +1 -0
- package/dist/parsers/typescript.d.ts +7 -0
- package/dist/parsers/typescript.d.ts.map +1 -0
- package/dist/parsers/typescript.js +138 -0
- package/dist/parsers/typescript.js.map +1 -0
- package/dist/parsers/yamllint.d.ts +8 -0
- package/dist/parsers/yamllint.d.ts.map +1 -0
- package/dist/parsers/yamllint.js +93 -0
- package/dist/parsers/yamllint.js.map +1 -0
- package/dist/plugin/registry.d.ts +20 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/registry.js +52 -0
- package/dist/plugin/registry.js.map +1 -0
- package/dist/plugin/types.d.ts +16 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin/types.js +5 -0
- package/dist/plugin/types.js.map +1 -0
- package/dist/validator/glob.d.ts +16 -0
- package/dist/validator/glob.d.ts.map +1 -0
- package/dist/validator/glob.js +44 -0
- package/dist/validator/glob.js.map +1 -0
- package/dist/validator/regex.d.ts +10 -0
- package/dist/validator/regex.d.ts.map +1 -0
- package/dist/validator/regex.js +45 -0
- package/dist/validator/regex.js.map +1 -0
- package/dist/validator/validator.d.ts +17 -0
- package/dist/validator/validator.d.ts.map +1 -0
- package/dist/validator/validator.js +85 -0
- package/dist/validator/validator.js.map +1 -0
- package/package.json +75 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to lostconf will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-01-26
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Smart severity classification system (LOW, MEDIUM, HIGH)
|
|
14
|
+
- Progress indicator for scanning large repositories
|
|
15
|
+
- `--min-severity` option to filter findings by severity level
|
|
16
|
+
- `--show-all` flag to show all findings including low severity
|
|
17
|
+
- `--skip-ignore-files` option to skip common ignore files
|
|
18
|
+
- `--exclude-parsers` option to exclude specific parsers
|
|
19
|
+
- `--no-progress` option to disable progress indicator
|
|
20
|
+
- Comprehensive validation report across 10 major OSS projects
|
|
21
|
+
- Automated NPM publishing workflow with provenance attestation
|
|
22
|
+
- Release automation script for streamlined version bumping
|
|
23
|
+
- NPM publishing guide with setup instructions
|
|
24
|
+
- CHANGELOG.md following Keep a Changelog format
|
|
25
|
+
- `.npmignore` to control published package contents
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- Default behavior now hides LOW severity patterns (use `--show-all` to see them)
|
|
29
|
+
- Improved path resolution for relative patterns in nested configs
|
|
30
|
+
- Enhanced output formatting with severity indicators
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- Path resolution bug causing false positives in nested configuration files
|
|
34
|
+
- 52% reduction in false positives for projects like Vite
|
|
35
|
+
|
|
36
|
+
## [0.1.0] - 2026-01-26
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- Initial release of lostconf meta-linter
|
|
40
|
+
- Support for 48+ configuration file types across 15+ languages
|
|
41
|
+
- File path, glob pattern, and regex pattern validation
|
|
42
|
+
- Multiple output formats: text, JSON, SARIF
|
|
43
|
+
- CI/CD integration support
|
|
44
|
+
- GitHub Code Scanning integration via SARIF
|
|
45
|
+
- Built-in parsers for:
|
|
46
|
+
- JavaScript/TypeScript: ESLint, Prettier, TypeScript, Jest, Stylelint, Biome, Deno
|
|
47
|
+
- Python: pytest, mypy, ruff, black, isort, flake8, pylint, bandit, pyright
|
|
48
|
+
- Ruby: RuboCop
|
|
49
|
+
- Go: golangci-lint
|
|
50
|
+
- Rust: rustfmt, clippy
|
|
51
|
+
- Java: Checkstyle, PMD, SpotBugs
|
|
52
|
+
- Kotlin: detekt
|
|
53
|
+
- PHP: PHP_CodeSniffer, PHPStan
|
|
54
|
+
- Swift: SwiftLint
|
|
55
|
+
- C/C++: clang-tidy, clang-format
|
|
56
|
+
- Scala: Scalafmt, Scalafix
|
|
57
|
+
- Elixir: Credo
|
|
58
|
+
- .NET: EditorConfig, MSBuild
|
|
59
|
+
- Shell: ShellCheck
|
|
60
|
+
- YAML: yamllint
|
|
61
|
+
- Terraform: TFLint
|
|
62
|
+
- Security: Semgrep, Gitleaks
|
|
63
|
+
- Docker: Hadolint
|
|
64
|
+
- General: Git (.gitignore), Docker (.dockerignore), markdownlint
|
|
65
|
+
- Command-line options:
|
|
66
|
+
- `--format` (text, json, sarif)
|
|
67
|
+
- `--output` (write to file)
|
|
68
|
+
- `--include` / `--exclude` (filter config files)
|
|
69
|
+
- `--fail-on-stale` (exit code 1 for CI)
|
|
70
|
+
- `--quiet` / `--verbose` (output control)
|
|
71
|
+
- Comprehensive test suite with 168+ tests
|
|
72
|
+
- Full TypeScript type definitions
|
|
73
|
+
- MIT License
|
|
74
|
+
|
|
75
|
+
### Documentation
|
|
76
|
+
- README with detailed usage instructions
|
|
77
|
+
- API documentation for programmatic usage
|
|
78
|
+
- Examples for CI/CD integration
|
|
79
|
+
- Contributing guidelines
|
|
80
|
+
|
|
81
|
+
[Unreleased]: https://github.com/lostconf/lostconf/compare/v0.2.0...HEAD
|
|
82
|
+
[0.2.0]: https://github.com/lostconf/lostconf/releases/tag/v0.2.0
|
|
83
|
+
[0.1.0]: https://github.com/lostconf/lostconf/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 lostconf
|
|
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/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lostconf contributors
|
|
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,445 @@
|
|
|
1
|
+
# lostconf
|
|
2
|
+
|
|
3
|
+
[](https://github.com/lostconf/lostconf/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/lostconf)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
A meta-linter that validates and detects stale references in configuration files across languages and tools.
|
|
8
|
+
|
|
9
|
+
## The Problem
|
|
10
|
+
|
|
11
|
+
Linter configs accumulate exclusions over time. Files get deleted, patterns become stale, but configs are never cleaned up. This leads to:
|
|
12
|
+
|
|
13
|
+
- **Confusing config files** full of dead references that nobody understands
|
|
14
|
+
- **Security risks** when exclusions outlive the code they were meant to exclude
|
|
15
|
+
- **Maintenance burden** when trying to understand what's actually being ignored
|
|
16
|
+
- **False confidence** in your linting when patterns no longer match anything
|
|
17
|
+
|
|
18
|
+
## The Solution
|
|
19
|
+
|
|
20
|
+
lostconf scans your config files, extracts path/glob/regex patterns, validates them against your codebase, and reports dead references.
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
$ npx lostconf
|
|
24
|
+
.eslintignore:3 src/legacy/*.js no matches
|
|
25
|
+
.rubocop.yml:47 spec/old_helper.rb file not found
|
|
26
|
+
pyproject.toml:12 test_.*_old\.py no matches
|
|
27
|
+
|
|
28
|
+
Found 3 stale patterns in 3 files
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Run directly with npx (no install required):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx lostconf
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or install globally:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g lostconf
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or add to your project:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install --save-dev lostconf
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Scan current directory (shows medium+ severity by default)
|
|
55
|
+
npx lostconf
|
|
56
|
+
|
|
57
|
+
# Show all findings including low severity (common patterns like node_modules)
|
|
58
|
+
npx lostconf --show-all
|
|
59
|
+
|
|
60
|
+
# Only show high severity issues
|
|
61
|
+
npx lostconf --min-severity=high
|
|
62
|
+
|
|
63
|
+
# Scan specific paths
|
|
64
|
+
npx lostconf ./src ./lib
|
|
65
|
+
|
|
66
|
+
# Fail CI if stale patterns found
|
|
67
|
+
npx lostconf --fail-on-stale
|
|
68
|
+
|
|
69
|
+
# JSON output for automation
|
|
70
|
+
npx lostconf --format json
|
|
71
|
+
|
|
72
|
+
# Only check TypeScript configs
|
|
73
|
+
npx lostconf --include "**/tsconfig.json"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## CLI Options
|
|
77
|
+
|
|
78
|
+
### Filtering Options
|
|
79
|
+
|
|
80
|
+
- `--skip-ignore-files` - Skip .gitignore, .prettierignore, .eslintignore, and .dockerignore files. Reduces noise by 70-80% since these files contain many intentionally missing patterns.
|
|
81
|
+
- `--exclude-parsers <names...>` - Skip specific parsers by name (e.g., `--exclude-parsers gitignore prettierignore`)
|
|
82
|
+
- `--include <glob...>` - Only check config files matching these glob patterns (e.g., `--include "**/tsconfig.json"`)
|
|
83
|
+
- `--exclude <glob...>` - Skip config files matching these glob patterns (e.g., `--exclude "**/test/**"`)
|
|
84
|
+
|
|
85
|
+
### Output Options
|
|
86
|
+
|
|
87
|
+
- `-f, --format <fmt>` - Output format: `text` (default), `json`, or `sarif`
|
|
88
|
+
- `-o, --output <file>` - Write results to file instead of stdout
|
|
89
|
+
- `--fail-on-stale` - Exit with code 1 if stale patterns are found (useful for CI)
|
|
90
|
+
- `-q, --quiet` - Suppress non-error output
|
|
91
|
+
- `-v, --verbose` - Show detailed debug information
|
|
92
|
+
|
|
93
|
+
### Progress
|
|
94
|
+
|
|
95
|
+
- `--no-progress` - Disable the progress indicator (enabled by default in text mode)
|
|
96
|
+
|
|
97
|
+
### Examples
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Focus on actionable issues (skip ignore files)
|
|
101
|
+
npx lostconf --skip-ignore-files
|
|
102
|
+
|
|
103
|
+
# Check only TypeScript configs in packages directory
|
|
104
|
+
npx lostconf packages/ --include "**/tsconfig.json"
|
|
105
|
+
|
|
106
|
+
# CI mode: fail build if stale patterns found, output JSON
|
|
107
|
+
npx lostconf --fail-on-stale --format json --skip-ignore-files
|
|
108
|
+
|
|
109
|
+
# Scan large monorepo with progress disabled
|
|
110
|
+
npx lostconf --no-progress
|
|
111
|
+
|
|
112
|
+
# Check everything except test directories
|
|
113
|
+
npx lostconf --exclude "**/test/**" --exclude "**/tests/**"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Supported Config Files
|
|
117
|
+
|
|
118
|
+
lostconf supports **48+ configuration files** from popular tools across **15+ languages**:
|
|
119
|
+
|
|
120
|
+
| Language/Category | Tool | Config File(s) | What We Check |
|
|
121
|
+
|-------------------|------|----------------|---------------|
|
|
122
|
+
| **JavaScript/TypeScript** | ESLint | `.eslintignore` | File paths and glob patterns in ignore list |
|
|
123
|
+
| | Prettier | `.prettierignore` | File paths and glob patterns in ignore list |
|
|
124
|
+
| | TypeScript | `tsconfig.json` | Files in `exclude`, `include` arrays |
|
|
125
|
+
| | Jest | `jest.config.json` | Test paths, coverage paths, module paths |
|
|
126
|
+
| | Stylelint | `.stylelintignore`, `.stylelintrc.json` | File paths and glob patterns, ignore patterns in config |
|
|
127
|
+
| | Biome | `biome.json`, `biome.jsonc` | Patterns in `files.ignore`, `linter.ignore`, `formatter.ignore` |
|
|
128
|
+
| | Deno | `deno.json`, `deno.jsonc` | Global `exclude`, `lint.exclude/include`, `fmt.exclude/include`, `test.exclude/include` |
|
|
129
|
+
| **Python** | pytest, coverage, mypy, ruff, black, isort | `pyproject.toml` | Test paths, source paths, exclude patterns, omit patterns |
|
|
130
|
+
| | Flake8 | `.flake8`, `setup.cfg` | Exclude patterns, extend-exclude, filename patterns, per-file-ignores |
|
|
131
|
+
| | Pylint | `.pylintrc`, `pylintrc` | Ignore paths, ignore patterns in `[MASTER]`/`[MAIN]` section |
|
|
132
|
+
| | Bandit | `.bandit` | Exclude directories, exclude files, test paths |
|
|
133
|
+
| | Pyright | `pyrightconfig.json` | `include`, `exclude`, `ignore`, `extraPaths` patterns |
|
|
134
|
+
| **Ruby** | RuboCop | `.rubocop.yml` | Exclude patterns, Include patterns in AllCops |
|
|
135
|
+
| **Go** | golangci-lint | `.golangci.yml` | Skip-dirs, skip-files, exclude patterns |
|
|
136
|
+
| **Rust** | rustfmt | `rustfmt.toml` | Ignore patterns |
|
|
137
|
+
| | Clippy | `clippy.toml` | Excluded files |
|
|
138
|
+
| **Java** | Checkstyle | `checkstyle.xml` | SuppressionFilter file attributes |
|
|
139
|
+
| | PMD | `pmd.xml` | Exclude patterns in rulesets |
|
|
140
|
+
| | SpotBugs | `spotbugs.xml` | Match/Class elements |
|
|
141
|
+
| **Kotlin** | detekt | `detekt.yml` | Excludes patterns in config |
|
|
142
|
+
| **PHP** | PHP_CodeSniffer | `phpcs.xml` | Exclude-pattern elements |
|
|
143
|
+
| | PHPStan | `phpstan.neon` | Excludes_analyse, ignoreErrors paths |
|
|
144
|
+
| **Swift** | SwiftLint | `.swiftlint.yml` | Excluded paths, included paths |
|
|
145
|
+
| **C/C++** | clang-tidy | `.clang-tidy` | CheckOptions paths |
|
|
146
|
+
| | clang-format | `.clang-format` | File patterns |
|
|
147
|
+
| **Scala** | Scalafmt | `.scalafmt.conf` | Project.excludeFilters |
|
|
148
|
+
| | Scalafix | `.scalafix.conf` | Excludes patterns |
|
|
149
|
+
| **Elixir** | Credo | `.credo.exs` | Files.excluded paths |
|
|
150
|
+
| **.NET** | EditorConfig | `.editorconfig` | File globs and patterns |
|
|
151
|
+
| | MSBuild | `Directory.Build.props` | Include/Exclude item patterns |
|
|
152
|
+
| **Shell** | ShellCheck | `.shellcheckrc` | Source-path directives |
|
|
153
|
+
| **YAML** | yamllint | `.yamllint`, `.yamllint.yml` | Ignore patterns, ignore-from-file paths |
|
|
154
|
+
| **Terraform** | TFLint | `.tflint.hcl` | Source paths, module directories, exclude patterns |
|
|
155
|
+
| **Security** | Semgrep | `.semgrep.yml`, `.semgrep.yaml`, `.semgrepignore` | `paths.exclude`, `paths.include` in rules, ignore patterns |
|
|
156
|
+
| | Gitleaks | `.gitleaks.toml` | `allowlist.paths`, `allowlist.regexes`, rule-specific allowlists |
|
|
157
|
+
| **Docker** | Hadolint | `.hadolint.yaml`, `.hadolint.yml` | `ignored` patterns, `trustedRegistries` (non-URL paths) |
|
|
158
|
+
| **General** | Git | `.gitignore` | All file paths and patterns |
|
|
159
|
+
| | Docker | `.dockerignore` | All file paths and patterns |
|
|
160
|
+
| | markdownlint | `.markdownlintignore` | All file paths and patterns |
|
|
161
|
+
|
|
162
|
+
## What Does lostconf Validate?
|
|
163
|
+
|
|
164
|
+
lostconf extracts and validates three types of patterns from configuration files:
|
|
165
|
+
|
|
166
|
+
### Pattern Types
|
|
167
|
+
|
|
168
|
+
- **File Paths**: Direct references to files or directories (e.g., `src/legacy/old.js`)
|
|
169
|
+
- **Glob Patterns**: Wildcards and patterns (e.g., `**/*.test.js`, `*.py`)
|
|
170
|
+
- **Regex Patterns**: Regular expressions in certain config contexts (e.g., Python test file patterns)
|
|
171
|
+
|
|
172
|
+
### Validation Strategy by Tool
|
|
173
|
+
|
|
174
|
+
**Ignore Files** (`.gitignore`, `.eslintignore`, `.prettierignore`, etc.)
|
|
175
|
+
- Validates that each pattern matches at least one file in your codebase
|
|
176
|
+
- Warns about patterns that no longer match anything (stale patterns)
|
|
177
|
+
|
|
178
|
+
**Configuration Files with Path References** (`tsconfig.json`, `pyproject.toml`, etc.)
|
|
179
|
+
- Checks `exclude`, `include`, `ignore`, and similar fields
|
|
180
|
+
- Validates source paths, test paths, and coverage paths
|
|
181
|
+
- Ensures referenced files and directories exist
|
|
182
|
+
|
|
183
|
+
**Linter-Specific Configs**
|
|
184
|
+
- **ESLint/Prettier/Stylelint**: Ignore patterns
|
|
185
|
+
- **TypeScript**: Files in `exclude`/`include` arrays
|
|
186
|
+
- **Jest**: Test paths, coverage directories, module path mappings
|
|
187
|
+
- **Biome**: Ignore/include patterns across files, linter, and formatter sections
|
|
188
|
+
- **Python Tools** (pytest, mypy, ruff, black, isort, flake8, pylint, bandit): Source paths, test paths, exclude patterns
|
|
189
|
+
- **RuboCop**: Exclude/Include patterns in AllCops
|
|
190
|
+
- **Go** (golangci-lint): Skip directories and files
|
|
191
|
+
- **Rust** (rustfmt, clippy): Ignored file patterns
|
|
192
|
+
- **Java** (checkstyle, pmd, spotbugs): Suppression files and exclude patterns
|
|
193
|
+
- **Kotlin** (detekt): Exclude patterns
|
|
194
|
+
- **PHP** (phpcs, phpstan): Exclude patterns and ignored paths
|
|
195
|
+
- **Swift** (swiftlint): Excluded and included file paths
|
|
196
|
+
- **C/C++** (clang-tidy, clang-format): File patterns and paths
|
|
197
|
+
- **Scala** (scalafmt, scalafix): Exclude filters
|
|
198
|
+
- **Elixir** (credo): Excluded file paths
|
|
199
|
+
- **.NET** (editorconfig, MSBuild): File globs and item patterns
|
|
200
|
+
- **ShellCheck**: Source path references
|
|
201
|
+
- **yamllint**: Ignore patterns and ignore-from-file references
|
|
202
|
+
- **Terraform** (tflint): Module sources and exclude patterns
|
|
203
|
+
|
|
204
|
+
### What Causes a Stale Pattern?
|
|
205
|
+
|
|
206
|
+
1. **File Not Found** - A specific file or directory path doesn't exist
|
|
207
|
+
2. **No Matches** - A glob or regex pattern doesn't match any files in the codebase
|
|
208
|
+
3. **Invalid Pattern** - The pattern syntax is malformed
|
|
209
|
+
|
|
210
|
+
## CLI Reference
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
lostconf [options] [paths...]
|
|
214
|
+
|
|
215
|
+
Arguments:
|
|
216
|
+
paths Paths to scan (default: current directory)
|
|
217
|
+
|
|
218
|
+
Options:
|
|
219
|
+
-V, --version Show version number
|
|
220
|
+
-f, --format <fmt> Output format: text, json, sarif (default: text)
|
|
221
|
+
-o, --output <file> Write to file instead of stdout
|
|
222
|
+
--include <glob...> Only check matching config files
|
|
223
|
+
--exclude <glob...> Skip matching config files
|
|
224
|
+
--fail-on-stale Exit code 1 if stale patterns found
|
|
225
|
+
-q, --quiet Suppress non-error output
|
|
226
|
+
-v, --verbose Show debug info
|
|
227
|
+
-h, --help Show help
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Output Formats
|
|
231
|
+
|
|
232
|
+
### Text (Default)
|
|
233
|
+
|
|
234
|
+
Human-readable output with colors:
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
.eslintignore:3 src/legacy/*.js no matches
|
|
238
|
+
.rubocop.yml:47 spec/old_helper.rb file not found
|
|
239
|
+
|
|
240
|
+
Found 2 stale patterns in 2 files
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### JSON
|
|
244
|
+
|
|
245
|
+
Machine-readable format for automation:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
npx lostconf --format json
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"findings": [
|
|
254
|
+
{
|
|
255
|
+
"file": ".eslintignore",
|
|
256
|
+
"line": 3,
|
|
257
|
+
"pattern": "src/legacy/*.js",
|
|
258
|
+
"type": "glob",
|
|
259
|
+
"reason": "no_matches",
|
|
260
|
+
"parser": "eslintignore"
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"summary": { "total": 1, "files": 1 }
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### SARIF
|
|
268
|
+
|
|
269
|
+
[SARIF](https://sarifweb.azurewebsites.net/) format for IDE integration and GitHub Code Scanning:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
npx lostconf --format sarif --output results.sarif
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## CI Integration
|
|
276
|
+
|
|
277
|
+
### GitHub Actions
|
|
278
|
+
|
|
279
|
+
Basic usage:
|
|
280
|
+
|
|
281
|
+
```yaml
|
|
282
|
+
name: Lint
|
|
283
|
+
on: [push, pull_request]
|
|
284
|
+
|
|
285
|
+
jobs:
|
|
286
|
+
lostconf:
|
|
287
|
+
runs-on: ubuntu-latest
|
|
288
|
+
steps:
|
|
289
|
+
- uses: actions/checkout@v4
|
|
290
|
+
- uses: actions/setup-node@v4
|
|
291
|
+
with:
|
|
292
|
+
node-version: '20'
|
|
293
|
+
- run: npx lostconf --fail-on-stale
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### GitHub Code Scanning with SARIF
|
|
297
|
+
|
|
298
|
+
```yaml
|
|
299
|
+
name: Code Scanning
|
|
300
|
+
on: [push, pull_request]
|
|
301
|
+
|
|
302
|
+
jobs:
|
|
303
|
+
lostconf:
|
|
304
|
+
runs-on: ubuntu-latest
|
|
305
|
+
steps:
|
|
306
|
+
- uses: actions/checkout@v4
|
|
307
|
+
- uses: actions/setup-node@v4
|
|
308
|
+
with:
|
|
309
|
+
node-version: '20'
|
|
310
|
+
|
|
311
|
+
- name: Run lostconf
|
|
312
|
+
run: npx lostconf --format sarif --output results.sarif
|
|
313
|
+
continue-on-error: true
|
|
314
|
+
|
|
315
|
+
- name: Upload SARIF
|
|
316
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
317
|
+
with:
|
|
318
|
+
sarif_file: results.sarif
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Pre-commit Hook
|
|
322
|
+
|
|
323
|
+
Add to `.pre-commit-config.yaml`:
|
|
324
|
+
|
|
325
|
+
```yaml
|
|
326
|
+
repos:
|
|
327
|
+
- repo: local
|
|
328
|
+
hooks:
|
|
329
|
+
- id: lostconf
|
|
330
|
+
name: Check for stale config patterns
|
|
331
|
+
entry: npx lostconf --fail-on-stale
|
|
332
|
+
language: system
|
|
333
|
+
pass_filenames: false
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Exit Codes
|
|
337
|
+
|
|
338
|
+
| Code | Description |
|
|
339
|
+
|------|-------------|
|
|
340
|
+
| 0 | Success (no stale patterns, or `--fail-on-stale` not set) |
|
|
341
|
+
| 1 | Stale patterns found (when `--fail-on-stale` is set) |
|
|
342
|
+
| 2 | Error (invalid arguments, file read errors, etc.) |
|
|
343
|
+
|
|
344
|
+
## Programmatic API
|
|
345
|
+
|
|
346
|
+
Use lostconf as a library in your Node.js scripts:
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
import { createEngine, getBuiltinParsers } from 'lostconf';
|
|
350
|
+
|
|
351
|
+
async function checkConfigs() {
|
|
352
|
+
const parsers = getBuiltinParsers();
|
|
353
|
+
const engine = createEngine(parsers, {
|
|
354
|
+
paths: ['.'],
|
|
355
|
+
verbose: false
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
const result = await engine.run();
|
|
359
|
+
|
|
360
|
+
console.log(`Found ${result.summary.total} stale patterns`);
|
|
361
|
+
|
|
362
|
+
for (const finding of result.findings) {
|
|
363
|
+
console.log(`${finding.file}:${finding.line} - ${finding.pattern}`);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
checkConfigs();
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Creating Custom Parsers
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
import { createEngine, Parser, Pattern, PatternType } from 'lostconf';
|
|
374
|
+
|
|
375
|
+
const myParser: Parser = {
|
|
376
|
+
name: 'my-tool',
|
|
377
|
+
filePatterns: ['.mytoolrc', '**/.mytoolrc'],
|
|
378
|
+
parse(filename: string, content: string): Pattern[] {
|
|
379
|
+
const patterns: Pattern[] = [];
|
|
380
|
+
// Parse your config format and extract patterns
|
|
381
|
+
// ...
|
|
382
|
+
return patterns;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
const engine = createEngine([myParser], { paths: ['.'] });
|
|
387
|
+
const result = await engine.run();
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## Pattern Types
|
|
391
|
+
|
|
392
|
+
lostconf understands three types of patterns:
|
|
393
|
+
|
|
394
|
+
| Type | Description | Example |
|
|
395
|
+
|------|-------------|---------|
|
|
396
|
+
| `path` | Exact file or directory path | `src/legacy/old.js` |
|
|
397
|
+
| `glob` | Glob pattern with wildcards | `src/**/*.test.js` |
|
|
398
|
+
| `regex` | Regular expression | `test_.*_old\.py` |
|
|
399
|
+
|
|
400
|
+
## Stale Reasons
|
|
401
|
+
|
|
402
|
+
| Reason | Description |
|
|
403
|
+
|--------|-------------|
|
|
404
|
+
| `file_not_found` | The referenced file or directory doesn't exist |
|
|
405
|
+
| `no_matches` | The glob/regex pattern doesn't match any files |
|
|
406
|
+
| `invalid_pattern` | The pattern syntax is invalid |
|
|
407
|
+
|
|
408
|
+
## Contributing
|
|
409
|
+
|
|
410
|
+
Contributions are welcome! Here's how to get started:
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
# Clone the repository
|
|
414
|
+
git clone https://github.com/lostconf/lostconf.git
|
|
415
|
+
cd lostconf
|
|
416
|
+
|
|
417
|
+
# Install dependencies
|
|
418
|
+
npm install
|
|
419
|
+
|
|
420
|
+
# Build
|
|
421
|
+
npm run build
|
|
422
|
+
|
|
423
|
+
# Run tests
|
|
424
|
+
npm test
|
|
425
|
+
|
|
426
|
+
# Run linter
|
|
427
|
+
npm run lint
|
|
428
|
+
|
|
429
|
+
# Check formatting
|
|
430
|
+
npm run format:check
|
|
431
|
+
|
|
432
|
+
# Run lostconf on itself
|
|
433
|
+
npm run selfcheck
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Adding a New Parser
|
|
437
|
+
|
|
438
|
+
1. Create a new file in `src/parsers/`
|
|
439
|
+
2. Implement the `Parser` interface
|
|
440
|
+
3. Export the parser from `src/parsers/index.ts`
|
|
441
|
+
4. Add tests in `tests/parsers/`
|
|
442
|
+
|
|
443
|
+
## License
|
|
444
|
+
|
|
445
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;GAEG"}
|