Archive — page 12


ESLint and Atom

So I finally decided to try out a linter (a package which checks code against an 'ideal best practice' and flags up any issues). I'm using the Atom text editor, and after a little searching I found this article on FreeCodeCamp's Medium publication which purports to explain how to easily set up ESLint ...

Unfortunately it's only easy if you're working with a clone of FreeCodeCamp's Github repo — which I wasn't. So after a lot of back-and-forth I've now worked out how to set up ESLint from scratch (kind-of).

Setting up ESLint from scratch (kind of)

1. In a terminal, change to the root directory of your project.

2. Make a file .eslintrc

... more

A Carousel

Update, April 2023 — I've now shut down the ski-slopes.uk site, on the grounds that (a) it doesn't see much traffic and (b) hosting and domain fees were getting prohibitively expensive. I also think it's probably the responsibility of local ski clubs and regional associations to put information out there over local slopes ...

I've been putting the finishing touches on ski-slopes.uk for a couple of days, and as part of that process found that I needed to make a small image carousel.

Having written the code, I decided it was worth tidying it up and making it available for others — so if you're interested, it's on Github here.


Babel, or, "I just want to use ES6"

So something that I've found endlessly irritating in recent months is Javascript, and in particular the different flavours of same. An awful lot of demo code is being written in 'ES6' but there's a lot of instances — particularly front-end in a browser — where ES6 code just immediately fails.

ES6, short for ECMAScript 6, also known as ECMAScript 2015, is (nearly) the latest version of Javascript; ECMAScript is the 'official' name of the language commonly known as Javascript. The previous 'stable' version of Javascript, which is pretty much guaranteed to run everywhere, is ES5.

The solution, I kept hearing, was to use a package called Babel — but there seems to be very little instruction on installing just Babel, without also being dragged down the path of linters and module bundlers and other stuff that I don't (yet) understand. All I want is to be able to write code in ES6 in a text editor and automatically convert it to ES5 so it'll work in all browsers!

The rest of this post is in the form of a short tutorial for those who want to follow along. It 'only' gets Babel working at the most basic level — I'm aware there's a lot more that can be done, and other packages that can be combined with Babel, but that's all for another day.

... more

FUZE BASIC on micro:bit

I'd missed this, but turns out that in addition to Javascript (using Code Kingdoms), Microsoft's Blocks Editor/Touch Develop and MicroPython, it's now possible to write BASIC code for the micro:bit courtesy of FUZE — who also sell a coding/electronics pack for the Raspberry Pi.

Personally I'm not a huge fan of BASIC language(s) — I sometimes use Visual Basic for scripting at work and don't enjoy it! — and I think it'll struggle against the Code Kingdoms visual editor (which can lead into Javascript) or 'proper' coding in MicroPython (which surely is a much more relevant language than BASIC nowadays?!) but I'm in favour of anything which helps get people interested in coding, so kudos.