Skip to content

Commit

Permalink
fix(eslint): parse jsx with typescript
Browse files Browse the repository at this point in the history
I do not know why this is required, but it does not work otherwise
  • Loading branch information
kentcdodds committed Jun 14, 2024
1 parent 5f1b6ee commit c9cfbfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 3 additions & 6 deletions eslint.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import globals from 'globals'
import {
parser as typescriptParser,
plugin as typescriptPlugin,
} from 'typescript-eslint'

const ERROR = 'error'
const WARN = 'warn'
Expand Down Expand Up @@ -81,6 +77,7 @@ export const config = [
react: (await import('eslint-plugin-react')).default,
},
languageOptions: {
parser: (await import('typescript-eslint')).parser,
parserOptions: {
jsx: true,
},
Expand Down Expand Up @@ -131,13 +128,13 @@ export const config = [
? {
files: ['**/*.ts?(x)'],
languageOptions: {
parser: typescriptParser,
parser: (await import('typescript-eslint')).parser,
parserOptions: {
projectService: true,
},
},
plugins: {
'@typescript-eslint': typescriptPlugin,
'@typescript-eslint': (await import('typescript-eslint')).plugin,
},
rules: {
'@typescript-eslint/no-unused-vars': [
Expand Down
7 changes: 7 additions & 0 deletions fixture/app/components/swizzle.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useState } from 'react'

export function Counter() {
const [count, setCount] = useState(0)
const increment = () => setCount((c) => c + 1)
return <button onClick={increment}>{count}</button>
}

0 comments on commit c9cfbfd

Please sign in to comment.