Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Skiant posted:

Related question: You guys think the ES6 modules could help us un-gently caress front-end dev a tiny bit? I'm on the fence about using that plus Babel or Traceur to make that poo poo slightly retro-compatible.

Mmmaybe?

The more I use ES6 modules, the more I like them.

Adbot
ADBOT LOVES YOU

ambushsabre
Sep 1, 2009

It's...it's not shutting down!
I just want to chime in on the frontend interviewing talk, especially with javascript. Here's my goto question (I'm a team lead where my team exclusively does js pretty much):

"You have a page with a button on it. When the page loads, make an api request to example.com/api/whatever?. When you have both the result of the api request and the button has been pressed (these can happen in any order), navigate to google.com."

I like this one because it really lets me know if they've worked in javascript before. If they have, I'm going to hear the word 'callback' at least once, something about ajax, and probably window.location.href. It also lets them tell me about setting a variable to keep track of the states of both these things which is some pretty simple logic, as well as being relatively real-world. I dunno it's done a good job of filtering out the bad people so far.

ambushsabre fucked around with this message at 12:44 on Apr 8, 2015

geetee
Feb 2, 2004

>;[

Thermopyle posted:

To help you imagine it, do a project where you only use NPM packages and browserify or webpack.

It's not great, but it cuts down some of the bullshit when you don't have to work with grunt and bower and gently caress all.

Oh Jesus yes, it was a glorious day to reach that point.

I've been running a few training sessions to demonstrate this, and I've been met with a large amount of eyes glazing over. All the NPM dependencies and webpack configurations are daunting, and people are scared of change in general.

One guy I work with hasn't really used JS in 10 years and will never come around. I have faith in the rest because all my developer friends have seen the light. Or maybe they just tell me that so I stop recommending React.

Skiant posted:

I must be in full-blown Stockholm syndrome right now because I'm considering switching from JSHint to ESLint and I'm about to do that in the project's Gulpfile.


Related question: You guys think the ES6 modules could help us un-gently caress front-end dev a tiny bit? I'm on the fence about using that plus Babel or Traceur to make that poo poo slightly retro-compatible.

I stitched to ES Lint recently. I can't remember why. I think it became more popular? I'm a terrible sheep.

Babel is great. Independent of ES6, modularizing your code with webpack (or browserify) is a fantastic step forward.

Maluco Marinero posted:

Yeah, but it results in a deep wasteful dependency tree, what with node_modules just being a giant recurse of dependencies.

I'd really like to see someone take a stab at reducing that, I mean, we have semver, there some foundations there for it.

Edit: for browserify I mean, just makes for a massive app-bundle if you're not careful.
I understand the benefit of the current way NPM lays out its dependencies on the file system, but I still hate it. Centralizing it like Maven would remove a lot of pain that I'm used to, but people new to NPM rightfully struggle with.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
So why use ESLint instead of JSHint?

I switched to JSHint from JSLint because JSLint is way too Crockford, but have had no issues with JSHint.

Kekekela
Oct 28, 2004
I got this, I use ESLint because....its what the main dev on the primary open-source project I work on uses. drat. :smith:

jkyuusai
Jun 26, 2008

homegrown man milk
I've only used JSHint. Did some digging around and found some stuff comparing it to ESLint.

The biggest thing that stands out to me is it sounds like syntax errors will mask the presence of other issues until they're corrected. I have JSHint running constantly via a plugin in SublimeText3, so I'd have to see it in action to decide whether that would bother me or not. I'll give this a shot in the next few days and see how it feels.

http://www.sitepoint.com/comparison-javascript-linting-tools/

JS Linting Tool Comparison posted:

JSHint

Pros
-Most settings can be configured
-Supports a configuration file, making it easier to use in larger projects
-Has support for many libraries out of the box, like jQuery, QUnit, NodeJS, Mocha, etc.
-Basic ES6 support

Cons
-Difficult to know which rule is causing an error
-Has two types of option: enforcing and relaxing (which can be used to make JSHint stricter, or to suppress its warnings). This can make configuration slightly confusing
-No custom rule support

ESLint

Pros
-Flexible: any rule can be toggled, and many rules have extra settings that can be tweaked
-Very extensible and has many plugins available
-Easy to understand output
-Includes many rules not available in other linters, making ESLint more useful for detecting problems
-Best ES6 support, and also the only tool to support JSX
-Supports custom reporters

Cons
-Some configuration required
-Slow, but not a hindrance

Also the author of ESLint talking about it (Note that this post is 2 years old)

Introduction from ESLint Author posted:

How ESLint differs from JSHint

Despite similar goals, ESLint and JSHint have some very specific differences. First and foremost, JSHint uses a progressive parser, finding errors along the way. ESLint uses Esprima, so the parsing is done first and then the rules are applied. That means JSHint will print out warnings up to and including a syntax error where ESLint will show only the syntax error. This makes JSHint much better for use in editors.

ESLint is much better suited for use in build systems and as a general command line utility. It works great for pre-commit hooks.

ESLint is a two-pass utility. The first pass is done by Esprima to parse the JavaScript and the second pass is a traversal of the AST to apply certain rules. JSHint is a single-pass utility, meaning that it will generally be faster.

ESLint is strictly a Node.js utility. JSHint runs on most JavaScript runtimes, including Rhino.

jkyuusai fucked around with this message at 16:07 on Apr 8, 2015

geetee
Feb 2, 2004

>;[

quote:

ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions:

-ESLint uses Espree for JavaScript parsing.
-ESLint uses an AST to evaluate patterns in code.
-ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.

Not the most compelling reasons to switch. Don't switch unless you find JS(H|L)int lacking.

Edit: beaten

PlaneGuy
Mar 28, 2001

g e r m a n
e n g i n e e r i n g

Yam Slacker
I'm such a loving front-end luddite. Gulp with babel and sass, then I... download dependencies from their respective websites and commit them to the repo :ohdear:


I dunno. After years of gems, nugets, and other such horseshit adding 18 bajillion dependencies to my projects because developer X just had to have the foreach function from library Y, I wanna concretely know what I'm making my users download. (In most cases knockout, require1k, lie to polyfill promises, my little ajax helper, and sometimes moment)

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Maluco Marinero posted:


Edit: for browserify I mean, just makes for a massive app-bundle if you're not careful.

Oh god yes. It's terrible. Browserify and NPM is definitely not a panacea and this is one of the real pain points.

Sometimes I have a hard time figuring out what is making my bundle so large...are there any tools for analyzing the bundle to figure that out?

In other news, the posts taking about Babel make me want to say that everyone should integrate Babel into their build system as ES6 stuff is pretty great!

Stoph
Mar 19, 2006

Give a hug - save a life.

ambushsabre posted:

I just want to chime in on the frontend interviewing talk, especially with javascript. Here's my goto question (I'm a team lead where my team exclusively does js pretty much):

"You have a page with a button on it. When the page loads, make an api request to example.com/api/whatever?. When you have both the result of the api request and the button has been pressed (these can happen in any order), navigate to google.com."

I like this one because it really lets me know if they've worked in javascript before. If they have, I'm going to hear the word 'callback' at least once, something about ajax, and probably window.location.href. It also lets them tell me about setting a variable to keep track of the states of both these things which is some pretty simple logic, as well as being relatively real-world. I dunno it's done a good job of filtering out the bad people so far.

I'd be very happy to hear them mention Promise.all

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all

Kekekela
Oct 28, 2004
Jsx support is enough for me to stay the course.



jkyuusai posted:

I've only used JSHint. Did some digging around and found some stuff comparing it to ESLint.

The biggest thing that stands out to me is it sounds like syntax errors will mask the presence of other issues until they're corrected. I have JSHint running constantly via a plugin in SublimeText3, so I'd have to see it in action to decide whether that would bother me or not. I'll give this a shot in the next few days and see how it feels.

http://www.sitepoint.com/comparison-javascript-linting-tools/


Also the author of ESLint talking about it (Note that this post is 2 years old)

Gul Banana
Nov 28, 2003

anyone doing frontend work on windows here? not a popular combination, but there are certainly clients who want websites built to run on windows server.. the big problem i'm running into is npm. certain packages simply cannot be used due to the path length recursion thing. is there some common workaround for this?

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Gul Banana posted:

anyone doing frontend work on windows here? not a popular combination, but there are certainly clients who want websites built to run on windows server.. the big problem i'm running into is npm. certain packages simply cannot be used due to the path length recursion thing. is there some common workaround for this?

Are you using NTFS partitions or FAT32?

geetee
Feb 2, 2004

>;[

Gul Banana posted:

anyone doing frontend work on windows here? not a popular combination, but there are certainly clients who want websites built to run on windows server.. the big problem i'm running into is npm. certain packages simply cannot be used due to the path length recursion thing. is there some common workaround for this?

We develop on Windows and have no problems installing NMP packages. Deleting has problems often. Usually kill those with Cygwin.

Gul Banana
Nov 28, 2003

NTFS. You're right that *installing* packages has no issue -this is because npm uses relative paths. But I can't, say, scp the result around, or uninstall them, or work with them in many source control apps (even to gitignore them). Are people just.. living with this?

Mr Shiny Pants
Nov 12, 2012

PlaneGuy posted:

I'm such a loving front-end luddite. Gulp with babel and sass, then I... download dependencies from their respective websites and commit them to the repo :ohdear:


I dunno. After years of gems, nugets, and other such horseshit adding 18 bajillion dependencies to my projects because developer X just had to have the foreach function from library Y, I wanna concretely know what I'm making my users download. (In most cases knockout, require1k, lie to polyfill promises, my little ajax helper, and sometimes moment)

This. I mean they are just scripts right? Create scripts directory, download backbone and its dependencies and put them in the folder. Reference them and off you go. It makes it easy to reason about stuff. Works pretty well.

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



Gul Banana posted:

NTFS. You're right that *installing* packages has no issue -this is because npm uses relative paths. But I can't, say, scp the result around, or uninstall them, or work with them in many source control apps (even to gitignore them). Are people just.. living with this?

I figured most people using Node.js or NPM just had Macbooks emblazoned with stickers.

luchadornado
Oct 7, 2004

A boombox is not a toy!

piratepilates posted:

I figured most people using Node.js or NPM just had Macbooks emblazoned with stickers.

That's seriously the response I got once - "why aren't you using a Mac?"

Node/NPM advocates have replaced offshore DBAs as the focal point of my burning rage towards my career.

The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord

Gul Banana posted:

NTFS. You're right that *installing* packages has no issue -this is because npm uses relative paths. But I can't, say, scp the result around, or uninstall them, or work with them in many source control apps (even to gitignore them). Are people just.. living with this?

My I present an actual back and forth between people on a github issue from 2014 about this:

"FYI Node (and thus npm) always uses UNC paths internally, before actually calling into the filesystem. It is only third-party tools that have a problem. (Unfortunately one of those third-party tools is Windows Explorer, but, that's Microsoft's bug...)"

"Claiming therefore, that Windows supports long paths ... is a(n) entirely disingenuous attempt to misrepresent the actual reality."

"I don't really care about whatever word games you want to play around the word "support." Sure, if you wish, all I'm saying is that Node and npm are Windows compatible software that support long paths."

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



Taking a trip down the node_modules rabbit hole for one of your projects is fun. Half of webpack's size is due to a dependency called 'source-map', which is maybe 100kb or so but contains a benchmark suite that has a 16mb file that just appears to be a Scala.js runtime.

That still feels weird to me how the modules you could be installing on your servers could contain this huge tree of dependencies that includes other language's transpiled to javascript to write a development artifact (benchmark, tests, etc.). Your project could end up having the same (sub-)dependency with the same version 15 times, each with their own copies of other language's runtimes for doing development work on the dependency itself.

abraham linksys
Sep 6, 2010

:darksouls:

piratepilates posted:

Taking a trip down the node_modules rabbit hole for one of your projects is fun. Half of webpack's size is due to a dependency called 'source-map', which is maybe 100kb or so but contains a benchmark suite that has a 16mb file that just appears to be a Scala.js runtime.

looks like there's a newly-added npmignore for the project that should help, at least: https://github.com/mozilla/source-map/blob/master/.npmignore (see https://github.com/mozilla/source-map/pull/169)

Sedro
Dec 31, 2008
Even if node/npm support Windows, most projects I've built from source don't. The build instructions will fail with a useless error message like EACCESS. npm install usually works, but sometimes it takes a few tries. I gave up trying to develop with node on Windows.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
https://www.npmjs.com/package/flatten-packages may be helpful.

mpaarating
May 6, 2011

The Baddest Boi

Sedro posted:

Even if node/npm support Windows, most projects I've built from source don't. The build instructions will fail with a useless error message like EACCESS. npm install usually works, but sometimes it takes a few tries. I gave up trying to develop with node on Windows.

I had the same issues. I tried to setup a dev environment for node on my desktop thinking that it would be more comfortable but the amount of hassle isn't worth it. Instead I just slouch and drink single origin espresso straight out of a chemex glass while covering my 2006 MBP in ember stickers.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I gave up doing any kind of development on Windows except for Visual Studio stuff a long time ago.

Now I develop in a virtual machine running Ubuntu. The whole setup works great.

At the time I switched it wasn't because of Web dev, but still...

mpaarating
May 6, 2011

The Baddest Boi

Thermopyle posted:

I gave up doing any kind of development on Windows except for Visual Studio stuff a long time ago.

Now I develop in a virtual machine running Ubuntu. The whole setup works great.

At the time I switched it wasn't because of Web dev, but still...

I'm still getting used to using VIM but once its more natural, I'm thinking about switching all of my personal dev to my play servers and just using VIM on there.

luchadornado
Oct 7, 2004

A boombox is not a toy!

mpaarating posted:

I'm still getting used to using VIM but once its more natural, I'm thinking about switching all of my personal dev to my play servers and just using VIM on there.

This is probably a good idea. I love Visual Studio so I'll always be running Windows in some form, but having a VM open with vim is the way to go I think.

Spraynard Kruger
May 8, 2007

I use Windows for all my modern web development and everything is great. Sometimes long paths make deleting a project require a special utility, but everything runs fine. Visual Studio with the Node tools is excellent.

Gul Banana posted:

NTFS. You're right that *installing* packages has no issue -this is because npm uses relative paths. But I can't, say, scp the result around, or uninstall them, or work with them in many source control apps (even to gitignore them). Are people just.. living with this?

.gitignore is just a text file... Open it up, put "node_modules" on a line, and you should be set.

Sedro
Dec 31, 2008

mpaarating posted:

I had the same issues. I tried to setup a dev environment for node on my desktop thinking that it would be more comfortable but the amount of hassle isn't worth it. Instead I just slouch and drink single origin espresso straight out of a chemex glass while covering my 2006 MBP in ember stickers.
Ember is one of those projects that won't build on windows :argh:

Skiant
Mar 10, 2013
I work on Windows, mostly with Sublime Text + a git-bash window wrapped in Console, and I'm not really encountering any major issue.
I'm also trying out WebStorm at work right now and I have to admit I really like it. If my new work (I switch early may) doesn't have strong feelings about one or the other, I'll probably buy myself a licence.

PlaneGuy
Mar 28, 2001

g e r m a n
e n g i n e e r i n g

Yam Slacker

Skiant posted:

I work on Windows, mostly with Sublime Text + a git-bash window wrapped in Console, and I'm not really encountering any major issue.

Me neither. I think it's really only these mega-frameworks that are doing this since they pull in a lot of dependencies that depend of things that depend on things, etc.

My pet peeve is when someone writes a server-side or dev depencency and cherry picks parts of a library (like lo_dash), but each part of that is depends on a core bit and that gets duped for every import. if it's not being sent to the user, who gives a poo poo if you save 12K not importing some things (but not really because of the dupes)? I mean, yeah it doesn't have much to do about the windows long path thing, but it's a symptom of not giving a poo poo what your dependencies are, which can cause those kind of problems.

Spraynard Kruger posted:

.gitignore is just a text file... Open it up, put "node_modules" on a line, and you should be set.

A.B.C. Always Be Committing except node_modules just let the dev type npm install

edit: another reason to be aware of your dependencies... if your dependency doesn't put a fixed version for its dependencies, you might actually get wildly different versions amongst devs

PlaneGuy fucked around with this message at 21:55 on Apr 9, 2015

Stoph
Mar 19, 2006

Give a hug - save a life.

PlaneGuy posted:

edit: another reason to be aware of your dependencies... if your dependency doesn't put a fixed version for its dependencies, you might actually get wildly different versions amongst devs

That's a good reason to use npm shrinkwrap.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Sedro posted:

Ember is one of those projects that won't build on windows :argh:

Works on my machine. Well, Ember CLI, to be precise.

PlaneGuy
Mar 28, 2001

g e r m a n
e n g i n e e r i n g

Yam Slacker

Stoph posted:

That's a good reason to use npm shrinkwrap.

aw snape! if my last place of employment knew about that there would've been a lot less swearing.

Good to know.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
We got an Angular site shipped from some external contractor. I've been trying to hack on it to add simple functionality and it's the most insane thing I've ever done.

Angular is an incomprehensible mess and I can't figure out how to do anything in it.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Suspicious Dish posted:

We got an Angular site shipped from some external contractor. I've been trying to hack on it to add simple functionality and it's the most insane thing I've ever done.

Angular is an incomprehensible mess and I can't figure out how to do anything in it.

Yeah I found Angular really difficult to wrap my head around. I've found React is much more... sensible?

MrMoo
Sep 14, 2000

Suspicious Dish posted:

We got an Angular site shipped from some external contractor. I've been trying to hack on it to add simple functionality and it's the most insane thing I've ever done.

Angular is an incomprehensible mess and I can't figure out how to do anything in it.

They all are, here is hoping the next generation fairs better. TodoMVC is pretty good at showing what a mess the situation is.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
React seems very similar to how I would design my own system, which is a system composed of a tree of widgets that "render" to DOM. Angular seems to be all about data binding of strings to a premade DOM, which is impossible to do anything semi-complex with.

mpaarating
May 6, 2011

The Baddest Boi

Suspicious Dish posted:

We got an Angular site shipped from some external contractor. I've been trying to hack on it to add simple functionality and it's the most insane thing I've ever done.

Angular is an incomprehensible mess and I can't figure out how to do anything in it.

uh, I doubt it has anything to do with Angular being bad. It's more likely that they wrote a complete piece of garbage. I've seen places write completely :wtc: angular apps that would just be stupid no matter the js framework. My company is currently converting a C# desktop app into an Angular/Java app and it has gone really well thus far (8+ months into it).

What types of issues are you having?

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

mpaarating posted:

uh, I doubt it has anything to do with Angular being bad. It's more likely that they wrote a complete piece of garbage. I've seen places write completely :wtc: angular apps that would just be stupid no matter the js framework. My company is currently converting a C# desktop app into an Angular/Java app and it has gone really well thus far (8+ months into it).

What types of issues are you having?

No, angular is pretty bad when measured on the comprehensibility-to-someone-who-hasn't-learned-it scale.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply