Issues with function args in Typescript types
Answered
Anay-208 posted this in #help-forum
Answered by Anay-208
So, based on this stackoverflow link: https://stackoverflow.com/questions/68802881/get-rid-of-is-defined-but-never-used-in-function-parameter
I found a comment
This helped me solve the issue by extending
I found a comment
You need to use the TypeScript version of the rule, ESLint's rules aren't aware of types
This helped me solve the issue by extending
typescript-eslint.28 Replies
Anay-208OP
-# .eslintsrc.js
const path = require("path")
module.exports = {
"root": true,
"extends": [
"eslint:recommended",
"next/core-web-vitals",
"plugin:eslint-plugin-next-on-pages/recommended",
"plugin:tailwindcss/recommended",
"next",
"prettier",
],
settings: {
tailwindcss: {
config: path.join(__dirname, './tailwind.config.ts'),
},
},
"plugins": [
"eslint-plugin-next-on-pages"
]
}@Anay-208 I'm getting this error, How do I fix it?
I believe its something relating to eslint
Bigeye scad
Quick google search for how to remove no unused vars eslint should help you out
@Bigeye scad Quick google search for how to remove no unused vars eslint should help you out
Anay-208OP
Do you expect to type this every time?
//disable…
I already know that. I asked this question to remove this warning
Bigeye scad
No, in your eslint config file
i only have this
{
"extends": "next/core-web-vitals",
"rules": {
"@next/next/no-img-element": "off"
}
}i dont get no-unused-vars error with this config
@Bigeye scad No, in your eslint config file
Anay-208OP
I don’t want to disable it
Issue is I’m getting this warning in ts types
@gin why is your eslint so advanced
Anay-208OP
To be able to see all my errors like u used variables
Anay-208OP
bump
@Anay-208 bump
Blue Picardy Spaniel
just don't declare the variable?
@Blue Picardy Spaniel just don't declare the variable?
Anay-208OP
I'll get a warning in my code then
Blue Picardy Spaniel
saying what
Blue Picardy Spaniel
paste the code that's having issues
Anay-208OP
interface PopupContentProps {
onClick: (state: string) => void;
}I'm getting warning on state
thats the min repro
Blue Picardy Spaniel
Anay-208OP
Will try this soon
Blue Picardy Spaniel
@Anay-208 do you still need the link?
Anay-208OP
No, found it
Anay-208OP
So, based on this stackoverflow link: https://stackoverflow.com/questions/68802881/get-rid-of-is-defined-but-never-used-in-function-parameter
I found a comment
This helped me solve the issue by extending
I found a comment
You need to use the TypeScript version of the rule, ESLint's rules aren't aware of types
This helped me solve the issue by extending
typescript-eslint.Answer