VSCode 1.62 - Definition for rule 'testing-library/no-debug' was not found - visual-studio-code

Got this error message Definition for rule 'testing-library/no-debug' was not found. right after VSCode update. Tried to install #types/testing-library, it didn't help.

Find testing-library/no-debug in your Eslint config then change it to testing-library/no-debugging-utils.
Ref:
https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/migration-guides/v5.md#steps-to-upgrade

Related

Stylelint 'Unknown rule declaration-property-value-blacklist' error on every css file

While running Stylelint against CSS files, every file has an output with the following error. It is odd that the error appears on the first line/character of each file.
1:1 x Unknown rule declaration-property-value-blacklist
Stylelint shows the "Unknown rule ..." problem when it encounters a rule in the configuration object that it doesn't recognise.
The declaration-property-value-blacklist rule was removed in version 14.0.0 of Stylelint. It was replaced by the declaration-property-value-disallowed-list rule. You should update your configuration object to use that rule instead.
There is a compatibility error between Stylelint 14.x and the stylelint-config-airbnb plugin. https://issuemode.com/issues/airbnb/css/10818973

What does the rust-analyzer error "could not resolve macro `$crate::format_args`" mean and how do I fix it?

I'm using rust-analyzer version 0.2.408 on Visual Studio Code.
I'm writing a command line application that involves centering text in the terminal. This is the function I wrote to do this:
use console::{Alignment, pad_str};
fn get_padded_row(row: &str, width: u16, symbol: Option<char>) -> String {
let symbol = symbol.unwrap_or(' ');
return pad_str(row, width as usize, Alignment::Center, None)
.to_string()
.replace(' ', &symbol.to_string());
}
This function works perfectly fine, and there were no errors with it. Then I wrote a test:
#[cfg(test)]
mod tests {
use crate::get_padded_row;
#[test]
fn row_padding_dashes() {
let padded_row = get_padded_row("hello", 15, Some('-'));
assert_eq!(
padded_row, "-----hello-----".to_string(),
"`get_padded_row` was not correct, got `{}`", padded_row
);
}
}
The code still works perfectly fine. Both cargo run and cargo test work, the function passes the test, and cargo check returns no issues. But rust-analyzer gives an error, highlighting everything from the tr}; in the use statement to the p right after return: "could not resolve macro $crate::format_args rust-analyzer(macro-error)". Searching for this error returns nothing. VSCode links me to rust-analyzer user manual, which says only "This diagnostic is shown for macro expansion errors". Restarting VSCode and reinstalling rust-analyzer have done nothing. The error always comes back, and highlighting the same oddly specific region. The only way I've found to get rid of it while keeping rust-analyzer installed is to remove the test.
Judging from how the error is about macro expansion, and how removing the test fixes the issue, I'd imagine it's caused by the #[test] macro, but it's strange that rustc finds no issues at all with my code while rust-analyzer is freaking out about this error. So far, I've had better experiences with rust-analyzer than with the official Rust VSCode extension, but I'm on the verge of switching back to fix this issue.
This is a bug in rust-analyzer. For now, you can disable the warning in your settings.json:
"rust-analyzer.diagnostics.disabled": [
"macro-error"
]
The bug was fixed on nightly, so you could install the nightly binary of rust-analyzer from GitHub, or you could just wait a couple days for the fix to land on stable.
Alternatively, you could downgrade to rls version 0.2.400, because the bug was caused by a commit in version 0.2.408:
Extensions Icon -> rust-analyzer -> Manage (gear icon) -> Install Another Version
Three months later and there seems to be a bug with Nightly release? Unsure.
I added unresolved-macro-call to Diagnostics: Disabled settings for rust-analyzer.
I've tried many things, read the open issue on github, etc which is tagged as solved, but persists here.
For vscode users, open settings (json) and disable by adding:
"rust-analyzer.procMacro.enable": false

parcel bundler - Unknown plugin "add-module-exports"

I'm trying to use 'react-responsive' but I am getting the error message - Unknown plugin "add-module-exports
It looks like this relates to the fact that node_modules needs to be excluded but due to a bug in babel v6 (fixed in v7) adding "ignore": "node_modules" to the .babelrc file doesn't work.
https://github.com/contra/react-responsive/issues/131
It seems like parcel-bundler uses babel v6 so my question is , how can I ignore node_modules and get parcel to bundle without throwing an error?
I was facing a similar issue recently with parcel, installing babel-plugin-add-module-exports seemed to fix the issue

eslint / babel-eslint issue with escope

Currently getting this error when i try to run eslint locally:
Error: Cannot find module 'escope'
at Function.Module._resolveFilename (module.js:455:15)
at monkeypatch (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/babel-eslint/index.js:53:26)
at Object.exports.parse (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/babel-eslint/index.js:358:5)
at parse (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/linter.js:671:23)
at Linter.verify (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/linter.js:806:27)
at processText (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:278:31)
at processFile (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:320:18)
at executeOnFile (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:655:25)
at fileList.forEach.fileInfo (/Users/pablorincon/Documents/SSENSE/micro-services/ws-website/services/ui-website/node_modules/eslint/lib/cli-engine.js:693:13)
at Array.forEach (native)
What's weird is that im using the same linting configuration with another project, and i had no issues at all.
I'm using:
babel-eslint#7.1.1
eslint#4.0.0-beta.0
Any ideas ?
Even though I had same package.json, babel-eslint was set as "7.1.1" in one and "^7.1.1" in the other.
Basically ESLint v4 uses a new fork of escope, which was then updated on version 7.2.3 of babel-eslint.
So, adding the little ^ to my configuration fixed my problem.

Sidr missing file

I installed sidr with bower, but when I try to run gulp, it breaks and outputs the following error
bower_components/sidr/src/scss/sidr/_base.scss
Error: File to import not found or unreadable: compass/css3
on line 1 of bower_components/sidr/src/scss/sidr/_base.scss
>> #import 'compass/css3';
^
I looked, and this compass/css3 file does not exists. _base.scss is the only file in that directory. Is there a fix for this that won't get over written whenever bower updates?
Not sure what you're using it with, but I'm trying to get it working with WordPress/Sage and found this link.
Basically:
Run npm install compass-mixins --save-dev in your theme directory. (See Edit 1 Below)
Edit the cssTasks - includePaths section of your gulpfile.js to point to the location of the compass folder eg: './node_modules/compass-mixins/lib'
Hope that helps!
Caveat
While that fixed the error for not finding the compass/css3 folder, I am now getting these warnings:
WARNING: PIE does not support background-image. Use #include background(linear-gradient(#4d4d4d, #1a1a1a)) instead.
on line 74 of node_modules/compass-mixins/lib/compass/css3/_images.scss
from line 46 of bower_components/sidr/src/scss/sidr/_base.scss
WARNING: PIE does not support background-image. Use #include background(linear-gradient(white, #dfdfdf)) instead.
on line 74 of node_modules/compass-mixins/lib/compass/css3/_images.scss
from line 46 of bower_components/sidr/src/scss/sidr/_base.scss
It also seems to be causing issues with uglify-js because I could run gulp fine before bower installing sidr.
Will update as I progress.
EDIT 1
After reading this, I uninstalled the npm compass-mixins package and installed via bower and changed the path in the gulpfile.js accordingly.
The Warnings for PIE are gone. Still experiencing issues with uglify-js though.
EDIT 2
Ran npm install gulp-util and set up the gulpfile to output more info on the error.
{ [Error: scripts/main.js: Unexpected token: name (sidr)]
message: 'scripts/main.js: Unexpected token: name (sidr)',
fileName: 'scripts/main.js',
...
showStack: false,
showProperties: true,
plugin: 'gulp-uglify' }