mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-06-05 22:23:17 +03:00
Change how we remove prettier pre-commit hook from the config (#4450)
This commit is contained in:
parent
d54f29fd4f
commit
bc56102f13
|
@ -207,6 +207,24 @@ def handle_js_runner(choice, use_docker, use_async):
|
||||||
remove_gulp_files()
|
remove_gulp_files()
|
||||||
|
|
||||||
|
|
||||||
|
def remove_prettier_pre_commit():
|
||||||
|
with open(".pre-commit-config.yaml", "r") as fd:
|
||||||
|
content = fd.readlines()
|
||||||
|
|
||||||
|
removing = False
|
||||||
|
new_lines = []
|
||||||
|
for line in content:
|
||||||
|
if removing and "- repo:" in line:
|
||||||
|
removing = False
|
||||||
|
if "mirrors-prettier" in line:
|
||||||
|
removing = True
|
||||||
|
if not removing:
|
||||||
|
new_lines.append(line)
|
||||||
|
|
||||||
|
with open(".pre-commit-config.yaml", "w") as fd:
|
||||||
|
fd.writelines(new_lines)
|
||||||
|
|
||||||
|
|
||||||
def remove_celery_files():
|
def remove_celery_files():
|
||||||
file_names = [
|
file_names = [
|
||||||
os.path.join("config", "celery_app.py"),
|
os.path.join("config", "celery_app.py"),
|
||||||
|
@ -465,6 +483,7 @@ def main():
|
||||||
remove_webpack_files()
|
remove_webpack_files()
|
||||||
remove_sass_files()
|
remove_sass_files()
|
||||||
remove_packagejson_file()
|
remove_packagejson_file()
|
||||||
|
remove_prettier_pre_commit()
|
||||||
if "{{ cookiecutter.use_docker }}".lower() == "y":
|
if "{{ cookiecutter.use_docker }}".lower() == "y":
|
||||||
remove_node_dockerfile()
|
remove_node_dockerfile()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -16,7 +16,6 @@ repos:
|
||||||
- id: check-case-conflict
|
- id: check-case-conflict
|
||||||
- id: check-docstring-first
|
- id: check-docstring-first
|
||||||
- id: detect-private-key
|
- id: detect-private-key
|
||||||
{%- if cookiecutter.frontend_pipeline in ["Webpack", "Gulp"] %}
|
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
rev: v3.0.0-alpha.9-for-vscode
|
rev: v3.0.0-alpha.9-for-vscode
|
||||||
|
@ -24,7 +23,6 @@ repos:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
args: ['--tab-width', '2', '--single-quote']
|
args: ['--tab-width', '2', '--single-quote']
|
||||||
exclude: '{{cookiecutter.project_slug}}/templates/'
|
exclude: '{{cookiecutter.project_slug}}/templates/'
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
- repo: https://github.com/adamchainz/django-upgrade
|
- repo: https://github.com/adamchainz/django-upgrade
|
||||||
rev: '1.14.0'
|
rev: '1.14.0'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user