Skip to content

Commit

Permalink
feat: upgrade (eslint 9, react 19, vite 6, date-fns 4, extract-colors…
Browse files Browse the repository at this point in the history
… 4, etc.) + fixes (#174)

- upgrade `eslint` to v9 & `prettier` to v3
- upgrade `vite` to v6
- upgrade `tailwindcss` & `postcss`
- upgrade various deps (minor)
- upgrade `date-fns` to v4
- upgrade `extract-colors` to v4
- upgrade `radash` to v12
- upgrade to `react` v19
- upgrade `@e-krebs/react-library` to v0.0.41

fixes:
- more agressive caching
- smiley uses currentColor (was black on dark background in dark mode)
- fix: matching url was broken
- defensiveness in pocket/get
  • Loading branch information
e-krebs authored Dec 16, 2024
1 parent a8545c5 commit 9e0d44a
Show file tree
Hide file tree
Showing 54 changed files with 568 additions and 383 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

60 changes: 0 additions & 60 deletions .eslintrc

This file was deleted.

3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"plugins": ["prettier-plugin-tailwindcss"],
"printWidth": 105,
"singleQuote": true,
"endOfLine": "auto"
}
}
Binary file modified bun.lockb
Binary file not shown.
116 changes: 116 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import reactRefresh from 'eslint-plugin-react-refresh';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import reactHooks from 'eslint-plugin-react-hooks';
import _import from 'eslint-plugin-import';
import prettier from 'eslint-plugin-prettier';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
files: ['**/*.ts', '**/*.tsx'],
},
{
ignores: ['**/*tailwind.config.ts'],
},
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript'
)
),
{
plugins: {
'react-refresh': reactRefresh,
'@typescript-eslint': fixupPluginRules(typescriptEslint),
'react-hooks': fixupPluginRules(reactHooks),
import: fixupPluginRules(_import),
prettier,
},

languageOptions: {
parser: tsParser,
},

settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},

typescript: {},
},

react: {
version: 'detect',
},
},

