diff --git a/.editorconfig b/.editorconfig index 0d9838d89..27247697f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,25 +15,10 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Common editor configurations for this project. # -# EditorConfig defines a file format for specifying some common coding style -# parameters. Many IDEs and editors read .editorconfig files, either natively -# or via plugins. A few formatters also read .editorconfig; shfmt and Prettier -# are two examples (as of early 2025). -# +# EditorConfig is a file format for specifying some common style parameters. +# Many IDEs & editors read .editorconfig files, either natively or via plugins. # We mostly follow Google's style guides (https://google.github.io/styleguide/) -# with very few deviations. -# -# Miscellaneous notes: -# -# - The EditorConfig property `max_line_length` is not set here because its -# intended behavior is poorly specified. (See the discussion in the comments -# at https://github.com/editorconfig/editorconfig/issues/387) It *would* have -# been desirable to define a project convention for the line width here, but -# we must instead use editor-specific configuration files to do that. -# -# - With few exceptions (e.g., shfmt), `.editorconfig` files are not read by -# linters or formatters, which means the project needs separate config files -# for those tools. This includes markdownlint, yamllint, and others. +# with only a few deviations for line length and indentation in some files. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ root = true @@ -43,24 +28,19 @@ charset = utf-8 indent_style = space insert_final_newline = true spelling_language = en-US -# It would be preferable not to set tab_width, but some EditorConfig plugins -# (e.g., Emacs's) set it equal to indent_size if it's not set otherwise. -tab_width = 8 -# Trailing whitespace on lines is almost always noise. An exception is in -# Markdown, where two spaces = line break; however, that's such a foot-gun in -# practice that we avoid it. So, it's okay to set this next value globally. trim_trailing_whitespace = true +max_line_length = 100 -[{BUILD,*.BUILD,*.bzl,*.bazel}] +[{BUILD,*.BUILD,*.bzl,*.bazel,.bazelrc}] # Google doesn't have a style guideline for Bazel files. Most people use 4. indent_size = 4 [{*.cc,*.h}] -# This matches Google style guidelines. +# Google style guidelines use 2. indent_size = 2 -[{*.ts,*.js}] -# This matches Google style guidelines. +[{*.js,*.ts}] +# Google style guidelines use 2. indent_size = 2 [*.json] @@ -68,7 +48,7 @@ indent_size = 2 indent_size = 2 [*.py] -# This matches Google style guidelines. +# Google style guidelines use 4. indent_size = 4 [*.rst] @@ -78,16 +58,6 @@ indent_size = 3 [*.sh] # Google style guidelines use 2. indent_size = 4 -# The following are used by shfmt. These bring it closer to Google's style. -binary_next_line = true -shell_variant = bash -space_redirects = true -switch_case_indent = true - -# If this repository has a "third_party" directory, ignore it entirely. -# Note: shfmt also respects this if you run it with --appply-ignore. -[third_party/**] -ignore = true [{*.yaml,*.yml}] # Google doesn't have style guidelines for YAML. Most people use indent = 2. diff --git a/.jsonlintrc b/.jsonlintrc deleted file mode 100644 index 3f290f9a4..000000000 --- a/.jsonlintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "comments": false, - "compact": true, - "endOfLine": "lf", - "indent": 2, - "no-duplicate-keys": true, - "patterns": ["**/*.json"], - "singleQuote": false, - "trailing-commas": false -} diff --git a/.jsonlintrc.yaml b/.jsonlintrc.yaml new file mode 100644 index 000000000..4a7f53370 --- /dev/null +++ b/.jsonlintrc.yaml @@ -0,0 +1,32 @@ +# Copyright 2025 Google LLC +# +# 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 +# +# https://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. + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Project configuration for jsonlint (https://github.com/prantlf/jsonlint). +# Note: there are multiple programs named jsonlint. The one targeted by this +# config file is an updated fork of a different "jsonlint". +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +comments: false +compact: true +continue: true +endOfLine: lf +indent: 2 +log-files: false +no-duplicate-keys: true +patterns: + - '**/*.json' + - '!**/node_modules' +singleQuote: false +trailing-commas: false diff --git a/.shellcheckrc b/.shellcheckrc deleted file mode 100644 index 672437e78..000000000 --- a/.shellcheckrc +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2025 Google LLC -# -# 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 -# -# https://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. - -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Project shellcheck configuration. -# -# Optional settings can be discovered by running "shellcheck --list-optional". -# The following page includes more information about the .shellcheckrc file: -# https://github.com/koalaman/shellcheck/wiki/Directive#shellcheckrc-file -# -# Note: shellcheck does not consider style factors such as indentation and -# line length. Shfmt is used for that; its configuration is in .editorconfig. -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# We use bash for all the scripts, so tell shellcheck to assume this dialect. -shell=bash - -# Makes shellcheck include files pointed-to by the source or . statements. -external-sources=true - -# Enable check for when a script uses "set -e" but a construct may disable it. -enable=check-set-e-suppressed - -# Enable check for tests like [ "$var" ], which are best written [ -n "$var" ]. -enable=avoid-nullary-conditions