18 Commits

Author SHA1 Message Date
Lorenzo Alberto Maria Ambrosi
aa52735006 Add clean-shrinkwrap script to postshrinkwrap step
Change-type: patch
Changelog-entry: Add clean-shrinkwrap script to postshrinkwrap step
Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzoa@balena.io>
2019-05-14 09:39:48 +02:00
Alexis Svinartchouk
34c98d1dcd Use async/await in flash.js
Avoid a rare race condition leading to "Error: There is already a flash in progress" messages

Changelog-entry: Avoid "Error: There is already a flash in progress" errors
Change-type: patch
2019-03-29 17:24:34 +01:00
Lorenzo Alberto Maria Ambrosi
64ec6d0e58
Convert flash results component to React
Change-type: minor
Changelog-entry: Added React component for the Flash Results button
Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzoa@balena.io>
2018-12-19 16:02:38 +01:00
Lorenzo Alberto Maria Ambrosi
c2c59f4a9e Enable React lint rules
Change-type: patch
Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzothunder.ambrosi@gmail.com>
2018-10-23 21:56:02 +02:00
Jonas Hermsmeier
d9a7730511 test(eslint): Fix JSX not being linted (#2358)
Change-Type: patch
2018-05-21 11:28:22 +01:00
Jonas Hermsmeier
edf924d012
test(lint): Replace ASCII-only check with ESLint rule
This replaces the `ensure-all-text-files-only-ascii` sanity-check
with an ESLint rule to only check identifiers in code against being
printable ASCII, as there are places where UTF-8 in content is required,
which would make the previous check fail.

Change-Type: patch
2018-04-02 17:10:23 +02:00
Jonas Hermsmeier
3dd646485f
chore(package): Replace custom missing require check
This replaces the custom bash script with rules from the eslint-node plugin
to check for `require()`d modules that don't exist.
This will also check requires of local modules, and installed packages,
yielding a more thorough check.

Change-Type: patch
2018-03-28 18:49:32 +02:00
Benedict Aas
47338cf07b
upgrade(package): Update eslint 3.19.0 -> 4.17.0 (#2026)
We upgrade eslint for better support of the object-curly-newline
options, and change the quantity of elements required before the linter
enforces newlines on objects, in addition we apply `consistent` to avoid
errors when there are newlines in objects with less than 2 elements.

```
const { field } = object

const {
  field
} = object

const {
  field1,
  field2
} = object
````

Change-Type: patch
Changelog-Entry: Upgrade eslint to use object-curly-newline options.
2018-02-09 15:30:43 +00:00
Juan Cruz Viotti
2291321b46 refactor(GUI): remove the intermediate child writer proxy process (#1910)
Etcher currently elevates a child writer proxy that itself spawns the
Etcher CLI in robot mode, parses the output, and proxies those messages
to the GUI application over IPC.

After these set of changes, Etcher elevates a single child writer
process that directly communicates back with the GUI using IPC. The main
purpose behind these changes is to simplify the overall architecture and
fix various issues caused by the current complex child process tree.

Here's a summary of the changes:

- Stop wrapping the Etcher CLI to perform writing
- Remove the robot option from the Etcher CLI (along with related
  documentation)
- Elevate a new `child-write.js` standalone executable
- Move the relevant bits of `lib/child-writer` to the `image-writer` GUI
  module
- Remove the `lib/child-writer` directory
- Add a new "Child died unexpectedly" Mixpanel event
- Floor state percentage in the flash state model

The above changes made is possible to tackle all the remaining issues
where the writer process would remain alive even if the parent died.

Change-Type: patch
Changelog-Entry: Ensure the writer process dies when the GUI application is killed.
See: https://github.com/resin-io/etcher/pull/1873
See: https://github.com/resin-io/etcher/pull/1843
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2018-01-04 20:46:09 +01:00
Juan Cruz Viotti
79a7a03d03 chore: enforce single quotes in ESLint (#1679)
We recently adopted the standardjs guidelines ESLint, which doesn't seem
to enforce single quotes, even though the guidelines mention it.

See: https://github.com/resin-io/etcher/pull/1663#discussion_r131623802
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-08 08:42:04 -07:00
Juan Cruz Viotti
d8e31665a0 chore: follow standardjs guidelines (#1664)
- Extend the `standard` ESLint configuration
- Remove ESLint rules that are defined in the `standard` configuration
- Get rid of semi-colons

See: https://github.com/resin-io/etcher/pull/1657
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-03 09:01:54 -04:00
Juan Cruz Viotti
5c19b70e83 refactor: adhere mostly to StandardJS guidelines (#1657)
This commit changes the whole codebase to adhere to all StandardJS
guidelines rules except semicolons, since the removal of semicolons
affect pretty much all lines, and the final diff is very hard to follow
(and to assess other more involved changes).

In a nutshell:

- When using `function`, we now require a space before the opening
  parenthesis
- If a line with operators is broken into multiple lines, the operator
  should now go after the line break
- Unnecessary padding lines are now forbidden

There were also some minor things that the `standard` CLI caught that I
updated here.

See: https://standardjs.com
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-08-03 06:59:02 -04:00
Juan Cruz Viotti
a5b1a92920 chore: add eslint-jsdoc-plugin to eslint (#1585)
This plugin helps us detect some things the built-in jsdoc rules can't,
like whether there is an example or not.

As expected, the addition of this plugin helped detect some minor JSDoc
issues.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-12 10:19:08 -04:00
Juan Cruz Viotti
df8611df11 chore: add ESLint Lodash plugin (#1148)
This is one step towards enforcing the linter until we barely have to
check for style issues on code reviews.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-08 19:11:15 -04:00
Juan Cruz Viotti
6c8bc117ab chore: revise ESLint built-in configuration (#1149)
There are a lot of new rules since the last time I revised the ESLint
rules documentation.

I've updated the main `.eslintrc.yml` to include some newer additions,
plus I added another ESLint configuration file inside `tests`, so we can
add some stricted rules to the production code while relaxing them for
the test suite (due to the fact that Mocha is not very ES6 friendly and
Angular tests require a bit of dark magic to setup).

This is a summary of the most important changes:

- Disallow "magic numbers"

These should now be extracted to constants, which forces us to think of
a good name for them, and thus make the code more self-documenting (I
had to Google up the meaning of some existing magic numbers, so I guess
this will be great for readability purposes).

- Require consistent `return` statements

Some functions relied on JavaScript relaxed casting mechanism to work,
which now have explicit return values. This flag also helped me detect
some promises that were not being returned, and therefore risked not
being caught by the exception handlers in case of errors.

- Disallow redefining function arguments

Immutability makes functions easier to reason about.

- Enforce JavaScript string templates instead of string concatenation

We were heavily mixing boths across the codebase.

There are some extra rules that I tweaked, however most of codebase
changes in this commit are related to the rules mentioned above.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-07 23:46:44 -04:00
Juan Cruz Viotti
4172291a10 chore: improve JSDoc ESLint rules (#1147)
- Prefer `@returns` to `@return`
- Prefer `@param` to `@arg`
- Prefer capitalised types

See: https://github.com/resin-io/etcher/pull/1111#discussion_r103483879
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-01 14:26:47 -04:00
Juan Cruz Viotti
edc69170d9 chore: don't force a linebreak style in ESLint (#570)
We're currently forcing a UNIX linebreak style, which causes hundreds of
complaints from the linter when cloning the project in a Windows machine
with a default configuration.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-07-12 10:30:07 -04:00
Juan Cruz Viotti
ea1df5cc11 chore: make use of ESLint (#540)
JSCS has merged with ESLint. This is the perfect excuse to move to
ESLint and unify both JSHint and JSCS hints under ESLint.

This PR also deprecates `gulp lint` in favour of `npm run lint`.

See: https://medium.com/@markelog/jscs-end-of-the-line-bc9bf0b3fdb2#.zbuwvxa5y
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-06-30 20:09:44 +05:30