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

@mikehardy/lint battles #33

Merged

Conversation

mikehardy
Copy link
Collaborator

@mikehardy mikehardy commented Nov 28, 2021

A bunch of little battles I just won with eslint + prettier ;-)

Each comment has what I learned and the reference

what a pain in the ... haha

yarn lint:all is now completely clean with these, including in a real project where there are switch statements and export const enums and such

Why?

Without this, you can't use `JSX.Element` etc as symbols
because typescript-eslint does not understand they are present.

`tsc` has no problem with the files.

This is specifically recommended as a setting by the linter docs:

https://github.com/typescript-eslint/typescript-eslint/blob/eaaa2047ca54f098dcdd32aaf5d8949495c6be26/docs/linting/TROUBLESHOOTING.md?plain=1#L111
they deprecated the old one: jsxBracketSameLine -> bracketSameLine

https://prettier.io/blog/2021/09/09/2.4.0.html

> This release renames the jsxBracketSameLine option to bracketSameLine, which supports HTML, Vue, and Angular in addition to JSX. The old name has been deprecated.
verified working, allows removal of ts-ignore/eslint-ignore,
which gets rid of a warning about an unreported eslint-ignore
using spacing in eslint conflicts with spacing rules in prettier,
and they *specifically* disagree on switch/case spacing in their
default setups.

Let Prettier control spacing, lint:all passes with fewer directives
and pretty switch/case spacing.
Hopefully integrates via PR upstream in `@react-native-community`,
this appears to be the standard configuration for no-shadow in
typescript projects, see:

react-native-community/react-native-template-typescript#238
@mikehardy
Copy link
Collaborator Author

Hmmm 🤔 - obviously the goal is clean lint runs and I have that locally.
I'll re-examine the lint failure a bit later to make sure this goes green in CI

@mikehardy
Copy link
Collaborator Author

Ah, it's on a component that doesn't exist anymore after #32 - or shouldn't - it does seem like the develop branch may be in a strange state ?

/home/runner/work/luna/luna/template/src/app/components/LearnMoreLinks/LearnMoreLinks.tsx

Error:    1:1   error    Delete `⏎`                                                                                                                                                                                                           prettier/prettier
Error:   17:31  error    Replace `'button'` with `"button"`                                                                                                                                                                                   prettier/prettier
Warning:   17:31  warning  Unexpected usage of singlequote                                                                                                                                                                                      jsx-quotes

@LunatiqueCoder
Copy link
Owner

Yep, it also seems to me that I messed something up with the develop branch, I'm trying to figure it out,

@LunatiqueCoder LunatiqueCoder changed the base branch from develop to master November 29, 2021 11:59
@LunatiqueCoder LunatiqueCoder changed the base branch from master to develop November 29, 2021 12:00
@LunatiqueCoder LunatiqueCoder merged commit d840d74 into LunatiqueCoder:develop Nov 29, 2021
@mikehardy mikehardy deleted the @mikehardy/lint-battles branch November 29, 2021 14:10
@mikehardy
Copy link
Collaborator Author

My firebase auth template on top of this one now does theming and language switching (including the built-in email auth templates that firebase gives you!). Just need a translation for 'ro' and you've got an out-of-the-box web/mobile app that's in your language - you might find that useful

@LunatiqueCoder
Copy link
Owner

I'm doing the last changes for Luna and I'll try the firebase example ASAP.

Unfortunately, I'm still on a vacation and my family demands my attention 😂 Trying to hop on the laptop whenever I have some spare time.

@mikehardy
Copy link
Collaborator Author

Oh hang with the family every time. Laptop will always be there... Cheers man :-)

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

Successfully merging this pull request may close these issues.

2 participants