/
vshmidt
/
streamlit
Обзор
Документация
Войти
/
vshmidt
/
streamlit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
.pre-commit-config.yaml
230 строк
8 KB
Lukas Masuch
Consolidate `prettier` dependencies to frontend workspace root (#13902)
11 фев 2026, 21:51
Не верифицирован
11 фев 2026, 21:51
9b73d18
Код
Авторство
О чём код?
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2026) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Pre-commit configuration file, # when Streamlit's pre-commit detects that one of the linters has failed, # it automatically lints the files and does not allow the commit to pass. # Please review the changes after lint has failed and commit them again, # the second commit should pass, # because the files were linted after trying to do the first commit. repos: - repo: https://github.com/astral-sh/ruff-pre-commit # We fix ruff to a version to be in sync with the dev-requirements: rev: v0.15.0 hooks: # Run the linter. - id: ruff-check args: [--fix] types_or: [python, pyi] # Run the formatter. - id: ruff-format types_or: [python, pyi] - repo: local hooks: # Single prettier hook for all frontend source files. # Uses run_in_subdirectory.py to handle path translation for subdirectory files. # See: https://github.com/pre-commit/pre-commit/issues/1417 - id: prettier-frontend name: Prettier Frontend entry: ./scripts/run_in_subdirectory.py frontend yarn exec prettier --write files: ^frontend/(app|lib|connection|utils)/.*\.(js|jsx|ts|tsx)$ exclude: /vendor/ language: node pass_filenames: true - id: prettier-yaml name: Prettier-yaml entry: ./scripts/run_in_subdirectory.py frontend yarn exec prettier "../.github/**/*.{yml,yaml}" --write files: ^.github/.*\.(yml|yaml)$ language: node pass_filenames: false - id: prettier-vscode-devcontainer-json name: Prettier VSCode/devcontainer JSON entry: ./scripts/run_in_subdirectory.py frontend yarn exec prettier "../.vscode/*.json" "../.devcontainer/*.json" --write --config ./.prettierrc files: ^(.vscode/.*\.json|\.devcontainer/.*\.json)$ language: node pass_filenames: false - id: license-headers name: Checks license headers entry: ./scripts/check_license_headers.py language: system always_run: true pass_filenames: false - id: generate-agent-rules name: Check generated agent rules entry: ./scripts/generate_agent_rules.py language: system pass_filenames: false files: | (?x) (^|.*/)AGENTS\.md$ |^scripts/generate_agent_rules\.py$ |^scripts/assets/code-review-instructions\.md$ |^Makefile$ - id: vscode-devcontainer-sync name: Check VSCode/devcontainer sync entry: ./scripts/sync_vscode_devcontainer.py --check language: system files: ^(.vscode/(settings|extensions)\.json|\.devcontainer/devcontainer\.json)$ pass_filenames: false - id: yarn-dedupe name: Check frontend yarn.lock dedupe entry: ./scripts/check_yarn_dedupe.sh frontend language: system pass_filenames: false files: ^frontend/yarn\.lock$ - id: sync-ruff-version name: Sync ruff version entry: ./scripts/sync_ruff_version.py language: system pass_filenames: false files: ^(lib/dev-requirements\.txt|\.pre-commit-config\.yaml)$ - id: proto-format name: Buf Format Protos entry: ./frontend/node_modules/.bin/buf format -w proto files: ^proto/.*\.proto$ language: system pass_filenames: false - id: proto-lint name: Buf Lint Protos entry: ./frontend/node_modules/.bin/buf lint proto files: ^proto/.*\.proto$ language: system pass_filenames: false - repo: https://github.com/Lucas-C/pre-commit-hooks rev: v1.5.5 hooks: - id: insert-license name: Add license for all (S)CSS/JS(X)/TS(X) files files: \.(s?css|jsx?|tsx?)$ args: - --comment-style - "/**| *| */" - --license-filepath - scripts/assets/license-template.txt - --fuzzy-match-generates-todo exclude: | (?x) /vendor/ |^vendor/ |^component-lib/declarations/apache-arrow |^frontend/app/src/assets/css/variables\.scss |^lib/tests/streamlit/elements/test_html\.js |^lib/tests/streamlit/elements/test_html\.css |^e2e_playwright/test_assets/ - id: insert-license name: Add license for all Proto files files: \.proto$ args: - --comment-style - "/**!| *| */" - --license-filepath - scripts/assets/license-template.txt - --fuzzy-match-generates-todo exclude: | (?x) /vendor/ |^vendor/ |^component-lib/declarations/apache-arrow |^proto/streamlit/proto/openmetrics_data_model\.proto - id: insert-license name: Add license for all shell files files: \.sh$ args: - --comment-style - "|#|" - --license-filepath - scripts/assets/license-template.txt - --fuzzy-match-generates-todo exclude: | (?x) /vendor/ |^vendor/ |^component-lib/declarations/apache-arrow - id: insert-license name: Add license for all Python files files: \.py$|\.pyi$ args: - --comment-style - "|#|" - --license-filepath - scripts/assets/license-template.txt - --fuzzy-match-generates-todo exclude: | (?x) /vendor/ |^vendor/ |^component-lib/declarations/apache-arrow - id: insert-license name: Add license for all HTML files files: \.html$ args: - --comment-style - "<!--||-->" - --license-filepath - scripts/assets/license-template.txt - --fuzzy-match-generates-todo exclude: | (?x) /vendor/ |^vendor/ |^component-lib/declarations/apache-arrow - repo: https://gitlab.com/bmares/check-json5 rev: v1.0.0 hooks: # Check JSON files that are allowed to have comments - id: check-json5 # Note that this should be the same as the check-json hook's exclude # property files: | (?x) ^\.vscode/.*\.json$ |tsconfig.*\.json$ |.*tsconfig\.json$ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace exclude: | (?x) ^frontend/app/src/assets/ |^NOTICES$ |^proto/streamlit/proto/openmetrics_data_model.proto$ |\.snap$ - id: check-added-large-files - id: check-json # Note that this should be the same as the check-json5 hook's files # property exclude: | (?x) ^\.vscode/.*\.json$ |tsconfig.*\.json$ |.*tsconfig\.json$ - id: check-toml - id: check-yaml - id: check-symlinks - id: check-case-conflict - id: check-merge-conflict - id: fix-byte-order-marker - id: end-of-file-fixer exclude: | (?x) /vendor/ |^NOTICES$ |^e2e_playwright/test_assets/ |^LICENSE$ - id: mixed-line-ending args: [--fix=lf] exclude: | (?x) ^NOTICES$