How to remove "deprecation" in Atom IDE? - ide

Does anyone know how to remove the annoying "deprecations" word in the right bottom corner from Atom IDE?.

You can easily remove it. File => Settings => Packages => Core Packages => Deprecation Cop => Disable

I've seen where the deprecated call is part of Atom itself:
It could also be due to an incompatible package but troubleshooting those becomes an endless chore. Thankfully it's possible to edit the css:
Atom->Stylesheet... (styles.less)
Before:
I found that changing the text color from orange to default was enough for me:
.deprecation-cop-status {
color: inherit;
}
You can also hide it completely (use visibility: hidden; to preserve width if desired):
.deprecation-cop-status {
display: none;
}

Just click on the deprecation word, and it should open a new tab telling you what's wrong. Update or delete the package that causes the deprecations and the word will be removed.

Related

how to disable ripple in nuxt js with vuetify?

I have created a NuxtJS project and selected Vuetify as the UI framework from default selections. I would like to disable the ripple effect on buttons and other possible vuetify components. Since there is no dedicated Vuetify.js file and all are configured in the nuxt.config.js file, I tried editing the same.
vuetify: {
button: {
disableRipple: true,
},
}
but no use. So, any help on this would be appreciated
After a long research, found out that, remove ripple effect on icon button accepted answer solved my case too. Answer maybe common but question is different 😅
In case if anything changes/for future reference,
.v-btn:before {
opacity: 0 !important;
}
.v-ripple__container {
opacity: 0 !important;
}
Thanks to Anant Vikram Singh

Trying to set Montserrat font on all pages of my React-Native App

I'm trying to apply the Montserrat font to all elements in my react-native app but can't seem to do it.
I've downloaded all 18 of the ttf files and put them into my assets/fonts folder.
I then tried using react-native-global-props:
import { setCustomText } from 'react-native-global-props';
const customTextProps = {
style: {
fontFamily: 'Montserrat'
}
}
setCustomText(customTextProps);
This didn't do anything to the text components of my app.
I then tried using defaultProps:
Text.defaultProps.style = { fontFamily: 'Montserrat' }
Also had no effect.
I also followed all the steps in this medium post about using custom fonts:
https://medium.com/react-native-training/react-native-custom-fonts-ccc9aacf9e5e
My main aim is to apply Montserrat font to every element of my entire app. I have a feeling it might have something to do with the font-type itself as Google Fonts say to apply fonts using this:
font-family: 'Montserrat', sans-serif;
However, react-native doesn't like the sans-serif as it has a hiphon so I just excluded it instead.
Any advice on this would be much appreciated.

React components not respecting legend position configuration

Is there any reason why my chart legends are always appearing on the right? My config looks like this:
legend: {
enabled: true,
position: 'bottom'
}
Setting enabled to false causes the legend to disappear as expected, but changing the position has no effect.
This is using #gooddata/react-components 5.2.0-alpha17
The config looks correct. Please share the code for the whole component and we will have a look at it. This is unlikely the problem, but please try to use a stable version instead of alpha. Current stable version is 5.1.0.
Please check you are importing your styles correctly
import '#gooddata/react-components/styles/css/main.css';
This snippet should work:
<PieChart
projectId={projectId}
measures={measures}
config={{
legend: {
enabled: true,
position: 'bottom'
}
}}
/>
You can find more information about chart legends in the official documentation

Timing of AppVeyor build steps

