Merge pull request #499 from Riverside-Healthcare/dev

This commit is contained in:
sur.la.route 2022-12-26 10:38:25 -06:00 committed by GitHub
commit edc772dc16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 435 additions and 414 deletions

View file

@ -27,7 +27,7 @@ repos:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/PyCQA/isort
rev: 5.11.3
rev: 5.11.4
hooks:
- id: isort
exclude: docs*

806
docs/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "djlint_docs",
"version": "1.0.52",
"version": "1.0.54",
"description": "",
"main": "index.js",
"scripts": {
@ -37,7 +37,7 @@
"@fortawesome/fontawesome-free": "6.2.1",
"@fullhuman/postcss-purgecss": "5.0.0",
"@toycode/markdown-it-class": "1.2.4",
"algoliasearch": "4.14.2",
"algoliasearch": "4.14.3",
"autoprefixer": "10.4.13",
"bulma": "0.9.4",
"bulma-pricingtable": "0.2.0",
@ -45,14 +45,14 @@
"cz-conventional-changelog": "3.3.0",
"eleventy-plugin-edit-on-github": "1.1.0",
"eleventy-plugin-metagen": "1.7.11",
"esbuild": "0.16.7",
"eslint": "8.29.0",
"esbuild": "0.16.10",
"eslint": "8.30.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.26.0",
"fontawesome-subset": "4.3.1",
"html-minifier": "4.0.0",
"markdown-it": "13.0.1",
"markdown-it-anchor": "8.6.5",
"markdown-it-anchor": "8.6.6",
"markdown-it-div": "1.1.0",
"markdown-it-imsize": "2.0.1",
"outdent": "0.8.0",
@ -60,7 +60,7 @@
"postcss-nested": "6.0.0",
"prettier": "2.8.1",
"prismjs": "1.29.0",
"sass": "1.56.2",
"sass": "1.57.1",
"slugify": "1.6.5"
},
"config": {

View file

@ -100,3 +100,15 @@ djLint can use used as formatter in neovim using the `null-ls` plugin.
- [GitHub repository](https://github.com/jose-elias-alvarez/null-ls.nvim)
- [Lint](https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/lua/null-ls/builtins/diagnostics/djlint.lua#L14)
- [Format](https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/lua/null-ls/builtins/formatting/djlint.lua#L13)
## MegaLinter
djlint is natively embedded within the 100+ linters of [MegaLinter](https://megalinter.io)
To install it, just run `npx mega-linter-runner --install` and follow instructions
::: content
- [GitHub repository](https://github.com/oxsecurity/megalinter)
- [djlint in MegaLinter documentation](https://megalinter.io/latest/descriptors/html_djlint/)
:::

View file

@ -172,11 +172,12 @@ def main(
temp_file = None
if "-" in src:
if set("-").intersection(set(src)):
if config.files:
file_list = get_src([Path(x) for x in config.files], config)
else:
config.stdin = True
stdin_stream = click.get_text_stream("stdin", encoding="utf8")
stdin_text = stdin_stream.read()

View file

@ -30,7 +30,6 @@ def print_output(
lint_success_message = ""
lint_error_count = 0
format_error_count = 0
print_blanks = config.stdin is False and config.quiet is False
if print_blanks:
@ -99,6 +98,7 @@ def build_output(error: dict, config: Config) -> int:
errors = sorted(
list(error.values())[0], key=lambda x: tuple(map(int, x["line"].split(":")))
)
width, _ = shutil.get_terminal_size()
if len(errors) == 0:

View file

@ -272,7 +272,7 @@ class Config:
self.ignore: str = str(ignore or djlint_settings.get("ignore", ""))
self.files: Optional[List[str]] = djlint_settings.get("files", None)
self.stdin = "-" in src and self.files is None
self.stdin = False
# codes to exclude
profile_dict: Dict[str, List[str]] = {

1
tests/test_djlint/-.html Normal file
View file

@ -0,0 +1 @@
<img>

View file

@ -5,7 +5,7 @@ run::
pytest tests/test_djlint/test_djlint.py --cov=src/djlint --cov-branch --cov-report xml:coverage.xml --cov-report term-missing
pytest tests/test_djlint/test_djlint.py::test_stdin
pytest tests/test_djlint/test_djlint.py::test_hyphen_file
or::
@ -61,6 +61,13 @@ def test_existing_file(runner: CliRunner) -> None:
assert str(Path("tests/test_djlint/bad.html")) in result.output
def test_hyphen_file(runner: CliRunner) -> None:
result = runner.invoke(djlint, ["tests/test_djlint/-.html"])
assert result.exit_code == 1
print(result.output)
assert str(Path("tests/test_djlint/-.html")) in result.output
def test_multiple_files(runner: CliRunner) -> None:
result = runner.invoke(
djlint,