How to format order import styles css module to first line in eslint-plugin-import?

Advertisements I am trying to config ESLint for my project that using eslint-plugin-import to ogranize module import order but I have a case with style css module. I want to place style css module import to the first line. How I can config to get my expected? Here is my lint config for that: .eslintrc.json… Read More How to format order import styles css module to first line in eslint-plugin-import?

How to solve- "<Something> is already declared in the upper scope" code smells?

Advertisements I am getting following code smell in my sonarqube dashboard, and I am not sure how to resolve such issues. ‘isInitialized’ is already declared in the upper scope. Here’s my code- let _isInitialized = false; /** * Getter for _isInitialized * * @return {Boolean} _isInitialized */ export const isInitialized = function() { return _isInitialized;… Read More How to solve- "<Something> is already declared in the upper scope" code smells?

How to fix this eslint error after installing my react application

Advertisements [eslint] Plugin "react" was conflicted between "package.json » eslint-config-react-app » C:\Users\Teke\Desktop\Projects\lilayi_lodge_demo\client\node_modules\eslint-config-react-app\base.js" and "BaseConfig » C:\Users\Teke\Desktop\Projects\lilayi_lodge_demo\Client\node_modules\eslint-config-react-app\base.js". >Solution : you have used inconsistent casing when navigating to your project with your terminal. cd into the directory of your React project using the correct casing. you can : 1- Open your shell and cd into the directory… Read More How to fix this eslint error after installing my react application

eslint no-useless-return in Promise

Advertisements I just realised that eslint’s no-useless-returns is yelling at me for writing the following… const success = await new Promise((resolve, reject) => { let timer = setTimeout(() => { reject(); return; <—- }, 5000); pubs.on(‘ok’, () => { console.log(‘okey!’); clearTimeout(timer); resolve(true); }); }); Now I understand what the rule is supposed to tell me,… Read More eslint no-useless-return in Promise

how to avoid indentation problem with ESlint?

Advertisements I hadn`t had this problem before I started using Vue 3 with ESlint. But now anytime I run my code I get multiple errors like: C:\Users\Acer\Desktop\salam\src\views\HomeView.vue 2:1 error Unexpected tab character no-tabs 3:1 error Unexpected tab character no-tabs 4:1 error Unexpected tab character no-tabs 5:1 error Unexpected tab character no-tabs 6:1 error Unexpected tab… Read More how to avoid indentation problem with ESlint?

Javascript: explictely ignore variables without esling warning about it

Advertisements 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… Read More Javascript: explictely ignore variables without esling warning about it

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

Advertisements 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":… 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

Advertisements 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… Read More i return `boolean` but Array.prototype.filter() expects a value to be returned at the end of arrow function