Skip to content

Commit

Permalink
test: eslint のテスト整備 (とちゅう)
Browse files Browse the repository at this point in the history
  • Loading branch information
a01sa01to committed Sep 24, 2024
1 parent 3842f57 commit 3b576b8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/eslint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: Linter.Config = {
position: 'before',
},
{
pattern: '{next**,next/**}',
pattern: '{next**,next/**,@remix-run/**}',
group: 'external',
position: 'before',
},
Expand Down
20 changes: 19 additions & 1 deletion packages/eslint/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,23 @@ import { createESLintInstance } from './common'
test('should be setup', async () => {
const instance = createESLintInstance()
expect(instance).not.toBeUndefined()
instance.lintText('const a = 1;')
const res = await instance.lintText("/*global console*/ console.log('Hello World!');")
expect(res).toHaveLength(1)
expect(res[0]!.messages).toHaveLength(0)
})

test('no-used-vars', async () => {
const instance = createESLintInstance()
const res = await instance.lintText("const foo = 1")
expect(res).toHaveLength(1)
expect(res[0]!.errorCount).toBeGreaterThan(0)
})

test('unused-imports', async () => {
const instance = createESLintInstance()
const res = await instance.lintText("import { foo } from './foo'")
expect(res).toHaveLength(1)
expect(res[0]!.errorCount).toBeGreaterThan(0)
console.log(res[0]!.messages)
})

0 comments on commit 3b576b8

Please sign in to comment.