Apply .prettierrc.json at top level for DX purposes

Created on 11 October 2022, about 2 years ago
Updated 5 August 2024, 4 months ago

Problem/Motivation

The core/.eslintrc.json is extended into a top-level .eslintrc.json:

{
  "extends": "./core/.eslintrc.json"
}

However, core/.prettierrc.json is used by eslint-plugin-prettier and is not extended to the top-level. This is could be confusing for developers, as the eslint configuration will run prettier without configuring it, and bogus code formatting errors will be reported.

Steps to reproduce

In a development sandbox, run yarn install from the core directory, and then run ../../../core/node_modules/.bin/eslint --resolve-plugins-relative-to=../../../core . from a contrib module directory. The unconfigured prettier plugin will incorrectly report that e.g. double quotes in .yml files should be changed to single quotes: error Replace `''` with `""` prettier/prettier

Proposed resolution

We could either symlink core/.prettierrc.json at the top level (approach used by my initial patch), or add prettier config to the .eslintrc.json, but the latter is not recommended since an editor extension will not read .eslintrc.json, as per https://github.com/prettier/eslint-plugin-prettier#options

Remaining tasks

Review patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Probably not needed as it's developer-facing.

✨ Feature request
Status

Closed: won't fix

Version

11.0 πŸ”₯

Component
JavascriptΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024