gnome-maps:wip/mattiasb/eslint-2.0-2

Last commit made on 2016-04-11
Get this branch:
git clone -b wip/mattiasb/eslint-2.0-2 https://git.launchpad.net/gnome-maps

Branch merges

Branch information

Name:
wip/mattiasb/eslint-2.0-2
Repository:
lp:gnome-maps

Recent commits

17b42bd... by Mattias Bengtsson <email address hidden>

WIP: Some more flags

ba3fd38... by Mattias Bengtsson <email address hidden>

Lint: Disallow coercing comparisons

In JavaScript when comparing two variables of different types with
`==` and `!=` JavaScript silently coerces the variable types according
to the Abstract Equality Comparison Algorithm[1], a rather obscure
algorithm which can have unexpected results.

Let's instead use the type safe alternatives `===` and `!==`.

1: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3

c647646... by Mattias Bengtsson <email address hidden>

Lint: Disallow the `var` statement

Disallow using `var` to declare variables. Only allow declaring
variables with `let` and `const`.

f7c048c... by Mattias Bengtsson <email address hidden>

Lint: Disallow custom indentation

Make ESLint throw an error for indentation other than:
 - 4 spaces per indentation level
 - just spaces (no tabs)
 - no indentation for case-statements in switches

...and fix all those errors.

e848cf3... by Mattias Bengtsson <email address hidden>

Lint: Fix leaking vars in case stmts

The ESLint recommended settings disallows declaring new variables with
let and const in case-statements. This is because a case statement
doesn't produce a new scope, which might be confusing and be a source
of bugs.

When there is need to use variables inside a switch-statement it is just as easy to declare it outside or wrap the case-clause inside {}'s.

2ffb9df... by Mattias Bengtsson <email address hidden>

Lint: Fix dangling commas in object lits

The ESLint recommended rules includes spitting errors when it sees
dangling commas in object literals.

Remove all dangling commas in object literals throughout the code.

4c6ea2b... by Mattias Bengtsson <email address hidden>

Lint: Fix all undeclared variable errors

The ESLint recommended settings disallows using undeclared variables
that it doesn't know about. This is a good thing since that likely
is a bug.

Fix all (two) undeclared variable errors.

80eb9ba... by Mattias Bengtsson <email address hidden>

Lint: Allow unused variables

The ESLint recommended rules includes spitting errors on unused
variables. While this makes sense in all other environments, in GJS
the way to export a function or variable is to just define it in
the top-level scope. So let's not do any errors on this.

de57fd0... by Mattias Bengtsson <email address hidden>

Lint: Allow our own global variables

Allow `pkg` and the gettext functions as global variables, since we use
them in Maps.

d30b9d4... by Mattias Bengtsson <email address hidden>

Lint: Allow all GJS default globals

The ESLint recommended rules will complain about access to global
variables that it doesn't know about. This is good, but ESLint
doesn't yet know about the GJS environment.

There is a PR (https://github.com/sindresorhus/globals/pull/73) for the
globals project on Github (which ESLint uses) to add the GJS environment
and all its global variables.

Until the above mentioned PR is merged, explicitly allow all default
GJS global variables.