prettier

How to overcome those prettier errors?


After commenting out and uncommenting some lines in a YML file, I can't get my project pushed to our Gitlab anymore due to those prettier errors. To be precise, the commented out block is the server 8080 and uncommented block is the server 443.

✖ prettier --write:
[error] src/main/resources/config/application-prod.yml: SyntaxError: All collection items must start at the same column (16:1)
[error]        14 | # ===================================================================
[error]        15 |
[error] >    16 | logging:
[error]              | ^^^^^^^^
[error] >    17 |      level:
[error]              | ^^^^^^^^
[error] >    18 |          ROOT: INFO
[error]              | ^^^^^^^^
[error] >    19 |          tech.jhipster: INFO
[error]              | ^^^^^^^^
[error] >    20 |          com.abc.myapp: INFO
[error]              | ^^^^^^^^
[error] >    21 |
[error]              | ^^^^^^^^
[error] >    22 | management:
[error]              | ^^^^^^^^
[error] >    23 |      metrics:
[error]              | ^^^^^^^^
[error] >    24 |          export:
[error]              | ^^^^^^^^
[error] >    25 |              prometheus:
[error]              | ^^^^^^^^
[error] >    26 |                  enabled: false
[error]              | ^^^^^^^^
...
[error] > 129 |
[error]              | ^
husky - pre-commit hook exited with code 1 (error)

The error message says

 All collection items must start at the same column (16:1)

I didn't change those lines at all. After making a comparison of the before and after editing versions of the same file in an IDE, I don't see any changes on those lines say line 16.

How to overcome this problem?

Here is the original file:

# ===================================================================
# Spring Boot configuration for the "prod" profile.
#
# This configuration overrides the application.yml file.
#
# More information on profiles:  https://www.jhipster.tech/profiles/
# More information on configuration properties: https://www.jhipster.tech/common-application-properties/
#   ===================================================================

# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================

logging:
  level:
    ROOT: INFO
    tech.jhipster: INFO
    com.abc.myapp: INFO

management:
  metrics:
    export:
      prometheus:
        enabled: false

spring:
  devtools:
    restart:
      enabled: false
    livereload:
      enabled: false
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:postgresql://localhost:5432/myapp
    username: myapp
    password:
    hikari:
      poolName: Hikari
      auto-commit: false
  jpa:
    database-platform: tech.jhipster.domain.util.FixedPostgreSQL10Dialect
  # Replace by 'prod, faker' to add the faker context and have sample data loaded in production
  liquibase:
    contexts: prod
  thymeleaf:
    cache: true
 security:
    oauth2:
      client:
        provider:
          oidc:
            issuer-uri: https://xyz.abc.com/
        registration:
          oidc:
            client-id: 78368cea7-17f90-439b-ac0f8-8a3296b300a50a
            client-secret: gto_ha769wcw4tafye7jrtljcmfe0vrk7k2r7yvaz38rpbkzo63o8s8tggn2pq
            scope: openid,profile,email,offline_access

# ===================================================================
# To enable TLS in production, generate a certificate using:
# keytool -genkey -alias myapp -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
#
# You can also use Let's Encrypt:
# https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm
#
# Then, modify the server.ssl properties so your "server" configuration looks like:

server:
  port: 443
  SSL:
    key-store: classpath:/home/ec12-user/docker/wrwvw/webapp-docker
    key-store-password: sf8*#l9
    key-store-type: PKCS12
    key-alias: myapp
    # The ciphers suite enforce the security by deactivating some old and deprecated SSL cipher, this list was tested against SSL Labs (https://www.ssllabs.com/ssltest/)
    ciphers: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 ,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
# ===================================================================
# server:
#  port: 8080
#  shutdown: graceful # see https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-graceful-shutdown
#  compression:
#    enabled: true
#    mime-types: text/html,text/xml,text/plain,text/css,application/javascript,application/json,image/svg+xml
# min-response-size: 1024

# ===================================================================
# JHipster specific properties
#
# Full reference is available at: https://www.jhipster.tech/common-application-properties/
# ===================================================================

jhipster:
  HTTP:
    cache: # Used by the CachingHttpHeadersFilter
      timeToLiveInDays: 1461
  cache: # Cache configuration
    ehcache: # Ehcache configuration
      time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
      max-entries: 1000 # Number of objects in each cache entry
  logging:
    use-json-format: false # By default, logs are not in Json format
    logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
      enabled: false
      host: localhost
      port: 5000
      queue-size: 512
# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JHipsterProperties above
#
# More documentation is available at:
# https://www.jhipster.tech/common-application-properties/
# ===================================================================

# application:

Solution

  • I am having similar issues with parsing errors with husky when trying to do a git commit. I "solved" it following this answer which says that you need to add a --no-verify flag:

    git commit -m "message for the commit" --no-verify

    Disclaimer: this overcomes the prettier errors but does not solve it. Be sure to check that your code works properly and follows the respective code guidelines before overpassing it. After you succesfully have done that, you will not need to use the --no-verify again unless you modify that file.