Lua truthiness rule warns even for Boolean type
I haven't found much on truthiness in the help tab but I believe this should not be warning me considering
columnIsFull
is a boolean (it is happening everywhere else in my codebase).
43 Replies
where did you get the bool?
i defined it on the previous line
oh
it is definitely 100% type boolean
because it shows at the top
sometimes happens that if eslint cant detect some types
and you get it from a type
it will think is any
should i try quickly
adding a return type to the function
and see if it fixes it
yeah maybe
nope
i will leave the return type there though because it helps with not making a silly mistake
weird
https://discord.com/channels/476080952636997633/476080952636997635/1200564845997736097
I got something similar
but I dont know
hmm
would you like my
.eslintrc
isentinel may know something about this. idk i think he is like an eslint wizard or somethingyou could ask him, but I really have no idea why it would happen
should i ping him? would he mind u think
i just dont know if the original rile has some false positives
sorry what exactly do you mean by this?
rule*
idk if the one in the plugin is broken
well i mean
if it were wouldnt everyone be experiencing this same issue?
because so far it just seems like its me and pepe at one point
i will just send the eslint rc because i dont really understand it at all
what version of eslint do you have
eslint@8.57.1
if you are asking about eslint-plugin-roblox-ts
0.0.36
that is the most recent version i think
my eslint is quite outdated though it seems
v9.28.0
is latest
@iSentinel sorry for pinging you again a month later but have you found any potential causes?you could try installing https://github.com/christopher-buss/eslint-plugin-roblox-ts-x
GitHub
GitHub - christopher-buss/eslint-plugin-roblox-ts-x: ESLint plugin ...
ESLint plugin for roblox-ts. Contribute to christopher-buss/eslint-plugin-roblox-ts-x development by creating an account on GitHub.
it should support eslint 8 now @Phantom
ah thanks! will give it a go in a sec
only since last night tho
i wrote some tests for it but i dont use eslint 8 myself so no promises
this seems to have fixed it
thank you very much!
@iSentinel ah dang it nevermind

am i meant to remove all extensions except
plugin:roblox-ts-x/recommended-legacy
?
i think i was, doing that only makes the error appear once
@Phantom
i dont believe i have @types in any of the 4 tsconfig.json files but i can send them here just in case i am doing something silly
i dont believe any of them have typeRoots of @types?
sorry just to confirm copilot is partly wrong here right? because it shouldnt be erroring for variables which have their type resolving to boolean

boolean shouldn't need it no
I'm not really sure, its been coming up for some people recently
specifically lua truthiness?
or just eslint acting strange
yes specifically that rule
is it a bad idea to turn it off
until a fix is found
i mean you dont need to have it on, its more of a guidance rule
i know i like it lol
if you know js truthiness and you're fine with it then its fine to turn off
id prefer to have it on in case i accidentally look past an empty string or a number being falsy but i guess i dont really have a choice
tbf i tend towards explicit anyway
id probably do if gameDataMap !== undefined
ah okay will do
thanks again
does this function exactly the same as how the eslint rule is supposed to function?
because if it does cant the code be repurposed somehow
i dont think there is a way to get around using the eslint plugin though
if you want readable code that is
It'd be nicer if the compiler had these methods exposed that it could hook into
is the compiler written in typescript?
For now
alright im going to try disabling the rule and running the compiler with the --logTruthyChanges flag
Yeah for these rules that are just meant to mimic the compiler it'd make sense