rules: {
'prettier/prettier': 'error',
'no-prototype-builtins': 'off',

'no-console': [
'error',
{
allow: ['warn', 'error'],
},
],

'require-await': 'error',
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-empty-function': 'off',
'react/no-unescaped-entities': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',

'react-refresh/only-export-components': [
'warn',
{
allowConstantExport: true,
},
],

'import/order': [
'error',
{
groups: [['builtin', 'external'], ['internal'], ['parent', 'sibling', 'index']],
'newlines-between': 'always',
},
],

'@typescript-eslint/no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],

semi: ['error', 'always'],
},
},
{
files: ['**/*.d.ts'],

rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
];
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "pile",
"description": "pile",
"version": "1.10.0",
"version": "1.11.0",
"icons": {
"16": "src/content/icons/icon-16.png",
"48": "src/content/icons/icon-48.png",
Expand Down
83 changes: 41 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pile",
"version": "1.10.0",
"version": "1.11.0",
"author": "Emmanuel Krebs <e-krebs@users.noreply.github.com>",
"license": "MIT",
"type": "module",
Expand All @@ -9,7 +9,7 @@
"build": "bun run clean && bunx --bun vite build",
"zip": "cd dist && bestzip ../pile.zip *",
"clean": "bun run clean.ts",
"lint": "eslint --ext .ts,.tsx src",
"lint": "eslint src",
"type-check": "tsc --noEmit",
"setup-ci": "cp ./src/env.sample.json ./src/env.json"
},
Expand All @@ -23,52 +23,51 @@
"webext-prod": {}
},
"dependencies": {
"@algolia/requester-fetch": "^4.23.3",
"@react-aria/checkbox": "^3.9.0",
"@react-aria/textfield": "^3.9.1",
"@react-aria/visually-hidden": "^3.8.0",
"@react-stately/toggle": "^3.5.1",
"algoliasearch": "^4.23.3",
"classnames": "^2.3.2",
"date-fns": "^2.30.0",
"extract-colors": "^3.0.0",
"radash": "^10.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@algolia/requester-fetch": "^5.17.1",
"@react-aria/checkbox": "^3.15.0",
"@react-aria/textfield": "^3.15.0",
"@react-aria/visually-hidden": "^3.8.18",
"@react-stately/toggle": "^3.8.0",
"algoliasearch": "^5.17.1",
"classnames": "^2.5.1",
"date-fns": "^4.1.0",
"extract-colors": "^4.1.1",
"radash": "^12.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-feather": "^2.0.10",
"react-hotkeys-hook": "^4.4.0",
"react-hotkeys-hook": "^4.6.1",
"react-query": "^3.39.3"
},
"devDependencies": {
"@crxjs/vite-plugin": "^2.0.0-beta.28",
"@e-krebs/react-library": "^0.0.23",
"@tailwindcss/typography": "^0.5.9",
"@types/bun": "^1.1.8",
"@types/chrome": "^0.0.236",
"@types/express": "^4.17.17",
"@types/node": "^20.16.1",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"@vitejs/plugin-react": "^4.3.1",
"@e-krebs/react-library": "^0.0.41",
"@eslint/compat": "^1.2.4",
"@tailwindcss/typography": "^0.5.15",
"@types/bun": "^1.1.14",
"@types/chrome": "^0.0.287",
"@types/node": "^20.17.10",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"@vitejs/plugin-react": "^4.3.4",
"bestzip": "^2.2.1",
"eslint": "^8.44.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.11",
"parcel": "^2.11.0",
"parcel-namer-rewrite": "2.10.3-rc.2",
"postcss": "^8.4.31",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.3.0",
"tailwindcss": "^3.3.2",
"typescript": "^5.0.4",
"vite": "^5.4.2",
"vite-plugin-svgr": "^4.2.0"
"eslint": "^9.17.0",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"postcss": "^8.4.49",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.9",
"tailwindcss": "^3.4.16",
"tailwindcss-react-aria-components": "^1.2.0",
"typescript": "^5.7.2",
"vite": "^6.0.3",
"vite-plugin-svgr": "^4.3.0"
},
"resolutions": {
"json5": "2.2.3",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Action: FC<ActionProps> = ({ icon, rgb, title, onClick, loading })
className={cx(
'shrink-0 cursor-pointer',
'flex h-10 w-10 items-center justify-center',
'rounded-full hover:bg-gray-100 hover:dark:bg-gray-800'
'rounded-full hover:bg-gray-100 hover:dark:bg-gray-800',
)}
title={title}
onClick={onClick}
Expand All @@ -30,7 +30,7 @@ export const Action: FC<ActionProps> = ({ icon, rgb, title, onClick, loading })
className={cx(
'h-5 w-5',
loading && 'animate-spin',
!color && 'text-gray-900 dark:text-gray-100'
!color && 'text-gray-900 dark:text-gray-100',
)}
style={{ color }}
/>
Expand Down
12 changes: 6 additions & 6 deletions src/components/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export const Autocomplete: FC<AutocompleteProps> = ({
allOptions
.filter((option) => !inputOption || option.value.includes(inputOption))
.sort(
(option1, option2) => option1.value.indexOf(inputOption) - option2.value.indexOf(inputOption)
(option1, option2) => option1.value.indexOf(inputOption) - option2.value.indexOf(inputOption),
)
.slice(0, 4),
[allOptions, inputOption]
[allOptions, inputOption],
);

const newOption: Option = useMemo(
() => (optionIndex === null ? { value: inputOption } : options[optionIndex]),
[options, inputOption, optionIndex]
[options, inputOption, optionIndex],
);

const add = async (option?: string) => {
Expand Down Expand Up @@ -104,7 +104,7 @@ export const Autocomplete: FC<AutocompleteProps> = ({
<ul
className={cx(
className,
'grid min-w-[25%] items-center gap-y-px rounded-lg border bg-gray-100 p-1 dark:bg-gray-800'
'grid min-w-[25%] items-center gap-y-px rounded-lg border bg-gray-100 p-1 dark:bg-gray-800',
)}
>
<TextInput
Expand All @@ -122,8 +122,8 @@ export const Autocomplete: FC<AutocompleteProps> = ({
key={option.value}
className={cx(
'cursor-pointer truncate rounded-sm px-1 leading-5',
'hover:bg-white hover:dark:bg-gray-900 ',
index === optionIndex && 'bg-white dark:bg-gray-900'
'hover:bg-white hover:dark:bg-gray-900',
index === optionIndex && 'bg-white dark:bg-gray-900',
)}
onClick={() => add(option.value)}
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/List/Item/ItemComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const ItemComponent: FC<RefAttributes<HTMLDivElement>> = forwardRef<HTMLD
<div
className={cx(
'rounded-md py-2 hover:bg-inherit',
isOpen ? 'bg-inherit' : 'bg-white dark:bg-gray-900'
isOpen ? 'bg-inherit' : 'bg-white dark:bg-gray-900',
)}
>
<div className="flex items-start space-x-4 pl-2">
Expand Down Expand Up @@ -57,5 +57,5 @@ export const ItemComponent: FC<RefAttributes<HTMLDivElement>> = forwardRef<HTMLD
</div>
</div>
);
}
},
);
4 changes: 2 additions & 2 deletions src/components/List/Item/TagAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const TagAutocomplete: FC = () => {

const options: Option[] = useMemo(
() => allTags.filter((tag) => !tags.includes(tag)).map((value) => ({ value })),
[allTags, tags]
[allTags, tags],
);

const close = useCallback(() => {
Expand All @@ -35,7 +35,7 @@ export const TagAutocomplete: FC = () => {
}
close();
},
[close, getQueryKey, id, queryClient, service]
[close, getQueryKey, id, queryClient, service],
);

if (!service.isUpdatable) return null;
Expand Down
Loading

0 comments on commit 9e0d44a

Please sign in to comment.