Skip to content

Commit 15a6993

Browse files
committed
improve linting
1 parent 321bd8f commit 15a6993

File tree

4 files changed

+100
-117
lines changed

4 files changed

+100
-117
lines changed

.eslintrc.cjs

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,56 @@
1+
const vitestFiles = ['app/**/__tests__/**/*', 'app/**/*.{spec,test}.*']
2+
const testFiles = ['**/tests/**', ...vitestFiles]
3+
const appFiles = ['app/**']
4+
15
/** @type {import('@types/eslint').Linter.BaseConfig} */
26
module.exports = {
37
extends: [
48
'@remix-run/eslint-config',
59
'@remix-run/eslint-config/node',
610
'prettier',
711
],
12+
rules: {
13+
'@typescript-eslint/consistent-type-imports': [
14+
'warn',
15+
{
16+
prefer: 'type-imports',
17+
disallowTypeAnnotations: true,
18+
fixStyle: 'inline-type-imports',
19+
},
20+
],
21+
'@typescript-eslint/no-duplicate-imports': 'warn',
22+
},
823
overrides: [
24+
{
25+
plugins: ['remix-react-routes'],
26+
files: appFiles,
27+
excludedFiles: testFiles,
28+
rules: {
29+
'remix-react-routes/use-link-for-routes': 'error',
30+
'remix-react-routes/require-valid-paths': 'error',
31+
// disable this one because it doesn't appear to work with our
32+
// route convention. Someone should dig deeper into this...
33+
'remix-react-routes/no-relative-paths': [
34+
'off',
35+
{ allowLinksToSelf: true },
36+
],
37+
'remix-react-routes/no-urls': 'error',
38+
'no-restricted-imports': [
39+
'error',
40+
{
41+
patterns: [
42+
{
43+
group: testFiles,
44+
message: 'Do not import test files in app files',
45+
},
46+
],
47+
},
48+
],
49+
},
50+
},
951
{
1052
extends: ['@remix-run/eslint-config/jest-testing-library'],
11-
files: ['app/**/__tests__/**/*', 'app/**/*.{spec,test}.*'],
53+
files: vitestFiles,
1254
rules: {
1355
'testing-library/no-await-sync-events': 'off',
1456
'jest-dom/prefer-in-document': 'off',
@@ -23,15 +65,4 @@ module.exports = {
2365
},
2466
},
2567
],
26-
rules: {
27-
'@typescript-eslint/consistent-type-imports': [
28-
'warn',
29-
{
30-
prefer: 'type-imports',
31-
disallowTypeAnnotations: true,
32-
fixStyle: 'inline-type-imports',
33-
},
34-
],
35-
'@typescript-eslint/no-duplicate-imports': 'warn',
36-
},
3768
}

app/routes/admin+/cache.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
22
import {
33
Form,
4+
Link,
45
useFetcher,
56
useLoaderData,
67
useSearchParams,
@@ -189,10 +190,12 @@ function CacheKeyRow({
189190
}: {
190191
cacheKey: string
191192
instance?: string
192-
type: string
193+
type: 'sqlite' | 'lru'
193194
}) {
194195
const fetcher = useFetcher()
195196
const dc = useDoubleCheck()
197+
const encodedKey = encodeURIComponent(cacheKey)
198+
const valuePage = `/admin/cache/${type}/${encodedKey}?instance=${instance}`
196199
return (
197200
<div className="flex items-center gap-2 font-mono">
198201
<fetcher.Form method="post">
@@ -211,13 +214,9 @@ function CacheKeyRow({
211214
: 'Deleting...'}
212215
</Button>
213216
</fetcher.Form>
214-
<a
215-
href={`/admin/cache/${type}/${encodeURIComponent(
216-
cacheKey,
217-
)}?instance=${instance}`}
218-
>
217+
<Link reloadDocument to={valuePage}>
219218
{cacheKey}
220-
</a>
219+
</Link>
221220
</div>
222221
)
223222
}

0 commit comments

Comments
 (0)