Skip to content

Commit

Permalink
Make TypeScript configuration stricter and fix Vega-Lite types
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Nov 28, 2024
1 parent 92ee5c4 commit 0dc572d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
21 changes: 20 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ import tseslint from 'typescript-eslint'
export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
extends: [
js.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.strictTypeChecked,
],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
project: ['./tsconfig.app.json', './tsconfig.node.json'],
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
'react-hooks': reactHooks,
Expand All @@ -23,6 +31,17 @@ export default tseslint.config(
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
},
},
)
4 changes: 2 additions & 2 deletions src/components/ActivityChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface ActivityChartProps {
type: ActivityType;
}

export function ActivityChart({ activities, type }: ActivityChartProps) {
export function ActivityChart({ activities, type }: ActivityChartProps): JSX.Element {

Check failure on line 11 in src/components/ActivityChart.tsx

View workflow job for this annotation

GitHub Actions / verify (18.x)

`JSX` is deprecated. Use `React.JSX` instead of the global `JSX` namespace
const spec: VisualizationSpec = useMemo(() => ({
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
data: {
Expand All @@ -19,7 +19,7 @@ export function ActivityChart({ activities, type }: ActivityChartProps) {
status: a.status,
})),
},
mark: 'line',
mark: { type: 'line' } as const,
encoding: {
x: {
field: 'date',
Expand Down
25 changes: 23 additions & 2 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,28 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
"noUncheckedIndexedAccess": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"exactOptionalPropertyTypes": true,
"noUncheckedSideEffectImports": true,

/* Type Checking */
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"useUnknownInCatchVariables": true,
"alwaysStrict": true,
"esModuleInterop": true,
"allowJs": false,
"checkJs": false
},
"include": ["src"]
"include": ["src"],
"exclude": ["node_modules"]
}

0 comments on commit 0dc572d

Please sign in to comment.