mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 22:12:15 +00:00
lint
This commit is contained in:
@@ -14,8 +14,10 @@ import click
|
|||||||
def cli(styles_folder):
|
def cli(styles_folder):
|
||||||
"""
|
"""
|
||||||
Lints all style JSON files in a folder
|
Lints all style JSON files in a folder
|
||||||
First runs prettier with recursive JSON sorting
|
1. runs gl-style-migrate
|
||||||
Then runs gl-style-format
|
2. runs prettier with recursive JSON sorting
|
||||||
|
3. gl-style-format
|
||||||
|
4. gl-style-validate
|
||||||
"""
|
"""
|
||||||
|
|
||||||
p = subprocess.run(['pnpm', 'bin'], capture_output=True, text=True)
|
p = subprocess.run(['pnpm', 'bin'], capture_output=True, text=True)
|
||||||
@@ -33,22 +35,34 @@ def cli(styles_folder):
|
|||||||
|
|
||||||
print(f'formatting {style_file}')
|
print(f'formatting {style_file}')
|
||||||
|
|
||||||
|
# gl-style-migrate
|
||||||
|
p = subprocess.run(
|
||||||
|
[node_bin_path / 'gl-style-migrate', style_file], capture_output=True, text=True
|
||||||
|
)
|
||||||
|
with open(style_file, 'w') as fp:
|
||||||
|
fp.write(p.stdout)
|
||||||
|
|
||||||
|
# prettier
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[node_bin_path / 'prettier', '--config', prettier_config_path, '--write', style_file],
|
[node_bin_path / 'prettier', '--config', prettier_config_path, '--write', style_file],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# gl-style-format
|
||||||
p = subprocess.run(
|
p = subprocess.run(
|
||||||
[
|
[node_bin_path / 'gl-style-format', style_file], capture_output=True, text=True
|
||||||
node_bin_path / 'gl-style-format',
|
|
||||||
style_file,
|
|
||||||
],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
)
|
)
|
||||||
with open(style_file, 'w') as fp:
|
with open(style_file, 'w') as fp:
|
||||||
fp.write(p.stdout)
|
fp.write(p.stdout)
|
||||||
|
|
||||||
|
# gl-style-validate
|
||||||
|
subprocess.run(
|
||||||
|
[
|
||||||
|
node_bin_path / 'gl-style-validate',
|
||||||
|
style_file,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
cli()
|
cli()
|
||||||
|
|||||||
Reference in New Issue
Block a user