Skip to content

Commit ca4572a

Browse files
committed
dx: commits should fail if they do not pass linter
1 parent 0fd03c1 commit ca4572a

6 files changed

Lines changed: 25 additions & 18 deletions

File tree

.eslintrc.cjs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ module.exports = {
2424
'import/no-unresolved': 'error',
2525
'import/no-relative-packages': 'error',
2626
'import/no-self-import': 'error',
27-
'import/newline-after-import': ['error', { count: 1, exactCount: true, considerComments: true }],
27+
'import/newline-after-import': [
28+
'error',
29+
{ count: 1, exactCount: true, considerComments: true },
30+
],
2831
'import/no-duplicates': 'error',
2932

3033
'no-restricted-imports': 'off',
@@ -45,23 +48,27 @@ module.exports = {
4548
],
4649

4750
// https://stackoverflow.com/a/64067915
48-
"no-unused-vars": "off",
49-
"@typescript-eslint/no-unused-vars": [
50-
"error",
51+
'no-unused-vars': 'off',
52+
'@typescript-eslint/no-unused-vars': [
53+
'error',
5154
{
52-
"argsIgnorePattern": "^_",
53-
"varsIgnorePattern": "^_",
54-
"caughtErrorsIgnorePattern": "^_"
55-
}
56-
]
55+
argsIgnorePattern: '^_',
56+
varsIgnorePattern: '^_',
57+
caughtErrorsIgnorePattern: '^_',
58+
},
59+
],
5760
},
5861

5962
settings: {
6063
'import/parsers': {
6164
'@typescript-eslint/parser': ['.ts', '.tsx'],
6265
},
6366
'import/resolver': {
64-
typescript: {},
67+
typescript: {
68+
// always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
69+
alwaysTryTypes: true,
70+
project: './tsconfig.json',
71+
},
6572
},
6673
},
6774
}

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
npx tsc
1+
yarn lint
22
npx lint-staged

environments/firefox/firefox.background.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ browser.runtime.onInstalled.addListener(() => {
88
console.log('Installed!')
99
})
1010

11-
browser.windows.getCurrent({ populate: true }).then((windowInfo) => {
12-
let myWindowId = windowInfo.id;
13-
});
11+
// browser.windows.getCurrent({ populate: true }).then((windowInfo) => {
12+
// let myWindowId = windowInfo.id;
13+
// });

src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import App from '~/App'
99
import DaisyUiThemeProvider from '~/containers/DaisyUiThemeProvider'
1010

1111
import '~/index.css'
12-
import StartupSpinner from './icons/StartupSpinner'
12+
import StartupSpinner from '~/icons/StartupSpinner'
1313

1414
const errorPage = (
1515
<div className="flex h-screen w-screen items-center justify-center bg-base-100">

src/tests/components/Omnibar.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import OmniBar from '~/components/OmniBar'
1010
import { settingStore } from '~/core/setting/SettingStore'
1111
import { chatStore } from '~/core/chat/ChatStore'
1212
import { focusStore } from '~/core/FocusStore'
13-
import { connectionStore } from '../../core/connection/ConnectionStore'
14-
import { setServerResponse } from '../msw'
13+
import { connectionStore } from '~/core/connection/ConnectionStore'
14+
import { setServerResponse } from '~/tests/msw'
1515

1616
describe('OmniBar', () => {
1717
const navigate = vi.fn()

tailwind.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @type {import('tailwindcss').Config} */
22

33
import { heroui } from '@heroui/react'
4-
import themes, { synthwave } from 'daisyui/src/theming/themes'
4+
import themes from 'daisyui/src/theming/themes'
55

66
const errorColor = 'oklch(51% 0.17 22.1)'
77

0 commit comments

Comments
 (0)