How to define an array of objects

Using vue 3, typescript and eslint I have the following code: … data() { return { blah: ”, blah2: [] … and in the methods object I have: methods: { addEntry() :void { this.blah2.push({s:’whatever’,b:false}); } … I’m getting this error: Argument of type ‘{ s: string; b: boolean; }’ is not assignable to parameter of… Read More How to define an array of objects

Javascript: explictely ignore variables without esling warning about it

I have a code like this: const [contract, _customer, _payment] = await Promise.all([ api.signup.contract.sign(…), api.signup.update(…), api.payment.update(…), ]); And eslint is complaining because of 118:15 warning ‘_customer’ is assigned a value but never used @typescript-eslint/no-unused-vars 118:26 warning ‘_payment’ is assigned a value but never used @typescript-eslint/no-unused-vars I though that prefixing the var with _ was enought… Read More Javascript: explictely ignore variables without esling warning about it

How to turn of semicolon error in a Eslint.js file and typescrip

I want to use semicolons in my typescript files, but eslint is giving me an error Extra semicolon.eslint@typescript-eslint/semi now I went to the docs and it tells me to put this in my eslint file "rules": { // Note: you must disable the base rule as it can report incorrect errors "semi": "off", "@typescript-eslint/semi": "warn"… Read More How to turn of semicolon error in a Eslint.js file and typescrip

i return `boolean` but Array.prototype.filter() expects a value to be returned at the end of arrow function

What’s wrong if i return boolean from filter it doesn’t matter i get an Error from eslint -> Array.prototype.filter() expects a value to be returned at the end of arrow function code example -> let filteredData = useMemo(() => { let childIds = []; let parentIds = []; if (customSearch || !searchQuery) { return data;… Read More i return `boolean` but Array.prototype.filter() expects a value to be returned at the end of arrow function

Facing this error "Unexpected use of 'scrollY' no-restricted-globals" in reactjs

I searched for it but did not find any good answer for this. like people saying that add scrollY:true to ESLint config file and did not tell where I could do these configuration and where the eslint config file is? Please help me. This is my Navbar.jsx component. const Navbar = () => { window.addEventListener(‘scroll’,… Read More Facing this error "Unexpected use of 'scrollY' no-restricted-globals" in reactjs

What to do when the npmregistry is missing @types/eslint/-/eslint-8.4.4.tgz

I jumped on to run npx create-react-app, however, the output of this is that there is no eslint-8.4.4 found on the npmregistry, looking online they just released 8.4.4 I believe? Error: ‘@types/eslint@8.4.4’ is not in the npm registry. I tried to find out how to use eslint-8.4.3 like last week’s project used but I can’t… Read More What to do when the npmregistry is missing @types/eslint/-/eslint-8.4.4.tgz