I'm driving an AppVeyor build with an appveyor.yml file, in this instance an Angular CLI build. This is a part of my file:
test_script:
- npm run lint
- npm test
- npm run e2e
- npm run build
Those are all npm scripts that delegate actual work to the ng cli.
How can I properly get timings for each step? My real build is even a bit bigger, and for starters I'd like to see (preferably as a summary) how long each step took.
I tried adding - ps: Get-Date -Format "o" in between each step, which is a workaround, but not really a nice one.
Can this be done in a more convenient manner?
Since the information is available in the tooltip, why not use CSS? That also works while the build is being updated. This is within my GreaseMonkey script (but I suppose you can also use the Style Editor in dev tools, Stylus or similar):
((css) => {
let style = document.createElement("style");
style.textContent = css;
document.body.appendChild(style);
})(`
/* Stretch the log, do not limit its width */
body > div > div.row {
max-width: initial;
}
/* Prepend mm:ss before every line */
div#job-console > div:before {
visibility: visible;
content: attr(title);
color: gold;
margin-top: 0;
margin-left: -5rem;
margin-right: 4em;
height: auto;
display: inline;
}
`);
I use -5rem such that the hour part is exactly hidden (many tests do not take an hour to run, so provides you three more characters for the actual log message).
The other answer was helpful, because it mentioned that the console output line numbers have a tooltip with timing info. You can use this snippet as a bookmarklet (or paste it in your console) to get a quick overview:
for (let d of document.querySelectorAll('#job-console > div')) {
x = document.createElement('span');
x.innerHTML = d.title;
x.style.marginRight = '2.5rem';
x.style.color = 'yellow';
d.insertBefore(x, d.firstChild);
}
I prefer this over creating a lot of boilerplate inside my steps like the answer or my workaround from the question (even though that would work too, I suppose).
I still hope there will turn out to be a way to do this with just a setting in the .yml file or in AppVeyor itself, but until then this is probably what I'll stick with.
Here's a bookmarklet function you can put straight into the URL of a bookmark in at least Chrome and Firefox:
javascript:(function() { for (let d of document.querySelectorAll('#job-console > div')) { x = document.createElement('span'); x.innerHTML = d.title; x.style.marginRight = '2.5rem'; x.style.color = 'yellow'; d.style.whiteSpace = 'nowrap'; d.insertBefore(x, d.firstChild); } })()
Using advice from this comment:
Verbose:
test_script:
- powershell $sw = [Diagnostics.Stopwatch]::StartNew(); npm run lint; $sw.Stop(); Write-host "Time taken: " $sw.Elapsed.totalseconds
Silent:
test_script:
- powershell (Measure-Command { npm run lint } -Verbose).totalseconds
Few notes:
You might not need it at all because if you hover mouse to the line
number on UI, you will see timestamp (relative to the build start).
Or you can download log and it has all timestamps.
Verbose output takes longer.
I call powershell from cmd mode (not ps), because npm writes
output to stdErr which makes custom PowerShell host on AppVeyor
unhappy (I assume you run Windows, not Linux builds)

Disable error overlay in development mode

