Skip to content

Commit 4214edb

Browse files
committed
feat: use .ls-lint.yaml file as default configuration file
The .ls-lint.yaml file is now used as the default configuration file The .ls-lint.yml file is still supported for backward compatibility. The choice was made to prioritize the .ls-lint.yaml file for its clarity and alignment with YAML file naming conventions.
1 parent 6d94ac0 commit 4214edb

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed
File renamed without changes.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ An extremely fast directory and filename linter - Bring some structure to your p
1111
![npm](https://badgen.net/static/npm%20downloads%20total/10M+/green)
1212
<a href="https://www.npmjs.com/package/@ls-lint/ls-lint"><img src="https://img.shields.io/npm/l/@ls-lint/ls-lint.svg?sanitize=true" alt="License"></a>
1313

14-
- Minimal setup with simple rules managed in one single or multiple `.ls-lint.yml` files
15-
- Works for directory and file names - all extensions supported - full unicode support
14+
- Minimal setup with simple rules managed in one single or multiple `.ls-lint.yaml` (or `.ls-lint.yml`) files
15+
- Works for directory and file names - all extensions supported - full Unicode support
1616
- Incredibly fast - lints thousands of files and directories in milliseconds
1717
- Support for Windows, MacOS and Linux + [NPM Package](https://www.npmjs.com/package/@ls-lint/ls-lint) + [GitHub Action](https://github.com/ls-lint/action) + [Homebrew](https://formulae.brew.sh/formula/ls-lint) + Docker
1818
- Trusted by [Renovate](https://github.com/renovatebot/renovate/blob/main/.ls-lint.yml), [Terser](https://github.com/terser/terser/blob/master/.ls-lint.yml) and many more
@@ -34,7 +34,7 @@ The full documentation can be found at [ls-lint.org](https://ls-lint.org)
3434

3535
## Demo
3636

37-
### Configuration `.ls-lint.yml`
37+
### Configuration `.ls-lint.yaml`
3838

3939
```yaml
4040
ls:

cmd/ls_lint/main.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@ func main() {
5757
}
5858

5959
if len(flagConfig) == 0 {
60-
flagConfig = _flag.Config{".ls-lint.yml"}
60+
// no config files were provided by the --config flag
61+
62+
// Default config file name with .yaml extension
63+
configFile := ".ls-lint.yaml"
64+
if _, err := os.Stat(configFile); os.IsNotExist(err) {
65+
// try to fallback to .yml extension if it exists, otherwise keep .yaml as default
66+
altConfigFile := ".ls-lint.yml"
67+
if _, err := os.Stat(altConfigFile); err == nil {
68+
configFile = altConfigFile
69+
}
70+
}
71+
72+
flagConfig = _flag.Config{configFile}
6173
}
6274

6375
filesystem := os.DirFS(*flagWorkdir)

0 commit comments

Comments
 (0)