Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add empty prettier config #283

Merged
merged 1 commit into from
Nov 25, 2022
Merged

Add empty prettier config #283

merged 1 commit into from
Nov 25, 2022

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Nov 25, 2022

By not having a config file, prettier (really cosmiconfig) will look upwards and in home directories, which can result in linting errors if there is a config there (such as I have).

Adding an empty config file ensures that prettier will always use the right config.

Copy link
Owner

@bmish bmish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. Note that I'm using ESLint to run prettier currently (configured by eslint-plugin-square).

@bmish bmish added the internal label Nov 25, 2022
@G-Rath
Copy link
Contributor Author

G-Rath commented Nov 25, 2022

Yeah, this happens regardless of how prettier is invoked i.e. this is the result of me running nrun lint:js right now (without this file):

✖ 402 problems (402 errors, 0 warnings)
  402 errors and 0 warnings potentially fixable with the `--fix` option.

😅

@bmish bmish merged commit b0d5a92 into bmish:main Nov 25, 2022
@G-Rath G-Rath deleted the add-prettier-config branch November 25, 2022 19:22
@bmish bmish changed the title chore: add empty prettier config Add empty prettier config Nov 25, 2022
@G-Rath
Copy link
Contributor Author

G-Rath commented Nov 26, 2022

@bmish so it seems that there is some contention between tools because you're actually at least using single-quotes in most of the codebase and that is what is being enforced by Prettier via ESLint, but not by the Prettier CLI (because it's not set in the config).

What I can't find out is where the Prettier plugin for ESLint is being configured to use single-quotes - all I can find is this, and even then that seems wrong because you switched to double quotes a few months ago.

I think I missed this because of ESLint caching, which generally is considered broken due to this sort of thing. I'm happy to do a PR adding in the single quotes option which seems like the immediate right thing to do, but wanted to run that by you first since you've got a better understanding of all the configs :)

@bmish
Copy link
Owner

bmish commented Nov 26, 2022

Prettier is being set to single quotes here. The goal is definitely to use single quotes and have eslint-plugin-square control that for us. It may have been a mistake for @square/prettier-config to switch to double quotes while the rest of eslint-plugin-square was intending to specify single quotes.

@G-Rath
Copy link
Contributor Author

G-Rath commented Nov 26, 2022

🤦 no idea how I missed that - I'd really recommend though having a prettier config at the project level, even if it's just pulling in @square/prettier-config, to avoid the original problem I described; but your call - if you don't want that then you should probably revert this.

fwiw my use-case is that I use prettier quite aggressively to format my code when I'm working, whereas ESLint has a higher overhead to run and typically is checking for more complex things that I might not be ready to address.

@bmish
Copy link
Owner

bmish commented Nov 26, 2022

Fair points. I may rework this setup soon.

@bmish
Copy link
Owner

bmish commented Dec 5, 2022

@G-Rath FYI #331 should fix the @square/prettier-config issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants