From ccc0ab733d61236302310148f542f1317a0f3ac1 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Fri, 14 Jul 2017 11:05:00 -0700 Subject: [PATCH 01/17] net: support passing undefined to listen() For consistency with 4.x and 8.x. This commit also contains a forward port of https://github.com/nodejs/node/pull/14232 to confirm that 4.x and 6.x behave identically with respect to the port argument. PR-URL: https://github.com/nodejs/node/pull/14234 Refs: https://github.com/nodejs/node/issues/14205 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Sam Roberts --- lib/net.js | 2 +- test/parallel/test-net-listen-port-option.js | 35 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index 5e653c61d2106c..83a93d6bd42e87 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1338,7 +1338,7 @@ Server.prototype.listen = function() { self.once('listening', lastArg); } - var port = toNumber(arguments[0]); + var port = typeof arguments[0] === 'undefined' ? 0 : toNumber(arguments[0]); // The third optional argument is the backlog size. // When the ip is omitted it can be the second argument. diff --git a/test/parallel/test-net-listen-port-option.js b/test/parallel/test-net-listen-port-option.js index c4851bd533dfbe..3902a709bd9549 100644 --- a/test/parallel/test-net-listen-port-option.js +++ b/test/parallel/test-net-listen-port-option.js @@ -26,3 +26,38 @@ net.Server().listen({ port: '' + common.PORT }, close); net.Server().listen({ port: port }, common.fail); }, /invalid listen argument/i); }); + +// Repeat the tests, passing port as an argument, which validates somewhat +// differently. + +net.Server().listen(undefined, close); +net.Server().listen('0', close); + +// 'nan', skip, treated as a path, not a port +//'+Infinity', skip, treated as a path, not a port +//'-Infinity' skip, treated as a path, not a port + +// 4.x treats these as 0, but 6.x treats them as invalid numbers. +[ + -1, + 123.456, + 0x10000, + 1 / 0, + -1 / 0, +].forEach(function(port) { + assert.throws(function() { + net.Server().listen(port, common.fail); + }, /"port" argument must be >= 0 and < 65536/i); +}); + +// null is treated as 0 +net.Server().listen(null, close); + +// false/true are converted to 0/1, arguably a bug, but fixing would be +// semver-major. Note that true fails because ports that low can't be listened +// on by unprivileged processes. +net.Server().listen(false, close); + +net.Server().listen(true).on('error', common.mustCall(function(err) { + assert.strictEqual(err.code, 'EACCES'); +})); From 34c93e3a531ca55573bbc895c28952b4c9ef51ef Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Fri, 21 Apr 2017 07:53:00 +0300 Subject: [PATCH 02/17] doc: prepare js code for eslint-plugin-markdown This is an initial step to eliminate most of parsing errors. Backport-PR-URL: https://github.com/nodejs/node/pull/14067 PR-URL: https://github.com/nodejs/node/pull/12563 Refs: https://github.com/nodejs/node/pull/12557#issuecomment-296015032 Reviewed-By: Teddy Katz Reviewed-By: James M Snell Reviewed-By: Timothy Gu Reviewed-By: Gibson Fahnestock Reviewed-By: Yuta Hiroto --- doc/api/child_process.md | 10 +++++---- doc/api/console.md | 3 +++ doc/api/fs.md | 10 ++++----- doc/api/modules.md | 3 ++- doc/api/process.md | 4 ++-- doc/api/tls.md | 2 +- doc/api/zlib.md | 4 +++- doc/guides/writing-tests.md | 42 ++++++++++++++++++------------------- 8 files changed, 43 insertions(+), 35 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 21fb32c1ae0596..3ea65c6fcb0d04 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -101,7 +101,9 @@ bat.stderr.on('data', (data) => { bat.on('exit', (code) => { console.log(`Child exited with code ${code}`); }); +``` +```js // OR... const exec = require('child_process').exec; exec('my.bat', (err, stdout, stderr) => { @@ -183,14 +185,14 @@ The `options` argument may be passed as the second argument to customize how the process is spawned. The default options are: ```js -{ +const defaults = { encoding: 'utf8', timeout: 0, maxBuffer: 200*1024, killSignal: 'SIGTERM', cwd: null, env: null -} +}; ``` If `timeout` is greater than `0`, the parent will send the signal @@ -335,10 +337,10 @@ trigger arbitrary command execution.** A third argument may be used to specify additional options, with these defaults: ```js -{ +const defaults = { cwd: undefined, env: process.env -} +}; ``` Use `cwd` to specify the working directory from which the process is spawned. diff --git a/doc/api/console.md b/doc/api/console.md index 4813988d77b978..95a8924f8c9a05 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -62,6 +62,9 @@ or `console.Console`: ```js const Console = require('console').Console; +``` + +```js const Console = console.Console; ``` diff --git a/doc/api/fs.md b/doc/api/fs.md index dac10a018188fe..76cffbef4f05a3 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -218,7 +218,7 @@ synchronous counterparts are of this type. For a regular file [`util.inspect(stats)`][] would return a string very similar to this: -```js +```txt Stats { dev: 2114, ino: 48064969, @@ -592,13 +592,13 @@ default value of 64 kb for the same parameter. `options` is an object or string with the following defaults: ```js -{ +const defaults = { flags: 'r', encoding: null, fd: null, mode: 0o666, autoClose: true -} +}; ``` `options` can include `start` and `end` values to read a range of bytes from @@ -648,13 +648,13 @@ Returns a new [`WriteStream`][] object. (See [Writable Stream][]). `options` is an object or string with the following defaults: ```js -{ +const defaults = { flags: 'w', defaultEncoding: 'utf8', fd: null, mode: 0o666, autoClose: true -} +}; ``` `options` may also include a `start` option to allow writing data at diff --git a/doc/api/modules.md b/doc/api/modules.md index 9621c72ccee0e4..a2d2beb753ebfd 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -558,7 +558,8 @@ object, it is common to also reassign `exports`, for example: ```js module.exports = exports = function Constructor() { - // ... etc. + // ... etc. +}; ``` To illustrate the behavior, imagine this hypothetical implementation of diff --git a/doc/api/process.md b/doc/api/process.md index 41af1fc9bba6b2..30438b64cdb9d2 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -550,7 +550,7 @@ running the `./configure` script. An example of the possible output looks like: -```js +```txt { target_defaults: { cflags: [], @@ -1707,7 +1707,7 @@ to load modules that were compiled against a different module ABI version. console.log(process.versions); ``` -Will generate output similar to: +Will generate an object similar to: ```js { diff --git a/doc/api/tls.md b/doc/api/tls.md index b45af9bd63ffa2..b7e5c8f15e2bf4 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -1195,7 +1195,7 @@ stream. `tls.TLSSocket()`. For example, the code: ```js -pair = tls.createSecurePair( ... ); +pair = tls.createSecurePair(/* ... */); pair.encrypted.pipe(socket); socket.pipe(pair.encrypted); ``` diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 92ebc8141e3850..a08cf9a4afc1e6 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -84,7 +84,9 @@ request.on('response', (response) => { break; } }); +``` +```js // server example // Running a gzip operation on every request is quite expensive. // It would be much more efficient to cache the compressed buffer. @@ -157,7 +159,7 @@ For example, to reduce the default memory requirements from 256K to 128K, the options should be set to: ```js -{ windowBits: 14, memLevel: 7 } +const options = { windowBits: 14, memLevel: 7 }; ``` This will, however, generally degrade compression. diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index cc60fb57acfa3f..0f5ff304930e0a 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -23,27 +23,27 @@ Add tests when: Let's analyze this basic test from the Node.js test suite: ```javascript -1 'use strict'; -2 const common = require('../common'); -3 -4 // This test ensures that the http-parser can handle UTF-8 characters -5 // in the http header. -6 -7 const assert = require('assert'); -8 const http = require('http'); -9 -10 const server = http.createServer(common.mustCall((req, res) => { -11 res.end('ok'); -12 })); -13 server.listen(0, () => { -14 http.get({ -15 port: server.address().port, -16 headers: {'Test': 'Düsseldorf'} -17 }, common.mustCall((res) => { -18 assert.strictEqual(res.statusCode, 200); -19 server.close(); -20 })); -21 }); +'use strict'; // 1 +const common = require('../common'); // 2 + // 3 +// This test ensures that the http-parser can handle UTF-8 characters // 4 +// in the http header. // 5 + // 6 +const assert = require('assert'); // 7 +const http = require('http'); // 8 + // 9 +const server = http.createServer(common.mustCall((req, res) => { // 10 + res.end('ok'); // 11 +})); // 12 +server.listen(0, () => { // 13 + http.get({ // 14 + port: server.address().port, // 15 + headers: {'Test': 'Düsseldorf'} // 16 + }, common.mustCall((res) => { // 17 + assert.strictEqual(res.statusCode, 200); // 18 + server.close(); // 19 + })); // 20 +}); // 21 ``` ### **Lines 1-2** From 95e087962dc8026c6beca3b6858667182509f086 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Fri, 21 Apr 2017 17:38:31 +0300 Subject: [PATCH 03/17] doc: conform to rules for eslint-plugin-markdown Backport-PR-URL: https://github.com/nodejs/node/pull/14067 PR-URL: https://github.com/nodejs/node/pull/12563 Refs: https://github.com/nodejs/node/pull/12557#issuecomment-296015032 Reviewed-By: Teddy Katz Reviewed-By: James M Snell Reviewed-By: Timothy Gu Reviewed-By: Gibson Fahnestock Reviewed-By: Yuta Hiroto --- benchmark/README.md | 39 +++++----- doc/api/assert.md | 35 ++++----- doc/api/buffer.md | 16 ++-- doc/api/child_process.md | 12 ++- doc/api/cluster.md | 13 ++-- doc/api/console.md | 6 +- doc/api/crypto.md | 6 +- doc/api/debugger.md | 1 + doc/api/dgram.md | 4 +- doc/api/dns.md | 3 + doc/api/domain.md | 2 +- doc/api/fs.md | 2 +- doc/api/http.md | 43 ++++++----- doc/api/modules.md | 9 +-- doc/api/net.md | 2 + doc/api/os.md | 2 + doc/api/path.md | 78 ++++++++++---------- doc/api/process.md | 39 +++++----- doc/api/querystring.md | 9 ++- doc/api/readline.md | 2 +- doc/api/repl.md | 21 ++++-- doc/api/stream.md | 50 ++++++------- doc/api/url.md | 6 +- doc/api/util.md | 9 ++- doc/api/v8.md | 1 + doc/api/vm.md | 17 +++-- doc/api/zlib.md | 33 +++++---- doc/guides/timers-in-node.md | 14 ++-- doc/guides/writing-tests.md | 23 +++--- doc/topics/domain-postmortem.md | 14 ++-- doc/topics/event-loop-timers-and-nexttick.md | 59 ++++++++------- tools/icu/README.md | 8 +- 32 files changed, 311 insertions(+), 267 deletions(-) diff --git a/benchmark/README.md b/benchmark/README.md index c3d950f792e31f..b63c14fb072f80 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -34,17 +34,18 @@ constructor iterates through the configuration object property values and runs the test function with each of the combined arguments in spawned processes. For example, buffers/buffer-read.js has the following configuration: + ```js var bench = common.createBenchmark(main, { noAssert: [false, true], buffer: ['fast', 'slow'], type: ['UInt8', 'UInt16LE', 'UInt16BE', - 'UInt32LE', 'UInt32BE', - 'Int8', 'Int16LE', 'Int16BE', - 'Int32LE', 'Int32BE', - 'FloatLE', 'FloatBE', - 'DoubleLE', 'DoubleBE'], - millions: [1] + 'UInt32LE', 'UInt32BE', + 'Int8', 'Int16LE', 'Int16BE', + 'Int32LE', 'Int32BE', + 'FloatLE', 'FloatBE', + 'DoubleLE', 'DoubleBE'], + millions: [1] }); ``` The runner takes one item from each of the property array value to build a list @@ -52,21 +53,24 @@ of arguments to run the main function. The main function will receive the conf object as follows: - first run: + + ```js - { noAssert: false, - buffer: 'fast', - type: 'UInt8', - millions: 1 - } +{ noAssert: false, + buffer: 'fast', + type: 'UInt8', + millions: 1 +} ``` - second run: + + ```js - { - noAssert: false, - buffer: 'fast', - type: 'UInt16LE', - millions: 1 - } +{ noAssert: false, + buffer: 'fast', + type: 'UInt16LE', + millions: 1 +} ``` ... @@ -122,6 +126,7 @@ buffers/buffer-slice.js. ### The code snippet + ```js var common = require('../common.js'); // Load the test runner diff --git a/doc/api/assert.md b/doc/api/assert.md index e02829918c8b45..0b7621520b688f 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -43,18 +43,18 @@ are evaluated also: const assert = require('assert'); const obj1 = { - a : { - b : 1 + a: { + b: 1 } }; const obj2 = { - a : { - b : 2 + a: { + b: 2 } }; const obj3 = { - a : { - b : 1 + a: { + b: 1 } }; const obj4 = Object.create(obj1); @@ -93,10 +93,10 @@ Second, object comparisons include a strict equality check of their prototypes. ```js const assert = require('assert'); -assert.deepEqual({a:1}, {a:'1'}); +assert.deepEqual({ a: 1 }, { a: '1' }); // OK, because 1 == '1' -assert.deepStrictEqual({a:1}, {a:'1'}); +assert.deepStrictEqual({ a: 1 }, { a: '1' }); // AssertionError: { a: 1 } deepStrictEqual { a: '1' } // because 1 !== '1' using strict equality ``` @@ -251,18 +251,18 @@ Tests for any deep inequality. Opposite of [`assert.deepEqual()`][]. const assert = require('assert'); const obj1 = { - a : { - b : 1 + a: { + b: 1 } }; const obj2 = { - a : { - b : 2 + a: { + b: 2 } }; const obj3 = { - a : { - b : 1 + a: { + b: 1 } }; const obj4 = Object.create(obj1); @@ -297,10 +297,10 @@ Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][]. ```js const assert = require('assert'); -assert.notDeepEqual({a:1}, {a:'1'}); +assert.notDeepEqual({a: 1}, {a: '1'}); // AssertionError: { a: 1 } notDeepEqual { a: '1' } -assert.notDeepStrictEqual({a:1}, {a:'1'}); +assert.notDeepStrictEqual({a: 1}, {a: '1'}); // OK ``` @@ -466,7 +466,7 @@ assert.throws( throw new Error('Wrong value'); }, function(err) { - if ( (err instanceof Error) && /value/.test(err) ) { + if ((err instanceof Error) && /value/.test(err)) { return true; } }, @@ -478,6 +478,7 @@ Note that `error` can not be a string. If a string is provided as the second argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes: + ```js // THIS IS A MISTAKE! DO NOT DO THIS! assert.throws(myFunction, 'missing foo', 'did not throw with expected message'); diff --git a/doc/api/buffer.md b/doc/api/buffer.md index b89135bbdcba59..69e800ae09e761 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -886,7 +886,7 @@ Example: Copy an ASCII string into a `Buffer`, one byte at a time const str = 'Node.js'; const buf = Buffer.allocUnsafe(str.length); -for (let i = 0; i < str.length ; i++) { +for (let i = 0; i < str.length; i++) { buf[i] = str.charCodeAt(i); } @@ -994,7 +994,7 @@ byte 16 through byte 19 into `buf2`, starting at the 8th byte in `buf2` const buf1 = Buffer.allocUnsafe(26); const buf2 = Buffer.allocUnsafe(26).fill('!'); -for (let i = 0 ; i < 26 ; i++) { +for (let i = 0; i < 26; i++) { // 97 is the decimal ASCII value for 'a' buf1[i] = i + 97; } @@ -1011,7 +1011,7 @@ overlapping region within the same `Buffer` ```js const buf = Buffer.allocUnsafe(26); -for (let i = 0 ; i < 26 ; i++) { +for (let i = 0; i < 26; i++) { // 97 is the decimal ASCII value for 'a' buf[i] = i + 97; } @@ -1781,7 +1781,7 @@ one byte from the original `Buffer` ```js const buf1 = Buffer.allocUnsafe(26); -for (let i = 0 ; i < 26 ; i++) { +for (let i = 0; i < 26; i++) { // 97 is the decimal ASCII value for 'a' buf1[i] = i + 97; } @@ -1930,7 +1930,7 @@ Examples: ```js const buf1 = Buffer.allocUnsafe(26); -for (let i = 0 ; i < 26 ; i++) { +for (let i = 0; i < 26; i++) { // 97 is the decimal ASCII value for 'a' buf1[i] = i + 97; } @@ -1974,9 +1974,9 @@ const json = JSON.stringify(buf); console.log(json); const copy = JSON.parse(json, (key, value) => { - return value && value.type === 'Buffer' - ? Buffer.from(value.data) - : value; + return value && value.type === 'Buffer' ? + Buffer.from(value.data) : + value; }); // Prints: diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 3ea65c6fcb0d04..11c40f425fd93e 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -188,7 +188,7 @@ the process is spawned. The default options are: const defaults = { encoding: 'utf8', timeout: 0, - maxBuffer: 200*1024, + maxBuffer: 200 * 1024, killSignal: 'SIGTERM', cwd: null, env: null @@ -868,13 +868,17 @@ as in this example: 'use strict'; const spawn = require('child_process').spawn; -const child = spawn('sh', ['-c', - `node -e "setInterval(() => { +const child = spawn( + 'sh', + [ + '-c', + `node -e "setInterval(() => { console.log(process.pid, 'is alive') }, 500);"` ], { stdio: ['inherit', 'inherit', 'inherit'] - }); + } +); setTimeout(() => { child.kill(); // does not terminate the node process in the shell diff --git a/doc/api/cluster.md b/doc/api/cluster.md index bdf58e2b45f279..1d605503848963 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -511,11 +511,14 @@ When any of the workers die the cluster module will emit the `'exit'` event. This can be used to restart the worker by calling `.fork()` again. ```js -cluster.on('exit', (worker, code, signal) => { - console.log('worker %d died (%s). restarting...', - worker.process.pid, signal || code); - cluster.fork(); -}); +cluster.on( + 'exit', + (worker, code, signal) => { + console.log('worker %d died (%s). restarting...', + worker.process.pid, signal || code); + cluster.fork(); + } +); ``` See [child_process event: 'exit'][]. diff --git a/doc/api/console.md b/doc/api/console.md index 95a8924f8c9a05..5b687140253d26 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -130,7 +130,7 @@ the default behavior of `console` in Node.js. // new impl for assert without monkey-patching. const myConsole = Object.create(console, { assert: { - value: function assert(assertion, message, ...args) { + value(assertion, message, ...args) { try { console.assert(assertion, message, ...args); } catch (err) { @@ -253,9 +253,7 @@ prints the result to `stdout`: ```js console.time('100-elements'); -for (let i = 0; i < 100; i++) { - ; -} +for (let i = 0; i < 100; i++) ; console.timeEnd('100-elements'); // prints 100-elements: 225.438ms ``` diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 0f0062ae2fce71..0af112727b3f65 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -280,7 +280,8 @@ decipher.on('end', () => { // Prints: some clear text data }); -const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; decipher.write(encrypted, 'hex'); decipher.end(); ``` @@ -304,7 +305,8 @@ Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods: const crypto = require('crypto'); const decipher = crypto.createDecipher('aes192', 'a password'); -const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; let decrypted = decipher.update(encrypted, 'hex', 'utf8'); decrypted += decipher.final('utf8'); console.log(decrypted); diff --git a/doc/api/debugger.md b/doc/api/debugger.md index 745c5ac5b451b9..1c9b1049e82491 100644 --- a/doc/api/debugger.md +++ b/doc/api/debugger.md @@ -26,6 +26,7 @@ inspection are possible. Inserting the statement `debugger;` into the source code of a script will enable a breakpoint at that position in the code: + ```js // myscript.js global.x = 5; diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 2d996ce0c6b058..2aec4abb254643 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -20,7 +20,7 @@ server.on('message', (msg, rinfo) => { }); server.on('listening', () => { - var address = server.address(); + const address = server.address(); console.log(`server listening ${address.address}:${address.port}`); }); @@ -146,7 +146,7 @@ server.on('message', (msg, rinfo) => { }); server.on('listening', () => { - var address = server.address(); + const address = server.address(); console.log(`server listening ${address.address}:${address.port}`); }); diff --git a/doc/api/dns.md b/doc/api/dns.md index 811ad84e016edd..457559d0ce692c 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -268,6 +268,7 @@ will contain an array of objects with the following properties: For example: + ```js { flags: 's', @@ -306,6 +307,7 @@ be an object with the following properties: * `expire` * `minttl` + ```js { nsname: 'ns.example.com', @@ -332,6 +334,7 @@ be an array of objects with the following properties: * `port` * `name` + ```js { priority: 10, diff --git a/doc/api/domain.md b/doc/api/domain.md index 1cc25e0cf8d8fb..e98ccc87a0e346 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -162,7 +162,7 @@ function handleRequest(req, res) { setTimeout(() => { // Whoops! flerb.bark(); - }); + }, timeout); break; default: res.end('ok'); diff --git a/doc/api/fs.md b/doc/api/fs.md index 76cffbef4f05a3..56969fc1d67dff 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -218,7 +218,7 @@ synchronous counterparts are of this type. For a regular file [`util.inspect(stats)`][] would return a string very similar to this: -```txt +``` Stats { dev: 2114, ino: 48064969, diff --git a/doc/api/http.md b/doc/api/http.md index 02b7aa5cc9e7e7..faefc803f7004b 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -12,6 +12,7 @@ user is able to stream data. HTTP message headers are represented by an object like this: + ```js { 'content-length': '123', 'content-type': 'text/plain', @@ -34,6 +35,7 @@ property, which is an array of `[key, value, key2, value2, ...]`. For example, the previous message header object might have a `rawHeaders` list like the following: + ```js [ 'ConTent-Length', '123456', 'content-LENGTH', '123', @@ -130,7 +132,7 @@ To configure any of them, you must create your own [`http.Agent`][] instance. ```js const http = require('http'); -var keepAliveAgent = new http.Agent({ keepAlive: true }); +const keepAliveAgent = new http.Agent({ keepAlive: true }); options.agent = keepAliveAgent; http.request(options, onResponseCallback); ``` @@ -309,14 +311,14 @@ const net = require('net'); const url = require('url'); // Create an HTTP tunneling proxy -var proxy = http.createServer( (req, res) => { +const proxy = http.createServer((req, res) => { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('okay'); }); proxy.on('connect', (req, cltSocket, head) => { // connect to an origin server - var srvUrl = url.parse(`http://${req.url}`); - var srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => { + const srvUrl = url.parse(`http://${req.url}`); + const srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => { cltSocket.write('HTTP/1.1 200 Connection Established\r\n' + 'Proxy-agent: Node.js-Proxy\r\n' + '\r\n'); @@ -330,14 +332,14 @@ proxy.on('connect', (req, cltSocket, head) => { proxy.listen(1337, '127.0.0.1', () => { // make a request to a tunneling proxy - var options = { + const options = { port: 1337, hostname: '127.0.0.1', method: 'CONNECT', path: 'www.google.com:80' }; - var req = http.request(options); + const req = http.request(options); req.end(); req.on('connect', (res, socket, head) => { @@ -405,7 +407,7 @@ A client server pair that show you how to listen for the `'upgrade'` event. const http = require('http'); // Create an HTTP server -var srv = http.createServer( (req, res) => { +const srv = http.createServer((req, res) => { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('okay'); }); @@ -422,7 +424,7 @@ srv.on('upgrade', (req, socket, head) => { srv.listen(1337, '127.0.0.1', () => { // make a request - var options = { + const options = { port: 1337, hostname: '127.0.0.1', headers: { @@ -431,7 +433,7 @@ srv.listen(1337, '127.0.0.1', () => { } }; - var req = http.request(options); + const req = http.request(options); req.end(); req.on('upgrade', (res, socket, upgradeHead) => { @@ -933,7 +935,7 @@ Note that the name is case insensitive. Example: ```js -var contentType = response.getHeader('content-type'); +const contentType = response.getHeader('content-type'); ``` ### response.headersSent @@ -1006,7 +1008,7 @@ any headers passed to [`response.writeHead()`][], with the headers passed to ```js // returns content-type = text/plain -const server = http.createServer((req,res) => { +const server = http.createServer((req, res) => { res.setHeader('Content-Type', 'text/html'); res.setHeader('X-Foo', 'bar'); res.writeHead(200, {'Content-Type': 'text/plain'}); @@ -1138,7 +1140,7 @@ argument. Example: ```js -var body = 'hello world'; +const body = 'hello world'; response.writeHead(200, { 'Content-Length': Buffer.byteLength(body), 'Content-Type': 'text/plain' }); @@ -1156,7 +1158,7 @@ any headers passed to [`response.writeHead()`][], with the headers passed to ```js // returns content-type = text/plain -const server = http.createServer((req,res) => { +const server = http.createServer((req, res) => { res.setHeader('Content-Type', 'text/html'); res.setHeader('X-Foo', 'bar'); res.writeHead(200, {'Content-Type': 'text/plain'}); @@ -1385,6 +1387,7 @@ Accept: text/plain\r\n Then `request.url` will be: + ```js '/status?name=ryan' ``` @@ -1488,10 +1491,10 @@ http.get('http://nodejs.org/dist/index.json', (res) => { let error; if (statusCode !== 200) { - error = new Error(`Request Failed.\n` + + error = new Error('Request Failed.\n' + `Status Code: ${statusCode}`); } else if (!/^application\/json/.test(contentType)) { - error = new Error(`Invalid content-type.\n` + + error = new Error('Invalid content-type.\n' + `Expected application/json but received ${contentType}`); } if (error) { @@ -1506,7 +1509,7 @@ http.get('http://nodejs.org/dist/index.json', (res) => { res.on('data', (chunk) => rawData += chunk); res.on('end', () => { try { - let parsedData = JSON.parse(rawData); + const parsedData = JSON.parse(rawData); console.log(parsedData); } catch (e) { console.log(e.message); @@ -1584,11 +1587,11 @@ upload a file with a POST request, then write to the `ClientRequest` object. Example: ```js -var postData = querystring.stringify({ - 'msg' : 'Hello World!' +const postData = querystring.stringify({ + 'msg': 'Hello World!' }); -var options = { +const options = { hostname: 'www.google.com', port: 80, path: '/upload', @@ -1599,7 +1602,7 @@ var options = { } }; -var req = http.request(options, (res) => { +const req = http.request(options, (res) => { console.log(`STATUS: ${res.statusCode}`); console.log(`HEADERS: ${JSON.stringify(res.headers)}`); res.setEncoding('utf8'); diff --git a/doc/api/modules.md b/doc/api/modules.md index a2d2beb753ebfd..480f9e10ea57be 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -67,11 +67,7 @@ The module system is implemented in the `require('module')` module. When a file is run directly from Node.js, `require.main` is set to its `module`. That means that you can determine whether a file has been run -directly by testing - -```js -require.main === module -``` +directly by testing `require.main === module`. For a file `foo.js`, this will be `true` if run via `node foo.js`, but `false` if run by `require('./foo')`. @@ -441,7 +437,7 @@ Before a module's code is executed, Node.js will wrap it with a function wrapper that looks like the following: ```js -(function (exports, require, module, __filename, __dirname) { +(function(exports, require, module, __filename, __dirname) { // Your module code actually lives in here }); ``` @@ -556,6 +552,7 @@ exports = { hello: false }; // Not exported, only available in the module When the `module.exports` property is being completely replaced by a new object, it is common to also reassign `exports`, for example: + ```js module.exports = exports = function Constructor() { // ... etc. diff --git a/doc/api/net.md b/doc/api/net.md index bcabc98df6abc0..72adf6306db77c 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -333,6 +333,7 @@ Construct a new socket object. `options` is an object with the following defaults: + ```js { fd: null, @@ -859,6 +860,7 @@ automatically set as a listener for the [`'connection'`][] event. `options` is an object with the following defaults: + ```js { allowHalfOpen: false, diff --git a/doc/api/os.md b/doc/api/os.md index 4009e53bcd5eac..84cb2ba3ff6b7c 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -71,6 +71,7 @@ The properties included on each object include: For example: + ```js [ { @@ -253,6 +254,7 @@ The properties available on the assigned network address object include: * `scopeid` {number} The numeric IPv6 scope ID (only specified when `family` is `IPv6`) + ```js { lo: [ diff --git a/doc/api/path.md b/doc/api/path.md index 5ccd5e021e5563..27ca6be6fed7ac 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -70,10 +70,10 @@ the Unix `basename` command. Trailing directory separators are ignored, see For example: ```js -path.basename('/foo/bar/baz/asdf/quux.html') +path.basename('/foo/bar/baz/asdf/quux.html'); // Returns: 'quux.html' -path.basename('/foo/bar/baz/asdf/quux.html', '.html') +path.basename('/foo/bar/baz/asdf/quux.html', '.html'); // Returns: 'quux' ``` @@ -95,21 +95,21 @@ Provides the platform-specific path delimiter: For example, on POSIX: ```js -console.log(process.env.PATH) +console.log(process.env.PATH); // Prints: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' -process.env.PATH.split(path.delimiter) +process.env.PATH.split(path.delimiter); // Returns: ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] ``` On Windows: ```js -console.log(process.env.PATH) +console.log(process.env.PATH); // Prints: 'C:\Windows\system32;C:\Windows;C:\Program Files\node\' -process.env.PATH.split(path.delimiter) -// Returns: ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\'] +process.env.PATH.split(path.delimiter); +// Returns ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\'] ``` ## path.dirname(path) @@ -127,7 +127,7 @@ the Unix `dirname` command. Trailing directory separators are ignored, see For example: ```js -path.dirname('/foo/bar/baz/asdf/quux') +path.dirname('/foo/bar/baz/asdf/quux'); // Returns: '/foo/bar/baz/asdf' ``` @@ -150,19 +150,19 @@ an empty string is returned. For example: ```js -path.extname('index.html') +path.extname('index.html'); // Returns: '.html' -path.extname('index.coffee.md') +path.extname('index.coffee.md'); // Returns: '.md' -path.extname('index.') +path.extname('index.'); // Returns: '.' -path.extname('index') +path.extname('index'); // Returns: '' -path.extname('.index') +path.extname('.index'); // Returns: '' ``` @@ -226,8 +226,8 @@ On Windows: ```js path.format({ - dir : "C:\\path\\dir", - base : "file.txt" + dir: 'C:\\path\\dir', + base: 'file.txt' }); // Returns: 'C:\\path\\dir\\file.txt' ``` @@ -247,22 +247,22 @@ If the given `path` is a zero-length string, `false` will be returned. For example on POSIX: ```js -path.isAbsolute('/foo/bar') // true -path.isAbsolute('/baz/..') // true -path.isAbsolute('qux/') // false -path.isAbsolute('.') // false +path.isAbsolute('/foo/bar'); // true +path.isAbsolute('/baz/..'); // true +path.isAbsolute('qux/'); // false +path.isAbsolute('.'); // false ``` On Windows: ```js -path.isAbsolute('//server') // true -path.isAbsolute('\\\\server') // true -path.isAbsolute('C:/foo/..') // true -path.isAbsolute('C:\\foo\\..') // true -path.isAbsolute('bar\\baz') // false -path.isAbsolute('bar/baz') // false -path.isAbsolute('.') // false +path.isAbsolute('//server'); // true +path.isAbsolute('\\\\server'); // true +path.isAbsolute('C:/foo/..'); // true +path.isAbsolute('C:\\foo\\..'); // true +path.isAbsolute('bar\\baz'); // false +path.isAbsolute('bar/baz'); // false +path.isAbsolute('.'); // false ``` A [`TypeError`][] is thrown if `path` is not a string. @@ -285,11 +285,11 @@ working directory. For example: ```js -path.join('/foo', 'bar', 'baz/asdf', 'quux', '..') +path.join('/foo', 'bar', 'baz/asdf', 'quux', '..'); // Returns: '/foo/bar/baz/asdf' -path.join('foo', {}, 'bar') -// throws TypeError: Arguments to path.join must be strings +path.join('foo', {}, 'bar'); +// throws 'TypeError: Path must be a string. Received {}' ``` A [`TypeError`][] is thrown if any of the path segments is not a string. @@ -316,7 +316,7 @@ current working directory. For example on POSIX: ```js -path.normalize('/foo/bar//baz/asdf/quux/..') +path.normalize('/foo/bar//baz/asdf/quux/..'); // Returns: '/foo/bar/baz/asdf' ``` @@ -360,7 +360,7 @@ The returned object will have the following properties: For example on POSIX: ```js -path.parse('/home/user/dir/file.txt') +path.parse('/home/user/dir/file.txt'); // Returns: // { // root : "/", @@ -384,7 +384,7 @@ path.parse('/home/user/dir/file.txt') On Windows: ```js -path.parse('C:\\path\\dir\\file.txt') +path.parse('C:\\path\\dir\\file.txt'); // Returns: // { // root : "C:\\", @@ -436,14 +436,14 @@ directory will be used instead of the zero-length strings. For example on POSIX: ```js -path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') +path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb'); // Returns: '../../impl/bbb' ``` On Windows: ```js -path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') +path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb'); // Returns: '..\\..\\impl\\bbb' ``` @@ -479,13 +479,13 @@ of the current working directory. For example: ```js -path.resolve('/foo/bar', './baz') +path.resolve('/foo/bar', './baz'); // Returns: '/foo/bar/baz' -path.resolve('/foo/bar', '/tmp/file/') +path.resolve('/foo/bar', '/tmp/file/'); // Returns: '/tmp/file' -path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') +path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif'); // if the current working directory is /home/myself/node, // this returns '/home/myself/node/wwwroot/static_files/gif/image.gif' ``` @@ -507,14 +507,14 @@ Provides the platform-specific path segment separator: For example on POSIX: ```js -'foo/bar/baz'.split(path.sep) +'foo/bar/baz'.split(path.sep); // Returns: ['foo', 'bar', 'baz'] ``` On Windows: ```js -'foo\\bar\\baz'.split(path.sep) +'foo\\bar\\baz'.split(path.sep); // Returns: ['foo', 'bar', 'baz'] ``` diff --git a/doc/api/process.md b/doc/api/process.md index 30438b64cdb9d2..03ccbe9b7aad6e 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -241,7 +241,7 @@ function SomeResource() { this.loaded = Promise.reject(new Error('Resource not yet loaded!')); } -var resource = new SomeResource(); +const resource = new SomeResource(); // no .catch or .then on resource.loaded for at least a turn ``` @@ -530,9 +530,8 @@ console.log(`Starting directory: ${process.cwd()}`); try { process.chdir('/tmp'); console.log(`New directory: ${process.cwd()}`); -} -catch (err) { - console.log(`chdir: ${err}`); +} catch (err) { + console.error(`chdir: ${err}`); } ``` @@ -550,7 +549,8 @@ running the `./configure` script. An example of the possible output looks like: -```txt + +```js { target_defaults: { cflags: [], @@ -670,6 +670,7 @@ See environ(7). An example of this object looks like: + ```js { TERM: 'xterm-256color', @@ -811,7 +812,7 @@ so, it is recommended to place the `emitWarning()` behind a simple boolean flag as illustrated in the example below: ```js -var warned = false; +let warned = false; function emitMyWarning() { if (!warned) { process.emitWarning('Only warn once!'); @@ -846,12 +847,14 @@ $ node --harmony script.js --version Results in `process.execArgv`: + ```js ['--harmony'] ``` And `process.argv`: + ```js ['/usr/local/bin/node', 'script.js', '--version'] ``` @@ -868,6 +871,7 @@ that started the Node.js process. For example: + ```js '/usr/local/bin/node' ``` @@ -1059,11 +1063,11 @@ Passing in the result of a previous call to `process.hrtime()` is useful for calculating an amount of time passed between calls: ```js -var time = process.hrtime(); +const time = process.hrtime(); // [ 1800216, 25 ] setTimeout(() => { - var diff = process.hrtime(time); + const diff = process.hrtime(time); // [ 1, 552 ] console.log(`Benchmark took ${diff[0] * 1e9 + diff[1]} nanoseconds`); @@ -1179,6 +1183,7 @@ console.log(process.memoryUsage()); Will generate: + ```js { rss: 4935680, @@ -1233,7 +1238,7 @@ function MyThing(options) { }); } -var thing = new MyThing(); +const thing = new MyThing(); thing.getReadyForStuff(); // thing.startDoingStuff() gets called now, not before. @@ -1348,6 +1353,7 @@ tarball. For example: + ```js { name: 'node', @@ -1401,8 +1407,7 @@ if (process.getegid && process.setegid) { try { process.setegid(501); console.log(`New gid: ${process.getegid()}`); - } - catch (err) { + } catch (err) { console.log(`Failed to set gid: ${err}`); } } @@ -1430,8 +1435,7 @@ if (process.geteuid && process.seteuid) { try { process.seteuid(501); console.log(`New uid: ${process.geteuid()}`); - } - catch (err) { + } catch (err) { console.log(`Failed to set uid: ${err}`); } } @@ -1458,8 +1462,7 @@ if (process.getgid && process.setgid) { try { process.setgid(501); console.log(`New gid: ${process.getgid()}`); - } - catch (err) { + } catch (err) { console.log(`Failed to set gid: ${err}`); } } @@ -1500,8 +1503,7 @@ if (process.getuid && process.setuid) { try { process.setuid(501); console.log(`New uid: ${process.getuid()}`); - } - catch (err) { + } catch (err) { console.log(`Failed to set uid: ${err}`); } } @@ -1538,7 +1540,7 @@ For example: process.stdin.setEncoding('utf8'); process.stdin.on('readable', () => { - var chunk = process.stdin.read(); + const chunk = process.stdin.read(); if (chunk !== null) { process.stdout.write(`data: ${chunk}`); } @@ -1709,6 +1711,7 @@ console.log(process.versions); Will generate an object similar to: + ```js { http_parser: '2.3.0', diff --git a/doc/api/querystring.md b/doc/api/querystring.md index a1ee5e62b87700..3a10604020db90 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -49,6 +49,7 @@ collection of key and value pairs. For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into: + ```js { foo: 'bar', @@ -70,7 +71,7 @@ in the following example: // Assuming gbkDecodeURIComponent function already exists... querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, - { decodeURIComponent: gbkDecodeURIComponent }) + { decodeURIComponent: gbkDecodeURIComponent }); ``` ## querystring.stringify(obj[, sep[, eq[, options]]]) @@ -98,10 +99,10 @@ Any other input values will be coerced to empty strings. For example: ```js -querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }) +querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); // returns 'foo=bar&baz=qux&baz=quux&corge=' -querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':') +querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); // returns 'foo:bar;baz:qux' ``` @@ -114,7 +115,7 @@ following example: // Assuming gbkEncodeURIComponent function already exists, querystring.stringify({ w: '中文', foo: 'bar' }, null, null, - { encodeURIComponent: gbkEncodeURIComponent }) + { encodeURIComponent: gbkEncodeURIComponent }); ``` ## querystring.unescape(str) diff --git a/doc/api/readline.md b/doc/api/readline.md index 6fdee2c0449de5..fab1e9b3ed80f3 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -485,7 +485,7 @@ const rl = readline.createInterface({ rl.prompt(); rl.on('line', (line) => { - switch(line.trim()) { + switch (line.trim()) { case 'hello': console.log('world!'); break; diff --git a/doc/api/repl.md b/doc/api/repl.md index 248d87991bb8ff..ed1425350d19f1 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -40,6 +40,7 @@ The following special commands are supported by all REPL instances: `> .load ./file/to/load.js` * `.editor` - Enter editor mode (`-D` to finish, `-C` to cancel) + ```js > .editor // Entering editor mode (^D to finish, ^C to cancel) @@ -75,6 +76,7 @@ evaluation function when the `repl.REPLServer` instance is created. The default evaluator supports direct evaluation of JavaScript expressions: + ```js > 1 + 1 2 @@ -96,13 +98,14 @@ it to the `context` object associated with each `REPLServer`. For example: ```js const repl = require('repl'); -var msg = 'message'; +const msg = 'message'; repl.start('> ').context.m = msg; ``` Properties in the `context` object appear as local within the REPL: + ```js $ node repl_test.js > m @@ -115,7 +118,7 @@ To specify read-only globals, context properties must be defined using ```js const repl = require('repl'); -var msg = 'message'; +const msg = 'message'; const r = repl.start('> '); Object.defineProperty(r.context, 'm', { @@ -132,6 +135,7 @@ REPL environment when used. For instance, unless otherwise declared as a global or scoped variable, the input `fs` will be evaluated on-demand as `global.fs = require('fs')`. + ```js > fs.createReadStream('./some/file'); ``` @@ -141,6 +145,7 @@ global or scoped variable, the input `fs` will be evaluated on-demand as The default evaluator will, by default, assign the result of the most recently evaluated expression to the special variable `_` (underscore). + ```js > [ 'a', 'b', 'c' ] [ 'a', 'b', 'c' ] @@ -183,7 +188,7 @@ to the provided callback function: ```js function eval(cmd, context, filename, callback) { - var result; + let result; try { result = vm.runInThisContext(cmd); } catch (e) { @@ -220,7 +225,7 @@ const repl = require('repl'); const r = repl.start({prompt: '>', eval: myEval, writer: myWriter}); function myEval(cmd, context, filename, callback) { - callback(null,cmd); + callback(null, cmd); } function myWriter(output) { @@ -275,7 +280,7 @@ function initializeContext(context) { context.m = 'test'; } -var r = repl.start({prompt: '>'}); +const r = repl.start({prompt: '>'}); initializeContext(r.context); r.on('reset', initializeContext); @@ -284,6 +289,7 @@ r.on('reset', initializeContext); When this code is executed, the global `'m'` variable can be modified but then reset to its initial value using the `.clear` command: + ```js $ ./node example.js >m @@ -321,7 +327,7 @@ The following example shows two new commands added to the REPL instance: ```js const repl = require('repl'); -var replServer = repl.start({prompt: '> '}); +const replServer = repl.start({prompt: '> '}); replServer.defineCommand('sayhello', { help: 'Say hello', action: function(name) { @@ -428,6 +434,7 @@ Node.js itself uses the `repl` module to provide its own interactive interface for executing JavaScript. This can be used by executing the Node.js binary without passing any arguments (or by passing the `-i` argument): + ```js $ node > a = [1, 2, 3]; @@ -502,7 +509,7 @@ socket, and a TCP socket: ```js const net = require('net'); const repl = require('repl'); -var connections = 0; +let connections = 0; repl.start({ prompt: 'Node.js via stdin> ', diff --git a/doc/api/stream.md b/doc/api/stream.md index e3fb35deba54c3..69efa51158ff9e 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -112,7 +112,7 @@ that implements an HTTP server: ```js const http = require('http'); -const server = http.createServer( (req, res) => { +const server = http.createServer((req, res) => { // req is an http.IncomingMessage, which is a Readable Stream // res is an http.ServerResponse, which is a Writable Stream @@ -237,7 +237,7 @@ function writeOneMillionTimes(writer, data, encoding, callback) { let i = 1000000; write(); function write() { - var ok = true; + let ok = true; do { i--; if (i === 0) { @@ -280,7 +280,7 @@ has been called, and all data has been flushed to the underlying system. ```js const writer = getWritableStreamSomehow(); -for (var i = 0; i < 100; i ++) { +for (let i = 0; i < 100; i++) { writer.write(`hello, #${i}!\n`); } writer.end('This is the end\n'); @@ -474,18 +474,18 @@ possible to respect backpressure and avoid memory issues using the [`'drain'`][] event: ```js -function write (data, cb) { +function write(data, cb) { if (!stream.write(data)) { - stream.once('drain', cb) + stream.once('drain', cb); } else { - process.nextTick(cb) + process.nextTick(cb); } } // Wait for cb to be called before doing any other write. write('hello', () => { - console.log('write completed, do more writes now') -}) + console.log('write completed, do more writes now'); +}); ``` A Writable stream in object mode will always ignore the `encoding` argument. @@ -755,13 +755,13 @@ Readable. This is used primarily by the mechanism that underlies the use this method directly. ```js -const readable = new stream.Readable +const readable = new stream.Readable(); -readable.isPaused() // === false -readable.pause() -readable.isPaused() // === true -readable.resume() -readable.isPaused() // === false +readable.isPaused(); // === false +readable.pause(); +readable.isPaused(); // === true +readable.resume(); +readable.isPaused(); // === false ``` ##### readable.pause() @@ -875,7 +875,7 @@ the internal buffer is fully drained. ```js const readable = getReadableStreamSomehow(); readable.on('readable', () => { - var chunk; + let chunk; while (null !== (chunk = readable.read())) { console.log(`Received ${chunk.length} bytes of data.`); } @@ -1007,14 +1007,14 @@ function parseHeader(stream, callback) { stream.on('error', callback); stream.on('readable', onReadable); const decoder = new StringDecoder('utf8'); - var header = ''; + let header = ''; function onReadable() { - var chunk; + let chunk; while (null !== (chunk = stream.read())) { - var str = decoder.write(chunk); + const str = decoder.write(chunk); if (str.match(/\n\n/)) { // found the header boundary - var split = str.split(/\n\n/); + const split = str.split(/\n\n/); header += split.shift(); const remaining = split.join('\n\n'); const buf = Buffer.from(remaining, 'utf8'); @@ -1068,7 +1068,7 @@ For example: ```js const OldReader = require('./old-api-module.js').OldReader; const Readable = require('stream').Readable; -const oreader = new OldReader; +const oreader = new OldReader(); const myReader = new Readable().wrap(oreader); myReader.on('readable', () => { @@ -1597,12 +1597,12 @@ class Counter extends Readable { } _read() { - var i = this._index++; + const i = this._index++; if (i > this._max) this.push(null); else { - var str = '' + i; - var buf = Buffer.from(str, 'ascii'); + const str = '' + i; + const buf = Buffer.from(str, 'ascii'); this.push(buf); } } @@ -1906,12 +1906,12 @@ argument is passed to the `callback`, it will be forwarded on to the `readable.push()` method. In other words the following are equivalent: ```js -transform.prototype._transform = function (data, encoding, callback) { +transform.prototype._transform = function(data, encoding, callback) { this.push(data); callback(); }; -transform.prototype._transform = function (data, encoding, callback) { +transform.prototype._transform = function(data, encoding, callback) { callback(null, data); }; ``` diff --git a/doc/api/url.md b/doc/api/url.md index 625247f0a24f4a..1cb3e2f89f0fd8 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -232,9 +232,9 @@ manner similar to that of a Web browser resolving an anchor tag HREF. For example: ```js -url.resolve('/one/two/three', 'four') // '/one/two/four' -url.resolve('http://example.com/', '/one') // 'http://example.com/one' -url.resolve('http://example.com/one', '/two') // 'http://example.com/two' +url.resolve('/one/two/three', 'four'); // '/one/two/four' +url.resolve('http://example.com/', '/one'); // 'http://example.com/one' +url.resolve('http://example.com/one', '/two'); // 'http://example.com/two' ``` ## Escaped Characters diff --git a/doc/api/util.md b/doc/api/util.md index b97b6f133378cb..ec5ec635d16fdf 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -59,7 +59,7 @@ it is marked as deprecated. const util = require('util'); exports.puts = util.deprecate(function() { - for (var i = 0, len = arguments.length; i < len; ++i) { + for (let i = 0, len = arguments.length; i < len; ++i) { process.stdout.write(arguments[i] + '\n'); } }, 'util.puts: Use console.log instead'); @@ -308,7 +308,8 @@ class Box { // Five space padding because that's the size of "Box< ". const padding = ' '.repeat(5); - const inner = util.inspect(this.value, newOptions).replace(/\n/g, '\n' + padding); + const inner = util.inspect(this.value, newOptions) + .replace(/\n/g, '\n' + padding); return options.stylize('Box', 'special') + '< ' + inner + ' >'; } } @@ -426,7 +427,7 @@ const util = require('util'); util.isArray([]); // Returns: true -util.isArray(new Array); +util.isArray(new Array()); // Returns: true util.isArray({}); // Returns: false @@ -662,7 +663,7 @@ util.isObject(null); // Returns: false util.isObject({}); // Returns: true -util.isObject(function(){}); +util.isObject(function() {}); // Returns: false ``` diff --git a/doc/api/v8.md b/doc/api/v8.md index 82169d04869dea..904bfddf5d2e92 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -25,6 +25,7 @@ Returns an object with the following properties: For example: + ```js { total_heap_size: 7326976, diff --git a/doc/api/vm.md b/doc/api/vm.md index f1596c617a6ac2..7d04cbd4d1689d 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -107,7 +107,7 @@ const sandbox = { const script = new vm.Script('count += 1; name = "kitty";'); const context = new vm.createContext(sandbox); -for (var i = 0; i < 10; ++i) { +for (let i = 0; i < 10; ++i) { script.runInContext(context); } @@ -198,7 +198,7 @@ global.globalVar = 0; const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' }); -for (var i = 0; i < 1000; ++i) { +for (let i = 0; i < 1000; ++i) { script.runInThisContext(); } @@ -226,14 +226,14 @@ will remain unchanged. const util = require('util'); const vm = require('vm'); -var globalVar = 3; +global.globalVar = 3; const sandbox = { globalVar: 1 }; vm.createContext(sandbox); vm.runInContext('globalVar *= 2;', sandbox); -console.log(util.inspect(sandbox)); // 2 +console.log(util.inspect(sandbox)); // { globalVar: 2 } console.log(util.inspect(globalVar)); // 3 ``` @@ -291,7 +291,7 @@ const vm = require('vm'); const sandbox = { globalVar: 1 }; vm.createContext(sandbox); -for (var i = 0; i < 10; ++i) { +for (let i = 0; i < 10; ++i) { vm.runInContext('globalVar *= 2;', sandbox); } console.log(util.inspect(sandbox)); @@ -394,9 +394,10 @@ local scope, but does have access to the current `global` object. The following example illustrates using both `vm.runInThisContext()` and the JavaScript [`eval()`][] function to run the same code: + ```js const vm = require('vm'); -var localVar = 'initial value'; +let localVar = 'initial value'; const vmResult = vm.runInThisContext('localVar = "vm";'); console.log('vmResult:', vmResult); @@ -430,7 +431,7 @@ to the `http` module passed to it. For instance: 'use strict'; const vm = require('vm'); -let code = +const code = `(function(require) { const http = require('http'); @@ -443,7 +444,7 @@ let code = console.log('Server running at http://127.0.0.1:8124/'); })`; - vm.runInThisContext(code)(require); +vm.runInThisContext(code)(require); ``` *Note*: The `require()` in the above case shares the state with the context it diff --git a/doc/api/zlib.md b/doc/api/zlib.md index a08cf9a4afc1e6..17a1464b159de3 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -65,11 +65,11 @@ const zlib = require('zlib'); const http = require('http'); const fs = require('fs'); const request = http.get({ host: 'example.com', - path: '/', - port: 80, - headers: { 'Accept-Encoding': 'gzip,deflate' } }); + path: '/', + port: 80, + headers: { 'Accept-Encoding': 'gzip,deflate' } }); request.on('response', (response) => { - var output = fs.createWriteStream('example.com_index.html'); + const output = fs.createWriteStream('example.com_index.html'); switch (response.headers['content-encoding']) { // or, just use zlib.createUnzip() to handle both cases @@ -94,8 +94,8 @@ const zlib = require('zlib'); const http = require('http'); const fs = require('fs'); http.createServer((request, response) => { - var raw = fs.createReadStream('index.html'); - var acceptEncoding = request.headers['accept-encoding']; + const raw = fs.createReadStream('index.html'); + let acceptEncoding = request.headers['accept-encoding']; if (!acceptEncoding) { acceptEncoding = ''; } @@ -125,13 +125,16 @@ method that is used to compressed the last chunk of input data: // This is a truncated version of the buffer from the above examples const buffer = Buffer.from('eJzT0yMA', 'base64'); -zlib.unzip(buffer, { finishFlush: zlib.Z_SYNC_FLUSH }, (err, buffer) => { - if (!err) { - console.log(buffer.toString()); - } else { - // handle error - } -}); +zlib.unzip( + buffer, + { finishFlush: zlib.Z_SYNC_FLUSH }, + (err, buffer) => { + if (!err) { + console.log(buffer.toString()); + } else { + // handle error + } + }); ``` This will not change the behavior in other error-throwing situations, e.g. @@ -149,7 +152,7 @@ From `zlib/zconf.h`, modified to node.js's usage: The memory requirements for deflate are (in bytes): ```js -(1 << (windowBits+2)) + (1 << (memLevel+9)) +(1 << (windowBits + 2)) + (1 << (memLevel + 9)); ``` That is: 128K for windowBits=15 + 128K for memLevel = 8 @@ -167,7 +170,7 @@ This will, however, generally degrade compression. The memory requirements for inflate are (in bytes) ```js -1 << windowBits +1 << windowBits; ``` That is, 32K for windowBits=15 (default value) plus a few kilobytes diff --git a/doc/guides/timers-in-node.md b/doc/guides/timers-in-node.md index 818cc793437cad..4c66312c0076a5 100644 --- a/doc/guides/timers-in-node.md +++ b/doc/guides/timers-in-node.md @@ -35,7 +35,7 @@ arguments may also be included and these will be passed on to the function. Here is an example of that: ```js -function myFunc (arg) { +function myFunc(arg) { console.log('arg was => ' + arg); } @@ -111,7 +111,7 @@ that may hold on to the event loop, and therefore should be treated as an approximate delay. See the below example: ```js -function intervalFunc () { +function intervalFunc() { console.log('Cant stop me now!'); } @@ -134,15 +134,15 @@ that object will be halted completely. The respective functions are below for an example of each: ```js -let timeoutObj = setTimeout(() => { +const timeoutObj = setTimeout(() => { console.log('timeout beyond time'); }, 1500); -let immediateObj = setImmediate(() => { +const immediateObj = setImmediate(() => { console.log('immediately executing immediate'); }); -let intervalObj = setInterval(() => { +const intervalObj = setInterval(() => { console.log('interviewing the interval'); }, 500); @@ -168,9 +168,9 @@ not *exactly* restore the initial behavior for performance reasons. See below for examples of both: ```js -let timerObj = setTimeout(() => { +const timerObj = setTimeout(() => { console.log('will i run?'); -}); +}, 1); // if left alone, this statement will keep the above // timeout from running, since the timeout will be the only diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index 0f5ff304930e0a..fbb1d55309a44b 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -141,22 +141,22 @@ this with a real test from the test suite. ```javascript 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); +require('../common'); +const assert = require('assert'); +const http = require('http'); -var request = 0; -var response = 0; +let request = 0; +let response = 0; process.on('exit', function() { assert.equal(request, 1, 'http server "request" callback was not called'); assert.equal(response, 1, 'http request "response" callback was not called'); }); -var server = http.createServer(function(req, res) { +const server = http.createServer(function(req, res) { request++; res.end(); }).listen(0, function() { - var options = { + const options = { agent: null, port: this.address().port }; @@ -172,14 +172,13 @@ This test could be greatly simplified by using `common.mustCall` like this: ```javascript 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); +const common = require('../common'); +const http = require('http'); -var server = http.createServer(common.mustCall(function(req, res) { +const server = http.createServer(common.mustCall(function(req, res) { res.end(); })).listen(0, function() { - var options = { + const options = { agent: null, port: this.address().port }; diff --git a/doc/topics/domain-postmortem.md b/doc/topics/domain-postmortem.md index e03012db926b08..c1f8f7e6352c5c 100644 --- a/doc/topics/domain-postmortem.md +++ b/doc/topics/domain-postmortem.md @@ -127,11 +127,11 @@ d1.run(() => setTimeout(() => { setTimeout(() => { setTimeout(() => { throw new Error('outer'); - }); - throw new Error('inner') - }); + }, 1); + throw new Error('inner'); + }, 1); }); -})); +}, 1)); ``` Even in the case that the domain instances are being used for local storage so @@ -216,7 +216,7 @@ const server = net.createServer((c) => { // for demonstration purposes. const ds = new DataStream(dataTransformed); c.on('data', (chunk) => ds.data(chunk)); -}).listen(8080, () => console.log(`listening on 8080`)); +}).listen(8080, () => console.log('listening on 8080')); function dataTransformed(chunk) { // FAIL! Because the DataStream instance also created a @@ -241,12 +241,12 @@ DataStream.prototype.data = function data(chunk) { this.domain.run(function() { // Simulate an async operation that does the data transform. setImmediate(() => { - for (var i = 0; i < chunk.length; i++) + for (let i = 0; i < chunk.length; i++) chunk[i] = ((chunk[i] + Math.random() * 100) % 96) + 33; // Grab the instance from the active domain and use that // to call the user's callback. const self = domain.active.data.inst; - self.cb.call(self, chunk); + self.cb(chunk); }); }); }; diff --git a/doc/topics/event-loop-timers-and-nexttick.md b/doc/topics/event-loop-timers-and-nexttick.md index d7d0ee96e9c438..377b14c9babc36 100644 --- a/doc/topics/event-loop-timers-and-nexttick.md +++ b/doc/topics/event-loop-timers-and-nexttick.md @@ -101,32 +101,31 @@ threshold, then your script starts asynchronously reading a file which takes 95 ms: ```js +const fs = require('fs'); -var fs = require('fs'); - -function someAsyncOperation (callback) { +function someAsyncOperation(callback) { // Assume this takes 95ms to complete fs.readFile('/path/to/file', callback); } -var timeoutScheduled = Date.now(); +const timeoutScheduled = Date.now(); -setTimeout(function () { +setTimeout(function() { - var delay = Date.now() - timeoutScheduled; + const delay = Date.now() - timeoutScheduled; - console.log(delay + "ms have passed since I was scheduled"); + console.log(delay + 'ms have passed since I was scheduled'); }, 100); // do someAsyncOperation which takes 95 ms to complete -someAsyncOperation(function () { +someAsyncOperation(function() { - var startCallback = Date.now(); + const startCallback = Date.now(); // do something that will take 10ms... while (Date.now() - startCallback < 10) { - ; // do nothing + // do nothing } }); @@ -233,11 +232,11 @@ process: ```js // timeout_vs_immediate.js -setTimeout(function timeout () { +setTimeout(function timeout() { console.log('timeout'); -},0); +}, 0); -setImmediate(function immediate () { +setImmediate(function immediate() { console.log('immediate'); }); ``` @@ -257,16 +256,16 @@ callback is always executed first: ```js // timeout_vs_immediate.js -var fs = require('fs') +const fs = require('fs'); fs.readFile(__filename, () => { setTimeout(() => { - console.log('timeout') - }, 0) + console.log('timeout'); + }, 0); setImmediate(() => { - console.log('immediate') - }) -}) + console.log('immediate'); + }); +}); ``` ```console @@ -307,10 +306,10 @@ design philosophy where an API should always be asynchronous even where it doesn't have to be. Take this code snippet for example: ```js -function apiCall (arg, callback) { +function apiCall(arg, callback) { if (typeof arg !== 'string') return process.nextTick(callback, - new TypeError('argument should be string')); + new TypeError('argument should be string')); } ``` @@ -333,8 +332,10 @@ This philosophy can lead to some potentially problematic situations. Take this snippet for example: ```js +let bar; + // this has an asynchronous signature, but calls callback synchronously -function someAsyncApiCall (callback) { callback(); }; +function someAsyncApiCall(callback) { callback(); } // the callback is called before `someAsyncApiCall` completes. someAsyncApiCall(() => { @@ -344,7 +345,7 @@ someAsyncApiCall(() => { }); -var bar = 1; +bar = 1; ``` The user defines `someAsyncApiCall()` to have an asynchronous signature, @@ -363,15 +364,17 @@ useful for the user to be alerted to an error before the event loop is allowed to continue. Here is the previous example using `process.nextTick()`: ```js -function someAsyncApiCall (callback) { +let bar; + +function someAsyncApiCall(callback) { process.nextTick(callback); -}; +} someAsyncApiCall(() => { console.log('bar', bar); // 1 }); -var bar = 1; +bar = 1; ``` Here's another real world example: @@ -423,7 +426,7 @@ stack has unwound but before the event loop continues. One example is to match the user's expectations. Simple example: ```js -var server = net.createServer(); +const server = net.createServer(); server.on('connection', function(conn) { }); server.listen(8080); @@ -471,7 +474,7 @@ function MyEmitter() { EventEmitter.call(this); // use nextTick to emit the event once a handler is assigned - process.nextTick(function () { + process.nextTick(function() { this.emit('event'); }.bind(this)); } diff --git a/tools/icu/README.md b/tools/icu/README.md index ed540c672599ed..7f689305c07ad1 100644 --- a/tools/icu/README.md +++ b/tools/icu/README.md @@ -25,8 +25,10 @@ make test-ci ``` Also running + + ```js - new Intl.DateTimeFormat('es',{month:'long'}).format(new Date(9E8)); +new Intl.DateTimeFormat('es', { month: 'long' }).format(new Date(9E8)); ``` …Should return `January` not `enero`. @@ -49,9 +51,11 @@ make ``` - Test this newly default-generated Node.js + + ```js process.versions.icu; -new Intl.DateTimeFormat('es',{month:'long'}).format(new Date(9E8)); +new Intl.DateTimeFormat('es', { month: 'long' }).format(new Date(9E8)); ``` (should return your updated ICU version number, and also `January` again.) From 8fef98577cbe6b221718688072d445d8e6a1ce23 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 4 Jul 2017 03:12:43 +0300 Subject: [PATCH 04/17] build, doc, tools: add eslint-plugin-markdown * Install eslint-plugin-markdown@1.0.0-beta.7 * Add doc/.eslintrc.yaml * Add `plugins: [markdown]` to the main .eslintrc.yaml * .js files in doc folder added to .eslintignore * Update Makefile, vcbuild.bat, and tools/jslint.js Refs: https://github.com/nodejs/node/pull/12563 Refs: https://github.com/nodejs/node/pull/12640 Refs: https://github.com/nodejs/node/pull/14047 PR-URL: https://github.com/nodejs/node/pull/14067 Reviewed-By: James Snell Reviewed-By: Myles Borins --- .eslintignore | 1 + .eslintrc.yaml | 3 + Makefile | 6 +- doc/.eslintrc.yaml | 12 + tools/eslint/node_modules/bail/LICENSE | 22 + tools/eslint/node_modules/bail/history.md | 12 + tools/eslint/node_modules/bail/index.js | 34 + tools/eslint/node_modules/bail/package.json | 103 + tools/eslint/node_modules/bail/readme.md | 73 + .../character-entities-legacy/LICENSE | 22 + .../character-entities-legacy/index.json | 108 + .../character-entities-legacy/package.json | 97 + .../character-entities-legacy/readme.md | 54 + .../node_modules/character-entities/LICENSE | 22 + .../character-entities/index.json | 2224 +++++++++++++++++ .../character-entities/package.json | 97 + .../node_modules/character-entities/readme.md | 53 + .../character-reference-invalid/LICENSE | 22 + .../character-reference-invalid/index.json | 30 + .../character-reference-invalid/package.json | 101 + .../character-reference-invalid/readme.md | 51 + .../node_modules/collapse-white-space/LICENSE | 22 + .../collapse-white-space/index.js | 8 + .../collapse-white-space/package.json | 94 + .../collapse-white-space/readme.md | 45 + .../eslint-plugin-markdown/LICENSE | 21 + .../eslint-plugin-markdown/README.md | 140 ++ .../eslint-plugin-markdown/index.js | 8 + .../eslint-plugin-markdown/lib/index.js | 17 + .../eslint-plugin-markdown/lib/processor.js | 164 ++ .../eslint-plugin-markdown/package.json | 80 + tools/eslint/node_modules/extend/LICENSE | 22 + tools/eslint/node_modules/extend/README.md | 80 + tools/eslint/node_modules/extend/index.js | 86 + tools/eslint/node_modules/extend/package.json | 75 + .../eslint/node_modules/function-bind/LICENSE | 19 + .../node_modules/function-bind/README.md | 48 + .../function-bind/implementation.js | 48 + .../node_modules/function-bind/index.js | 3 + .../node_modules/function-bind/package.json | 98 + tools/eslint/node_modules/has/LICENSE-MIT | 22 + tools/eslint/node_modules/has/README.mkd | 18 + tools/eslint/node_modules/has/package.json | 62 + tools/eslint/node_modules/has/src/index.js | 3 + .../node_modules/is-alphabetical/LICENSE | 22 + .../node_modules/is-alphabetical/history.md | 6 + .../node_modules/is-alphabetical/index.js | 29 + .../node_modules/is-alphabetical/package.json | 110 + .../node_modules/is-alphabetical/readme.md | 58 + .../node_modules/is-alphanumerical/LICENSE | 22 + .../node_modules/is-alphanumerical/history.md | 6 + .../node_modules/is-alphanumerical/index.js | 29 + .../is-alphanumerical/package.json | 114 + .../node_modules/is-alphanumerical/readme.md | 60 + tools/eslint/node_modules/is-buffer/LICENSE | 21 + tools/eslint/node_modules/is-buffer/README.md | 49 + tools/eslint/node_modules/is-buffer/index.js | 21 + .../node_modules/is-buffer/package.json | 77 + tools/eslint/node_modules/is-decimal/LICENSE | 22 + .../eslint/node_modules/is-decimal/history.md | 6 + tools/eslint/node_modules/is-decimal/index.js | 28 + .../node_modules/is-decimal/package.json | 111 + .../eslint/node_modules/is-decimal/readme.md | 58 + .../node_modules/is-hexadecimal/LICENSE | 22 + .../node_modules/is-hexadecimal/history.md | 6 + .../node_modules/is-hexadecimal/index.js | 30 + .../node_modules/is-hexadecimal/package.json | 109 + .../node_modules/is-hexadecimal/readme.md | 58 + .../eslint/node_modules/is-plain-obj/index.js | 7 + .../eslint/node_modules/is-plain-obj/license | 21 + .../node_modules/is-plain-obj/package.json | 68 + .../node_modules/is-plain-obj/readme.md | 35 + .../is-whitespace-character/LICENSE | 22 + .../is-whitespace-character/history.md | 6 + .../is-whitespace-character/index.js | 33 + .../is-whitespace-character/package.json | 111 + .../is-whitespace-character/readme.md | 63 + .../node_modules/is-word-character/LICENSE | 22 + .../node_modules/is-word-character/history.md | 6 + .../node_modules/is-word-character/index.js | 33 + .../is-word-character/package.json | 109 + .../node_modules/is-word-character/readme.md | 62 + .../node_modules/markdown-escapes/LICENSE | 22 + .../node_modules/markdown-escapes/history.md | 6 + .../node_modules/markdown-escapes/index.js | 75 + .../markdown-escapes/package.json | 109 + .../node_modules/markdown-escapes/readme.md | 71 + .../node_modules/parse-entities/LICENSE | 22 + .../node_modules/parse-entities/index.js | 473 ++++ .../node_modules/parse-entities/package.json | 113 + .../node_modules/parse-entities/readme.md | 157 ++ .../eslint/node_modules/remark-parse/index.js | 14 + .../remark-parse/lib/block-elements.json | 68 + .../node_modules/remark-parse/lib/decode.js | 71 + .../node_modules/remark-parse/lib/defaults.js | 21 + .../remark-parse/lib/locate/break.js | 25 + .../remark-parse/lib/locate/code-inline.js | 15 + .../remark-parse/lib/locate/delete.js | 15 + .../remark-parse/lib/locate/emphasis.js | 26 + .../remark-parse/lib/locate/escape.js | 15 + .../remark-parse/lib/locate/link.js | 24 + .../remark-parse/lib/locate/strong.js | 26 + .../remark-parse/lib/locate/tag.js | 15 + .../remark-parse/lib/locate/url.js | 34 + .../node_modules/remark-parse/lib/parse.js | 53 + .../node_modules/remark-parse/lib/parser.js | 162 ++ .../remark-parse/lib/set-options.js | 59 + .../remark-parse/lib/tokenize/auto-link.js | 151 ++ .../remark-parse/lib/tokenize/blockquote.js | 137 + .../remark-parse/lib/tokenize/break.js | 51 + .../remark-parse/lib/tokenize/code-fenced.js | 245 ++ .../lib/tokenize/code-indented.js | 106 + .../remark-parse/lib/tokenize/code-inline.js | 120 + .../remark-parse/lib/tokenize/definition.js | 287 +++ .../remark-parse/lib/tokenize/delete.js | 69 + .../remark-parse/lib/tokenize/emphasis.js | 94 + .../remark-parse/lib/tokenize/escape.js | 43 + .../lib/tokenize/footnote-definition.js | 194 ++ .../remark-parse/lib/tokenize/heading-atx.js | 150 ++ .../lib/tokenize/heading-setext.js | 116 + .../remark-parse/lib/tokenize/html-block.js | 103 + .../remark-parse/lib/tokenize/html-inline.js | 63 + .../remark-parse/lib/tokenize/link.js | 399 +++ .../remark-parse/lib/tokenize/list.js | 494 ++++ .../remark-parse/lib/tokenize/newline.js | 55 + .../remark-parse/lib/tokenize/paragraph.js | 130 + .../remark-parse/lib/tokenize/reference.js | 219 ++ .../remark-parse/lib/tokenize/strong.js | 93 + .../remark-parse/lib/tokenize/table.js | 276 ++ .../remark-parse/lib/tokenize/text.js | 67 + .../lib/tokenize/thematic-break.js | 79 + .../remark-parse/lib/tokenize/url.js | 153 ++ .../remark-parse/lib/tokenize/yaml.js | 74 + .../remark-parse/lib/tokenizer.js | 451 ++++ .../node_modules/remark-parse/lib/unescape.js | 46 + .../remark-parse/lib/util/get-indentation.js | 46 + .../remark-parse/lib/util/html.js | 33 + .../remark-parse/lib/util/interrupt.js | 51 + .../remark-parse/lib/util/normalize.js | 29 + .../lib/util/remove-indentation.js | 102 + .../node_modules/remark-parse/package.json | 86 + .../node_modules/remark-parse/readme.md | 448 ++++ .../eslint/node_modules/repeat-string/LICENSE | 21 + .../node_modules/repeat-string/README.md | 136 + .../node_modules/repeat-string/index.js | 70 + .../node_modules/repeat-string/package.json | 128 + tools/eslint/node_modules/replace-ext/LICENSE | 21 + .../eslint/node_modules/replace-ext/README.md | 50 + .../eslint/node_modules/replace-ext/index.js | 18 + .../node_modules/replace-ext/package.json | 86 + .../eslint/node_modules/state-toggle/LICENSE | 22 + .../node_modules/state-toggle/history.md | 6 + .../eslint/node_modules/state-toggle/index.js | 45 + .../node_modules/state-toggle/package.json | 107 + .../node_modules/state-toggle/readme.md | 83 + .../node_modules/trim-trailing-lines/LICENSE | 22 + .../node_modules/trim-trailing-lines/index.js | 15 + .../trim-trailing-lines/package.json | 96 + .../trim-trailing-lines/readme.md | 55 + tools/eslint/node_modules/trim/Makefile | 7 + tools/eslint/node_modules/trim/Readme.md | 69 + tools/eslint/node_modules/trim/index.js | 14 + tools/eslint/node_modules/trim/package.json | 49 + tools/eslint/node_modules/trough/LICENSE | 21 + tools/eslint/node_modules/trough/history.md | 6 + tools/eslint/node_modules/trough/index.js | 176 ++ tools/eslint/node_modules/trough/package.json | 122 + tools/eslint/node_modules/trough/readme.md | 281 +++ tools/eslint/node_modules/unherit/LICENSE | 21 + tools/eslint/node_modules/unherit/index.js | 67 + .../eslint/node_modules/unherit/package.json | 109 + tools/eslint/node_modules/unherit/readme.md | 66 + tools/eslint/node_modules/unified/LICENSE | 21 + tools/eslint/node_modules/unified/index.js | 460 ++++ .../eslint/node_modules/unified/package.json | 117 + tools/eslint/node_modules/unified/readme.md | 919 +++++++ .../unist-util-remove-position/LICENSE | 22 + .../unist-util-remove-position/index.js | 19 + .../unist-util-remove-position/package.json | 103 + .../unist-util-remove-position/readme.md | 77 + .../unist-util-stringify-position/LICENSE | 22 + .../unist-util-stringify-position/index.js | 50 + .../package.json | 102 + .../unist-util-stringify-position/readme.md | 85 + .../node_modules/unist-util-visit/LICENSE | 22 + .../node_modules/unist-util-visit/index.js | 53 + .../unist-util-visit/package.json | 105 + .../node_modules/unist-util-visit/readme.md | 117 + .../node_modules/vfile-location/LICENSE | 22 + .../node_modules/vfile-location/index.js | 123 + .../node_modules/vfile-location/package.json | 109 + .../node_modules/vfile-location/readme.md | 83 + tools/eslint/node_modules/vfile/LICENSE | 21 + tools/eslint/node_modules/vfile/index.js | 261 ++ tools/eslint/node_modules/vfile/package.json | 126 + tools/eslint/node_modules/vfile/readme.md | 290 +++ .../eslint/node_modules/x-is-function/LICENSE | 21 + .../node_modules/x-is-function/README.md | 41 + .../node_modules/x-is-function/index.js | 3 + .../node_modules/x-is-function/package.json | 46 + tools/eslint/node_modules/x-is-string/LICENCE | 19 + .../eslint/node_modules/x-is-string/README.md | 46 + .../eslint/node_modules/x-is-string/index.js | 7 + .../node_modules/x-is-string/package.json | 86 + tools/eslint/package-lock.json | 736 ++++++ tools/eslint/package.json | 1 + tools/jslint.js | 4 +- vcbuild.bat | 4 +- 208 files changed, 19279 insertions(+), 6 deletions(-) create mode 100644 doc/.eslintrc.yaml create mode 100644 tools/eslint/node_modules/bail/LICENSE create mode 100644 tools/eslint/node_modules/bail/history.md create mode 100644 tools/eslint/node_modules/bail/index.js create mode 100644 tools/eslint/node_modules/bail/package.json create mode 100644 tools/eslint/node_modules/bail/readme.md create mode 100644 tools/eslint/node_modules/character-entities-legacy/LICENSE create mode 100644 tools/eslint/node_modules/character-entities-legacy/index.json create mode 100644 tools/eslint/node_modules/character-entities-legacy/package.json create mode 100644 tools/eslint/node_modules/character-entities-legacy/readme.md create mode 100644 tools/eslint/node_modules/character-entities/LICENSE create mode 100644 tools/eslint/node_modules/character-entities/index.json create mode 100644 tools/eslint/node_modules/character-entities/package.json create mode 100644 tools/eslint/node_modules/character-entities/readme.md create mode 100644 tools/eslint/node_modules/character-reference-invalid/LICENSE create mode 100644 tools/eslint/node_modules/character-reference-invalid/index.json create mode 100644 tools/eslint/node_modules/character-reference-invalid/package.json create mode 100644 tools/eslint/node_modules/character-reference-invalid/readme.md create mode 100644 tools/eslint/node_modules/collapse-white-space/LICENSE create mode 100644 tools/eslint/node_modules/collapse-white-space/index.js create mode 100644 tools/eslint/node_modules/collapse-white-space/package.json create mode 100644 tools/eslint/node_modules/collapse-white-space/readme.md create mode 100644 tools/eslint/node_modules/eslint-plugin-markdown/LICENSE create mode 100644 tools/eslint/node_modules/eslint-plugin-markdown/README.md create mode 100644 tools/eslint/node_modules/eslint-plugin-markdown/index.js create mode 100644 tools/eslint/node_modules/eslint-plugin-markdown/lib/index.js create mode 100644 tools/eslint/node_modules/eslint-plugin-markdown/lib/processor.js create mode 100644 tools/eslint/node_modules/eslint-plugin-markdown/package.json create mode 100644 tools/eslint/node_modules/extend/LICENSE create mode 100644 tools/eslint/node_modules/extend/README.md create mode 100644 tools/eslint/node_modules/extend/index.js create mode 100644 tools/eslint/node_modules/extend/package.json create mode 100644 tools/eslint/node_modules/function-bind/LICENSE create mode 100644 tools/eslint/node_modules/function-bind/README.md create mode 100644 tools/eslint/node_modules/function-bind/implementation.js create mode 100644 tools/eslint/node_modules/function-bind/index.js create mode 100644 tools/eslint/node_modules/function-bind/package.json create mode 100644 tools/eslint/node_modules/has/LICENSE-MIT create mode 100644 tools/eslint/node_modules/has/README.mkd create mode 100644 tools/eslint/node_modules/has/package.json create mode 100644 tools/eslint/node_modules/has/src/index.js create mode 100644 tools/eslint/node_modules/is-alphabetical/LICENSE create mode 100644 tools/eslint/node_modules/is-alphabetical/history.md create mode 100644 tools/eslint/node_modules/is-alphabetical/index.js create mode 100644 tools/eslint/node_modules/is-alphabetical/package.json create mode 100644 tools/eslint/node_modules/is-alphabetical/readme.md create mode 100644 tools/eslint/node_modules/is-alphanumerical/LICENSE create mode 100644 tools/eslint/node_modules/is-alphanumerical/history.md create mode 100644 tools/eslint/node_modules/is-alphanumerical/index.js create mode 100644 tools/eslint/node_modules/is-alphanumerical/package.json create mode 100644 tools/eslint/node_modules/is-alphanumerical/readme.md create mode 100644 tools/eslint/node_modules/is-buffer/LICENSE create mode 100644 tools/eslint/node_modules/is-buffer/README.md create mode 100644 tools/eslint/node_modules/is-buffer/index.js create mode 100644 tools/eslint/node_modules/is-buffer/package.json create mode 100644 tools/eslint/node_modules/is-decimal/LICENSE create mode 100644 tools/eslint/node_modules/is-decimal/history.md create mode 100644 tools/eslint/node_modules/is-decimal/index.js create mode 100644 tools/eslint/node_modules/is-decimal/package.json create mode 100644 tools/eslint/node_modules/is-decimal/readme.md create mode 100644 tools/eslint/node_modules/is-hexadecimal/LICENSE create mode 100644 tools/eslint/node_modules/is-hexadecimal/history.md create mode 100644 tools/eslint/node_modules/is-hexadecimal/index.js create mode 100644 tools/eslint/node_modules/is-hexadecimal/package.json create mode 100644 tools/eslint/node_modules/is-hexadecimal/readme.md create mode 100644 tools/eslint/node_modules/is-plain-obj/index.js create mode 100644 tools/eslint/node_modules/is-plain-obj/license create mode 100644 tools/eslint/node_modules/is-plain-obj/package.json create mode 100644 tools/eslint/node_modules/is-plain-obj/readme.md create mode 100644 tools/eslint/node_modules/is-whitespace-character/LICENSE create mode 100644 tools/eslint/node_modules/is-whitespace-character/history.md create mode 100644 tools/eslint/node_modules/is-whitespace-character/index.js create mode 100644 tools/eslint/node_modules/is-whitespace-character/package.json create mode 100644 tools/eslint/node_modules/is-whitespace-character/readme.md create mode 100644 tools/eslint/node_modules/is-word-character/LICENSE create mode 100644 tools/eslint/node_modules/is-word-character/history.md create mode 100644 tools/eslint/node_modules/is-word-character/index.js create mode 100644 tools/eslint/node_modules/is-word-character/package.json create mode 100644 tools/eslint/node_modules/is-word-character/readme.md create mode 100644 tools/eslint/node_modules/markdown-escapes/LICENSE create mode 100644 tools/eslint/node_modules/markdown-escapes/history.md create mode 100644 tools/eslint/node_modules/markdown-escapes/index.js create mode 100644 tools/eslint/node_modules/markdown-escapes/package.json create mode 100644 tools/eslint/node_modules/markdown-escapes/readme.md create mode 100644 tools/eslint/node_modules/parse-entities/LICENSE create mode 100644 tools/eslint/node_modules/parse-entities/index.js create mode 100644 tools/eslint/node_modules/parse-entities/package.json create mode 100644 tools/eslint/node_modules/parse-entities/readme.md create mode 100644 tools/eslint/node_modules/remark-parse/index.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/block-elements.json create mode 100644 tools/eslint/node_modules/remark-parse/lib/decode.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/defaults.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/break.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/code-inline.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/delete.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/emphasis.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/escape.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/link.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/strong.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/tag.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/locate/url.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/parse.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/parser.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/set-options.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/break.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/definition.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/delete.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/escape.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/html-block.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/link.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/list.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/newline.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/reference.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/strong.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/table.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/text.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/url.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenize/yaml.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/tokenizer.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/unescape.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/util/get-indentation.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/util/html.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/util/interrupt.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/util/normalize.js create mode 100644 tools/eslint/node_modules/remark-parse/lib/util/remove-indentation.js create mode 100644 tools/eslint/node_modules/remark-parse/package.json create mode 100644 tools/eslint/node_modules/remark-parse/readme.md create mode 100644 tools/eslint/node_modules/repeat-string/LICENSE create mode 100644 tools/eslint/node_modules/repeat-string/README.md create mode 100644 tools/eslint/node_modules/repeat-string/index.js create mode 100644 tools/eslint/node_modules/repeat-string/package.json create mode 100644 tools/eslint/node_modules/replace-ext/LICENSE create mode 100644 tools/eslint/node_modules/replace-ext/README.md create mode 100644 tools/eslint/node_modules/replace-ext/index.js create mode 100644 tools/eslint/node_modules/replace-ext/package.json create mode 100644 tools/eslint/node_modules/state-toggle/LICENSE create mode 100644 tools/eslint/node_modules/state-toggle/history.md create mode 100644 tools/eslint/node_modules/state-toggle/index.js create mode 100644 tools/eslint/node_modules/state-toggle/package.json create mode 100644 tools/eslint/node_modules/state-toggle/readme.md create mode 100644 tools/eslint/node_modules/trim-trailing-lines/LICENSE create mode 100644 tools/eslint/node_modules/trim-trailing-lines/index.js create mode 100644 tools/eslint/node_modules/trim-trailing-lines/package.json create mode 100644 tools/eslint/node_modules/trim-trailing-lines/readme.md create mode 100644 tools/eslint/node_modules/trim/Makefile create mode 100644 tools/eslint/node_modules/trim/Readme.md create mode 100644 tools/eslint/node_modules/trim/index.js create mode 100644 tools/eslint/node_modules/trim/package.json create mode 100644 tools/eslint/node_modules/trough/LICENSE create mode 100644 tools/eslint/node_modules/trough/history.md create mode 100644 tools/eslint/node_modules/trough/index.js create mode 100644 tools/eslint/node_modules/trough/package.json create mode 100644 tools/eslint/node_modules/trough/readme.md create mode 100644 tools/eslint/node_modules/unherit/LICENSE create mode 100644 tools/eslint/node_modules/unherit/index.js create mode 100644 tools/eslint/node_modules/unherit/package.json create mode 100644 tools/eslint/node_modules/unherit/readme.md create mode 100644 tools/eslint/node_modules/unified/LICENSE create mode 100644 tools/eslint/node_modules/unified/index.js create mode 100644 tools/eslint/node_modules/unified/package.json create mode 100644 tools/eslint/node_modules/unified/readme.md create mode 100644 tools/eslint/node_modules/unist-util-remove-position/LICENSE create mode 100644 tools/eslint/node_modules/unist-util-remove-position/index.js create mode 100644 tools/eslint/node_modules/unist-util-remove-position/package.json create mode 100644 tools/eslint/node_modules/unist-util-remove-position/readme.md create mode 100644 tools/eslint/node_modules/unist-util-stringify-position/LICENSE create mode 100644 tools/eslint/node_modules/unist-util-stringify-position/index.js create mode 100644 tools/eslint/node_modules/unist-util-stringify-position/package.json create mode 100644 tools/eslint/node_modules/unist-util-stringify-position/readme.md create mode 100644 tools/eslint/node_modules/unist-util-visit/LICENSE create mode 100644 tools/eslint/node_modules/unist-util-visit/index.js create mode 100644 tools/eslint/node_modules/unist-util-visit/package.json create mode 100644 tools/eslint/node_modules/unist-util-visit/readme.md create mode 100644 tools/eslint/node_modules/vfile-location/LICENSE create mode 100644 tools/eslint/node_modules/vfile-location/index.js create mode 100644 tools/eslint/node_modules/vfile-location/package.json create mode 100644 tools/eslint/node_modules/vfile-location/readme.md create mode 100644 tools/eslint/node_modules/vfile/LICENSE create mode 100644 tools/eslint/node_modules/vfile/index.js create mode 100644 tools/eslint/node_modules/vfile/package.json create mode 100644 tools/eslint/node_modules/vfile/readme.md create mode 100644 tools/eslint/node_modules/x-is-function/LICENSE create mode 100644 tools/eslint/node_modules/x-is-function/README.md create mode 100644 tools/eslint/node_modules/x-is-function/index.js create mode 100644 tools/eslint/node_modules/x-is-function/package.json create mode 100644 tools/eslint/node_modules/x-is-string/LICENCE create mode 100644 tools/eslint/node_modules/x-is-string/README.md create mode 100644 tools/eslint/node_modules/x-is-string/index.js create mode 100644 tools/eslint/node_modules/x-is-string/package.json create mode 100644 tools/eslint/package-lock.json diff --git a/.eslintignore b/.eslintignore index 1ccb8f831baa0b..bd85fff8e424aa 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,3 +7,4 @@ test/tmp*/ tools/eslint node_modules benchmark/tmp/ +doc/**/*.js diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 97b67ff89bd49b..f7c61cac14739e 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -1,5 +1,8 @@ root: true +plugins: + - markdown + env: node: true es6: true diff --git a/Makefile b/Makefile index 52bd44fa2e9227..cfbd426033c7f2 100644 --- a/Makefile +++ b/Makefile @@ -751,13 +751,13 @@ bench-idle: jslint: @echo "Running JS linter..." - $(NODE) tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules \ - benchmark lib test tools + $(NODE) tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules --ext=.js,.md \ + benchmark doc lib test tools jslint-ci: @echo "Running JS linter..." $(NODE) tools/jslint.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \ - benchmark lib test tools + benchmark doc lib test tools CPPLINT_EXCLUDE ?= CPPLINT_EXCLUDE += src/node_root_certs.h diff --git a/doc/.eslintrc.yaml b/doc/.eslintrc.yaml new file mode 100644 index 00000000000000..b4fbf847be7aaf --- /dev/null +++ b/doc/.eslintrc.yaml @@ -0,0 +1,12 @@ +## Docs-specific linter rules + +rules: + # ease some restrictions in doc examples + no-restricted-properties: 0 + no-undef: 0 + no-unused-vars: 0 + strict: 0 + + # add new ECMAScript features gradually + no-var: 2 + prefer-const: 2 diff --git a/tools/eslint/node_modules/bail/LICENSE b/tools/eslint/node_modules/bail/LICENSE new file mode 100644 index 00000000000000..32e7a3d93ca5a2 --- /dev/null +++ b/tools/eslint/node_modules/bail/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/bail/history.md b/tools/eslint/node_modules/bail/history.md new file mode 100644 index 00000000000000..4f794e30a916a5 --- /dev/null +++ b/tools/eslint/node_modules/bail/history.md @@ -0,0 +1,12 @@ + + + + +1.0.1 / 2016-07-23 +================== + +* Rewrite module ([`75e6d41`](https://github.com/wooorm/bail/commit/75e6d41)) +* Update dev-dependencies ([`9ec98f9`](https://github.com/wooorm/bail/commit/9ec98f9)) + +1.0.0 / 2015-07-28 +================== diff --git a/tools/eslint/node_modules/bail/index.js b/tools/eslint/node_modules/bail/index.js new file mode 100644 index 00000000000000..7772d5634feccf --- /dev/null +++ b/tools/eslint/node_modules/bail/index.js @@ -0,0 +1,34 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module bail + * @fileoverview Throw a given error. + */ + +'use strict'; + +/* Expose. */ +module.exports = bail; + +/** + * Throw a given error. + * + * @example + * bail(); + * + * @example + * bail(new Error('failure')); + * // Error: failure + * // at repl:1:6 + * // at REPLServer.defaultEval (repl.js:154:27) + * // ... + * + * @param {Error?} [err] - Optional error. + * @throws {Error} - `err`, when given. + */ +function bail(err) { + if (err) { + throw err; + } +} diff --git a/tools/eslint/node_modules/bail/package.json b/tools/eslint/node_modules/bail/package.json new file mode 100644 index 00000000000000..f3c3bd04e7bf3c --- /dev/null +++ b/tools/eslint/node_modules/bail/package.json @@ -0,0 +1,103 @@ +{ + "_from": "bail@^1.0.0", + "_id": "bail@1.0.1", + "_inBundle": false, + "_integrity": "sha1-kSV53os5Gq3zxf30zSoPwiXfO8I=", + "_location": "/bail", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "bail@^1.0.0", + "name": "bail", + "escapedName": "bail", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/unified" + ], + "_resolved": "https://registry.npmjs.org/bail/-/bail-1.0.1.tgz", + "_shasum": "912579de8b391aadf3c5fdf4cd2a0fc225df3bc2", + "_spec": "bail@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/bail/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Throw a given error", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/bail#readme", + "keywords": [ + "fail", + "bail", + "throw", + "callback", + "error" + ], + "license": "MIT", + "name": "bail", + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/bail.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s bail > bail.js", + "build-mangle": "esmangle bail.js > bail.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.1", + "xo": { + "space": true, + "ignores": [ + "bail.js", + "bail.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/bail/readme.md b/tools/eslint/node_modules/bail/readme.md new file mode 100644 index 00000000000000..b35158cd735f64 --- /dev/null +++ b/tools/eslint/node_modules/bail/readme.md @@ -0,0 +1,73 @@ +# bail [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +:warning: Throw a given error. + +## Installation + +[npm][npm-install]: + +```bash +npm install bail +``` + +## Usage + +```js +var bail = require('bail'); + +bail(); + +bail(new Error('failure')); +// Error: failure +// at repl:1:6 +// at REPLServer.defaultEval (repl.js:154:27) +// ... +``` + +## API + +### `bail([err])` + +Throw a given error. + +###### Parameters + +* `err` (`Error?`) — Optional error. + +###### Throws + +* `Error` — Given error, if any. + +## Related + +* [`noop`][noop]; +* [`noop2`][noop2]; +* [`noop3`][noop3]; + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/bail.svg + +[travis]: https://travis-ci.org/wooorm/bail + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/bail.svg + +[codecov]: https://codecov.io/github/wooorm/bail + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[noop]: https://www.npmjs.com/package/noop + +[noop2]: https://www.npmjs.com/package/noop2 + +[noop3]: https://www.npmjs.com/package/noop3 diff --git a/tools/eslint/node_modules/character-entities-legacy/LICENSE b/tools/eslint/node_modules/character-entities-legacy/LICENSE new file mode 100644 index 00000000000000..32e7a3d93ca5a2 --- /dev/null +++ b/tools/eslint/node_modules/character-entities-legacy/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/character-entities-legacy/index.json b/tools/eslint/node_modules/character-entities-legacy/index.json new file mode 100644 index 00000000000000..d83b75251b7928 --- /dev/null +++ b/tools/eslint/node_modules/character-entities-legacy/index.json @@ -0,0 +1,108 @@ +{ + "AElig": "Æ", + "AMP": "&", + "Aacute": "Á", + "Acirc": "Â", + "Agrave": "À", + "Aring": "Å", + "Atilde": "Ã", + "Auml": "Ä", + "COPY": "©", + "Ccedil": "Ç", + "ETH": "Ð", + "Eacute": "É", + "Ecirc": "Ê", + "Egrave": "È", + "Euml": "Ë", + "GT": ">", + "Iacute": "Í", + "Icirc": "Î", + "Igrave": "Ì", + "Iuml": "Ï", + "LT": "<", + "Ntilde": "Ñ", + "Oacute": "Ó", + "Ocirc": "Ô", + "Ograve": "Ò", + "Oslash": "Ø", + "Otilde": "Õ", + "Ouml": "Ö", + "QUOT": "\"", + "REG": "®", + "THORN": "Þ", + "Uacute": "Ú", + "Ucirc": "Û", + "Ugrave": "Ù", + "Uuml": "Ü", + "Yacute": "Ý", + "aacute": "á", + "acirc": "â", + "acute": "´", + "aelig": "æ", + "agrave": "à", + "amp": "&", + "aring": "å", + "atilde": "ã", + "auml": "ä", + "brvbar": "¦", + "ccedil": "ç", + "cedil": "¸", + "cent": "¢", + "copy": "©", + "curren": "¤", + "deg": "°", + "divide": "÷", + "eacute": "é", + "ecirc": "ê", + "egrave": "è", + "eth": "ð", + "euml": "ë", + "frac12": "½", + "frac14": "¼", + "frac34": "¾", + "gt": ">", + "iacute": "í", + "icirc": "î", + "iexcl": "¡", + "igrave": "ì", + "iquest": "¿", + "iuml": "ï", + "laquo": "«", + "lt": "<", + "macr": "¯", + "micro": "µ", + "middot": "·", + "nbsp": " ", + "not": "¬", + "ntilde": "ñ", + "oacute": "ó", + "ocirc": "ô", + "ograve": "ò", + "ordf": "ª", + "ordm": "º", + "oslash": "ø", + "otilde": "õ", + "ouml": "ö", + "para": "¶", + "plusmn": "±", + "pound": "£", + "quot": "\"", + "raquo": "»", + "reg": "®", + "sect": "§", + "shy": "­", + "sup1": "¹", + "sup2": "²", + "sup3": "³", + "szlig": "ß", + "thorn": "þ", + "times": "×", + "uacute": "ú", + "ucirc": "û", + "ugrave": "ù", + "uml": "¨", + "uuml": "ü", + "yacute": "ý", + "yen": "¥", + "yuml": "ÿ" +} diff --git a/tools/eslint/node_modules/character-entities-legacy/package.json b/tools/eslint/node_modules/character-entities-legacy/package.json new file mode 100644 index 00000000000000..8e38910c843437 --- /dev/null +++ b/tools/eslint/node_modules/character-entities-legacy/package.json @@ -0,0 +1,97 @@ +{ + "_from": "character-entities-legacy@^1.0.0", + "_id": "character-entities-legacy@1.1.0", + "_inBundle": false, + "_integrity": "sha1-sYqtmPa3vMZGweTIH58ZVjdqVho=", + "_location": "/character-entities-legacy", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "character-entities-legacy@^1.0.0", + "name": "character-entities-legacy", + "escapedName": "character-entities-legacy", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/parse-entities" + ], + "_resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.0.tgz", + "_shasum": "b18aad98f6b7bcc646c1e4c81f9f1956376a561a", + "_spec": "character-entities-legacy@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/character-entities-legacy/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "HTML legacy character entity information", + "devDependencies": { + "bail": "^1.0.1", + "browserify": "^13.0.1", + "concat-stream": "^1.5.2", + "esmangle": "^1.0.1", + "nyc": "^8.0.0", + "remark-cli": "^2.0.0", + "remark-preset-wooorm": "^1.0.0", + "tape": "^4.0.0", + "xo": "^0.17.0" + }, + "files": [ + "index.json" + ], + "homepage": "https://github.com/wooorm/character-entities-legacy#readme", + "keywords": [ + "html", + "entity", + "entities", + "character", + "reference", + "name", + "replacement" + ], + "license": "MIT", + "main": "index.json", + "name": "character-entities-legacy", + "remarkConfig": { + "output": true, + "presets": "wooorm" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/character-entities-legacy.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-generate && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.json --bare -s characterEntitiesLegacy > character-entities-legacy.js", + "build-generate": "node build", + "build-mangle": "esmangle character-entities-legacy.js > character-entities-legacy.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.0", + "xo": { + "space": true, + "ignores": [ + "character-entities-legacy.js" + ] + } +} diff --git a/tools/eslint/node_modules/character-entities-legacy/readme.md b/tools/eslint/node_modules/character-entities-legacy/readme.md new file mode 100644 index 00000000000000..7f6a876820f98a --- /dev/null +++ b/tools/eslint/node_modules/character-entities-legacy/readme.md @@ -0,0 +1,54 @@ +# character-entities-legacy [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +HTML legacy character entity information: for legacy reasons some +character entities are not required to have a trailing semicolon: +`©` is perfectly okay for `©`. + +## Installation + +[npm][npm-install]: + +```bash +npm install character-entities-legacy +``` + +## Usage + +```js +console.log(characterEntitiesLegacy.copy); // © +console.log(characterEntitiesLegacy.frac34); // ¾ +console.log(characterEntitiesLegacy.sup1); // ¹ +``` + +## API + +### `characterEntitiesLegacy` + +Mapping between (case-sensitive) legacy character entity names to +replacements. + +## Support + +See [whatwg/html][html]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/character-entities-legacy.svg + +[travis]: https://travis-ci.org/wooorm/character-entities-legacy + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities-legacy.svg + +[codecov]: https://codecov.io/github/wooorm/character-entities-legacy + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[html]: https://raw.githubusercontent.com/whatwg/html/master/json-entities-legacy.inc diff --git a/tools/eslint/node_modules/character-entities/LICENSE b/tools/eslint/node_modules/character-entities/LICENSE new file mode 100644 index 00000000000000..32e7a3d93ca5a2 --- /dev/null +++ b/tools/eslint/node_modules/character-entities/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/character-entities/index.json b/tools/eslint/node_modules/character-entities/index.json new file mode 100644 index 00000000000000..a63babe093521d --- /dev/null +++ b/tools/eslint/node_modules/character-entities/index.json @@ -0,0 +1,2224 @@ +{ + "AEli": "Æ", + "AElig": "Æ", + "AM": "&", + "AMP": "&", + "Aacut": "Á", + "Aacute": "Á", + "Abreve": "Ă", + "Acir": "Â", + "Acirc": "Â", + "Acy": "А", + "Afr": "𝔄", + "Agrav": "À", + "Agrave": "À", + "Alpha": "Α", + "Amacr": "Ā", + "And": "⩓", + "Aogon": "Ą", + "Aopf": "𝔸", + "ApplyFunction": "⁡", + "Arin": "Å", + "Aring": "Å", + "Ascr": "𝒜", + "Assign": "≔", + "Atild": "Ã", + "Atilde": "Ã", + "Aum": "Ä", + "Auml": "Ä", + "Backslash": "∖", + "Barv": "⫧", + "Barwed": "⌆", + "Bcy": "Б", + "Because": "∵", + "Bernoullis": "ℬ", + "Beta": "Β", + "Bfr": "𝔅", + "Bopf": "𝔹", + "Breve": "˘", + "Bscr": "ℬ", + "Bumpeq": "≎", + "CHcy": "Ч", + "COP": "©", + "COPY": "©", + "Cacute": "Ć", + "Cap": "⋒", + "CapitalDifferentialD": "ⅅ", + "Cayleys": "ℭ", + "Ccaron": "Č", + "Ccedi": "Ç", + "Ccedil": "Ç", + "Ccirc": "Ĉ", + "Cconint": "∰", + "Cdot": "Ċ", + "Cedilla": "¸", + "CenterDot": "·", + "Cfr": "ℭ", + "Chi": "Χ", + "CircleDot": "⊙", + "CircleMinus": "⊖", + "CirclePlus": "⊕", + "CircleTimes": "⊗", + "ClockwiseContourIntegral": "∲", + "CloseCurlyDoubleQuote": "”", + "CloseCurlyQuote": "’", + "Colon": "∷", + "Colone": "⩴", + "Congruent": "≡", + "Conint": "∯", + "ContourIntegral": "∮", + "Copf": "ℂ", + "Coproduct": "∐", + "CounterClockwiseContourIntegral": "∳", + "Cross": "⨯", + "Cscr": "𝒞", + "Cup": "⋓", + "CupCap": "≍", + "DD": "ⅅ", + "DDotrahd": "⤑", + "DJcy": "Ђ", + "DScy": "Ѕ", + "DZcy": "Џ", + "Dagger": "‡", + "Darr": "↡", + "Dashv": "⫤", + "Dcaron": "Ď", + "Dcy": "Д", + "Del": "∇", + "Delta": "Δ", + "Dfr": "𝔇", + "DiacriticalAcute": "´", + "DiacriticalDot": "˙", + "DiacriticalDoubleAcute": "˝", + "DiacriticalGrave": "`", + "DiacriticalTilde": "˜", + "Diamond": "⋄", + "DifferentialD": "ⅆ", + "Dopf": "𝔻", + "Dot": "¨", + "DotDot": "⃜", + "DotEqual": "≐", + "DoubleContourIntegral": "∯", + "DoubleDot": "¨", + "DoubleDownArrow": "⇓", + "DoubleLeftArrow": "⇐", + "DoubleLeftRightArrow": "⇔", + "DoubleLeftTee": "⫤", + "DoubleLongLeftArrow": "⟸", + "DoubleLongLeftRightArrow": "⟺", + "DoubleLongRightArrow": "⟹", + "DoubleRightArrow": "⇒", + "DoubleRightTee": "⊨", + "DoubleUpArrow": "⇑", + "DoubleUpDownArrow": "⇕", + "DoubleVerticalBar": "∥", + "DownArrow": "↓", + "DownArrowBar": "⤓", + "DownArrowUpArrow": "⇵", + "DownBreve": "̑", + "DownLeftRightVector": "⥐", + "DownLeftTeeVector": "⥞", + "DownLeftVector": "↽", + "DownLeftVectorBar": "⥖", + "DownRightTeeVector": "⥟", + "DownRightVector": "⇁", + "DownRightVectorBar": "⥗", + "DownTee": "⊤", + "DownTeeArrow": "↧", + "Downarrow": "⇓", + "Dscr": "𝒟", + "Dstrok": "Đ", + "ENG": "Ŋ", + "ET": "Ð", + "ETH": "Ð", + "Eacut": "É", + "Eacute": "É", + "Ecaron": "Ě", + "Ecir": "Ê", + "Ecirc": "Ê", + "Ecy": "Э", + "Edot": "Ė", + "Efr": "𝔈", + "Egrav": "È", + "Egrave": "È", + "Element": "∈", + "Emacr": "Ē", + "EmptySmallSquare": "◻", + "EmptyVerySmallSquare": "▫", + "Eogon": "Ę", + "Eopf": "𝔼", + "Epsilon": "Ε", + "Equal": "⩵", + "EqualTilde": "≂", + "Equilibrium": "⇌", + "Escr": "ℰ", + "Esim": "⩳", + "Eta": "Η", + "Eum": "Ë", + "Euml": "Ë", + "Exists": "∃", + "ExponentialE": "ⅇ", + "Fcy": "Ф", + "Ffr": "𝔉", + "FilledSmallSquare": "◼", + "FilledVerySmallSquare": "▪", + "Fopf": "𝔽", + "ForAll": "∀", + "Fouriertrf": "ℱ", + "Fscr": "ℱ", + "GJcy": "Ѓ", + "G": ">", + "GT": ">", + "Gamma": "Γ", + "Gammad": "Ϝ", + "Gbreve": "Ğ", + "Gcedil": "Ģ", + "Gcirc": "Ĝ", + "Gcy": "Г", + "Gdot": "Ġ", + "Gfr": "𝔊", + "Gg": "⋙", + "Gopf": "𝔾", + "GreaterEqual": "≥", + "GreaterEqualLess": "⋛", + "GreaterFullEqual": "≧", + "GreaterGreater": "⪢", + "GreaterLess": "≷", + "GreaterSlantEqual": "⩾", + "GreaterTilde": "≳", + "Gscr": "𝒢", + "Gt": "≫", + "HARDcy": "Ъ", + "Hacek": "ˇ", + "Hat": "^", + "Hcirc": "Ĥ", + "Hfr": "ℌ", + "HilbertSpace": "ℋ", + "Hopf": "ℍ", + "HorizontalLine": "─", + "Hscr": "ℋ", + "Hstrok": "Ħ", + "HumpDownHump": "≎", + "HumpEqual": "≏", + "IEcy": "Е", + "IJlig": "IJ", + "IOcy": "Ё", + "Iacut": "Í", + "Iacute": "Í", + "Icir": "Î", + "Icirc": "Î", + "Icy": "И", + "Idot": "İ", + "Ifr": "ℑ", + "Igrav": "Ì", + "Igrave": "Ì", + "Im": "ℑ", + "Imacr": "Ī", + "ImaginaryI": "ⅈ", + "Implies": "⇒", + "Int": "∬", + "Integral": "∫", + "Intersection": "⋂", + "InvisibleComma": "⁣", + "InvisibleTimes": "⁢", + "Iogon": "Į", + "Iopf": "𝕀", + "Iota": "Ι", + "Iscr": "ℐ", + "Itilde": "Ĩ", + "Iukcy": "І", + "Ium": "Ï", + "Iuml": "Ï", + "Jcirc": "Ĵ", + "Jcy": "Й", + "Jfr": "𝔍", + "Jopf": "𝕁", + "Jscr": "𝒥", + "Jsercy": "Ј", + "Jukcy": "Є", + "KHcy": "Х", + "KJcy": "Ќ", + "Kappa": "Κ", + "Kcedil": "Ķ", + "Kcy": "К", + "Kfr": "𝔎", + "Kopf": "𝕂", + "Kscr": "𝒦", + "LJcy": "Љ", + "L": "<", + "LT": "<", + "Lacute": "Ĺ", + "Lambda": "Λ", + "Lang": "⟪", + "Laplacetrf": "ℒ", + "Larr": "↞", + "Lcaron": "Ľ", + "Lcedil": "Ļ", + "Lcy": "Л", + "LeftAngleBracket": "⟨", + "LeftArrow": "←", + "LeftArrowBar": "⇤", + "LeftArrowRightArrow": "⇆", + "LeftCeiling": "⌈", + "LeftDoubleBracket": "⟦", + "LeftDownTeeVector": "⥡", + "LeftDownVector": "⇃", + "LeftDownVectorBar": "⥙", + "LeftFloor": "⌊", + "LeftRightArrow": "↔", + "LeftRightVector": "⥎", + "LeftTee": "⊣", + "LeftTeeArrow": "↤", + "LeftTeeVector": "⥚", + "LeftTriangle": "⊲", + "LeftTriangleBar": "⧏", + "LeftTriangleEqual": "⊴", + "LeftUpDownVector": "⥑", + "LeftUpTeeVector": "⥠", + "LeftUpVector": "↿", + "LeftUpVectorBar": "⥘", + "LeftVector": "↼", + "LeftVectorBar": "⥒", + "Leftarrow": "⇐", + "Leftrightarrow": "⇔", + "LessEqualGreater": "⋚", + "LessFullEqual": "≦", + "LessGreater": "≶", + "LessLess": "⪡", + "LessSlantEqual": "⩽", + "LessTilde": "≲", + "Lfr": "𝔏", + "Ll": "⋘", + "Lleftarrow": "⇚", + "Lmidot": "Ŀ", + "LongLeftArrow": "⟵", + "LongLeftRightArrow": "⟷", + "LongRightArrow": "⟶", + "Longleftarrow": "⟸", + "Longleftrightarrow": "⟺", + "Longrightarrow": "⟹", + "Lopf": "𝕃", + "LowerLeftArrow": "↙", + "LowerRightArrow": "↘", + "Lscr": "ℒ", + "Lsh": "↰", + "Lstrok": "Ł", + "Lt": "≪", + "Map": "⤅", + "Mcy": "М", + "MediumSpace": " ", + "Mellintrf": "ℳ", + "Mfr": "𝔐", + "MinusPlus": "∓", + "Mopf": "𝕄", + "Mscr": "ℳ", + "Mu": "Μ", + "NJcy": "Њ", + "Nacute": "Ń", + "Ncaron": "Ň", + "Ncedil": "Ņ", + "Ncy": "Н", + "NegativeMediumSpace": "​", + "NegativeThickSpace": "​", + "NegativeThinSpace": "​", + "NegativeVeryThinSpace": "​", + "NestedGreaterGreater": "≫", + "NestedLessLess": "≪", + "NewLine": "\n", + "Nfr": "𝔑", + "NoBreak": "⁠", + "NonBreakingSpace": " ", + "Nopf": "ℕ", + "Not": "⫬", + "NotCongruent": "≢", + "NotCupCap": "≭", + "NotDoubleVerticalBar": "∦", + "NotElement": "∉", + "NotEqual": "≠", + "NotEqualTilde": "≂̸", + "NotExists": "∄", + "NotGreater": "≯", + "NotGreaterEqual": "≱", + "NotGreaterFullEqual": "≧̸", + "NotGreaterGreater": "≫̸", + "NotGreaterLess": "≹", + "NotGreaterSlantEqual": "⩾̸", + "NotGreaterTilde": "≵", + "NotHumpDownHump": "≎̸", + "NotHumpEqual": "≏̸", + "NotLeftTriangle": "⋪", + "NotLeftTriangleBar": "⧏̸", + "NotLeftTriangleEqual": "⋬", + "NotLess": "≮", + "NotLessEqual": "≰", + "NotLessGreater": "≸", + "NotLessLess": "≪̸", + "NotLessSlantEqual": "⩽̸", + "NotLessTilde": "≴", + "NotNestedGreaterGreater": "⪢̸", + "NotNestedLessLess": "⪡̸", + "NotPrecedes": "⊀", + "NotPrecedesEqual": "⪯̸", + "NotPrecedesSlantEqual": "⋠", + "NotReverseElement": "∌", + "NotRightTriangle": "⋫", + "NotRightTriangleBar": "⧐̸", + "NotRightTriangleEqual": "⋭", + "NotSquareSubset": "⊏̸", + "NotSquareSubsetEqual": "⋢", + "NotSquareSuperset": "⊐̸", + "NotSquareSupersetEqual": "⋣", + "NotSubset": "⊂⃒", + "NotSubsetEqual": "⊈", + "NotSucceeds": "⊁", + "NotSucceedsEqual": "⪰̸", + "NotSucceedsSlantEqual": "⋡", + "NotSucceedsTilde": "≿̸", + "NotSuperset": "⊃⃒", + "NotSupersetEqual": "⊉", + "NotTilde": "≁", + "NotTildeEqual": "≄", + "NotTildeFullEqual": "≇", + "NotTildeTilde": "≉", + "NotVerticalBar": "∤", + "Nscr": "𝒩", + "Ntild": "Ñ", + "Ntilde": "Ñ", + "Nu": "Ν", + "OElig": "Œ", + "Oacut": "Ó", + "Oacute": "Ó", + "Ocir": "Ô", + "Ocirc": "Ô", + "Ocy": "О", + "Odblac": "Ő", + "Ofr": "𝔒", + "Ograv": "Ò", + "Ograve": "Ò", + "Omacr": "Ō", + "Omega": "Ω", + "Omicron": "Ο", + "Oopf": "𝕆", + "OpenCurlyDoubleQuote": "“", + "OpenCurlyQuote": "‘", + "Or": "⩔", + "Oscr": "𝒪", + "Oslas": "Ø", + "Oslash": "Ø", + "Otild": "Õ", + "Otilde": "Õ", + "Otimes": "⨷", + "Oum": "Ö", + "Ouml": "Ö", + "OverBar": "‾", + "OverBrace": "⏞", + "OverBracket": "⎴", + "OverParenthesis": "⏜", + "PartialD": "∂", + "Pcy": "П", + "Pfr": "𝔓", + "Phi": "Φ", + "Pi": "Π", + "PlusMinus": "±", + "Poincareplane": "ℌ", + "Popf": "ℙ", + "Pr": "⪻", + "Precedes": "≺", + "PrecedesEqual": "⪯", + "PrecedesSlantEqual": "≼", + "PrecedesTilde": "≾", + "Prime": "″", + "Product": "∏", + "Proportion": "∷", + "Proportional": "∝", + "Pscr": "𝒫", + "Psi": "Ψ", + "QUO": "\"", + "QUOT": "\"", + "Qfr": "𝔔", + "Qopf": "ℚ", + "Qscr": "𝒬", + "RBarr": "⤐", + "RE": "®", + "REG": "®", + "Racute": "Ŕ", + "Rang": "⟫", + "Rarr": "↠", + "Rarrtl": "⤖", + "Rcaron": "Ř", + "Rcedil": "Ŗ", + "Rcy": "Р", + "Re": "ℜ", + "ReverseElement": "∋", + "ReverseEquilibrium": "⇋", + "ReverseUpEquilibrium": "⥯", + "Rfr": "ℜ", + "Rho": "Ρ", + "RightAngleBracket": "⟩", + "RightArrow": "→", + "RightArrowBar": "⇥", + "RightArrowLeftArrow": "⇄", + "RightCeiling": "⌉", + "RightDoubleBracket": "⟧", + "RightDownTeeVector": "⥝", + "RightDownVector": "⇂", + "RightDownVectorBar": "⥕", + "RightFloor": "⌋", + "RightTee": "⊢", + "RightTeeArrow": "↦", + "RightTeeVector": "⥛", + "RightTriangle": "⊳", + "RightTriangleBar": "⧐", + "RightTriangleEqual": "⊵", + "RightUpDownVector": "⥏", + "RightUpTeeVector": "⥜", + "RightUpVector": "↾", + "RightUpVectorBar": "⥔", + "RightVector": "⇀", + "RightVectorBar": "⥓", + "Rightarrow": "⇒", + "Ropf": "ℝ", + "RoundImplies": "⥰", + "Rrightarrow": "⇛", + "Rscr": "ℛ", + "Rsh": "↱", + "RuleDelayed": "⧴", + "SHCHcy": "Щ", + "SHcy": "Ш", + "SOFTcy": "Ь", + "Sacute": "Ś", + "Sc": "⪼", + "Scaron": "Š", + "Scedil": "Ş", + "Scirc": "Ŝ", + "Scy": "С", + "Sfr": "𝔖", + "ShortDownArrow": "↓", + "ShortLeftArrow": "←", + "ShortRightArrow": "→", + "ShortUpArrow": "↑", + "Sigma": "Σ", + "SmallCircle": "∘", + "Sopf": "𝕊", + "Sqrt": "√", + "Square": "□", + "SquareIntersection": "⊓", + "SquareSubset": "⊏", + "SquareSubsetEqual": "⊑", + "SquareSuperset": "⊐", + "SquareSupersetEqual": "⊒", + "SquareUnion": "⊔", + "Sscr": "𝒮", + "Star": "⋆", + "Sub": "⋐", + "Subset": "⋐", + "SubsetEqual": "⊆", + "Succeeds": "≻", + "SucceedsEqual": "⪰", + "SucceedsSlantEqual": "≽", + "SucceedsTilde": "≿", + "SuchThat": "∋", + "Sum": "∑", + "Sup": "⋑", + "Superset": "⊃", + "SupersetEqual": "⊇", + "Supset": "⋑", + "THOR": "Þ", + "THORN": "Þ", + "TRADE": "™", + "TSHcy": "Ћ", + "TScy": "Ц", + "Tab": "\t", + "Tau": "Τ", + "Tcaron": "Ť", + "Tcedil": "Ţ", + "Tcy": "Т", + "Tfr": "𝔗", + "Therefore": "∴", + "Theta": "Θ", + "ThickSpace": "  ", + "ThinSpace": " ", + "Tilde": "∼", + "TildeEqual": "≃", + "TildeFullEqual": "≅", + "TildeTilde": "≈", + "Topf": "𝕋", + "TripleDot": "⃛", + "Tscr": "𝒯", + "Tstrok": "Ŧ", + "Uacut": "Ú", + "Uacute": "Ú", + "Uarr": "↟", + "Uarrocir": "⥉", + "Ubrcy": "Ў", + "Ubreve": "Ŭ", + "Ucir": "Û", + "Ucirc": "Û", + "Ucy": "У", + "Udblac": "Ű", + "Ufr": "𝔘", + "Ugrav": "Ù", + "Ugrave": "Ù", + "Umacr": "Ū", + "UnderBar": "_", + "UnderBrace": "⏟", + "UnderBracket": "⎵", + "UnderParenthesis": "⏝", + "Union": "⋃", + "UnionPlus": "⊎", + "Uogon": "Ų", + "Uopf": "𝕌", + "UpArrow": "↑", + "UpArrowBar": "⤒", + "UpArrowDownArrow": "⇅", + "UpDownArrow": "↕", + "UpEquilibrium": "⥮", + "UpTee": "⊥", + "UpTeeArrow": "↥", + "Uparrow": "⇑", + "Updownarrow": "⇕", + "UpperLeftArrow": "↖", + "UpperRightArrow": "↗", + "Upsi": "ϒ", + "Upsilon": "Υ", + "Uring": "Ů", + "Uscr": "𝒰", + "Utilde": "Ũ", + "Uum": "Ü", + "Uuml": "Ü", + "VDash": "⊫", + "Vbar": "⫫", + "Vcy": "В", + "Vdash": "⊩", + "Vdashl": "⫦", + "Vee": "⋁", + "Verbar": "‖", + "Vert": "‖", + "VerticalBar": "∣", + "VerticalLine": "|", + "VerticalSeparator": "❘", + "VerticalTilde": "≀", + "VeryThinSpace": " ", + "Vfr": "𝔙", + "Vopf": "𝕍", + "Vscr": "𝒱", + "Vvdash": "⊪", + "Wcirc": "Ŵ", + "Wedge": "⋀", + "Wfr": "𝔚", + "Wopf": "𝕎", + "Wscr": "𝒲", + "Xfr": "𝔛", + "Xi": "Ξ", + "Xopf": "𝕏", + "Xscr": "𝒳", + "YAcy": "Я", + "YIcy": "Ї", + "YUcy": "Ю", + "Yacut": "Ý", + "Yacute": "Ý", + "Ycirc": "Ŷ", + "Ycy": "Ы", + "Yfr": "𝔜", + "Yopf": "𝕐", + "Yscr": "𝒴", + "Yuml": "Ÿ", + "ZHcy": "Ж", + "Zacute": "Ź", + "Zcaron": "Ž", + "Zcy": "З", + "Zdot": "Ż", + "ZeroWidthSpace": "​", + "Zeta": "Ζ", + "Zfr": "ℨ", + "Zopf": "ℤ", + "Zscr": "𝒵", + "aacut": "á", + "aacute": "á", + "abreve": "ă", + "ac": "∾", + "acE": "∾̳", + "acd": "∿", + "acir": "â", + "acirc": "â", + "acut": "´", + "acute": "´", + "acy": "а", + "aeli": "æ", + "aelig": "æ", + "af": "⁡", + "afr": "𝔞", + "agrav": "à", + "agrave": "à", + "alefsym": "ℵ", + "aleph": "ℵ", + "alpha": "α", + "amacr": "ā", + "amalg": "⨿", + "am": "&", + "amp": "&", + "and": "∧", + "andand": "⩕", + "andd": "⩜", + "andslope": "⩘", + "andv": "⩚", + "ang": "∠", + "ange": "⦤", + "angle": "∠", + "angmsd": "∡", + "angmsdaa": "⦨", + "angmsdab": "⦩", + "angmsdac": "⦪", + "angmsdad": "⦫", + "angmsdae": "⦬", + "angmsdaf": "⦭", + "angmsdag": "⦮", + "angmsdah": "⦯", + "angrt": "∟", + "angrtvb": "⊾", + "angrtvbd": "⦝", + "angsph": "∢", + "angst": "Å", + "angzarr": "⍼", + "aogon": "ą", + "aopf": "𝕒", + "ap": "≈", + "apE": "⩰", + "apacir": "⩯", + "ape": "≊", + "apid": "≋", + "apos": "'", + "approx": "≈", + "approxeq": "≊", + "arin": "å", + "aring": "å", + "ascr": "𝒶", + "ast": "*", + "asymp": "≈", + "asympeq": "≍", + "atild": "ã", + "atilde": "ã", + "aum": "ä", + "auml": "ä", + "awconint": "∳", + "awint": "⨑", + "bNot": "⫭", + "backcong": "≌", + "backepsilon": "϶", + "backprime": "‵", + "backsim": "∽", + "backsimeq": "⋍", + "barvee": "⊽", + "barwed": "⌅", + "barwedge": "⌅", + "bbrk": "⎵", + "bbrktbrk": "⎶", + "bcong": "≌", + "bcy": "б", + "bdquo": "„", + "becaus": "∵", + "because": "∵", + "bemptyv": "⦰", + "bepsi": "϶", + "bernou": "ℬ", + "beta": "β", + "beth": "ℶ", + "between": "≬", + "bfr": "𝔟", + "bigcap": "⋂", + "bigcirc": "◯", + "bigcup": "⋃", + "bigodot": "⨀", + "bigoplus": "⨁", + "bigotimes": "⨂", + "bigsqcup": "⨆", + "bigstar": "★", + "bigtriangledown": "▽", + "bigtriangleup": "△", + "biguplus": "⨄", + "bigvee": "⋁", + "bigwedge": "⋀", + "bkarow": "⤍", + "blacklozenge": "⧫", + "blacksquare": "▪", + "blacktriangle": "▴", + "blacktriangledown": "▾", + "blacktriangleleft": "◂", + "blacktriangleright": "▸", + "blank": "␣", + "blk12": "▒", + "blk14": "░", + "blk34": "▓", + "block": "█", + "bne": "=⃥", + "bnequiv": "≡⃥", + "bnot": "⌐", + "bopf": "𝕓", + "bot": "⊥", + "bottom": "⊥", + "bowtie": "⋈", + "boxDL": "╗", + "boxDR": "╔", + "boxDl": "╖", + "boxDr": "╓", + "boxH": "═", + "boxHD": "╦", + "boxHU": "╩", + "boxHd": "╤", + "boxHu": "╧", + "boxUL": "╝", + "boxUR": "╚", + "boxUl": "╜", + "boxUr": "╙", + "boxV": "║", + "boxVH": "╬", + "boxVL": "╣", + "boxVR": "╠", + "boxVh": "╫", + "boxVl": "╢", + "boxVr": "╟", + "boxbox": "⧉", + "boxdL": "╕", + "boxdR": "╒", + "boxdl": "┐", + "boxdr": "┌", + "boxh": "─", + "boxhD": "╥", + "boxhU": "╨", + "boxhd": "┬", + "boxhu": "┴", + "boxminus": "⊟", + "boxplus": "⊞", + "boxtimes": "⊠", + "boxuL": "╛", + "boxuR": "╘", + "boxul": "┘", + "boxur": "└", + "boxv": "│", + "boxvH": "╪", + "boxvL": "╡", + "boxvR": "╞", + "boxvh": "┼", + "boxvl": "┤", + "boxvr": "├", + "bprime": "‵", + "breve": "˘", + "brvba": "¦", + "brvbar": "¦", + "bscr": "𝒷", + "bsemi": "⁏", + "bsim": "∽", + "bsime": "⋍", + "bsol": "\\", + "bsolb": "⧅", + "bsolhsub": "⟈", + "bull": "•", + "bullet": "•", + "bump": "≎", + "bumpE": "⪮", + "bumpe": "≏", + "bumpeq": "≏", + "cacute": "ć", + "cap": "∩", + "capand": "⩄", + "capbrcup": "⩉", + "capcap": "⩋", + "capcup": "⩇", + "capdot": "⩀", + "caps": "∩︀", + "caret": "⁁", + "caron": "ˇ", + "ccaps": "⩍", + "ccaron": "č", + "ccedi": "ç", + "ccedil": "ç", + "ccirc": "ĉ", + "ccups": "⩌", + "ccupssm": "⩐", + "cdot": "ċ", + "cedi": "¸", + "cedil": "¸", + "cemptyv": "⦲", + "cen": "¢", + "cent": "¢", + "centerdot": "·", + "cfr": "𝔠", + "chcy": "ч", + "check": "✓", + "checkmark": "✓", + "chi": "χ", + "cir": "○", + "cirE": "⧃", + "circ": "ˆ", + "circeq": "≗", + "circlearrowleft": "↺", + "circlearrowright": "↻", + "circledR": "®", + "circledS": "Ⓢ", + "circledast": "⊛", + "circledcirc": "⊚", + "circleddash": "⊝", + "cire": "≗", + "cirfnint": "⨐", + "cirmid": "⫯", + "cirscir": "⧂", + "clubs": "♣", + "clubsuit": "♣", + "colon": ":", + "colone": "≔", + "coloneq": "≔", + "comma": ",", + "commat": "@", + "comp": "∁", + "compfn": "∘", + "complement": "∁", + "complexes": "ℂ", + "cong": "≅", + "congdot": "⩭", + "conint": "∮", + "copf": "𝕔", + "coprod": "∐", + "cop": "©", + "copy": "©", + "copysr": "℗", + "crarr": "↵", + "cross": "✗", + "cscr": "𝒸", + "csub": "⫏", + "csube": "⫑", + "csup": "⫐", + "csupe": "⫒", + "ctdot": "⋯", + "cudarrl": "⤸", + "cudarrr": "⤵", + "cuepr": "⋞", + "cuesc": "⋟", + "cularr": "↶", + "cularrp": "⤽", + "cup": "∪", + "cupbrcap": "⩈", + "cupcap": "⩆", + "cupcup": "⩊", + "cupdot": "⊍", + "cupor": "⩅", + "cups": "∪︀", + "curarr": "↷", + "curarrm": "⤼", + "curlyeqprec": "⋞", + "curlyeqsucc": "⋟", + "curlyvee": "⋎", + "curlywedge": "⋏", + "curre": "¤", + "curren": "¤", + "curvearrowleft": "↶", + "curvearrowright": "↷", + "cuvee": "⋎", + "cuwed": "⋏", + "cwconint": "∲", + "cwint": "∱", + "cylcty": "⌭", + "dArr": "⇓", + "dHar": "⥥", + "dagger": "†", + "daleth": "ℸ", + "darr": "↓", + "dash": "‐", + "dashv": "⊣", + "dbkarow": "⤏", + "dblac": "˝", + "dcaron": "ď", + "dcy": "д", + "dd": "ⅆ", + "ddagger": "‡", + "ddarr": "⇊", + "ddotseq": "⩷", + "de": "°", + "deg": "°", + "delta": "δ", + "demptyv": "⦱", + "dfisht": "⥿", + "dfr": "𝔡", + "dharl": "⇃", + "dharr": "⇂", + "diam": "⋄", + "diamond": "⋄", + "diamondsuit": "♦", + "diams": "♦", + "die": "¨", + "digamma": "ϝ", + "disin": "⋲", + "div": "÷", + "divid": "÷", + "divide": "÷", + "divideontimes": "⋇", + "divonx": "⋇", + "djcy": "ђ", + "dlcorn": "⌞", + "dlcrop": "⌍", + "dollar": "$", + "dopf": "𝕕", + "dot": "˙", + "doteq": "≐", + "doteqdot": "≑", + "dotminus": "∸", + "dotplus": "∔", + "dotsquare": "⊡", + "doublebarwedge": "⌆", + "downarrow": "↓", + "downdownarrows": "⇊", + "downharpoonleft": "⇃", + "downharpoonright": "⇂", + "drbkarow": "⤐", + "drcorn": "⌟", + "drcrop": "⌌", + "dscr": "𝒹", + "dscy": "ѕ", + "dsol": "⧶", + "dstrok": "đ", + "dtdot": "⋱", + "dtri": "▿", + "dtrif": "▾", + "duarr": "⇵", + "duhar": "⥯", + "dwangle": "⦦", + "dzcy": "џ", + "dzigrarr": "⟿", + "eDDot": "⩷", + "eDot": "≑", + "eacut": "é", + "eacute": "é", + "easter": "⩮", + "ecaron": "ě", + "ecir": "ê", + "ecirc": "ê", + "ecolon": "≕", + "ecy": "э", + "edot": "ė", + "ee": "ⅇ", + "efDot": "≒", + "efr": "𝔢", + "eg": "⪚", + "egrav": "è", + "egrave": "è", + "egs": "⪖", + "egsdot": "⪘", + "el": "⪙", + "elinters": "⏧", + "ell": "ℓ", + "els": "⪕", + "elsdot": "⪗", + "emacr": "ē", + "empty": "∅", + "emptyset": "∅", + "emptyv": "∅", + "emsp13": " ", + "emsp14": " ", + "emsp": " ", + "eng": "ŋ", + "ensp": " ", + "eogon": "ę", + "eopf": "𝕖", + "epar": "⋕", + "eparsl": "⧣", + "eplus": "⩱", + "epsi": "ε", + "epsilon": "ε", + "epsiv": "ϵ", + "eqcirc": "≖", + "eqcolon": "≕", + "eqsim": "≂", + "eqslantgtr": "⪖", + "eqslantless": "⪕", + "equals": "=", + "equest": "≟", + "equiv": "≡", + "equivDD": "⩸", + "eqvparsl": "⧥", + "erDot": "≓", + "erarr": "⥱", + "escr": "ℯ", + "esdot": "≐", + "esim": "≂", + "eta": "η", + "et": "ð", + "eth": "ð", + "eum": "ë", + "euml": "ë", + "euro": "€", + "excl": "!", + "exist": "∃", + "expectation": "ℰ", + "exponentiale": "ⅇ", + "fallingdotseq": "≒", + "fcy": "ф", + "female": "♀", + "ffilig": "ffi", + "fflig": "ff", + "ffllig": "ffl", + "ffr": "𝔣", + "filig": "fi", + "fjlig": "fj", + "flat": "♭", + "fllig": "fl", + "fltns": "▱", + "fnof": "ƒ", + "fopf": "𝕗", + "forall": "∀", + "fork": "⋔", + "forkv": "⫙", + "fpartint": "⨍", + "frac1": "¼", + "frac12": "½", + "frac13": "⅓", + "frac14": "¼", + "frac15": "⅕", + "frac16": "⅙", + "frac18": "⅛", + "frac23": "⅔", + "frac25": "⅖", + "frac3": "¾", + "frac34": "¾", + "frac35": "⅗", + "frac38": "⅜", + "frac45": "⅘", + "frac56": "⅚", + "frac58": "⅝", + "frac78": "⅞", + "frasl": "⁄", + "frown": "⌢", + "fscr": "𝒻", + "gE": "≧", + "gEl": "⪌", + "gacute": "ǵ", + "gamma": "γ", + "gammad": "ϝ", + "gap": "⪆", + "gbreve": "ğ", + "gcirc": "ĝ", + "gcy": "г", + "gdot": "ġ", + "ge": "≥", + "gel": "⋛", + "geq": "≥", + "geqq": "≧", + "geqslant": "⩾", + "ges": "⩾", + "gescc": "⪩", + "gesdot": "⪀", + "gesdoto": "⪂", + "gesdotol": "⪄", + "gesl": "⋛︀", + "gesles": "⪔", + "gfr": "𝔤", + "gg": "≫", + "ggg": "⋙", + "gimel": "ℷ", + "gjcy": "ѓ", + "gl": "≷", + "glE": "⪒", + "gla": "⪥", + "glj": "⪤", + "gnE": "≩", + "gnap": "⪊", + "gnapprox": "⪊", + "gne": "⪈", + "gneq": "⪈", + "gneqq": "≩", + "gnsim": "⋧", + "gopf": "𝕘", + "grave": "`", + "gscr": "ℊ", + "gsim": "≳", + "gsime": "⪎", + "gsiml": "⪐", + "g": ">", + "gt": ">", + "gtcc": "⪧", + "gtcir": "⩺", + "gtdot": "⋗", + "gtlPar": "⦕", + "gtquest": "⩼", + "gtrapprox": "⪆", + "gtrarr": "⥸", + "gtrdot": "⋗", + "gtreqless": "⋛", + "gtreqqless": "⪌", + "gtrless": "≷", + "gtrsim": "≳", + "gvertneqq": "≩︀", + "gvnE": "≩︀", + "hArr": "⇔", + "hairsp": " ", + "half": "½", + "hamilt": "ℋ", + "hardcy": "ъ", + "harr": "↔", + "harrcir": "⥈", + "harrw": "↭", + "hbar": "ℏ", + "hcirc": "ĥ", + "hearts": "♥", + "heartsuit": "♥", + "hellip": "…", + "hercon": "⊹", + "hfr": "𝔥", + "hksearow": "⤥", + "hkswarow": "⤦", + "hoarr": "⇿", + "homtht": "∻", + "hookleftarrow": "↩", + "hookrightarrow": "↪", + "hopf": "𝕙", + "horbar": "―", + "hscr": "𝒽", + "hslash": "ℏ", + "hstrok": "ħ", + "hybull": "⁃", + "hyphen": "‐", + "iacut": "í", + "iacute": "í", + "ic": "⁣", + "icir": "î", + "icirc": "î", + "icy": "и", + "iecy": "е", + "iexc": "¡", + "iexcl": "¡", + "iff": "⇔", + "ifr": "𝔦", + "igrav": "ì", + "igrave": "ì", + "ii": "ⅈ", + "iiiint": "⨌", + "iiint": "∭", + "iinfin": "⧜", + "iiota": "℩", + "ijlig": "ij", + "imacr": "ī", + "image": "ℑ", + "imagline": "ℐ", + "imagpart": "ℑ", + "imath": "ı", + "imof": "⊷", + "imped": "Ƶ", + "in": "∈", + "incare": "℅", + "infin": "∞", + "infintie": "⧝", + "inodot": "ı", + "int": "∫", + "intcal": "⊺", + "integers": "ℤ", + "intercal": "⊺", + "intlarhk": "⨗", + "intprod": "⨼", + "iocy": "ё", + "iogon": "į", + "iopf": "𝕚", + "iota": "ι", + "iprod": "⨼", + "iques": "¿", + "iquest": "¿", + "iscr": "𝒾", + "isin": "∈", + "isinE": "⋹", + "isindot": "⋵", + "isins": "⋴", + "isinsv": "⋳", + "isinv": "∈", + "it": "⁢", + "itilde": "ĩ", + "iukcy": "і", + "ium": "ï", + "iuml": "ï", + "jcirc": "ĵ", + "jcy": "й", + "jfr": "𝔧", + "jmath": "ȷ", + "jopf": "𝕛", + "jscr": "𝒿", + "jsercy": "ј", + "jukcy": "є", + "kappa": "κ", + "kappav": "ϰ", + "kcedil": "ķ", + "kcy": "к", + "kfr": "𝔨", + "kgreen": "ĸ", + "khcy": "х", + "kjcy": "ќ", + "kopf": "𝕜", + "kscr": "𝓀", + "lAarr": "⇚", + "lArr": "⇐", + "lAtail": "⤛", + "lBarr": "⤎", + "lE": "≦", + "lEg": "⪋", + "lHar": "⥢", + "lacute": "ĺ", + "laemptyv": "⦴", + "lagran": "ℒ", + "lambda": "λ", + "lang": "⟨", + "langd": "⦑", + "langle": "⟨", + "lap": "⪅", + "laqu": "«", + "laquo": "«", + "larr": "←", + "larrb": "⇤", + "larrbfs": "⤟", + "larrfs": "⤝", + "larrhk": "↩", + "larrlp": "↫", + "larrpl": "⤹", + "larrsim": "⥳", + "larrtl": "↢", + "lat": "⪫", + "latail": "⤙", + "late": "⪭", + "lates": "⪭︀", + "lbarr": "⤌", + "lbbrk": "❲", + "lbrace": "{", + "lbrack": "[", + "lbrke": "⦋", + "lbrksld": "⦏", + "lbrkslu": "⦍", + "lcaron": "ľ", + "lcedil": "ļ", + "lceil": "⌈", + "lcub": "{", + "lcy": "л", + "ldca": "⤶", + "ldquo": "“", + "ldquor": "„", + "ldrdhar": "⥧", + "ldrushar": "⥋", + "ldsh": "↲", + "le": "≤", + "leftarrow": "←", + "leftarrowtail": "↢", + "leftharpoondown": "↽", + "leftharpoonup": "↼", + "leftleftarrows": "⇇", + "leftrightarrow": "↔", + "leftrightarrows": "⇆", + "leftrightharpoons": "⇋", + "leftrightsquigarrow": "↭", + "leftthreetimes": "⋋", + "leg": "⋚", + "leq": "≤", + "leqq": "≦", + "leqslant": "⩽", + "les": "⩽", + "lescc": "⪨", + "lesdot": "⩿", + "lesdoto": "⪁", + "lesdotor": "⪃", + "lesg": "⋚︀", + "lesges": "⪓", + "lessapprox": "⪅", + "lessdot": "⋖", + "lesseqgtr": "⋚", + "lesseqqgtr": "⪋", + "lessgtr": "≶", + "lesssim": "≲", + "lfisht": "⥼", + "lfloor": "⌊", + "lfr": "𝔩", + "lg": "≶", + "lgE": "⪑", + "lhard": "↽", + "lharu": "↼", + "lharul": "⥪", + "lhblk": "▄", + "ljcy": "љ", + "ll": "≪", + "llarr": "⇇", + "llcorner": "⌞", + "llhard": "⥫", + "lltri": "◺", + "lmidot": "ŀ", + "lmoust": "⎰", + "lmoustache": "⎰", + "lnE": "≨", + "lnap": "⪉", + "lnapprox": "⪉", + "lne": "⪇", + "lneq": "⪇", + "lneqq": "≨", + "lnsim": "⋦", + "loang": "⟬", + "loarr": "⇽", + "lobrk": "⟦", + "longleftarrow": "⟵", + "longleftrightarrow": "⟷", + "longmapsto": "⟼", + "longrightarrow": "⟶", + "looparrowleft": "↫", + "looparrowright": "↬", + "lopar": "⦅", + "lopf": "𝕝", + "loplus": "⨭", + "lotimes": "⨴", + "lowast": "∗", + "lowbar": "_", + "loz": "◊", + "lozenge": "◊", + "lozf": "⧫", + "lpar": "(", + "lparlt": "⦓", + "lrarr": "⇆", + "lrcorner": "⌟", + "lrhar": "⇋", + "lrhard": "⥭", + "lrm": "‎", + "lrtri": "⊿", + "lsaquo": "‹", + "lscr": "𝓁", + "lsh": "↰", + "lsim": "≲", + "lsime": "⪍", + "lsimg": "⪏", + "lsqb": "[", + "lsquo": "‘", + "lsquor": "‚", + "lstrok": "ł", + "l": "<", + "lt": "<", + "ltcc": "⪦", + "ltcir": "⩹", + "ltdot": "⋖", + "lthree": "⋋", + "ltimes": "⋉", + "ltlarr": "⥶", + "ltquest": "⩻", + "ltrPar": "⦖", + "ltri": "◃", + "ltrie": "⊴", + "ltrif": "◂", + "lurdshar": "⥊", + "luruhar": "⥦", + "lvertneqq": "≨︀", + "lvnE": "≨︀", + "mDDot": "∺", + "mac": "¯", + "macr": "¯", + "male": "♂", + "malt": "✠", + "maltese": "✠", + "map": "↦", + "mapsto": "↦", + "mapstodown": "↧", + "mapstoleft": "↤", + "mapstoup": "↥", + "marker": "▮", + "mcomma": "⨩", + "mcy": "м", + "mdash": "—", + "measuredangle": "∡", + "mfr": "𝔪", + "mho": "℧", + "micr": "µ", + "micro": "µ", + "mid": "∣", + "midast": "*", + "midcir": "⫰", + "middo": "·", + "middot": "·", + "minus": "−", + "minusb": "⊟", + "minusd": "∸", + "minusdu": "⨪", + "mlcp": "⫛", + "mldr": "…", + "mnplus": "∓", + "models": "⊧", + "mopf": "𝕞", + "mp": "∓", + "mscr": "𝓂", + "mstpos": "∾", + "mu": "μ", + "multimap": "⊸", + "mumap": "⊸", + "nGg": "⋙̸", + "nGt": "≫⃒", + "nGtv": "≫̸", + "nLeftarrow": "⇍", + "nLeftrightarrow": "⇎", + "nLl": "⋘̸", + "nLt": "≪⃒", + "nLtv": "≪̸", + "nRightarrow": "⇏", + "nVDash": "⊯", + "nVdash": "⊮", + "nabla": "∇", + "nacute": "ń", + "nang": "∠⃒", + "nap": "≉", + "napE": "⩰̸", + "napid": "≋̸", + "napos": "ʼn", + "napprox": "≉", + "natur": "♮", + "natural": "♮", + "naturals": "ℕ", + "nbs": " ", + "nbsp": " ", + "nbump": "≎̸", + "nbumpe": "≏̸", + "ncap": "⩃", + "ncaron": "ň", + "ncedil": "ņ", + "ncong": "≇", + "ncongdot": "⩭̸", + "ncup": "⩂", + "ncy": "н", + "ndash": "–", + "ne": "≠", + "neArr": "⇗", + "nearhk": "⤤", + "nearr": "↗", + "nearrow": "↗", + "nedot": "≐̸", + "nequiv": "≢", + "nesear": "⤨", + "nesim": "≂̸", + "nexist": "∄", + "nexists": "∄", + "nfr": "𝔫", + "ngE": "≧̸", + "nge": "≱", + "ngeq": "≱", + "ngeqq": "≧̸", + "ngeqslant": "⩾̸", + "nges": "⩾̸", + "ngsim": "≵", + "ngt": "≯", + "ngtr": "≯", + "nhArr": "⇎", + "nharr": "↮", + "nhpar": "⫲", + "ni": "∋", + "nis": "⋼", + "nisd": "⋺", + "niv": "∋", + "njcy": "њ", + "nlArr": "⇍", + "nlE": "≦̸", + "nlarr": "↚", + "nldr": "‥", + "nle": "≰", + "nleftarrow": "↚", + "nleftrightarrow": "↮", + "nleq": "≰", + "nleqq": "≦̸", + "nleqslant": "⩽̸", + "nles": "⩽̸", + "nless": "≮", + "nlsim": "≴", + "nlt": "≮", + "nltri": "⋪", + "nltrie": "⋬", + "nmid": "∤", + "nopf": "𝕟", + "no": "¬", + "not": "¬", + "notin": "∉", + "notinE": "⋹̸", + "notindot": "⋵̸", + "notinva": "∉", + "notinvb": "⋷", + "notinvc": "⋶", + "notni": "∌", + "notniva": "∌", + "notnivb": "⋾", + "notnivc": "⋽", + "npar": "∦", + "nparallel": "∦", + "nparsl": "⫽⃥", + "npart": "∂̸", + "npolint": "⨔", + "npr": "⊀", + "nprcue": "⋠", + "npre": "⪯̸", + "nprec": "⊀", + "npreceq": "⪯̸", + "nrArr": "⇏", + "nrarr": "↛", + "nrarrc": "⤳̸", + "nrarrw": "↝̸", + "nrightarrow": "↛", + "nrtri": "⋫", + "nrtrie": "⋭", + "nsc": "⊁", + "nsccue": "⋡", + "nsce": "⪰̸", + "nscr": "𝓃", + "nshortmid": "∤", + "nshortparallel": "∦", + "nsim": "≁", + "nsime": "≄", + "nsimeq": "≄", + "nsmid": "∤", + "nspar": "∦", + "nsqsube": "⋢", + "nsqsupe": "⋣", + "nsub": "⊄", + "nsubE": "⫅̸", + "nsube": "⊈", + "nsubset": "⊂⃒", + "nsubseteq": "⊈", + "nsubseteqq": "⫅̸", + "nsucc": "⊁", + "nsucceq": "⪰̸", + "nsup": "⊅", + "nsupE": "⫆̸", + "nsupe": "⊉", + "nsupset": "⊃⃒", + "nsupseteq": "⊉", + "nsupseteqq": "⫆̸", + "ntgl": "≹", + "ntild": "ñ", + "ntilde": "ñ", + "ntlg": "≸", + "ntriangleleft": "⋪", + "ntrianglelefteq": "⋬", + "ntriangleright": "⋫", + "ntrianglerighteq": "⋭", + "nu": "ν", + "num": "#", + "numero": "№", + "numsp": " ", + "nvDash": "⊭", + "nvHarr": "⤄", + "nvap": "≍⃒", + "nvdash": "⊬", + "nvge": "≥⃒", + "nvgt": ">⃒", + "nvinfin": "⧞", + "nvlArr": "⤂", + "nvle": "≤⃒", + "nvlt": "<⃒", + "nvltrie": "⊴⃒", + "nvrArr": "⤃", + "nvrtrie": "⊵⃒", + "nvsim": "∼⃒", + "nwArr": "⇖", + "nwarhk": "⤣", + "nwarr": "↖", + "nwarrow": "↖", + "nwnear": "⤧", + "oS": "Ⓢ", + "oacut": "ó", + "oacute": "ó", + "oast": "⊛", + "ocir": "ô", + "ocirc": "ô", + "ocy": "о", + "odash": "⊝", + "odblac": "ő", + "odiv": "⨸", + "odot": "⊙", + "odsold": "⦼", + "oelig": "œ", + "ofcir": "⦿", + "ofr": "𝔬", + "ogon": "˛", + "ograv": "ò", + "ograve": "ò", + "ogt": "⧁", + "ohbar": "⦵", + "ohm": "Ω", + "oint": "∮", + "olarr": "↺", + "olcir": "⦾", + "olcross": "⦻", + "oline": "‾", + "olt": "⧀", + "omacr": "ō", + "omega": "ω", + "omicron": "ο", + "omid": "⦶", + "ominus": "⊖", + "oopf": "𝕠", + "opar": "⦷", + "operp": "⦹", + "oplus": "⊕", + "or": "∨", + "orarr": "↻", + "ord": "º", + "order": "ℴ", + "orderof": "ℴ", + "ordf": "ª", + "ordm": "º", + "origof": "⊶", + "oror": "⩖", + "orslope": "⩗", + "orv": "⩛", + "oscr": "ℴ", + "oslas": "ø", + "oslash": "ø", + "osol": "⊘", + "otild": "õ", + "otilde": "õ", + "otimes": "⊗", + "otimesas": "⨶", + "oum": "ö", + "ouml": "ö", + "ovbar": "⌽", + "par": "¶", + "para": "¶", + "parallel": "∥", + "parsim": "⫳", + "parsl": "⫽", + "part": "∂", + "pcy": "п", + "percnt": "%", + "period": ".", + "permil": "‰", + "perp": "⊥", + "pertenk": "‱", + "pfr": "𝔭", + "phi": "φ", + "phiv": "ϕ", + "phmmat": "ℳ", + "phone": "☎", + "pi": "π", + "pitchfork": "⋔", + "piv": "ϖ", + "planck": "ℏ", + "planckh": "ℎ", + "plankv": "ℏ", + "plus": "+", + "plusacir": "⨣", + "plusb": "⊞", + "pluscir": "⨢", + "plusdo": "∔", + "plusdu": "⨥", + "pluse": "⩲", + "plusm": "±", + "plusmn": "±", + "plussim": "⨦", + "plustwo": "⨧", + "pm": "±", + "pointint": "⨕", + "popf": "𝕡", + "poun": "£", + "pound": "£", + "pr": "≺", + "prE": "⪳", + "prap": "⪷", + "prcue": "≼", + "pre": "⪯", + "prec": "≺", + "precapprox": "⪷", + "preccurlyeq": "≼", + "preceq": "⪯", + "precnapprox": "⪹", + "precneqq": "⪵", + "precnsim": "⋨", + "precsim": "≾", + "prime": "′", + "primes": "ℙ", + "prnE": "⪵", + "prnap": "⪹", + "prnsim": "⋨", + "prod": "∏", + "profalar": "⌮", + "profline": "⌒", + "profsurf": "⌓", + "prop": "∝", + "propto": "∝", + "prsim": "≾", + "prurel": "⊰", + "pscr": "𝓅", + "psi": "ψ", + "puncsp": " ", + "qfr": "𝔮", + "qint": "⨌", + "qopf": "𝕢", + "qprime": "⁗", + "qscr": "𝓆", + "quaternions": "ℍ", + "quatint": "⨖", + "quest": "?", + "questeq": "≟", + "quo": "\"", + "quot": "\"", + "rAarr": "⇛", + "rArr": "⇒", + "rAtail": "⤜", + "rBarr": "⤏", + "rHar": "⥤", + "race": "∽̱", + "racute": "ŕ", + "radic": "√", + "raemptyv": "⦳", + "rang": "⟩", + "rangd": "⦒", + "range": "⦥", + "rangle": "⟩", + "raqu": "»", + "raquo": "»", + "rarr": "→", + "rarrap": "⥵", + "rarrb": "⇥", + "rarrbfs": "⤠", + "rarrc": "⤳", + "rarrfs": "⤞", + "rarrhk": "↪", + "rarrlp": "↬", + "rarrpl": "⥅", + "rarrsim": "⥴", + "rarrtl": "↣", + "rarrw": "↝", + "ratail": "⤚", + "ratio": "∶", + "rationals": "ℚ", + "rbarr": "⤍", + "rbbrk": "❳", + "rbrace": "}", + "rbrack": "]", + "rbrke": "⦌", + "rbrksld": "⦎", + "rbrkslu": "⦐", + "rcaron": "ř", + "rcedil": "ŗ", + "rceil": "⌉", + "rcub": "}", + "rcy": "р", + "rdca": "⤷", + "rdldhar": "⥩", + "rdquo": "”", + "rdquor": "”", + "rdsh": "↳", + "real": "ℜ", + "realine": "ℛ", + "realpart": "ℜ", + "reals": "ℝ", + "rect": "▭", + "re": "®", + "reg": "®", + "rfisht": "⥽", + "rfloor": "⌋", + "rfr": "𝔯", + "rhard": "⇁", + "rharu": "⇀", + "rharul": "⥬", + "rho": "ρ", + "rhov": "ϱ", + "rightarrow": "→", + "rightarrowtail": "↣", + "rightharpoondown": "⇁", + "rightharpoonup": "⇀", + "rightleftarrows": "⇄", + "rightleftharpoons": "⇌", + "rightrightarrows": "⇉", + "rightsquigarrow": "↝", + "rightthreetimes": "⋌", + "ring": "˚", + "risingdotseq": "≓", + "rlarr": "⇄", + "rlhar": "⇌", + "rlm": "‏", + "rmoust": "⎱", + "rmoustache": "⎱", + "rnmid": "⫮", + "roang": "⟭", + "roarr": "⇾", + "robrk": "⟧", + "ropar": "⦆", + "ropf": "𝕣", + "roplus": "⨮", + "rotimes": "⨵", + "rpar": ")", + "rpargt": "⦔", + "rppolint": "⨒", + "rrarr": "⇉", + "rsaquo": "›", + "rscr": "𝓇", + "rsh": "↱", + "rsqb": "]", + "rsquo": "’", + "rsquor": "’", + "rthree": "⋌", + "rtimes": "⋊", + "rtri": "▹", + "rtrie": "⊵", + "rtrif": "▸", + "rtriltri": "⧎", + "ruluhar": "⥨", + "rx": "℞", + "sacute": "ś", + "sbquo": "‚", + "sc": "≻", + "scE": "⪴", + "scap": "⪸", + "scaron": "š", + "sccue": "≽", + "sce": "⪰", + "scedil": "ş", + "scirc": "ŝ", + "scnE": "⪶", + "scnap": "⪺", + "scnsim": "⋩", + "scpolint": "⨓", + "scsim": "≿", + "scy": "с", + "sdot": "⋅", + "sdotb": "⊡", + "sdote": "⩦", + "seArr": "⇘", + "searhk": "⤥", + "searr": "↘", + "searrow": "↘", + "sec": "§", + "sect": "§", + "semi": ";", + "seswar": "⤩", + "setminus": "∖", + "setmn": "∖", + "sext": "✶", + "sfr": "𝔰", + "sfrown": "⌢", + "sharp": "♯", + "shchcy": "щ", + "shcy": "ш", + "shortmid": "∣", + "shortparallel": "∥", + "sh": "­", + "shy": "­", + "sigma": "σ", + "sigmaf": "ς", + "sigmav": "ς", + "sim": "∼", + "simdot": "⩪", + "sime": "≃", + "simeq": "≃", + "simg": "⪞", + "simgE": "⪠", + "siml": "⪝", + "simlE": "⪟", + "simne": "≆", + "simplus": "⨤", + "simrarr": "⥲", + "slarr": "←", + "smallsetminus": "∖", + "smashp": "⨳", + "smeparsl": "⧤", + "smid": "∣", + "smile": "⌣", + "smt": "⪪", + "smte": "⪬", + "smtes": "⪬︀", + "softcy": "ь", + "sol": "/", + "solb": "⧄", + "solbar": "⌿", + "sopf": "𝕤", + "spades": "♠", + "spadesuit": "♠", + "spar": "∥", + "sqcap": "⊓", + "sqcaps": "⊓︀", + "sqcup": "⊔", + "sqcups": "⊔︀", + "sqsub": "⊏", + "sqsube": "⊑", + "sqsubset": "⊏", + "sqsubseteq": "⊑", + "sqsup": "⊐", + "sqsupe": "⊒", + "sqsupset": "⊐", + "sqsupseteq": "⊒", + "squ": "□", + "square": "□", + "squarf": "▪", + "squf": "▪", + "srarr": "→", + "sscr": "𝓈", + "ssetmn": "∖", + "ssmile": "⌣", + "sstarf": "⋆", + "star": "☆", + "starf": "★", + "straightepsilon": "ϵ", + "straightphi": "ϕ", + "strns": "¯", + "sub": "⊂", + "subE": "⫅", + "subdot": "⪽", + "sube": "⊆", + "subedot": "⫃", + "submult": "⫁", + "subnE": "⫋", + "subne": "⊊", + "subplus": "⪿", + "subrarr": "⥹", + "subset": "⊂", + "subseteq": "⊆", + "subseteqq": "⫅", + "subsetneq": "⊊", + "subsetneqq": "⫋", + "subsim": "⫇", + "subsub": "⫕", + "subsup": "⫓", + "succ": "≻", + "succapprox": "⪸", + "succcurlyeq": "≽", + "succeq": "⪰", + "succnapprox": "⪺", + "succneqq": "⪶", + "succnsim": "⋩", + "succsim": "≿", + "sum": "∑", + "sung": "♪", + "sup": "⊃", + "sup1": "¹", + "sup2": "²", + "sup3": "³", + "supE": "⫆", + "supdot": "⪾", + "supdsub": "⫘", + "supe": "⊇", + "supedot": "⫄", + "suphsol": "⟉", + "suphsub": "⫗", + "suplarr": "⥻", + "supmult": "⫂", + "supnE": "⫌", + "supne": "⊋", + "supplus": "⫀", + "supset": "⊃", + "supseteq": "⊇", + "supseteqq": "⫆", + "supsetneq": "⊋", + "supsetneqq": "⫌", + "supsim": "⫈", + "supsub": "⫔", + "supsup": "⫖", + "swArr": "⇙", + "swarhk": "⤦", + "swarr": "↙", + "swarrow": "↙", + "swnwar": "⤪", + "szli": "ß", + "szlig": "ß", + "target": "⌖", + "tau": "τ", + "tbrk": "⎴", + "tcaron": "ť", + "tcedil": "ţ", + "tcy": "т", + "tdot": "⃛", + "telrec": "⌕", + "tfr": "𝔱", + "there4": "∴", + "therefore": "∴", + "theta": "θ", + "thetasym": "ϑ", + "thetav": "ϑ", + "thickapprox": "≈", + "thicksim": "∼", + "thinsp": " ", + "thkap": "≈", + "thksim": "∼", + "thor": "þ", + "thorn": "þ", + "tilde": "˜", + "time": "×", + "times": "×", + "timesb": "⊠", + "timesbar": "⨱", + "timesd": "⨰", + "tint": "∭", + "toea": "⤨", + "top": "⊤", + "topbot": "⌶", + "topcir": "⫱", + "topf": "𝕥", + "topfork": "⫚", + "tosa": "⤩", + "tprime": "‴", + "trade": "™", + "triangle": "▵", + "triangledown": "▿", + "triangleleft": "◃", + "trianglelefteq": "⊴", + "triangleq": "≜", + "triangleright": "▹", + "trianglerighteq": "⊵", + "tridot": "◬", + "trie": "≜", + "triminus": "⨺", + "triplus": "⨹", + "trisb": "⧍", + "tritime": "⨻", + "trpezium": "⏢", + "tscr": "𝓉", + "tscy": "ц", + "tshcy": "ћ", + "tstrok": "ŧ", + "twixt": "≬", + "twoheadleftarrow": "↞", + "twoheadrightarrow": "↠", + "uArr": "⇑", + "uHar": "⥣", + "uacut": "ú", + "uacute": "ú", + "uarr": "↑", + "ubrcy": "ў", + "ubreve": "ŭ", + "ucir": "û", + "ucirc": "û", + "ucy": "у", + "udarr": "⇅", + "udblac": "ű", + "udhar": "⥮", + "ufisht": "⥾", + "ufr": "𝔲", + "ugrav": "ù", + "ugrave": "ù", + "uharl": "↿", + "uharr": "↾", + "uhblk": "▀", + "ulcorn": "⌜", + "ulcorner": "⌜", + "ulcrop": "⌏", + "ultri": "◸", + "umacr": "ū", + "um": "¨", + "uml": "¨", + "uogon": "ų", + "uopf": "𝕦", + "uparrow": "↑", + "updownarrow": "↕", + "upharpoonleft": "↿", + "upharpoonright": "↾", + "uplus": "⊎", + "upsi": "υ", + "upsih": "ϒ", + "upsilon": "υ", + "upuparrows": "⇈", + "urcorn": "⌝", + "urcorner": "⌝", + "urcrop": "⌎", + "uring": "ů", + "urtri": "◹", + "uscr": "𝓊", + "utdot": "⋰", + "utilde": "ũ", + "utri": "▵", + "utrif": "▴", + "uuarr": "⇈", + "uum": "ü", + "uuml": "ü", + "uwangle": "⦧", + "vArr": "⇕", + "vBar": "⫨", + "vBarv": "⫩", + "vDash": "⊨", + "vangrt": "⦜", + "varepsilon": "ϵ", + "varkappa": "ϰ", + "varnothing": "∅", + "varphi": "ϕ", + "varpi": "ϖ", + "varpropto": "∝", + "varr": "↕", + "varrho": "ϱ", + "varsigma": "ς", + "varsubsetneq": "⊊︀", + "varsubsetneqq": "⫋︀", + "varsupsetneq": "⊋︀", + "varsupsetneqq": "⫌︀", + "vartheta": "ϑ", + "vartriangleleft": "⊲", + "vartriangleright": "⊳", + "vcy": "в", + "vdash": "⊢", + "vee": "∨", + "veebar": "⊻", + "veeeq": "≚", + "vellip": "⋮", + "verbar": "|", + "vert": "|", + "vfr": "𝔳", + "vltri": "⊲", + "vnsub": "⊂⃒", + "vnsup": "⊃⃒", + "vopf": "𝕧", + "vprop": "∝", + "vrtri": "⊳", + "vscr": "𝓋", + "vsubnE": "⫋︀", + "vsubne": "⊊︀", + "vsupnE": "⫌︀", + "vsupne": "⊋︀", + "vzigzag": "⦚", + "wcirc": "ŵ", + "wedbar": "⩟", + "wedge": "∧", + "wedgeq": "≙", + "weierp": "℘", + "wfr": "𝔴", + "wopf": "𝕨", + "wp": "℘", + "wr": "≀", + "wreath": "≀", + "wscr": "𝓌", + "xcap": "⋂", + "xcirc": "◯", + "xcup": "⋃", + "xdtri": "▽", + "xfr": "𝔵", + "xhArr": "⟺", + "xharr": "⟷", + "xi": "ξ", + "xlArr": "⟸", + "xlarr": "⟵", + "xmap": "⟼", + "xnis": "⋻", + "xodot": "⨀", + "xopf": "𝕩", + "xoplus": "⨁", + "xotime": "⨂", + "xrArr": "⟹", + "xrarr": "⟶", + "xscr": "𝓍", + "xsqcup": "⨆", + "xuplus": "⨄", + "xutri": "△", + "xvee": "⋁", + "xwedge": "⋀", + "yacut": "ý", + "yacute": "ý", + "yacy": "я", + "ycirc": "ŷ", + "ycy": "ы", + "ye": "¥", + "yen": "¥", + "yfr": "𝔶", + "yicy": "ї", + "yopf": "𝕪", + "yscr": "𝓎", + "yucy": "ю", + "yum": "ÿ", + "yuml": "ÿ", + "zacute": "ź", + "zcaron": "ž", + "zcy": "з", + "zdot": "ż", + "zeetrf": "ℨ", + "zeta": "ζ", + "zfr": "𝔷", + "zhcy": "ж", + "zigrarr": "⇝", + "zopf": "𝕫", + "zscr": "𝓏", + "zwj": "‍", + "zwnj": "‌" +} diff --git a/tools/eslint/node_modules/character-entities/package.json b/tools/eslint/node_modules/character-entities/package.json new file mode 100644 index 00000000000000..52f8ed39b8969d --- /dev/null +++ b/tools/eslint/node_modules/character-entities/package.json @@ -0,0 +1,97 @@ +{ + "_from": "character-entities@^1.0.0", + "_id": "character-entities@1.2.0", + "_inBundle": false, + "_integrity": "sha1-poPiz3Xb6LFxljUxNk5Y4YobFV8=", + "_location": "/character-entities", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "character-entities@^1.0.0", + "name": "character-entities", + "escapedName": "character-entities", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/parse-entities" + ], + "_resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.0.tgz", + "_shasum": "a683e2cf75dbe8b171963531364e58e18a1b155f", + "_spec": "character-entities@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/character-entities/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "HTML character entity information", + "devDependencies": { + "bail": "^1.0.1", + "browserify": "^13.0.1", + "concat-stream": "^1.5.2", + "esmangle": "^1.0.1", + "nyc": "^8.0.0", + "remark-cli": "^2.0.0", + "remark-preset-wooorm": "^1.0.0", + "tape": "^4.0.0", + "xo": "^0.17.0" + }, + "files": [ + "index.json" + ], + "homepage": "https://github.com/wooorm/character-entities#readme", + "keywords": [ + "html", + "entity", + "entities", + "character", + "reference", + "name", + "replacement" + ], + "license": "MIT", + "main": "index.json", + "name": "character-entities", + "remarkConfig": { + "output": true, + "presets": "wooorm" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/character-entities.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-generate && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.json --bare -s characterEntities > character-entities.js", + "build-generate": "node build", + "build-mangle": "esmangle character-entities.js > character-entities.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.2.0", + "xo": { + "space": true, + "ignores": [ + "character-entities.js" + ] + } +} diff --git a/tools/eslint/node_modules/character-entities/readme.md b/tools/eslint/node_modules/character-entities/readme.md new file mode 100644 index 00000000000000..8f79f76b2ffeed --- /dev/null +++ b/tools/eslint/node_modules/character-entities/readme.md @@ -0,0 +1,53 @@ +# character-entities [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +HTML character entity information. + +## Installation + +[npm][npm-install]: + +```bash +npm install character-entities +``` + +## Usage + +```js +console.log(characterEntities.AElig); // Æ +console.log(characterEntities.aelig); // æ +console.log(characterEntities.amp); // & +``` + +## API + +### characterEntities + +Mapping between (case-sensitive) character entity names to replacements. + +## Support + +See [html.spec.whatwg.org][html]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/character-entities.svg + +[travis]: https://travis-ci.org/wooorm/character-entities + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities.svg + +[codecov]: https://codecov.io/github/wooorm/character-entities + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[html]: https://html.spec.whatwg.org/multipage/syntax.html#named-character-references diff --git a/tools/eslint/node_modules/character-reference-invalid/LICENSE b/tools/eslint/node_modules/character-reference-invalid/LICENSE new file mode 100644 index 00000000000000..32e7a3d93ca5a2 --- /dev/null +++ b/tools/eslint/node_modules/character-reference-invalid/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/character-reference-invalid/index.json b/tools/eslint/node_modules/character-reference-invalid/index.json new file mode 100644 index 00000000000000..9337a854e40194 --- /dev/null +++ b/tools/eslint/node_modules/character-reference-invalid/index.json @@ -0,0 +1,30 @@ +{ + "0": "�", + "128": "€", + "130": "‚", + "131": "ƒ", + "132": "„", + "133": "…", + "134": "†", + "135": "‡", + "136": "ˆ", + "137": "‰", + "138": "Š", + "139": "‹", + "140": "Œ", + "142": "Ž", + "145": "‘", + "146": "’", + "147": "“", + "148": "”", + "149": "•", + "150": "–", + "151": "—", + "152": "˜", + "153": "™", + "154": "š", + "155": "›", + "156": "œ", + "158": "ž", + "159": "Ÿ" +} diff --git a/tools/eslint/node_modules/character-reference-invalid/package.json b/tools/eslint/node_modules/character-reference-invalid/package.json new file mode 100644 index 00000000000000..6f12e8bea0ea75 --- /dev/null +++ b/tools/eslint/node_modules/character-reference-invalid/package.json @@ -0,0 +1,101 @@ +{ + "_from": "character-reference-invalid@^1.0.0", + "_id": "character-reference-invalid@1.1.0", + "_inBundle": false, + "_integrity": "sha1-3smtHfufjQa0/NqircPE/ZevHmg=", + "_location": "/character-reference-invalid", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "character-reference-invalid@^1.0.0", + "name": "character-reference-invalid", + "escapedName": "character-reference-invalid", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/parse-entities" + ], + "_resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz", + "_shasum": "dec9ad1dfb9f8d06b4fcdaa2adc3c4fd97af1e68", + "_spec": "character-reference-invalid@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/character-reference-invalid/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "HTML invalid numeric character reference information", + "devDependencies": { + "bail": "^1.0.1", + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "jsdom": "^9.4.1", + "nyc": "^8.0.0", + "remark-cli": "^2.0.0", + "remark-preset-wooorm": "^1.0.0", + "tape": "^4.0.0", + "xo": "^0.17.0" + }, + "files": [ + "index.json" + ], + "homepage": "https://github.com/wooorm/character-reference-invalid#readme", + "keywords": [ + "html", + "entity", + "numeric", + "character", + "reference", + "replacement", + "invalid", + "name" + ], + "license": "MIT", + "main": "index.json", + "name": "character-reference-invalid", + "remarkConfig": { + "output": true, + "presets": "wooorm" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/character-reference-invalid.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.json --bare -s characterReferenceInvalid > character-reference-invalid.js", + "build-generate": "node build", + "build-mangle": "esmangle character-reference-invalid.js > character-reference-invalid.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.0", + "xo": { + "space": true, + "rules": { + "guard-for-in": "off" + }, + "ignores": [ + "character-reference-invalid.js" + ] + } +} diff --git a/tools/eslint/node_modules/character-reference-invalid/readme.md b/tools/eslint/node_modules/character-reference-invalid/readme.md new file mode 100644 index 00000000000000..ac6e3e1f384991 --- /dev/null +++ b/tools/eslint/node_modules/character-reference-invalid/readme.md @@ -0,0 +1,51 @@ +# character-reference-invalid [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +HTML invalid numeric character reference information. + +## Installation + +[npm][npm-install]: + +```bash +npm install character-reference-invalid +``` + +## Usage + +```js +console.log(characterReferenceInvalid[0x80]); // € +console.log(characterReferenceInvalid[0x89]); // ‰ +console.log(characterReferenceInvalid[0x99]); // ™ +``` + +## API + +### `characterReferenceInvalid` + +Mapping between invalid numeric character reference to replacements. + +## Support + +See [html.spec.whatwg.org][html]. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/character-reference-invalid.svg + +[travis]: https://travis-ci.org/wooorm/character-reference-invalid + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-reference-invalid.svg + +[codecov]: https://codecov.io/github/wooorm/character-reference-invalid + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[html]: https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides diff --git a/tools/eslint/node_modules/collapse-white-space/LICENSE b/tools/eslint/node_modules/collapse-white-space/LICENSE new file mode 100644 index 00000000000000..32e7a3d93ca5a2 --- /dev/null +++ b/tools/eslint/node_modules/collapse-white-space/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/collapse-white-space/index.js b/tools/eslint/node_modules/collapse-white-space/index.js new file mode 100644 index 00000000000000..dcd14c65de4a8a --- /dev/null +++ b/tools/eslint/node_modules/collapse-white-space/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = collapse; + +/* collapse(' \t\nbar \nbaz\t'); // ' bar baz ' */ +function collapse(value) { + return String(value).replace(/\s+/g, ' '); +} diff --git a/tools/eslint/node_modules/collapse-white-space/package.json b/tools/eslint/node_modules/collapse-white-space/package.json new file mode 100644 index 00000000000000..088306dadfb677 --- /dev/null +++ b/tools/eslint/node_modules/collapse-white-space/package.json @@ -0,0 +1,94 @@ +{ + "_from": "collapse-white-space@^1.0.2", + "_id": "collapse-white-space@1.0.3", + "_inBundle": false, + "_integrity": "sha1-S5BvZw5aljqHt2sOFolkM0G2Ajw=", + "_location": "/collapse-white-space", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "collapse-white-space@^1.0.2", + "name": "collapse-white-space", + "escapedName": "collapse-white-space", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.3.tgz", + "_shasum": "4b906f670e5a963a87b76b0e1689643341b6023c", + "_spec": "collapse-white-space@^1.0.2", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/collapse-white-space/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Replace multiple white-space characters with a single space", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.1", + "nyc": "^11.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.0.0", + "xo": "^0.18.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/collapse-white-space#readme", + "keywords": [ + "collapse", + "white", + "space" + ], + "license": "MIT", + "name": "collapse-white-space", + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/collapse-white-space.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s collapseWhiteSpace > collapse-white-space.js", + "build-mangle": "esmangle collapse-white-space.js > collapse-white-space.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.3", + "xo": { + "space": true, + "esnext": false, + "rules": { + "capitalized-comments": "off" + }, + "ignores": [ + "collapse-white-space.js" + ] + } +} diff --git a/tools/eslint/node_modules/collapse-white-space/readme.md b/tools/eslint/node_modules/collapse-white-space/readme.md new file mode 100644 index 00000000000000..5cf867a7002957 --- /dev/null +++ b/tools/eslint/node_modules/collapse-white-space/readme.md @@ -0,0 +1,45 @@ +# collapse-white-space [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Replace multiple white-space characters with a single space. + +## Installation + +[npm][npm-install]: + +```bash +npm install collapse-white-space +``` + +## Usage + +```javascript +var collapse = require('collapse-white-space'); + +collapse('\tfoo \n\tbar \t\r\nbaz'); //=> ' foo bar baz' +``` + +## API + +### `collapse(value)` + +Replace multiple white-space characters in value with a single space. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/collapse-white-space.svg + +[travis]: https://travis-ci.org/wooorm/collapse-white-space + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/collapse-white-space.svg + +[codecov]: https://codecov.io/github/wooorm/collapse-white-space + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/eslint-plugin-markdown/LICENSE b/tools/eslint/node_modules/eslint-plugin-markdown/LICENSE new file mode 100644 index 00000000000000..cf5a5995af4cd5 --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-markdown/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright JS Foundation and other contributors, https://js.foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/eslint-plugin-markdown/README.md b/tools/eslint/node_modules/eslint-plugin-markdown/README.md new file mode 100644 index 00000000000000..749c18832358a1 --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-markdown/README.md @@ -0,0 +1,140 @@ +# eslint-plugin-markdown + +![Screenshot](screenshot.png) + +An [ESLint](http://eslint.org/) plugin to lint JavaScript in Markdown. + +Supported extensions are `.markdown`, `.mdown`, `.mkdn`, and `.md`. + +## Usage + +Install the plugin: + +```sh +npm install --save-dev eslint eslint-plugin-markdown +``` + +Add it to your `.eslintrc`: + +```json +{ + "plugins": [ + "markdown" + ] +} +``` + +Run ESLint on `.md` files: + +```sh +eslint --ext md . +``` + +It will lint `js`, `javascript`, `jsx`, or `node` [fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) in your Markdown documents: + + ```js + // This gets linted + var answer = 6 * 7; + console.log(answer); + ``` + + ```JavaScript + // This also gets linted + + /* eslint quotes: [2, "double"] */ + + function hello() { + console.log("Hello, world!"); + } + hello(); + ``` + + ```jsx + // This gets linted too + var div =
; + ``` + + ```node + // And this + console.log(process.version); + ``` + +Blocks that don't specify either `js`, `javascript`, `jsx`, or `node` syntax are ignored: + + ``` + This is plain text and doesn't get linted. + ``` + + ```python + print("This doesn't get linted either.") + ``` + +## Configuration Comments + +The processor will convert HTML comments immediately preceding a code block into JavaScript block comments and insert them at the beginning of the source code that it passes to ESLint. This permits configuring ESLint via configuration comments while keeping the configuration comments themselves hidden when the markdown is rendered. Comment bodies are passed through unmodified, so the plugin supports any [configuration comments](http://eslint.org/docs/user-guide/configuring) supported by ESLint itself. + +This example enables the `browser` environment, disables the `no-alert` rule, and configures the `quotes` rule to prefer single quotes: + + + + + + ```js + alert('Hello, world!'); + ``` + +Each code block in a file is linted separately, so configuration comments apply only to the code block that immediately follows. + + Assuming `no-alert` is enabled in `.eslintrc`, the first code block will have no error from `no-alert`: + + + + + ```js + alert("Hello, world!"); + ``` + + But the next code block will have an error from `no-alert`: + + + + ```js + alert("Hello, world!"); + ``` + +## Skipping Blocks + +Sometimes it can be useful to have code blocks marked with `js` even though they don't contain valid JavaScript syntax, such as commented JSON blobs that need `js` syntax highlighting. Standard `eslint-disable` comments only silence rule reporting, but ESLint still reports any syntax errors it finds. In cases where a code block should not even be parsed, insert a non-standard `` comment before the block, and this plugin will hide the following block from ESLint. Neither rule nor syntax errors will be reported. + + There are comments in this JSON, so we use `js` syntax for better + highlighting. Skip the block to prevent warnings about invalid syntax. + + + + ```js + { + // This code block is hidden from ESLint. + "hello": "world" + } + ``` + + ```js + console.log("This code block is linted normally."); + ``` + +## Unsatisfiable Rules + +Since code blocks are not files themselves but embedded inside a Markdown document, some rules do not apply to Markdown code blocks, and messages from these rules are automatically suppressed: + +- `eol-last` + +## Contributing + +```sh +$ git clone https://github.com/eslint/eslint-plugin-markdown.git +$ cd eslint-plugin-markdown +$ npm install +$ npm test +``` + +This project follows the [ESLint contribution guidelines](http://eslint.org/docs/developer-guide/contributing/). diff --git a/tools/eslint/node_modules/eslint-plugin-markdown/index.js b/tools/eslint/node_modules/eslint-plugin-markdown/index.js new file mode 100644 index 00000000000000..1638f11ee3c12b --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-markdown/index.js @@ -0,0 +1,8 @@ +/** + * @fileoverview Exports the processor. + * @author Brandon Mills + */ + +"use strict"; + +module.exports = require("./lib"); diff --git a/tools/eslint/node_modules/eslint-plugin-markdown/lib/index.js b/tools/eslint/node_modules/eslint-plugin-markdown/lib/index.js new file mode 100644 index 00000000000000..890425ff8aefa0 --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-markdown/lib/index.js @@ -0,0 +1,17 @@ +/** + * @fileoverview Enables the processor for Markdown file extensions. + * @author Brandon Mills + */ + +"use strict"; + +var processor = require("./processor"); + +module.exports = { + "processors": { + ".markdown": processor, + ".mdown": processor, + ".mkdn": processor, + ".md": processor + } +}; diff --git a/tools/eslint/node_modules/eslint-plugin-markdown/lib/processor.js b/tools/eslint/node_modules/eslint-plugin-markdown/lib/processor.js new file mode 100644 index 00000000000000..8df09ef614d2da --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-markdown/lib/processor.js @@ -0,0 +1,164 @@ +/** + * @fileoverview Processes Markdown files for consumption by ESLint. + * @author Brandon Mills + */ + +"use strict"; + +var assign = require("object-assign"); +var unified = require("unified"); +var remarkParse = require("remark-parse"); + +var SUPPORTED_SYNTAXES = ["js", "javascript", "node", "jsx"]; +var UNSATISFIABLE_RULES = [ + "eol-last" // The Markdown parser strips trailing newlines in code fences +]; + +var markdown = unified().use(remarkParse); + +var blocks = []; + +/** + * Performs a depth-first traversal of the Markdown AST. + * @param {ASTNode} node A Markdown AST node. + * @param {object} callbacks A map of node types to callbacks. + * @param {object} [parent] The node's parent AST node. + * @returns {void} + */ +function traverse(node, callbacks, parent) { + var i; + + if (callbacks[node.type]) { + callbacks[node.type](node, parent); + } + + if (typeof node.children !== "undefined") { + for (i = 0; i < node.children.length; i++) { + traverse(node.children[i], callbacks, node); + } + } +} + +/** + * Converts leading HTML comments to JS block comments. + * @param {string} html The text content of an HTML AST node. + * @returns {string[]} An array of JS block comments. + */ +function getComment(html) { + var commentStart = ""; + var prefix = "eslint"; + + if ( + html.slice(0, commentStart.length) !== commentStart || + html.slice(-commentEnd.length) !== commentEnd + ) { + return ""; + } + + html = html.slice(commentStart.length, -commentEnd.length); + + if (html.trim().slice(0, prefix.length) !== prefix) { + return ""; + } + + return html; +} + +/** + * Extracts lintable JavaScript code blocks from Markdown text. + * @param {string} text The text of the file. + * @returns {string[]} Source code strings to lint. + */ +function preprocess(text) { + var ast = markdown.parse(text); + + blocks = []; + traverse(ast, { + "code": function(node, parent) { + var comments = []; + var index, previousNode, comment; + + if (node.lang && SUPPORTED_SYNTAXES.indexOf(node.lang.toLowerCase()) >= 0) { + index = parent.children.indexOf(node) - 1; + previousNode = parent.children[index]; + while (previousNode && previousNode.type === "html") { + comment = getComment(previousNode.value); + + if (!comment) { + break; + } + + if (comment.trim() === "eslint-skip") { + return; + } + + comments.unshift("/*" + comment + "*/"); + index--; + previousNode = parent.children[index]; + } + + blocks.push(assign({}, node, { comments: comments })); + } + } + }); + + return blocks.map(function(block) { + return block.comments.concat(block.value).join("\n"); + }); +} + +/** + * Creates a map function that adjusts messages in a code block. + * @param {Block} block A code block. + * @returns {function} A function that adjusts messages in a code block. + */ +function adjustBlock(block) { + var leadingCommentLines = block.comments.reduce(function(count, comment) { + return count + comment.split("\n").length; + }, 0); + + /** + * Adjusts ESLint messages to point to the correct location in the Markdown. + * @param {Message} message A message from ESLint. + * @returns {Message} The same message, but adjusted ot the correct location. + */ + return function adjustMessage(message) { + var lineInCode = message.line - leadingCommentLines; + if (lineInCode < 1) { + return null; + } + + return assign({}, message, { + line: lineInCode + block.position.start.line, + column: message.column + block.position.indent[lineInCode - 1] - 1 + }); + }; +} + +/** + * Excludes unsatisfiable rules from the list of messages. + * @param {Message} message A message from the linter. + * @returns {boolean} True if the message should be included in output. + */ +function excludeUnsatisfiableRules(message) { + return message && UNSATISFIABLE_RULES.indexOf(message.ruleId) < 0; +} + +/** + * Transforms generated messages for output. + * @param {Array} messages An array containing one array of messages + * for each code block returned from `preprocess`. + * @returns {Message[]} A flattened array of messages with mapped locations. + */ +function postprocess(messages) { + return [].concat.apply([], messages.map(function(group, i) { + var adjust = adjustBlock(blocks[i]); + return group.map(adjust).filter(excludeUnsatisfiableRules); + })); +} + +module.exports = { + preprocess: preprocess, + postprocess: postprocess +}; diff --git a/tools/eslint/node_modules/eslint-plugin-markdown/package.json b/tools/eslint/node_modules/eslint-plugin-markdown/package.json new file mode 100644 index 00000000000000..2f3483f2d5f590 --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-markdown/package.json @@ -0,0 +1,80 @@ +{ + "_from": "eslint-plugin-markdown@next", + "_id": "eslint-plugin-markdown@1.0.0-beta.7", + "_inBundle": false, + "_integrity": "sha1-Euc6QSfEpLedlm+fR1hR3Q949+c=", + "_location": "/eslint-plugin-markdown", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "eslint-plugin-markdown@next", + "name": "eslint-plugin-markdown", + "escapedName": "eslint-plugin-markdown", + "rawSpec": "next", + "saveSpec": null, + "fetchSpec": "next" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/eslint-plugin-markdown/-/eslint-plugin-markdown-1.0.0-beta.7.tgz", + "_shasum": "12e73a4127c4a4b79d966f9f475851dd0f78f7e7", + "_spec": "eslint-plugin-markdown@next", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint", + "author": { + "name": "Brandon Mills", + "url": "https://github.com/btmills" + }, + "bugs": { + "url": "https://github.com/eslint/eslint-plugin-markdown/issues" + }, + "bundleDependencies": false, + "dependencies": { + "object-assign": "^4.0.1", + "remark-parse": "^3.0.0", + "unified": "^6.1.2" + }, + "deprecated": false, + "description": "An ESLint plugin to lint JavaScript in Markdown code fences.", + "devDependencies": { + "chai": "^3.0.0", + "eslint": "^2.2.0", + "eslint-config-eslint": "^3.0.0", + "eslint-release": "^0.10.2", + "istanbul": "^0.4.5", + "mocha": "^2.2.5" + }, + "files": [ + "index.js", + "lib/index.js", + "lib/processor.js" + ], + "homepage": "https://github.com/eslint/eslint-plugin-markdown#readme", + "keywords": [ + "eslint", + "eslintplugin", + "markdown", + "lint", + "linter" + ], + "license": "MIT", + "main": "index.js", + "name": "eslint-plugin-markdown", + "repository": { + "type": "git", + "url": "git+https://github.com/eslint/eslint-plugin-markdown.git" + }, + "scripts": { + "alpharelease": "eslint-prerelease alpha", + "betarelease": "eslint-prerelease beta", + "ci-release": "eslint-ci-release", + "gh-release": "eslint-gh-release", + "lint": "eslint Makefile.js lib/**/*.js tests/lib/plugin.js", + "release": "eslint-release", + "test": "npm run lint && npm run test-cov", + "test-cov": "istanbul cover _mocha -- -c tests/lib/**/*.js" + }, + "version": "1.0.0-beta.7" +} diff --git a/tools/eslint/node_modules/extend/LICENSE b/tools/eslint/node_modules/extend/LICENSE new file mode 100644 index 00000000000000..92d41503d32ec1 --- /dev/null +++ b/tools/eslint/node_modules/extend/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Stefan Thomas + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/extend/README.md b/tools/eslint/node_modules/extend/README.md new file mode 100644 index 00000000000000..947dda6aeb9640 --- /dev/null +++ b/tools/eslint/node_modules/extend/README.md @@ -0,0 +1,80 @@ +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] + +# extend() for Node.js [![Version Badge][npm-version-png]][npm-url] + +`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. + +Notes: + +* Since Node.js >= 4, + [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) + now offers the same functionality natively (but without the "deep copy" option). + See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6). +* Some native implementations of `Object.assign` in both Node.js and many + browsers (since NPM modules are for the browser too) may not be fully + spec-compliant. + Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for + a compliant candidate. + +## Installation + +This package is available on [npm][npm-url] as: `extend` + +``` sh +npm install extend +``` + +## Usage + +**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** + +*Extend one object with one or more others, returning the modified object.* + +**Example:** + +``` js +var extend = require('extend'); +extend(targetObject, object1, object2); +``` + +Keep in mind that the target object will be modified, and will be returned from extend(). + +If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). +Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. +Warning: passing `false` as the first argument is not supported. + +### Arguments + +* `deep` *Boolean* (optional) +If set, the merge becomes recursive (i.e. deep copy). +* `target` *Object* +The object to extend. +* `object1` *Object* +The object that will be merged into the first. +* `objectN` *Object* (Optional) +More objects to merge into the first. + +## License + +`node-extend` is licensed under the [MIT License][mit-license-url]. + +## Acknowledgements + +All credit to the jQuery authors for perfecting this amazing utility. + +Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb]. + +[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg +[travis-url]: https://travis-ci.org/justmoon/node-extend +[npm-url]: https://npmjs.org/package/extend +[mit-license-url]: http://opensource.org/licenses/MIT +[github-justmoon]: https://github.com/justmoon +[github-insin]: https://github.com/insin +[github-ljharb]: https://github.com/ljharb +[npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg +[deps-svg]: https://david-dm.org/justmoon/node-extend.svg +[deps-url]: https://david-dm.org/justmoon/node-extend +[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg +[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies diff --git a/tools/eslint/node_modules/extend/index.js b/tools/eslint/node_modules/extend/index.js new file mode 100644 index 00000000000000..bbe53f66083ce6 --- /dev/null +++ b/tools/eslint/node_modules/extend/index.js @@ -0,0 +1,86 @@ +'use strict'; + +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; + +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } + + return toStr.call(arr) === '[object Array]'; +}; + +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } + + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } + + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; + +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } + + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = target[name]; + copy = options[name]; + + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[name] = extend(deep, clone, copy); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + target[name] = copy; + } + } + } + } + } + + // Return the modified object + return target; +}; diff --git a/tools/eslint/node_modules/extend/package.json b/tools/eslint/node_modules/extend/package.json new file mode 100644 index 00000000000000..3b82d8e6f07d7e --- /dev/null +++ b/tools/eslint/node_modules/extend/package.json @@ -0,0 +1,75 @@ +{ + "_from": "extend@^3.0.0", + "_id": "extend@3.0.1", + "_inBundle": false, + "_integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "_location": "/extend", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "extend@^3.0.0", + "name": "extend", + "escapedName": "extend", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/unified" + ], + "_resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "_shasum": "a755ea7bc1adfcc5a31ce7e762dbaadc5e636444", + "_spec": "extend@^3.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", + "author": { + "name": "Stefan Thomas", + "email": "justmoon@members.fsf.org", + "url": "http://www.justmoon.net" + }, + "bugs": { + "url": "https://github.com/justmoon/node-extend/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Port of jQuery.extend for node.js and the browser", + "devDependencies": { + "@ljharb/eslint-config": "^11.0.0", + "covert": "^1.1.0", + "eslint": "^3.19.0", + "jscs": "^3.0.7", + "tape": "^4.6.3" + }, + "homepage": "https://github.com/justmoon/node-extend#readme", + "keywords": [ + "extend", + "clone", + "merge" + ], + "license": "MIT", + "main": "index", + "name": "extend", + "repository": { + "type": "git", + "url": "git+https://github.com/justmoon/node-extend.git" + }, + "scripts": { + "coverage": "covert test/index.js", + "coverage-quiet": "covert test/index.js --quiet", + "eslint": "eslint *.js */*.js", + "jscs": "jscs *.js */*.js", + "lint": "npm run jscs && npm run eslint", + "posttest": "npm run coverage-quiet", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "node test" + }, + "version": "3.0.1" +} diff --git a/tools/eslint/node_modules/function-bind/LICENSE b/tools/eslint/node_modules/function-bind/LICENSE new file mode 100644 index 00000000000000..5b1b5dc3683d91 --- /dev/null +++ b/tools/eslint/node_modules/function-bind/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/function-bind/README.md b/tools/eslint/node_modules/function-bind/README.md new file mode 100644 index 00000000000000..81862a02cb940c --- /dev/null +++ b/tools/eslint/node_modules/function-bind/README.md @@ -0,0 +1,48 @@ +# function-bind + + + + + +Implementation of function.prototype.bind + +## Example + +I mainly do this for unit tests I run on phantomjs. +PhantomJS does not have Function.prototype.bind :( + +```js +Function.prototype.bind = require("function-bind") +``` + +## Installation + +`npm install function-bind` + +## Contributors + + - Raynos + +## MIT Licenced + + [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg + [travis-url]: https://travis-ci.org/Raynos/function-bind + [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg + [npm-url]: https://npmjs.org/package/function-bind + [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png + [6]: https://coveralls.io/r/Raynos/function-bind + [7]: https://gemnasium.com/Raynos/function-bind.png + [8]: https://gemnasium.com/Raynos/function-bind + [deps-svg]: https://david-dm.org/Raynos/function-bind.svg + [deps-url]: https://david-dm.org/Raynos/function-bind + [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg + [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies + [11]: https://ci.testling.com/Raynos/function-bind.png + [12]: https://ci.testling.com/Raynos/function-bind diff --git a/tools/eslint/node_modules/function-bind/implementation.js b/tools/eslint/node_modules/function-bind/implementation.js new file mode 100644 index 00000000000000..5e91272802571e --- /dev/null +++ b/tools/eslint/node_modules/function-bind/implementation.js @@ -0,0 +1,48 @@ +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var slice = Array.prototype.slice; +var toStr = Object.prototype.toString; +var funcType = '[object Function]'; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + } + }; + + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push('$' + i); + } + + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; diff --git a/tools/eslint/node_modules/function-bind/index.js b/tools/eslint/node_modules/function-bind/index.js new file mode 100644 index 00000000000000..60ba57846097b2 --- /dev/null +++ b/tools/eslint/node_modules/function-bind/index.js @@ -0,0 +1,3 @@ +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; diff --git a/tools/eslint/node_modules/function-bind/package.json b/tools/eslint/node_modules/function-bind/package.json new file mode 100644 index 00000000000000..e45bd113ad6c96 --- /dev/null +++ b/tools/eslint/node_modules/function-bind/package.json @@ -0,0 +1,98 @@ +{ + "_from": "function-bind@^1.0.2", + "_id": "function-bind@1.1.0", + "_inBundle": false, + "_integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=", + "_location": "/function-bind", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "function-bind@^1.0.2", + "name": "function-bind", + "escapedName": "function-bind", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/has" + ], + "_resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", + "_shasum": "16176714c801798e4e8f2cf7f7529467bb4a5771", + "_spec": "function-bind@^1.0.2", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\has", + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "bugs": { + "url": "https://github.com/Raynos/function-bind/issues", + "email": "raynos2@gmail.com" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Raynos" + }, + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Implementation of Function.prototype.bind", + "devDependencies": { + "@ljharb/eslint-config": "^2.1.0", + "covert": "^1.1.0", + "eslint": "^2.0.0", + "jscs": "^2.9.0", + "tape": "^4.4.0" + }, + "homepage": "https://github.com/Raynos/function-bind", + "keywords": [ + "function", + "bind", + "shim", + "es5" + ], + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/Raynos/function-bind/raw/master/LICENSE" + } + ], + "main": "index", + "name": "function-bind", + "repository": { + "type": "git", + "url": "git://github.com/Raynos/function-bind.git" + }, + "scripts": { + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "eslint": "eslint *.js */*.js", + "jscs": "jscs *.js */*.js", + "lint": "npm run jscs && npm run eslint", + "test": "npm run lint && npm run tests-only && npm run coverage-quiet", + "tests-only": "node test" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.1.0" +} diff --git a/tools/eslint/node_modules/has/LICENSE-MIT b/tools/eslint/node_modules/has/LICENSE-MIT new file mode 100644 index 00000000000000..ae7014d385df3d --- /dev/null +++ b/tools/eslint/node_modules/has/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2013 Thiago de Arruda + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/has/README.mkd b/tools/eslint/node_modules/has/README.mkd new file mode 100644 index 00000000000000..635e3a4baab00b --- /dev/null +++ b/tools/eslint/node_modules/has/README.mkd @@ -0,0 +1,18 @@ +# has + +> Object.prototype.hasOwnProperty.call shortcut + +## Installation + +```sh +npm install --save has +``` + +## Usage + +```js +var has = require('has'); + +has({}, 'hasOwnProperty'); // false +has(Object.prototype, 'hasOwnProperty'); // true +``` diff --git a/tools/eslint/node_modules/has/package.json b/tools/eslint/node_modules/has/package.json new file mode 100644 index 00000000000000..4b8fa331c05282 --- /dev/null +++ b/tools/eslint/node_modules/has/package.json @@ -0,0 +1,62 @@ +{ + "_from": "has@^1.0.1", + "_id": "has@1.0.1", + "_inBundle": false, + "_integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "_location": "/has", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "has@^1.0.1", + "name": "has", + "escapedName": "has", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "_shasum": "8461733f538b0837c9361e39a9ab9e9704dc2f28", + "_spec": "has@^1.0.1", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Thiago de Arruda", + "email": "tpadilha84@gmail.com" + }, + "bugs": { + "url": "https://github.com/tarruda/has/issues" + }, + "bundleDependencies": false, + "dependencies": { + "function-bind": "^1.0.2" + }, + "deprecated": false, + "description": "Object.prototype.hasOwnProperty.call shortcut", + "devDependencies": { + "chai": "~1.7.2", + "mocha": "^1.21.4" + }, + "engines": { + "node": ">= 0.8.0" + }, + "homepage": "https://github.com/tarruda/has", + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" + } + ], + "main": "./src/index", + "name": "has", + "repository": { + "type": "git", + "url": "git://github.com/tarruda/has.git" + }, + "scripts": { + "test": "node_modules/mocha/bin/mocha" + }, + "version": "1.0.1" +} diff --git a/tools/eslint/node_modules/has/src/index.js b/tools/eslint/node_modules/has/src/index.js new file mode 100644 index 00000000000000..cdf328576e70c2 --- /dev/null +++ b/tools/eslint/node_modules/has/src/index.js @@ -0,0 +1,3 @@ +var bind = require('function-bind'); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/tools/eslint/node_modules/is-alphabetical/LICENSE b/tools/eslint/node_modules/is-alphabetical/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/is-alphabetical/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-alphabetical/history.md b/tools/eslint/node_modules/is-alphabetical/history.md new file mode 100644 index 00000000000000..ef81df4296778c --- /dev/null +++ b/tools/eslint/node_modules/is-alphabetical/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-11 +================== diff --git a/tools/eslint/node_modules/is-alphabetical/index.js b/tools/eslint/node_modules/is-alphabetical/index.js new file mode 100644 index 00000000000000..090d47010ff3c0 --- /dev/null +++ b/tools/eslint/node_modules/is-alphabetical/index.js @@ -0,0 +1,29 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module is-alphabetical + * @fileoverview Check if a character is alphabetical. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Expose. */ +module.exports = alphabetical; + +/** + * Check whether the given character code, or the character + * code at the first character, is alphabetical. + * + * @param {string|number} character + * @return {boolean} - Whether `character` is alphabetical. + */ +function alphabetical(character) { + var code = typeof character === 'string' ? + character.charCodeAt(0) : character; + + return (code >= 97 && code <= 122) || /* a-z */ + (code >= 65 && code <= 90); /* A-Z */ +} diff --git a/tools/eslint/node_modules/is-alphabetical/package.json b/tools/eslint/node_modules/is-alphabetical/package.json new file mode 100644 index 00000000000000..3cd68ffa43ec06 --- /dev/null +++ b/tools/eslint/node_modules/is-alphabetical/package.json @@ -0,0 +1,110 @@ +{ + "_from": "is-alphabetical@^1.0.0", + "_id": "is-alphabetical@1.0.0", + "_inBundle": false, + "_integrity": "sha1-4lRMEwWCVfIUTLdXBmzTNCocjEY=", + "_location": "/is-alphabetical", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-alphabetical@^1.0.0", + "name": "is-alphabetical", + "escapedName": "is-alphabetical", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/is-alphanumerical", + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.0.tgz", + "_shasum": "e2544c13058255f2144cb757066cd3342a1c8c46", + "_spec": "is-alphabetical@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/is-alphabetical/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Check if a character is alphabetical", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/is-alphabetical#readme", + "keywords": [ + "string", + "character", + "char", + "code", + "alphabetical" + ], + "license": "MIT", + "name": "is-alphabetical", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/is-alphabetical.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s isAlphabetical > is-alphabetical.js", + "build-mangle": "esmangle < is-alphabetical.js > is-alphabetical.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "is-alphabetical.js", + "is-alphabetical.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/is-alphabetical/readme.md b/tools/eslint/node_modules/is-alphabetical/readme.md new file mode 100644 index 00000000000000..ea08662dad3bc2 --- /dev/null +++ b/tools/eslint/node_modules/is-alphabetical/readme.md @@ -0,0 +1,58 @@ +# is-alphabetical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +Check if a character is alphabetical. + +## Installation + +[npm][npm-install]: + +```bash +npm install is-alphabetical +``` + +## Usage + +Dependencies: + +```javascript +var alphabetical = require('is-alphabetical'); + +alphabetical('a'); // true +alphabetical('B'); // true +alphabetical('0'); // false +alphabetical('💩'); // false +``` + +## API + +### `alphabetical(character)` + +Check whether the given character code (`number`), or the character +code at the first position (`string`), is alphabetical. + +## Related + +* [`is-decimal`](https://github.com/wooorm/is-decimal) +* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/is-alphabetical.svg + +[travis]: https://travis-ci.org/wooorm/is-alphabetical + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-alphabetical.svg + +[codecov]: https://codecov.io/github/wooorm/is-alphabetical + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/is-alphanumerical/LICENSE b/tools/eslint/node_modules/is-alphanumerical/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/is-alphanumerical/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-alphanumerical/history.md b/tools/eslint/node_modules/is-alphanumerical/history.md new file mode 100644 index 00000000000000..674e111c479ebb --- /dev/null +++ b/tools/eslint/node_modules/is-alphanumerical/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-12 +================== diff --git a/tools/eslint/node_modules/is-alphanumerical/index.js b/tools/eslint/node_modules/is-alphanumerical/index.js new file mode 100644 index 00000000000000..58ea455baa4efe --- /dev/null +++ b/tools/eslint/node_modules/is-alphanumerical/index.js @@ -0,0 +1,29 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module is-alphanumerical + * @fileoverview Check if a character is alphanumerical. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Dependencies. */ +var alphabetical = require('is-alphabetical'); +var decimal = require('is-decimal'); + +/* Expose. */ +module.exports = alphanumerical; + +/** + * Check whether the given character code, or the character + * code at the first character, is alphanumerical. + * + * @param {string|number} character + * @return {boolean} - Whether `character` is alphanumerical. + */ +function alphanumerical(character) { + return alphabetical(character) || decimal(character); +} diff --git a/tools/eslint/node_modules/is-alphanumerical/package.json b/tools/eslint/node_modules/is-alphanumerical/package.json new file mode 100644 index 00000000000000..4e99e725b63553 --- /dev/null +++ b/tools/eslint/node_modules/is-alphanumerical/package.json @@ -0,0 +1,114 @@ +{ + "_from": "is-alphanumerical@^1.0.0", + "_id": "is-alphanumerical@1.0.0", + "_inBundle": false, + "_integrity": "sha1-4GSS5xnBvxXewjnk8a9fZ7TW578=", + "_location": "/is-alphanumerical", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-alphanumerical@^1.0.0", + "name": "is-alphanumerical", + "escapedName": "is-alphanumerical", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/parse-entities" + ], + "_resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.0.tgz", + "_shasum": "e06492e719c1bf15dec239e4f1af5f67b4d6e7bf", + "_spec": "is-alphanumerical@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/is-alphanumerical/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + }, + "deprecated": false, + "description": "Check if a character is alphanumerical", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/is-alphanumerical#readme", + "keywords": [ + "string", + "character", + "char", + "code", + "alphabetical", + "numerical", + "alphanumerical" + ], + "license": "MIT", + "name": "is-alphanumerical", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/is-alphanumerical.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s isAlphanumerical > is-alphanumerical.js", + "build-mangle": "esmangle < is-alphanumerical.js > is-alphanumerical.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "is-alphanumerical.js", + "is-alphanumerical.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/is-alphanumerical/readme.md b/tools/eslint/node_modules/is-alphanumerical/readme.md new file mode 100644 index 00000000000000..26e6289d38bfc7 --- /dev/null +++ b/tools/eslint/node_modules/is-alphanumerical/readme.md @@ -0,0 +1,60 @@ +# is-alphanumerical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +Check if a character is alphanumerical (`[a-zA-Z0-9]`). + +## Installation + +[npm][npm-install]: + +```bash +npm install is-alphanumerical +``` + +## Usage + +```javascript +var alphanumerical = require('is-alphanumerical'); + +alphanumerical('a'); // true +alphanumerical('Z'); // true +alphanumerical('0'); // true +alphanumerical(' '); // false +alphanumerical('💩'); // false +``` + +## API + +### `alphanumerical(character)` + +Check whether the given character code (`number`), or the character +code at the first position (`string`), is alphanumerical. + +## Related + +* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`is-decimal`](https://github.com/wooorm/is-decimal) +* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) +* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) +* [`is-word-character`](https://github.com/wooorm/is-word-character) + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/is-alphanumerical.svg + +[travis]: https://travis-ci.org/wooorm/is-alphanumerical + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-alphanumerical.svg + +[codecov]: https://codecov.io/github/wooorm/is-alphanumerical + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/is-buffer/LICENSE b/tools/eslint/node_modules/is-buffer/LICENSE new file mode 100644 index 00000000000000..0c068ceecbd48f --- /dev/null +++ b/tools/eslint/node_modules/is-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-buffer/README.md b/tools/eslint/node_modules/is-buffer/README.md new file mode 100644 index 00000000000000..cb6f356d5a95a0 --- /dev/null +++ b/tools/eslint/node_modules/is-buffer/README.md @@ -0,0 +1,49 @@ +# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url] + +#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer)) + +[![saucelabs][saucelabs-image]][saucelabs-url] + +[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/is-buffer +[npm-image]: https://img.shields.io/npm/v/is-buffer.svg +[npm-url]: https://npmjs.org/package/is-buffer +[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg +[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg +[saucelabs-url]: https://saucelabs.com/u/is-buffer + +## Why not use `Buffer.isBuffer`? + +This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)). + +It's future-proof and works in node too! + +## install + +```bash +npm install is-buffer +``` + +## usage + +```js +var isBuffer = require('is-buffer') + +isBuffer(new Buffer(4)) // true + +isBuffer(undefined) // false +isBuffer(null) // false +isBuffer('') // false +isBuffer(true) // false +isBuffer(false) // false +isBuffer(0) // false +isBuffer(1) // false +isBuffer(1.0) // false +isBuffer('string') // false +isBuffer({}) // false +isBuffer(function foo () {}) // false +``` + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). diff --git a/tools/eslint/node_modules/is-buffer/index.js b/tools/eslint/node_modules/is-buffer/index.js new file mode 100644 index 00000000000000..36c808ea7579c2 --- /dev/null +++ b/tools/eslint/node_modules/is-buffer/index.js @@ -0,0 +1,21 @@ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) +} + +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) +} diff --git a/tools/eslint/node_modules/is-buffer/package.json b/tools/eslint/node_modules/is-buffer/package.json new file mode 100644 index 00000000000000..742f383ca74b56 --- /dev/null +++ b/tools/eslint/node_modules/is-buffer/package.json @@ -0,0 +1,77 @@ +{ + "_from": "is-buffer@^1.1.4", + "_id": "is-buffer@1.1.5", + "_inBundle": false, + "_integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "_location": "/is-buffer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-buffer@^1.1.4", + "name": "is-buffer", + "escapedName": "is-buffer", + "rawSpec": "^1.1.4", + "saveSpec": null, + "fetchSpec": "^1.1.4" + }, + "_requiredBy": [ + "/vfile" + ], + "_resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "_shasum": "1f3b26ef613b214b88cbca23cc6c01d87961eecc", + "_spec": "is-buffer@^1.1.4", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\vfile", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/is-buffer/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Determine if an object is a Buffer", + "devDependencies": { + "standard": "*", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/is-buffer#readme", + "keywords": [ + "buffer", + "buffers", + "type", + "core buffer", + "browser buffer", + "browserify", + "typed array", + "uint32array", + "int16array", + "int32array", + "float32array", + "float64array", + "browser", + "arraybuffer", + "dataview" + ], + "license": "MIT", + "main": "index.js", + "name": "is-buffer", + "repository": { + "type": "git", + "url": "git://github.com/feross/is-buffer.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + }, + "version": "1.1.5" +} diff --git a/tools/eslint/node_modules/is-decimal/LICENSE b/tools/eslint/node_modules/is-decimal/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/is-decimal/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-decimal/history.md b/tools/eslint/node_modules/is-decimal/history.md new file mode 100644 index 00000000000000..ef81df4296778c --- /dev/null +++ b/tools/eslint/node_modules/is-decimal/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-11 +================== diff --git a/tools/eslint/node_modules/is-decimal/index.js b/tools/eslint/node_modules/is-decimal/index.js new file mode 100644 index 00000000000000..15ed373507932f --- /dev/null +++ b/tools/eslint/node_modules/is-decimal/index.js @@ -0,0 +1,28 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module is-decimal + * @fileoverview Check if a character is decimal. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Expose. */ +module.exports = decimal; + +/** + * Check whether the given character code, or the character + * code at the first character, is decimal. + * + * @param {string|number} character + * @return {boolean} - Whether `character` is decimal. + */ +function decimal(character) { + var code = typeof character === 'string' ? + character.charCodeAt(0) : character; + + return code >= 48 && code <= 57; /* 0-9 */ +} diff --git a/tools/eslint/node_modules/is-decimal/package.json b/tools/eslint/node_modules/is-decimal/package.json new file mode 100644 index 00000000000000..35b7ba49621906 --- /dev/null +++ b/tools/eslint/node_modules/is-decimal/package.json @@ -0,0 +1,111 @@ +{ + "_from": "is-decimal@^1.0.0", + "_id": "is-decimal@1.0.0", + "_inBundle": false, + "_integrity": "sha1-lAV5tupjxigICmnmK9qIyEcLT+A=", + "_location": "/is-decimal", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-decimal@^1.0.0", + "name": "is-decimal", + "escapedName": "is-decimal", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/is-alphanumerical", + "/parse-entities", + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.0.tgz", + "_shasum": "940579b6ea63c628080a69e62bda88c8470b4fe0", + "_spec": "is-decimal@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/is-decimal/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Check if a character is decimal", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/is-decimal#readme", + "keywords": [ + "string", + "character", + "char", + "code", + "decimal" + ], + "license": "MIT", + "name": "is-decimal", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/is-decimal.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s isDecimal > is-decimal.js", + "build-mangle": "esmangle < is-decimal.js > is-decimal.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "is-decimal.js", + "is-decimal.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/is-decimal/readme.md b/tools/eslint/node_modules/is-decimal/readme.md new file mode 100644 index 00000000000000..58d25c26bc55ce --- /dev/null +++ b/tools/eslint/node_modules/is-decimal/readme.md @@ -0,0 +1,58 @@ +# is-decimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +Check if a character is decimal. + +## Installation + +[npm][npm-install]: + +```bash +npm install is-decimal +``` + +## Usage + +Dependencies: + +```javascript +var decimal = require('is-decimal'); + +decimal('0'); // true +decimal('9'); // true +decimal('a'); // false +decimal('💩'); // false +``` + +## API + +### `decimal(character)` + +Check whether the given character code (`number`), or the character +code at the first position (`string`), is decimal. + +## Related + +* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/is-decimal.svg + +[travis]: https://travis-ci.org/wooorm/is-decimal + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-decimal.svg + +[codecov]: https://codecov.io/github/wooorm/is-decimal + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/is-hexadecimal/LICENSE b/tools/eslint/node_modules/is-hexadecimal/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/is-hexadecimal/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-hexadecimal/history.md b/tools/eslint/node_modules/is-hexadecimal/history.md new file mode 100644 index 00000000000000..ef81df4296778c --- /dev/null +++ b/tools/eslint/node_modules/is-hexadecimal/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-11 +================== diff --git a/tools/eslint/node_modules/is-hexadecimal/index.js b/tools/eslint/node_modules/is-hexadecimal/index.js new file mode 100644 index 00000000000000..dfb9ddb5780072 --- /dev/null +++ b/tools/eslint/node_modules/is-hexadecimal/index.js @@ -0,0 +1,30 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module is-hexadecimal + * @fileoverview Check if a character is hexadecimal. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Expose. */ +module.exports = hexadecimal; + +/** + * Check whether the given character code, or the character + * code at the first character, is hexadecimal. + * + * @param {string|number} character + * @return {boolean} - Whether `character` is hexadecimal. + */ +function hexadecimal(character) { + var code = typeof character === 'string' ? + character.charCodeAt(0) : character; + + return (code >= 97 /* a */ && code <= 102 /* z */) || + (code >= 65 /* A */ && code <= 70 /* Z */) || + (code >= 48 /* A */ && code <= 57 /* Z */); +} diff --git a/tools/eslint/node_modules/is-hexadecimal/package.json b/tools/eslint/node_modules/is-hexadecimal/package.json new file mode 100644 index 00000000000000..51eae8673e6664 --- /dev/null +++ b/tools/eslint/node_modules/is-hexadecimal/package.json @@ -0,0 +1,109 @@ +{ + "_from": "is-hexadecimal@^1.0.0", + "_id": "is-hexadecimal@1.0.0", + "_inBundle": false, + "_integrity": "sha1-XEWXcdKvmi45Ungf1U/LG8/kETw=", + "_location": "/is-hexadecimal", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-hexadecimal@^1.0.0", + "name": "is-hexadecimal", + "escapedName": "is-hexadecimal", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/parse-entities" + ], + "_resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.0.tgz", + "_shasum": "5c459771d2af9a2e3952781fd54fcb1bcfe4113c", + "_spec": "is-hexadecimal@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/is-hexadecimal/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Check if a character is hexadecimal", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/is-hexadecimal#readme", + "keywords": [ + "string", + "character", + "char", + "code", + "hexadecimal" + ], + "license": "MIT", + "name": "is-hexadecimal", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/is-hexadecimal.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s isHexadecimal > is-hexadecimal.js", + "build-mangle": "esmangle < is-hexadecimal.js > is-hexadecimal.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "is-hexadecimal.js", + "is-hexadecimal.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/is-hexadecimal/readme.md b/tools/eslint/node_modules/is-hexadecimal/readme.md new file mode 100644 index 00000000000000..19640e3668278b --- /dev/null +++ b/tools/eslint/node_modules/is-hexadecimal/readme.md @@ -0,0 +1,58 @@ +# is-hexadecimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +Check if a character is hexadecimal. + +## Installation + +[npm][npm-install]: + +```bash +npm install is-hexadecimal +``` + +## Usage + +Dependencies: + +```javascript +var hexadecimal = require('is-hexadecimal'); + +hexadecimal('a'); // true +hexadecimal('0'); // true +hexadecimal('G'); // false +hexadecimal('💩'); // false +``` + +## API + +### `hexadecimal(character)` + +Check whether the given character code (`number`), or the character +code at the first position (`string`), is hexadecimal. + +## Related + +* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`is-decimal`](https://github.com/wooorm/is-decimal) + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/is-hexadecimal.svg + +[travis]: https://travis-ci.org/wooorm/is-hexadecimal + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-hexadecimal.svg + +[codecov]: https://codecov.io/github/wooorm/is-hexadecimal + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/is-plain-obj/index.js b/tools/eslint/node_modules/is-plain-obj/index.js new file mode 100644 index 00000000000000..0d1ba9eeb89723 --- /dev/null +++ b/tools/eslint/node_modules/is-plain-obj/index.js @@ -0,0 +1,7 @@ +'use strict'; +var toString = Object.prototype.toString; + +module.exports = function (x) { + var prototype; + return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); +}; diff --git a/tools/eslint/node_modules/is-plain-obj/license b/tools/eslint/node_modules/is-plain-obj/license new file mode 100644 index 00000000000000..654d0bfe943437 --- /dev/null +++ b/tools/eslint/node_modules/is-plain-obj/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-plain-obj/package.json b/tools/eslint/node_modules/is-plain-obj/package.json new file mode 100644 index 00000000000000..48d8594ef0fc80 --- /dev/null +++ b/tools/eslint/node_modules/is-plain-obj/package.json @@ -0,0 +1,68 @@ +{ + "_from": "is-plain-obj@^1.1.0", + "_id": "is-plain-obj@1.1.0", + "_inBundle": false, + "_integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "_location": "/is-plain-obj", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-plain-obj@^1.1.0", + "name": "is-plain-obj", + "escapedName": "is-plain-obj", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/unified" + ], + "_resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "_shasum": "71a50c8429dfca773c92a390a4a03b39fcd51d3e", + "_spec": "is-plain-obj@^1.1.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is-plain-obj/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Check if a value is a plain object", + "devDependencies": { + "ava": "0.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/is-plain-obj#readme", + "keywords": [ + "obj", + "object", + "is", + "check", + "test", + "type", + "plain", + "vanilla", + "pure", + "simple" + ], + "license": "MIT", + "name": "is-plain-obj", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is-plain-obj.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.1.0" +} diff --git a/tools/eslint/node_modules/is-plain-obj/readme.md b/tools/eslint/node_modules/is-plain-obj/readme.md new file mode 100644 index 00000000000000..269e56aeff0646 --- /dev/null +++ b/tools/eslint/node_modules/is-plain-obj/readme.md @@ -0,0 +1,35 @@ +# is-plain-obj [![Build Status](https://travis-ci.org/sindresorhus/is-plain-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/is-plain-obj) + +> Check if a value is a plain object + +An object is plain if it's created by either `{}`, `new Object()` or `Object.create(null)`. + + +## Install + +``` +$ npm install --save is-plain-obj +``` + + +## Usage + +```js +var isPlainObj = require('is-plain-obj'); + +isPlainObj({foo: 'bar'}); +//=> true + +isPlainObj([1, 2, 3]); +//=> false +``` + + +## Related + +- [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/tools/eslint/node_modules/is-whitespace-character/LICENSE b/tools/eslint/node_modules/is-whitespace-character/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/is-whitespace-character/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-whitespace-character/history.md b/tools/eslint/node_modules/is-whitespace-character/history.md new file mode 100644 index 00000000000000..674e111c479ebb --- /dev/null +++ b/tools/eslint/node_modules/is-whitespace-character/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-12 +================== diff --git a/tools/eslint/node_modules/is-whitespace-character/index.js b/tools/eslint/node_modules/is-whitespace-character/index.js new file mode 100644 index 00000000000000..f9e23df3f72b0b --- /dev/null +++ b/tools/eslint/node_modules/is-whitespace-character/index.js @@ -0,0 +1,33 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module is-whitespace-character + * @fileoverview Check if a character is a whitespace character. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Expose. */ +module.exports = whitespace; + +/* Methods. */ +var fromCode = String.fromCharCode; + +/* Constants. */ +var re = /\s/; + +/** + * Check whether the given character code, or the character + * code at the first character, is a whitespace character. + * + * @param {string|number} character + * @return {boolean} - Whether `character` is a whitespaces character. + */ +function whitespace(character) { + return re.test( + typeof character === 'number' ? fromCode(character) : character.charAt(0) + ); +} diff --git a/tools/eslint/node_modules/is-whitespace-character/package.json b/tools/eslint/node_modules/is-whitespace-character/package.json new file mode 100644 index 00000000000000..4720e68f99190c --- /dev/null +++ b/tools/eslint/node_modules/is-whitespace-character/package.json @@ -0,0 +1,111 @@ +{ + "_from": "is-whitespace-character@^1.0.0", + "_id": "is-whitespace-character@1.0.0", + "_inBundle": false, + "_integrity": "sha1-u/SoN2Tq0NRRvsKlUhjpGWGtwnU=", + "_location": "/is-whitespace-character", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-whitespace-character@^1.0.0", + "name": "is-whitespace-character", + "escapedName": "is-whitespace-character", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.0.tgz", + "_shasum": "bbf4a83764ead0d451bec2a55218e91961adc275", + "_spec": "is-whitespace-character@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/is-whitespace-character/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Check if a character is a whitespace character", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/is-whitespace-character#readme", + "keywords": [ + "string", + "character", + "char", + "code", + "whitespace", + "white", + "space" + ], + "license": "MIT", + "name": "is-whitespace-character", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/is-whitespace-character.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s isWhitespaceCharacter > is-whitespace-character.js", + "build-mangle": "esmangle < is-whitespace-character.js > is-whitespace-character.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "is-whitespace-character.js", + "is-whitespace-character.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/is-whitespace-character/readme.md b/tools/eslint/node_modules/is-whitespace-character/readme.md new file mode 100644 index 00000000000000..c2ac49c21300e8 --- /dev/null +++ b/tools/eslint/node_modules/is-whitespace-character/readme.md @@ -0,0 +1,63 @@ +# is-whitespace-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +Check if a character is a whitespace character: `\s`, which equals +all Unicode Space Separators (including `[ \t\v\f]`), the BOM +(`\uFEFF`), and line terminator (`[\n\r\u2028\u2029]`). + +## Installation + +[npm][npm-install]: + +```bash +npm install is-whitespace-character +``` + +## Usage + +```javascript +var whitespace = require('is-whitespace-character'); + +whitespace(' '); // true +whitespace('\n'); // true +whitespace('\ufeff'); // true +whitespace('_'); // false +whitespace('a'); // true +whitespace('💩'); // false +``` + +## API + +### `whitespaceCharacter(character)` + +Check whether the given character code (`number`), or the character +code at the first position (`string`), is a whitespace character. + +## Related + +* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`is-alphanumerical`](https://github.com/wooorm/is-alphanumerical) +* [`is-decimal`](https://github.com/wooorm/is-decimal) +* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) +* [`is-word-character`](https://github.com/wooorm/is-word-character) + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/is-whitespace-character.svg + +[travis]: https://travis-ci.org/wooorm/is-whitespace-character + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-whitespace-character.svg + +[codecov]: https://codecov.io/github/wooorm/is-whitespace-character + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/is-word-character/LICENSE b/tools/eslint/node_modules/is-word-character/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/is-word-character/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/is-word-character/history.md b/tools/eslint/node_modules/is-word-character/history.md new file mode 100644 index 00000000000000..674e111c479ebb --- /dev/null +++ b/tools/eslint/node_modules/is-word-character/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-12 +================== diff --git a/tools/eslint/node_modules/is-word-character/index.js b/tools/eslint/node_modules/is-word-character/index.js new file mode 100644 index 00000000000000..c2f9c3fd05992c --- /dev/null +++ b/tools/eslint/node_modules/is-word-character/index.js @@ -0,0 +1,33 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module is-word-character + * @fileoverview Check if a character is a word character. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Expose. */ +module.exports = wordCharacter; + +/* Methods. */ +var fromCode = String.fromCharCode; + +/* Constants. */ +var re = /\w/; + +/** + * Check whether the given character code, or the character + * code at the first character, is a word character. + * + * @param {string|number} character + * @return {boolean} - Whether `character` is a word character. + */ +function wordCharacter(character) { + return re.test( + typeof character === 'number' ? fromCode(character) : character.charAt(0) + ); +} diff --git a/tools/eslint/node_modules/is-word-character/package.json b/tools/eslint/node_modules/is-word-character/package.json new file mode 100644 index 00000000000000..894b1e46745966 --- /dev/null +++ b/tools/eslint/node_modules/is-word-character/package.json @@ -0,0 +1,109 @@ +{ + "_from": "is-word-character@^1.0.0", + "_id": "is-word-character@1.0.0", + "_inBundle": false, + "_integrity": "sha1-o6nl3a1wxcLuNvSpz8mlP0RTUkc=", + "_location": "/is-word-character", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-word-character@^1.0.0", + "name": "is-word-character", + "escapedName": "is-word-character", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.0.tgz", + "_shasum": "a3a9e5ddad70c5c2ee36f4a9cfc9a53f44535247", + "_spec": "is-word-character@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/is-word-character/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Check if a character is a word character", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/is-word-character#readme", + "keywords": [ + "string", + "character", + "char", + "code", + "word" + ], + "license": "MIT", + "name": "is-word-character", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/is-word-character.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s isWordCharacter > is-word-character.js", + "build-mangle": "esmangle < is-word-character.js > is-word-character.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "is-word-character.js", + "is-word-character.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/is-word-character/readme.md b/tools/eslint/node_modules/is-word-character/readme.md new file mode 100644 index 00000000000000..4a0a25fd299d77 --- /dev/null +++ b/tools/eslint/node_modules/is-word-character/readme.md @@ -0,0 +1,62 @@ +# is-word-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +Check if a character is a word character (`\w`, which equals +`[a-zA-Z0-9_]`). + +## Installation + +[npm][npm-install]: + +```bash +npm install is-word-character +``` + +## Usage + +```javascript +var wordCharacter = require('is-word-character'); + +wordCharacter('a'); // true +wordCharacter('Z'); // true +wordCharacter('0'); // true +wordCharacter('_'); // true +wordCharacter(' '); // false +wordCharacter('💩'); // false +``` + +## API + +### `wordCharacter(character)` + +Check whether the given character code (`number`), or the character +code at the first position (`string`), is a word character. + +## Related + +* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) +* [`is-alphanumerical`](https://github.com/wooorm/is-alphanumerical) +* [`is-decimal`](https://github.com/wooorm/is-decimal) +* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) +* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/is-word-character.svg + +[travis]: https://travis-ci.org/wooorm/is-word-character + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-word-character.svg + +[codecov]: https://codecov.io/github/wooorm/is-word-character + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/markdown-escapes/LICENSE b/tools/eslint/node_modules/markdown-escapes/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/markdown-escapes/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/markdown-escapes/history.md b/tools/eslint/node_modules/markdown-escapes/history.md new file mode 100644 index 00000000000000..f20d5035693db5 --- /dev/null +++ b/tools/eslint/node_modules/markdown-escapes/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-16 +================== diff --git a/tools/eslint/node_modules/markdown-escapes/index.js b/tools/eslint/node_modules/markdown-escapes/index.js new file mode 100644 index 00000000000000..38f81193e81238 --- /dev/null +++ b/tools/eslint/node_modules/markdown-escapes/index.js @@ -0,0 +1,75 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module markdown-escapes + * @fileoverview List of escapable characters in markdown. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Expose. */ +module.exports = escapes; + +/* Characters. */ +var defaults = [ + '\\', + '`', + '*', + '{', + '}', + '[', + ']', + '(', + ')', + '#', + '+', + '-', + '.', + '!', + '_', + '>' +]; + +var gfm = defaults.concat(['~', '|']); + +var commonmark = gfm.concat([ + '\n', + '"', + '$', + '%', + '&', + '\'', + ',', + '/', + ':', + ';', + '<', + '=', + '?', + '@', + '^' +]); + +/* Expose characters. */ +escapes.default = defaults; +escapes.gfm = gfm; +escapes.commonmark = commonmark; + +/** + * Get markdown escapes. + * + * @param {Object?} [options] - Configuration. + * @return {Array.} - Escapes. + */ +function escapes(options) { + var settings = options || {}; + + if (settings.commonmark) { + return commonmark; + } + + return settings.gfm ? gfm : defaults; +} diff --git a/tools/eslint/node_modules/markdown-escapes/package.json b/tools/eslint/node_modules/markdown-escapes/package.json new file mode 100644 index 00000000000000..e36f7e19963896 --- /dev/null +++ b/tools/eslint/node_modules/markdown-escapes/package.json @@ -0,0 +1,109 @@ +{ + "_from": "markdown-escapes@^1.0.0", + "_id": "markdown-escapes@1.0.0", + "_inBundle": false, + "_integrity": "sha1-yMoZ8dlNaCRZ4Kk8htsnp+9xayM=", + "_location": "/markdown-escapes", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "markdown-escapes@^1.0.0", + "name": "markdown-escapes", + "escapedName": "markdown-escapes", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.0.tgz", + "_shasum": "c8ca19f1d94d682459e0a93c86db27a7ef716b23", + "_spec": "markdown-escapes@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/markdown-escapes/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "List of escapable characters in markdown", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/markdown-escapes#readme", + "keywords": [ + "markdown", + "escape", + "pedantic", + "gfm", + "commonmark" + ], + "license": "MIT", + "name": "markdown-escapes", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/markdown-escapes.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s markdownEscapes > markdown-escapes.js", + "build-mangle": "esmangle < markdown-escapes.js > markdown-escapes.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "markdown-escapes.js", + "markdown-escapes.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/markdown-escapes/readme.md b/tools/eslint/node_modules/markdown-escapes/readme.md new file mode 100644 index 00000000000000..8ab33f397d289d --- /dev/null +++ b/tools/eslint/node_modules/markdown-escapes/readme.md @@ -0,0 +1,71 @@ +# markdown-escapes [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +List of escapable characters in markdown. + +## Installation + +[npm][npm-install]: + +```bash +npm install markdown-escapes +``` + +## Usage + +```javascript +var escapes = require('markdown-escapes'); + +// Access by property: +escapes.commonmark; +// ['\\', '`', ..., '@', '^'] + +// Access by options object: +escapes({gfm: true}); +// ['\\', '`', ..., '~', '|'] +``` + +## API + +### `escapes([options])` + +Get escapes. Supports `options.commonmark` and `options.gfm`, which +when `true` returns the extra escape characters supported by those +flavours. + +###### Returns + +`Array.`. + +### `escapes.default` + +List of default escapable characters. + +### `escapes.gfm` + +List of escapable characters in GFM (which includes all `default`s). + +### `escapes.commonmark` + +List of escapable characters in CommonMark (which includes all `gfm`s). + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/markdown-escapes.svg + +[travis]: https://travis-ci.org/wooorm/markdown-escapes + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-escapes.svg + +[codecov]: https://codecov.io/github/wooorm/markdown-escapes + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/parse-entities/LICENSE b/tools/eslint/node_modules/parse-entities/LICENSE new file mode 100644 index 00000000000000..611b67581bb8e2 --- /dev/null +++ b/tools/eslint/node_modules/parse-entities/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/parse-entities/index.js b/tools/eslint/node_modules/parse-entities/index.js new file mode 100644 index 00000000000000..f2c9e02a52d4bf --- /dev/null +++ b/tools/eslint/node_modules/parse-entities/index.js @@ -0,0 +1,473 @@ +'use strict'; + +/* Dependencies. */ +var characterEntities = require('character-entities'); +var legacy = require('character-entities-legacy'); +var invalid = require('character-reference-invalid'); +var decimal = require('is-decimal'); +var hexadecimal = require('is-hexadecimal'); +var alphanumerical = require('is-alphanumerical'); + +/* Expose. */ +module.exports = wrapper; + +/* Methods. */ +var own = {}.hasOwnProperty; +var fromCharCode = String.fromCharCode; +var noop = Function.prototype; + +/* Characters. */ +var REPLACEMENT = '\uFFFD'; +var FORM_FEED = '\f'; +var AMPERSAND = '&'; +var OCTOTHORP = '#'; +var SEMICOLON = ';'; +var NEWLINE = '\n'; +var X_LOWER = 'x'; +var X_UPPER = 'X'; +var SPACE = ' '; +var LESS_THAN = '<'; +var EQUAL = '='; +var EMPTY = ''; +var TAB = '\t'; + +/* Default settings. */ +var defaults = { + warning: null, + reference: null, + text: null, + warningContext: null, + referenceContext: null, + textContext: null, + position: {}, + additional: null, + attribute: false, + nonTerminated: true +}; + +/* Reference types. */ +var NAMED = 'named'; +var HEXADECIMAL = 'hexadecimal'; +var DECIMAL = 'decimal'; + +/* Map of bases. */ +var BASE = {}; + +BASE[HEXADECIMAL] = 16; +BASE[DECIMAL] = 10; + +/* Map of types to tests. Each type of character reference + * accepts different characters. This test is used to + * detect whether a reference has ended (as the semicolon + * is not strictly needed). */ +var TESTS = {}; + +TESTS[NAMED] = alphanumerical; +TESTS[DECIMAL] = decimal; +TESTS[HEXADECIMAL] = hexadecimal; + +/* Warning messages. */ +var NAMED_NOT_TERMINATED = 1; +var NUMERIC_NOT_TERMINATED = 2; +var NAMED_EMPTY = 3; +var NUMERIC_EMPTY = 4; +var NAMED_UNKNOWN = 5; +var NUMERIC_DISALLOWED = 6; +var NUMERIC_PROHIBITED = 7; + +var NUMERIC_REFERENCE = 'Numeric character references'; +var NAMED_REFERENCE = 'Named character references'; +var TERMINATED = ' must be terminated by a semicolon'; +var VOID = ' cannot be empty'; + +var MESSAGES = {}; + +MESSAGES[NAMED_NOT_TERMINATED] = NAMED_REFERENCE + TERMINATED; +MESSAGES[NUMERIC_NOT_TERMINATED] = NUMERIC_REFERENCE + TERMINATED; +MESSAGES[NAMED_EMPTY] = NAMED_REFERENCE + VOID; +MESSAGES[NUMERIC_EMPTY] = NUMERIC_REFERENCE + VOID; +MESSAGES[NAMED_UNKNOWN] = NAMED_REFERENCE + ' must be known'; +MESSAGES[NUMERIC_DISALLOWED] = NUMERIC_REFERENCE + ' cannot be disallowed'; +MESSAGES[NUMERIC_PROHIBITED] = NUMERIC_REFERENCE + ' cannot be outside the ' + + 'permissible Unicode range'; + +/* Wrap to ensure clean parameters are given to `parse`. */ +function wrapper(value, options) { + var settings = {}; + var option; + var key; + + if (!options) { + options = {}; + } + + for (key in defaults) { + option = options[key]; + settings[key] = option === null || option === undefined ? defaults[key] : option; + } + + if (settings.position.indent || settings.position.start) { + settings.indent = settings.position.indent || []; + settings.position = settings.position.start; + } + + return parse(value, settings); +} + +/* Parse entities. */ +function parse(value, settings) { + var additional = settings.additional; + var nonTerminated = settings.nonTerminated; + var handleText = settings.text; + var handleReference = settings.reference; + var handleWarning = settings.warning; + var textContext = settings.textContext; + var referenceContext = settings.referenceContext; + var warningContext = settings.warningContext; + var pos = settings.position; + var indent = settings.indent || []; + var length = value.length; + var index = 0; + var lines = -1; + var column = pos.column || 1; + var line = pos.line || 1; + var queue = EMPTY; + var result = []; + var entityCharacters; + var terminated; + var characters; + var character; + var reference; + var following; + var warning; + var reason; + var output; + var entity; + var begin; + var start; + var type; + var test; + var prev; + var next; + var diff; + var end; + + /* Cache the current point. */ + prev = now(); + + /* Wrap `handleWarning`. */ + warning = handleWarning ? parseError : noop; + + /* Ensure the algorithm walks over the first character + * and the end (inclusive). */ + index--; + length++; + + while (++index < length) { + /* If the previous character was a newline. */ + if (character === NEWLINE) { + column = indent[lines] || 1; + } + + character = at(index); + + /* Handle anything other than an ampersand, + * including newlines and EOF. */ + if (character !== AMPERSAND) { + if (character === NEWLINE) { + line++; + lines++; + column = 0; + } + + if (character) { + queue += character; + column++; + } else { + flush(); + } + } else { + following = at(index + 1); + + /* The behaviour depends on the identity of the next + * character. */ + if ( + following === TAB || + following === NEWLINE || + following === FORM_FEED || + following === SPACE || + following === LESS_THAN || + following === AMPERSAND || + following === EMPTY || + (additional && following === additional) + ) { + /* Not a character reference. No characters + * are consumed, and nothing is returned. + * This is not an error, either. */ + queue += character; + column++; + + continue; + } + + start = index + 1; + begin = start; + end = start; + + /* Numerical entity. */ + if (following !== OCTOTHORP) { + type = NAMED; + } else { + end = ++begin; + + /* The behaviour further depends on the + * character after the U+0023 NUMBER SIGN. */ + following = at(end); + + if (following === X_LOWER || following === X_UPPER) { + /* ASCII hex digits. */ + type = HEXADECIMAL; + end = ++begin; + } else { + /* ASCII digits. */ + type = DECIMAL; + } + } + + entityCharacters = EMPTY; + entity = EMPTY; + characters = EMPTY; + test = TESTS[type]; + end--; + + while (++end < length) { + following = at(end); + + if (!test(following)) { + break; + } + + characters += following; + + /* Check if we can match a legacy named + * reference. If so, we cache that as the + * last viable named reference. This + * ensures we do not need to walk backwards + * later. */ + if (type === NAMED && own.call(legacy, characters)) { + entityCharacters = characters; + entity = legacy[characters]; + } + } + + terminated = at(end) === SEMICOLON; + + if (terminated) { + end++; + + if (type === NAMED && own.call(characterEntities, characters)) { + entityCharacters = characters; + entity = characterEntities[characters]; + } + } + + diff = 1 + end - start; + + if (!terminated && !nonTerminated) { + /* Empty. */ + } else if (!characters) { + /* An empty (possible) entity is valid, unless + * its numeric (thus an ampersand followed by + * an octothorp). */ + if (type !== NAMED) { + warning(NUMERIC_EMPTY, diff); + } + } else if (type === NAMED) { + /* An ampersand followed by anything + * unknown, and not terminated, is invalid. */ + if (terminated && !entity) { + warning(NAMED_UNKNOWN, 1); + } else { + /* If theres something after an entity + * name which is not known, cap the + * reference. */ + if (entityCharacters !== characters) { + end = begin + entityCharacters.length; + diff = 1 + end - begin; + terminated = false; + } + + /* If the reference is not terminated, + * warn. */ + if (!terminated) { + reason = entityCharacters ? + NAMED_NOT_TERMINATED : + NAMED_EMPTY; + + if (!settings.attribute) { + warning(reason, diff); + } else { + following = at(end); + + if (following === EQUAL) { + warning(reason, diff); + entity = null; + } else if (alphanumerical(following)) { + entity = null; + } else { + warning(reason, diff); + } + } + } + } + + reference = entity; + } else { + if (!terminated) { + /* All non-terminated numeric entities are + * not rendered, and trigger a warning. */ + warning(NUMERIC_NOT_TERMINATED, diff); + } + + /* When terminated and number, parse as + * either hexadecimal or decimal. */ + reference = parseInt(characters, BASE[type]); + + /* Trigger a warning when the parsed number + * is prohibited, and replace with + * replacement character. */ + if (isProhibited(reference)) { + warning(NUMERIC_PROHIBITED, diff); + + reference = REPLACEMENT; + } else if (reference in invalid) { + /* Trigger a warning when the parsed number + * is disallowed, and replace by an + * alternative. */ + warning(NUMERIC_DISALLOWED, diff); + + reference = invalid[reference]; + } else { + /* Parse the number. */ + output = EMPTY; + + /* Trigger a warning when the parsed + * number should not be used. */ + if (isWarning(reference)) { + warning(NUMERIC_DISALLOWED, diff); + } + + /* Stringify the number. */ + if (reference > 0xFFFF) { + reference -= 0x10000; + output += fromCharCode((reference >>> (10 & 0x3FF)) | 0xD800); + reference = 0xDC00 | (reference & 0x3FF); + } + + reference = output + fromCharCode(reference); + } + } + + /* If we could not find a reference, queue the + * checked characters (as normal characters), + * and move the pointer to their end. This is + * possible because we can be certain neither + * newlines nor ampersands are included. */ + if (!reference) { + characters = value.slice(start - 1, end); + queue += characters; + column += characters.length; + index = end - 1; + } else { + /* Found it! First eat the queued + * characters as normal text, then eat + * an entity. */ + flush(); + + prev = now(); + index = end - 1; + column += end - start + 1; + result.push(reference); + next = now(); + next.offset++; + + if (handleReference) { + handleReference.call(referenceContext, reference, { + start: prev, + end: next + }, value.slice(start - 1, end)); + } + + prev = next; + } + } + } + + /* Return the reduced nodes, and any possible warnings. */ + return result.join(EMPTY); + + /* Get current position. */ + function now() { + return { + line: line, + column: column, + offset: index + (pos.offset || 0) + }; + } + + /* “Throw” a parse-error: a warning. */ + function parseError(code, offset) { + var position = now(); + + position.column += offset; + position.offset += offset; + + handleWarning.call(warningContext, MESSAGES[code], position, code); + } + + /* Get character at position. */ + function at(position) { + return value.charAt(position); + } + + /* Flush `queue` (normal text). Macro invoked before + * each entity and at the end of `value`. + * Does nothing when `queue` is empty. */ + function flush() { + if (queue) { + result.push(queue); + + if (handleText) { + handleText.call(textContext, queue, { + start: prev, + end: now() + }); + } + + queue = EMPTY; + } + } +} + +/* Check if `character` is outside the permissible + * unicode range. */ +function isProhibited(code) { + return (code >= 0xD800 && code <= 0xDFFF) || (code > 0x10FFFF); +} + +/* Check if `character` is disallowed. */ +function isWarning(code) { + if ( + (code >= 0x0001 && code <= 0x0008) || + code === 0x000B || + (code >= 0x000D && code <= 0x001F) || + (code >= 0x007F && code <= 0x009F) || + (code >= 0xFDD0 && code <= 0xFDEF) || + (code & 0xFFFF) === 0xFFFF || + (code & 0xFFFF) === 0xFFFE + ) { + return true; + } + + return false; +} diff --git a/tools/eslint/node_modules/parse-entities/package.json b/tools/eslint/node_modules/parse-entities/package.json new file mode 100644 index 00000000000000..bff817d457d45b --- /dev/null +++ b/tools/eslint/node_modules/parse-entities/package.json @@ -0,0 +1,113 @@ +{ + "_from": "parse-entities@^1.0.2", + "_id": "parse-entities@1.1.1", + "_inBundle": false, + "_integrity": "sha1-gRLYhHExnyerrk1klksSL+ThuJA=", + "_location": "/parse-entities", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "parse-entities@^1.0.2", + "name": "parse-entities", + "escapedName": "parse-entities", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.1.tgz", + "_shasum": "8112d88471319f27abae4d64964b122fe4e1b890", + "_spec": "parse-entities@^1.0.2", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/parse-entities/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" + }, + "deprecated": false, + "description": "Parse HTML character references: fast, spec-compliant, positional information", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.0", + "nyc": "^11.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.2.0", + "xo": "^0.18.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/parse-entities#readme", + "keywords": [ + "parse", + "html", + "character", + "reference", + "entity", + "entities" + ], + "license": "MIT", + "name": "parse-entities", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/parse-entities.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s parseEntities > parse-entities.js", + "build-mangle": "esmangle parse-entities.js > parse-entities.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test.js", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.1", + "xo": { + "space": true, + "esnext": false, + "rules": { + "guard-for-in": "off", + "no-negated-condition": "off", + "max-depth": "off", + "complexity": "off" + }, + "ignores": [ + "parse-entities.js" + ] + } +} diff --git a/tools/eslint/node_modules/parse-entities/readme.md b/tools/eslint/node_modules/parse-entities/readme.md new file mode 100644 index 00000000000000..9361031183df9b --- /dev/null +++ b/tools/eslint/node_modules/parse-entities/readme.md @@ -0,0 +1,157 @@ +# parse-entities [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] + +Parse HTML character references: fast, spec-compliant, positional +information. + +## Installation + +[npm][]: + +```bash +npm install parse-entities +``` + +## Usage + +```js +var decode = require('parse-entities'); + +decode('alpha & bravo'); +//=> alpha & bravo + +decode('charlie ©cat; delta'); +//=> charlie ©cat; delta + +decode('echo © foxtrot ≠ golf 𝌆 hotel'); +//=> echo © foxtrot ≠ golf 𝌆 hotel +``` + +## API + +## `parseEntities(value[, options])` + +###### `options` + +* `additional` (`string`, optional, default: `''`) + — Additional character to accept when following an ampersand (without + error) +* `attribute` (`boolean`, optional, default: `false`) + — Whether to parse `value` as an attribute value +* `nonTerminated` (`boolean`, default: `true`) + — Whether to allow non-terminated entities, such as `©cat` to + `©cat`. This behaviour is spec-compliant but can lead to unexpected + results +* `warning` ([`Function`][warning], optional) + — Error handler +* `text` ([`Function`][text], optional) + — Text handler +* `reference` ([`Function`][reference], + optional) — Reference handler +* `warningContext` (`'*'`, optional) + — Context used when invoking `warning` +* `textContext` (`'*'`, optional) + — Context used when invoking `text` +* `referenceContext` (`'*'`, optional) + — Context used when invoking `reference` +* `position` (`Location` or `Position`, optional) + — Starting `position` of `value`, useful when dealing with values + nested in some sort of syntax tree. The default is: + + ```json + { + "start": { + "line": 1, + "column": 1, + "offset": 0 + }, + "indent": [] + } + ``` + +###### Returns + +`string` — Decoded `value`. + +### `function warning(reason, position, code)` + +Error handler. + +###### Context + +`this` refers to `warningContext` when given to `parseEntities`. + +###### Parameters + +* `reason` (`string`) + — Reason (human-readable) for triggering a parse error +* `position` (`Position`) + — Place at which the parse error occurred +* `code` (`number`) + — Identifier of reason for triggering a parse error + +The following codes are used: + +| Code | Example | Note | +| ---- | ------------------ | --------------------------------------------- | +| `1` | `foo & bar` | Missing semicolon (named) | +| `2` | `foo { bar` | Missing semicolon (numeric) | +| `3` | `Foo &bar baz` | Ampersand did not start a reference | +| `4` | `Foo &#` | Empty reference | +| `5` | `Foo &bar; baz` | Unknown entity | +| `6` | `Foo € baz` | [Disallowed reference][invalid] | +| `7` | `Foo � baz` | Prohibited: outside permissible unicode range | + +###### `function text(value, location)` + +Text handler. + +###### Context + +`this` refers to `textContext` when given to `parseEntities`. + +###### Parameters + +* `value` (`string`) — String of content +* `location` (`Location`) — Location at which `value` starts and ends + +### `function reference(value, location, source)` + +Character reference handler. + +###### Context + +`this` refers to `referenceContext` when given to `parseEntities`. + +###### Parameters + +* `value` (`string`) — Encoded character reference +* `location` (`Location`) — Location at which `value` starts and ends +* `source` (`Location`) — Source of character reference + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/parse-entities.svg + +[build-status]: https://travis-ci.org/wooorm/parse-entities + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/parse-entities.svg + +[coverage-status]: https://codecov.io/github/wooorm/parse-entities + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[warning]: #function-warningreason-position-code + +[text]: #function-textvalue-location + +[reference]: #function-referencevalue-location-source + +[invalid]: https://github.com/wooorm/character-reference-invalid diff --git a/tools/eslint/node_modules/remark-parse/index.js b/tools/eslint/node_modules/remark-parse/index.js new file mode 100644 index 00000000000000..1579e35518c582 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/index.js @@ -0,0 +1,14 @@ +'use strict'; + +var unherit = require('unherit'); +var xtend = require('xtend'); +var Parser = require('./lib/parser.js'); + +module.exports = parse; +parse.Parser = Parser; + +function parse(options) { + var Local = unherit(Parser); + Local.prototype.options = xtend(Local.prototype.options, this.data('settings'), options); + this.Parser = Local; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/block-elements.json b/tools/eslint/node_modules/remark-parse/lib/block-elements.json new file mode 100644 index 00000000000000..2d13b561792d65 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/block-elements.json @@ -0,0 +1,68 @@ +[ + "address", + "article", + "aside", + "base", + "basefont", + "blockquote", + "body", + "caption", + "center", + "col", + "colgroup", + "dd", + "details", + "dialog", + "dir", + "div", + "dl", + "dt", + "fieldset", + "figcaption", + "figure", + "footer", + "form", + "frame", + "frameset", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hgroup", + "hr", + "html", + "iframe", + "legend", + "li", + "link", + "main", + "menu", + "menuitem", + "meta", + "nav", + "noframes", + "ol", + "optgroup", + "option", + "p", + "param", + "pre", + "section", + "source", + "title", + "summary", + "table", + "tbody", + "td", + "tfoot", + "th", + "thead", + "title", + "tr", + "track", + "ul" +] diff --git a/tools/eslint/node_modules/remark-parse/lib/decode.js b/tools/eslint/node_modules/remark-parse/lib/decode.js new file mode 100644 index 00000000000000..75116385eed36c --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/decode.js @@ -0,0 +1,71 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:decode + * @fileoverview Decode entities. + */ + +'use strict'; + +var entities = require('parse-entities'); + +module.exports = factory; + +/* Factory to create an entity decoder. */ +function factory(ctx) { + decoder.raw = decodeRaw; + + return decoder; + + /* Normalize `position` to add an `indent`. */ + function normalize(position) { + var offsets = ctx.offset; + var line = position.line; + var result = []; + + while (++line) { + if (!(line in offsets)) { + break; + } + + result.push((offsets[line] || 0) + 1); + } + + return { + start: position, + indent: result + }; + } + + /* Handle a warning. + * See https://github.com/wooorm/parse-entities + * for the warnings. */ + function handleWarning(reason, position, code) { + if (code === 3) { + return; + } + + ctx.file.message(reason, position); + } + + /* Decode `value` (at `position`) into text-nodes. */ + function decoder(value, position, handler) { + entities(value, { + position: normalize(position), + warning: handleWarning, + text: handler, + reference: handler, + textContext: ctx, + referenceContext: ctx + }); + } + + /* Decode `value` (at `position`) into a string. */ + function decodeRaw(value, position) { + return entities(value, { + position: normalize(position), + warning: handleWarning + }); + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/defaults.js b/tools/eslint/node_modules/remark-parse/lib/defaults.js new file mode 100644 index 00000000000000..ccb3fabd485901 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/defaults.js @@ -0,0 +1,21 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:defaults + * @fileoverview Default options for `parse`. + */ + +'use strict'; + +/* Expose. */ +module.exports = { + position: true, + gfm: true, + yaml: true, + commonmark: false, + footnotes: false, + pedantic: false, + blocks: require('./block-elements'), + breaks: false +}; diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/break.js b/tools/eslint/node_modules/remark-parse/lib/locate/break.js new file mode 100644 index 00000000000000..b5550e10076605 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/break.js @@ -0,0 +1,25 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:break + * @fileoverview Locate a break. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var index = value.indexOf('\n', fromIndex); + + while (index > fromIndex) { + if (value.charAt(index - 1) !== ' ') { + break; + } + + index--; + } + + return index; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/code-inline.js b/tools/eslint/node_modules/remark-parse/lib/locate/code-inline.js new file mode 100644 index 00000000000000..010e74dcec4b00 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/code-inline.js @@ -0,0 +1,15 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:code-inline + * @fileoverview Locate inline code. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('`', fromIndex); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/delete.js b/tools/eslint/node_modules/remark-parse/lib/locate/delete.js new file mode 100644 index 00000000000000..1a892e1be7716e --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/delete.js @@ -0,0 +1,15 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:delete + * @fileoverview Locate strikethrough. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('~~', fromIndex); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/emphasis.js b/tools/eslint/node_modules/remark-parse/lib/locate/emphasis.js new file mode 100644 index 00000000000000..270daad0f9e00c --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/emphasis.js @@ -0,0 +1,26 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:emphasis + * @fileoverview Locate italics / emphasis. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var asterisk = value.indexOf('*', fromIndex); + var underscore = value.indexOf('_', fromIndex); + + if (underscore === -1) { + return asterisk; + } + + if (asterisk === -1) { + return underscore; + } + + return underscore < asterisk ? underscore : asterisk; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/escape.js b/tools/eslint/node_modules/remark-parse/lib/locate/escape.js new file mode 100644 index 00000000000000..45f9b449a7873c --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/escape.js @@ -0,0 +1,15 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:escape + * @fileoverview Locate an escape. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('\\', fromIndex); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/link.js b/tools/eslint/node_modules/remark-parse/lib/locate/link.js new file mode 100644 index 00000000000000..dab2a3c54f1774 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/link.js @@ -0,0 +1,24 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:link + * @fileoverview Locate a link. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var link = value.indexOf('[', fromIndex); + var image = value.indexOf('![', fromIndex); + + if (image === -1) { + return link; + } + + /* Link can never be `-1` if an image is found, so we don’t need + * to check for that :) */ + return link < image ? link : image; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/strong.js b/tools/eslint/node_modules/remark-parse/lib/locate/strong.js new file mode 100644 index 00000000000000..717259f36eae22 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/strong.js @@ -0,0 +1,26 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:strong + * @fileoverview Locate bold / strong / importance. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var asterisk = value.indexOf('**', fromIndex); + var underscore = value.indexOf('__', fromIndex); + + if (underscore === -1) { + return asterisk; + } + + if (asterisk === -1) { + return underscore; + } + + return underscore < asterisk ? underscore : asterisk; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/tag.js b/tools/eslint/node_modules/remark-parse/lib/locate/tag.js new file mode 100644 index 00000000000000..56e2d49e564587 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/tag.js @@ -0,0 +1,15 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:tag + * @fileoverview Locate a tag. + */ + +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('<', fromIndex); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/locate/url.js b/tools/eslint/node_modules/remark-parse/lib/locate/url.js new file mode 100644 index 00000000000000..53b239241c104a --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/locate/url.js @@ -0,0 +1,34 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:locate:url + * @fileoverview Locate a URL. + */ + +'use strict'; + +module.exports = locate; + +var PROTOCOLS = ['https://', 'http://', 'mailto:']; + +function locate(value, fromIndex) { + var length = PROTOCOLS.length; + var index = -1; + var min = -1; + var position; + + if (!this.options.gfm) { + return -1; + } + + while (++index < length) { + position = value.indexOf(PROTOCOLS[index], fromIndex); + + if (position !== -1 && (position < min || min === -1)) { + min = position; + } + } + + return min; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/parse.js b/tools/eslint/node_modules/remark-parse/lib/parse.js new file mode 100644 index 00000000000000..53a50b181e67d4 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/parse.js @@ -0,0 +1,53 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:parse + * @fileoverview Parse the document + */ + +'use strict'; + +var xtend = require('xtend'); +var removePosition = require('unist-util-remove-position'); + +module.exports = parse; + +var C_NEWLINE = '\n'; +var EXPRESSION_LINE_BREAKS = /\r\n|\r/g; + +/* Parse the bound file. */ +function parse() { + var self = this; + var value = String(self.file); + var start = {line: 1, column: 1, offset: 0}; + var content = xtend(start); + var node; + + /* Clean non-unix newlines: `\r\n` and `\r` are all + * changed to `\n`. This should not affect positional + * information. */ + value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE); + + if (value.charCodeAt(0) === 0xFEFF) { + value = value.slice(1); + + content.column++; + content.offset++; + } + + node = { + type: 'root', + children: self.tokenizeBlock(value, content), + position: { + start: start, + end: self.eof || xtend(start) + } + }; + + if (!self.options.position) { + removePosition(node, true); + } + + return node; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/parser.js b/tools/eslint/node_modules/remark-parse/lib/parser.js new file mode 100644 index 00000000000000..8fe982b661c41c --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/parser.js @@ -0,0 +1,162 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse + * @fileoverview Markdown parser. + */ + +'use strict'; + +var xtend = require('xtend'); +var toggle = require('state-toggle'); +var vfileLocation = require('vfile-location'); +var unescape = require('./unescape'); +var decode = require('./decode'); +var tokenizer = require('./tokenizer'); + +module.exports = Parser; + +/* Construct a new parser. */ +function Parser(doc, file) { + this.file = file; + this.offset = {}; + this.options = xtend(this.options); + this.setOptions({}); + + this.inList = false; + this.inBlock = false; + this.inLink = false; + this.atStart = true; + + this.toOffset = vfileLocation(file).toOffset; + this.unescape = unescape(this, 'escape'); + this.decode = decode(this); +} + +/* Prototype. */ +var proto = Parser.prototype; + +/* Expose core. */ +proto.setOptions = require('./set-options'); +proto.parse = require('./parse'); + +/* Expose `defaults`. */ +proto.options = require('./defaults'); + +/* Enter and exit helpers. */ +proto.exitStart = toggle('atStart', true); +proto.enterList = toggle('inList', false); +proto.enterLink = toggle('inLink', false); +proto.enterBlock = toggle('inBlock', false); + +/* Nodes that can interupt a paragraph: + * + * ```markdown + * A paragraph, followed by a thematic break. + * ___ + * ``` + * + * In the above example, the thematic break “interupts” + * the paragraph. */ +proto.interruptParagraph = [ + ['thematicBreak'], + ['atxHeading'], + ['fencedCode'], + ['blockquote'], + ['html'], + ['setextHeading', {commonmark: false}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +]; + +/* Nodes that can interupt a list: + * + * ```markdown + * - One + * ___ + * ``` + * + * In the above example, the thematic break “interupts” + * the list. */ +proto.interruptList = [ + ['fencedCode', {pedantic: false}], + ['thematicBreak', {pedantic: false}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +]; + +/* Nodes that can interupt a blockquote: + * + * ```markdown + * > A paragraph. + * ___ + * ``` + * + * In the above example, the thematic break “interupts” + * the blockquote. */ +proto.interruptBlockquote = [ + ['indentedCode', {commonmark: true}], + ['fencedCode', {commonmark: true}], + ['atxHeading', {commonmark: true}], + ['setextHeading', {commonmark: true}], + ['thematicBreak', {commonmark: true}], + ['html', {commonmark: true}], + ['list', {commonmark: true}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +]; + +/* Handlers. */ +proto.blockTokenizers = { + yamlFrontMatter: require('./tokenize/yaml'), + newline: require('./tokenize/newline'), + indentedCode: require('./tokenize/code-indented'), + fencedCode: require('./tokenize/code-fenced'), + blockquote: require('./tokenize/blockquote'), + atxHeading: require('./tokenize/heading-atx'), + thematicBreak: require('./tokenize/thematic-break'), + list: require('./tokenize/list'), + setextHeading: require('./tokenize/heading-setext'), + html: require('./tokenize/html-block'), + footnote: require('./tokenize/footnote-definition'), + definition: require('./tokenize/definition'), + table: require('./tokenize/table'), + paragraph: require('./tokenize/paragraph') +}; + +proto.inlineTokenizers = { + escape: require('./tokenize/escape'), + autoLink: require('./tokenize/auto-link'), + url: require('./tokenize/url'), + html: require('./tokenize/html-inline'), + link: require('./tokenize/link'), + reference: require('./tokenize/reference'), + strong: require('./tokenize/strong'), + emphasis: require('./tokenize/emphasis'), + deletion: require('./tokenize/delete'), + code: require('./tokenize/code-inline'), + break: require('./tokenize/break'), + text: require('./tokenize/text') +}; + +/* Expose precedence. */ +proto.blockMethods = keys(proto.blockTokenizers); +proto.inlineMethods = keys(proto.inlineTokenizers); + +/* Tokenizers. */ +proto.tokenizeBlock = tokenizer('block'); +proto.tokenizeInline = tokenizer('inline'); +proto.tokenizeFactory = tokenizer; + +/* Get all keys in `value`. */ +function keys(value) { + var result = []; + var key; + + for (key in value) { + result.push(key); + } + + return result; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/set-options.js b/tools/eslint/node_modules/remark-parse/lib/set-options.js new file mode 100644 index 00000000000000..3f9abad7c49a06 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/set-options.js @@ -0,0 +1,59 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse + * @fileoverview Markdown parser. + */ + +'use strict'; + +var xtend = require('xtend'); +var escapes = require('markdown-escapes'); +var defaults = require('./defaults'); + +module.exports = setOptions; + +/* Set options. */ +function setOptions(options) { + var self = this; + var current = self.options; + var key; + var value; + + if (options == null) { + options = {}; + } else if (typeof options === 'object') { + options = xtend(options); + } else { + throw new Error( + 'Invalid value `' + options + '` ' + + 'for setting `options`' + ); + } + + for (key in defaults) { + value = options[key]; + + if (value == null) { + value = current[key]; + } + + if ( + (key !== 'blocks' && typeof value !== 'boolean') || + (key === 'blocks' && typeof value !== 'object') + ) { + throw new Error( + 'Invalid value `' + value + '` ' + + 'for setting `options.' + key + '`' + ); + } + + options[key] = value; + } + + self.options = options; + self.escape = escapes(options); + + return self; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js new file mode 100644 index 00000000000000..3861b48a14aead --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/auto-link.js @@ -0,0 +1,151 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:auto-link + * @fileoverview Tokenise an auto-link. + */ + +'use strict'; + +var decode = require('parse-entities'); +var locate = require('../locate/tag'); + +module.exports = autoLink; +autoLink.locator = locate; +autoLink.notInLink = true; + +var C_LT = '<'; +var C_GT = '>'; +var C_AT_SIGN = '@'; +var C_SLASH = '/'; +var MAILTO = 'mailto:'; +var MAILTO_LENGTH = MAILTO.length; + +/* Tokenise a link. */ +function autoLink(eat, value, silent) { + var self; + var subvalue; + var length; + var index; + var queue; + var character; + var hasAtCharacter; + var link; + var now; + var content; + var tokenize; + var exit; + + if (value.charAt(0) !== C_LT) { + return; + } + + self = this; + subvalue = ''; + length = value.length; + index = 0; + queue = ''; + hasAtCharacter = false; + link = ''; + + index++; + subvalue = C_LT; + + while (index < length) { + character = value.charAt(index); + + if ( + character === ' ' || + character === C_GT || + character === C_AT_SIGN || + (character === ':' && value.charAt(index + 1) === C_SLASH) + ) { + break; + } + + queue += character; + index++; + } + + if (!queue) { + return; + } + + link += queue; + queue = ''; + + character = value.charAt(index); + link += character; + index++; + + if (character === C_AT_SIGN) { + hasAtCharacter = true; + } else { + if ( + character !== ':' || + value.charAt(index + 1) !== C_SLASH + ) { + return; + } + + link += C_SLASH; + index++; + } + + while (index < length) { + character = value.charAt(index); + + if (character === ' ' || character === C_GT) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (!queue || character !== C_GT) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + link += queue; + content = link; + subvalue += link + character; + now = eat.now(); + now.column++; + now.offset++; + + if (hasAtCharacter) { + if (link.slice(0, MAILTO_LENGTH).toLowerCase() === MAILTO) { + content = content.substr(MAILTO_LENGTH); + now.column += MAILTO_LENGTH; + now.offset += MAILTO_LENGTH; + } else { + link = MAILTO + link; + } + } + + /* Temporarily remove support for escapes in autolinks. */ + tokenize = self.inlineTokenizers.escape; + self.inlineTokenizers.escape = null; + exit = self.enterLink(); + + content = self.tokenizeInline(content, now); + + self.inlineTokenizers.escape = tokenize; + exit(); + + return eat(subvalue)({ + type: 'link', + title: null, + url: decode(link), + children: content + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js new file mode 100644 index 00000000000000..764e0aa010392c --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/blockquote.js @@ -0,0 +1,137 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:blockquote + * @fileoverview Tokenise blockquote. + */ + +'use strict'; + +var trim = require('trim'); +var interrupt = require('../util/interrupt'); + +module.exports = blockquote; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_GT = '>'; + +/* Tokenise a blockquote. */ +function blockquote(eat, value, silent) { + var self = this; + var offsets = self.offset; + var tokenizers = self.blockTokenizers; + var interruptors = self.interruptBlockquote; + var now = eat.now(); + var currentLine = now.line; + var length = value.length; + var values = []; + var contents = []; + var indents = []; + var add; + var index = 0; + var character; + var rest; + var nextIndex; + var content; + var line; + var startIndex; + var prefixed; + var exit; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + index++; + } + + if (value.charAt(index) !== C_GT) { + return; + } + + if (silent) { + return true; + } + + index = 0; + + while (index < length) { + nextIndex = value.indexOf(C_NEWLINE, index); + startIndex = index; + prefixed = false; + + if (nextIndex === -1) { + nextIndex = length; + } + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + index++; + } + + if (value.charAt(index) === C_GT) { + index++; + prefixed = true; + + if (value.charAt(index) === C_SPACE) { + index++; + } + } else { + index = startIndex; + } + + content = value.slice(index, nextIndex); + + if (!prefixed && !trim(content)) { + index = startIndex; + break; + } + + if (!prefixed) { + rest = value.slice(index); + + /* Check if the following code contains a possible + * block. */ + if (interrupt(interruptors, tokenizers, self, [eat, rest, true])) { + break; + } + } + + line = startIndex === index ? content : value.slice(startIndex, nextIndex); + + indents.push(index - startIndex); + values.push(line); + contents.push(content); + + index = nextIndex + 1; + } + + index = -1; + length = indents.length; + add = eat(values.join(C_NEWLINE)); + + while (++index < length) { + offsets[currentLine] = (offsets[currentLine] || 0) + indents[index]; + currentLine++; + } + + exit = self.enterBlock(); + contents = self.tokenizeBlock(contents.join(C_NEWLINE), now); + exit(); + + return add({ + type: 'blockquote', + children: contents + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/break.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/break.js new file mode 100644 index 00000000000000..6d2d0dcff9552b --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/break.js @@ -0,0 +1,51 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:break + * @fileoverview Tokenise a break. + */ + +'use strict'; + +var locate = require('../locate/break'); + +module.exports = hardBreak; +hardBreak.locator = locate; + +var MIN_BREAK_LENGTH = 2; + +/* Tokenise a break. */ +function hardBreak(eat, value, silent) { + var self = this; + var breaks = self.options.breaks; + var length = value.length; + var index = -1; + var queue = ''; + var character; + + while (++index < length) { + character = value.charAt(index); + + if (character === '\n') { + if (!breaks && index < MIN_BREAK_LENGTH) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + queue += character; + + return eat(queue)({type: 'break'}); + } + + if (character !== ' ') { + return; + } + + queue += character; + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js new file mode 100644 index 00000000000000..f2577405b26587 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/code-fenced.js @@ -0,0 +1,245 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:code-fenced + * @fileoverview Tokenise fenced code. + */ + +'use strict'; + +var trim = require('trim-trailing-lines'); + +module.exports = fencedCode; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_TILDE = '~'; +var C_TICK = '`'; + +var MIN_FENCE_COUNT = 3; +var CODE_INDENT_COUNT = 4; + +/* Tokenise fenced code. */ +function fencedCode(eat, value, silent) { + var self = this; + var settings = self.options; + var length = value.length + 1; + var index = 0; + var subvalue = ''; + var fenceCount; + var marker; + var character; + var flag; + var queue; + var content; + var exdentedContent; + var closing; + var exdentedClosing; + var indent; + var now; + + if (!settings.gfm) { + return; + } + + /* Eat initial spacing. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + subvalue += character; + index++; + } + + indent = index; + + /* Eat the fence. */ + character = value.charAt(index); + + if (character !== C_TILDE && character !== C_TICK) { + return; + } + + index++; + marker = character; + fenceCount = 1; + subvalue += character; + + while (index < length) { + character = value.charAt(index); + + if (character !== marker) { + break; + } + + subvalue += character; + fenceCount++; + index++; + } + + if (fenceCount < MIN_FENCE_COUNT) { + return; + } + + /* Eat spacing before flag. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + subvalue += character; + index++; + } + + /* Eat flag. */ + flag = ''; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character === C_NEWLINE || + character === C_TILDE || + character === C_TICK + ) { + break; + } + + if (character === C_SPACE || character === C_TAB) { + queue += character; + } else { + flag += queue + character; + queue = ''; + } + + index++; + } + + character = value.charAt(index); + + if (character && character !== C_NEWLINE) { + return; + } + + if (silent) { + return true; + } + + now = eat.now(); + now.column += subvalue.length; + now.offset += subvalue.length; + + subvalue += flag; + flag = self.decode.raw(self.unescape(flag), now); + + if (queue) { + subvalue += queue; + } + + queue = ''; + closing = ''; + exdentedClosing = ''; + content = ''; + exdentedContent = ''; + + /* Eat content. */ + while (index < length) { + character = value.charAt(index); + content += closing; + exdentedContent += exdentedClosing; + closing = ''; + exdentedClosing = ''; + + if (character !== C_NEWLINE) { + content += character; + exdentedClosing += character; + index++; + continue; + } + + /* Add the newline to `subvalue` if its the first + * character. Otherwise, add it to the `closing` + * queue. */ + if (content) { + closing += character; + exdentedClosing += character; + } else { + subvalue += character; + } + + queue = ''; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE) { + break; + } + + queue += character; + index++; + } + + closing += queue; + exdentedClosing += queue.slice(indent); + + if (queue.length >= CODE_INDENT_COUNT) { + continue; + } + + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== marker) { + break; + } + + queue += character; + index++; + } + + closing += queue; + exdentedClosing += queue; + + if (queue.length < fenceCount) { + continue; + } + + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + closing += character; + exdentedClosing += character; + index++; + } + + if (!character || character === C_NEWLINE) { + break; + } + } + + subvalue += content + closing; + + return eat(subvalue)({ + type: 'code', + lang: flag || null, + value: trim(exdentedContent) + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js new file mode 100644 index 00000000000000..50c581fe26e2e4 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/code-indented.js @@ -0,0 +1,106 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:code-indented + * @fileoverview Tokenise indented code. + */ + +'use strict'; + +var repeat = require('repeat-string'); +var trim = require('trim-trailing-lines'); + +module.exports = indentedCode; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; + +var CODE_INDENT_COUNT = 4; +var CODE_INDENT = repeat(C_SPACE, CODE_INDENT_COUNT); + +/* Tokenise indented code. */ +function indentedCode(eat, value, silent) { + var index = -1; + var length = value.length; + var subvalue = ''; + var content = ''; + var subvalueQueue = ''; + var contentQueue = ''; + var character; + var blankQueue; + var indent; + + while (++index < length) { + character = value.charAt(index); + + if (indent) { + indent = false; + + subvalue += subvalueQueue; + content += contentQueue; + subvalueQueue = ''; + contentQueue = ''; + + if (character === C_NEWLINE) { + subvalueQueue = character; + contentQueue = character; + } else { + subvalue += character; + content += character; + + while (++index < length) { + character = value.charAt(index); + + if (!character || character === C_NEWLINE) { + contentQueue = character; + subvalueQueue = character; + break; + } + + subvalue += character; + content += character; + } + } + } else if ( + character === C_SPACE && + value.charAt(index + 1) === character && + value.charAt(index + 2) === character && + value.charAt(index + 3) === character + ) { + subvalueQueue += CODE_INDENT; + index += 3; + indent = true; + } else if (character === C_TAB) { + subvalueQueue += character; + indent = true; + } else { + blankQueue = ''; + + while (character === C_TAB || character === C_SPACE) { + blankQueue += character; + character = value.charAt(++index); + } + + if (character !== C_NEWLINE) { + break; + } + + subvalueQueue += blankQueue + character; + contentQueue += character; + } + } + + if (content) { + if (silent) { + return true; + } + + return eat(subvalue)({ + type: 'code', + lang: null, + value: trim(content) + }); + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js new file mode 100644 index 00000000000000..9157412753ad1a --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/code-inline.js @@ -0,0 +1,120 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:code-inline + * @fileoverview Tokenise inline code. + */ + +'use strict'; + +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/code-inline'); + +module.exports = inlineCode; +inlineCode.locator = locate; + +var C_TICK = '`'; + +/* Tokenise inline code. */ +function inlineCode(eat, value, silent) { + var length = value.length; + var index = 0; + var queue = ''; + var tickQueue = ''; + var contentQueue; + var subqueue; + var count; + var openingCount; + var subvalue; + var character; + var found; + var next; + + while (index < length) { + if (value.charAt(index) !== C_TICK) { + break; + } + + queue += C_TICK; + index++; + } + + if (!queue) { + return; + } + + subvalue = queue; + openingCount = index; + queue = ''; + next = value.charAt(index); + count = 0; + + while (index < length) { + character = next; + next = value.charAt(index + 1); + + if (character === C_TICK) { + count++; + tickQueue += character; + } else { + count = 0; + queue += character; + } + + if (count && next !== C_TICK) { + if (count === openingCount) { + subvalue += queue + tickQueue; + found = true; + break; + } + + queue += tickQueue; + tickQueue = ''; + } + + index++; + } + + if (!found) { + if (openingCount % 2 !== 0) { + return; + } + + queue = ''; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + contentQueue = ''; + subqueue = ''; + length = queue.length; + index = -1; + + while (++index < length) { + character = queue.charAt(index); + + if (whitespace(character)) { + subqueue += character; + continue; + } + + if (subqueue) { + if (contentQueue) { + contentQueue += subqueue; + } + + subqueue = ''; + } + + contentQueue += character; + } + + return eat(subvalue)({ + type: 'inlineCode', + value: contentQueue + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/definition.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/definition.js new file mode 100644 index 00000000000000..3f7345a2c901c8 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/definition.js @@ -0,0 +1,287 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:definition + * @fileoverview Tokenise a definition. + */ + +'use strict'; + +var whitespace = require('is-whitespace-character'); +var normalize = require('../util/normalize'); + +module.exports = definition; +definition.notInList = true; +definition.notInBlock = true; + +var C_DOUBLE_QUOTE = '"'; +var C_SINGLE_QUOTE = '\''; +var C_BACKSLASH = '\\'; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_PAREN_OPEN = '('; +var C_PAREN_CLOSE = ')'; +var C_COLON = ':'; +var C_LT = '<'; +var C_GT = '>'; + +/* Tokenise a definition. */ +function definition(eat, value, silent) { + var self = this; + var commonmark = self.options.commonmark; + var index = 0; + var length = value.length; + var subvalue = ''; + var beforeURL; + var beforeTitle; + var queue; + var character; + var test; + var identifier; + var url; + var title; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + + if (character !== C_BRACKET_OPEN) { + return; + } + + index++; + subvalue += character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE) { + break; + } else if (character === C_BACKSLASH) { + queue += character; + index++; + character = value.charAt(index); + } + + queue += character; + index++; + } + + if ( + !queue || + value.charAt(index) !== C_BRACKET_CLOSE || + value.charAt(index + 1) !== C_COLON + ) { + return; + } + + identifier = queue; + subvalue += queue + C_BRACKET_CLOSE + C_COLON; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character !== C_TAB && + character !== C_SPACE && + character !== C_NEWLINE + ) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + queue = ''; + beforeURL = subvalue; + + if (character === C_LT) { + index++; + + while (index < length) { + character = value.charAt(index); + + if (!isEnclosedURLCharacter(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (character === isEnclosedURLCharacter.delimiter) { + subvalue += C_LT + queue + character; + index++; + } else { + if (commonmark) { + return; + } + + index -= queue.length + 1; + queue = ''; + } + } + + if (!queue) { + while (index < length) { + character = value.charAt(index); + + if (!isUnclosedURLCharacter(character)) { + break; + } + + queue += character; + index++; + } + + subvalue += queue; + } + + if (!queue) { + return; + } + + url = queue; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character !== C_TAB && + character !== C_SPACE && + character !== C_NEWLINE + ) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + test = null; + + if (character === C_DOUBLE_QUOTE) { + test = C_DOUBLE_QUOTE; + } else if (character === C_SINGLE_QUOTE) { + test = C_SINGLE_QUOTE; + } else if (character === C_PAREN_OPEN) { + test = C_PAREN_CLOSE; + } + + if (!test) { + queue = ''; + index = subvalue.length; + } else if (queue) { + subvalue += queue + character; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === test) { + break; + } + + if (character === C_NEWLINE) { + index++; + character = value.charAt(index); + + if (character === C_NEWLINE || character === test) { + return; + } + + queue += C_NEWLINE; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (character !== test) { + return; + } + + beforeTitle = subvalue; + subvalue += queue + character; + index++; + title = queue; + queue = ''; + } else { + return; + } + + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + + if (!character || character === C_NEWLINE) { + if (silent) { + return true; + } + + beforeURL = eat(beforeURL).test().end; + url = self.decode.raw(self.unescape(url), beforeURL); + + if (title) { + beforeTitle = eat(beforeTitle).test().end; + title = self.decode.raw(self.unescape(title), beforeTitle); + } + + return eat(subvalue)({ + type: 'definition', + identifier: normalize(identifier), + title: title || null, + url: url + }); + } +} + +/* Check if `character` can be inside an enclosed URI. */ +function isEnclosedURLCharacter(character) { + return character !== C_GT && + character !== C_BRACKET_OPEN && + character !== C_BRACKET_CLOSE; +} + +isEnclosedURLCharacter.delimiter = C_GT; + +/* Check if `character` can be inside an unclosed URI. */ +function isUnclosedURLCharacter(character) { + return character !== C_BRACKET_OPEN && + character !== C_BRACKET_CLOSE && + !whitespace(character); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/delete.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/delete.js new file mode 100644 index 00000000000000..60ae9c4936c61f --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/delete.js @@ -0,0 +1,69 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:delete + * @fileoverview Tokenise strikethrough. + */ + +'use strict'; + +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/delete'); + +module.exports = strikethrough; +strikethrough.locator = locate; + +var C_TILDE = '~'; +var DOUBLE = '~~'; + +/* Tokenise strikethrough. */ +function strikethrough(eat, value, silent) { + var self = this; + var character = ''; + var previous = ''; + var preceding = ''; + var subvalue = ''; + var index; + var length; + var now; + + if ( + !self.options.gfm || + value.charAt(0) !== C_TILDE || + value.charAt(1) !== C_TILDE || + whitespace(value.charAt(2)) + ) { + return; + } + + index = 1; + length = value.length; + now = eat.now(); + now.column += 2; + now.offset += 2; + + while (++index < length) { + character = value.charAt(index); + + if ( + character === C_TILDE && + previous === C_TILDE && + (!preceding || !whitespace(preceding)) + ) { + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + return eat(DOUBLE + subvalue + DOUBLE)({ + type: 'delete', + children: self.tokenizeInline(subvalue, now) + }); + } + + subvalue += previous; + preceding = previous; + previous = character; + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js new file mode 100644 index 00000000000000..46249369224bc5 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/emphasis.js @@ -0,0 +1,94 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:emphasis + * @fileoverview Tokenise emphasis. + */ + +'use strict'; + +var trim = require('trim'); +var word = require('is-word-character'); +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/emphasis'); + +module.exports = emphasis; +emphasis.locator = locate; + +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; + +/* Tokenise emphasis. */ +function emphasis(eat, value, silent) { + var self = this; + var index = 0; + var character = value.charAt(index); + var now; + var pedantic; + var marker; + var queue; + var subvalue; + var length; + var prev; + + if (character !== C_ASTERISK && character !== C_UNDERSCORE) { + return; + } + + pedantic = self.options.pedantic; + subvalue = character; + marker = character; + length = value.length; + index++; + queue = ''; + character = ''; + + if (pedantic && whitespace(value.charAt(index))) { + return; + } + + while (index < length) { + prev = character; + character = value.charAt(index); + + if (character === marker && (!pedantic || !whitespace(prev))) { + character = value.charAt(++index); + + if (character !== marker) { + if (!trim(queue) || prev === marker) { + return; + } + + if (!pedantic && marker === C_UNDERSCORE && word(character)) { + queue += marker; + continue; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + now.column++; + now.offset++; + + return eat(subvalue + queue + marker)({ + type: 'emphasis', + children: self.tokenizeInline(queue, now) + }); + } + + queue += marker; + } + + if (!pedantic && character === '\\') { + queue += character; + character = value.charAt(++index); + } + + queue += character; + index++; + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/escape.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/escape.js new file mode 100644 index 00000000000000..3e41a4cec5e6ea --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/escape.js @@ -0,0 +1,43 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:escape + * @fileoverview Tokenise an escape. + */ + +'use strict'; + +var locate = require('../locate/escape'); + +module.exports = escape; +escape.locator = locate; + +/* Tokenise an escape. */ +function escape(eat, value, silent) { + var self = this; + var character; + var node; + + if (value.charAt(0) === '\\') { + character = value.charAt(1); + + if (self.escape.indexOf(character) !== -1) { + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + if (character === '\n') { + node = {type: 'break'}; + } else { + node = { + type: 'text', + value: character + }; + } + + return eat('\\' + character)(node); + } + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js new file mode 100644 index 00000000000000..3537ccb6115017 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/footnote-definition.js @@ -0,0 +1,194 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:footnote-definition + * @fileoverview Tokenise footnote definition. + */ + +'use strict'; + +var whitespace = require('is-whitespace-character'); +var normalize = require('../util/normalize'); + +module.exports = footnoteDefinition; +footnoteDefinition.notInList = true; +footnoteDefinition.notInBlock = true; + +var C_BACKSLASH = '\\'; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_CARET = '^'; +var C_COLON = ':'; + +var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm; + +/* Tokenise a footnote definition. */ +function footnoteDefinition(eat, value, silent) { + var self = this; + var offsets = self.offset; + var index; + var length; + var subvalue; + var now; + var currentLine; + var content; + var queue; + var subqueue; + var character; + var identifier; + var add; + var exit; + + if (!self.options.footnotes) { + return; + } + + index = 0; + length = value.length; + subvalue = ''; + now = eat.now(); + currentLine = now.line; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + subvalue += character; + index++; + } + + if ( + value.charAt(index) !== C_BRACKET_OPEN || + value.charAt(index + 1) !== C_CARET + ) { + return; + } + + subvalue += C_BRACKET_OPEN + C_CARET; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE) { + break; + } else if (character === C_BACKSLASH) { + queue += character; + index++; + character = value.charAt(index); + } + + queue += character; + index++; + } + + if ( + !queue || + value.charAt(index) !== C_BRACKET_CLOSE || + value.charAt(index + 1) !== C_COLON + ) { + return; + } + + if (silent) { + return true; + } + + identifier = normalize(queue); + subvalue += queue + C_BRACKET_CLOSE + C_COLON; + index = subvalue.length; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + subvalue += character; + index++; + } + + now.column += subvalue.length; + now.offset += subvalue.length; + queue = ''; + content = ''; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_NEWLINE) { + subqueue = character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_NEWLINE) { + break; + } + + subqueue += character; + index++; + } + + queue += subqueue; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE) { + break; + } + + subqueue += character; + index++; + } + + if (subqueue.length === 0) { + break; + } + + queue += subqueue; + } + + if (queue) { + content += queue; + queue = ''; + } + + content += character; + index++; + } + + subvalue += content; + + content = content.replace(EXPRESSION_INITIAL_TAB, function (line) { + offsets[currentLine] = (offsets[currentLine] || 0) + line.length; + currentLine++; + + return ''; + }); + + add = eat(subvalue); + + exit = self.enterBlock(); + content = self.tokenizeBlock(content, now); + exit(); + + return add({ + type: 'footnoteDefinition', + identifier: identifier, + children: content + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js new file mode 100644 index 00000000000000..e5fdedc537ad0b --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/heading-atx.js @@ -0,0 +1,150 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:heading-atx + * @fileoverview Tokenise an ATX-style heading. + */ + +'use strict'; + +module.exports = atxHeading; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_HASH = '#'; + +var MAX_ATX_COUNT = 6; + +/* Tokenise an ATX-style heading. */ +function atxHeading(eat, value, silent) { + var self = this; + var settings = self.options; + var length = value.length + 1; + var index = -1; + var now = eat.now(); + var subvalue = ''; + var content = ''; + var character; + var queue; + var depth; + + /* Eat initial spacing. */ + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + index--; + break; + } + + subvalue += character; + } + + /* Eat hashes. */ + depth = 0; + + while (++index <= length) { + character = value.charAt(index); + + if (character !== C_HASH) { + index--; + break; + } + + subvalue += character; + depth++; + } + + if (depth > MAX_ATX_COUNT) { + return; + } + + if ( + !depth || + (!settings.pedantic && value.charAt(index + 1) === C_HASH) + ) { + return; + } + + length = value.length + 1; + + /* Eat intermediate white-space. */ + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + index--; + break; + } + + queue += character; + } + + /* Exit when not in pedantic mode without spacing. */ + if ( + !settings.pedantic && + queue.length === 0 && + character && + character !== C_NEWLINE + ) { + return; + } + + if (silent) { + return true; + } + + /* Eat content. */ + subvalue += queue; + queue = ''; + content = ''; + + while (++index < length) { + character = value.charAt(index); + + if (!character || character === C_NEWLINE) { + break; + } + + if ( + character !== C_SPACE && + character !== C_TAB && + character !== C_HASH + ) { + content += queue + character; + queue = ''; + continue; + } + + while (character === C_SPACE || character === C_TAB) { + queue += character; + character = value.charAt(++index); + } + + while (character === C_HASH) { + queue += character; + character = value.charAt(++index); + } + + while (character === C_SPACE || character === C_TAB) { + queue += character; + character = value.charAt(++index); + } + + index--; + } + + now.column += subvalue.length; + now.offset += subvalue.length; + subvalue += content + queue; + + return eat(subvalue)({ + type: 'heading', + depth: depth, + children: self.tokenizeInline(content, now) + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js new file mode 100644 index 00000000000000..db8bbcfb73c2c9 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/heading-setext.js @@ -0,0 +1,116 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:heading-setext + * @fileoverview Tokenise an setext-style heading. + */ + +'use strict'; + +module.exports = setextHeading; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_EQUALS = '='; +var C_DASH = '-'; + +var MAX_HEADING_INDENT = 3; + +/* Map of characters which can be used to mark setext + * headers, mapping to their corresponding depth. */ +var SETEXT_MARKERS = {}; + +SETEXT_MARKERS[C_EQUALS] = 1; +SETEXT_MARKERS[C_DASH] = 2; + +/* Tokenise an setext-style heading. */ +function setextHeading(eat, value, silent) { + var self = this; + var now = eat.now(); + var length = value.length; + var index = -1; + var subvalue = ''; + var content; + var queue; + var character; + var marker; + var depth; + + /* Eat initial indentation. */ + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE || index >= MAX_HEADING_INDENT) { + index--; + break; + } + + subvalue += character; + } + + /* Eat content. */ + content = ''; + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character === C_NEWLINE) { + index--; + break; + } + + if (character === C_SPACE || character === C_TAB) { + queue += character; + } else { + content += queue + character; + queue = ''; + } + } + + now.column += subvalue.length; + now.offset += subvalue.length; + subvalue += content + queue; + + /* Ensure the content is followed by a newline and a + * valid marker. */ + character = value.charAt(++index); + marker = value.charAt(++index); + + if (character !== C_NEWLINE || !SETEXT_MARKERS[marker]) { + return; + } + + subvalue += character; + + /* Eat Setext-line. */ + queue = marker; + depth = SETEXT_MARKERS[marker]; + + while (++index < length) { + character = value.charAt(index); + + if (character !== marker) { + if (character !== C_NEWLINE) { + return; + } + + index--; + break; + } + + queue += character; + } + + if (silent) { + return true; + } + + return eat(subvalue + queue)({ + type: 'heading', + depth: depth, + children: self.tokenizeInline(content, now) + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/html-block.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/html-block.js new file mode 100644 index 00000000000000..dc861b53c3a37b --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/html-block.js @@ -0,0 +1,103 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:html-block + * @fileoverview Tokenise block HTML. + */ + +'use strict'; + +var openCloseTag = require('../util/html').openCloseTag; + +module.exports = blockHTML; + +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_LT = '<'; + +/* Tokenise block HTML. */ +function blockHTML(eat, value, silent) { + var self = this; + var blocks = self.options.blocks; + var length = value.length; + var index = 0; + var next; + var line; + var offset; + var character; + var count; + var sequence; + var subvalue; + + var sequences = [ + [/^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true], + [/^/, true], + [/^<\?/, /\?>/, true], + [/^/, true], + [/^/, true], + [new RegExp('^|$))', 'i'), /^$/, true], + [new RegExp(openCloseTag.source + '\\s*$'), /^$/, false] + ]; + + /* Eat initial spacing. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + index++; + } + + if (value.charAt(index) !== C_LT) { + return; + } + + next = value.indexOf(C_NEWLINE, index + 1); + next = next === -1 ? length : next; + line = value.slice(index, next); + offset = -1; + count = sequences.length; + + while (++offset < count) { + if (sequences[offset][0].test(line)) { + sequence = sequences[offset]; + break; + } + } + + if (!sequence) { + return; + } + + if (silent) { + return sequence[2]; + } + + index = next; + + if (!sequence[1].test(line)) { + while (index < length) { + next = value.indexOf(C_NEWLINE, index + 1); + next = next === -1 ? length : next; + line = value.slice(index + 1, next); + + if (sequence[1].test(line)) { + if (line) { + index = next; + } + + break; + } + + index = next; + } + } + + subvalue = value.slice(0, index); + + return eat(subvalue)({type: 'html', value: subvalue}); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js new file mode 100644 index 00000000000000..d8c0b9ab21829a --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/html-inline.js @@ -0,0 +1,63 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:html-inline + * @fileoverview Tokenise inline HTML. + */ + +'use strict'; + +var alphabetical = require('is-alphabetical'); +var locate = require('../locate/tag'); +var tag = require('../util/html').tag; + +module.exports = inlineHTML; +inlineHTML.locator = locate; + +var EXPRESSION_HTML_LINK_OPEN = /^/i; + +/* Tokenise inline HTML. */ +function inlineHTML(eat, value, silent) { + var self = this; + var length = value.length; + var character; + var subvalue; + + if (value.charAt(0) !== '<' || length < 3) { + return; + } + + character = value.charAt(1); + + if ( + !alphabetical(character) && + character !== '?' && + character !== '!' && + character !== '/' + ) { + return; + } + + subvalue = value.match(tag); + + if (!subvalue) { + return; + } + + /* istanbul ignore if - not used yet. */ + if (silent) { + return true; + } + + subvalue = subvalue[0]; + + if (!self.inLink && EXPRESSION_HTML_LINK_OPEN.test(subvalue)) { + self.inLink = true; + } else if (self.inLink && EXPRESSION_HTML_LINK_CLOSE.test(subvalue)) { + self.inLink = false; + } + + return eat(subvalue)({type: 'html', value: subvalue}); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/link.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/link.js new file mode 100644 index 00000000000000..fb11c5099054df --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/link.js @@ -0,0 +1,399 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:link + * @fileoverview Tokenise a link. + */ + +'use strict'; + +var has = require('has'); +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/link'); + +module.exports = link; +link.locator = locate; + +var C_BACKSLASH = '\\'; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_PAREN_OPEN = '('; +var C_PAREN_CLOSE = ')'; +var C_LT = '<'; +var C_GT = '>'; +var C_TICK = '`'; +var C_DOUBLE_QUOTE = '"'; +var C_SINGLE_QUOTE = '\''; + +/* Map of characters, which can be used to mark link + * and image titles. */ +var LINK_MARKERS = {}; + +LINK_MARKERS[C_DOUBLE_QUOTE] = C_DOUBLE_QUOTE; +LINK_MARKERS[C_SINGLE_QUOTE] = C_SINGLE_QUOTE; + +/* Map of characters, which can be used to mark link + * and image titles in commonmark-mode. */ +var COMMONMARK_LINK_MARKERS = {}; + +COMMONMARK_LINK_MARKERS[C_DOUBLE_QUOTE] = C_DOUBLE_QUOTE; +COMMONMARK_LINK_MARKERS[C_SINGLE_QUOTE] = C_SINGLE_QUOTE; +COMMONMARK_LINK_MARKERS[C_PAREN_OPEN] = C_PAREN_CLOSE; + +/* Tokenise a link. */ +function link(eat, value, silent) { + var self = this; + var subvalue = ''; + var index = 0; + var character = value.charAt(0); + var commonmark = self.options.commonmark; + var gfm = self.options.gfm; + var closed; + var count; + var opening; + var beforeURL; + var beforeTitle; + var subqueue; + var hasMarker; + var markers; + var isImage; + var content; + var marker; + var length; + var title; + var depth; + var queue; + var url; + var now; + var exit; + var node; + + /* Detect whether this is an image. */ + if (character === '!') { + isImage = true; + subvalue = character; + character = value.charAt(++index); + } + + /* Eat the opening. */ + if (character !== C_BRACKET_OPEN) { + return; + } + + /* Exit when this is a link and we’re already inside + * a link. */ + if (!isImage && self.inLink) { + return; + } + + subvalue += character; + queue = ''; + index++; + + /* Eat the content. */ + length = value.length; + now = eat.now(); + depth = 0; + + now.column += index; + now.offset += index; + + while (index < length) { + character = value.charAt(index); + subqueue = character; + + if (character === C_TICK) { + /* Inline-code in link content. */ + count = 1; + + while (value.charAt(index + 1) === C_TICK) { + subqueue += character; + index++; + count++; + } + + if (!opening) { + opening = count; + } else if (count >= opening) { + opening = 0; + } + } else if (character === C_BACKSLASH) { + /* Allow brackets to be escaped. */ + index++; + subqueue += value.charAt(index); + /* In GFM mode, brackets in code still count. + * In all other modes, they don’t. This empty + * block prevents the next statements are + * entered. */ + } else if ((!opening || gfm) && character === C_BRACKET_OPEN) { + depth++; + } else if ((!opening || gfm) && character === C_BRACKET_CLOSE) { + if (depth) { + depth--; + } else { + /* Allow white-space between content and + * url in GFM mode. */ + if (gfm) { + while (index < length) { + character = value.charAt(index + 1); + + if (!whitespace(character)) { + break; + } + + subqueue += character; + index++; + } + } + + if (value.charAt(index + 1) !== C_PAREN_OPEN) { + return; + } + + subqueue += C_PAREN_OPEN; + closed = true; + index++; + + break; + } + } + + queue += subqueue; + subqueue = ''; + index++; + } + + /* Eat the content closing. */ + if (!closed) { + return; + } + + content = queue; + subvalue += queue + subqueue; + index++; + + /* Eat white-space. */ + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + subvalue += character; + index++; + } + + /* Eat the URL. */ + character = value.charAt(index); + markers = commonmark ? COMMONMARK_LINK_MARKERS : LINK_MARKERS; + queue = ''; + beforeURL = subvalue; + + if (character === C_LT) { + index++; + beforeURL += C_LT; + + while (index < length) { + character = value.charAt(index); + + if (character === C_GT) { + break; + } + + if (commonmark && character === '\n') { + return; + } + + queue += character; + index++; + } + + if (value.charAt(index) !== C_GT) { + return; + } + + subvalue += C_LT + queue + C_GT; + url = queue; + index++; + } else { + character = null; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (subqueue && has(markers, character)) { + break; + } + + if (whitespace(character)) { + if (commonmark) { + break; + } + + subqueue += character; + } else { + if (character === C_PAREN_OPEN) { + depth++; + } else if (character === C_PAREN_CLOSE) { + if (depth === 0) { + break; + } + + depth--; + } + + queue += subqueue; + subqueue = ''; + + if (character === C_BACKSLASH) { + queue += C_BACKSLASH; + character = value.charAt(++index); + } + + queue += character; + } + + index++; + } + + subvalue += queue; + url = queue; + index = subvalue.length; + } + + /* Eat white-space. */ + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + subvalue += queue; + + /* Eat the title. */ + if (queue && has(markers, character)) { + index++; + subvalue += character; + queue = ''; + marker = markers[character]; + beforeTitle = subvalue; + + /* In commonmark-mode, things are pretty easy: the + * marker cannot occur inside the title. + * + * Non-commonmark does, however, support nested + * delimiters. */ + if (commonmark) { + while (index < length) { + character = value.charAt(index); + + if (character === marker) { + break; + } + + if (character === C_BACKSLASH) { + queue += C_BACKSLASH; + character = value.charAt(++index); + } + + index++; + queue += character; + } + + character = value.charAt(index); + + if (character !== marker) { + return; + } + + title = queue; + subvalue += queue + character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + subvalue += character; + index++; + } + } else { + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === marker) { + if (hasMarker) { + queue += marker + subqueue; + subqueue = ''; + } + + hasMarker = true; + } else if (!hasMarker) { + queue += character; + } else if (character === C_PAREN_CLOSE) { + subvalue += queue + marker + subqueue; + title = queue; + break; + } else if (whitespace(character)) { + subqueue += character; + } else { + queue += marker + subqueue + character; + subqueue = ''; + hasMarker = false; + } + + index++; + } + } + } + + if (value.charAt(index) !== C_PAREN_CLOSE) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + subvalue += C_PAREN_CLOSE; + + url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end); + + if (title) { + beforeTitle = eat(beforeTitle).test().end; + title = self.decode.raw(self.unescape(title), beforeTitle); + } + + node = { + type: isImage ? 'image' : 'link', + title: title || null, + url: url + }; + + if (isImage) { + node.alt = self.decode.raw(self.unescape(content), now) || null; + } else { + exit = self.enterLink(); + node.children = self.tokenizeInline(content, now); + exit(); + } + + return eat(subvalue)(node); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/list.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/list.js new file mode 100644 index 00000000000000..da8002e574196c --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/list.js @@ -0,0 +1,494 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:list + * @fileoverview Tokenise a list. + */ + +'use strict'; + +/* eslint-disable max-params */ + +var trim = require('trim'); +var repeat = require('repeat-string'); +var decimal = require('is-decimal'); +var getIndent = require('../util/get-indentation'); +var removeIndent = require('../util/remove-indentation'); +var interrupt = require('../util/interrupt'); + +module.exports = list; + +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; +var C_PLUS = '+'; +var C_DASH = '-'; +var C_DOT = '.'; +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_PAREN_CLOSE = ')'; +var C_X_LOWER = 'x'; + +var TAB_SIZE = 4; +var EXPRESSION_LOOSE_LIST_ITEM = /\n\n(?!\s*$)/; +var EXPRESSION_TASK_ITEM = /^\[([ \t]|x|X)][ \t]/; +var EXPRESSION_BULLET = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/; +var EXPRESSION_PEDANTIC_BULLET = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/; +var EXPRESSION_INITIAL_INDENT = /^( {1,4}|\t)?/gm; + +/* Map of characters which can be used to mark + * list-items. */ +var LIST_UNORDERED_MARKERS = {}; + +LIST_UNORDERED_MARKERS[C_ASTERISK] = true; +LIST_UNORDERED_MARKERS[C_PLUS] = true; +LIST_UNORDERED_MARKERS[C_DASH] = true; + +/* Map of characters which can be used to mark + * list-items after a digit. */ +var LIST_ORDERED_MARKERS = {}; + +LIST_ORDERED_MARKERS[C_DOT] = true; + +/* Map of characters which can be used to mark + * list-items after a digit. */ +var LIST_ORDERED_COMMONMARK_MARKERS = {}; + +LIST_ORDERED_COMMONMARK_MARKERS[C_DOT] = true; +LIST_ORDERED_COMMONMARK_MARKERS[C_PAREN_CLOSE] = true; + +/* Tokenise a list. */ +function list(eat, value, silent) { + var self = this; + var commonmark = self.options.commonmark; + var pedantic = self.options.pedantic; + var tokenizers = self.blockTokenizers; + var interuptors = self.interruptList; + var markers; + var index = 0; + var length = value.length; + var start = null; + var size = 0; + var queue; + var ordered; + var character; + var marker; + var nextIndex; + var startIndex; + var prefixed; + var currentMarker; + var content; + var line; + var prevEmpty; + var empty; + var items; + var allLines; + var emptyLines; + var item; + var enterTop; + var exitBlockquote; + var isLoose; + var node; + var now; + var end; + var indented; + + while (index < length) { + character = value.charAt(index); + + if (character === C_TAB) { + size += TAB_SIZE - (size % TAB_SIZE); + } else if (character === C_SPACE) { + size++; + } else { + break; + } + + index++; + } + + if (size >= TAB_SIZE) { + return; + } + + character = value.charAt(index); + + markers = commonmark ? + LIST_ORDERED_COMMONMARK_MARKERS : + LIST_ORDERED_MARKERS; + + if (LIST_UNORDERED_MARKERS[character] === true) { + marker = character; + ordered = false; + } else { + ordered = true; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!decimal(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (!queue || markers[character] !== true) { + return; + } + + start = parseInt(queue, 10); + marker = character; + } + + character = value.charAt(++index); + + if (character !== C_SPACE && character !== C_TAB) { + return; + } + + if (silent) { + return true; + } + + index = 0; + items = []; + allLines = []; + emptyLines = []; + + while (index < length) { + nextIndex = value.indexOf(C_NEWLINE, index); + startIndex = index; + prefixed = false; + indented = false; + + if (nextIndex === -1) { + nextIndex = length; + } + + end = index + TAB_SIZE; + size = 0; + + while (index < length) { + character = value.charAt(index); + + if (character === C_TAB) { + size += TAB_SIZE - (size % TAB_SIZE); + } else if (character === C_SPACE) { + size++; + } else { + break; + } + + index++; + } + + if (size >= TAB_SIZE) { + indented = true; + } + + if (item && size >= item.indent) { + indented = true; + } + + character = value.charAt(index); + currentMarker = null; + + if (!indented) { + if (LIST_UNORDERED_MARKERS[character] === true) { + currentMarker = character; + index++; + size++; + } else { + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!decimal(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + index++; + + if (queue && markers[character] === true) { + currentMarker = character; + size += queue.length + 1; + } + } + + if (currentMarker) { + character = value.charAt(index); + + if (character === C_TAB) { + size += TAB_SIZE - (size % TAB_SIZE); + index++; + } else if (character === C_SPACE) { + end = index + TAB_SIZE; + + while (index < end) { + if (value.charAt(index) !== C_SPACE) { + break; + } + + index++; + size++; + } + + if (index === end && value.charAt(index) === C_SPACE) { + index -= TAB_SIZE - 1; + size -= TAB_SIZE - 1; + } + } else if (character !== C_NEWLINE && character !== '') { + currentMarker = null; + } + } + } + + if (currentMarker) { + if (!pedantic && marker !== currentMarker) { + break; + } + + prefixed = true; + } else { + if (!commonmark && !indented && value.charAt(startIndex) === C_SPACE) { + indented = true; + } else if (commonmark && item) { + indented = size >= item.indent || size > TAB_SIZE; + } + + prefixed = false; + index = startIndex; + } + + line = value.slice(startIndex, nextIndex); + content = startIndex === index ? line : value.slice(index, nextIndex); + + if ( + currentMarker === C_ASTERISK || + currentMarker === C_UNDERSCORE || + currentMarker === C_DASH + ) { + if (tokenizers.thematicBreak.call(self, eat, line, true)) { + break; + } + } + + prevEmpty = empty; + empty = !trim(content).length; + + if (indented && item) { + item.value = item.value.concat(emptyLines, line); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } else if (prefixed) { + if (emptyLines.length !== 0) { + item.value.push(''); + item.trail = emptyLines.concat(); + } + + item = { + value: [line], + indent: size, + trail: [] + }; + + items.push(item); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } else if (empty) { + if (prevEmpty) { + break; + } + + emptyLines.push(line); + } else { + if (prevEmpty) { + break; + } + + if (interrupt(interuptors, tokenizers, self, [eat, line, true])) { + break; + } + + item.value = item.value.concat(emptyLines, line); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } + + index = nextIndex + 1; + } + + node = eat(allLines.join(C_NEWLINE)).reset({ + type: 'list', + ordered: ordered, + start: start, + loose: null, + children: [] + }); + + enterTop = self.enterList(); + exitBlockquote = self.enterBlock(); + isLoose = false; + index = -1; + length = items.length; + + while (++index < length) { + item = items[index].value.join(C_NEWLINE); + now = eat.now(); + + item = eat(item)(listItem(self, item, now), node); + + if (item.loose) { + isLoose = true; + } + + item = items[index].trail.join(C_NEWLINE); + + if (index !== length - 1) { + item += C_NEWLINE; + } + + eat(item); + } + + enterTop(); + exitBlockquote(); + + node.loose = isLoose; + + return node; +} + +/** + * Create a list-item node. + * + * @example + * listItem('- _foo_', now()); + * + * @param {Object} ctx - Parser. + * @param {Object} value - List-item. + * @param {Object} position - List-item location. + * @return {Object} - `listItem` node. + */ +function listItem(ctx, value, position) { + var offsets = ctx.offset; + var fn = ctx.options.pedantic ? pedanticListItem : normalListItem; + var checked = null; + var task; + var indent; + + value = fn.apply(null, arguments); + + if (ctx.options.gfm) { + task = value.match(EXPRESSION_TASK_ITEM); + + if (task) { + indent = task[0].length; + checked = task[1].toLowerCase() === C_X_LOWER; + offsets[position.line] += indent; + value = value.slice(indent); + } + } + + return { + type: 'listItem', + loose: EXPRESSION_LOOSE_LIST_ITEM.test(value) || + value.charAt(value.length - 1) === C_NEWLINE, + checked: checked, + children: ctx.tokenizeBlock(value, position) + }; +} + +/* Create a list-item using overly simple mechanics. */ +function pedanticListItem(ctx, value, position) { + var offsets = ctx.offset; + var line = position.line; + + /* Remove the list-item’s bullet. */ + value = value.replace(EXPRESSION_PEDANTIC_BULLET, replacer); + + /* The initial line was also matched by the below, so + * we reset the `line`. */ + line = position.line; + + return value.replace(EXPRESSION_INITIAL_INDENT, replacer); + + /* A simple replacer which removed all matches, + * and adds their length to `offset`. */ + function replacer($0) { + offsets[line] = (offsets[line] || 0) + $0.length; + line++; + + return ''; + } +} + +/* Create a list-item using sane mechanics. */ +function normalListItem(ctx, value, position) { + var offsets = ctx.offset; + var line = position.line; + var max; + var bullet; + var rest; + var lines; + var trimmedLines; + var index; + var length; + + /* Remove the list-item’s bullet. */ + value = value.replace(EXPRESSION_BULLET, replacer); + + lines = value.split(C_NEWLINE); + + trimmedLines = removeIndent(value, getIndent(max).indent).split(C_NEWLINE); + + /* We replaced the initial bullet with something + * else above, which was used to trick + * `removeIndentation` into removing some more + * characters when possible. However, that could + * result in the initial line to be stripped more + * than it should be. */ + trimmedLines[0] = rest; + + offsets[line] = (offsets[line] || 0) + bullet.length; + line++; + + index = 0; + length = lines.length; + + while (++index < length) { + offsets[line] = (offsets[line] || 0) + + lines[index].length - trimmedLines[index].length; + line++; + } + + return trimmedLines.join(C_NEWLINE); + + function replacer($0, $1, $2, $3, $4) { + bullet = $1 + $2 + $3; + rest = $4; + + /* Make sure that the first nine numbered list items + * can indent with an extra space. That is, when + * the bullet did not receive an extra final space. */ + if (Number($2) < 10 && bullet.length % 2 === 1) { + $2 = C_SPACE + $2; + } + + max = $1 + repeat(C_SPACE, $2.length) + $3; + + return max + rest; + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/newline.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/newline.js new file mode 100644 index 00000000000000..f710e0ef976603 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/newline.js @@ -0,0 +1,55 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:newline + * @fileoverview Tokenise a newline. + */ + +'use strict'; + +var whitespace = require('is-whitespace-character'); + +module.exports = newline; + +/* Tokenise newline. */ +function newline(eat, value, silent) { + var character = value.charAt(0); + var length; + var subvalue; + var queue; + var index; + + if (character !== '\n') { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + index = 1; + length = value.length; + subvalue = character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + queue += character; + + if (character === '\n') { + subvalue += queue; + queue = ''; + } + + index++; + } + + eat(subvalue); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js new file mode 100644 index 00000000000000..7d064522ffecbd --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/paragraph.js @@ -0,0 +1,130 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:paragraph + * @fileoverview Tokenise a paragraph. + */ + +'use strict'; + +var trim = require('trim'); +var decimal = require('is-decimal'); +var trimTrailingLines = require('trim-trailing-lines'); +var interrupt = require('../util/interrupt'); + +module.exports = paragraph; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; + +var TAB_SIZE = 4; + +/* Tokenise paragraph. */ +function paragraph(eat, value, silent) { + var self = this; + var settings = self.options; + var commonmark = settings.commonmark; + var gfm = settings.gfm; + var tokenizers = self.blockTokenizers; + var interruptors = self.interruptParagraph; + var index = value.indexOf(C_NEWLINE); + var length = value.length; + var position; + var subvalue; + var character; + var size; + var now; + + while (index < length) { + /* Eat everything if there’s no following newline. */ + if (index === -1) { + index = length; + break; + } + + /* Stop if the next character is NEWLINE. */ + if (value.charAt(index + 1) === C_NEWLINE) { + break; + } + + /* In commonmark-mode, following indented lines + * are part of the paragraph. */ + if (commonmark) { + size = 0; + position = index + 1; + + while (position < length) { + character = value.charAt(position); + + if (character === C_TAB) { + size = TAB_SIZE; + break; + } else if (character === C_SPACE) { + size++; + } else { + break; + } + + position++; + } + + if (size >= TAB_SIZE) { + index = value.indexOf(C_NEWLINE, index + 1); + continue; + } + } + + subvalue = value.slice(index + 1); + + /* Check if the following code contains a possible + * block. */ + if (interrupt(interruptors, tokenizers, self, [eat, subvalue, true])) { + break; + } + + /* Break if the following line starts a list, when + * already in a list, or when in commonmark, or when + * in gfm mode and the bullet is *not* numeric. */ + if ( + tokenizers.list.call(self, eat, subvalue, true) && + ( + self.inList || + commonmark || + (gfm && !decimal(trim.left(subvalue).charAt(0))) + ) + ) { + break; + } + + position = index; + index = value.indexOf(C_NEWLINE, index + 1); + + if (index !== -1 && trim(value.slice(position, index)) === '') { + index = position; + break; + } + } + + subvalue = value.slice(0, index); + + if (trim(subvalue) === '') { + eat(subvalue); + + return null; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + subvalue = trimTrailingLines(subvalue); + + return eat(subvalue)({ + type: 'paragraph', + children: self.tokenizeInline(subvalue, now) + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/reference.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/reference.js new file mode 100644 index 00000000000000..1fa150d9e6b958 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/reference.js @@ -0,0 +1,219 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:reference + * @fileoverview Tokenise a reference. + */ + +'use strict'; + +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/link'); +var normalize = require('../util/normalize'); + +module.exports = reference; +reference.locator = locate; + +var T_LINK = 'link'; +var T_IMAGE = 'image'; +var T_FOOTNOTE = 'footnote'; +var REFERENCE_TYPE_SHORTCUT = 'shortcut'; +var REFERENCE_TYPE_COLLAPSED = 'collapsed'; +var REFERENCE_TYPE_FULL = 'full'; +var C_CARET = '^'; +var C_BACKSLASH = '\\'; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; + +/* Tokenise a reference. */ +function reference(eat, value, silent) { + var self = this; + var character = value.charAt(0); + var index = 0; + var length = value.length; + var subvalue = ''; + var intro = ''; + var type = T_LINK; + var referenceType = REFERENCE_TYPE_SHORTCUT; + var content; + var identifier; + var now; + var node; + var exit; + var queue; + var bracketed; + var depth; + + /* Check whether we’re eating an image. */ + if (character === '!') { + type = T_IMAGE; + intro = character; + character = value.charAt(++index); + } + + if (character !== C_BRACKET_OPEN) { + return; + } + + index++; + intro += character; + queue = ''; + + /* Check whether we’re eating a footnote. */ + if ( + self.options.footnotes && + type === T_LINK && + value.charAt(index) === C_CARET + ) { + intro += C_CARET; + index++; + type = T_FOOTNOTE; + } + + /* Eat the text. */ + depth = 0; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_OPEN) { + bracketed = true; + depth++; + } else if (character === C_BRACKET_CLOSE) { + if (!depth) { + break; + } + + depth--; + } + + if (character === C_BACKSLASH) { + queue += C_BACKSLASH; + character = value.charAt(++index); + } + + queue += character; + index++; + } + + subvalue = queue; + content = queue; + character = value.charAt(index); + + if (character !== C_BRACKET_CLOSE) { + return; + } + + index++; + subvalue += character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (character === C_BRACKET_OPEN) { + identifier = ''; + queue += character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_OPEN || character === C_BRACKET_CLOSE) { + break; + } + + if (character === C_BACKSLASH) { + identifier += C_BACKSLASH; + character = value.charAt(++index); + } + + identifier += character; + index++; + } + + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE) { + referenceType = identifier ? REFERENCE_TYPE_FULL : REFERENCE_TYPE_COLLAPSED; + queue += identifier + character; + index++; + } else { + identifier = ''; + } + + subvalue += queue; + queue = ''; + } else { + if (!content) { + return; + } + + identifier = content; + } + + /* Brackets cannot be inside the identifier. */ + if (referenceType !== REFERENCE_TYPE_FULL && bracketed) { + return; + } + + /* Inline footnotes cannot have an identifier. */ + if (type === T_FOOTNOTE && referenceType !== REFERENCE_TYPE_SHORTCUT) { + type = T_LINK; + intro = C_BRACKET_OPEN + C_CARET; + content = C_CARET + content; + } + + subvalue = intro + subvalue; + + if (type === T_LINK && self.inLink) { + return null; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + if (type === T_FOOTNOTE && content.indexOf(' ') !== -1) { + return eat(subvalue)({ + type: 'footnote', + children: this.tokenizeInline(content, eat.now()) + }); + } + + now = eat.now(); + now.column += intro.length; + now.offset += intro.length; + identifier = referenceType === REFERENCE_TYPE_FULL ? identifier : content; + + node = { + type: type + 'Reference', + identifier: normalize(identifier) + }; + + if (type === T_LINK || type === T_IMAGE) { + node.referenceType = referenceType; + } + + if (type === T_LINK) { + exit = self.enterLink(); + node.children = self.tokenizeInline(content, now); + exit(); + } else if (type === T_IMAGE) { + node.alt = self.decode.raw(self.unescape(content), now) || null; + } + + return eat(subvalue)(node); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/strong.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/strong.js new file mode 100644 index 00000000000000..765993fa0bd4b3 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/strong.js @@ -0,0 +1,93 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:strong + * @fileoverview Tokenise strong. + */ + +'use strict'; + +var trim = require('trim'); +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/strong'); + +module.exports = strong; +strong.locator = locate; + +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; + +/* Tokenise strong. */ +function strong(eat, value, silent) { + var self = this; + var index = 0; + var character = value.charAt(index); + var now; + var pedantic; + var marker; + var queue; + var subvalue; + var length; + var prev; + + if ( + (character !== C_ASTERISK && character !== C_UNDERSCORE) || + value.charAt(++index) !== character + ) { + return; + } + + pedantic = self.options.pedantic; + marker = character; + subvalue = marker + marker; + length = value.length; + index++; + queue = ''; + character = ''; + + if (pedantic && whitespace(value.charAt(index))) { + return; + } + + while (index < length) { + prev = character; + character = value.charAt(index); + + if ( + character === marker && + value.charAt(index + 1) === marker && + (!pedantic || !whitespace(prev)) + ) { + character = value.charAt(index + 2); + + if (character !== marker) { + if (!trim(queue)) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + now.column += 2; + now.offset += 2; + + return eat(subvalue + queue + subvalue)({ + type: 'strong', + children: self.tokenizeInline(queue, now) + }); + } + } + + if (!pedantic && character === '\\') { + queue += character; + character = value.charAt(++index); + } + + queue += character; + index++; + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/table.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/table.js new file mode 100644 index 00000000000000..c440067e1011d7 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/table.js @@ -0,0 +1,276 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:table + * @fileoverview Tokenise a table. + */ + +'use strict'; + +var whitespace = require('is-whitespace-character'); + +module.exports = table; +table.notInList = true; + +var C_BACKSLASH = '\\'; +var C_TICK = '`'; +var C_DASH = '-'; +var C_PIPE = '|'; +var C_COLON = ':'; +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; + +var MIN_TABLE_COLUMNS = 1; +var MIN_TABLE_ROWS = 2; + +var TABLE_ALIGN_LEFT = 'left'; +var TABLE_ALIGN_CENTER = 'center'; +var TABLE_ALIGN_RIGHT = 'right'; +var TABLE_ALIGN_NONE = null; + +/* Tokenise a table. */ +function table(eat, value, silent) { + var self = this; + var index; + var alignments; + var alignment; + var subvalue; + var row; + var length; + var lines; + var queue; + var character; + var hasDash; + var align; + var cell; + var preamble; + var count; + var opening; + var now; + var position; + var lineCount; + var line; + var rows; + var table; + var lineIndex; + var pipeIndex; + var first; + + /* Exit when not in gfm-mode. */ + if (!self.options.gfm) { + return; + } + + /* Get the rows. + * Detecting tables soon is hard, so there are some + * checks for performance here, such as the minimum + * number of rows, and allowed characters in the + * alignment row. */ + index = 0; + lineCount = 0; + length = value.length + 1; + lines = []; + + while (index < length) { + lineIndex = value.indexOf(C_NEWLINE, index); + pipeIndex = value.indexOf(C_PIPE, index + 1); + + if (lineIndex === -1) { + lineIndex = value.length; + } + + if (pipeIndex === -1 || pipeIndex > lineIndex) { + if (lineCount < MIN_TABLE_ROWS) { + return; + } + + break; + } + + lines.push(value.slice(index, lineIndex)); + lineCount++; + index = lineIndex + 1; + } + + /* Parse the alignment row. */ + subvalue = lines.join(C_NEWLINE); + alignments = lines.splice(1, 1)[0] || []; + index = 0; + length = alignments.length; + lineCount--; + alignment = false; + align = []; + + while (index < length) { + character = alignments.charAt(index); + + if (character === C_PIPE) { + hasDash = null; + + if (alignment === false) { + if (first === false) { + return; + } + } else { + align.push(alignment); + alignment = false; + } + + first = false; + } else if (character === C_DASH) { + hasDash = true; + alignment = alignment || TABLE_ALIGN_NONE; + } else if (character === C_COLON) { + if (alignment === TABLE_ALIGN_LEFT) { + alignment = TABLE_ALIGN_CENTER; + } else if (hasDash && alignment === TABLE_ALIGN_NONE) { + alignment = TABLE_ALIGN_RIGHT; + } else { + alignment = TABLE_ALIGN_LEFT; + } + } else if (!whitespace(character)) { + return; + } + + index++; + } + + if (alignment !== false) { + align.push(alignment); + } + + /* Exit when without enough columns. */ + if (align.length < MIN_TABLE_COLUMNS) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + /* Parse the rows. */ + position = -1; + rows = []; + + table = eat(subvalue).reset({ + type: 'table', + align: align, + children: rows + }); + + while (++position < lineCount) { + line = lines[position]; + row = {type: 'tableRow', children: []}; + + /* Eat a newline character when this is not the + * first row. */ + if (position) { + eat(C_NEWLINE); + } + + /* Eat the row. */ + eat(line).reset(row, table); + + length = line.length + 1; + index = 0; + queue = ''; + cell = ''; + preamble = true; + count = null; + opening = null; + + while (index < length) { + character = line.charAt(index); + + if (character === C_TAB || character === C_SPACE) { + if (cell) { + queue += character; + } else { + eat(character); + } + + index++; + continue; + } + + if (character === '' || character === C_PIPE) { + if (preamble) { + eat(character); + } else { + if (character && opening) { + queue += character; + index++; + continue; + } + + if ((cell || character) && !preamble) { + subvalue = cell; + + if (queue.length > 1) { + if (character) { + subvalue += queue.slice(0, queue.length - 1); + queue = queue.charAt(queue.length - 1); + } else { + subvalue += queue; + queue = ''; + } + } + + now = eat.now(); + + eat(subvalue)({ + type: 'tableCell', + children: self.tokenizeInline(cell, now) + }, row); + } + + eat(queue + character); + + queue = ''; + cell = ''; + } + } else { + if (queue) { + cell += queue; + queue = ''; + } + + cell += character; + + if (character === C_BACKSLASH && index !== length - 2) { + cell += line.charAt(index + 1); + index++; + } + + if (character === C_TICK) { + count = 1; + + while (line.charAt(index + 1) === character) { + cell += character; + index++; + count++; + } + + if (!opening) { + opening = count; + } else if (count >= opening) { + opening = 0; + } + } + } + + preamble = false; + index++; + } + + /* Eat the alignment row. */ + if (!position) { + eat(C_NEWLINE + alignments); + } + } + + return table; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/text.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/text.js new file mode 100644 index 00000000000000..ef6d3f2879d46e --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/text.js @@ -0,0 +1,67 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:text + * @fileoverview Tokenise text. + */ + +'use strict'; + +module.exports = text; + +/* Tokenise text. */ +function text(eat, value, silent) { + var self = this; + var methods; + var tokenizers; + var index; + var length; + var subvalue; + var position; + var tokenizer; + var name; + var min; + var now; + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + methods = self.inlineMethods; + length = methods.length; + tokenizers = self.inlineTokenizers; + index = -1; + min = value.length; + + while (++index < length) { + name = methods[index]; + + if (name === 'text' || !tokenizers[name]) { + continue; + } + + tokenizer = tokenizers[name].locator; + + if (!tokenizer) { + eat.file.fail('Missing locator: `' + name + '`'); + } + + position = tokenizer.call(self, value, 1); + + if (position !== -1 && position < min) { + min = position; + } + } + + subvalue = value.slice(0, min); + now = eat.now(); + + self.decode(subvalue, now, function (content, position, source) { + eat(source || content)({ + type: 'text', + value: content + }); + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js new file mode 100644 index 00000000000000..a580d09fe09c0b --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/thematic-break.js @@ -0,0 +1,79 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:thematic-break + * @fileoverview Tokenise a thematic break. + */ + +'use strict'; + +module.exports = thematicBreak; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; +var C_DASH = '-'; + +var THEMATIC_BREAK_MARKER_COUNT = 3; + +/* Tokenise a thematic break. */ +function thematicBreak(eat, value, silent) { + var index = -1; + var length = value.length + 1; + var subvalue = ''; + var character; + var marker; + var markerCount; + var queue; + + while (++index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + subvalue += character; + } + + if ( + character !== C_ASTERISK && + character !== C_DASH && + character !== C_UNDERSCORE + ) { + return; + } + + marker = character; + subvalue += character; + markerCount = 1; + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character === marker) { + markerCount++; + subvalue += queue + marker; + queue = ''; + } else if (character === C_SPACE) { + queue += character; + } else if ( + markerCount >= THEMATIC_BREAK_MARKER_COUNT && + (!character || character === C_NEWLINE) + ) { + subvalue += queue; + + if (silent) { + return true; + } + + return eat(subvalue)({type: 'thematicBreak'}); + } else { + return; + } + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/url.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/url.js new file mode 100644 index 00000000000000..fd2debd32f35fe --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/url.js @@ -0,0 +1,153 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:url + * @fileoverview Tokenise a URL. + */ + +'use strict'; + +var decode = require('parse-entities'); +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/url'); + +module.exports = url; +url.locator = locate; +url.notInLink = true; + +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_PAREN_OPEN = '('; +var C_PAREN_CLOSE = ')'; +var C_LT = '<'; +var C_AT_SIGN = '@'; + +var HTTP_PROTOCOL = 'http://'; +var HTTPS_PROTOCOL = 'https://'; +var MAILTO_PROTOCOL = 'mailto:'; + +var PROTOCOLS = [ + HTTP_PROTOCOL, + HTTPS_PROTOCOL, + MAILTO_PROTOCOL +]; + +var PROTOCOLS_LENGTH = PROTOCOLS.length; + +/* Tokenise a URL. */ +function url(eat, value, silent) { + var self = this; + var subvalue; + var content; + var character; + var index; + var position; + var protocol; + var match; + var length; + var queue; + var parenCount; + var nextCharacter; + var exit; + + if (!self.options.gfm) { + return; + } + + subvalue = ''; + index = -1; + length = PROTOCOLS_LENGTH; + + while (++index < length) { + protocol = PROTOCOLS[index]; + match = value.slice(0, protocol.length); + + if (match.toLowerCase() === protocol) { + subvalue = match; + break; + } + } + + if (!subvalue) { + return; + } + + index = subvalue.length; + length = value.length; + queue = ''; + parenCount = 0; + + while (index < length) { + character = value.charAt(index); + + if (whitespace(character) || character === C_LT) { + break; + } + + if ( + character === '.' || + character === ',' || + character === ':' || + character === ';' || + character === '"' || + character === '\'' || + character === ')' || + character === ']' + ) { + nextCharacter = value.charAt(index + 1); + + if (!nextCharacter || whitespace(nextCharacter)) { + break; + } + } + + if (character === C_PAREN_OPEN || character === C_BRACKET_OPEN) { + parenCount++; + } + + if (character === C_PAREN_CLOSE || character === C_BRACKET_CLOSE) { + parenCount--; + + if (parenCount < 0) { + break; + } + } + + queue += character; + index++; + } + + if (!queue) { + return; + } + + subvalue += queue; + content = subvalue; + + if (protocol === MAILTO_PROTOCOL) { + position = queue.indexOf(C_AT_SIGN); + + if (position === -1 || position === length - 1) { + return; + } + + content = content.substr(MAILTO_PROTOCOL.length); + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + exit = self.enterLink(); + content = self.tokenizeInline(content, eat.now()); + exit(); + + return eat(subvalue)({ + type: 'link', + title: null, + url: decode(subvalue), + children: content + }); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenize/yaml.js b/tools/eslint/node_modules/remark-parse/lib/tokenize/yaml.js new file mode 100644 index 00000000000000..78dec31a0f9eb8 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenize/yaml.js @@ -0,0 +1,74 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenize:yaml + * @fileoverview Tokenise YAML. + */ + +'use strict'; + +module.exports = yaml; +yaml.onlyAtStart = true; + +var FENCE = '---'; +var C_DASH = '-'; +var C_NEWLINE = '\n'; + +/* Tokenise YAML. */ +function yaml(eat, value, silent) { + var self = this; + var subvalue; + var content; + var index; + var length; + var character; + var queue; + + if ( + !self.options.yaml || + value.charAt(0) !== C_DASH || + value.charAt(1) !== C_DASH || + value.charAt(2) !== C_DASH || + value.charAt(3) !== C_NEWLINE + ) { + return; + } + + subvalue = FENCE + C_NEWLINE; + content = ''; + queue = ''; + index = 3; + length = value.length; + + while (++index < length) { + character = value.charAt(index); + + if ( + character === C_DASH && + (queue || !content) && + value.charAt(index + 1) === C_DASH && + value.charAt(index + 2) === C_DASH + ) { + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + subvalue += queue + FENCE; + + return eat(subvalue)({ + type: 'yaml', + value: content + }); + } + + if (character === C_NEWLINE) { + queue += character; + } else { + subvalue += queue + character; + content += queue + character; + queue = ''; + } + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/tokenizer.js b/tools/eslint/node_modules/remark-parse/lib/tokenizer.js new file mode 100644 index 00000000000000..aefe551fc37993 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/tokenizer.js @@ -0,0 +1,451 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:tokenizer + * @fileoverview Markdown tokenizer. + */ + +'use strict'; + +module.exports = factory; + +var MERGEABLE_NODES = { + text: mergeText, + blockquote: mergeBlockquote +}; + +/* Check whether a node is mergeable with adjacent nodes. */ +function mergeable(node) { + var start; + var end; + + if (node.type !== 'text' || !node.position) { + return true; + } + + start = node.position.start; + end = node.position.end; + + /* Only merge nodes which occupy the same size as their + * `value`. */ + return start.line !== end.line || + end.column - start.column === node.value.length; +} + +/* Merge two text nodes: `node` into `prev`. */ +function mergeText(prev, node) { + prev.value += node.value; + + return prev; +} + +/* Merge two blockquotes: `node` into `prev`, unless in + * CommonMark mode. */ +function mergeBlockquote(prev, node) { + if (this.options.commonmark) { + return node; + } + + prev.children = prev.children.concat(node.children); + + return prev; +} + +/* Construct a tokenizer. This creates both + * `tokenizeInline` and `tokenizeBlock`. */ +function factory(type) { + return tokenize; + + /* Tokenizer for a bound `type`. */ + function tokenize(value, location) { + var self = this; + var offset = self.offset; + var tokens = []; + var methods = self[type + 'Methods']; + var tokenizers = self[type + 'Tokenizers']; + var line = location.line; + var column = location.column; + var index; + var length; + var method; + var name; + var matched; + var valueLength; + + /* Trim white space only lines. */ + if (!value) { + return tokens; + } + + /* Expose on `eat`. */ + eat.now = now; + eat.file = self.file; + + /* Sync initial offset. */ + updatePosition(''); + + /* Iterate over `value`, and iterate over all + * tokenizers. When one eats something, re-iterate + * with the remaining value. If no tokenizer eats, + * something failed (should not happen) and an + * exception is thrown. */ + while (value) { + index = -1; + length = methods.length; + matched = false; + + while (++index < length) { + name = methods[index]; + method = tokenizers[name]; + + if ( + method && + (!method.onlyAtStart || self.atStart) && + (!method.notInList || !self.inList) && + (!method.notInBlock || !self.inBlock) && + (!method.notInLink || !self.inLink) + ) { + valueLength = value.length; + + method.apply(self, [eat, value]); + + matched = valueLength !== value.length; + + if (matched) { + break; + } + } + } + + /* istanbul ignore if */ + if (!matched) { + self.file.fail(new Error('Infinite loop'), eat.now()); + } + } + + self.eof = now(); + + return tokens; + + /** + * Update line, column, and offset based on + * `value`. + * + * @example + * updatePosition('foo'); + * + * @param {string} subvalue - Subvalue to eat. + */ + function updatePosition(subvalue) { + var lastIndex = -1; + var index = subvalue.indexOf('\n'); + + while (index !== -1) { + line++; + lastIndex = index; + index = subvalue.indexOf('\n', index + 1); + } + + if (lastIndex === -1) { + column += subvalue.length; + } else { + column = subvalue.length - lastIndex; + } + + if (line in offset) { + if (lastIndex !== -1) { + column += offset[line]; + } else if (column <= offset[line]) { + column = offset[line] + 1; + } + } + } + + /** + * Get offset. Called before the first character is + * eaten to retrieve the range's offsets. + * + * @return {Function} - `done`, to be called when + * the last character is eaten. + */ + function getOffset() { + var indentation = []; + var pos = line + 1; + + /** + * Done. Called when the last character is + * eaten to retrieve the range’s offsets. + * + * @return {Array.} - Offset. + */ + return function () { + var last = line + 1; + + while (pos < last) { + indentation.push((offset[pos] || 0) + 1); + + pos++; + } + + return indentation; + }; + } + + /** + * Get the current position. + * + * @example + * position = now(); // {line: 1, column: 1, offset: 0} + * + * @return {Object} - Current Position. + */ + function now() { + var pos = {line: line, column: column}; + + pos.offset = self.toOffset(pos); + + return pos; + } + + /** + * Store position information for a node. + * + * @example + * start = now(); + * updatePosition('foo'); + * location = new Position(start); + * // { + * // start: {line: 1, column: 1, offset: 0}, + * // end: {line: 1, column: 3, offset: 2} + * // } + * + * @param {Object} start - Starting position. + */ + function Position(start) { + this.start = start; + this.end = now(); + } + + /** + * Throw when a value is incorrectly eaten. + * This shouldn’t happen but will throw on new, + * incorrect rules. + * + * @example + * // When the current value is set to `foo bar`. + * validateEat('foo'); + * eat('foo'); + * + * validateEat('bar'); + * // throws, because the space is not eaten. + * + * @param {string} subvalue - Value to be eaten. + * @throws {Error} - When `subvalue` cannot be eaten. + */ + function validateEat(subvalue) { + /* istanbul ignore if */ + if (value.substring(0, subvalue.length) !== subvalue) { + /* Capture stack-trace. */ + self.file.fail( + new Error( + 'Incorrectly eaten value: please report this ' + + 'warning on http://git.io/vg5Ft' + ), + now() + ); + } + } + + /** + * Mark position and patch `node.position`. + * + * @example + * var update = position(); + * updatePosition('foo'); + * update({}); + * // { + * // position: { + * // start: {line: 1, column: 1, offset: 0}, + * // end: {line: 1, column: 3, offset: 2} + * // } + * // } + * + * @returns {Function} - Updater. + */ + function position() { + var before = now(); + + return update; + + /** + * Add the position to a node. + * + * @example + * update({type: 'text', value: 'foo'}); + * + * @param {Node} node - Node to attach position + * on. + * @param {Array} [indent] - Indentation for + * `node`. + * @return {Node} - `node`. + */ + function update(node, indent) { + var prev = node.position; + var start = prev ? prev.start : before; + var combined = []; + var n = prev && prev.end.line; + var l = before.line; + + node.position = new Position(start); + + /* If there was already a `position`, this + * node was merged. Fixing `start` wasn’t + * hard, but the indent is different. + * Especially because some information, the + * indent between `n` and `l` wasn’t + * tracked. Luckily, that space is + * (should be?) empty, so we can safely + * check for it now. */ + if (prev && indent && prev.indent) { + combined = prev.indent; + + if (n < l) { + while (++n < l) { + combined.push((offset[n] || 0) + 1); + } + + combined.push(before.column); + } + + indent = combined.concat(indent); + } + + node.position.indent = indent || []; + + return node; + } + } + + /** + * Add `node` to `parent`s children or to `tokens`. + * Performs merges where possible. + * + * @example + * add({}); + * + * add({}, {children: []}); + * + * @param {Object} node - Node to add. + * @param {Object} [parent] - Parent to insert into. + * @return {Object} - Added or merged into node. + */ + function add(node, parent) { + var children = parent ? parent.children : tokens; + var prev = children[children.length - 1]; + + if ( + prev && + node.type === prev.type && + node.type in MERGEABLE_NODES && + mergeable(prev) && + mergeable(node) + ) { + node = MERGEABLE_NODES[node.type].call(self, prev, node); + } + + if (node !== prev) { + children.push(node); + } + + if (self.atStart && tokens.length !== 0) { + self.exitStart(); + } + + return node; + } + + /** + * Remove `subvalue` from `value`. + * `subvalue` must be at the start of `value`. + * + * @example + * eat('foo')({type: 'text', value: 'foo'}); + * + * @param {string} subvalue - Removed from `value`, + * and passed to `updatePosition`. + * @return {Function} - Wrapper around `add`, which + * also adds `position` to node. + */ + function eat(subvalue) { + var indent = getOffset(); + var pos = position(); + var current = now(); + + validateEat(subvalue); + + apply.reset = reset; + reset.test = test; + apply.test = test; + + value = value.substring(subvalue.length); + + updatePosition(subvalue); + + indent = indent(); + + return apply; + + /** + * Add the given arguments, add `position` to + * the returned node, and return the node. + * + * @param {Object} node - Node to add. + * @param {Object} [parent] - Node to insert into. + * @return {Node} - Added node. + */ + function apply(node, parent) { + return pos(add(pos(node), parent), indent); + } + + /** + * Functions just like apply, but resets the + * content: the line and column are reversed, + * and the eaten value is re-added. + * + * This is useful for nodes with a single + * type of content, such as lists and tables. + * + * See `apply` above for what parameters are + * expected. + * + * @return {Node} - Added node. + */ + function reset() { + var node = apply.apply(null, arguments); + + line = current.line; + column = current.column; + value = subvalue + value; + + return node; + } + + /** + * Test the position, after eating, and reverse + * to a not-eaten state. + * + * @return {Position} - Position after eating `subvalue`. + */ + function test() { + var result = pos({}); + + line = current.line; + column = current.column; + value = subvalue + value; + + return result.position; + } + } + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/unescape.js b/tools/eslint/node_modules/remark-parse/lib/unescape.js new file mode 100644 index 00000000000000..dc83486126112c --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/unescape.js @@ -0,0 +1,46 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:unescape + * @fileoverview Unescape escapes. + */ + +'use strict'; + +/* Expose. */ +module.exports = factory; + +/* Factory to de-escape a value, based on a list at `key` + * in `ctx`. */ +function factory(ctx, key) { + return unescape; + + /* De-escape a string using the expression at `key` + * in `ctx`. */ + function unescape(value) { + var prev = 0; + var index = value.indexOf('\\'); + var escape = ctx[key]; + var queue = []; + var character; + + while (index !== -1) { + queue.push(value.slice(prev, index)); + prev = index + 1; + character = value.charAt(prev); + + /* If the following character is not a valid escape, + * add the slash. */ + if (!character || escape.indexOf(character) === -1) { + queue.push('\\'); + } + + index = value.indexOf('\\', prev); + } + + queue.push(value.slice(prev)); + + return queue.join(''); + } +} diff --git a/tools/eslint/node_modules/remark-parse/lib/util/get-indentation.js b/tools/eslint/node_modules/remark-parse/lib/util/get-indentation.js new file mode 100644 index 00000000000000..eebd40c94ac26b --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/util/get-indentation.js @@ -0,0 +1,46 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:util:get-indentation + * @fileoverview Get indentation. + */ + +'use strict'; + +/* Expose. */ +module.exports = indentation; + +/* Map of characters, and their column length, + * which can be used as indentation. */ +var characters = {' ': 1, '\t': 4}; + +/** + * Gets indentation information for a line. + * + * @param {string} value - Indented line. + * @return {Object} - Indetation information. + */ +function indentation(value) { + var index = 0; + var indent = 0; + var character = value.charAt(index); + var stops = {}; + var size; + + while (character in characters) { + size = characters[character]; + + indent += size; + + if (size > 1) { + indent = Math.floor(indent / size) * size; + } + + stops[indent] = index; + + character = value.charAt(++index); + } + + return {indent: indent, stops: stops}; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/util/html.js b/tools/eslint/node_modules/remark-parse/lib/util/html.js new file mode 100644 index 00000000000000..234ba342e1d3fa --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/util/html.js @@ -0,0 +1,33 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:util:html + * @fileoverview HTML regexes. + */ + +'use strict'; + +var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; +var unquoted = '[^"\'=<>`\\u0000-\\u0020]+'; +var singleQuoted = '\'[^\']*\''; +var doubleQuoted = '"[^"]*"'; +var attributeValue = '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')'; +var attribute = '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)'; +var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'; +var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'; +var comment = '|'; +var processing = '<[?].*?[?]>'; +var declaration = ']*>'; +var cdata = ''; + +exports.openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')'); + +exports.tag = new RegExp('^(?:' + + openTag + '|' + + closeTag + '|' + + comment + '|' + + processing + '|' + + declaration + '|' + + cdata + +')'); diff --git a/tools/eslint/node_modules/remark-parse/lib/util/interrupt.js b/tools/eslint/node_modules/remark-parse/lib/util/interrupt.js new file mode 100644 index 00000000000000..b8dc2305501db1 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/util/interrupt.js @@ -0,0 +1,51 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:util:get-indentation + * @fileoverview Get indentation. + */ + +'use strict'; + +module.exports = interrupt; + +function interrupt(interruptors, tokenizers, ctx, params) { + var bools = ['pedantic', 'commonmark']; + var count = bools.length; + var length = interruptors.length; + var index = -1; + var interruptor; + var config; + var fn; + var offset; + var bool; + var ignore; + + while (++index < length) { + interruptor = interruptors[index]; + config = interruptor[1] || {}; + fn = interruptor[0]; + offset = -1; + ignore = false; + + while (++offset < count) { + bool = bools[offset]; + + if (config[bool] !== undefined && config[bool] !== ctx.options[bool]) { + ignore = true; + break; + } + } + + if (ignore) { + continue; + } + + if (tokenizers[fn].apply(ctx, params)) { + return true; + } + } + + return false; +} diff --git a/tools/eslint/node_modules/remark-parse/lib/util/normalize.js b/tools/eslint/node_modules/remark-parse/lib/util/normalize.js new file mode 100644 index 00000000000000..3602a18f788317 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/util/normalize.js @@ -0,0 +1,29 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:util:normalize + * @fileoverview Normalize an identifier. + */ + +'use strict'; + +/* Dependencies. */ +var collapseWhiteSpace = require('collapse-white-space'); + +/* Expose. */ +module.exports = normalize; + +/** + * Normalize an identifier. Collapses multiple white space + * characters into a single space, and removes casing. + * + * @example + * normalizeIdentifier('FOO\t bar'); // 'foo bar' + * + * @param {string} value - Content to normalize. + * @return {string} - Normalized content. + */ +function normalize(value) { + return collapseWhiteSpace(value).toLowerCase(); +} diff --git a/tools/eslint/node_modules/remark-parse/lib/util/remove-indentation.js b/tools/eslint/node_modules/remark-parse/lib/util/remove-indentation.js new file mode 100644 index 00000000000000..d56db0bad4b735 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/lib/util/remove-indentation.js @@ -0,0 +1,102 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module remark:parse:util:remove-indentation + * @fileoverview Remove indentation. + */ + +'use strict'; + +/* Dependencies. */ +var trim = require('trim'); +var repeat = require('repeat-string'); +var getIndent = require('./get-indentation'); + +/* Expose. */ +module.exports = indentation; + +/* Characters. */ +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; + +/** + * Remove the minimum indent from every line in `value`. + * Supports both tab, spaced, and mixed indentation (as + * well as possible). + * + * @example + * removeIndentation(' foo'); // 'foo' + * removeIndentation(' foo', 2); // ' foo' + * removeIndentation('\tfoo', 2); // ' foo' + * removeIndentation(' foo\n bar'); // ' foo\n bar' + * + * @param {string} value - Value to trim. + * @param {number?} [maximum] - Maximum indentation + * to remove. + * @return {string} - Unindented `value`. + */ +function indentation(value, maximum) { + var values = value.split(C_NEWLINE); + var position = values.length + 1; + var minIndent = Infinity; + var matrix = []; + var index; + var indentation; + var stops; + var padding; + + values.unshift(repeat(C_SPACE, maximum) + '!'); + + while (position--) { + indentation = getIndent(values[position]); + + matrix[position] = indentation.stops; + + if (trim(values[position]).length === 0) { + continue; + } + + if (indentation.indent) { + if (indentation.indent > 0 && indentation.indent < minIndent) { + minIndent = indentation.indent; + } + } else { + minIndent = Infinity; + + break; + } + } + + if (minIndent !== Infinity) { + position = values.length; + + while (position--) { + stops = matrix[position]; + index = minIndent; + + while (index && !(index in stops)) { + index--; + } + + if ( + trim(values[position]).length !== 0 && + minIndent && + index !== minIndent + ) { + padding = C_TAB; + } else { + padding = ''; + } + + values[position] = padding + values[position].slice( + index in stops ? stops[index] + 1 : 0 + ); + } + } + + values.shift(); + + return values.join(C_NEWLINE); +} diff --git a/tools/eslint/node_modules/remark-parse/package.json b/tools/eslint/node_modules/remark-parse/package.json new file mode 100644 index 00000000000000..166c662b4b02d7 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/package.json @@ -0,0 +1,86 @@ +{ + "_from": "remark-parse@^3.0.0", + "_id": "remark-parse@3.0.1", + "_inBundle": false, + "_integrity": "sha1-G5+EGkTY9PvyJGhQJlRZpOs1TIA=", + "_location": "/remark-parse", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-parse@^3.0.0", + "name": "remark-parse", + "escapedName": "remark-parse", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/eslint-plugin-markdown" + ], + "_resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-3.0.1.tgz", + "_shasum": "1b9f841a44d8f4fbf2246850265459a4eb354c80", + "_spec": "remark-parse@^3.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\eslint-plugin-markdown", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/remark/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + } + ], + "dependencies": { + "collapse-white-space": "^1.0.2", + "has": "^1.0.1", + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "is-word-character": "^1.0.0", + "markdown-escapes": "^1.0.0", + "parse-entities": "^1.0.2", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "trim": "0.0.1", + "trim-trailing-lines": "^1.0.0", + "unherit": "^1.0.4", + "unist-util-remove-position": "^1.0.0", + "vfile-location": "^2.0.0", + "xtend": "^4.0.1" + }, + "deprecated": false, + "description": "Markdown parser for remark", + "files": [ + "index.js", + "lib" + ], + "homepage": "http://remark.js.org", + "keywords": [ + "markdown", + "abstract", + "syntax", + "tree", + "ast", + "parse" + ], + "license": "MIT", + "name": "remark-parse", + "repository": { + "type": "git", + "url": "https://github.com/wooorm/remark/tree/master/packages/remark-parse" + }, + "version": "3.0.1", + "xo": false +} diff --git a/tools/eslint/node_modules/remark-parse/readme.md b/tools/eslint/node_modules/remark-parse/readme.md new file mode 100644 index 00000000000000..53426f41eee224 --- /dev/null +++ b/tools/eslint/node_modules/remark-parse/readme.md @@ -0,0 +1,448 @@ +# remark-parse [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] + +[Parser][] for [**unified**][unified]. Parses markdown to an +[**MDAST**][mdast] syntax tree. Used in the [**remark** +processor][processor]. Can be [extended][extend] to change how +markdown is parsed. + +## Installation + +[npm][]: + +```sh +npm install remark-parse +``` + +## Usage + +```js +var unified = require('unified'); +var createStream = require('unified-stream'); +var markdown = require('remark-parse'); +var html = require('remark-html'); + +var processor = unified() + .use(markdown, {commonmark: true}) + .use(html) + +process.stdin + .pipe(createStream(processor)) + .pipe(process.stdout); +``` + +## Table of Contents + +* [API](#api) + * [processor.use(parse)](#processoruseparse) + * [parse.Parser](#parseparser) +* [Extending the Parser](#extending-the-parser) + * [Parser#blockTokenizers](#parserblocktokenizers) + * [Parser#blockMethods](#parserblockmethods) + * [Parser#inlineTokenizers](#parserinlinetokenizers) + * [Parser#inlineMethods](#parserinlinemethods) + * [function tokenizer(eat, value, silent)](#function-tokenizereat-value-silent) + * [tokenizer.locator(value, fromIndex)](#tokenizerlocatorvalue-fromindex) + * [eat(subvalue)](#eatsubvalue) + * [add(node\[, parent\])](#addnode-parent) + * [add.test()](#addtest) + * [add.reset(node\[, parent\])](#addresetnode-parent) +* [License](#license) + +## API + +### `processor.use(parse)` + +Configure the `processor` to read markdown as input and process an +[**MDAST**][mdast] syntax tree. + +#### `options` + +Options are passed later through [`processor.parse()`][parse], +[`processor.process()`][process], or [`processor.pipe()`][pipe]. +The following settings are supported: + +* [`gfm`][options-gfm] (`boolean`, default: `true`) +* [`yaml`][options-yaml] (`boolean`, default: `true`) +* [`commonmark`][options-commonmark] (`boolean`, default: `false`) +* [`footnotes`][options-footnotes] (`boolean`, default: `false`) +* [`pedantic`][options-pedantic] (`boolean`, default: `false`) +* [`breaks`][options-breaks] (`boolean`, default: `false`) +* [`blocks`][options-blocks] (`Array.`, default: list of block HTML + elements) + +##### `options.gfm` + +```md +hello ~~hi~~ world +``` + +GFM mode (default: `true`) turns on: + +* [Fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) +* [Autolinking of URLs](https://help.github.com/articles/github-flavored-markdown/#url-autolinking) +* [Deletions (strikethrough)](https://help.github.com/articles/github-flavored-markdown/#strikethrough) +* [Task lists](https://help.github.com/articles/writing-on-github/#task-lists) +* [Tables](https://help.github.com/articles/github-flavored-markdown/#tables) + +##### `options.yaml` + +```md +--- +title: YAML is Cool +--- + +# YAML is Cool +``` + +YAML mode (default: `true`) enables raw YAML front matter to be detected +at the top. + +##### `options.commonmark` + +```md +This is a paragraph + and this is also part of the preceding paragraph. +``` + +CommonMark mode (default: `false`) allows: + +* Empty lines to split blockquotes +* Parentheses (`(` and `)`) around for link and image titles +* Any escaped [ASCII-punctuation][escapes] character +* Closing parenthesis (`)`) as an ordered list marker +* URL definitions (and footnotes, when enabled) in blockquotes + +CommonMark mode disallows: + +* Code directly following a paragraph +* ATX-headings (`# Hash headings`) without spacing after opening hashes + or and before closing hashes +* Setext headings (`Underline headings\n---`) when following a paragraph +* Newlines in link and image titles +* White space in link and image URLs in auto-links (links in brackets, + `<` and `>`) +* Lazy blockquote continuation, lines not preceded by a closing angle + bracket (`>`), for lists, code, and thematicBreak + +##### `options.footnotes` + +```md +Something something[^or something?]. + +And something else[^1]. + +[^1]: This reference footnote contains a paragraph... + + * ...and a list +``` + +Footnotes mode (default: `false`) enables reference footnotes and inline +footnotes. Both are wrapped in square brackets and preceded by a caret +(`^`), and can be referenced from inside other footnotes. + +##### `options.breaks` + +```md +This is a +paragraph. +``` + +Breaks mode (default: `false`) exposes newline characters inside +paragraphs as breaks. + +##### `options.blocks` + +```md +foo + +``` + +Blocks (default: a list of HTML block elements) exposes +let’s users define block-level HTML elements. + +##### `options.pedantic` + +```md +Check out some_file_name.txt +``` + +Pedantic mode (default: `false`) turns on: + +* Emphasis (`_alpha_`) and importance (`__bravo__`) with underscores + in words +* Unordered lists with different markers (`*`, `-`, `+`) +* If `commonmark` is also turned on, ordered lists with different + markers (`.`, `)`) +* And pedantic mode removes less spaces in list-items (at most four, + instead of the whole indent) + +### `parse.Parser` + +Access to the [parser][], if you need it. + +## Extending the Parser + +Most often, using transformers to manipulate a syntax tree produces +the desired output. Sometimes, mainly when introducing new syntactic +entities with a certain level of precedence, interfacing with the parser +is necessary. + +If this plug-in is used, it adds a [`Parser`][parser] constructor to +the `processor`. Other plug-ins can add tokenizers to the parser’s +prototype to change how markdown is parsed. + +The below plug-in adds a [tokenizer][] for at-mentions. + +```js +module.exports = mentions; + +function mentions() { + var Parser = this.Parser; + var tokenizers = Parser.prototype.inlineTokenizers; + var methods = Parser.prototype.inlineMethods; + + /* Add an inline tokenizer (defined in the following example). */ + tokenizers.mention = tokenizeMention; + + /* Run it just before `text`. */ + methods.splice(methods.indexOf('text'), 0, 'mention'); +} +``` + +### `Parser#blockTokenizers` + +An object mapping tokenizer names to [tokenizer][]s. These +tokenizers (for example: `fencedCode`, `table`, and `paragraph`) eat +from the start of a value to a line ending. + +### `Parser#blockMethods` + +Array of `blockTokenizers` names (`string`) specifying the order in +which they run. + +### `Parser#inlineTokenizers` + +An object mapping tokenizer names to [tokenizer][]s. These tokenizers +(for example: `url`, `reference`, and `emphasis`) eat from the start +of a value. To increase performance, they depend on [locator][]s. + +### `Parser#inlineMethods` + +Array of `inlineTokenizers` names (`string`) specifying the order in +which they run. + +### `function tokenizer(eat, value, silent)` + +```js +tokenizeMention.notInLink = true; +tokenizeMention.locator = locateMention; + +function tokenizeMention(eat, value, silent) { + var match = /^@(\w+)/.exec(value); + + if (match) { + if (silent) { + return true; + } + + return eat(match[0])({ + type: 'link', + url: 'https://social-network/' + match[1], + children: [{type: 'text', value: match[0]}] + }); + } +} +``` + +The parser knows two types of tokenizers: block level and inline level. +Block level tokenizers are the same as inline level tokenizers, with +the exception that the latter must have a [locator][]. + +Tokenizers _test_ whether a document starts with a certain syntactic +entity. In _silent_ mode, they return whether that test passes. +In _normal_ mode, they consume that token, a process which is called +“eating”. Locators enable tokenizers to function faster by providing +information on where the next entity may occur. + +###### Signatures + +* `Node? = tokenizer(eat, value)` +* `boolean? = tokenizer(eat, value, silent)` + +###### Parameters + +* `eat` ([`Function`][eat]) — Eat, when applicable, an entity +* `value` (`string`) — Value which may start an entity +* `silent` (`boolean`, optional) — Whether to detect or consume + +###### Properties + +* `locator` ([`Function`][locator]) + — Required for inline tokenizers +* `onlyAtStart` (`boolean`) + — Whether nodes can only be found at the beginning of the document +* `notInBlock` (`boolean`) + — Whether nodes cannot be in blockquotes, lists, or footnote + definitions +* `notInList` (`boolean`) + — Whether nodes cannot be in lists +* `notInLink` (`boolean`) + — Whether nodes cannot be in links + +###### Returns + +* In _silent_ mode, whether a node can be found at the start of `value` +* In _normal_ mode, a node if it can be found at the start of `value` + +### `tokenizer.locator(value, fromIndex)` + +```js +function locateMention(value, fromIndex) { + return value.indexOf('@', fromIndex); +} +``` + +Locators are required for inline tokenization to keep the process +performant. Locators enable inline tokenizers to function faster by +providing information on the where the next entity occurs. Locators +may be wrong, it’s OK if there actually isn’t a node to be found at +the index they return, but they must skip any nodes. + +###### Parameters + +* `value` (`string`) — Value which may contain an entity +* `fromIndex` (`number`) — Position to start searching at + +###### Returns + +Index at which an entity may start, and `-1` otherwise. + +### `eat(subvalue)` + +```js +var add = eat('foo'); +``` + +Eat `subvalue`, which is a string at the start of the +[tokenize][tokenizer]d `value` (it’s tracked to ensure the correct +value is eaten). + +###### Parameters + +* `subvalue` (`string`) - Value to eat. + +###### Returns + +[`add`][add]. + +### `add(node[, parent])` + +```js +var add = eat('foo'); +add({type: 'text', value: 'foo'}); +``` + +Add [positional information][location] to `node` and add it to `parent`. + +###### Parameters + +* `node` ([`Node`][node]) - Node to patch position on and insert +* `parent` ([`Node`][node], optional) - Place to add `node` to in + the syntax tree. Defaults to the currently processed node + +###### Returns + +The given `node`. + +### `add.test()` + +Get the [positional information][location] which would be patched on +`node` by `add`. + +###### Returns + +[`Location`][location]. + +### `add.reset(node[, parent])` + +`add`, but resets the internal location. Useful for example in +lists, where the same content is first eaten for a list, and later +for list items + +###### Parameters + +* `node` ([`Node`][node]) - Node to patch position on and insert +* `parent` ([`Node`][node], optional) - Place to add `node` to in + the syntax tree. Defaults to the currently processed node + +###### Returns + +The given `node`. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/remark.svg + +[build-status]: https://travis-ci.org/wooorm/remark + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark.svg + +[coverage-status]: https://codecov.io/github/wooorm/remark + +[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg + +[chat]: https://gitter.im/wooorm/remark + +[license]: https://github.com/wooorm/remark/blob/master/LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[unified]: https://github.com/wooorm/unified + +[parse]: https://github.com/wooorm/unified#processorparsefilevalue-options + +[process]: https://github.com/wooorm/unified#processorprocessfilevalue-options-done + +[pipe]: https://github.com/wooorm/unified#processorpipestream-options + +[processor]: https://github.com/wooorm/remark/blob/master/packages/remark + +[mdast]: https://github.com/wooorm/mdast + +[escapes]: http://spec.commonmark.org/0.25/#backslash-escapes + +[node]: https://github.com/wooorm/unist#node + +[location]: https://github.com/wooorm/unist#location + +[options-gfm]: #optionsgfm + +[options-yaml]: #optionsyaml + +[options-commonmark]: #optionscommonmark + +[options-footnotes]: #optionsfootnotes + +[options-pedantic]: #optionspedantic + +[options-breaks]: #optionsbreaks + +[options-blocks]: #optionsblocks + +[parser]: https://github.com/wooorm/unified#processorparser + +[extend]: #extending-the-parser + +[tokenizer]: #function-tokenizereat-value-silent + +[locator]: #tokenizerlocatorvalue-fromindex + +[eat]: #eatsubvalue + +[add]: #addnode-parent diff --git a/tools/eslint/node_modules/repeat-string/LICENSE b/tools/eslint/node_modules/repeat-string/LICENSE new file mode 100644 index 00000000000000..39245ac1c60613 --- /dev/null +++ b/tools/eslint/node_modules/repeat-string/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/repeat-string/README.md b/tools/eslint/node_modules/repeat-string/README.md new file mode 100644 index 00000000000000..bf875c664d8752 --- /dev/null +++ b/tools/eslint/node_modules/repeat-string/README.md @@ -0,0 +1,136 @@ +# repeat-string [![NPM version](https://img.shields.io/npm/v/repeat-string.svg?style=flat)](https://www.npmjs.com/package/repeat-string) [![NPM monthly downloads](https://img.shields.io/npm/dm/repeat-string.svg?style=flat)](https://npmjs.org/package/repeat-string) [![NPM total downloads](https://img.shields.io/npm/dt/repeat-string.svg?style=flat)](https://npmjs.org/package/repeat-string) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/repeat-string.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/repeat-string) + +> Repeat the given string n times. Fastest implementation for repeating a string. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save repeat-string +``` + +## Usage + +### [repeat](index.js#L41) + +Repeat the given `string` the specified `number` of times. + +**Example:** + +**Example** + +```js +var repeat = require('repeat-string'); +repeat('A', 5); +//=> AAAAA +``` + +**Params** + +* `string` **{String}**: The string to repeat +* `number` **{Number}**: The number of times to repeat the string +* `returns` **{String}**: Repeated string + +## Benchmarks + +Repeat string is significantly faster than the native method (which is itself faster than [repeating](https://github.com/sindresorhus/repeating)): + +```sh +# 2x +repeat-string █████████████████████████ (26,953,977 ops/sec) +repeating █████████ (9,855,695 ops/sec) +native ██████████████████ (19,453,895 ops/sec) + +# 3x +repeat-string █████████████████████████ (19,445,252 ops/sec) +repeating ███████████ (8,661,565 ops/sec) +native ████████████████████ (16,020,598 ops/sec) + +# 10x +repeat-string █████████████████████████ (23,792,521 ops/sec) +repeating █████████ (8,571,332 ops/sec) +native ███████████████ (14,582,955 ops/sec) + +# 50x +repeat-string █████████████████████████ (23,640,179 ops/sec) +repeating █████ (5,505,509 ops/sec) +native ██████████ (10,085,557 ops/sec) + +# 250x +repeat-string █████████████████████████ (23,489,618 ops/sec) +repeating ████ (3,962,937 ops/sec) +native ████████ (7,724,892 ops/sec) + +# 2000x +repeat-string █████████████████████████ (20,315,172 ops/sec) +repeating ████ (3,297,079 ops/sec) +native ███████ (6,203,331 ops/sec) + +# 20000x +repeat-string █████████████████████████ (23,382,915 ops/sec) +repeating ███ (2,980,058 ops/sec) +native █████ (5,578,808 ops/sec) +``` + +**Run the benchmarks** + +Install dev dependencies: + +```sh +npm i -d && node benchmark +``` + +## About + +### Related projects + +[repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor**
| +| --- | --- | +| 51 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [LinusU](https://github.com/LinusU) | +| 2 | [tbusser](https://github.com/tbusser) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [wooorm](https://github.com/wooorm) | + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](http://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/repeat-string/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 23, 2016._ \ No newline at end of file diff --git a/tools/eslint/node_modules/repeat-string/index.js b/tools/eslint/node_modules/repeat-string/index.js new file mode 100644 index 00000000000000..4459afd8016e31 --- /dev/null +++ b/tools/eslint/node_modules/repeat-string/index.js @@ -0,0 +1,70 @@ +/*! + * repeat-string + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +/** + * Results cache + */ + +var res = ''; +var cache; + +/** + * Expose `repeat` + */ + +module.exports = repeat; + +/** + * Repeat the given `string` the specified `number` + * of times. + * + * **Example:** + * + * ```js + * var repeat = require('repeat-string'); + * repeat('A', 5); + * //=> AAAAA + * ``` + * + * @param {String} `string` The string to repeat + * @param {Number} `number` The number of times to repeat the string + * @return {String} Repeated string + * @api public + */ + +function repeat(str, num) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + // cover common, quick use cases + if (num === 1) return str; + if (num === 2) return str + str; + + var max = str.length * num; + if (cache !== str || typeof cache === 'undefined') { + cache = str; + res = ''; + } else if (res.length >= max) { + return res.substr(0, max); + } + + while (max > res.length && num > 1) { + if (num & 1) { + res += str; + } + + num >>= 1; + str += str; + } + + res += str; + res = res.substr(0, max); + return res; +} diff --git a/tools/eslint/node_modules/repeat-string/package.json b/tools/eslint/node_modules/repeat-string/package.json new file mode 100644 index 00000000000000..ffa3c505378fa1 --- /dev/null +++ b/tools/eslint/node_modules/repeat-string/package.json @@ -0,0 +1,128 @@ +{ + "_from": "repeat-string@^1.5.4", + "_id": "repeat-string@1.6.1", + "_inBundle": false, + "_integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "_location": "/repeat-string", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "repeat-string@^1.5.4", + "name": "repeat-string", + "escapedName": "repeat-string", + "rawSpec": "^1.5.4", + "saveSpec": null, + "fetchSpec": "^1.5.4" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "_shasum": "8dcae470e1c88abc2d600fff4a776286da75e637", + "_spec": "repeat-string@^1.5.4", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Jon Schlinkert", + "url": "http://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/repeat-string/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "email": "brian.woodward@gmail.com", + "url": "https://github.com/doowb" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Linus Unnebäck", + "email": "linus@folkdatorn.se", + "url": "http://linus.unnebäck.se" + }, + { + "name": "Thijs Busser", + "email": "tbusser@gmail.com", + "url": "http://tbusser.net" + }, + { + "name": "Titus", + "email": "tituswormer@gmail.com", + "url": "wooorm.com" + } + ], + "deprecated": false, + "description": "Repeat the given string n times. Fastest implementation for repeating a string.", + "devDependencies": { + "ansi-cyan": "^0.1.1", + "benchmarked": "^0.2.5", + "gulp-format-md": "^0.1.11", + "isobject": "^2.1.0", + "mocha": "^3.1.2", + "repeating": "^3.0.0", + "text-table": "^0.2.0", + "yargs-parser": "^4.0.2" + }, + "engines": { + "node": ">=0.10" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/repeat-string", + "keywords": [ + "fast", + "fastest", + "fill", + "left", + "left-pad", + "multiple", + "pad", + "padding", + "repeat", + "repeating", + "repetition", + "right", + "right-pad", + "string", + "times" + ], + "license": "MIT", + "main": "index.js", + "name": "repeat-string", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/repeat-string.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "repeat-element" + ] + }, + "helpers": [ + "./benchmark/helper.js" + ], + "reflinks": [ + "verb" + ] + }, + "version": "1.6.1" +} diff --git a/tools/eslint/node_modules/replace-ext/LICENSE b/tools/eslint/node_modules/replace-ext/LICENSE new file mode 100644 index 00000000000000..fd38d69351565d --- /dev/null +++ b/tools/eslint/node_modules/replace-ext/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blaine Bublitz , Eric Schoffstall and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/eslint/node_modules/replace-ext/README.md b/tools/eslint/node_modules/replace-ext/README.md new file mode 100644 index 00000000000000..8775983b7834d5 --- /dev/null +++ b/tools/eslint/node_modules/replace-ext/README.md @@ -0,0 +1,50 @@ +

+ + + +

+ +# replace-ext + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] + +Replaces a file extension with another one. + +## Usage + +```js +var replaceExt = require('replace-ext'); + +var path = '/some/dir/file.js'; +var newPath = replaceExt(path, '.coffee'); + +console.log(newPath); // /some/dir/file.coffee +``` + +## API + +### `replaceExt(path, extension)` + +Replaces the extension from `path` with `extension` and returns the updated path string. + +Does not replace the extension if `path` is not a string or is empty. + +## License + +MIT + +[downloads-image]: http://img.shields.io/npm/dm/replace-ext.svg +[npm-url]: https://www.npmjs.com/package/replace-ext +[npm-image]: http://img.shields.io/npm/v/replace-ext.svg + +[travis-url]: https://travis-ci.org/gulpjs/replace-ext +[travis-image]: http://img.shields.io/travis/gulpjs/replace-ext.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/replace-ext +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/replace-ext.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/replace-ext +[coveralls-image]: http://img.shields.io/coveralls/gulpjs/replace-ext/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/tools/eslint/node_modules/replace-ext/index.js b/tools/eslint/node_modules/replace-ext/index.js new file mode 100644 index 00000000000000..7cb7789e280723 --- /dev/null +++ b/tools/eslint/node_modules/replace-ext/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var path = require('path'); + +function replaceExt(npath, ext) { + if (typeof npath !== 'string') { + return npath; + } + + if (npath.length === 0) { + return npath; + } + + var nFileName = path.basename(npath, path.extname(npath)) + ext; + return path.join(path.dirname(npath), nFileName); +} + +module.exports = replaceExt; diff --git a/tools/eslint/node_modules/replace-ext/package.json b/tools/eslint/node_modules/replace-ext/package.json new file mode 100644 index 00000000000000..de05679dc16398 --- /dev/null +++ b/tools/eslint/node_modules/replace-ext/package.json @@ -0,0 +1,86 @@ +{ + "_from": "replace-ext@1.0.0", + "_id": "replace-ext@1.0.0", + "_inBundle": false, + "_integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "_location": "/replace-ext", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "replace-ext@1.0.0", + "name": "replace-ext", + "escapedName": "replace-ext", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/vfile" + ], + "_resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "_shasum": "de63128373fcbf7c3ccfa4de5a480c45a67958eb", + "_spec": "replace-ext@1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\vfile", + "author": { + "name": "Gulp Team", + "email": "team@gulpjs.com", + "url": "http://gulpjs.com/" + }, + "bugs": { + "url": "https://github.com/gulpjs/replace-ext/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Eric Schoffstall", + "email": "yo@contra.io" + }, + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Replaces a file extension with another one", + "devDependencies": { + "eslint": "^1.10.3", + "eslint-config-gulp": "^2.0.0", + "expect": "^1.16.0", + "istanbul": "^0.4.3", + "istanbul-coveralls": "^1.0.3", + "jscs": "^2.3.5", + "jscs-preset-gulp": "^1.0.0", + "mocha": "^2.4.5" + }, + "engines": { + "node": ">= 0.10" + }, + "files": [ + "LICENSE", + "index.js" + ], + "homepage": "https://github.com/gulpjs/replace-ext#readme", + "keywords": [ + "gulp", + "extensions", + "filepath", + "basename" + ], + "license": "MIT", + "main": "index.js", + "name": "replace-ext", + "repository": { + "type": "git", + "url": "git+https://github.com/gulpjs/replace-ext.git" + }, + "scripts": { + "cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly", + "coveralls": "npm run cover && istanbul-coveralls", + "lint": "eslint . && jscs index.js test/", + "pretest": "npm run lint", + "test": "mocha --async-only" + }, + "version": "1.0.0" +} diff --git a/tools/eslint/node_modules/state-toggle/LICENSE b/tools/eslint/node_modules/state-toggle/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/state-toggle/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/state-toggle/history.md b/tools/eslint/node_modules/state-toggle/history.md new file mode 100644 index 00000000000000..f20d5035693db5 --- /dev/null +++ b/tools/eslint/node_modules/state-toggle/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-07-16 +================== diff --git a/tools/eslint/node_modules/state-toggle/index.js b/tools/eslint/node_modules/state-toggle/index.js new file mode 100644 index 00000000000000..d5aff1857fc453 --- /dev/null +++ b/tools/eslint/node_modules/state-toggle/index.js @@ -0,0 +1,45 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module state-toggle + * @fileoverview Enter/exit a state. + */ + +'use strict'; + +/* eslint-env commonjs */ + +/* Expose. */ +module.exports = factory; + +/** + * Construct a state `toggler`: a function which inverses + * `property` in context based on its current value. + * The by `toggler` returned function restores that value. + * + * @param {string} key - Property to toggle. + * @param {boolean} state - Default state. + * @param {Object?} [ctx] - Context object. + * @return {Function} - Enter. + */ +function factory(key, state, ctx) { + /** + * Enter a state. + * + * @return {Function} - Exit state. + */ + return function () { + var context = ctx || this; + var current = context[key]; + + context[key] = !state; + + /** + * Cancel state to its value before entering. + */ + return function () { + context[key] = current; + }; + }; +} diff --git a/tools/eslint/node_modules/state-toggle/package.json b/tools/eslint/node_modules/state-toggle/package.json new file mode 100644 index 00000000000000..0ed33a4e4ec8b8 --- /dev/null +++ b/tools/eslint/node_modules/state-toggle/package.json @@ -0,0 +1,107 @@ +{ + "_from": "state-toggle@^1.0.0", + "_id": "state-toggle@1.0.0", + "_inBundle": false, + "_integrity": "sha1-0g+aYWu08MO5i5GSLSW2QKorxCU=", + "_location": "/state-toggle", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "state-toggle@^1.0.0", + "name": "state-toggle", + "escapedName": "state-toggle", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.0.tgz", + "_shasum": "d20f9a616bb4f0c3b98b91922d25b640aa2bc425", + "_spec": "state-toggle@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/state-toggle/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Enter/exit a state", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^7.0.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/state-toggle#readme", + "keywords": [ + "enter", + "exit", + "state" + ], + "license": "MIT", + "name": "state-toggle", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": [ + "comment-config", + "github", + "lint", + "validate-links" + ], + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/state-toggle.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s stateToggle > state-toggle.js", + "build-mangle": "esmangle < state-toggle.js > state-toggle.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "ignores": [ + "state-toggle.js", + "state-toggle.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/state-toggle/readme.md b/tools/eslint/node_modules/state-toggle/readme.md new file mode 100644 index 00000000000000..e2282d113b8383 --- /dev/null +++ b/tools/eslint/node_modules/state-toggle/readme.md @@ -0,0 +1,83 @@ +# state-toggle [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + + + +Enter/exit a state. + +## Installation + +[npm][npm-install]: + +```bash +npm install state-toggle +``` + +## Usage + +```javascript +var toggle = require('state-toggle'); +var ctx = {on: false}; +var enter = toggle('on', ctx.on, ctx); +var exit; + +// Entering: +exit = enter(); +console.log(ctx.on); // true + +// Exiting: +exit(); +console.log(ctx.on); // false +``` + +## API + +### `toggle(key, initial[, ctx])` + +Create a toggle, which when entering toggles `key` on `ctx` (or `this`, +if `ctx` is not given) to `!initial`, and when exiting, sets `key` on +the context back to the value it had before entering. + +###### Returns + +`Function` — [`enter`][enter]. + +### `enter()` + +Enter the state. + +###### Context + +If no `ctx` was given to `toggle`, the context object (`this`) of `enter()` +is used to toggle. + +###### Returns + +`Function` — [`exit`][exit]. + +### `exit()` + +Exit the state, reverting `key` to the value it had before entering. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/state-toggle.svg + +[travis]: https://travis-ci.org/wooorm/state-toggle + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/state-toggle.svg + +[codecov]: https://codecov.io/github/wooorm/state-toggle + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[enter]: #enter + +[exit]: #exit diff --git a/tools/eslint/node_modules/trim-trailing-lines/LICENSE b/tools/eslint/node_modules/trim-trailing-lines/LICENSE new file mode 100644 index 00000000000000..611b67581bb8e2 --- /dev/null +++ b/tools/eslint/node_modules/trim-trailing-lines/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/trim-trailing-lines/index.js b/tools/eslint/node_modules/trim-trailing-lines/index.js new file mode 100644 index 00000000000000..41356676eedf46 --- /dev/null +++ b/tools/eslint/node_modules/trim-trailing-lines/index.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = trimTrailingLines; + +var line = '\n'; + +/* Remove final newline characters from `value`. */ +function trimTrailingLines(value) { + var val = String(value); + var index = val.length; + + while (val.charAt(--index) === line) { /* empty */ } + + return val.slice(0, index + 1); +} diff --git a/tools/eslint/node_modules/trim-trailing-lines/package.json b/tools/eslint/node_modules/trim-trailing-lines/package.json new file mode 100644 index 00000000000000..48fe505d2574be --- /dev/null +++ b/tools/eslint/node_modules/trim-trailing-lines/package.json @@ -0,0 +1,96 @@ +{ + "_from": "trim-trailing-lines@^1.0.0", + "_id": "trim-trailing-lines@1.1.0", + "_inBundle": false, + "_integrity": "sha1-eu+7eAjfnWafbaLkOMrIxGradoQ=", + "_location": "/trim-trailing-lines", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "trim-trailing-lines@^1.0.0", + "name": "trim-trailing-lines", + "escapedName": "trim-trailing-lines", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.0.tgz", + "_shasum": "7aefbb7808df9d669f6da2e438cac8c46ada7684", + "_spec": "trim-trailing-lines@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/trim-trailing-lines/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Remove final newline characters from a string", + "devDependencies": { + "browserify": "^13.0.0", + "esmangle": "^1.0.0", + "nyc": "^10.0.0", + "remark-cli": "^2.0.0", + "remark-preset-wooorm": "^1.0.0", + "tape": "^4.6.3", + "xo": "^0.17.1" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/trim-trailing-lines#readme", + "keywords": [ + "trim", + "final", + "line", + "newline", + "characters" + ], + "license": "MIT", + "name": "trim-trailing-lines", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "presets": "wooorm" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/trim-trailing-lines.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s trimTrailingLines > trim-trailing-lines.js", + "build-mangle": "esmangle trim-trailing-lines.js > trim-trailing-lines.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.0", + "xo": { + "space": true, + "ignores": [ + "trim-trailing-lines.js" + ] + } +} diff --git a/tools/eslint/node_modules/trim-trailing-lines/readme.md b/tools/eslint/node_modules/trim-trailing-lines/readme.md new file mode 100644 index 00000000000000..affedf5d8cbef4 --- /dev/null +++ b/tools/eslint/node_modules/trim-trailing-lines/readme.md @@ -0,0 +1,55 @@ +# trim-trailing-lines [![Build Status][travtrim-trailing-lines]][travis] [![Coverage Status][codecov-badge]][codecov] + +Remove final newline characters from a string. + +## Installation + +[npm][]: + +```bash +npm install trim-trailing-lines +``` + +## Usage + +```js +var trimTrailingLines = require('trim-trailing-lines'); + +trimTrailingLines('foo\nbar'); //=> 'foo\nbar' +trimTrailingLines('foo\nbar\n'); //=> 'foo\nbar' +trimTrailingLines('foo\nbar\n\n'); //=> 'foo\nbar' +``` + +## API + +### `trimTrailingLines(value)` + +Remove final newline characters from `value`. + +###### Parameters + +* `value` (`string`) — Value with trailing newlines, coerced to string. + +###### Returns + +`string` — Value without trailing newlines. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travtrim-trailing-lines]: https://img.shields.io/travis/wooorm/trim-trailing-lines.svg + +[travis]: https://travis-ci.org/wooorm/trim-trailing-lines + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/trim-trailing-lines.svg + +[codecov]: https://codecov.io/github/wooorm/trim-trailing-lines + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/trim/Makefile b/tools/eslint/node_modules/trim/Makefile new file mode 100644 index 00000000000000..4e9c8d36ebcd2f --- /dev/null +++ b/tools/eslint/node_modules/trim/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/tools/eslint/node_modules/trim/Readme.md b/tools/eslint/node_modules/trim/Readme.md new file mode 100644 index 00000000000000..04a67e345e981d --- /dev/null +++ b/tools/eslint/node_modules/trim/Readme.md @@ -0,0 +1,69 @@ + +# trim + + Trims string whitespace. + +## Installation + +``` +$ npm install trim +$ component install component/trim +``` + +## API + + - [trim(str)](#trimstr) + - [.left(str)](#leftstr) + - [.right(str)](#rightstr) + + + +### trim(str) +should trim leading / trailing whitespace. + +```js +trim(' foo bar ').should.equal('foo bar'); +trim('\n\n\nfoo bar\n\r\n\n').should.equal('foo bar'); +``` + + +### .left(str) +should trim leading whitespace. + +```js +trim.left(' foo bar ').should.equal('foo bar '); +``` + + +### .right(str) +should trim trailing whitespace. + +```js +trim.right(' foo bar ').should.equal(' foo bar'); +``` + + +## License + +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/tools/eslint/node_modules/trim/index.js b/tools/eslint/node_modules/trim/index.js new file mode 100644 index 00000000000000..640c24cf302e60 --- /dev/null +++ b/tools/eslint/node_modules/trim/index.js @@ -0,0 +1,14 @@ + +exports = module.exports = trim; + +function trim(str){ + return str.replace(/^\s*|\s*$/g, ''); +} + +exports.left = function(str){ + return str.replace(/^\s*/, ''); +}; + +exports.right = function(str){ + return str.replace(/\s*$/, ''); +}; diff --git a/tools/eslint/node_modules/trim/package.json b/tools/eslint/node_modules/trim/package.json new file mode 100644 index 00000000000000..ab78b740286a3b --- /dev/null +++ b/tools/eslint/node_modules/trim/package.json @@ -0,0 +1,49 @@ +{ + "_from": "trim@0.0.1", + "_id": "trim@0.0.1", + "_inBundle": false, + "_integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", + "_location": "/trim", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "trim@0.0.1", + "name": "trim", + "escapedName": "trim", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "_shasum": "5858547f6b290757ee95cccc666fb50084c460dd", + "_spec": "trim@0.0.1", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "trim/index.js": "index.js" + } + }, + "dependencies": {}, + "deprecated": false, + "description": "Trim string whitespace", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "keywords": [ + "string", + "trim" + ], + "main": "index", + "name": "trim", + "version": "0.0.1" +} diff --git a/tools/eslint/node_modules/trough/LICENSE b/tools/eslint/node_modules/trough/LICENSE new file mode 100644 index 00000000000000..3f0166f62b10c0 --- /dev/null +++ b/tools/eslint/node_modules/trough/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/trough/history.md b/tools/eslint/node_modules/trough/history.md new file mode 100644 index 00000000000000..52aefbd7038190 --- /dev/null +++ b/tools/eslint/node_modules/trough/history.md @@ -0,0 +1,6 @@ + + + + +1.0.0 / 2016-08-01 +================== diff --git a/tools/eslint/node_modules/trough/index.js b/tools/eslint/node_modules/trough/index.js new file mode 100644 index 00000000000000..9d8eb90a00108b --- /dev/null +++ b/tools/eslint/node_modules/trough/index.js @@ -0,0 +1,176 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module trough + * @fileoverview Middleware. Inspired by `segmentio/ware`, + * but able to change the values from transformer to + * transformer. + */ + +'use strict'; + +/* Expose. */ +module.exports = trough; + +/* Methods. */ +var slice = [].slice; + +/** + * Create new middleware. + * + * @return {Object} - Middlewre. + */ +function trough() { + var fns = []; + var middleware = {}; + + middleware.run = run; + middleware.use = use; + + return middleware; + + /** + * Run `fns`. Last argument must be + * a completion handler. + * + * @param {...*} input - Parameters + */ + function run() { + var index = -1; + var input = slice.call(arguments, 0, -1); + var done = arguments[arguments.length - 1]; + + if (typeof done !== 'function') { + throw new Error('Expected function as last argument, not ' + done); + } + + next.apply(null, [null].concat(input)); + + return; + + /** + * Run the next `fn`, if any. + * + * @param {Error?} err - Failure. + * @param {...*} values - Other input. + */ + function next(err) { + var fn = fns[++index]; + var params = slice.call(arguments, 0); + var values = params.slice(1); + var length = input.length; + var pos = -1; + + if (err) { + done(err); + return; + } + + /* Copy non-nully input into values. */ + while (++pos < length) { + if (values[pos] === null || values[pos] === undefined) { + values[pos] = input[pos]; + } + } + + input = values; + + /* Next or done. */ + if (fn) { + wrap(fn, next).apply(null, input); + } else { + done.apply(null, [null].concat(input)); + } + } + } + + /** + * Add `fn` to the list. + * + * @param {Function} fn - Anything `wrap` accepts. + */ + function use(fn) { + if (typeof fn !== 'function') { + throw new Error('Expected `fn` to be a function, not ' + fn); + } + + fns.push(fn); + + return middleware; + } +} + +/** + * Wrap `fn`. Can be sync or async; return a promise, + * receive a completion handler, return new values and + * errors. + * + * @param {Function} fn - Thing to wrap. + * @param {Function} next - Completion handler. + * @return {Function} - Wrapped `fn`. + */ +function wrap(fn, next) { + var invoked; + + return wrapped; + + function wrapped() { + var params = slice.call(arguments, 0); + var callback = fn.length > params.length; + var result; + + if (callback) { + params.push(done); + } + + try { + result = fn.apply(null, params); + } catch (err) { + /* Well, this is quite the pickle. `fn` received + * a callback and invoked it (thus continuing the + * pipeline), but later also threw an error. + * We’re not about to restart the pipeline again, + * so the only thing left to do is to throw the + * thing instea. */ + if (callback && invoked) { + throw err; + } + + return done(err); + } + + if (!callback) { + if (result && typeof result.then === 'function') { + result.then(then, done); + } else if (result instanceof Error) { + done(result); + } else { + then(result); + } + } + } + + /** + * Invoke `next`, only once. + * + * @param {Error?} err - Optional error. + */ + function done() { + if (!invoked) { + invoked = true; + + next.apply(null, arguments); + } + } + + /** + * Invoke `done` with one value. + * Tracks if an error is passed, too. + * + * @param {*} value - Optional value. + */ + function then(value) { + done(null, value); + } +} diff --git a/tools/eslint/node_modules/trough/package.json b/tools/eslint/node_modules/trough/package.json new file mode 100644 index 00000000000000..51f0ee15060aa0 --- /dev/null +++ b/tools/eslint/node_modules/trough/package.json @@ -0,0 +1,122 @@ +{ + "_from": "trough@^1.0.0", + "_id": "trough@1.0.0", + "_inBundle": false, + "_integrity": "sha1-a97f5/KqSabzxDIldodVWVfzQv0=", + "_location": "/trough", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "trough@^1.0.0", + "name": "trough", + "escapedName": "trough", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/unified" + ], + "_resolved": "https://registry.npmjs.org/trough/-/trough-1.0.0.tgz", + "_shasum": "6bdedfe7f2aa49a6f3c432257687555957f342fd", + "_spec": "trough@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/trough/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Middleware: a channel used to convey a liquid", + "devDependencies": { + "browserify": "^13.0.0", + "esmangle": "^1.0.0", + "nyc": "^7.1.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-toc": "^3.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.4.0", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.11.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/trough#readme", + "keywords": [ + "middleware", + "ware" + ], + "license": "MIT", + "name": "trough", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": { + "comment-config": null, + "lint": { + "heading-increment": false, + "no-duplicate-headings": false, + "list-item-spacing": false + }, + "github": null, + "toc": { + "tight": true, + "maxDepth": 3 + }, + "validate-links": null + }, + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/trough.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s trough > trough.js", + "build-mangle": "esmangle trough.js > trough.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.0", + "xo": { + "space": true, + "rules": { + "guard-for-in": "off", + "max-lines": "off" + }, + "ignores": [ + "trough.js", + "trough.min.js" + ] + } +} diff --git a/tools/eslint/node_modules/trough/readme.md b/tools/eslint/node_modules/trough/readme.md new file mode 100644 index 00000000000000..1b1d8047ba2a92 --- /dev/null +++ b/tools/eslint/node_modules/trough/readme.md @@ -0,0 +1,281 @@ +# trough [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +> **trough** /trôf/ — a channel used to convey a liquid. + +**trough** is like [`ware`][ware] with less sugar, and middleware +functions can change the input of the next. + +## Installation + +[npm][]: + +```bash +npm install trough +``` + +## Usage + +```js +var fs = require('fs'); +var path = require('path'); +var trough = require('trough'); + +var pipeline = trough() + .use(function (fileName) { + console.log('Checking... ' + fileName); + }) + .use(function (fileName) { + return path.join(process.cwd(), fileName); + }) + .use(function (filePath, next) { + fs.stat(filePath, function (err, stats) { + next(err, {filePath: filePath, stats: stats}); + }); + }) + .use(function (ctx, next) { + if (ctx.stats.isFile()) { + fs.readFile(ctx.filePath, next); + } else { + next(new Error('Expected file')); + } + }); + +pipeline.run('readme.md', console.log); +pipeline.run('node_modules', console.log); +``` + +Yields: + +```txt +Checking... readme.md +Checking... node_modules +Error: Expected file + at ~/example.js:18:12 + at wrapped (~/node_modules/trough/index.js:120:19) + at next (~/node_modules/trough/index.js:77:24) + at done (~/node_modules/trough/index.js:157:12) + at ~/example.js:11:7 + at FSReqWrap.oncomplete (fs.js:123:15) +null +``` + +## API + +### `trough()` + +Create a new [`Trough`][trough]. + +### `Trough` + +A pipeline. + +### `Trough#run([input..., ]done)` + +Run the pipeline (all [`use()`][use]d middleware). Invokes [`done`][done] +on completion with either an error or the output of the last middleware + +> Note! as the length of input defines whether [async][] function +> get a `next` function, it’s recommended to keep `input` at one +> value normally. + +#### `function done(err?, [output...])` + +The final handler passed to [`run()`][run], invoked with an error +if a [middleware function][fn] rejected, passed, or threw one, or +the output of the last middleware function. + +### `Trough#use(fn)` + +Add `fn`, a [middleware function][fn], to the pipeline. + +#### `function fn([input..., ][next])` + +A middleware function invoked with the output of its predecessor. + +##### Synchronous + +If `fn` returns or throws an error, the pipeline fails and `done` is +invoked with that error. + +If `fn` returns a value (neither `null` nor `undefined`), the first +`input` of the next function is set to that value (all other `input` +is passed through). + +###### Example + +The following example shows how returning an error stops the pipeline: + +```js +var trough = require('trough'); + +trough().use(function (val) { + return new Error('Got: ' + val); +}).run('some value', console.log); +``` + +Yields: + +```txt +Error: Got: some value + at ~example.js:6:10 + ... +``` + +The following example shows how throwing an error stops the pipeline: + +```js +var trough = require('trough'); + +trough().use(function (val) { + throw new Error('Got: ' + val); +}).run('more value', console.log); +``` + +Yields: + +```txt +Error: Got: more value + at ~example.js:6:10 + ... +``` + +The following example shows how the first output can be modified: + +```js +var trough = require('trough'); + +trough().use(function (val) { + return 'even ' + val; +}).run('more value', 'untouched', console.log); +``` + +Yields: + +```txt +null 'even more value' 'untouched' +``` + +##### Promise + +If `fn` returns a promise, and that promise rejects, the pipeline fails +and `done` is invoked with the rejected value. + +If `fn` returns a promise, and that promise resolves with a value +(neither `null` nor `undefined`), the first `input` of the next function +is set to that value (all other `input` is passed through). + +###### Example + +The following example shows how rejecting a promise stops the pipeline: + +```js +trough().use(function (val) { + return new Promise(function (resolve, reject) { + reject('Got: ' + val); + }); +}).run('val', console.log); +``` + +Yields: + +```txt +Got: val +``` + +The following example shows how the input isn’t touched by resolving +to `null`. + +```js +trough().use(function (val) { + return new Promise(function (resolve, reject) { + setTimeout(function () { resolve(null); }, 100); + }); +}).run('Input', console.log); +``` + +Yields: + +```txt +null 'Input' +``` + +##### Asynchronous + +If `fn` accepts one more argument than the given `input`, a `next` +function is given (after the input). `next` must be called, but doesn’t +have to be called async. + +If `next` is given a a value (neither `null` nor `undefined`) as its first +argument, the pipeline fails and `done` is invoked with that value. + +If `next` is given no value (either `null` or `undefined`) as the first +argument, all following non-nully values change the input of the following +function, and all nully values default to the `input`. + +###### Example + +The following example shows how passing a first argument stops the +pipeline: + +```js +trough().use(function (val, next) { + next(new Error('Got: ' + val)); +}).run('val', console.log); +``` + +Yields: + +```txt +Error: Got: val + at ~/example.js:6:8 +``` + +The following example shows how more values than the input are passed. + +```js +trough().use(function (val, next) { + setTimeout(function () { + next(null, null, 'values'); + }, 100); +}).run('some', console.log); +``` + +Yields: + +```txt +null 'some' 'values' +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/trough.svg + +[travis]: https://travis-ci.org/wooorm/trough + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/trough.svg + +[codecov]: https://codecov.io/github/wooorm/trough + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[ware]: https://github.com/segmentio/ware + +[trough]: #trough-1 + +[use]: #troughusefn + +[run]: #troughruninput-done + +[fn]: #function-fninput-next + +[done]: #function-doneerr-output + +[async]: #asynchronous diff --git a/tools/eslint/node_modules/unherit/LICENSE b/tools/eslint/node_modules/unherit/LICENSE new file mode 100644 index 00000000000000..f3722d94b38121 --- /dev/null +++ b/tools/eslint/node_modules/unherit/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/unherit/index.js b/tools/eslint/node_modules/unherit/index.js new file mode 100644 index 00000000000000..5a10751425cbbe --- /dev/null +++ b/tools/eslint/node_modules/unherit/index.js @@ -0,0 +1,67 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module unherit + * @fileoverview Create a custom constructor which can be modified + * without affecting the original class. + */ + +'use strict'; + +/* Dependencies. */ +var xtend = require('xtend'); +var inherits = require('inherits'); + +/* Expose. */ +module.exports = unherit; + +/** + * Create a custom constructor which can be modified + * without affecting the original class. + * + * @param {Function} Super - Super-class. + * @return {Function} - Constructor acting like `Super`, + * which can be modified without affecting the original + * class. + */ +function unherit(Super) { + var result; + var key; + var value; + + inherits(Of, Super); + inherits(From, Of); + + /* Clone values. */ + result = Of.prototype; + + for (key in result) { + value = result[key]; + + if (value && typeof value === 'object') { + result[key] = 'concat' in value ? value.concat() : xtend(value); + } + } + + return Of; + + /** + * Constructor accepting a single argument, + * which itself is an `arguments` object. + */ + function From(parameters) { + return Super.apply(this, parameters); + } + + /** + * Constructor accepting variadic arguments. + */ + function Of() { + if (!(this instanceof Of)) { + return new From(arguments); + } + + return Super.apply(this, arguments); + } +} diff --git a/tools/eslint/node_modules/unherit/package.json b/tools/eslint/node_modules/unherit/package.json new file mode 100644 index 00000000000000..a22977f0b5af1a --- /dev/null +++ b/tools/eslint/node_modules/unherit/package.json @@ -0,0 +1,109 @@ +{ + "_from": "unherit@^1.0.4", + "_id": "unherit@1.1.0", + "_inBundle": false, + "_integrity": "sha1-a5qu379z3xdWrZ4xbdmBiFhAzX0=", + "_location": "/unherit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unherit@^1.0.4", + "name": "unherit", + "escapedName": "unherit", + "rawSpec": "^1.0.4", + "saveSpec": null, + "fetchSpec": "^1.0.4" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.0.tgz", + "_shasum": "6b9aaedfbf73df1756ad9e316dd981885840cd7d", + "_spec": "unherit@^1.0.4", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/unherit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "inherits": "^2.0.1", + "xtend": "^4.0.1" + }, + "deprecated": false, + "description": "Clone a constructor without affecting the super-class", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^8.1.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/unherit#readme", + "keywords": [ + "clone", + "super", + "class", + "constructor" + ], + "license": "MIT", + "name": "unherit", + "remarkConfig": { + "output": true, + "plugins": { + "comment-config": null, + "github": null, + "lint": { + "heading-increment": false + }, + "validate-links": null + }, + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/unherit.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s unherit > unherit.js", + "build-mangle": "esmangle unherit.js > unherit.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.0", + "xo": { + "space": true, + "rules": { + "guard-for-in": "off" + }, + "ignores": [ + "unherit.js" + ] + } +} diff --git a/tools/eslint/node_modules/unherit/readme.md b/tools/eslint/node_modules/unherit/readme.md new file mode 100644 index 00000000000000..d7070923d3c4ab --- /dev/null +++ b/tools/eslint/node_modules/unherit/readme.md @@ -0,0 +1,66 @@ +# unherit [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Create a custom constructor which can be modified without affecting the +original class. + +## Installation + +[npm][npm-install]: + +```bash +npm install unherit +``` + +## Usage + +```js +var EventEmitter = require('events').EventEmitter; + +/* Create a private class which acts just like + * `EventEmitter`. */ +var Emitter = unherit(EventEmitter); + +Emitter.prototype.defaultMaxListeners = 0; +/* Now, all instances of `Emitter` have no maximum + * listeners, without affecting other `EventEmitter`s. */ + +assert(new Emitter().defaultMaxListeners === 0); // true +assert(new EventEmitter().defaultMaxListeners === undefined); // true +assert(new Emitter() instanceof EventEmitter); // true +``` + +## API + +### `unherit(Super)` + +Create a custom constructor which can be modified without affecting the +original class. + +###### Parameters + +* `Super` (`Function`) — Super-class. + +###### Returns + +`Function` — Constructor acting like `Super`, which can be modified +without affecting the original class. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/unherit.svg + +[travis]: https://travis-ci.org/wooorm/unherit + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/unherit.svg + +[codecov]: https://codecov.io/github/wooorm/unherit + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com diff --git a/tools/eslint/node_modules/unified/LICENSE b/tools/eslint/node_modules/unified/LICENSE new file mode 100644 index 00000000000000..f3722d94b38121 --- /dev/null +++ b/tools/eslint/node_modules/unified/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/unified/index.js b/tools/eslint/node_modules/unified/index.js new file mode 100644 index 00000000000000..2bc872ee8dcff4 --- /dev/null +++ b/tools/eslint/node_modules/unified/index.js @@ -0,0 +1,460 @@ +'use strict'; + +/* Dependencies. */ +var extend = require('extend'); +var bail = require('bail'); +var vfile = require('vfile'); +var trough = require('trough'); +var string = require('x-is-string'); +var func = require('x-is-function'); +var plain = require('is-plain-obj'); + +/* Expose a frozen processor. */ +module.exports = unified().freeze(); + +var slice = [].slice; +var own = {}.hasOwnProperty; + +/* Process pipeline. */ +var pipeline = trough().use(pipelineParse).use(pipelineRun).use(pipelineStringify); + +function pipelineParse(p, ctx) { + ctx.tree = p.parse(ctx.file); +} + +function pipelineRun(p, ctx, next) { + p.run(ctx.tree, ctx.file, done); + + function done(err, tree, file) { + if (err) { + next(err); + } else { + ctx.tree = tree; + ctx.file = file; + next(); + } + } +} + +function pipelineStringify(p, ctx) { + ctx.file.contents = p.stringify(ctx.tree, ctx.file); +} + +/* Function to create the first processor. */ +function unified() { + var attachers = []; + var transformers = trough(); + var namespace = {}; + var frozen = false; + var freezeIndex = -1; + + /* Data management. */ + processor.data = data; + + /* Lock. */ + processor.freeze = freeze; + + /* Plug-ins. */ + processor.attachers = attachers; + processor.use = use; + + /* API. */ + processor.parse = parse; + processor.stringify = stringify; + processor.run = run; + processor.runSync = runSync; + processor.process = process; + processor.processSync = processSync; + + /* Expose. */ + return processor; + + /* Create a new processor based on the processor + * in the current scope. */ + function processor() { + var destination = unified(); + var length = attachers.length; + var index = -1; + + while (++index < length) { + destination.use.apply(null, attachers[index]); + } + + destination.data(extend(true, {}, namespace)); + + return destination; + } + + /* Freeze: used to signal a processor that has finished + * configuration. + * + * For example, take unified itself. It’s frozen. + * Plug-ins should not be added to it. Rather, it should + * be extended, by invoking it, before modifying it. + * + * In essence, always invoke this when exporting a + * processor. */ + function freeze() { + var values; + var plugin; + var options; + var transformer; + + if (frozen) { + return processor; + } + + while (++freezeIndex < attachers.length) { + values = attachers[freezeIndex]; + plugin = values[0]; + options = values[1]; + transformer = null; + + if (options === false) { + continue; + } + + if (options === true) { + values[1] = undefined; + } + + transformer = plugin.apply(processor, values.slice(1)); + + if (func(transformer)) { + transformers.use(transformer); + } + } + + frozen = true; + freezeIndex = Infinity; + + return processor; + } + + /* Data management. + * Getter / setter for processor-specific informtion. */ + function data(key, value) { + if (string(key)) { + /* Set `key`. */ + if (arguments.length === 2) { + assertUnfrozen('data', frozen); + + namespace[key] = value; + + return processor; + } + + /* Get `key`. */ + return (own.call(namespace, key) && namespace[key]) || null; + } + + /* Set space. */ + if (key) { + assertUnfrozen('data', frozen); + namespace = key; + return processor; + } + + /* Get space. */ + return namespace; + } + + /* Plug-in management. + * + * Pass it: + * * an attacher and options, + * * a preset, + * * a list of presets, attachers, and arguments (list + * of attachers and options). */ + function use(value) { + var settings; + + assertUnfrozen('use', frozen); + + if (value === null || value === undefined) { + /* Empty */ + } else if (func(value)) { + addPlugin.apply(null, arguments); + } else if (typeof value === 'object') { + if ('length' in value) { + addList(value); + } else { + addPreset(value); + } + } else { + throw new Error('Expected usable value, not `' + value + '`'); + } + + if (settings) { + namespace.settings = extend(namespace.settings || {}, settings); + } + + return processor; + + function addPreset(result) { + addList(result.plugins); + + if (result.settings) { + settings = extend(settings || {}, result.settings); + } + } + + function add(value) { + if (func(value)) { + addPlugin(value); + } else if (typeof value === 'object') { + if ('length' in value) { + addPlugin.apply(null, value); + } else { + addPreset(value); + } + } else { + throw new Error('Expected usable value, not `' + value + '`'); + } + } + + function addList(plugins) { + var length; + var index; + + if (plugins === null || plugins === undefined) { + /* Empty */ + } else if (typeof plugins === 'object' && 'length' in plugins) { + length = plugins.length; + index = -1; + + while (++index < length) { + add(plugins[index]); + } + } else { + throw new Error('Expected a list of plugins, not `' + plugins + '`'); + } + } + + function addPlugin(plugin, value) { + var entry = find(plugin); + + if (entry) { + if (plain(entry[1]) && plain(value)) { + value = extend(entry[1], value); + } + + entry[1] = value; + } else { + attachers.push(slice.call(arguments)); + } + } + } + + function find(plugin) { + var length = attachers.length; + var index = -1; + var entry; + + while (++index < length) { + entry = attachers[index]; + + if (entry[0] === plugin) { + return entry; + } + } + } + + /* Parse a file (in string or VFile representation) + * into a Unist node using the `Parser` on the + * processor. */ + function parse(doc) { + var file = vfile(doc); + var Parser; + + freeze(); + Parser = processor.Parser; + assertParser('parse', Parser); + + if (newable(Parser)) { + return new Parser(String(file), file).parse(); + } + + return Parser(String(file), file); // eslint-disable-line new-cap + } + + /* Run transforms on a Unist node representation of a file + * (in string or VFile representation), async. */ + function run(node, file, cb) { + assertNode(node); + freeze(); + + if (!cb && func(file)) { + cb = file; + file = null; + } + + if (!cb) { + return new Promise(executor); + } + + executor(null, cb); + + function executor(resolve, reject) { + transformers.run(node, vfile(file), done); + + function done(err, tree, file) { + tree = tree || node; + if (err) { + reject(err); + } else if (resolve) { + resolve(tree); + } else { + cb(null, tree, file); + } + } + } + } + + /* Run transforms on a Unist node representation of a file + * (in string or VFile representation), sync. */ + function runSync(node, file) { + var complete = false; + var result; + + run(node, file, done); + + assertDone('runSync', 'run', complete); + + return result; + + function done(err, tree) { + complete = true; + bail(err); + result = tree; + } + } + + /* Stringify a Unist node representation of a file + * (in string or VFile representation) into a string + * using the `Compiler` on the processor. */ + function stringify(node, doc) { + var file = vfile(doc); + var Compiler; + + freeze(); + Compiler = processor.Compiler; + assertCompiler('stringify', Compiler); + assertNode(node); + + if (newable(Compiler)) { + return new Compiler(node, file).compile(); + } + + return Compiler(node, file); // eslint-disable-line new-cap + } + + /* Parse a file (in string or VFile representation) + * into a Unist node using the `Parser` on the processor, + * then run transforms on that node, and compile the + * resulting node using the `Compiler` on the processor, + * and store that result on the VFile. */ + function process(doc, cb) { + freeze(); + assertParser('process', processor.Parser); + assertCompiler('process', processor.Compiler); + + if (!cb) { + return new Promise(executor); + } + + executor(null, cb); + + function executor(resolve, reject) { + var file = vfile(doc); + + pipeline.run(processor, {file: file}, done); + + function done(err) { + if (err) { + reject(err); + } else if (resolve) { + resolve(file); + } else { + cb(null, file); + } + } + } + } + + /* Process the given document (in string or VFile + * representation), sync. */ + function processSync(doc) { + var complete = false; + var file; + + freeze(); + assertParser('processSync', processor.Parser); + assertCompiler('processSync', processor.Compiler); + file = vfile(doc); + + process(file, done); + + assertDone('processSync', 'process', complete); + + return file; + + function done(err) { + complete = true; + bail(err); + } + } +} + +/* Check if `func` is a constructor. */ +function newable(value) { + return func(value) && keys(value.prototype); +} + +/* Check if `value` is an object with keys. */ +function keys(value) { + var key; + for (key in value) { + return true; + } + return false; +} + +/* Assert a parser is available. */ +function assertParser(name, Parser) { + if (!func(Parser)) { + throw new Error('Cannot `' + name + '` without `Parser`'); + } +} + +/* Assert a compiler is available. */ +function assertCompiler(name, Compiler) { + if (!func(Compiler)) { + throw new Error('Cannot `' + name + '` without `Compiler`'); + } +} + +/* Assert the processor is not frozen. */ +function assertUnfrozen(name, frozen) { + if (frozen) { + throw new Error( + 'Cannot invoke `' + name + '` on a frozen processor.\n' + + 'Create a new processor first, by invoking it: ' + + 'use `processor()` instead of `processor`.' + ); + } +} + +/* Assert `node` is a Unist node. */ +function assertNode(node) { + if (!node || !string(node.type)) { + throw new Error('Expected node, got `' + node + '`'); + } +} + +/* Assert that `complete` is `true`. */ +function assertDone(name, asyncName, complete) { + if (!complete) { + throw new Error('`' + name + '` finished async. Use `' + asyncName + '` instead'); + } +} diff --git a/tools/eslint/node_modules/unified/package.json b/tools/eslint/node_modules/unified/package.json new file mode 100644 index 00000000000000..c11406059dbb01 --- /dev/null +++ b/tools/eslint/node_modules/unified/package.json @@ -0,0 +1,117 @@ +{ + "_from": "unified@^6.1.2", + "_id": "unified@6.1.5", + "_inBundle": false, + "_integrity": "sha1-cWk3hyYhpjE15iztLzrGoGPG+4c=", + "_location": "/unified", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unified@^6.1.2", + "name": "unified", + "escapedName": "unified", + "rawSpec": "^6.1.2", + "saveSpec": null, + "fetchSpec": "^6.1.2" + }, + "_requiredBy": [ + "/eslint-plugin-markdown" + ], + "_resolved": "https://registry.npmjs.org/unified/-/unified-6.1.5.tgz", + "_shasum": "716937872621a63135e62ced2f3ac6a063c6fb87", + "_spec": "unified@^6.1.2", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\eslint-plugin-markdown", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/unifiedjs/unified/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^1.1.0", + "trough": "^1.0.0", + "vfile": "^2.0.0", + "x-is-function": "^1.0.4", + "x-is-string": "^0.1.0" + }, + "deprecated": false, + "description": "Pluggable text processing interface", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.0", + "nyc": "^11.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.4.0", + "xo": "^0.18.1" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/unifiedjs/unified#readme", + "keywords": [ + "process", + "parse", + "transform", + "compile", + "stringify", + "rehype", + "retext", + "remark" + ], + "license": "MIT", + "name": "unified", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/unifiedjs/unified.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unified > unified.js", + "build-mangle": "esmangle unified.js > unified.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test" + }, + "version": "6.1.5", + "xo": { + "space": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "import/no-unassigned-import": "off", + "guard-for-in": "off", + "max-lines": "off" + }, + "ignores": [ + "unified.js" + ] + } +} diff --git a/tools/eslint/node_modules/unified/readme.md b/tools/eslint/node_modules/unified/readme.md new file mode 100644 index 00000000000000..431349459a9d0c --- /dev/null +++ b/tools/eslint/node_modules/unified/readme.md @@ -0,0 +1,919 @@ +# ![unified][logo] + +[![Build Status][travis-badge]][travis] +[![Coverage Status][codecov-badge]][codecov] + +**unified** is an interface for processing text using syntax trees. +It’s what powers [**remark**][remark], [**retext**][retext], and +[**rehype**][rehype], but it also allows for processing between +multiple syntaxes. + +[`unifiedjs.github.io`][site], the website for **unified** provides a less +technical, more practical, introduction to unified. Make sure to visit it +and try its introductionary [Guides][]. + +## Installation + +[npm][]: + +```bash +npm install unified +``` + +## Usage + +```js +var unified = require('unified'); +var markdown = require('remark-parse'); +var remark2rehype = require('remark-rehype'); +var doc = require('rehype-document'); +var format = require('rehype-format'); +var html = require('rehype-stringify'); +var reporter = require('vfile-reporter'); + +unified() + .use(markdown) + .use(remark2rehype) + .use(doc) + .use(format) + .use(html) + .process('# Hello world!', function (err, file) { + console.error(reporter(err || file)); + console.log(String(file)); + }); +``` + +Yields: + +```html +no issues found + + + + + + + +

Hello world!

+ + +``` + +## Table of Contents + +* [Description](#description) +* [API](#api) + * [processor()](#processor) + * [processor.use(plugin\[, options\])](#processoruseplugin-options) + * [processor.parse(file|value)](#processorparsefilevalue) + * [processor.stringify(node\[, file\])](#processorstringifynode-file) + * [processor.run(node\[, file\]\[, done\])](#processorrunnode-file-done) + * [processor.runSync(node\[, file\])](#processorrunsyncnode-file) + * [processor.process(file|value\[, done\])](#processorprocessfilevalue-done) + * [processor.processSync(file|value)](#processorprocesssyncfilevalue) + * [processor.data(key\[, value\])](#processordatakey-value) + * [processor.freeze()](#processorfreeze) +* [Plugin](#plugin) + * [function attacher(\[options\])](#function-attacheroptions) + * [function transformer(node, file\[, next\])](#function-transformernode-file-next) +* [Preset](#preset) +* [License](#license) + +## Description + +**unified** is an interface for processing text using syntax trees. +Syntax trees are a representation understandable to programs. +Those programs, called [**plug-in**][plugin]s, take these trees and +modify them, amongst other things. To get to the syntax tree from +input text, there’s a [**parser**][parser], and, to get from that +back to text, there’s a [**compiler**][compiler]. This is the +[**process**][process] of a **processor**. + +```ascii + ┌──────────────┐ + ┌─ │ Transformers │ ─┐ + ▲ └──────────────┘ ▼ + └────────┐ ┌────────┘ + │ │ + ┌────────┐ │ │ ┌──────────┐ + Input ──▶ │ Parser │ ──▶ Tree ──▶ │ Compiler │ ──▶ Output + └────────┘ └──────────┘ +``` + +###### Processors + +Every processor implements another processor. To create a new +processor, invoke another processor. This creates a processor that is +configured to function the same as its ancestor. But, when +the descendant processor is configured in the future, that +configuration does not change the ancestral processor. + +Often, when processors are exposed from a library (for example, +unified itself), they should not be configured directly, as that +would change their behaviour for all users. Those processors are +[**frozen**][freeze], and new processors should be made from them before +they are used, by invoking them. + +###### Node + +The syntax trees used in **unified** are [**Unist**][unist] nodes, +which are plain JavaScript objects with a `type` property. The +semantics of those `type`s are defined by other projects. + +There are several [utilities][unist-utilities] for working with these +nodes. + +###### List of Processors + +The following projects process different syntax trees. They parse +text to their respective syntax tree, and they compile their syntax +trees back to text. These processors can be used as-is, or their +parsers and compilers can be mixed and matched with other plug-ins +to process between different syntaxes. + +* [**rehype**][rehype] ([**HAST**][hast]) — HTML +* [**remark**][remark] ([**MDAST**][mdast]) — Markdown +* [**retext**][retext] ([**NLCST**][nlcst]) — Natural language + +###### File + +When processing documents, metadata is often gathered about that +document. [**VFile**][vfile] is a virtual file format which stores +data, and handles metadata and messages for **unified** and its +plug-ins. + +There are several [utilities][vfile-utilities] for working with these +files. + +###### Configuration + +To configure a processor, invoke its [`use`][use] method, supply it a +[**plug-in**][plugin], and optionally settings. + +###### Integrations + +**unified** can integrate with the file-system through +[**unified-engine**][engine]. On top of that, CLI apps can be created +with [**unified-args**][args], Gulp plug-ins with +[**unified-engine-gulp**][gulp], and Atom Linters with +[**unified-engine-atom**][atom]. + +###### Programming interface + +The API gives access to processing metadata (such as lint messages), and +supports multiple passed through files: + +```js +var unified = require('unified'); +var markdown = require('remark-parse'); +var styleGuide = require('remark-preset-lint-markdown-style-guide'); +var remark2retext = require('remark-retext'); +var english = require('retext-english'); +var equality = require('retext-equality'); +var remark2rehype = require('remark-rehype'); +var html = require('rehype-stringify'); +var reporter = require('vfile-reporter'); + +unified() + .use(markdown) + .use(styleGuide) + .use(remark2retext, unified().use(english).use(equality)) + .use(remark2rehype) + .use(html) + .process('*Emphasis* and _importance_, you guys!', function (err, file) { + console.error(reporter(err || file)); + console.log(String(file)); + }); +``` + +Which yields: + +```txt + 1:16-1:28 warning Emphasis should use `*` as a marker emphasis-marker remark-lint + 1:34-1:38 warning `guys` may be insensitive, use `people`, `persons`, `folks` instead gals-men retext-equality + +⚠ 2 warnings +

Emphasis and importance, you guys!

+``` + +###### Processing between syntaxes + +The processors can be combined in two modes. + +**Bridge** mode transforms the syntax tree from one flavour (the origin) +to another (the destination). Then, transformations are applied on that +tree. Finally, the origin processor continues transforming the original +syntax tree. + +**Mutate** mode also transforms the syntax tree from one flavour to +another. But then the origin processor continues transforming the +destination syntax tree. + +In the previous example (“Programming interface”), `remark-retext` is +used in bridge mode: the origin syntax tree is kept after retext is +finished; whereas `remark-rehype` is used in mutate mode: it sets a +new syntax tree and discards the original. + +* [**remark-retext**][remark-retext] +* [**remark-rehype**][remark-rehype] +* [**rehype-retext**][rehype-retext] +* [**rehype-remark**][rehype-remark] + +## API + +### `processor()` + +Object describing how to process text. + +###### Returns + +`Function` — A new [**unfrozen**][freeze] processor which is +configured to function the same as its ancestor. But, when the +descendant processor is configured in the future, that configuration +does not change the ancestral processor. + +###### Example + +The following example shows how a new processor can be created (from +the remark processor) and linked to **stdin**(4) and **stdout**(4). + +```js +var remark = require('remark'); +var concat = require('concat-stream'); + +process.stdin.pipe(concat(function (buf) { + process.stdout.write(remark().processSync(buf).toString()); +})); +``` + +### `processor.use(plugin[, options])` + +Configure the processor to use a [**plug-in**][plugin], and configure +that plug-in with optional options. + +###### Signatures + +* `processor.use(plugin[, options])` +* `processor.use(preset)` +* `processor.use(list)` + +###### Parameters + +* `plugin` ([`Plugin`][plugin]) +* `options` (`*`, optional) — Configuration for `plugin` +* `preset` (`Object`) — Object with an optional `plugins` (set to `list`), + and/or an optional `settings` object +* `list` (`Array`) — plugins, presets, and arguments (a plugin and options + in an array), in an array + +###### Returns + +`processor` — The processor on which `use` is invoked. + +###### Note + +`use` cannot be called on [frozen][freeze] processors. Invoke the processor +first to create a new unfrozen processor. + +###### Example + +There are many ways to pass plugins to `.use()`. The below example +gives an overview. + +```js +var unified = require('unified'); + +unified() + // Plugin with options: + .use(plugin, {}) + // Plugins: + .use([plugin, pluginB]) + // Two plugins, the second with options: + .use([plugin, [pluginB, {}]]) + // Preset with plugins and settings: + .use({plugins: [plugin, [pluginB, {}]], settings: {position: false}}) + // Settings only: + .use({settings: {position: false}}); + +function plugin() {} +function pluginB() {} +``` + +### `processor.parse(file|value)` + +Parse text to a syntax tree. + +###### Parameters + +* `file` ([**VFile**][file]) + — Or anything which can be given to `vfile()` + +###### Returns + +[**Node**][node] — Syntax tree representation of input. + +###### Note + +`parse` [freezes][freeze] the processor, if not already frozen. + +#### `processor.Parser` + +Function handling the parsing of text to a syntax tree. Used in the +[**parse**][parse] phase in the process and invoked with a `string` +and [**VFile**][file] representation of the document to parse. + +If `Parser` is a normal parser, it should return a [`Node`][node]: the syntax +tree representation of the given file. + +`Parser` can also be a constructor function, in which case it’s invoked with +`new`. In that case, instances should have a `parse` method, which is invoked +(without arguments), and should return a [`Node`][node]. + +### `processor.stringify(node[, file])` + +Compile a syntax tree to text. + +###### Parameters + +* `node` ([**Node**][node]) +* `file` ([**VFile**][file], optional); + — Or anything which can be given to `vfile()` + +###### Returns + +`string` — String representation of the syntax tree file. + +###### Note + +`stringify` [freezes][freeze] the processor, if not already frozen. + +#### `processor.Compiler` + +Function handling the compilation of syntax tree to a text. Used in the +[**stringify**][stringify] phase in the process and invoked with a +[`Node`][node] and [**VFile**][file] representation of the document to +stringify. + +If `Compiler` is a normal stringifier, it should return a `string`: the text +representation of the given syntax tree. + +`Compiler` can also be a constructor function, in which case it’s invoked with +`new`. In that case, instances should have a `compile` method, which is invoked +(without arguments), and should return a `string`. + +### `processor.run(node[, file][, done])` + +Transform a syntax tree by applying [**plug-in**][plugin]s to it. + +###### Parameters + +* `node` ([**Node**][node]) +* `file` ([**VFile**][file], optional) + — Or anything which can be given to `vfile()` +* `done` ([`Function`][run-done], optional) + +###### Returns + +[**Promise**][promise], if `done` is not given. Rejected with an error, +or resolved with the resulting syntax tree. + +###### Note + +`run` [freezes][freeze] the processor, if not already frozen. + +##### `function done(err[, node, file])` + +Invoked when transformation is complete. Either invoked with an +error, or a syntax tree and a file. + +###### Parameters + +* `err` (`Error`) — Fatal error +* `node` ([**Node**][node]) +* `file` ([**VFile**][file]) + +### `processor.runSync(node[, file])` + +Transform a syntax tree by applying [**plug-in**][plugin]s to it. + +If asynchronous [**plug-in**][plugin]s are configured, an error is thrown. + +###### Parameters + +* `node` ([**Node**][node]) +* `file` ([**VFile**][file], optional) + — Or anything which can be given to `vfile()` + +###### Returns + +[**Node**][node] — The given syntax tree. + +###### Note + +`runSync` [freezes][freeze] the processor, if not already frozen. + +### `processor.process(file|value[, done])` + +Process the given representation of a file as configured on the +processor. The process invokes `parse`, `run`, and `stringify` +internally. + +###### Parameters + +* `file` ([**VFile**][file]) +* `value` (`string`) — String representation of a file +* `done` ([`Function`][process-done], optional) + +###### Returns + +[**Promise**][promise], if `done` is not given. Rejected with an error, +or resolved with the resulting file. + +###### Note + +`process` [freezes][freeze] the processor, if not already frozen. + +#### `function done(err, file)` + +Invoked when the process is complete. Invoked with a fatal error, if +any, and the [**VFile**][file]. + +###### Parameters + +* `err` (`Error`, optional) — Fatal error +* `file` ([**VFile**][file]) + +###### Example + +```js +var unified = require('unified'); +var markdown = require('remark-parse'); +var remark2rehype = require('remark-rehype'); +var doc = require('rehype-document'); +var format = require('rehype-format'); +var html = require('rehype-stringify'); +var reporter = require('vfile-reporter'); + +unified() + .use(markdown) + .use(remark2rehype) + .use(doc) + .use(format) + .use(html) + .process('# Hello world!') + .then(function (file) { + console.log(String(file)); + }, function (err) { + console.error(String(err)); + }); +``` + +Yields: + +```html + + + + + + + +

Hello world!

+ + +``` + +### `processor.processSync(file|value)` + +Process the given representation of a file as configured on the +processor. The process invokes `parse`, `run`, and `stringify` +internally. + +If asynchronous [**plug-in**][plugin]s are configured, an error is thrown. + +###### Parameters + +* `file` ([**VFile**][file]) +* `value` (`string`) — String representation of a file + +###### Returns + +[**VFile**][file] — Virtual file with modified [`contents`][vfile-contents]. + +###### Note + +`processSync` [freezes][freeze] the processor, if not already frozen. + +###### Example + +```js +var unified = require('unified'); +var markdown = require('remark-parse'); +var remark2rehype = require('remark-rehype'); +var doc = require('rehype-document'); +var format = require('rehype-format'); +var html = require('rehype-stringify'); +var reporter = require('vfile-reporter'); + +var processor = unified() + .use(markdown) + .use(remark2rehype) + .use(doc) + .use(format) + .use(html); + +console.log(processor.processSync('# Hello world!').toString()); +``` + +Yields: + +```html + + + + + + + +

Hello world!

+ + +``` + +### `processor.data(key[, value])` + +Get or set information in an in-memory key-value store accessible to +all phases of the process. An example is a list of HTML elements +which are self-closing (i.e., do not need a closing tag), which is +needed when parsing, transforming, and compiling HTML. + +###### Parameters + +* `key` (`string`) — Identifier +* `value` (`*`, optional) — Value to set. Omit if getting `key` + +###### Returns + +* `processor` — If setting, the processor on which `data` is invoked +* `*` — If getting, the value at `key` + +###### Note + +Setting information with `data` cannot occur on [frozen][freeze] processors. +Invoke the processor first to create a new unfrozen processor. + +###### Example + +The following example show how to get and set information: + +```js +var unified = require('unified'); + +console.log(unified().data('alpha', 'bravo').data('alpha')) +``` + +Yields: + +```txt +bravo +``` + +### `processor.freeze()` + +Freeze a processor. Frozen processors are meant to be extended, and not to +be configured or processed directly. + +Once a processor is frozen, it cannot be unfrozen. But, a new processor +functioning just like it can be created by invoking the processor. + +It’s possible to freeze processors explicitly, by calling `.freeze()`, but +[`.parse()`][parse], [`.run()`][run], [`.stringify()`][stringify], and +[`.process()`][process] call `.freeze()` to freeze a processor too. + +###### Returns + +`Processor` — The processor on which `freeze` is invoked. + +###### Example + +The following example, `index.js`, shows how [**rehype**][rehype] +prevents extensions to itself: + +```js +var unified = require('unified'); +var parse = require('rehype-parse'); +var stringify = require('rehype-stringify'); + +module.exports = unified().use(parse).use(stringify).freeze(); +``` + +The below example, `a.js`, shows how that processor can be used and +configured. + +```js +var rehype = require('rehype'); +var format = require('rehype-format'); +// ... + +rehype() + .use(format) + // ... +``` + +The below example, `b.js`, shows a similar looking example which +operates on the frozen [**rehype**][rehype] interface. If this +behaviour was allowed it would result in unexpected behaviour, so +an error is thrown. **This is invalid**: + +```js +var rehype = require('rehype'); +var format = require('rehype-format'); +// ... + +rehype + .use(format) + // ... +``` + +Yields: + +```txt +~/node_modules/unified/index.js:440 + throw new Error( + ^ + +Error: Cannot invoke `use` on a frozen processor. +Create a new processor first, by invoking it: use `processor()` instead of `processor`. + at assertUnfrozen (~/node_modules/unified/index.js:440:11) + at Function.use (~/node_modules/unified/index.js:172:5) + at Object. (~/b.js:6:4) +``` + +## `Plugin` + +A **unified** plugin changes the way the applied-on processor works, +in the following ways: + +* It modifies the [**processor**][processor]: such as changing the + parser, the compiler, or linking the processor to other processors +* It transforms the [**syntax tree**][node] representation of a file +* It modifies metadata of a file + +Plug-in’s are a concept which materialise as [**attacher**][attacher]s. + +###### Example + +`move.js`: + +```js +module.exports = move; + +function move(options) { + var expected = (options || {}).extname; + + if (!expected) { + throw new Error('Missing `extname` in options'); + } + + return transformer; + + function transformer(tree, file) { + if (file.extname && file.extname !== expected) { + file.extname = expected; + } + } +} +``` + +`index.js`: + +```js +var unified = require('unified'); +var parse = require('remark-parse'); +var remark2rehype = require('remark-rehype'); +var stringify = require('rehype-stringify'); +var vfile = require('to-vfile'); +var reporter = require('vfile-reporter'); +var move = require('./move'); + +unified() + .use(parse) + .use(remark2rehype) + .use(move, {extname: '.html'}) + .use(stringify) + .process(vfile.readSync('index.md'), function (err, file) { + console.error(reporter(err || file)); + if (file) { + vfile.writeSync(file); // Written to `index.html`. + } + }); +``` + +### `function attacher([options])` + +An attacher is the thing passed to [`use`][use]. It configures the +processor and in turn can receive options. + +Attachers can configure processors, such as by interacting with parsers +and compilers, linking them to other processors, or by specifying how +the syntax tree is handled. + +###### Context + +The context object is set to the invoked on [`processor`][processor]. + +###### Parameters + +* `options` (`*`, optional) — Configuration + +###### Returns + +[`transformer`][transformer] — Optional. + +###### Note + +Attachers are invoked when the processor is [frozen][freeze]: either when +`.freeze()` is called explicitly, or when [`.parse()`][parse], [`.run()`][run], +[`.stringify()`][stringify], or [`.process()`][process] is called for the first +time. + +### `function transformer(node, file[, next])` + +Transformers modify the syntax tree or metadata of a file. +A transformer is a function which is invoked each time a file is +passed through the transform phase. If an error occurs (either +because it’s thrown, returned, rejected, or passed to [`next`][next]), +the process stops. + +The transformation process in **unified** is handled by [`trough`][trough], +see it’s documentation for the exact semantics of transformers. + +###### Parameters + +* `node` ([**Node**][node]) +* `file` ([**VFile**][file]) +* `next` ([`Function`][next], optional) + +###### Returns + +* `Error` — Can be returned to stop the process +* [**Node**][node] — Can be returned and results in further + transformations and `stringify`s to be performed on the new + tree +* `Promise` — If a promise is returned, the function is asynchronous, + and **must** be resolved (optionally with a [**Node**][node]) or + rejected (optionally with an `Error`) + +#### `function next(err[, tree[, file]])` + +If the signature of a transformer includes `next` (third argument), +the function **may** finish asynchronous, and **must** invoke `next()`. + +###### Parameters + +* `err` (`Error`, optional) — Stop the process +* `node` ([**Node**][node], optional) — New syntax tree +* `file` ([**VFile**][file], optional) — New virtual file + +## `Preset` + +A **unified** preset provides a potentially sharable way to configure +processors. They can contain multiple plugins and optionally settings as +well. + +###### Example + +`preset.js`: + +```js +exports.settings = {bullet: '*', fences: true}; + +exports.plugins = [ + require('remark-preset-lint-recommended'), + require('remark-comment-config'), + require('remark-preset-lint-markdown-style-guide'), + [require('remark-toc'), {maxDepth: 3, tight: true}], + require('remark-github') +]; +``` + +`index.js`: + +```js +var remark = require('remark'); +var vfile = require('to-vfile'); +var reporter = require('vfile-reporter'); +var preset = require('./preset'); + +remark() + .use(preset) + .process(vfile.readSync('index.md'), function (err, file) { + console.error(reporter(err || file)); + + if (file) { + vfile.writeSync(file); + } + }); +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[logo]: https://cdn.rawgit.com/unifiedjs/unified/84f55c8/logo.svg + +[travis-badge]: https://img.shields.io/travis/unifiedjs/unified.svg + +[travis]: https://travis-ci.org/unifiedjs/unified + +[codecov-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified.svg + +[codecov]: https://codecov.io/github/unifiedjs/unified + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[site]: https://unifiedjs.github.io + +[guides]: https://unifiedjs.github.io/#guides + +[rehype]: https://github.com/wooorm/rehype + +[remark]: https://github.com/wooorm/remark + +[retext]: https://github.com/wooorm/retext + +[hast]: https://github.com/syntax-tree/hast + +[mdast]: https://github.com/syntax-tree/mdast + +[nlcst]: https://github.com/syntax-tree/nlcst + +[unist]: https://github.com/syntax-tree/unist + +[engine]: https://github.com/unifiedjs/unified-engine + +[args]: https://github.com/unifiedjs/unified-args + +[gulp]: https://github.com/unifiedjs/unified-engine-gulp + +[atom]: https://github.com/unifiedjs/unified-engine-atom + +[remark-rehype]: https://github.com/wooorm/remark-rehype + +[remark-retext]: https://github.com/wooorm/remark-retext + +[rehype-retext]: https://github.com/wooorm/rehype-retext + +[rehype-remark]: https://github.com/wooorm/rehype-remark + +[unist-utilities]: https://github.com/syntax-tree/unist#list-of-utilities + +[vfile]: https://github.com/vfile/vfile + +[vfile-contents]: https://github.com/vfile/vfile#vfilecontents + +[vfile-utilities]: https://github.com/vfile/vfile#related-tools + +[file]: #file + +[node]: #node + +[processor]: #processor + +[process]: #processorprocessfilevalue-done + +[parse]: #processorparsefilevalue + +[parser]: #processorparser + +[stringify]: #processorstringifynode-file + +[run]: #processorrunnode-file-done + +[compiler]: #processorcompiler + +[use]: #processoruseplugin-options + +[attacher]: #function-attacheroptions + +[transformer]: #function-transformernode-file-next + +[next]: #function-nexterr-tree-file + +[freeze]: #processorfreeze + +[plugin]: #plugin + +[run-done]: #function-doneerr-node-file + +[process-done]: #function-doneerr-file + +[trough]: https://github.com/wooorm/trough#function-fninput-next + +[promise]: https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Promise diff --git a/tools/eslint/node_modules/unist-util-remove-position/LICENSE b/tools/eslint/node_modules/unist-util-remove-position/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/unist-util-remove-position/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/unist-util-remove-position/index.js b/tools/eslint/node_modules/unist-util-remove-position/index.js new file mode 100644 index 00000000000000..4db10234be92bc --- /dev/null +++ b/tools/eslint/node_modules/unist-util-remove-position/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var visit = require('unist-util-visit'); + +module.exports = removePosition; + +/* Remove `position`s from `tree`. */ +function removePosition(node, force) { + visit(node, force ? hard : soft); + return node; +} + +function hard(node) { + delete node.position; +} + +function soft(node) { + node.position = undefined; +} diff --git a/tools/eslint/node_modules/unist-util-remove-position/package.json b/tools/eslint/node_modules/unist-util-remove-position/package.json new file mode 100644 index 00000000000000..493c66c020881b --- /dev/null +++ b/tools/eslint/node_modules/unist-util-remove-position/package.json @@ -0,0 +1,103 @@ +{ + "_from": "unist-util-remove-position@^1.0.0", + "_id": "unist-util-remove-position@1.1.1", + "_inBundle": false, + "_integrity": "sha1-WoXBVV/BugwQG4ZwfRXlD6TIcbs=", + "_location": "/unist-util-remove-position", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-remove-position@^1.0.0", + "name": "unist-util-remove-position", + "escapedName": "unist-util-remove-position", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.1.tgz", + "_shasum": "5a85c1555fc1ba0c101b86707d15e50fa4c871bb", + "_spec": "unist-util-remove-position@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-remove-position/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "unist-util-visit": "^1.1.0" + }, + "deprecated": false, + "description": "Remove `position`s from a unist tree", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.1", + "nyc": "^11.0.0", + "remark": "^7.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.0.0", + "unist-builder": "^1.0.2", + "xo": "^0.18.2" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/syntax-tree/unist-util-remove-position#readme", + "keywords": [ + "unist", + "utility", + "remove", + "position", + "location" + ], + "license": "MIT", + "name": "unist-util-remove-position", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-remove-position.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s unistUtilRemovePosition > unist-util-remove-position.js", + "build-mangle": "esmangle < unist-util-remove-position.js > unist-util-remove-position.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.1", + "xo": { + "space": true, + "esnext": false, + "ignores": [ + "unist-util-remove-position.js" + ] + } +} diff --git a/tools/eslint/node_modules/unist-util-remove-position/readme.md b/tools/eslint/node_modules/unist-util-remove-position/readme.md new file mode 100644 index 00000000000000..6063836f57bfad --- /dev/null +++ b/tools/eslint/node_modules/unist-util-remove-position/readme.md @@ -0,0 +1,77 @@ +# unist-util-remove-position [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Remove [`position`][position]s from a [Unist][] tree. + +## Installation + +[npm][]: + +```bash +npm install unist-util-remove-position +``` + +## Usage + +```javascript +var remark = require('remark'); +var removePosition = require('unist-util-remove-position'); + +var tree = remark().parse('Some _emphasis_, **importance**, and `code`.'); + +console.dir(removePosition(tree, true), {depth: null}); +``` + +Yields: + +```js +{ type: 'root', + children: + [ { type: 'paragraph', + children: + [ { type: 'text', value: 'Some ' }, + { type: 'emphasis', + children: [ { type: 'text', value: 'emphasis' } ] }, + { type: 'text', value: ', ' }, + { type: 'strong', + children: [ { type: 'text', value: 'importance' } ] }, + { type: 'text', value: ', and ' }, + { type: 'inlineCode', value: 'code' }, + { type: 'text', value: '.' } ] } ] } +``` + +## API + +### `removePosition(node[, force])` + +Remove [`position`][position]s from [`node`][node]. If `force` is given, +uses `delete`, otherwise, sets `position`s to `undefined`. + +###### Returns + +The given `node`. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/syntax-tree/unist-util-remove-position.svg + +[travis]: https://travis-ci.org/syntax-tree/unist-util-remove-position + +[codecov-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-remove-position.svg + +[codecov]: https://codecov.io/github/syntax-tree/unist-util-remove-position + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[position]: https://github.com/syntax-tree/unist#position + +[node]: https://github.com/syntax-tree/unist#node diff --git a/tools/eslint/node_modules/unist-util-stringify-position/LICENSE b/tools/eslint/node_modules/unist-util-stringify-position/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/unist-util-stringify-position/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/unist-util-stringify-position/index.js b/tools/eslint/node_modules/unist-util-stringify-position/index.js new file mode 100644 index 00000000000000..bf8ac832b0bf38 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-stringify-position/index.js @@ -0,0 +1,50 @@ +'use strict'; + +var own = {}.hasOwnProperty; + +module.exports = stringify; + +function stringify(value) { + /* Nothing. */ + if (!value || typeof value !== 'object') { + return null; + } + + /* Node. */ + if (own.call(value, 'position') || own.call(value, 'type')) { + return location(value.position); + } + + /* Location. */ + if (own.call(value, 'start') || own.call(value, 'end')) { + return location(value); + } + + /* Position. */ + if (own.call(value, 'line') || own.call(value, 'column')) { + return position(value); + } + + /* ? */ + return null; +} + +function position(pos) { + if (!pos || typeof pos !== 'object') { + pos = {}; + } + + return index(pos.line) + ':' + index(pos.column); +} + +function location(loc) { + if (!loc || typeof loc !== 'object') { + loc = {}; + } + + return position(loc.start) + '-' + position(loc.end); +} + +function index(value) { + return value && typeof value === 'number' ? value : 1; +} diff --git a/tools/eslint/node_modules/unist-util-stringify-position/package.json b/tools/eslint/node_modules/unist-util-stringify-position/package.json new file mode 100644 index 00000000000000..89283caf697265 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-stringify-position/package.json @@ -0,0 +1,102 @@ +{ + "_from": "unist-util-stringify-position@^1.0.0", + "_id": "unist-util-stringify-position@1.1.1", + "_inBundle": false, + "_integrity": "sha1-PMvcU2ee7W7PN3fdf14yKcG2qjw=", + "_location": "/unist-util-stringify-position", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-stringify-position@^1.0.0", + "name": "unist-util-stringify-position", + "escapedName": "unist-util-stringify-position", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/vfile" + ], + "_resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.1.tgz", + "_shasum": "3ccbdc53679eed6ecf3777dd7f5e3229c1b6aa3c", + "_spec": "unist-util-stringify-position@^1.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\vfile", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-stringify-position/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Stringify a Unist node, location, or position", + "devDependencies": { + "browserify": "^14.1.0", + "esmangle": "^1.0.0", + "nyc": "^10.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.5.1", + "xo": "^0.18.1" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/syntax-tree/unist-util-stringify-position#readme", + "keywords": [ + "unist", + "position", + "location", + "node", + "stringify", + "tostring", + "util", + "utility" + ], + "license": "MIT", + "name": "unist-util-stringify-position", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-stringify-position.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --no-builtins -s unistUtilStringifyPosition > unist-util-stringify-position.js", + "build-mangle": "esmangle unist-util-stringify-position.js > unist-util-stringify-position.min.js", + "build-md": "remark . --quiet --frail --output", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.1", + "xo": { + "space": true, + "esnext": false, + "ignores": [ + "unist-util-stringify-position.js" + ] + } +} diff --git a/tools/eslint/node_modules/unist-util-stringify-position/readme.md b/tools/eslint/node_modules/unist-util-stringify-position/readme.md new file mode 100644 index 00000000000000..36155a47debdf9 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-stringify-position/readme.md @@ -0,0 +1,85 @@ +# unist-util-stringify-position [![Build Status][build-badge]][build-page] [![Coverage Status][coverage-badge]][coverage-page] + +Stringify a [**Unist**][unist] [position][] or [location][]. + +## Installation + +[npm][]: + +```bash +npm install unist-util-stringify-position +``` + +## Usage + +```javascript +var stringify = require('unist-util-stringify-position'); + +stringify({line: 2, column: 3 }); //=> '2:3' + +stringify({ + start: {line: 2}, + end: {line: 3} +}); //=> '2:1-3:1' + +stringify({ + type: 'text', + value: '!', + position: { + start: {line: 5, column: 11}, + end: {line: 5, column: 12} + } +}); //=> '5:11-5:12' +``` + +## API + +### `stringifyPosition(node|location|position)` + +Stringify one position, a location (start and end positions), or +a node’s location. + +###### Parameters + +* `node` ([`Node`][node]) + — Node whose `'position'` property to stringify +* `location` ([`Location`][location]) + — Location whose `'start'` and `'end'` positions to stringify +* `position` ([`Position`][position]) + — Location whose `'line'` and `'column'` to stringify + +###### Returns + +`string?` — A range `ls:cs-le:ce` (when given `node` or +`location`) or a point `l:c` (when given `position`), where `l` stands +for line, `c` for column, `s` for `start`, and `e` for +end. `null` is returned if the given value is neither `node`, +`location`, nor `position`. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-stringify-position.svg + +[build-page]: https://travis-ci.org/syntax-tree/unist-util-stringify-position + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg + +[coverage-page]: https://codecov.io/github/syntax-tree/unist-util-stringify-position?branch=master + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[location]: https://github.com/syntax-tree/unist#location + +[position]: https://github.com/syntax-tree/unist#position diff --git a/tools/eslint/node_modules/unist-util-visit/LICENSE b/tools/eslint/node_modules/unist-util-visit/LICENSE new file mode 100644 index 00000000000000..32e7a3d93ca5a2 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-visit/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/unist-util-visit/index.js b/tools/eslint/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000000000..885059059e7e56 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-visit/index.js @@ -0,0 +1,53 @@ +'use strict'; + +/* Expose. */ +module.exports = visit; + +/* Visit. */ +function visit(tree, type, visitor, reverse) { + if (typeof type === 'function') { + reverse = visitor; + visitor = type; + type = null; + } + + one(tree); + + /* Visit a single node. */ + function one(node, index, parent) { + var result; + + index = index || (parent ? 0 : null); + + if (!type || node.type === type) { + result = visitor(node, index, parent || null); + } + + if (node.children && result !== false) { + return all(node.children, node); + } + + return result; + } + + /* Visit children in `parent`. */ + function all(children, parent) { + var step = reverse ? -1 : 1; + var max = children.length; + var min = -1; + var index = (reverse ? max : min) + step; + var child; + + while (index > min && index < max) { + child = children[index]; + + if (child && one(child, index, parent) === false) { + return false; + } + + index += step; + } + + return true; + } +} diff --git a/tools/eslint/node_modules/unist-util-visit/package.json b/tools/eslint/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000000000..b4e41df8edb3ad --- /dev/null +++ b/tools/eslint/node_modules/unist-util-visit/package.json @@ -0,0 +1,105 @@ +{ + "_from": "unist-util-visit@^1.1.0", + "_id": "unist-util-visit@1.1.3", + "_inBundle": false, + "_integrity": "sha1-7CaOcxudJ3p5pbWqBkOZDkBdYAs=", + "_location": "/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^1.1.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/unist-util-remove-position" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.1.3.tgz", + "_shasum": "ec268e731b9d277a79a5b5aa0643990e405d600b", + "_spec": "unist-util-visit@^1.1.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unist-util-remove-position", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "deprecated": false, + "description": "Recursively walk over unist nodes", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.0", + "nyc": "^11.0.0", + "remark": "^7.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.5.1", + "xo": "^0.18.2" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "remark", + "markdown", + "retext", + "natural", + "language", + "node", + "visit", + "walk", + "util", + "utility" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --no-builtins -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "esmangle unist-util-visit.js > unist-util-visit.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.3", + "xo": { + "space": true, + "esnext": false, + "ignores": [ + "unist-util-visit.js" + ] + } +} diff --git a/tools/eslint/node_modules/unist-util-visit/readme.md b/tools/eslint/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000000000..6d32c4f89417e1 --- /dev/null +++ b/tools/eslint/node_modules/unist-util-visit/readme.md @@ -0,0 +1,117 @@ +# unist-util-visit [![Build Status][build-badge]][build-page] [![Coverage Status][coverage-badge]][coverage-page] + +[Unist][] node visitor. Useful when working with [**remark**][remark], +[**retext**][retext], or [**rehype**][rehype]. + +## Installation + +[npm][]: + +```bash +npm install unist-util-visit +``` + +## Usage + +```javascript +var remark = require('remark'); +var visit = require('unist-util-visit'); + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.'); + +visit(tree, 'text', visitor); + +function visitor(node) { + console.log(node); +} +``` + +Yields: + +```js +{ type: 'text', value: 'Some ' } +{ type: 'text', value: 'emphasis' } +{ type: 'text', value: ', ' } +{ type: 'text', value: 'importance' } +{ type: 'text', value: ', and ' } +{ type: 'text', value: '.' } +``` + +## API + +### `visit(node[, type], visitor[, reverse])` + +Visit nodes. Optionally by node type. Optionally in reverse. + +###### Parameters + +* `node` ([`Node`][node]) + — Node to search +* `type` (`string`, optional) + — Node type +* `visitor` ([Function][visitor]) + — Visitor invoked when a node is found +* `reverse` (`boolean`, default: `false`) + — When falsey, checking starts at the first child and continues + through to later children. When truthy, this is reversed. + This **does not** mean checking starts at the deepest node and + continues on to the highest node + +#### `stop? = visitor(node, index, parent)` + +Invoked when a node (when `type` is given, matching `type`) is found. + +###### Parameters + +* `node` (`Node`) — Found node +* `index` (`number?`) — Position of `node` in `parent` +* `parent` (`Node?`) — Parent of `node` + +###### Returns + +`boolean?` - When `false`, visiting is immediately stopped. + +## Related + +* [`unist-util-visit-parents`](https://github.com/syntax-tree/unist-util-visit-parents) + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/eush77/unist-util-select) + — Select nodes with CSS-like selectors + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build-page]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage-page]: https://codecov.io/github/syntax-tree/unist-util-visit?branch=master + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[retext]: https://github.com/wooorm/retext + +[remark]: https://github.com/wooorm/remark + +[rehype]: https://github.com/wooorm/rehype + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #stop--visitornode-index-parent diff --git a/tools/eslint/node_modules/vfile-location/LICENSE b/tools/eslint/node_modules/vfile-location/LICENSE new file mode 100644 index 00000000000000..8d8660d36ef2ec --- /dev/null +++ b/tools/eslint/node_modules/vfile-location/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/vfile-location/index.js b/tools/eslint/node_modules/vfile-location/index.js new file mode 100644 index 00000000000000..0f85b86290cfa8 --- /dev/null +++ b/tools/eslint/node_modules/vfile-location/index.js @@ -0,0 +1,123 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module vfile-location + * @fileoverview Convert between positions (line and column-based) + * and offsets (range-based) locations in a virtual file. + */ + +'use strict'; + +/* Expose. */ +module.exports = factory; + +/** + * Factory. + * + * @param {VFile|string|Buffer} file - Virtual file or document. + */ +function factory(file) { + var contents = indices(String(file)); + + return { + toPosition: offsetToPositionFactory(contents), + toOffset: positionToOffsetFactory(contents) + }; +} + +/** + * Factory to get the line and column-based `position` for + * `offset` in the bound indices. + * + * @param {Array.} indices - Indices of + * line-breaks in `value`. + * @return {Function} - Bound method. + */ +function offsetToPositionFactory(indices) { + return offsetToPosition; + + /** + * Get the line and column-based `position` for + * `offset` in the bound indices. + * + * @param {number} offset - Offset. + * @return {Position} - Object with `line`, `column`, + * and `offset` properties based on the bound + * `indices`. An empty object when given invalid + * or out of bounds input. + */ + function offsetToPosition(offset) { + var index = -1; + var length = indices.length; + + if (offset < 0) { + return {}; + } + + while (++index < length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: (offset - (indices[index - 1] || 0)) + 1, + offset: offset + }; + } + } + + return {}; + } +} + +/** + * Factory to get the `offset` for a line and column-based + * `position` in the bound indices. + * + * @param {Array.} indices - Indices of + * line-breaks in `value`. + * @return {Function} - Bound method. + */ +function positionToOffsetFactory(indices) { + return positionToOffset; + + /** + * Get the `offset` for a line and column-based + * `position` in the bound indices. + * + * @param {Position} position - Object with `line` and + * `column` properties. + * @return {number} - Offset. `-1` when given invalid + * or out of bounds input. + */ + function positionToOffset(position) { + var line = position && position.line; + var column = position && position.column; + + if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { + return ((indices[line - 2] || 0) + column - 1) || 0; + } + + return -1; + } +} + +/** + * Get indices of line-breaks in `value`. + * + * @param {string} value - Value. + * @return {Array.} - List of indices of + * line-breaks. + */ +function indices(value) { + var result = []; + var index = value.indexOf('\n'); + + while (index !== -1) { + result.push(index + 1); + index = value.indexOf('\n', index + 1); + } + + result.push(value.length + 1); + + return result; +} diff --git a/tools/eslint/node_modules/vfile-location/package.json b/tools/eslint/node_modules/vfile-location/package.json new file mode 100644 index 00000000000000..b661dcdaea7ef3 --- /dev/null +++ b/tools/eslint/node_modules/vfile-location/package.json @@ -0,0 +1,109 @@ +{ + "_from": "vfile-location@^2.0.0", + "_id": "vfile-location@2.0.1", + "_inBundle": false, + "_integrity": "sha1-C/iBb3MrD4vZAqVv2kxiyOk13FI=", + "_location": "/vfile-location", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "vfile-location@^2.0.0", + "name": "vfile-location", + "escapedName": "vfile-location", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.1.tgz", + "_shasum": "0bf8816f732b0f8bd902a56fda4c62c8e935dc52", + "_spec": "vfile-location@^2.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/vfile-location/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Convert between positions (line and column-based) and offsets (range-based) locations in a virtual file", + "devDependencies": { + "browserify": "^13.0.1", + "esmangle": "^1.0.1", + "nyc": "^8.1.0", + "remark-cli": "^1.0.0", + "remark-comment-config": "^4.0.0", + "remark-github": "^5.0.0", + "remark-lint": "^4.0.0", + "remark-validate-links": "^4.0.0", + "tape": "^4.0.0", + "vfile": "^2.0.0", + "xo": "^0.16.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/vfile-location#readme", + "keywords": [ + "remark", + "comment", + "message", + "marker", + "control" + ], + "license": "MIT", + "name": "vfile-location", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "output": true, + "plugins": { + "comment-config": null, + "github": null, + "lint": null, + "validate-links": null + }, + "settings": { + "bullet": "*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/vfile-location.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s vfileLocation > vfile-location.js", + "build-mangle": "esmangle vfile-location.js > vfile-location.min.js", + "build-md": "remark . --quiet --frail", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "2.0.1", + "xo": { + "space": true, + "ignores": [ + "vfile-location.js" + ] + } +} diff --git a/tools/eslint/node_modules/vfile-location/readme.md b/tools/eslint/node_modules/vfile-location/readme.md new file mode 100644 index 00000000000000..02081d68dcfef6 --- /dev/null +++ b/tools/eslint/node_modules/vfile-location/readme.md @@ -0,0 +1,83 @@ +# vfile-location [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Convert between positions (line and column-based) and offsets +(range-based) locations in a [virtual file][vfile]. + +## Installation + +[npm][npm-install]: + +```bash +npm install vfile-location +``` + +## Usage + +```js +var vfile = require('vfile'); +var vfileLocation = require('vfile-location'); +var location = vfileLocation(vfile('foo\nbar\nbaz')); + +var offset = location.toOffset({line: 3, column: 3}); +var position = location.toPosition(offset); +``` + +Yields: + +```js +10 +{ + "line": 3, + "column": 3, + "offset": 10 +} +``` + +## API + +### `location = vfileLocation(doc)` + +Get transform functions for the given `doc` (`string`) or +[`file`][vfile]. + +Returns an object with [`toOffset`][to-offset] and +[`toPosition`][to-position]. + +### `location.toOffset(position)` + +Get the `offset` (`number`) for a line and column-based +[`position`][position] in the bound file. Returns `-1` +when given invalid or out of bounds input. + +### `location.toPosition(offset)` + +Get the line and column-based [`position`][position] for `offset` in +the bound file. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/wooorm/vfile-location.svg + +[travis]: https://travis-ci.org/wooorm/vfile-location + +[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/vfile-location.svg + +[codecov]: https://codecov.io/github/wooorm/vfile-location + +[npm-install]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[vfile]: https://github.com/wooorm/vfile + +[to-offset]: #locationtooffsetposition + +[to-position]: #locationtopositionoffset + +[position]: https://github.com/wooorm/unist#position diff --git a/tools/eslint/node_modules/vfile/LICENSE b/tools/eslint/node_modules/vfile/LICENSE new file mode 100644 index 00000000000000..f3722d94b38121 --- /dev/null +++ b/tools/eslint/node_modules/vfile/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/vfile/index.js b/tools/eslint/node_modules/vfile/index.js new file mode 100644 index 00000000000000..bc5b0ef853272f --- /dev/null +++ b/tools/eslint/node_modules/vfile/index.js @@ -0,0 +1,261 @@ +'use strict'; + +var path = require('path'); +var replace = require('replace-ext'); +var stringify = require('unist-util-stringify-position'); +var buffer = require('is-buffer'); + +module.exports = VFile; + +var own = {}.hasOwnProperty; +var proto = VFile.prototype; + +proto.toString = toString; +proto.message = message; +proto.fail = fail; + +/* Slight backwards compatibility. Remove in the future. */ +proto.warn = message; + +/* Order of setting (least specific to most), we need this because + * otherwise `{stem: 'a', path: '~/b.js'}` would throw, as a path + * is needed before a stem can be set. */ +var order = [ + 'history', + 'path', + 'basename', + 'stem', + 'extname', + 'dirname' +]; + +/* Construct a new file. */ +function VFile(options) { + var prop; + var index; + var length; + + if (!options) { + options = {}; + } else if (typeof options === 'string' || buffer(options)) { + options = {contents: options}; + } else if ('message' in options && 'messages' in options) { + return options; + } + + if (!(this instanceof VFile)) { + return new VFile(options); + } + + this.data = {}; + this.messages = []; + this.history = []; + this.cwd = process.cwd(); + + /* Set path related properties in the correct order. */ + index = -1; + length = order.length; + + while (++index < length) { + prop = order[index]; + + if (own.call(options, prop)) { + this[prop] = options[prop]; + } + } + + /* Set non-path related properties. */ + for (prop in options) { + if (order.indexOf(prop) === -1) { + this[prop] = options[prop]; + } + } +} + +/* Access full path (`~/index.min.js`). */ +Object.defineProperty(proto, 'path', { + get: function () { + return this.history[this.history.length - 1]; + }, + set: function (path) { + assertNonEmpty(path, 'path'); + + if (path !== this.path) { + this.history.push(path); + } + } +}); + +/* Access parent path (`~`). */ +Object.defineProperty(proto, 'dirname', { + get: function () { + return typeof this.path === 'string' ? path.dirname(this.path) : undefined; + }, + set: function (dirname) { + assertPath(this.path, 'dirname'); + this.path = path.join(dirname || '', this.basename); + } +}); + +/* Access basename (`index.min.js`). */ +Object.defineProperty(proto, 'basename', { + get: function () { + return typeof this.path === 'string' ? path.basename(this.path) : undefined; + }, + set: function (basename) { + assertNonEmpty(basename, 'basename'); + assertPart(basename, 'basename'); + this.path = path.join(this.dirname || '', basename); + } +}); + +/* Access extname (`.js`). */ +Object.defineProperty(proto, 'extname', { + get: function () { + return typeof this.path === 'string' ? path.extname(this.path) : undefined; + }, + set: function (extname) { + var ext = extname || ''; + + assertPart(ext, 'extname'); + assertPath(this.path, 'extname'); + + if (ext) { + if (ext.charAt(0) !== '.') { + throw new Error('`extname` must start with `.`'); + } + + if (ext.indexOf('.', 1) !== -1) { + throw new Error('`extname` cannot contain multiple dots'); + } + } + + this.path = replace(this.path, ext); + } +}); + +/* Access stem (`index.min`). */ +Object.defineProperty(proto, 'stem', { + get: function () { + return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined; + }, + set: function (stem) { + assertNonEmpty(stem, 'stem'); + assertPart(stem, 'stem'); + this.path = path.join(this.dirname || '', stem + (this.extname || '')); + } +}); + +/* Get the value of the file. */ +function toString(encoding) { + var value = this.contents || ''; + return buffer(value) ? value.toString(encoding) : String(value); +} + +/* Create a message with `reason` at `position`. + * When an error is passed in as `reason`, copies the + * stack. This does not add a message to `messages`. */ +function message(reason, position, ruleId) { + var filePath = this.path; + var range = stringify(position) || '1:1'; + var location; + var err; + + location = { + start: {line: null, column: null}, + end: {line: null, column: null} + }; + + if (position && position.position) { + position = position.position; + } + + if (position) { + /* Location. */ + if (position.start) { + location = position; + position = position.start; + } else { + /* Position. */ + location.start = position; + } + } + + err = new VMessage(reason.message || reason); + + err.name = (filePath ? filePath + ':' : '') + range; + err.file = filePath || ''; + err.reason = reason.message || reason; + err.line = position ? position.line : null; + err.column = position ? position.column : null; + err.location = location; + err.ruleId = ruleId || null; + err.source = null; + err.fatal = false; + + if (reason.stack) { + err.stack = reason.stack; + } + + this.messages.push(err); + + return err; +} + +/* Fail. Creates a vmessage, associates it with the file, + * and throws it. */ +function fail() { + var message = this.message.apply(this, arguments); + + message.fatal = true; + + throw message; +} + +/* Inherit from `Error#`. */ +function VMessagePrototype() {} +VMessagePrototype.prototype = Error.prototype; +VMessage.prototype = new VMessagePrototype(); + +/* Message properties. */ +proto = VMessage.prototype; + +proto.file = ''; +proto.name = ''; +proto.reason = ''; +proto.message = ''; +proto.stack = ''; +proto.fatal = null; +proto.column = null; +proto.line = null; + +/* Construct a new file message. + * + * Note: We cannot invoke `Error` on the created context, + * as that adds readonly `line` and `column` attributes on + * Safari 9, thus throwing and failing the data. */ +function VMessage(reason) { + this.message = reason; +} + +/* Assert that `part` is not a path (i.e., does + * not contain `path.sep`). */ +function assertPart(part, name) { + if (part.indexOf(path.sep) !== -1) { + throw new Error('`' + name + '` cannot be a path: did not expect `' + path.sep + '`'); + } +} + +/* Assert that `part` is not empty. */ +function assertNonEmpty(part, name) { + if (!part) { + throw new Error('`' + name + '` cannot be empty'); + } +} + +/* Assert `path` exists. */ +function assertPath(path, name) { + if (!path) { + throw new Error('Setting `' + name + '` requires `path` to be set too'); + } +} diff --git a/tools/eslint/node_modules/vfile/package.json b/tools/eslint/node_modules/vfile/package.json new file mode 100644 index 00000000000000..68021260818f17 --- /dev/null +++ b/tools/eslint/node_modules/vfile/package.json @@ -0,0 +1,126 @@ +{ + "_from": "vfile@^2.0.0", + "_id": "vfile@2.1.0", + "_inBundle": false, + "_integrity": "sha1-086Lgl57jVO4lhZDQSczgZNvAr0=", + "_location": "/vfile", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "vfile@^2.0.0", + "name": "vfile", + "escapedName": "vfile", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/unified" + ], + "_resolved": "https://registry.npmjs.org/vfile/-/vfile-2.1.0.tgz", + "_shasum": "d3ce8b825e7b8d53b896164341273381936f02bd", + "_spec": "vfile@^2.0.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/vfile/vfile/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + { + "name": "Denys Dovhan", + "email": "email@denysdovhan.com" + }, + { + "name": "Kyle Mathews", + "email": "mathews.kyle@gmail.com" + }, + { + "name": "Shinnosuke Watanabe", + "email": "snnskwtnb@gmail.com" + }, + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dependencies": { + "is-buffer": "^1.1.4", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0" + }, + "deprecated": false, + "description": "Virtual file format for text processing", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.0", + "nyc": "^10.0.0", + "remark-cli": "^3.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.4.0", + "xo": "^0.18.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/vfile/vfile#readme", + "keywords": [ + "virtual", + "file", + "text", + "processing", + "message", + "warning", + "error", + "remark", + "retext" + ], + "license": "MIT", + "name": "vfile", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vfile/vfile.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s VFile > vfile.js", + "build-mangle": "esmangle vfile.js > vfile.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "2.1.0", + "xo": { + "space": true, + "esnext": false, + "rules": { + "unicorn/no-new-buffer": "off" + }, + "ignores": [ + "vfile.js" + ] + } +} diff --git a/tools/eslint/node_modules/vfile/readme.md b/tools/eslint/node_modules/vfile/readme.md new file mode 100644 index 00000000000000..38896f69407d09 --- /dev/null +++ b/tools/eslint/node_modules/vfile/readme.md @@ -0,0 +1,290 @@ +# ![vfile][] + +[![Build Status][build-badge]][build-status] +[![Coverage Status][coverage-badge]][coverage-status] + +**VFile** is a virtual file format used by [**unified**][unified], +a text processing umbrella (it powers [**retext**][retext] for +natural language, [**remark**][remark] for markdown, and +[**rehype**][rehype] for HTML). Each processors that parse, transform, +and compile text, and need a virtual representation of files and a +place to store [messages][] about them. Plus, they work in the browser. +**VFile** provides these requirements at a small size, in IE 9 and up. + +> **VFile** is different from the excellent [**vinyl**][vinyl] +> in that it has a smaller API, a smaller size, and focuses on +> [messages][]. + +## Installation + +[npm][]: + +```bash +npm install vfile +``` + +## Table of Contents + +* [Usage](#usage) +* [Utilities](#utilities) +* [Reporters](#reporters) +* [API](#api) + * [VFile(\[options\])](#vfileoptions) + * [vfile.contents](#vfilecontents) + * [vfile.cwd](#vfilecwd) + * [vfile.path](#vfilepath) + * [vfile.basename](#vfilebasename) + * [vfile.stem](#vfilestem) + * [vfile.extname](#vfileextname) + * [vfile.dirname](#vfiledirname) + * [vfile.history](#vfilehistory) + * [vfile.messages](#vfilemessages) + * [vfile.data](#vfiledata) + * [VFile#toString(\[encoding\])](#vfiletostringencoding) + * [VFile#message(reason\[, position\[, ruleId\]\])](#vfilemessagereason-position-ruleid) + * [VFile#fail(reason\[, position\[, ruleId\]\])](#vfilefailreason-position-ruleid) + * [VFileMessage](#vfilemessage) +* [License](#license) + +## Usage + +```js +var vfile = require('vfile'); + +var file = vfile({path: '~/example.txt', contents: 'Alpha *braavo* charlie.'}); + +file.path; //=> '~/example.txt' +file.dirname; //=> '~' + +file.extname = '.md'; + +file.basename; //=> 'example.md' + +file.basename = 'index.text'; + +file.history; //=> ['~/example.txt', '~/example.md', '~/index.text'] + +file.message('`braavo` is misspelt; did you mean `bravo`?', {line: 1, column: 8}); + +console.log(file.messages); +``` + +Yields: + +```js +[ { [~/index.text:1:8: `braavo` is misspelt; did you mean `bravo`?] + message: '`braavo` is misspelt; did you mean `bravo`?', + name: '~/index.text:1:8', + file: '~/index.text', + reason: '`braavo` is misspelt; did you mean `bravo`?', + line: 1, + column: 8, + location: { start: [Object], end: [Object] }, + ruleId: null, + source: null, + fatal: false } ] +``` + +## Utilities + +The following list of projects includes tools for working with virtual +files. See [**Unist**][unist] for projects working with nodes. + +* [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile) + — Convert from [Vinyl][] +* [`is-vfile-message`](https://github.com/shinnn/is-vfile-message) + — Check if a value is a `VFileMessage` object +* [`to-vfile`](https://github.com/vfile/to-vfile) + — Create a virtual file from a file-path (and optionally read it) +* [`vfile-find-down`](https://github.com/vfile/vfile-find-down) + — Find files by searching the file system downwards +* [`vfile-find-up`](https://github.com/vfile/vfile-find-up) + — Find files by searching the file system upwards +* [`vfile-location`](https://github.com/vfile/vfile-location) + — Convert between line/column- and range-based locations +* [`vfile-statistics`](https://github.com/vfile/vfile-statistics) + — Count messages per category +* [`vfile-messages-to-vscode-diagnostics`](https://github.com/shinnn/vfile-messages-to-vscode-diagnostics) + — Convert to VS Code diagnostics +* [`vfile-sort`](https://github.com/vfile/vfile-sort) + — Sort messages by line/column +* [`vfile-to-eslint`](https://github.com/vfile/vfile-to-eslint) + — Convert VFiles to ESLint formatter compatible output + +## Reporters + +The following list of projects show linting results for given virtual files. +Reporters _must_ accept `Array.` as their first argument, and return +`string`. Reporters _may_ accept other values too, in which case it’s suggested +to stick to `vfile-reporter`s interface. + +* [`vfile-reporter`](https://github.com/vfile/vfile-reporter) + — Stylish reporter +* [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json) + — JSON reporter +* [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty) + — Pretty reporter + +## API + +### `VFile([options])` + +Create a new virtual file. If `options` is `string` or `Buffer`, treats +it as `{contents: options}`. If `options` is a `VFile`, returns it. +All other options are set on the newly created `vfile`. + +Path related properties are set in the following order (least specific +to most specific): `history`, `path`, `basename`, `stem`, `extname`, +`dirname`. + +It’s not possible to set either `dirname` or `extname` without setting +either `history`, `path`, `basename`, or `stem` as well. + +###### Example + +```js +vfile(); +vfile('console.log("alpha");'); +vfile(Buffer.from('exit 1')); +vfile({path: path.join(__dirname, 'readme.md')}); +vfile({stem: 'readme', extname: '.md', dirname: __dirname}); +vfile({other: 'properties', are: 'copied', ov: {e: 'r'}}); +``` + +### `vfile.contents` + +`Buffer`, `string`, `null` — Raw value. + +### `vfile.cwd` + +`string` — Base of `path`. Defaults to `process.cwd()`. + +### `vfile.path` + +`string?` — Path of `vfile`. Cannot be nullified. + +### `vfile.basename` + +`string?` — Current name (including extension) of `vfile`. Cannot +contain path separators. Cannot be nullified either (use +`file.path = file.dirname` instead). + +### `vfile.stem` + +`string?` — Name (without extension) of `vfile`. Cannot be nullified, +and cannot contain path separators. + +### `vfile.extname` + +`string?` — Extension (with dot) of `vfile`. Cannot be set if +there’s no `path` yet and cannot contain path separators. + +### `vfile.dirname` + +`string?` — Path to parent directory of `vfile`. Cannot be set if +there’s no `path` yet. + +### `vfile.history` + +`Array.` — List of file-paths the file moved between. + +### `vfile.messages` + +`Array.` — List of messages associated with the file. + +### `vfile.data` + +`Object` — Place to store custom information. It’s OK to store custom +data directly on the `vfile`, moving it to `data` gives a _little_ more +privacy. + +### `VFile#toString([encoding])` + +Convert contents of `vfile` to string. If `contents` is a buffer, +`encoding` is used to stringify buffers (default: `'utf8'`). + +### `VFile#message(reason[, position[, ruleId]])` + +Associates a message with the file for `reason` at `position`. When an +error is passed in as `reason`, copies the stack. + +###### Parameters + +* `reason` (`string` or `Error`) + — Reason for message, uses the stack and message of the error if given +* `position` (`Node`, `Location`, or `Position`, optional) + — Place at which the message occurred in `vfile` +* `ruleId` (`string`, optional) + — Category of warning + +###### Returns + +[`VFileMessage`][message]. + +### `VFile#fail(reason[, position[, ruleId]])` + +Associates a fatal message with the file, then immediately throws it. +Note: fatal errors mean a file is no longer processable. +Calls [`#message()`][messages] internally. + +###### Throws + +[`VFileMessage`][message]. + +### `VFileMessage` + +File-related message describing something at certain position (extends +`Error`). + +###### Properties + +* `file` (`string`) — File-path (when the message was triggered) +* `reason` (`string`) — Reason for message +* `ruleId` (`string?`) — Category of message +* `source` (`string?`) — Namespace of warning +* `stack` (`string?`) — Stack of message +* `fatal` (`boolean?`) — If `true`, marks associated file as no longer + processable +* `line` (`number?`) — Starting line of error +* `column` (`number?`) — Starting column of error +* `location` (`object`) — Full range information, when available. Has + `start` and `end` properties, both set to an object with `line` and + `column`, set to `number?` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/vfile/vfile.svg + +[build-status]: https://travis-ci.org/vfile/vfile + +[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile.svg + +[coverage-status]: https://codecov.io/github/vfile/vfile + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[vfile]: https://cdn.rawgit.com/vfile/vfile/a20a566/logo.svg + +[unified]: https://github.com/unifiedjs/unified + +[retext]: https://github.com/wooorm/retext + +[remark]: https://github.com/wooorm/remark + +[rehype]: https://github.com/wooorm/rehype + +[vinyl]: https://github.com/gulpjs/vinyl + +[unist]: https://github.com/syntax-tree/unist#list-of-utilities + +[messages]: #vfilemessagereason-position-ruleid + +[message]: #vfilemessage diff --git a/tools/eslint/node_modules/x-is-function/LICENSE b/tools/eslint/node_modules/x-is-function/LICENSE new file mode 100644 index 00000000000000..4f2aa21a49912c --- /dev/null +++ b/tools/eslint/node_modules/x-is-function/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Alexander Praetorius + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/eslint/node_modules/x-is-function/README.md b/tools/eslint/node_modules/x-is-function/README.md new file mode 100644 index 00000000000000..0c21a7e9ff09f6 --- /dev/null +++ b/tools/eslint/node_modules/x-is-function/README.md @@ -0,0 +1,41 @@ +# x-is-function +x is a function + +# usage +`npm install x-is-function` + +```js +var isFunction = require('x-is-function') + +isFunction(function () {}) +// -> true + +isFunction("hello") +// -> false + +isFunction("") +// -> false + +isFunction(9) +// -> false + +isFunction(true) +// -> false + +isFunction(new Date()) +// -> false + +isFunction({}) +// -> false + +isFunction(null) +// -> false + +isFunction(undefined) +// -> false +``` + + +# related +a list of other `x-is-...` modules can be found at +* [x-is](https://www.npmjs.com/package/x-is) diff --git a/tools/eslint/node_modules/x-is-function/index.js b/tools/eslint/node_modules/x-is-function/index.js new file mode 100644 index 00000000000000..b820d6318d09a1 --- /dev/null +++ b/tools/eslint/node_modules/x-is-function/index.js @@ -0,0 +1,3 @@ +module.exports = function isFunction (fn) { + return Object.prototype.toString.call(fn) === '[object Function]' +} diff --git a/tools/eslint/node_modules/x-is-function/package.json b/tools/eslint/node_modules/x-is-function/package.json new file mode 100644 index 00000000000000..a8a3fb45d8ed24 --- /dev/null +++ b/tools/eslint/node_modules/x-is-function/package.json @@ -0,0 +1,46 @@ +{ + "_from": "x-is-function@^1.0.4", + "_id": "x-is-function@1.0.4", + "_inBundle": false, + "_integrity": "sha1-XSlNw9Joy90GJYDgxd93o5HR+h4=", + "_location": "/x-is-function", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "x-is-function@^1.0.4", + "name": "x-is-function", + "escapedName": "x-is-function", + "rawSpec": "^1.0.4", + "saveSpec": null, + "fetchSpec": "^1.0.4" + }, + "_requiredBy": [ + "/unified" + ], + "_resolved": "https://registry.npmjs.org/x-is-function/-/x-is-function-1.0.4.tgz", + "_shasum": "5d294dc3d268cbdd062580e0c5df77a391d1fa1e", + "_spec": "x-is-function@^1.0.4", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", + "author": { + "name": "@serapath" + }, + "bugs": { + "url": "https://github.com/serapath/x-is-function/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Simple function test", + "homepage": "https://github.com/serapath/x-is-function#readme", + "license": "MIT", + "main": "index.js", + "name": "x-is-function", + "repository": { + "type": "git", + "url": "git+https://github.com/serapath/x-is-function.git" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "version": "1.0.4" +} diff --git a/tools/eslint/node_modules/x-is-string/LICENCE b/tools/eslint/node_modules/x-is-string/LICENCE new file mode 100644 index 00000000000000..0d0834052f3c54 --- /dev/null +++ b/tools/eslint/node_modules/x-is-string/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Matt-Esch. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/eslint/node_modules/x-is-string/README.md b/tools/eslint/node_modules/x-is-string/README.md new file mode 100644 index 00000000000000..99977d475ac91e --- /dev/null +++ b/tools/eslint/node_modules/x-is-string/README.md @@ -0,0 +1,46 @@ +# x-is-string + +Simple string test + +## Example + +```js +var isString = require("x-is-string") + +isString("hello") +// -> true + +isString("") +// -> true + +isString(new String("things")) +// -> true + +isString(1) +// -> false + +isString(true) +// -> false + +isString(new Date()) +// -> false + +isString({}) +// -> false + +isString(null) +// -> false + +isString(undefined) +// -> false +``` + +## Installation + +`npm install x-is-string` + +## Contributors + + - Matt-Esch + +## MIT Licenced \ No newline at end of file diff --git a/tools/eslint/node_modules/x-is-string/index.js b/tools/eslint/node_modules/x-is-string/index.js new file mode 100644 index 00000000000000..090130d4ce4026 --- /dev/null +++ b/tools/eslint/node_modules/x-is-string/index.js @@ -0,0 +1,7 @@ +var toString = Object.prototype.toString + +module.exports = isString + +function isString(obj) { + return toString.call(obj) === "[object String]" +} diff --git a/tools/eslint/node_modules/x-is-string/package.json b/tools/eslint/node_modules/x-is-string/package.json new file mode 100644 index 00000000000000..e42818c640b74a --- /dev/null +++ b/tools/eslint/node_modules/x-is-string/package.json @@ -0,0 +1,86 @@ +{ + "_from": "x-is-string@^0.1.0", + "_id": "x-is-string@0.1.0", + "_inBundle": false, + "_integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=", + "_location": "/x-is-string", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "x-is-string@^0.1.0", + "name": "x-is-string", + "escapedName": "x-is-string", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/unified" + ], + "_resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "_shasum": "474b50865af3a49a9c4657f05acd145458f77d82", + "_spec": "x-is-string@^0.1.0", + "_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", + "author": { + "name": "Matt-Esch", + "email": "matt@mattesch.info" + }, + "bugs": { + "url": "https://github.com/Matt-Esch/x-is-string/issues", + "email": "matt@mattesch.info" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Matt-Esch" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Simple string test", + "devDependencies": { + "tape": "^2.12.2" + }, + "homepage": "https://github.com/Matt-Esch/x-is-string", + "keywords": [], + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/Matt-Esch/x-is-string/raw/master/LICENSE" + } + ], + "main": "index", + "name": "x-is-string", + "repository": { + "type": "git", + "url": "git://github.com/Matt-Esch/x-is-string.git" + }, + "scripts": { + "cover": "istanbul cover --report none --print detail ./test/index.js", + "start": "node ./index.js", + "test": "node ./test/index.js", + "test-browser": "testem-browser ./test/browser/index.js", + "testem": "testem-both -b=./test/browser/index.js", + "travis-test": "istanbul cover ./test/index.js && ((cat coverage/lcov.info | coveralls) || exit 0)", + "view-cover": "istanbul report html && google-chrome ./coverage/index.html", + "watch": "nodemon -w ./index.js index.js" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "0.1.0" +} diff --git a/tools/eslint/package-lock.json b/tools/eslint/package-lock.json new file mode 100644 index 00000000000000..ec7a0af01ba16e --- /dev/null +++ b/tools/eslint/package-lock.json @@ -0,0 +1,736 @@ +{ + "name": "eslint", + "version": "3.19.0", + "lockfileVersion": 1, + "dependencies": { + "acorn": { + "version": "https://registry.npmjs.org/acorn/-/acorn-5.0.3.tgz", + "integrity": "sha1-xGDfCEkUY/AozLguqzcwvwEIez0=" + }, + "acorn-jsx": { + "version": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dependencies": { + "acorn": { + "version": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=" + } + } + }, + "ajv": { + "version": "https://registry.npmjs.org/ajv/-/ajv-4.11.5.tgz", + "integrity": "sha1-tu50ZXuZOgHc5Et5RNVvSFgo1b0=" + }, + "ajv-keywords": { + "version": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=" + }, + "ansi-escapes": { + "version": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=" + }, + "ansi-regex": { + "version": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "argparse": { + "version": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=" + }, + "array-union": { + "version": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=" + }, + "array-uniq": { + "version": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "arrify": { + "version": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + }, + "babel-code-frame": { + "version": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", + "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=" + }, + "bail": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.1.tgz", + "integrity": "sha1-kSV53os5Gq3zxf30zSoPwiXfO8I=" + }, + "balanced-match": { + "version": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=" + }, + "brace-expansion": { + "version": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz", + "integrity": "sha1-cZfX6qm4fmSDkOph/GbIRCdCDfk=" + }, + "buffer-shims": { + "version": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=" + }, + "caller-path": { + "version": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=" + }, + "callsites": { + "version": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=" + }, + "chalk": { + "version": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=" + }, + "character-entities": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.0.tgz", + "integrity": "sha1-poPiz3Xb6LFxljUxNk5Y4YobFV8=" + }, + "character-entities-legacy": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.0.tgz", + "integrity": "sha1-sYqtmPa3vMZGweTIH58ZVjdqVho=" + }, + "character-reference-invalid": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz", + "integrity": "sha1-3smtHfufjQa0/NqircPE/ZevHmg=" + }, + "circular-json": { + "version": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.1.tgz", + "integrity": "sha1-vos2rvzN6LPKeqLWr8B6NyQsDS0=" + }, + "cli-cursor": { + "version": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=" + }, + "cli-width": { + "version": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", + "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=" + }, + "co": { + "version": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "code-point-at": { + "version": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "collapse-white-space": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.3.tgz", + "integrity": "sha1-S5BvZw5aljqHt2sOFolkM0G2Ajw=" + }, + "concat-map": { + "version": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=" + }, + "core-util-is": { + "version": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "d": { + "version": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=" + }, + "debug": { + "version": "https://registry.npmjs.org/debug/-/debug-2.6.3.tgz", + "integrity": "sha1-D364wwll7AjHKsz6ATDIt5mEFB0=" + }, + "deep-is": { + "version": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, + "del": { + "version": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=" + }, + "doctrine": { + "version": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=" + }, + "es5-ext": { + "version": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.15.tgz", + "integrity": "sha1-wzClk0we4hKEp8CBqG5f2TfJHqY=" + }, + "es6-iterator": { + "version": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=" + }, + "es6-map": { + "version": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", + "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=" + }, + "es6-set": { + "version": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=" + }, + "es6-symbol": { + "version": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=" + }, + "es6-weak-map": { + "version": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", + "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=" + }, + "escape-string-regexp": { + "version": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "escope": { + "version": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", + "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=" + }, + "eslint-plugin-markdown": { + "version": "1.0.0-beta.7", + "resolved": "https://registry.npmjs.org/eslint-plugin-markdown/-/eslint-plugin-markdown-1.0.0-beta.7.tgz", + "integrity": "sha1-Euc6QSfEpLedlm+fR1hR3Q949+c=" + }, + "espree": { + "version": "https://registry.npmjs.org/espree/-/espree-3.4.1.tgz", + "integrity": "sha1-KKg6tKrtce2P4PXv5ht2oFwTxNI=" + }, + "esprima": { + "version": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + }, + "esquery": { + "version": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=" + }, + "esrecurse": { + "version": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.1.0.tgz", + "integrity": "sha1-RxO2U2rffyrE8yfVWed1a/9kgiA=", + "dependencies": { + "estraverse": { + "version": "https://registry.npmjs.org/estraverse/-/estraverse-4.1.1.tgz", + "integrity": "sha1-9srKcokzqFDvkGYdDheYK6RxEaI=" + } + } + }, + "estraverse": { + "version": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + }, + "esutils": { + "version": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, + "event-emitter": { + "version": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=" + }, + "exit-hook": { + "version": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=" + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "fast-levenshtein": { + "version": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, + "figures": { + "version": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=" + }, + "file-entry-cache": { + "version": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=" + }, + "flat-cache": { + "version": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz", + "integrity": "sha1-+oZxTnLCHbiGAXYezy9VXRq8a5Y=" + }, + "fs.realpath": { + "version": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "function-bind": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", + "integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=" + }, + "generate-function": { + "version": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" + }, + "generate-object-property": { + "version": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=" + }, + "glob": { + "version": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=" + }, + "globals": { + "version": "https://registry.npmjs.org/globals/-/globals-9.17.0.tgz", + "integrity": "sha1-DAymltm5u2lNLlRwvTd3fKrVAoY=" + }, + "globby": { + "version": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=" + }, + "graceful-fs": { + "version": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=" + }, + "has-ansi": { + "version": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=" + }, + "ignore": { + "version": "https://registry.npmjs.org/ignore/-/ignore-3.2.6.tgz", + "integrity": "sha1-JujaBkS+C7TLOVFvbHnw4PT/5Iw=" + }, + "imurmurhash": { + "version": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "inflight": { + "version": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=" + }, + "inherits": { + "version": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "inquirer": { + "version": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", + "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=" + }, + "interpret": { + "version": "https://registry.npmjs.org/interpret/-/interpret-1.0.2.tgz", + "integrity": "sha1-9PYj8LtxIvFfVxfI4lS4FhtcWy0=" + }, + "is-alphabetical": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.0.tgz", + "integrity": "sha1-4lRMEwWCVfIUTLdXBmzTNCocjEY=" + }, + "is-alphanumerical": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.0.tgz", + "integrity": "sha1-4GSS5xnBvxXewjnk8a9fZ7TW578=" + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=" + }, + "is-decimal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.0.tgz", + "integrity": "sha1-lAV5tupjxigICmnmK9qIyEcLT+A=" + }, + "is-fullwidth-code-point": { + "version": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=" + }, + "is-hexadecimal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.0.tgz", + "integrity": "sha1-XEWXcdKvmi45Ungf1U/LG8/kETw=" + }, + "is-my-json-valid": { + "version": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz", + "integrity": "sha1-8Hndm/2uZe4gOKrorLyGqxCeNpM=" + }, + "is-path-cwd": { + "version": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=" + }, + "is-path-in-cwd": { + "version": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=" + }, + "is-path-inside": { + "version": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=" + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + }, + "is-property": { + "version": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" + }, + "is-resolvable": { + "version": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=" + }, + "is-whitespace-character": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.0.tgz", + "integrity": "sha1-u/SoN2Tq0NRRvsKlUhjpGWGtwnU=" + }, + "is-word-character": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.0.tgz", + "integrity": "sha1-o6nl3a1wxcLuNvSpz8mlP0RTUkc=" + }, + "isarray": { + "version": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "js-tokens": { + "version": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", + "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=" + }, + "js-yaml": { + "version": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.8.2.tgz", + "integrity": "sha1-AtPiwPa+qyAkjUEsNSIDgn14ZyE=" + }, + "json-stable-stringify": { + "version": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=" + }, + "jsonify": { + "version": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, + "jsonpointer": { + "version": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" + }, + "levn": { + "version": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=" + }, + "lodash": { + "version": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" + }, + "markdown-escapes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.0.tgz", + "integrity": "sha1-yMoZ8dlNaCRZ4Kk8htsnp+9xayM=" + }, + "minimatch": { + "version": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha1-Kk5AkLlrLbBqnX3wEFWmKnfJt3Q=" + }, + "minimist": { + "version": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=" + }, + "ms": { + "version": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=" + }, + "mute-stream": { + "version": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", + "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=" + }, + "natural-compare": { + "version": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" + }, + "number-is-nan": { + "version": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "object-assign": { + "version": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "once": { + "version": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=" + }, + "onetime": { + "version": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=" + }, + "optionator": { + "version": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=" + }, + "os-homedir": { + "version": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "parse-entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.1.tgz", + "integrity": "sha1-gRLYhHExnyerrk1klksSL+ThuJA=" + }, + "path-is-absolute": { + "version": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=" + }, + "path-parse": { + "version": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" + }, + "pify": { + "version": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=" + }, + "pluralize": { + "version": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=" + }, + "prelude-ls": { + "version": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, + "process-nextick-args": { + "version": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "progress": { + "version": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=" + }, + "readable-stream": { + "version": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz", + "integrity": "sha1-i0Ou125xSDk40SqNRsbPGgCx+BY=" + }, + "readline2": { + "version": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", + "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=" + }, + "rechoir": { + "version": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=" + }, + "remark-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-3.0.1.tgz", + "integrity": "sha1-G5+EGkTY9PvyJGhQJlRZpOs1TIA=" + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" + }, + "require-uncached": { + "version": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=" + }, + "resolve": { + "version": "https://registry.npmjs.org/resolve/-/resolve-1.3.2.tgz", + "integrity": "sha1-HwRCyeDLuBNuh7kwX5MvRsfygjU=" + }, + "resolve-from": { + "version": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=" + }, + "restore-cursor": { + "version": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=" + }, + "rimraf": { + "version": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=" + }, + "run-async": { + "version": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", + "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=" + }, + "rx-lite": { + "version": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", + "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=" + }, + "shelljs": { + "version": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.7.tgz", + "integrity": "sha1-svXHfvlxSPS09uImguELuoZnz/E=" + }, + "slice-ansi": { + "version": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=" + }, + "sprintf-js": { + "version": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "state-toggle": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.0.tgz", + "integrity": "sha1-0g+aYWu08MO5i5GSLSW2QKorxCU=" + }, + "string_decoder": { + "version": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "string-width": { + "version": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=" + }, + "strip-ansi": { + "version": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=" + }, + "strip-bom": { + "version": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "strip-json-comments": { + "version": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "supports-color": { + "version": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + }, + "table": { + "version": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "dependencies": { + "is-fullwidth-code-point": { + "version": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "https://registry.npmjs.org/string-width/-/string-width-2.0.0.tgz", + "integrity": "sha1-Y1xUNsxypuDDh87KJ41OLuxSaH4=" + } + } + }, + "text-table": { + "version": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" + }, + "through": { + "version": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "trim-trailing-lines": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.0.tgz", + "integrity": "sha1-eu+7eAjfnWafbaLkOMrIxGradoQ=" + }, + "trough": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.0.tgz", + "integrity": "sha1-a97f5/KqSabzxDIldodVWVfzQv0=" + }, + "tryit": { + "version": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", + "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=" + }, + "type-check": { + "version": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=" + }, + "typedarray": { + "version": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "unherit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.0.tgz", + "integrity": "sha1-a5qu379z3xdWrZ4xbdmBiFhAzX0=" + }, + "unified": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-6.1.5.tgz", + "integrity": "sha1-cWk3hyYhpjE15iztLzrGoGPG+4c=" + }, + "unist-util-remove-position": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.1.tgz", + "integrity": "sha1-WoXBVV/BugwQG4ZwfRXlD6TIcbs=" + }, + "unist-util-stringify-position": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.1.tgz", + "integrity": "sha1-PMvcU2ee7W7PN3fdf14yKcG2qjw=" + }, + "unist-util-visit": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.1.3.tgz", + "integrity": "sha1-7CaOcxudJ3p5pbWqBkOZDkBdYAs=" + }, + "user-home": { + "version": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", + "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=" + }, + "util-deprecate": { + "version": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "vfile": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-2.1.0.tgz", + "integrity": "sha1-086Lgl57jVO4lhZDQSczgZNvAr0=" + }, + "vfile-location": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.1.tgz", + "integrity": "sha1-C/iBb3MrD4vZAqVv2kxiyOk13FI=" + }, + "wordwrap": { + "version": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, + "wrappy": { + "version": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=" + }, + "x-is-function": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/x-is-function/-/x-is-function-1.0.4.tgz", + "integrity": "sha1-XSlNw9Joy90GJYDgxd93o5HR+h4=" + }, + "x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=" + }, + "xtend": { + "version": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + } + } +} diff --git a/tools/eslint/package.json b/tools/eslint/package.json index e064affa2526dc..09fc85dc63c33e 100644 --- a/tools/eslint/package.json +++ b/tools/eslint/package.json @@ -61,6 +61,7 @@ "concat-stream": "^1.6.0", "debug": "^2.6.8", "doctrine": "^2.0.0", + "eslint-plugin-markdown": "^1.0.0-beta.7", "eslint-scope": "^3.7.1", "espree": "^3.4.3", "esquery": "^1.0.0", diff --git a/tools/jslint.js b/tools/jslint.js index 5aa6079dea9fa5..245a5c570b7a90 100644 --- a/tools/jslint.js +++ b/tools/jslint.js @@ -1,6 +1,7 @@ 'use strict'; const rulesDirs = ['tools/eslint-rules']; +const extensions = ['.js', '.md']; // This is the maximum number of files to be linted per worker at any given time const maxWorkload = 40; @@ -14,7 +15,8 @@ const glob = require('./eslint/node_modules/glob'); const cwd = process.cwd(); const cliOptions = { - rulePaths: rulesDirs + rulePaths: rulesDirs, + extensions: extensions, }; // Check if we should fix errors that are fixable diff --git a/vcbuild.bat b/vcbuild.bat index 59588b9c8990fe..52b7916693235c 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -349,12 +349,12 @@ if defined jslint_ci goto jslint-ci if not defined jslint goto exit if not exist tools\eslint\bin\eslint.js goto no-lint echo running jslint -%config%\node tools\eslint\bin\eslint.js --cache --rule "linebreak-style: 0" --rulesdir=tools\eslint-rules benchmark lib test tools +%config%\node tools\eslint\bin\eslint.js --cache --rule "linebreak-style: 0" --rulesdir=tools\eslint-rules --ext=.js,.md benchmark doc lib test tools goto exit :jslint-ci echo running jslint-ci -%config%\node tools\jslint.js -J -f tap -o test-eslint.tap benchmark lib test tools +%config%\node tools\jslint.js -J -f tap -o test-eslint.tap benchmark doc lib test tools goto exit :no-lint From 0d60a34298ad43c44fee9447a4adbf4a5fbb50f2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 31 Dec 2016 21:52:56 -0800 Subject: [PATCH 05/17] tools: remove no-useless-regex-char-class-escape The `no-useless-regex-char-class-escape` custom lint rule was introduced as a less aggressive alternative to some enhancements that were introduced into ESLint. Those enhancements were blocking us from updating ESLint. However, they have since been relaxed and the custom rule is no longer needed. Remove it. Backport-PR-URL: https://github.com/nodejs/node/pull/14360 PR-URL: https://github.com/nodejs/node/pull/10561 Reviewed-By: Teddy Katz Reviewed-By: James M Snell Reviewed-By: Sam Roberts --- .eslintrc.yaml | 1 - .../no-useless-regex-char-class-escape.js | 190 ------------------ 2 files changed, 191 deletions(-) delete mode 100644 tools/eslint-rules/no-useless-regex-char-class-escape.js diff --git a/.eslintrc.yaml b/.eslintrc.yaml index f7c61cac14739e..0139d63a78a04f 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -165,7 +165,6 @@ rules: # Custom rules in tools/eslint-rules align-multiline-assignment: 2 assert-throws-arguments: [2, { requireTwo: true }] - no-useless-regex-char-class-escape: [2, { override: ['[', ']'] }] # Global scoped method and vars globals: diff --git a/tools/eslint-rules/no-useless-regex-char-class-escape.js b/tools/eslint-rules/no-useless-regex-char-class-escape.js deleted file mode 100644 index 934a3fa193b506..00000000000000 --- a/tools/eslint-rules/no-useless-regex-char-class-escape.js +++ /dev/null @@ -1,190 +0,0 @@ -/** - * @fileoverview Disallow useless escape in regex character class - * Based on 'no-useless-escape' rule - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const REGEX_CHARCLASS_ESCAPES = new Set('\\bcdDfnrsStvwWxu0123456789]'); - -/** - * Parses a regular expression into a list of regex character class list. - * @param {string} regExpText raw text used to create the regular expression - * @returns {Object[]} A list of character classes tokens with index and - * escape info - * @example - * - * parseRegExpCharClass('a\\b[cd-]') - * - * returns: - * [ - * { - * empty: false, - * start: 4, - * end: 6, - * chars: [ - * {text: 'c', index: 4, escaped: false}, - * {text: 'd', index: 5, escaped: false}, - * {text: '-', index: 6, escaped: false} - * ] - * } - * ] - */ - -function parseRegExpCharClass(regExpText) { - const charList = []; - let charListIdx = -1; - const initState = { - escapeNextChar: false, - inCharClass: false, - startingCharClass: false - }; - - regExpText.split('').reduce((state, char, index) => { - if (!state.escapeNextChar) { - if (char === '\\') { - return Object.assign(state, { escapeNextChar: true }); - } - if (char === '[' && !state.inCharClass) { - charListIdx += 1; - charList.push({ start: index + 1, chars: [], end: -1 }); - return Object.assign(state, { - inCharClass: true, - startingCharClass: true - }); - } - if (char === ']' && state.inCharClass) { - const charClass = charList[charListIdx]; - charClass.empty = charClass.chars.length === 0; - if (charClass.empty) { - charClass.start = charClass.end = -1; - } else { - charList[charListIdx].end = index - 1; - } - return Object.assign(state, { - inCharClass: false, - startingCharClass: false - }); - } - } - if (state.inCharClass) { - charList[charListIdx].chars.push({ - text: char, - index, escaped: - state.escapeNextChar - }); - } - return Object.assign(state, { - escapeNextChar: false, - startingCharClass: false - }); - }, initState); - - return charList; -} - -module.exports = { - meta: { - docs: { - description: 'disallow unnecessary regex characer class escape sequences', - category: 'Best Practices', - recommended: false - }, - fixable: 'code', - schema: [{ - 'type': 'object', - 'properties': { - 'override': { - 'type': 'array', - 'items': { 'type': 'string' }, - 'uniqueItems': true - } - }, - 'additionalProperties': false - }] - }, - - create(context) { - const overrideSet = new Set(context.options.length - ? context.options[0].override || [] - : []); - - /** - * Reports a node - * @param {ASTNode} node The node to report - * @param {number} startOffset The backslash's offset - * from the start of the node - * @param {string} character The uselessly escaped character - * (not including the backslash) - * @returns {void} - */ - function report(node, startOffset, character) { - context.report({ - node, - loc: { - line: node.loc.start.line, - column: node.loc.start.column + startOffset - }, - message: 'Unnecessary regex escape in character' + - ' class: \\{{character}}', - data: { character }, - fix: (fixer) => { - const start = node.range[0] + startOffset; - return fixer.replaceTextRange([start, start + 1], ''); - } - }); - } - - /** - * Checks if a node has superflous escape character - * in regex character class. - * - * @param {ASTNode} node - node to check. - * @returns {void} - */ - function check(node) { - if (node.regex) { - parseRegExpCharClass(node.regex.pattern) - .forEach((charClass) => { - charClass - .chars - // The '-' character is a special case if is not at - // either edge of the character class. To account for this, - // filter out '-' characters that appear in the middle of a - // character class. - .filter((charInfo) => !(charInfo.text === '-' && - (charInfo.index !== charClass.start && - charInfo.index !== charClass.end))) - - // The '^' character is a special case if it's at the beginning - // of the character class. To account for this, filter out '^' - // characters that appear at the start of a character class. - // - .filter((charInfo) => !(charInfo.text === '^' && - charInfo.index === charClass.start)) - - // Filter out characters that aren't escaped. - .filter((charInfo) => charInfo.escaped) - - // Filter out characters that are valid to escape, based on - // their position in the regular expression. - .filter((charInfo) => !REGEX_CHARCLASS_ESCAPES.has(charInfo.text)) - - // Filter out overridden character list. - .filter((charInfo) => !overrideSet.has(charInfo.text)) - - // Report all the remaining characters. - .forEach((charInfo) => - report(node, charInfo.index, charInfo.text)); - }); - } - } - - return { - Literal: check - }; - } -}; From 81c276342f4179a2ebd98803bc5ae6abceffd476 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 17 Jun 2017 22:35:39 -0700 Subject: [PATCH 06/17] tools: fix indentation in required-modules.js In preparation for applying the more strict indentation linting available in ESLint 4.0.0, correct minor indentation issues in tools/eslint-rules/required-modules.js. This is the only file with indentation that does not conform to the stricter checks. Backport-PR-URL: https://github.com/nodejs/node/pull/14360 PR-URL: https://github.com/nodejs/node/pull/13758 Reviewed-By: Teddy Katz Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- tools/eslint-rules/required-modules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 3e4a8e8aadfc82..7691d5dd7d91a0 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -77,13 +77,13 @@ module.exports = function(context) { function(module) { return foundModules.indexOf(module === -1); } - ); + ); missingModules.forEach(function(moduleName) { context.report( node, 'Mandatory module "{{moduleName}}" must be loaded.', { moduleName: moduleName } - ); + ); }); } } From 446b04a47e85f804d8e0ff42c046dcf5994d0814 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 17 Jun 2017 22:37:09 -0700 Subject: [PATCH 07/17] tools: apply stricter indentation rules to tools ESLint 4.0.0 provides stricter (and more granular) indentation checking than previous versions. Apply the stricter indentation rules to the tools directory. Backport-PR-URL: https://github.com/nodejs/node/pull/14360 PR-URL: https://github.com/nodejs/node/pull/13758 Reviewed-By: Teddy Katz Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- tools/.eslintrc.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/.eslintrc.yaml diff --git a/tools/.eslintrc.yaml b/tools/.eslintrc.yaml new file mode 100644 index 00000000000000..e1405dd718bf0f --- /dev/null +++ b/tools/.eslintrc.yaml @@ -0,0 +1,12 @@ +## Tools-specific linter rules + +rules: + # Stylistic Issues + # http://eslint.org/docs/rules/#stylistic-issues + indent: [2, 2, {ArrayExpression: first, + CallExpression: {arguments: first}, + FunctionDeclaration: {parameters: first}, + FunctionExpression: {parameters: first}, + MemberExpression: off, + ObjectExpression: first, + SwitchCase: 1}] From 8648032359628c91514ed2207b03096914b76d15 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 19 Jun 2017 11:13:30 -0700 Subject: [PATCH 08/17] tools: fix error in custom ESLint rule Fix previously-unnoticed typo in `required-modules.js`. Backport-PR-URL: https://github.com/nodejs/node/pull/14360 Refs: https://github.com/nodejs/node/pull/13758#discussion_r122582786 PR-URL: https://github.com/nodejs/node/pull/13758 Reviewed-By: Teddy Katz Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- tools/eslint-rules/required-modules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 7691d5dd7d91a0..4a444809b7115c 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -75,7 +75,7 @@ module.exports = function(context) { if (foundModules.length < requiredModules.length) { var missingModules = requiredModules.filter( function(module) { - return foundModules.indexOf(module === -1); + return foundModules.indexOf(module) === -1; } ); missingModules.forEach(function(moduleName) { From 97f5806dbb0860eb353c6f036aa5aabcdf241478 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sun, 18 Jun 2017 16:22:32 +0300 Subject: [PATCH 09/17] test: fix RegExp nits * Remove needless RegExp flag In fixed case, `/g` flag is needless in the boolean context. * Remove needless RegExp capturing Use non-capturing grouping or remove capturing completely when: * capturing is useless per se, e.g. in test() check; * captured groups are not used afterward at all; * some of the later captured groups are not used afterward. * Use test, not match/exec in boolean context match() and exec() return a complicated object, unneeded in a boolean context. * Do not needlessly repeat RegExp creation This commit takes RegExp creation out of cycles and other repetitions. As long as the RegExp does not use /g flag and match indices, we are safe here. In tests, this fix hardly gives a significant performance gain, but it increases clarity and maintainability, reassuring some RegExps to be identical. RegExp in functions are not taken out of their functions: while these functions are called many times and their RegExps are recreated with each call, the performance gain in test cases does not seem to be worth decreasing function self-dependency. Backport-PR-URL: https://github.com/nodejs/node/pull/14370 PR-URL: https://github.com/nodejs/node/pull/13770 Reviewed-By: Colin Ihrig --- test/common/index.js | 3 +- test/debugger/helper-debugger-repl.js | 4 +- test/doctool/test-doctool-html.js | 6 +- test/inspector/test-inspector.js | 4 +- .../parallel/test-buffer-prototype-inspect.js | 2 +- test/parallel/test-cli-syntax.js | 9 +-- test/parallel/test-crypto-authenticated.js | 28 ++++++---- .../test-crypto-cipheriv-decipheriv.js | 8 ++- test/parallel/test-crypto-dh.js | 11 ++-- test/parallel/test-crypto.js | 3 +- test/parallel/test-error-reporting.js | 12 ++-- .../test-event-emitter-max-listeners.js | 14 ++--- test/parallel/test-fs-null-bytes.js | 2 +- .../test-fs-read-stream-throw-type-error.js | 11 ++-- test/parallel/test-global-console-exists.js | 2 +- .../test-http-client-unescaped-path.js | 4 +- test/parallel/test-http-server.js | 4 +- test/parallel/test-path.js | 11 ++-- test/parallel/test-process-chdir.js | 7 ++- test/parallel/test-process-emitwarning.js | 2 +- test/parallel/test-process-setuid-setgid.js | 4 +- test/parallel/test-repl.js | 4 +- test/parallel/test-require-json.js | 6 +- .../test-stream-readable-invalid-chunk.js | 7 ++- test/parallel/test-string-decoder.js | 3 +- .../test-timers-throw-when-cb-not-function.js | 56 +++++++------------ test/parallel/test-tls-client-mindhsize.js | 7 ++- test/parallel/test-tls-env-bad-extra-ca.js | 5 +- test/parallel/test-tls-no-sslv23.js | 16 ++++-- test/parallel/test-tls-passphrase.js | 18 +++--- ...rver-failed-handshake-emits-clienterror.js | 6 +- ...tls-socket-failed-handshake-emits-error.js | 6 +- test/parallel/test-util-inspect.js | 3 +- test/parallel/test-util-internal.js | 35 ++++++------ test/parallel/test-util-log.js | 2 +- test/parallel/test-zlib-truncated.js | 6 +- test/pummel/test-net-pingpong.js | 2 +- test/sequential/test-module-loading.js | 8 ++- test/sequential/test-process-warnings.js | 8 ++- test/sequential/test-regress-GH-784.js | 18 +++--- 40 files changed, 195 insertions(+), 172 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index a4f61e9ccc4c88..455d50fe6c344a 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -196,8 +196,9 @@ if (exports.isWindows) { } const ifaces = os.networkInterfaces(); +const re = /lo/; exports.hasIPv6 = Object.keys(ifaces).some(function(name) { - return /lo/.test(name) && ifaces[name].some(function(info) { + return re.test(name) && ifaces[name].some(function(info) { return info.family === 'IPv6'; }); }); diff --git a/test/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js index 4c1bf6859428d5..ca2dd37e835ee5 100644 --- a/test/debugger/helper-debugger-repl.js +++ b/test/debugger/helper-debugger-repl.js @@ -30,12 +30,12 @@ function startDebugger(scriptToDebug) { child.stderr.pipe(process.stderr); child.on('line', function(line) { - line = line.replace(/^(debug> *)+/, ''); + line = line.replace(/^(?:debug> *)+/, ''); console.log(line); assert.ok(expected.length > 0, `Got unexpected line: ${line}`); const expectedLine = expected[0].lines.shift(); - assert.ok(line.match(expectedLine) !== null, `${line} != ${expectedLine}`); + assert.ok(expectedLine.test(line), `${line} != ${expectedLine}`); if (expected[0].lines.length === 0) { const callback = expected[0].callback; diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 58ec2bc731a596..b28d34b57e6edc 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -80,9 +80,11 @@ const testData = [ }, ]; +const spaces = /\s/g; + testData.forEach((item) => { // Normalize expected data by stripping whitespace - const expected = item.html.replace(/\s/g, ''); + const expected = item.html.replace(spaces, ''); const includeAnalytics = typeof item.analyticsId !== 'undefined'; fs.readFile(item.file, 'utf8', common.mustCall((err, input) => { @@ -101,7 +103,7 @@ testData.forEach((item) => { common.mustCall((err, output) => { assert.ifError(err); - const actual = output.replace(/\s/g, ''); + const actual = output.replace(spaces, ''); // Assert that the input stripped of all whitespace contains the // expected list assert.notStrictEqual(actual.indexOf(expected), -1); diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js index f4de8bbc28d2aa..59d6d4cf71d796 100644 --- a/test/inspector/test-inspector.js +++ b/test/inspector/test-inspector.js @@ -10,8 +10,8 @@ function checkListResponse(err, response) { assert.strictEqual(1, response.length); assert.ok(response[0]['devtoolsFrontendUrl']); assert.ok( - response[0]['webSocketDebuggerUrl'] - .match(/ws:\/\/127.0.0.1:\d+\/[0-9A-Fa-f]{8}-/)); + /ws:\/\/127.0.0.1:\d+\/[0-9A-Fa-f]{8}-/ + .test(response[0]['webSocketDebuggerUrl'])); } function checkVersion(err, response) { diff --git a/test/parallel/test-buffer-prototype-inspect.js b/test/parallel/test-buffer-prototype-inspect.js index 5f65a9bb288f16..9e6c66dc3da002 100644 --- a/test/parallel/test-buffer-prototype-inspect.js +++ b/test/parallel/test-buffer-prototype-inspect.js @@ -19,5 +19,5 @@ const util = require('util'); { const buf = Buffer.from('x'.repeat(51)); - assert.ok(/^$/.test(util.inspect(buf))); + assert.ok(/^$/.test(util.inspect(buf))); } diff --git a/test/parallel/test-cli-syntax.js b/test/parallel/test-cli-syntax.js index 1986c117ab6bf4..6426a5803c8724 100644 --- a/test/parallel/test-cli-syntax.js +++ b/test/parallel/test-cli-syntax.js @@ -13,6 +13,9 @@ const syntaxArgs = [ ['--check'] ]; +const syntaxErrorRE = /^SyntaxError: Unexpected identifier$/m; +const notFoundRE = /^Error: Cannot find module/m; + // test good syntax with and without shebang [ 'syntax/good_syntax.js', @@ -53,8 +56,7 @@ const syntaxArgs = [ assert.strictEqual(c.stdout, '', 'stdout produced'); // stderr should have a syntax error message - const match = c.stderr.match(/^SyntaxError: Unexpected identifier$/m); - assert(match, 'stderr incorrect'); + assert(syntaxErrorRE.test(c.stderr), 'stderr incorrect'); assert.strictEqual(c.status, 1, `code == ${c.status}`); }); @@ -76,8 +78,7 @@ const syntaxArgs = [ assert.strictEqual(c.stdout, '', 'stdout produced'); // stderr should have a module not found error message - const match = c.stderr.match(/^Error: Cannot find module/m); - assert(match, 'stderr incorrect'); + assert(notFoundRE.test(c.stderr), 'stderr incorrect'); assert.strictEqual(c.status, 1, `code == ${c.status}`); }); diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 5caaf121a5d0fc..b92d6d681d55c8 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -307,6 +307,13 @@ const TEST_CASES = [ tag: 'a44a8266ee1c8eb0c8b5d4cf5ae9f19a', tampered: false }, ]; +const errMessages = { + auth: / auth/, + state: / state/, + FIPS: /not supported in FIPS mode/, + length: /Invalid IV length/, +}; + const ciphers = crypto.getCiphers(); for (const i in TEST_CASES) { @@ -357,14 +364,14 @@ for (const i in TEST_CASES) { assert.strictEqual(msg, test.plain); } else { // assert that final throws if input data could not be verified! - assert.throws(function() { decrypt.final('ascii'); }, / auth/); + assert.throws(function() { decrypt.final('ascii'); }, errMessages.auth); } } if (test.password) { if (common.hasFipsCrypto) { assert.throws(() => { crypto.createCipher(test.algo, test.password); }, - /not supported in FIPS mode/); + errMessages.FIPS); } else { const encrypt = crypto.createCipher(test.algo, test.password); if (test.aad) @@ -383,7 +390,7 @@ for (const i in TEST_CASES) { if (test.password) { if (common.hasFipsCrypto) { assert.throws(() => { crypto.createDecipher(test.algo, test.password); }, - /not supported in FIPS mode/); + errMessages.FIPS); } else { const decrypt = crypto.createDecipher(test.algo, test.password); decrypt.setAuthTag(Buffer.from(test.tag, 'hex')); @@ -395,7 +402,7 @@ for (const i in TEST_CASES) { assert.strictEqual(msg, test.plain); } else { // assert that final throws if input data could not be verified! - assert.throws(function() { decrypt.final('ascii'); }, / auth/); + assert.throws(function() { decrypt.final('ascii'); }, errMessages.auth); } } } @@ -406,7 +413,7 @@ for (const i in TEST_CASES) { Buffer.from(test.key, 'hex'), Buffer.from(test.iv, 'hex')); encrypt.update('blah', 'ascii'); - assert.throws(function() { encrypt.getAuthTag(); }, / state/); + assert.throws(function() { encrypt.getAuthTag(); }, errMessages.state); } { @@ -415,7 +422,7 @@ for (const i in TEST_CASES) { Buffer.from(test.key, 'hex'), Buffer.from(test.iv, 'hex')); assert.throws(() => { encrypt.setAuthTag(Buffer.from(test.tag, 'hex')); }, - / state/); + errMessages.state); } { @@ -423,7 +430,7 @@ for (const i in TEST_CASES) { const decrypt = crypto.createDecipheriv(test.algo, Buffer.from(test.key, 'hex'), Buffer.from(test.iv, 'hex')); - assert.throws(function() { decrypt.getAuthTag(); }, / state/); + assert.throws(function() { decrypt.getAuthTag(); }, errMessages.state); } { @@ -434,7 +441,7 @@ for (const i in TEST_CASES) { Buffer.from(test.key, 'hex'), Buffer.alloc(0) ); - }, /Invalid IV length/); + }, errMessages.length); } } @@ -446,6 +453,7 @@ for (const i in TEST_CASES) { '6fKjEjR3Vl30EUYC'); encrypt.update('blah', 'ascii'); encrypt.final(); - assert.throws(() => encrypt.getAuthTag(), / state/); - assert.throws(() => encrypt.setAAD(Buffer.from('123', 'ascii')), / state/); + assert.throws(() => encrypt.getAuthTag(), errMessages.state); + assert.throws(() => encrypt.setAAD(Buffer.from('123', 'ascii')), + errMessages.state); } diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index 6f22dbe71affb1..7c1fad34bfe1c6 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -66,12 +66,14 @@ testCipher2(Buffer.from('0123456789abcd0123456789'), Buffer.from('12345678')); // Zero-sized IV should be accepted in ECB mode. crypto.createCipheriv('aes-128-ecb', Buffer.alloc(16), Buffer.alloc(0)); +const errMessage = /Invalid IV length/; + // But non-empty IVs should be rejected. for (let n = 1; n < 256; n += 1) { assert.throws( () => crypto.createCipheriv('aes-128-ecb', Buffer.alloc(16), Buffer.alloc(n)), - /Invalid IV length/); + errMessage); } // Correctly sized IV should be accepted in CBC mode. @@ -83,14 +85,14 @@ for (let n = 0; n < 256; n += 1) { assert.throws( () => crypto.createCipheriv('aes-128-cbc', Buffer.alloc(16), Buffer.alloc(n)), - /Invalid IV length/); + errMessage); } // Zero-sized IV should be rejected in GCM mode. assert.throws( () => crypto.createCipheriv('aes-128-gcm', Buffer.alloc(16), Buffer.alloc(0)), - /Invalid IV length/); + errMessage); // But all other IV lengths should be accepted. for (let n = 1; n < 256; n += 1) { diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 9e1226efaff014..ccc30353af6867 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -280,14 +280,15 @@ if (availableCurves.has('prime256v1') && availableCurves.has('secp256k1')) { // rejected. ecdh5.setPrivateKey(cafebabeKey, 'hex'); - [ // Some invalid private keys for the secp256k1 curve. - '0000000000000000000000000000000000000000000000000000000000000000', - 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', - 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', + // Some invalid private keys for the secp256k1 curve. + const errMessage = /^Error: Private key is not valid for specified curve.$/; + ['0000000000000000000000000000000000000000000000000000000000000000', + 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', + 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', ].forEach((element) => { assert.throws(() => { ecdh5.setPrivateKey(element, 'hex'); - }, /^Error: Private key is not valid for specified curve.$/); + }, errMessage); // Verify object state did not change. assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey); }); diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index 4a08463ca3b979..a923694f3d7b61 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -78,7 +78,8 @@ validateList(cryptoCiphers); const tlsCiphers = tls.getCiphers(); assert(tls.getCiphers().includes('aes256-sha')); // There should be no capital letters in any element. -assert(tlsCiphers.every((value) => /^[^A-Z]+$/.test(value))); +const noCapitals = /^[^A-Z]+$/; +assert(tlsCiphers.every((value) => noCapitals.test(value))); validateList(tlsCiphers); // Assert that we have sha and sha1 but not SHA and SHA1. diff --git a/test/parallel/test-error-reporting.js b/test/parallel/test-error-reporting.js index 965d7fbf77bc06..73799cda48365e 100644 --- a/test/parallel/test-error-reporting.js +++ b/test/parallel/test-error-reporting.js @@ -21,6 +21,8 @@ function errExec(script, callback) { }); } +const syntaxErrorMessage = /SyntaxError/; + // Simple throw error errExec('throws_error.js', common.mustCall(function(err, stdout, stderr) { @@ -30,30 +32,30 @@ errExec('throws_error.js', common.mustCall(function(err, stdout, stderr) { // Trying to JSON.parse(undefined) errExec('throws_error2.js', common.mustCall(function(err, stdout, stderr) { - assert.ok(/SyntaxError/.test(stderr)); + assert.ok(syntaxErrorMessage.test(stderr)); })); // Trying to JSON.parse(undefined) in nextTick errExec('throws_error3.js', common.mustCall(function(err, stdout, stderr) { - assert.ok(/SyntaxError/.test(stderr)); + assert.ok(syntaxErrorMessage.test(stderr)); })); // throw ILLEGAL error errExec('throws_error4.js', common.mustCall(function(err, stdout, stderr) { assert.ok(/\/\*\*/.test(stderr)); - assert.ok(/SyntaxError/.test(stderr)); + assert.ok(syntaxErrorMessage.test(stderr)); })); // Specific long exception line doesn't result in stack overflow errExec('throws_error5.js', common.mustCall(function(err, stdout, stderr) { - assert.ok(/SyntaxError/.test(stderr)); + assert.ok(syntaxErrorMessage.test(stderr)); })); // Long exception line with length > errorBuffer doesn't result in assertion errExec('throws_error6.js', common.mustCall(function(err, stdout, stderr) { - assert.ok(/SyntaxError/.test(stderr)); + assert.ok(syntaxErrorMessage.test(stderr)); })); // Object that throws in toString() doesn't print garbage diff --git a/test/parallel/test-event-emitter-max-listeners.js b/test/parallel/test-event-emitter-max-listeners.js index 0ace154aa00a5c..2946c48f8fb30e 100644 --- a/test/parallel/test-event-emitter-max-listeners.js +++ b/test/parallel/test-event-emitter-max-listeners.js @@ -9,16 +9,10 @@ e.on('maxListeners', common.mustCall(function() {})); // Should not corrupt the 'maxListeners' queue. e.setMaxListeners(42); -assert.throws(function() { - e.setMaxListeners(NaN); -}, /^TypeError: "n" argument must be a positive number$/); +const maxError = /^TypeError: "n" argument must be a positive number$/; -assert.throws(function() { - e.setMaxListeners(-1); -}, /^TypeError: "n" argument must be a positive number$/); - -assert.throws(function() { - e.setMaxListeners('and even this'); -}, /^TypeError: "n" argument must be a positive number$/); +assert.throws(function() { e.setMaxListeners(NaN); }, maxError); +assert.throws(function() { e.setMaxListeners(-1); }, maxError); +assert.throws(function() { e.setMaxListeners('and even this'); }, maxError); e.emit('maxListeners'); diff --git a/test/parallel/test-fs-null-bytes.js b/test/parallel/test-fs-null-bytes.js index 24d5514eecde75..aa9935df291e7a 100644 --- a/test/parallel/test-fs-null-bytes.js +++ b/test/parallel/test-fs-null-bytes.js @@ -7,7 +7,7 @@ function check(async, sync) { const expected = /Path must be a string without null bytes/; const argsSync = Array.prototype.slice.call(arguments, 2); const argsAsync = argsSync.concat((er) => { - assert(er && er.message.match(expected)); + assert(er && expected.test(er.message)); assert.strictEqual(er.code, 'ENOENT'); }); diff --git a/test/parallel/test-fs-read-stream-throw-type-error.js b/test/parallel/test-fs-read-stream-throw-type-error.js index 81f924d355b91c..0eb2de6aca2d4b 100644 --- a/test/parallel/test-fs-read-stream-throw-type-error.js +++ b/test/parallel/test-fs-read-stream-throw-type-error.js @@ -16,18 +16,19 @@ assert.doesNotThrow(function() { fs.createReadStream(example, {encoding: 'utf8'}); }); +const errMessage = /"options" argument must be a string or an object/; assert.throws(function() { fs.createReadStream(example, null); -}, /"options" argument must be a string or an object/); +}, errMessage); assert.throws(function() { fs.createReadStream(example, 123); -}, /"options" argument must be a string or an object/); +}, errMessage); assert.throws(function() { fs.createReadStream(example, 0); -}, /"options" argument must be a string or an object/); +}, errMessage); assert.throws(function() { fs.createReadStream(example, true); -}, /"options" argument must be a string or an object/); +}, errMessage); assert.throws(function() { fs.createReadStream(example, false); -}, /"options" argument must be a string or an object/); +}, errMessage); diff --git a/test/parallel/test-global-console-exists.js b/test/parallel/test-global-console-exists.js index d4a7c21222b807..fe77d42630c2c8 100644 --- a/test/parallel/test-global-console-exists.js +++ b/test/parallel/test-global-console-exists.js @@ -24,7 +24,7 @@ process.on('warning', (warning) => { process.stderr.write = (data) => { if (write_calls === 0) - assert.ok(data.match(leak_warning)); + assert.ok(leak_warning.test(data)); else common.fail('stderr.write should be called only once'); diff --git a/test/parallel/test-http-client-unescaped-path.js b/test/parallel/test-http-client-unescaped-path.js index eb04a42d37c5ac..ce4db0c7cdee8b 100644 --- a/test/parallel/test-http-client-unescaped-path.js +++ b/test/parallel/test-http-client-unescaped-path.js @@ -3,8 +3,8 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const errMessage = /contains unescaped characters/; for (let i = 0; i <= 32; i += 1) { const path = `bad${String.fromCharCode(i)}path`; - assert.throws(() => http.get({ path }, common.mustNotCall()), - /contains unescaped characters/); + assert.throws(() => http.get({ path }, common.mustNotCall()), errMessage); } diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index 90c2709ebdbc5c..1bf6194874b504 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -95,10 +95,10 @@ process.on('exit', function() { assert.strictEqual(4, requests_sent); const hello = new RegExp('/hello'); - assert.notStrictEqual(null, hello.exec(server_response)); + assert.ok(hello.test(server_response)); const quit = new RegExp('/quit'); - assert.notStrictEqual(null, quit.exec(server_response)); + assert.ok(quit.test(server_response)); assert.strictEqual(true, client_got_eof); }); diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 9541cdcbb8af56..46f36e36e7ec12 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -7,6 +7,9 @@ const path = require('path'); const f = __filename; const failures = []; +const slashRE = /\//g; +const backslashRE = /\\/g; + // path.basename tests assert.strictEqual(path.basename(f), 'test-path.js'); assert.strictEqual(path.basename(f, '.js'), 'test-path'); @@ -167,7 +170,7 @@ assert.strictEqual(path.win32.dirname('foo'), '.'); let input = test[0]; let os; if (extname === path.win32.extname) { - input = input.replace(/\//g, '\\'); + input = input.replace(slashRE, '\\'); os = 'win32'; } else { os = 'posix'; @@ -324,7 +327,7 @@ joinTests.forEach((test) => { let actualAlt; let os; if (join === path.win32.join) { - actualAlt = actual.replace(/\\/g, '/'); + actualAlt = actual.replace(backslashRE, '/'); os = 'win32'; } else { os = 'posix'; @@ -430,9 +433,9 @@ resolveTests.forEach((test) => { let actualAlt; const os = resolve === path.win32.resolve ? 'win32' : 'posix'; if (resolve === path.win32.resolve && !common.isWindows) - actualAlt = actual.replace(/\\/g, '/'); + actualAlt = actual.replace(backslashRE, '/'); else if (resolve !== path.win32.resolve && common.isWindows) - actualAlt = actual.replace(/\//g, '\\'); + actualAlt = actual.replace(slashRE, '\\'); const expected = test[1]; const message = diff --git a/test/parallel/test-process-chdir.js b/test/parallel/test-process-chdir.js index b137be4611c20d..61707706a322bc 100644 --- a/test/parallel/test-process-chdir.js +++ b/test/parallel/test-process-chdir.js @@ -31,9 +31,10 @@ process.chdir('..'); assert.strictEqual(process.cwd().normalize(), path.resolve(common.tmpDir).normalize()); +const errMessage = /^TypeError: Bad argument\.$/; assert.throws(function() { process.chdir({}); }, - /^TypeError: Bad argument\.$/, 'Bad argument.'); + errMessage, 'Bad argument.'); assert.throws(function() { process.chdir(); }, - /^TypeError: Bad argument\.$/, 'Bad argument.'); + errMessage, 'Bad argument.'); assert.throws(function() { process.chdir('x', 'y'); }, - /^TypeError: Bad argument\.$/, 'Bad argument.'); + errMessage, 'Bad argument.'); diff --git a/test/parallel/test-process-emitwarning.js b/test/parallel/test-process-emitwarning.js index 651bdbd1abc1ed..6d24865d3c2eac 100644 --- a/test/parallel/test-process-emitwarning.js +++ b/test/parallel/test-process-emitwarning.js @@ -8,7 +8,7 @@ const util = require('util'); process.on('warning', common.mustCall((warning) => { assert(warning); - assert(/^(Warning|CustomWarning)/.test(warning.name)); + assert(/^(?:Warning|CustomWarning)/.test(warning.name)); assert(warning.message, 'A Warning'); }, 7)); diff --git a/test/parallel/test-process-setuid-setgid.js b/test/parallel/test-process-setuid-setgid.js index b60eb913660503..33cb718eaedfb3 100644 --- a/test/parallel/test-process-setuid-setgid.js +++ b/test/parallel/test-process-setuid-setgid.js @@ -26,12 +26,12 @@ if (process.getuid() !== 0) { assert.throws( () => { process.setgid('nobody'); }, - /^Error: (EPERM, .+|setgid group id does not exist)$/ + /^Error: (?:EPERM, .+|setgid group id does not exist)$/ ); assert.throws( () => { process.setuid('nobody'); }, - /^Error: (EPERM, .+|setuid user id does not exist)$/ + /^Error: (?:EPERM, .+|setuid user id does not exist)$/ ); return; } diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 2b2cf1a19971da..2fc888de67b1f8 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -75,7 +75,7 @@ function error_test() { let expect = client_unix.expect; if (expect === prompt_multiline) expect = /[.]{3} /; - assert.ok(read_buffer.match(expect)); + assert.ok(RegExp(expect).test(read_buffer)); console.error('match'); } read_buffer = ''; @@ -358,7 +358,7 @@ function error_test() { expect: /^(?!repl)/ }, // Avoid emitting stack trace { client: client_unix, send: 'a = 3.5e', - expect: /^(?!\s+at\s)/gm }, + expect: /^(?!\s+at\s)/m }, // https://github.com/nodejs/node/issues/9850 { client: client_unix, send: 'function* foo() {}; foo().next();', diff --git a/test/parallel/test-require-json.js b/test/parallel/test-require-json.js index f2c74dc57d743d..1d0b10f84cbd45 100644 --- a/test/parallel/test-require-json.js +++ b/test/parallel/test-require-json.js @@ -6,7 +6,7 @@ const assert = require('assert'); try { require(path.join(common.fixturesDir, 'invalid.json')); } catch (err) { - const re = /test[/\\]fixtures[/\\]invalid.json: Unexpected string/; - const i = err.message.match(re); - assert.notStrictEqual(null, i, 'require() json error should include path'); + assert.ok( + /test[/\\]fixtures[/\\]invalid.json: Unexpected string/.test(err.message), + 'require() json error should include path'); } diff --git a/test/parallel/test-stream-readable-invalid-chunk.js b/test/parallel/test-stream-readable-invalid-chunk.js index d845b6114c5f94..62cd103b025528 100644 --- a/test/parallel/test-stream-readable-invalid-chunk.js +++ b/test/parallel/test-stream-readable-invalid-chunk.js @@ -7,6 +7,7 @@ const readable = new stream.Readable({ read: () => {} }); -assert.throws(() => readable.push([]), /Invalid non-string\/buffer chunk/); -assert.throws(() => readable.push({}), /Invalid non-string\/buffer chunk/); -assert.throws(() => readable.push(0), /Invalid non-string\/buffer chunk/); +const errMessage = /Invalid non-string\/buffer chunk/; +assert.throws(() => readable.push([]), errMessage); +assert.throws(() => readable.push({}), errMessage); +assert.throws(() => readable.push(0), errMessage); diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index 3879f2021b2841..b9fa47da52bc42 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -127,6 +127,7 @@ function test(encoding, input, expected, singleSequence) { } else { sequences = [singleSequence]; } + const hexNumberRE = /.{2}/g; sequences.forEach((sequence) => { const decoder = new StringDecoder(encoding); let output = ''; @@ -139,7 +140,7 @@ function test(encoding, input, expected, singleSequence) { const message = 'Expected "' + unicodeEscape(expected) + '", ' + 'but got "' + unicodeEscape(output) + '"\n' + - 'input: ' + input.toString('hex').match(/.{2}/g) + '\n' + + 'input: ' + input.toString('hex').match(hexNumberRE) + '\n' + 'Write sequence: ' + JSON.stringify(sequence) + '\n' + 'Full Decoder State: ' + inspect(decoder); assert.fail(output, expected, message); diff --git a/test/parallel/test-timers-throw-when-cb-not-function.js b/test/parallel/test-timers-throw-when-cb-not-function.js index 2aff904f06a500..4e866726c19c22 100644 --- a/test/parallel/test-timers-throw-when-cb-not-function.js +++ b/test/parallel/test-timers-throw-when-cb-not-function.js @@ -8,18 +8,14 @@ function doSetTimeout(callback, after) { }; } -assert.throws(doSetTimeout('foo'), - /"callback" argument must be a function/); -assert.throws(doSetTimeout({foo: 'bar'}), - /"callback" argument must be a function/); -assert.throws(doSetTimeout(), - /"callback" argument must be a function/); -assert.throws(doSetTimeout(undefined, 0), - /"callback" argument must be a function/); -assert.throws(doSetTimeout(null, 0), - /"callback" argument must be a function/); -assert.throws(doSetTimeout(false, 0), - /"callback" argument must be a function/); +const errMessage = /"callback" argument must be a function/; + +assert.throws(doSetTimeout('foo'), errMessage); +assert.throws(doSetTimeout({foo: 'bar'}), errMessage); +assert.throws(doSetTimeout(), errMessage); +assert.throws(doSetTimeout(undefined, 0), errMessage); +assert.throws(doSetTimeout(null, 0), errMessage); +assert.throws(doSetTimeout(false, 0), errMessage); function doSetInterval(callback, after) { @@ -28,18 +24,12 @@ function doSetInterval(callback, after) { }; } -assert.throws(doSetInterval('foo'), - /"callback" argument must be a function/); -assert.throws(doSetInterval({foo: 'bar'}), - /"callback" argument must be a function/); -assert.throws(doSetInterval(), - /"callback" argument must be a function/); -assert.throws(doSetInterval(undefined, 0), - /"callback" argument must be a function/); -assert.throws(doSetInterval(null, 0), - /"callback" argument must be a function/); -assert.throws(doSetInterval(false, 0), - /"callback" argument must be a function/); +assert.throws(doSetInterval('foo'), errMessage); +assert.throws(doSetInterval({foo: 'bar'}), errMessage); +assert.throws(doSetInterval(), errMessage); +assert.throws(doSetInterval(undefined, 0), errMessage); +assert.throws(doSetInterval(null, 0), errMessage); +assert.throws(doSetInterval(false, 0), errMessage); function doSetImmediate(callback, after) { @@ -48,15 +38,9 @@ function doSetImmediate(callback, after) { }; } -assert.throws(doSetImmediate('foo'), - /"callback" argument must be a function/); -assert.throws(doSetImmediate({foo: 'bar'}), - /"callback" argument must be a function/); -assert.throws(doSetImmediate(), - /"callback" argument must be a function/); -assert.throws(doSetImmediate(undefined, 0), - /"callback" argument must be a function/); -assert.throws(doSetImmediate(null, 0), - /"callback" argument must be a function/); -assert.throws(doSetImmediate(false, 0), - /"callback" argument must be a function/); +assert.throws(doSetImmediate('foo'), errMessage); +assert.throws(doSetImmediate({foo: 'bar'}), errMessage); +assert.throws(doSetImmediate(), errMessage); +assert.throws(doSetImmediate(undefined, 0), errMessage); +assert.throws(doSetImmediate(null, 0), errMessage); +assert.throws(doSetImmediate(false, 0), errMessage); diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js index f9bd0efea4234c..f68134d76025d2 100644 --- a/test/parallel/test-tls-client-mindhsize.js +++ b/test/parallel/test-tls-client-mindhsize.js @@ -78,13 +78,14 @@ testDHE1024(); assert.throws(() => test(512, true, common.mustNotCall()), /DH parameter is less than 1024 bits/); +let errMessage = /minDHSize is not a positive number/; [0, -1, -Infinity, NaN].forEach((minDHSize) => { - assert.throws(() => tls.connect({ minDHSize }), - /minDHSize is not a positive number/); + assert.throws(() => tls.connect({ minDHSize }), errMessage); }); +errMessage = /minDHSize is not a number/; [true, false, null, undefined, {}, [], '', '1'].forEach((minDHSize) => { - assert.throws(() => tls.connect({ minDHSize }), /minDHSize is not a number/); + assert.throws(() => tls.connect({ minDHSize }), errMessage); }); process.on('exit', function() { diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js index 12e4e3a4d9518b..57e4c1cfaf3af6 100644 --- a/test/parallel/test-tls-env-bad-extra-ca.js +++ b/test/parallel/test-tls-env-bad-extra-ca.js @@ -33,9 +33,8 @@ fork(__filename, opts) assert.strictEqual(status, 0, 'client did not succeed in connecting'); })) .on('close', common.mustCall(function() { - assert(stderr.match( - /Warning: Ignoring extra certs from.*no-such-file-exists.* load failed:.*No such file or directory/ - ), stderr); + const re = /Warning: Ignoring extra certs from.*no-such-file-exists.* load failed:.*No such file or directory/; + assert(re.test(stderr), stderr); })) .stderr.setEncoding('utf8').on('data', function(str) { stderr += str; diff --git a/test/parallel/test-tls-no-sslv23.js b/test/parallel/test-tls-no-sslv23.js index ff1214d167e6a0..564efab26da22c 100644 --- a/test/parallel/test-tls-no-sslv23.js +++ b/test/parallel/test-tls-no-sslv23.js @@ -12,29 +12,33 @@ assert.throws(function() { tls.createSecureContext({ secureProtocol: 'blargh' }); }, /Unknown method/); +const errMessageSSLv2 = /SSLv2 methods disabled/; + assert.throws(function() { tls.createSecureContext({ secureProtocol: 'SSLv2_method' }); -}, /SSLv2 methods disabled/); +}, errMessageSSLv2); assert.throws(function() { tls.createSecureContext({ secureProtocol: 'SSLv2_client_method' }); -}, /SSLv2 methods disabled/); +}, errMessageSSLv2); assert.throws(function() { tls.createSecureContext({ secureProtocol: 'SSLv2_server_method' }); -}, /SSLv2 methods disabled/); +}, errMessageSSLv2); + +const errMessageSSLv3 = /SSLv3 methods disabled/; assert.throws(function() { tls.createSecureContext({ secureProtocol: 'SSLv3_method' }); -}, /SSLv3 methods disabled/); +}, errMessageSSLv3); assert.throws(function() { tls.createSecureContext({ secureProtocol: 'SSLv3_client_method' }); -}, /SSLv3 methods disabled/); +}, errMessageSSLv3); assert.throws(function() { tls.createSecureContext({ secureProtocol: 'SSLv3_server_method' }); -}, /SSLv3 methods disabled/); +}, errMessageSSLv3); // Note that SSLv2 and SSLv3 are disallowed but SSLv2_method and friends are // still accepted. They are OpenSSL's way of saying that all known protocols diff --git a/test/parallel/test-tls-passphrase.js b/test/parallel/test-tls-passphrase.js index 4630fe236d16c7..f2f6f5ccdacda8 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -204,6 +204,8 @@ server.listen(0, common.mustCall(function() { }, common.mustCall(function() {})); })).unref(); +const errMessagePassword = /bad password read/; + // Missing passphrase assert.throws(function() { tls.connect({ @@ -212,7 +214,7 @@ assert.throws(function() { cert: cert, rejectUnauthorized: false }); -}, /bad password read/); +}, errMessagePassword); assert.throws(function() { tls.connect({ @@ -221,7 +223,7 @@ assert.throws(function() { cert: cert, rejectUnauthorized: false }); -}, /bad password read/); +}, errMessagePassword); assert.throws(function() { tls.connect({ @@ -230,7 +232,9 @@ assert.throws(function() { cert: cert, rejectUnauthorized: false }); -}, /bad password read/); +}, errMessagePassword); + +const errMessageDecrypt = /bad decrypt/; // Invalid passphrase assert.throws(function() { @@ -241,7 +245,7 @@ assert.throws(function() { cert: cert, rejectUnauthorized: false }); -}, /bad decrypt/); +}, errMessageDecrypt); assert.throws(function() { tls.connect({ @@ -251,7 +255,7 @@ assert.throws(function() { cert: cert, rejectUnauthorized: false }); -}, /bad decrypt/); +}, errMessageDecrypt); assert.throws(function() { tls.connect({ @@ -261,7 +265,7 @@ assert.throws(function() { cert: cert, rejectUnauthorized: false }); -}, /bad decrypt/); +}, errMessageDecrypt); assert.throws(function() { tls.connect({ @@ -271,4 +275,4 @@ assert.throws(function() { cert: cert, rejectUnauthorized: false }); -}, /bad decrypt/); +}, errMessageDecrypt); diff --git a/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js b/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js index 1ff7decf3cf9cc..0290bcc629a3e3 100644 --- a/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js +++ b/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js @@ -21,9 +21,9 @@ const server = tls.createServer({}) }).on('tlsClientError', common.mustCall(function(e) { assert.ok(e instanceof Error, 'Instance of Error should be passed to error handler'); - assert.ok(e.message.match( - /SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol/), - 'Expecting SSL unknown protocol'); + assert.ok( + /SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol/.test(e.message), + 'Expecting SSL unknown protocol'); server.close(); })); diff --git a/test/parallel/test-tls-socket-failed-handshake-emits-error.js b/test/parallel/test-tls-socket-failed-handshake-emits-error.js index ffeb42c8ebd8da..106a14a7df8ec6 100644 --- a/test/parallel/test-tls-socket-failed-handshake-emits-error.js +++ b/test/parallel/test-tls-socket-failed-handshake-emits-error.js @@ -21,9 +21,9 @@ const server = net.createServer(function(c) { s.on('error', common.mustCall(function(e) { assert.ok(e instanceof Error, 'Instance of Error should be passed to error handler'); - assert.ok(e.message.match( - /SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol/), - 'Expecting SSL unknown protocol'); + assert.ok( + /SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol/.test(e.message), + 'Expecting SSL unknown protocol'); })); s.on('close', function() { diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 177d46f5f652b4..e3a65c895ab6d1 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -746,9 +746,10 @@ assert.strictEqual(util.inspect(keys), 'SetIterator { 1, 3 }'); function checkAlignment(container) { const lines = util.inspect(container).split('\n'); + const numRE = /\d/; let pos; lines.forEach(function(line) { - const npos = line.search(/\d/); + const npos = line.search(numRE); if (npos !== -1) { if (pos !== undefined) assert.strictEqual(pos, npos, 'container items not aligned'); diff --git a/test/parallel/test-util-internal.js b/test/parallel/test-util-internal.js index 386e9a739c7912..49c74966a3539f 100644 --- a/test/parallel/test-util-internal.js +++ b/test/parallel/test-util-internal.js @@ -19,24 +19,27 @@ function setHiddenValue(obj, name, val) { }; } -assert.throws(getHiddenValue(), /obj must be an object/); -assert.throws(getHiddenValue(null, 'foo'), /obj must be an object/); -assert.throws(getHiddenValue(undefined, 'foo'), /obj must be an object/); -assert.throws(getHiddenValue('bar', 'foo'), /obj must be an object/); -assert.throws(getHiddenValue(85, 'foo'), /obj must be an object/); -assert.throws(getHiddenValue({}), /name must be a string/); -assert.throws(getHiddenValue({}, null), /name must be a string/); -assert.throws(getHiddenValue({}, []), /name must be a string/); +const errMessageObj = /obj must be an object/; +const errMessageStr = /name must be a string/; + +assert.throws(getHiddenValue(), errMessageObj); +assert.throws(getHiddenValue(null, 'foo'), errMessageObj); +assert.throws(getHiddenValue(undefined, 'foo'), errMessageObj); +assert.throws(getHiddenValue('bar', 'foo'), errMessageObj); +assert.throws(getHiddenValue(85, 'foo'), errMessageObj); +assert.throws(getHiddenValue({}), errMessageStr); +assert.throws(getHiddenValue({}, null), errMessageStr); +assert.throws(getHiddenValue({}, []), errMessageStr); assert.deepStrictEqual(internalUtil.getHiddenValue({}, 'foo'), undefined); -assert.throws(setHiddenValue(), /obj must be an object/); -assert.throws(setHiddenValue(null, 'foo'), /obj must be an object/); -assert.throws(setHiddenValue(undefined, 'foo'), /obj must be an object/); -assert.throws(setHiddenValue('bar', 'foo'), /obj must be an object/); -assert.throws(setHiddenValue(85, 'foo'), /obj must be an object/); -assert.throws(setHiddenValue({}), /name must be a string/); -assert.throws(setHiddenValue({}, null), /name must be a string/); -assert.throws(setHiddenValue({}, []), /name must be a string/); +assert.throws(setHiddenValue(), errMessageObj); +assert.throws(setHiddenValue(null, 'foo'), errMessageObj); +assert.throws(setHiddenValue(undefined, 'foo'), errMessageObj); +assert.throws(setHiddenValue('bar', 'foo'), errMessageObj); +assert.throws(setHiddenValue(85, 'foo'), errMessageObj); +assert.throws(setHiddenValue({}), errMessageStr); +assert.throws(setHiddenValue({}, null), errMessageStr); +assert.throws(setHiddenValue({}, []), errMessageStr); const obj = {}; assert.strictEqual(internalUtil.setHiddenValue(obj, 'foo', 'bar'), true); assert.strictEqual(internalUtil.getHiddenValue(obj, 'foo'), 'bar'); diff --git a/test/parallel/test-util-log.js b/test/parallel/test-util-log.js index 3604b42820063e..38ae710a273984 100644 --- a/test/parallel/test-util-log.js +++ b/test/parallel/test-util-log.js @@ -26,10 +26,10 @@ const tests = [ ]; // test util.log() +const re = /[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/; tests.forEach(function(test) { util.log(test.input); const result = strings.shift().trim(); - const re = (/[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/); const match = re.exec(result); assert.ok(match); assert.strictEqual(match[1], test.output); diff --git a/test/parallel/test-zlib-truncated.js b/test/parallel/test-zlib-truncated.js index 517b63886f8106..22171a8f9c57b2 100644 --- a/test/parallel/test-zlib-truncated.js +++ b/test/parallel/test-zlib-truncated.js @@ -15,6 +15,8 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli' 'm arcu mi, sodales non suscipit id, ultrices ut massa. S' + 'ed ac sem sit amet arcu malesuada fermentum. Nunc sed. '; +const errMessage = /unexpected end of file/; + [ { comp: 'gzip', decomp: 'gunzip', decompSync: 'gunzipSync' }, { comp: 'gzip', decomp: 'unzip', decompSync: 'unzipSync' }, @@ -41,11 +43,11 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli' // sync truncated input test assert.throws(function() { zlib[methods.decompSync](truncated); - }, /unexpected end of file/); + }, errMessage); // async truncated input test zlib[methods.decomp](truncated, function(err, result) { - assert(/unexpected end of file/.test(err.message)); + assert(errMessage.test(err.message)); }); const syncFlushOpt = { finishFlush: zlib.Z_SYNC_FLUSH }; diff --git a/test/pummel/test-net-pingpong.js b/test/pummel/test-net-pingpong.js index 1441c85ab6918c..35a836b4c8a9ca 100644 --- a/test/pummel/test-net-pingpong.js +++ b/test/pummel/test-net-pingpong.js @@ -31,7 +31,7 @@ function pingPongTest(port, host, on_complete) { console.log(`server got: ${JSON.stringify(data)}`); assert.strictEqual('open', socket.readyState); assert.strictEqual(true, count <= N); - if (/PING/.exec(data)) { + if (/PING/.test(data)) { socket.write('PONG'); } }); diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index f12b766c984829..8fd681cc651be8 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -4,6 +4,8 @@ const assert = require('assert'); const path = require('path'); const fs = require('fs'); +const backslash = /\\/g; + console.error('load test-module-loading.js'); // assert that this is the main module. @@ -158,7 +160,7 @@ try { require(`${loadOrder}file3`); } catch (e) { // Not a real .node module, but we know we require'd the right thing. - assert.ok(e.message.replace(/\\/g, '/').match(/file3\.node/)); + assert.ok(/file3\.node/.test(e.message.replace(backslash, '/'))); } assert.strictEqual(require(`${loadOrder}file4`).file4, 'file4.reg', msg); assert.strictEqual(require(`${loadOrder}file5`).file5, 'file5.reg2', msg); @@ -166,7 +168,7 @@ assert.strictEqual(require(`${loadOrder}file6`).file6, 'file6/index.js', msg); try { require(`${loadOrder}file7`); } catch (e) { - assert.ok(e.message.replace(/\\/g, '/').match(/file7\/index\.node/)); + assert.ok(/file7\/index\.node/.test(e.message.replace(backslash, '/'))); } assert.strictEqual(require(`${loadOrder}file8`).file8, 'file8/index.reg', msg); assert.strictEqual(require(`${loadOrder}file9`).file9, 'file9/index.reg2', msg); @@ -194,7 +196,7 @@ assert.deepStrictEqual(json, { const children = module.children.reduce(function red(set, child) { let id = path.relative(path.dirname(__dirname), child.id); - id = id.replace(/\\/g, '/'); + id = id.replace(backslash, '/'); set[id] = child.children.reduce(red, {}); return set; }, {}); diff --git a/test/sequential/test-process-warnings.js b/test/sequential/test-process-warnings.js index 9eaa45bd38c323..558601c539972b 100644 --- a/test/sequential/test-process-warnings.js +++ b/test/sequential/test-process-warnings.js @@ -10,24 +10,26 @@ const normal = [warnmod]; const noWarn = ['--no-warnings', warnmod]; const traceWarn = ['--trace-warnings', warnmod]; +const warningMessage = /^\(.+\)\sWarning: a bad practice warning/; + execFile(node, normal, function(er, stdout, stderr) { // Show Process Warnings assert.strictEqual(er, null); assert.strictEqual(stdout, ''); - assert(/^\(.+\)\sWarning: a bad practice warning/.test(stderr)); + assert(warningMessage.test(stderr)); }); execFile(node, noWarn, function(er, stdout, stderr) { // Hide Process Warnings assert.strictEqual(er, null); assert.strictEqual(stdout, ''); - assert(!/^\(.+\)\sWarning: a bad practice warning/.test(stderr)); + assert(!warningMessage.test(stderr)); }); execFile(node, traceWarn, function(er, stdout, stderr) { // Show Warning Trace assert.strictEqual(er, null); assert.strictEqual(stdout, ''); - assert(/^\(.+\)\sWarning: a bad practice warning/.test(stderr)); + assert(warningMessage.test(stderr)); assert(/at Object\.\s\(.+warnings.js:3:9\)/.test(stderr)); }); diff --git a/test/sequential/test-regress-GH-784.js b/test/sequential/test-regress-GH-784.js index 6278a7f44685bf..f567b9bc5272bf 100644 --- a/test/sequential/test-regress-GH-784.js +++ b/test/sequential/test-regress-GH-784.js @@ -49,28 +49,30 @@ const responses = []; function afterPing(result) { responses.push(result); console.error(`afterPing. responses.length = ${responses.length}`); + const ECONNREFUSED_RE = /ECONNREFUSED/; + const successRE = /success/; switch (responses.length) { case 2: - assert.ok(/ECONNREFUSED/.test(responses[0])); - assert.ok(/ECONNREFUSED/.test(responses[1])); + assert.ok(ECONNREFUSED_RE.test(responses[0])); + assert.ok(ECONNREFUSED_RE.test(responses[1])); serverOn(); break; case 4: - assert.ok(/success/.test(responses[2])); - assert.ok(/success/.test(responses[3])); + assert.ok(successRE.test(responses[2])); + assert.ok(successRE.test(responses[3])); serverOff(); break; case 6: - assert.ok(/ECONNREFUSED/.test(responses[4])); - assert.ok(/ECONNREFUSED/.test(responses[5])); + assert.ok(ECONNREFUSED_RE.test(responses[4])); + assert.ok(ECONNREFUSED_RE.test(responses[5])); serverOn(); break; case 8: - assert.ok(/success/.test(responses[6])); - assert.ok(/success/.test(responses[7])); + assert.ok(successRE.test(responses[6])); + assert.ok(successRE.test(responses[7])); server.close(); // we should go to process.on('exit') from here. break; From 565c5569f449bea34a5619205c7ec0236d0f9995 Mon Sep 17 00:00:00 2001 From: Marcel Laverdet Date: Thu, 18 May 2017 16:53:20 -0500 Subject: [PATCH 10/17] vm: fix displayErrors in runIn.. functions This option has been broken for almost a year when used with any of the vm.runIn.. family of functions, except for syntax errors. Backport-PR-URL: https://github.com/nodejs/node/pull/14373 PR-URL: https://github.com/nodejs/node/pull/13074 Reviewed-By: Anna Henningsen --- lib/repl.js | 2 +- src/node_contextify.cc | 18 +++++++----------- test/message/vm_display_runtime_error.js | 8 +++++++- test/message/vm_display_runtime_error.out | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 2dfcc2899344a6..9f544759a6581f 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -332,7 +332,7 @@ function REPLServer(prompt, try { try { const scriptOptions = { - displayErrors: true, + displayErrors: false, breakOnSigint: self.breakEvalOnSigint }; diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 1ec8774f240e17..e1f00ad07f64bc 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -684,8 +684,10 @@ class ContextifyScript : public BaseObject { return; } - Local decorated_stack = String::Concat(arrow.As(), - stack.As()); + Local decorated_stack = String::Concat( + String::Concat(arrow.As(), + FIXED_ONE_BYTE_STRING(env->isolate(), "\n")), + stack.As()); err_obj->Set(env->stack_string(), decorated_stack); err_obj->SetPrivate( env->context(), @@ -932,6 +934,9 @@ class ContextifyScript : public BaseObject { env->ThrowError("Script execution timed out."); } else if (received_signal) { env->ThrowError("Script execution interrupted."); + } else if (display_errors) { + // We should decorate non-termination exceptions + DecorateErrorStack(env, *try_catch); } // If there was an exception thrown during script execution, re-throw it. @@ -944,15 +949,6 @@ class ContextifyScript : public BaseObject { return false; } - if (result.IsEmpty()) { - // Error occurred during execution of the script. - if (display_errors) { - DecorateErrorStack(env, *try_catch); - } - try_catch->ReThrow(); - return false; - } - args.GetReturnValue().Set(result); return true; } diff --git a/test/message/vm_display_runtime_error.js b/test/message/vm_display_runtime_error.js index 861e87f2f2bb93..a16afaee3d559b 100644 --- a/test/message/vm_display_runtime_error.js +++ b/test/message/vm_display_runtime_error.js @@ -4,6 +4,12 @@ const vm = require('vm'); console.error('beginning'); -vm.runInThisContext('throw new Error("boo!")', { filename: 'test.vm' }); +try { + vm.runInThisContext('throw new Error("boo!")', { filename: 'test.vm'}); +} catch (err) { + console.error(err.stack); +} + +vm.runInThisContext('throw new Error("spooky!")', { filename: 'test.vm' }); console.error('end'); diff --git a/test/message/vm_display_runtime_error.out b/test/message/vm_display_runtime_error.out index d5cf1d3ee50dbb..789f12733c163f 100644 --- a/test/message/vm_display_runtime_error.out +++ b/test/message/vm_display_runtime_error.out @@ -14,3 +14,18 @@ Error: boo! at tryModuleLoad (module.js:*:*) at Function.Module._load (module.js:*) at Module.runMain (module.js:*) +test.vm:1 +throw new Error("spooky!") +^ + +Error: spooky! + at test.vm:1:7 + at ContextifyScript.Script.runInThisContext (vm.js:*) + at Object.runInThisContext (vm.js:*) + at Object. (*test*message*vm_display_runtime_error.js:*) + at Module._compile (module.js:*) + at Object.Module._extensions..js (module.js:*) + at Module.load (module.js:*) + at tryModuleLoad (module.js:*:*) + at Function.Module._load (module.js:*) + at Module.runMain (module.js:*) From 8188a523f3332bb2e695331907755a5e21131ab3 Mon Sep 17 00:00:00 2001 From: Marcel Laverdet Date: Thu, 18 May 2017 17:12:41 -0500 Subject: [PATCH 11/17] vm: fix race condition with timeout param This fixes a race condition in the watchdog timer used for vm timeouts. The condition would terminate the main stack's execution instead of the code running under the sandbox. Backport-PR-URL: https://github.com/nodejs/node/pull/14373 PR-URL: https://github.com/nodejs/node/pull/13074 Reviewed-By: Anna Henningsen --- src/node_contextify.cc | 24 ++++++++--------- src/node_watchdog.cc | 53 ++++++++----------------------------- src/node_watchdog.h | 26 ++++++------------ test/pummel/test-vm-race.js | 33 +++++++++++++++++++++++ 4 files changed, 63 insertions(+), 73 deletions(-) create mode 100644 test/pummel/test-vm-race.js diff --git a/src/node_contextify.cc b/src/node_contextify.cc index e1f00ad07f64bc..9d774d2c37aede 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -906,27 +906,20 @@ class ContextifyScript : public BaseObject { bool timed_out = false; bool received_signal = false; if (break_on_sigint && timeout != -1) { - Watchdog wd(env->isolate(), timeout); - SigintWatchdog swd(env->isolate()); + Watchdog wd(env->isolate(), timeout, &timed_out); + SigintWatchdog swd(env->isolate(), &received_signal); result = script->Run(); - timed_out = wd.HasTimedOut(); - received_signal = swd.HasReceivedSignal(); } else if (break_on_sigint) { - SigintWatchdog swd(env->isolate()); + SigintWatchdog swd(env->isolate(), &received_signal); result = script->Run(); - received_signal = swd.HasReceivedSignal(); } else if (timeout != -1) { - Watchdog wd(env->isolate(), timeout); + Watchdog wd(env->isolate(), timeout, &timed_out); result = script->Run(); - timed_out = wd.HasTimedOut(); } else { result = script->Run(); } - if (try_catch->HasCaught()) { - if (try_catch->HasTerminated()) - env->isolate()->CancelTerminateExecution(); - + if (timed_out || received_signal) { // It is possible that execution was terminated by another timeout in // which this timeout is nested, so check whether one of the watchdogs // from this invocation is responsible for termination. @@ -934,7 +927,12 @@ class ContextifyScript : public BaseObject { env->ThrowError("Script execution timed out."); } else if (received_signal) { env->ThrowError("Script execution interrupted."); - } else if (display_errors) { + } + env->isolate()->CancelTerminateExecution(); + } + + if (try_catch->HasCaught()) { + if (!timed_out && !received_signal && display_errors) { // We should decorate non-termination exceptions DecorateErrorStack(env, *try_catch); } diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index 5d95c4132f1b3f..049cd177ef0a0b 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -6,9 +6,9 @@ namespace node { -Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), - timed_out_(false), - destroyed_(false) { +Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms, bool* timed_out) + : isolate_(isolate), timed_out_(timed_out) { + int rc; loop_ = new uv_loop_t; CHECK(loop_); @@ -33,20 +33,6 @@ Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), Watchdog::~Watchdog() { - Destroy(); -} - - -void Watchdog::Dispose() { - Destroy(); -} - - -void Watchdog::Destroy() { - if (destroyed_) { - return; - } - uv_async_send(&async_); uv_thread_join(&thread_); @@ -59,8 +45,6 @@ void Watchdog::Destroy() { CHECK_EQ(0, rc); delete loop_; loop_ = nullptr; - - destroyed_ = true; } @@ -72,7 +56,7 @@ void Watchdog::Run(void* arg) { uv_run(wd->loop_, UV_RUN_DEFAULT); // Loop ref count reaches zero when both handles are closed. - // Close the timer handle on this side and let Destroy() close async_ + // Close the timer handle on this side and let ~Watchdog() close async_ uv_close(reinterpret_cast(&wd->timer_), nullptr); } @@ -85,24 +69,15 @@ void Watchdog::Async(uv_async_t* async) { void Watchdog::Timer(uv_timer_t* timer) { Watchdog* w = ContainerOf(&Watchdog::timer_, timer); - w->timed_out_ = true; - uv_stop(w->loop_); + *w->timed_out_ = true; w->isolate()->TerminateExecution(); + uv_stop(w->loop_); } -SigintWatchdog::~SigintWatchdog() { - Destroy(); -} - - -void SigintWatchdog::Dispose() { - Destroy(); -} - - -SigintWatchdog::SigintWatchdog(v8::Isolate* isolate) - : isolate_(isolate), received_signal_(false), destroyed_(false) { +SigintWatchdog::SigintWatchdog( + v8::Isolate* isolate, bool* received_signal) + : isolate_(isolate), received_signal_(received_signal) { // Register this watchdog with the global SIGINT/Ctrl+C listener. SigintWatchdogHelper::GetInstance()->Register(this); // Start the helper thread, if that has not already happened. @@ -110,20 +85,14 @@ SigintWatchdog::SigintWatchdog(v8::Isolate* isolate) } -void SigintWatchdog::Destroy() { - if (destroyed_) { - return; - } - - destroyed_ = true; - +SigintWatchdog::~SigintWatchdog() { SigintWatchdogHelper::GetInstance()->Unregister(this); SigintWatchdogHelper::GetInstance()->Stop(); } void SigintWatchdog::HandleSigint() { - received_signal_ = true; + *received_signal_ = true; isolate_->TerminateExecution(); } diff --git a/src/node_watchdog.h b/src/node_watchdog.h index 2d55d782d0af5d..ec6285af5d0349 100644 --- a/src/node_watchdog.h +++ b/src/node_watchdog.h @@ -16,16 +16,13 @@ namespace node { class Watchdog { public: - explicit Watchdog(v8::Isolate* isolate, uint64_t ms); + explicit Watchdog(v8::Isolate* isolate, + uint64_t ms, + bool* timed_out = nullptr); ~Watchdog(); - - void Dispose(); - v8::Isolate* isolate() { return isolate_; } - bool HasTimedOut() { return timed_out_; } - private: - void Destroy(); + private: static void Run(void* arg); static void Async(uv_async_t* async); static void Timer(uv_timer_t* timer); @@ -35,27 +32,20 @@ class Watchdog { uv_loop_t* loop_; uv_async_t async_; uv_timer_t timer_; - bool timed_out_; - bool destroyed_; + bool* timed_out_; }; class SigintWatchdog { public: - explicit SigintWatchdog(v8::Isolate* isolate); + explicit SigintWatchdog(v8::Isolate* isolate, + bool* received_signal = nullptr); ~SigintWatchdog(); - - void Dispose(); - v8::Isolate* isolate() { return isolate_; } - bool HasReceivedSignal() { return received_signal_; } void HandleSigint(); private: - void Destroy(); - v8::Isolate* isolate_; - bool received_signal_; - bool destroyed_; + bool* received_signal_; }; class SigintWatchdogHelper { diff --git a/test/pummel/test-vm-race.js b/test/pummel/test-vm-race.js new file mode 100644 index 00000000000000..7f9514b04e9e73 --- /dev/null +++ b/test/pummel/test-vm-race.js @@ -0,0 +1,33 @@ +'use strict'; +require('../common'); +const vm = require('vm'); + +// We're testing a race condition so we just have to spin this in a loop +// for a little while and see if it breaks. The condition being tested +// is an `isolate->TerminateExecution()` reaching the main JS stack from +// the timeout watchdog. +const sandbox = { timeout: 5 }; +const context = vm.createContext(sandbox); +const script = new vm.Script( + 'var d = Date.now() + timeout;while (d > Date.now());' +); +const immediate = setImmediate(function() { + throw new Error('Detected vm race condition!'); +}); + +// When this condition was first discovered this test would fail in 50ms +// or so. A better, but still incorrect implementation would fail after +// 100 seconds or so. If you're messing with vm timeouts you might +// consider increasing this timeout to hammer out races. +const giveUp = Date.now() + 5000; +do { + // The loop adjusts the timeout up or down trying to hit the race + try { + script.runInContext(context, { timeout: 5 }); + ++sandbox.timeout; + } catch (err) { + --sandbox.timeout; + } +} while (Date.now() < giveUp); + +clearImmediate(immediate); From 71e542c791c9bf1f0ef9f86f5790cb94147e5559 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 24 May 2017 13:17:34 -0700 Subject: [PATCH 12/17] http: describe parse err in debug output Backport-PR-URL: https://github.com/nodejs/node/pull/14416 PR-URL: https://github.com/nodejs/node/pull/13206 Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Brian White --- lib/_http_client.js | 2 +- lib/_http_server.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 9088239f52ea5a..22eadfb5584676 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -361,7 +361,7 @@ function socketOnData(d) { var ret = parser.execute(d); if (ret instanceof Error) { - debug('parse error'); + debug('parse error', ret); freeParser(parser, req, socket); socket.destroy(); req.emit('error', ret); diff --git a/lib/_http_server.js b/lib/_http_server.js index c9397a0bc2a4e7..63d3fb10cf870b 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -379,7 +379,7 @@ function connectionListener(socket) { function onParserExecuteCommon(ret, d) { if (ret instanceof Error) { - debug('parse error'); + debug('parse error', ret); socketOnError.call(socket, ret); } else if (parser.incoming && parser.incoming.upgrade) { // Upgrade or CONNECT From 65f8bfbfa46a2635b3f50092dd7529c98241f041 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 6 Jun 2017 15:06:45 -0400 Subject: [PATCH 13/17] https: support rejectUnauthorized for unix sockets This commit allows self signed certificates to work with unix sockets by forwarding the rejectUnauthorized option. Backport-PR-URL: https://github.com/nodejs/node/pull/14415 Fixes: https://github.com/nodejs/node/issues/13470 PR-URL: https://github.com/nodejs/node/pull/13505 Reviewed-By: Refael Ackermann Reviewed-By: Sam Roberts Reviewed-By: Luigi Pinca Reviewed-By: Daniel Bevenius --- lib/_http_client.js | 3 +- .../test-https-unix-socket-self-signed.js | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-https-unix-socket-self-signed.js diff --git a/lib/_http_client.js b/lib/_http_client.js index 22eadfb5584676..4d71ec594743f4 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -135,7 +135,8 @@ function ClientRequest(options, cb) { self.shouldKeepAlive = false; const optionsPath = { path: self.socketPath, - timeout: self.timeout + timeout: self.timeout, + rejectUnauthorized: !!options.rejectUnauthorized }; const newSocket = self.agent.createConnection(optionsPath, oncreate); if (newSocket && !called) { diff --git a/test/parallel/test-https-unix-socket-self-signed.js b/test/parallel/test-https-unix-socket-self-signed.js new file mode 100644 index 00000000000000..f503b84591cad7 --- /dev/null +++ b/test/parallel/test-https-unix-socket-self-signed.js @@ -0,0 +1,28 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) { + common.skip('missing crypto'); + return; +} + +common.refreshTmpDir(); + +const fs = require('fs'); +const https = require('https'); +const options = { + cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'), + key: fs.readFileSync(common.fixturesDir + '/test_key.pem') +}; + +const server = https.createServer(options, common.mustCall((req, res) => { + res.end('bye\n'); + server.close(); +})); + +server.listen(common.PIPE, common.mustCall(() => { + https.get({ + socketPath: common.PIPE, + rejectUnauthorized: false + }); +})); From 696f4391d1af124f1ecf50f8aa6c597ace8b11fb Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 2 May 2017 14:55:58 +0200 Subject: [PATCH 14/17] src: make root_cert_vector function scoped root_cert_vector currently has file scope and external linkage, but is only used in the NewRootCertsStore function. If this is not required to be externally linked perhaps it can be changed to be static and function scoped instead. PR-URL: https://github.com/nodejs/node/pull/12788 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Shigeki Ohtsu --- src/node_crypto.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index f654dcf60cb424..7eb18ad2020a32 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -127,7 +127,6 @@ const char* const root_certs[] = { std::string extra_root_certs_file; // NOLINT(runtime/string) X509_STORE* root_cert_store; -std::vector root_certs_vector; // Just to generate static methods template class SSLWrap; @@ -710,6 +709,7 @@ static int X509_up_ref(X509* cert) { static X509_STORE* NewRootCertStore() { + static std::vector root_certs_vector; if (root_certs_vector.empty()) { for (size_t i = 0; i < arraysize(root_certs); i++) { BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i])); From 7b8fcf834b495d8722869cc989431d0d8bd24039 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 24 May 2017 14:37:29 +0200 Subject: [PATCH 15/17] crypto: remove root_cert_store from node_crypto.h root_cert_store is defined as extern in node_crypto.h but only used in node_crypto.cc. It is then set using SSL_CTX_set_cert_store. The only usages of SSL_CTX_get_cert_store are in node_crypto.cc which would all be accessing the same X509_STORE through the root_cert_store pointer as far as I can tell. Am I missing something here? This commit suggests removing it from the header and making it static in node_crypto.cc. PR-URL: https://github.com/nodejs/node/pull/13194 Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson Reviewed-By: James M Snell Reviewed-By: Sam Roberts --- src/node_crypto.cc | 6 +++--- src/node_crypto.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 7eb18ad2020a32..aa2dafebc5cf81 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -120,13 +120,13 @@ static X509_NAME *cnnic_ev_name = static Mutex* mutexes; -const char* const root_certs[] = { +static const char* const root_certs[] = { #include "node_root_certs.h" // NOLINT(build/include_order) }; -std::string extra_root_certs_file; // NOLINT(runtime/string) +static std::string extra_root_certs_file; // NOLINT(runtime/string) -X509_STORE* root_cert_store; +static X509_STORE* root_cert_store; // Just to generate static methods template class SSLWrap; diff --git a/src/node_crypto.h b/src/node_crypto.h index 38f49ba5a05063..746c954b26fb43 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -63,8 +63,6 @@ enum CheckResult { extern int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx); -extern X509_STORE* root_cert_store; - extern void UseExtraCaCerts(const std::string& file); // Forward declaration From 39c381c582dbe23c10bd4d0ea9a1eabaf3969f53 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 5 Apr 2017 14:04:44 -0700 Subject: [PATCH 16/17] src: supply missing comments for CLI options A few of the CLI option values exposed as properties on the process object were missing a comment, fix this. PR-URL: https://github.com/nodejs/node/pull/12245 Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- src/node.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node.cc b/src/node.cc index 73ed460f361b44..180afa25f78f3e 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3317,6 +3317,7 @@ void SetupProcessObject(Environment* env, READONLY_PROPERTY(process, "_forceRepl", True(env->isolate())); } + // -r, --require if (preload_module_count) { CHECK(preload_modules); Local array = Array::New(env->isolate()); @@ -3339,10 +3340,12 @@ void SetupProcessObject(Environment* env, READONLY_PROPERTY(process, "noDeprecation", True(env->isolate())); } + // --no-warnings if (no_process_warnings) { READONLY_PROPERTY(process, "noProcessWarnings", True(env->isolate())); } + // --trace-warnings if (trace_warnings) { READONLY_PROPERTY(process, "traceProcessWarnings", True(env->isolate())); } From b39075b77b83e284835aee4210d1e82ae1dceee6 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 5 Apr 2017 14:06:52 -0700 Subject: [PATCH 17/17] src: use option parser for expose_internals bootstrap_node.js was directly parsing process.execArgv to see if internals should be exposed, even though the argv was already parsed by node. This is unusual and unnecessary, change it to set the option value from the parser onto the config binding. PR-URL: https://github.com/nodejs/node/pull/12245 Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- lib/internal/bootstrap_node.js | 6 ++---- src/node.cc | 8 +++++++- src/node_config.cc | 3 +++ src/node_internals.h | 6 ++++++ test/parallel/test-internal-modules-expose.js | 4 ++++ 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 55dd4057ac95ce..de215dc2dce62b 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -443,11 +443,9 @@ return NativeModule._source.hasOwnProperty(id); }; - const EXPOSE_INTERNALS = process.execArgv.some(function(arg) { - return arg.match(/^--expose[-_]internals$/); - }); + const config = process.binding('config'); - if (EXPOSE_INTERNALS) { + if (config.exposeInternals) { NativeModule.nonInternalExists = NativeModule.exists; NativeModule.isInternal = function(id) { diff --git a/src/node.cc b/src/node.cc index 180afa25f78f3e..dfe84c67c165f8 100644 --- a/src/node.cc +++ b/src/node.cc @@ -199,6 +199,12 @@ bool trace_warnings = false; // that is used by lib/module.js bool config_preserve_symlinks = false; +// Set in node.cc by ParseArgs when --expose-internals or --expose_internals is +// used. +// Used in node_config.cc to set a constant on process.binding('config') +// that is used by lib/internal/bootstrap_node.js +bool config_expose_internals = false; + // process-relative uptime base, initialized at start-up static double prog_start_time; static bool debugger_running; @@ -3896,7 +3902,7 @@ static void ParseArgs(int* argc, #endif } else if (strcmp(arg, "--expose-internals") == 0 || strcmp(arg, "--expose_internals") == 0) { - // consumed in js + config_expose_internals = true; } else if (strcmp(arg, "--") == 0) { index += 1; break; diff --git a/src/node_config.cc b/src/node_config.cc index 401345f6a608be..4408bc3cf33ffc 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -44,6 +44,9 @@ void InitConfig(Local target, if (config_preserve_symlinks) READONLY_BOOLEAN_PROPERTY("preserveSymlinks"); + + if (config_expose_internals) + READONLY_BOOLEAN_PROPERTY("exposeInternals"); } // InitConfig } // namespace node diff --git a/src/node_internals.h b/src/node_internals.h index cb71720e8205d9..e93244a94c6927 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -43,6 +43,12 @@ extern std::string openssl_config; // that is used by lib/module.js extern bool config_preserve_symlinks; +// Set in node.cc by ParseArgs when --expose-internals or --expose_internals is +// used. +// Used in node_config.cc to set a constant on process.binding('config') +// that is used by lib/internal/bootstrap_node.js +extern bool config_expose_internals; + // Forward declaration class Environment; diff --git a/test/parallel/test-internal-modules-expose.js b/test/parallel/test-internal-modules-expose.js index 02ddfd87c363fc..ab48e36881268c 100644 --- a/test/parallel/test-internal-modules-expose.js +++ b/test/parallel/test-internal-modules-expose.js @@ -3,5 +3,9 @@ require('../common'); const assert = require('assert'); +const config = process.binding('config'); + +console.log(config, process.argv); assert.strictEqual(typeof require('internal/freelist').FreeList, 'function'); +assert.strictEqual(config.exposeInternals, true);