Skip to content

Commit 35077ca

Browse files
committed
fixup! [New] Symmetric useState hook variable names
1 parent c5b65a9 commit 35077ca

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/lib/rules/hook-use-state.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const tests = {
4646
},
4747
{
4848
code: `
49-
import React from 'react';
49+
import React from 'react'
5050
function useColor() {
5151
const [color, setColor] = React.useState()
5252
return [color, setColor]
@@ -150,14 +150,15 @@ const tests = {
150150
`,
151151
features: ['ts'],
152152
},
153+
]),
154+
invalid: parsers.all([
153155
{
154156
code: `
155157
import { useState } from 'react';
156-
const result = useState();
158+
const result = useState()
157159
`,
160+
errors: [{ message: 'useState call is not destructured into value + setter pair' }],
158161
},
159-
]),
160-
invalid: parsers.all([
161162
{
162163
code: `
163164
import { useState } from 'react';
@@ -435,7 +436,7 @@ const tests = {
435436
{
436437
code: `
437438
import { useState } from 'react'
438-
const [color, setFlavor, extraneous] = useState();
439+
const [color, setFlavor, extraneous] = useState()
439440
`,
440441
errors: [
441442
{
@@ -444,7 +445,7 @@ const tests = {
444445
{
445446
output: `
446447
import { useState } from 'react'
447-
const [color, setColor] = useState();
448+
const [color, setColor] = useState()
448449
`,
449450
},
450451
],

0 commit comments

Comments
 (0)