It can be easily set up with a module resolver:
Continue readingCategory Archives: JavaScript
Difference between ESLint and Prettier
What they do:
- ESLint: underline when code doesn’t comply to logical rules. Can run a script and fix some easy errors (etc. unused variables lying around)
- Prettier: doesn’t change the logic of code, only formats it (etc. removing extra spaces, turning double quotes to singles)
new Date() Not Valid in Safari
Not all the date formats can be used to create a date with new Date()
.
Object doesn’t support property or method ‘scrollTo’
Even if Edge is not called Internet Explorer, it’s still basically IE. 🙁 And IEs don’t support scrollTo.
Continue readingReact: How To Prompt User of Unsaved Data before Leaving Site
There’s a specific function for this: beforeunload
.
Yarn Upgrade All Dependencies to Latest
For reference:
yarn upgrade-interactive --latest
And use a
key to select all of them.
Webpack: New Resolve Root Path
- src
|- components
||- CatComponent.js
||- DogComponent.js
- node_modules
/* src/components/DogComponent.js */
import CatComponent from 'components';
For importing from another directive to work like imports from node_modules
like above, configure webpack.
Tab Forever Loading
If you find the loading spinner in browser tab spinning forever, it might be due to the use of document.write()
.
AngularJS: How to Get The Controller of Another Component
Or perhaps it should be called “How to get rid of the $parent.$parent.$parent...$parent
s in your code”, or “How do components talk to one another”.
There are a couple of ways to deal with it.
Continue reading