0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
Commit Graph

13 Commits

Author SHA1 Message Date
Rich Trott
25cd455407 tools: enforce throw new Error() with lint rule
Add linting rule requiring `throw new Error()` over `throw Error()`.

PR-URL: https://github.com/nodejs/node/pull/3714
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-10 21:01:53 -08:00
Sakthipriyan Vairamani
b0e7b362c2 tools: enable prefer-const eslint rule
Description from: http://eslint.org/docs/rules/prefer-const.html

If a variable is never modified, using the `const` declaration is
better. `const` declaration tells readers, "this variable is never
modified," reducing cognitive load and improving maintainability.

Refer: https://github.com/nodejs/node/issues/3118
PR-URL: https://github.com/nodejs/node/pull/3152
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2015-10-27 23:02:43 +05:30
Sakthipriyan Vairamani
845acb4e1e tools: enable arrow functions in .eslintrc
As of v8 4.5, arrow functions are rolled out. This patch allows eslint
to accept arrow functions as well.

PR-URL: #2840
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-09-15 10:27:20 +05:30
Brendan Ashworth
96a2b2d54d tools: enable space-after-keywords in eslint
Requires that you do:

  if (x) { ... }

Rather than:

  if(x) { ... }
2015-08-22 18:01:53 -07:00
Jeremiah Senkpiel
ceee8d2807 test: add tests for persistent repl history
PR-URL: https://github.com/nodejs/io.js/pull/2224
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-08-04 11:56:18 -07:00
Roman Reiss
e3f9335c40 tools: re-enable comma-spacing linter rule
The rule was disabled because of an eslint bug which is now resolved.
All code in lib was already conforming and only test code needed a few
changes to make the linter happy with this rule enabled.

Ref: https://github.com/eslint/eslint/issues/2408

PR-URL: https://github.com/nodejs/io.js/pull/2072
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-by: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Alex Kocharin <alex@kocharin.ru>
2015-06-29 19:04:16 +02:00
Roman Reiss
3777f41562 tools: enable whitespace related rules in eslint
Enables rules for trailing whitespace, final newline and maximum
consecutive empty lines.

PR-URL: https://github.com/nodejs/io.js/pull/1971
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-15 16:42:01 +02:00
Roman Reiss
6e4d30286d tools: enable/add additional eslint rules
Enables the following rules:

- no-undef: Valuable rule to error on usage of undefined variables
- require-buffer: Custom rule that forbids usage of the global Buffer
  inside lib/ because of REPL issues.

PR-URL: https://github.com/nodejs/io.js/pull/1794
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-11 20:27:35 +02:00
Evan Lucas
fbd2b59716 tools: add objectLiteralShorthandProperties to .eslintrc
Required to make linting pass for using object literal
shorthand properties.

PR-URL: https://github.com/nodejs/io.js/pull/1760
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-05-28 09:35:43 -05:00
Roman Reiss
f29762f4dd test: enable linting for tests
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.

test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.

PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 21:21:27 +02:00
Roman Reiss
f07b3b600b tools: set eslint comma-spacing to 'warn'
Certain cases with comments inside arrays or object literals fail to
pass eslint's comma-spacing rule. This change sets the comma-spacing
rule to the 'warn' level.

Once https://github.com/eslint/eslint/issues/2408 is resolved and
released, this rule should be set back to 'error' level.

PR-URL: https://github.com/iojs/io.js/pull/1672
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
2015-05-11 14:32:57 +02:00
Alex Kocharin
aed6bce906 readline: turn emitKeys into a streaming parser
In certain environments escape sequences could be splitted into
multiple chunks. For example, when user presses left arrow,
`\x1b[D` sequence could appear as two keypresses (`\x1b` + `[D`).

PR-URL: https://github.com/iojs/io.js/pull/1601
Fixes: https://github.com/iojs/io.js/issues/1403
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-10 04:48:50 +02:00
Yosuke Furukawa
f9dd34d301 tools: replace closure-linter with eslint
PR-URL: https://github.com/iojs/io.js/pull/1539
Fixes: https://github.com/iojs/io.js/issues/1253
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2015-05-09 12:09:52 +09:00