Metadata-Version: 2.4
Name: jay_lint
Version: 0.2.0
Summary: Jay Choy's personal linter
License: MIT
License-File: LICENSE
Author: Jay Choy
Author-email: choyzhengjay@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Dist: tomli (>=1.1) ; python_version < "3.11"
Requires-Dist: tree-sitter (>=0.23) ; python_version >= "3.9"
Requires-Dist: tree-sitter-typescript (>=0.23) ; python_version >= "3.9"
Description-Content-Type: text/markdown

# jay_lint
[![Build and Test](https://github.com/ZJay07/jay_lint/actions/workflows/unittest_feature.yml/badge.svg)](https://github.com/ZJay07/jay_lint/actions/workflows/unittest_feature.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This is my attempt in making my own linter using [Please](https://github.com/thought-machine/please) from Thought Machine and the python [ast](https://docs.python.org/3/library/ast.html) library

# Install it via pip
```bash
pip install jay_lint
```

# To install, on the root directory run:
```bash
pip install .
```

# How to use?
After installing, simply run `jlint` followed by your file name.
eg:
```bash
jlint <test.py>
```

# How to use 'fix'?
Same as before, just add `--fix` after the file name
eg:
```bash
jlint --fix <test.py>
```

# TypeScript / JavaScript support
`jlint` also lints `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs` files. It parses them with
[tree-sitter](https://tree-sitter.github.io/) (installed with the package; needs Python 3.9+):
```bash
jlint app/page.tsx                      # one file
jlint app components lib                # directories (node_modules, .next, plz-out skipped)
jlint --fix components/Bio.tsx          # fix in place
jlint --strict --max-line-length 88 app # exit 1 if anything is reported (for CI)
jlint                                   # no arguments: use the paths from the config file
```

Checks (`--fix` can fix the ones marked *fix*):

| Check | |
| --- | --- |
| Import order and blank lines between import groups (builtin, external, `@/` internal, parent, sibling, index; alphabetised) | *fix* |
| Unused imports (default, named, aliased, namespace; side-effect imports are never unused) | *fix* |
| Trailing whitespace, repeated or leading blank lines, final newline | *fix* |
| Line length (`--max-line-length`, default 100). Whole-line `//` comments and ` * ` JSDoc lines that are too long are reported and `--fix` wraps them at word boundaries (keeping indent and prefix). Lines with a string, template literal, regex, URL, trailing comment, tool directive (`eslint-...`, `@ts-...`, `prettier-ignore`) or aligned columns are not reported, since they cannot be wrapped safely | *fix* (comments) |

The import order rules mirror `eslint-plugin-import`'s `import/order` with
`alphabetize` and `newlines-between: always`, so the two agree. Imports are only reordered
when nothing but imports sits between them; a comment between two imports leaves them alone.

# Config file
Put your settings in `jlint.toml`, or under `[tool.jlint]` in `pyproject.toml`, and run plain `jlint`.
The nearest config is found by searching upwards from the current directory
(`jlint.toml` wins over `pyproject.toml`), or pass one with `--config path/to/file.toml`.

```toml
# jlint.toml
paths = ["app", "components", "lib", "utils"]   # linted when no files are given on the command line
max-line-length = 88                            # TypeScript / JavaScript (default 100)
strict = true                                   # exit 1 if anything is reported
exclude = ["generated", "*.stories.tsx"]        # folder names or paths to skip inside directories
```

The same settings in `pyproject.toml`:
```toml
[tool.jlint]
paths = ["src"]
```

`paths` and `exclude` are relative to the config file. Command-line arguments override the
config: files on the command line replace `paths`, and `--max-line-length` replaces
`max-line-length`. Unknown settings and wrong types are reported as errors.

# Development (Please)
Tests run under Please, pinned to the Python in `.python-version` (currently 3.11) so local and CI match.
Please builds with its own restricted `PATH`, so it ignores the `python3` on yours; `scripts/use_uv_python.sh` installs the pinned Python with [uv](https://docs.astral.sh/uv/) and points Please at it (via an untracked `.plzconfig.local`).
```bash
./scripts/use_uv_python.sh
./pleasew test //src/...
```

