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

The one where biome replaces eslint #4

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 0 additions & 82 deletions .eslintrc.cjs

This file was deleted.

26 changes: 7 additions & 19 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,15 @@ permissions:
pull-requests: write
jobs:
lint:
name: ⬣ ESLint
name: ⬣ Biome lint
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]

- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: 🔬 Lint
run: npm run lint:strict
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
- name: Run Biome
run: biome ci .

typecheck:
name: 🔎 Type check
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run typecheck && npm run lint:strict
npm run typecheck && npm run lint
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["codeforge.remix-forge"]
"recommendations": ["codeforge.remix-forge", "biomejs.biome"]
}
34 changes: 34 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.formatOnType": false,
"editor.renderWhitespace": "all",
"editor.rulers": [120, 160],
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "never",
"source.organizeImports.biome": "always",
"quickfix.biome": "always"
},
"eslint.enable": false,
"prettier.enable": false,
"editor.insertSpaces": false,
"editor.detectIndentation": false,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"workbench.colorCustomizations": {
"editorWhitespace.foreground": "#333"
},
"files.trimTrailingWhitespace": true,
"files.trimTrailingWhitespaceInRegexAndStrings": true,
"files.trimFinalNewlines": true,
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
90 changes: 45 additions & 45 deletions app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
import { RemixBrowser } from "@remix-run/react";
import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";
import i18n from "~/localization/i18n";
import i18next from "i18next";
import { I18nextProvider, initReactI18next } from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import Backend from "i18next-http-backend";
import { getInitialNamespaces } from "remix-i18next/client";
import { resources } from "./localization/resource";
import { RemixBrowser } from "@remix-run/react"
import i18next from "i18next"
import LanguageDetector from "i18next-browser-languagedetector"
import Backend from "i18next-http-backend"
import { StrictMode, startTransition } from "react"
import { hydrateRoot } from "react-dom/client"
import { I18nextProvider, initReactI18next } from "react-i18next"
import { getInitialNamespaces } from "remix-i18next/client"
import i18n from "~/localization/i18n"
import { resources } from "./localization/resource"

async function hydrate() {
// eslint-disable-next-line import/no-named-as-default-member
await i18next
.use(initReactI18next) // Tell i18next to use the react-i18next plugin
.use(LanguageDetector) // Setup a client-side language detector
.use(Backend) // Setup your backend
.init({
...i18n, // spread the configuration
// This function detects the namespaces your routes rendered while SSR use
ns: getInitialNamespaces(),
backend: { loadPath: "/locales/{{lng}}/{{ns}}.json" },
resources,
detection: {
// Here only enable htmlTag detection, we'll detect the language only
// server-side with remix-i18next, by using the `<html lang>` attribute
// we can communicate to the client the language detected server-side
order: ["htmlTag"],
// Because we only use htmlTag, there's no reason to cache the language
// on the browser, so we disable it
caches: [],
},
});
// eslint-disable-next-line import/no-named-as-default-member
await i18next
.use(initReactI18next) // Tell i18next to use the react-i18next plugin
.use(LanguageDetector) // Setup a client-side language detector
.use(Backend) // Setup your backend
.init({
...i18n, // spread the configuration
// This function detects the namespaces your routes rendered while SSR use
ns: getInitialNamespaces(),
backend: { loadPath: "/locales/{{lng}}/{{ns}}.json" },
resources,
detection: {
// Here only enable htmlTag detection, we'll detect the language only
// server-side with remix-i18next, by using the `<html lang>` attribute
// we can communicate to the client the language detected server-side
order: ["htmlTag"],
// Because we only use htmlTag, there's no reason to cache the language
// on the browser, so we disable it
caches: [],
},
})

startTransition(() => {
hydrateRoot(
document,
<I18nextProvider i18n={i18next}>
<StrictMode>
<RemixBrowser />
</StrictMode>
</I18nextProvider>
);
});
startTransition(() => {
hydrateRoot(
document,
<I18nextProvider i18n={i18next}>
<StrictMode>
<RemixBrowser />
</StrictMode>
</I18nextProvider>
)
})
}

if (window.requestIdleCallback) {
window.requestIdleCallback(hydrate);
window.requestIdleCallback(hydrate)
} else {
// Safari doesn't support requestIdleCallback
// https://caniuse.com/requestidlecallback
window.setTimeout(hydrate, 1);
// Safari doesn't support requestIdleCallback
// https://caniuse.com/requestidlecallback
window.setTimeout(hydrate, 1)
}
Loading