Is there a way to disable the error overlay when running a create-react-app in development mode?
This is the overlay I'm talking about:
I'm asking this because im using error boundaries (React 16 Error Boundaries) in my app to display error messages when components crashes, but the error overlay pops up and covers my messages.
An alternate solution is to add the following CSS style:
iframe
{
display: none;
}
This prevents the error from showing.
We don't provide an option to disable the error overlay in development.
Error boundaries do not take its place (they are meant for production use).
There is no harm having both the development error overlay and your error boundary; simply press Escape if you'd like to view your error boundary.
We feel the error overlay provides tremendous value over your typical error boundary (source code, click to open, etc).
It is also vital as we explore enabling hot component reloading as a default behavior for all users.
If you feel strongly about disabling the overlay, you'll need to eject from react-scripts and discontinue use of webpackHotDevClient. A less intrusive method may be removing the error event listener installed by the overlay off of window.
The error overlay can be disabled by using the stopReportingRuntimeErrors helper utility in the react-error-overlay package.
First, install the react-error-overlay package:
yarn add react-error-overlay
Then in index.js — right before mounting the root React component, import the utility and invoke it like this:
import { stopReportingRuntimeErrors } from "react-error-overlay";
if (process.env.NODE_ENV === "development") {
stopReportingRuntimeErrors(); // disables error overlays
}
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
Error overlays in create-react-app should now be disabled.
You can suppress React's error event handling by capturing the event first.
for example, by placing in public/index.html's <head>:
<script>
window.addEventListener('error', function(e){
// prevent React's listener from firing
e.stopImmediatePropagation();
// prevent the browser's console error message
e.preventDefault();
});
</script>
Since you probably still want React's error overlay for errors outside the error boundary, consider this option:
<script>
window.addEventListener('error', function(e){
const {error} = e;
if (!error.captured) {
error.captured = true;
e.stopImmediatePropagation();
e.preventDefault();
// Revisit this error after the error boundary element processed it
setTimeout(()=>{
// can be set by the error boundary error handler
if (!error.shouldIgnore) {
// but if it wasn't caught by a boundary, release it back to the wild
throw error;
}
})
}
});
</script>
assuming your error boundary does something like:
static getDerivedStateFromError(error) {
error['shouldIgnore'] = true;
return { error };
}
The result is a behaviour that follows try...catch line of reasoning.
To solve this issue, you could use CSS:
body > iframe {
display: none !important;
}
for some reason the overlay popped up for me only now while upgrading to Webpack 5.
In any case, you can now cancel the overlay by adding in your webpack.config.js:
module.exports = {
//...
devServer: {
client: {
overlay: false,
},
},
};
Or through the CLI: npx webpack serve --no-client-overlay
Taken from here: https://webpack.js.org/configuration/dev-server/#overlay
To avoid bundling in this large dev library in prod you can use a
dynamic import:
yarn add react-error-overlay
if (process.env.NODE_ENV === 'development') {
import('react-error-overlay').then(m => {
m.stopReportingRuntimeErrors();
});
}
In config/webpack.config.dev.js, comment out the following line in the entry array
require.resolve('react-dev-utils/webpackHotDevClient'),
And uncomment these two:
require.resolve('webpack-dev-server/client') + '?/',
require.resolve('webpack/hot/dev-server'),
I think this makes sense but sometimes when you are typing and have an error boundary then the overlay pops up with each character stroke and is annoying. I can remove the handler I suppose.
In the file webpack.config.js, comment the line:
// require.resolve('react-dev-utils/webpackHotDevClient'),
And uncomment:
require.resolve('webpack-dev-server/client') + '?/',
require.resolve('webpack/hot/dev-server'),
In the file webpackDevServer.config.js, comment:
// transportMode: 'ws',
// injectClient: false,
hide it with adblock
It is very useful to disable the errors temporarily so you don't have to comment/uncomment parts of your code that is not used at the moment, but it definitely will be after a few more changes.
The quickest solution is to just use adblock to pick the iframe with the errors.
It is trivial to toggle it with a single click to enable / disable adblock on the given page.
It is counter-intuitive to overlay the rendered page in development mode just to inform the user the newly imported objects or the recenlty created variables are not yet used.
I would say it is an arrow to the knee for beginners :)
If you are using the latest version with react-script >= 5.0.0, you just need to add an environment variable ESLINT_NO_DEV_ERRORS=true.
https://create-react-app.dev/docs/advanced-configuration
There is no option for it.
But, if you strongly wanted to disable modal window, just comment out this line
https://github.com/facebook/create-react-app/blob/26f701fd60cece427d0e6c5a0ae98a5c79993640/packages/react-dev-utils/webpackHotDevClient.js#L173
I had the same problem and I have been digging in the create-react-app source for a long time. I can't find any way to disable it, but you can remove the listeners it puts in place, which effectivly stops the error message. Open the developerconsole and select the html tag. There you can remove the event listeners on error and unhandlerejection which is put in place by unhandledError.js. You can also close the error message by clicking the x in the upper right corner of the screen, and then you should see your message.
Gathering answers here together, I managed to solve this issue for myself.
Here is the package I created for this.
The css fix has changed:
body > hmr-error-overlay {
display: none;
}
I'll also recommend adding this block on init so that you don't get silent errors:
window.addEventListener('error', function (e) {
console.error(e.message);
// prevent React's listener from firing
e.stopImmediatePropagation();
// prevent the browser's console error message
e.preventDefault();
});