Skip to content

Commit

Permalink
fixup! [New] Symmetric useState hook variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanbeevers committed Dec 24, 2021
1 parent c5b65a9 commit 35077ca
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/lib/rules/hook-use-state.js
Expand Up @@ -46,7 +46,7 @@ const tests = {
},
{
code: `
import React from 'react';
import React from 'react'
function useColor() {
const [color, setColor] = React.useState()
return [color, setColor]
Expand Down Expand Up @@ -150,14 +150,15 @@ const tests = {
`,
features: ['ts'],
},
]),
invalid: parsers.all([
{
code: `
import { useState } from 'react';
const result = useState();
const result = useState()
`,
errors: [{ message: 'useState call is not destructured into value + setter pair' }],
},
]),
invalid: parsers.all([
{
code: `
import { useState } from 'react';
Expand Down Expand Up @@ -435,7 +436,7 @@ const tests = {
{
code: `
import { useState } from 'react'
const [color, setFlavor, extraneous] = useState();
const [color, setFlavor, extraneous] = useState()
`,
errors: [
{
Expand All @@ -444,7 +445,7 @@ const tests = {
{
output: `
import { useState } from 'react'
const [color, setColor] = useState();
const [color, setColor] = useState()
`,
},
],
Expand Down

0 comments on commit 35077ca

Please sign in to comment.