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 9665a635910b44..0139d63a78a04f 100644
--- a/.eslintrc.yaml
+++ b/.eslintrc.yaml
@@ -1,5 +1,8 @@
root: true
+plugins:
+ - markdown
+
env:
node: true
es6: true
@@ -38,7 +41,7 @@ rules:
dot-location: [2, property]
no-fallthrough: 2
no-global-assign: 2
- no-multi-spaces: 2
+ no-multi-spaces: [2, {ignoreEOLComments: true}]
no-octal: 2
no-redeclare: 2
no-self-assign: 2
@@ -92,15 +95,26 @@ rules:
eol-last: 2
func-call-spacing: 2
func-name-matching: 2
- indent: [2, 2, {ArrayExpression: first,
- CallExpression: {arguments: first},
- MemberExpression: 1,
- ObjectExpression: first,
- SwitchCase: 1}]
+ func-style: [2, declaration, {allowArrowFunctions: true}]
+ # indent: [2, 2, {ArrayExpression: first,
+ # CallExpression: {arguments: first},
+ # FunctionDeclaration: {parameters: first},
+ # FunctionExpression: {parameters: first},
+ # MemberExpression: off,
+ # ObjectExpression: first,
+ # SwitchCase: 1}]
+ indent-legacy: [2, 2, {ArrayExpression: first,
+ CallExpression: {arguments: first},
+ MemberExpression: 1,
+ ObjectExpression: first,
+ SwitchCase: 1}]
key-spacing: [2, {mode: minimum}]
keyword-spacing: 2
linebreak-style: [2, unix]
- max-len: [2, {code: 80, ignoreUrls: true, tabWidth: 2}]
+ max-len: [2, {code: 80,
+ ignoreRegExpLiterals: true,
+ ignoreUrls: true,
+ tabWidth: 2}]
new-parens: 2
no-mixed-spaces-and-tabs: 2
no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}]
@@ -109,7 +123,13 @@ rules:
message: "setTimeout() must be invoked with at least two arguments."
}, {
selector: "CallExpression[callee.name='setInterval'][arguments.length<2]",
- message: "setInterval() must be invoked with at least 2 arguments"
+ message: "setInterval() must be invoked with at least 2 arguments."
+ }, {
+ selector: "ThrowStatement > CallExpression[callee.name=/Error$/]",
+ message: "Use new keyword when throwing an Error."
+ }, {
+ selector: "CallExpression[callee.object.name='assert'][callee.property.name='fail'][arguments.length=1]",
+ message: "assert.fail() message should be third argument"
}]
no-tabs: 2
no-trailing-spaces: 2
@@ -118,7 +138,11 @@ rules:
semi: 2
semi-spacing: 2
space-before-blocks: [2, always]
- space-before-function-paren: [2, never]
+ space-before-function-paren: [2, {
+ "anonymous": "never",
+ "named": "never",
+ "asyncArrow": "always"
+ }]
space-in-parens: [2, never]
space-infix-ops: 2
space-unary-ops: 2
@@ -140,10 +164,7 @@ rules:
# Custom rules in tools/eslint-rules
align-multiline-assignment: 2
- assert-fail-single-argument: 2
- assert-throws-arguments: [2, { requireTwo: false }]
- new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError]
- no-useless-regex-char-class-escape: [2, { override: ['[', ']'] }]
+ assert-throws-arguments: [2, { requireTwo: true }]
# Global scoped method and vars
globals:
diff --git a/.gitignore b/.gitignore
index f8f99f5f839389..b4ba0e2983f12c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ node_g
.benchmark_reports
icu_config.gypi
.eslintcache
+node_trace.*.log
/out
@@ -59,6 +60,8 @@ ipch/
*.VC.opendb
.vs/
.vscode/
+/deps/v8/src/debug/obj
+/*.exe
/config.mk
/config.gypi
diff --git a/BUILDING.md b/BUILDING.md
index d1962af1bdf70f..f000720c3f13ae 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -26,14 +26,17 @@ Support is divided into three tiers:
the broader community.
* **Tier 2**: Full test coverage but more limited maintenance,
often provided by the vendor of the platform.
-* **Experimental**: Known to compile but not necessarily reliably or with
- a full passing test suite. These are often working to be promoted to Tier
- 2 but are not quite ready. There is at least one individual actively
- providing maintenance and the team is striving to broaden quality and
- reliability of support.
+* **Experimental**: May not compile reliably or test suite may not pass.
+ These are often working to be promoted to Tier 2 but are not quite ready.
+ There is at least one individual actively providing maintenance and the team
+ is striving to broaden quality and reliability of support.
### Supported platforms
+The community does not build or test against end of life distributions (EoL).
+Thus we do not recommend that you use Node on end of life or unsupported platforms
+in production.
+
| System | Support type | Version | Architectures | Notes |
|--------------|--------------|----------------------------------|----------------------|------------------|
| GNU/Linux | Tier 1 | kernel >= 2.6.18, glibc >= 2.5 | x86, x64, arm, arm64 | |
@@ -63,8 +66,8 @@ Depending on host platform, the selection of toolchains may vary.
#### Unix
-* GCC 4.8 or newer
-* Clang 3.4 or newer
+* GCC 4.8.5 or newer
+* Clang 3.4.2 or newer
#### Windows
@@ -79,24 +82,23 @@ Depending on host platform, the selection of toolchains may vary.
Prerequisites:
* `gcc` and `g++` 4.8.5 or newer, or
-* `clang` and `clang++` 3.4 or newer
+* `clang` and `clang++` 3.4.2 or newer
* Python 2.6 or 2.7
* GNU Make 3.81 or newer
-On macOS, you will also need:
-* [Xcode](https://developer.apple.com/xcode/download/)
- - You also need to install the `Command Line Tools` via Xcode. You can find
- this under the menu `Xcode -> Preferences -> Downloads`
- - This step will install `gcc` and the related toolchain containing `make`
-
-* After building, you may want to setup [firewall rules](tools/macosx-firewall.sh)
+On macOS you will need to install the `Xcode Command Line Tools` by running
+`xcode-select --install`. Alternatively, if you already have the full Xcode
+installed, you can find them under the menu `Xcode -> Open Developer Tool ->
+More Developer Tools...`. This step will install `clang`, `clang++`, and
+`make`.
+* You may want to setup [firewall rules](tools/macosx-firewall.sh)
to avoid popups asking to accept incoming network connections when running tests:
```console
$ sudo ./tools/macosx-firewall.sh
```
Running this script will add rules for the executable `node` in the out
-directory and the symbolic `node` link in the projects root directory.
+directory and the symbolic `node` link in the project's root directory.
On FreeBSD and OpenBSD, you may also need:
* libexecinfo
@@ -121,17 +123,8 @@ and not a newer version.
To run the tests:
-```console
-$ make test
```
-
-To run the npm test suite:
-
-*note: to run the suite on node v4 or earlier you must first*
-*run `make install`*
-
-```console
-$ make test-npm
+$ make test
```
To build the documentation:
@@ -206,9 +199,9 @@ in the current continuous integration environment. The participation of people
dedicated and determined to improve Android building, testing, and support is
encouraged.
-Be sure you have downloaded and extracted [Android NDK]
-(https://developer.android.com/tools/sdk/ndk/index.html)
-before in a folder. Then run:
+Be sure you have downloaded and extracted
+[Android NDK](https://developer.android.com/tools/sdk/ndk/index.html) before in
+a folder. Then run:
```console
$ ./android-configure /path/to/your/android-ndk
@@ -350,6 +343,6 @@ and [user guide](https://openssl.org/docs/fips/UserGuide-2.0.pdf).
6. Get into Node.js checkout folder
7. `./configure --openssl-fips=/path/to/openssl-fips/installdir`
For example on ubuntu 12 the installation directory was
- /usr/local/ssl/fips-2.0
+ `/usr/local/ssl/fips-2.0`
8. Build Node.js with `make -j`
-9. Verify with `node -p "process.versions.openssl"` (`1.0.2a-fips`)
+9. Verify with `node -p "process.versions.openssl"` (for example `1.0.2a-fips`)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8f1fb735ed1ed7..f3ce011cbc7927 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,7 +26,8 @@ release.
-6.11.1
+6.11.2
+6.11.1
6.11.0
6.10.3
6.10.2
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md
index 95f625bbfa8e44..116624a79aefd0 100644
--- a/COLLABORATOR_GUIDE.md
+++ b/COLLABORATOR_GUIDE.md
@@ -4,6 +4,7 @@
* [Issues and Pull Requests](#issues-and-pull-requests)
* [Accepting Modifications](#accepting-modifications)
+ - [Useful CI Jobs](#useful-ci-jobs)
- [Internal vs. Public API](#internal-vs-public-api)
- [Breaking Changes](#breaking-changes)
- [Deprecations](#deprecations)
@@ -87,6 +88,31 @@ All pull requests that modify executable code should be subjected to
continuous integration tests on the
[project CI server](https://ci.nodejs.org/).
+#### Useful CI Jobs
+
+* [`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/)
+is the standard CI run we do to check Pull Requests. It triggers `node-test-commit`,
+which runs the `build-ci` and `test-ci` targets on all supported platforms.
+
+* [`node-test-linter`](https://ci.nodejs.org/job/node-test-linter/)
+only runs the linter targets, which is useful for changes that only affect comments
+or documentation.
+
+* [`citgm-smoker`](https://ci.nodejs.org/job/citgm-smoker/)
+uses [`CitGM`](https://github.com/nodejs/citgm) to allow you to run `npm install && npm test`
+on a large selection of common modules. This is useful to check whether a
+change will cause breakage in the ecosystem. To test Node.JS ABI changes
+you can run [`citgm-abi-smoker`](https://ci.nodejs.org/job/citgm-abi-smoker/).
+
+* [`node-stress-single-test`](https://ci.nodejs.org/job/node-stress-single-test/)
+is designed to allow one to run a group of tests over and over on a specific
+platform to confirm that the test is reliable.
+
+* [`node-test-commit-v8-linux`](https://ci.nodejs.org/job/node-test-commit-v8-linux/)
+is designed to allow validation of changes to the copy of V8 in the Node.js
+tree by running the standard V8 tests. It should be run whenever the
+level of V8 within Node.js is updated or new patches are floated on V8.
+
### Internal vs. Public API
Due to the nature of the JavaScript language, it can often be difficult to
@@ -230,6 +256,13 @@ not can often be based on many complex factors that are not easily codified. It
is also possible that the breaking commit can be labeled retroactively as a
semver-major change that will not be backported to Current or LTS branches.
+##### Reverting commits
+
+Commits are reverted with `git revert `, or `git revert ..` for
+multiple commits. Commit metadata and the reason for the revert should be
+appended. Commit message rules about line length and subsystem can be ignored.
+A Pull Request should be raised and approved like any other change.
+
### Deprecations
Deprecation refers to the identification of Public APIs that should no longer
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 120ef75e34c49b..c012c2258ca84c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -38,7 +38,7 @@ copy locally.
```text
$ git clone git@github.com:username/node.git
$ cd node
-$ git remote add upstream git://github.com/nodejs/node.git
+$ git remote add upstream https://github.com/nodejs/node.git
```
#### Which branch?
@@ -182,7 +182,14 @@ If you are updating tests and just want to run a single test to check it, you
can use this syntax to run it exactly as the test harness would:
```text
-$ python tools/test.py -v --mode=release parallel/test-stream2-transform
+$ python tools/test.py -J --mode=release parallel/test-stream2-transform
+```
+
+If you want to check the other options, please refer to the help by using
+the `--help` option
+
+```text
+$ python tools/test.py --help
```
You can run tests directly with node:
diff --git a/GOVERNANCE.md b/GOVERNANCE.md
index 417c16e04e7ae3..d7d60671ac1ad2 100644
--- a/GOVERNANCE.md
+++ b/GOVERNANCE.md
@@ -1,33 +1,17 @@
# Node.js Project Governance
-## Core Technical Committee
-
-The Node.js project is governed by a Core Technical Committee (CTC) which is
-responsible for high-level guidance of the project.
-
-The CTC has final authority over this project including:
-
-* Technical direction
-* Project governance and process (including this policy)
-* Contribution policy
-* GitHub repository hosting
-* Conduct guidelines
-* Maintaining the list of additional Collaborators
-
-For the current list of CTC members, see the project
-[README.md](./README.md#current-project-team-members).
+The Node.js project is governed by its Collaborators, including a Core Technical
+Committee (CTC) which is responsible for high-level guidance of the project.
## Collaborators
The [nodejs/node](https://github.com/nodejs/node) GitHub repository is
-maintained by the CTC and additional Collaborators who are added by the
-CTC on an ongoing basis.
+maintained by Collaborators who are added by the CTC on an ongoing basis.
Individuals identified by the CTC as making significant and valuable
-contributions are made Collaborators and given commit access to the project.
-
-_Note:_ If you make a significant contribution and are not considered
-for commit access, log an issue or contact a CTC member directly.
+contributions are made Collaborators and given commit access to the project. If
+you make a significant contribution and are not considered for commit access,
+log an issue or contact a CTC member directly.
Modifications of the contents of the nodejs/node repository are made on
a collaborative basis. Anybody with a GitHub account may propose a
@@ -45,18 +29,15 @@ be accepted unless:
the change. Previously-objecting Collaborators do not necessarily have to
sign-off on the change, but they should not be opposed to it.
* The change is escalated to the CTC and the CTC votes to approve the change.
- This should be used only after other options (especially discussion among
- the disagreeing Collaborators) have been exhausted.
+ This should only happen if disagreements between Collaborators cannot be
+ resolved through discussion.
Collaborators may opt to elevate significant or controversial modifications to
the CTC by assigning the `ctc-review` label to a pull request or issue. The
CTC should serve as the final arbiter where required.
-For the current list of Collaborators, see the project
-[README.md](./README.md#current-project-team-members).
-
-A guide for Collaborators is maintained in
-[COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md).
+* [Current list of Collaborators](./README.md#current-project-team-members)
+* [A guide for Collaborators](./COLLABORATOR_GUIDE.md)
### Collaborator Activities
@@ -68,9 +49,23 @@ Typical activities of a Collaborator include:
* participation in working groups
* merging pull requests
-While the above are typical things done by Collaborators, there are no required
-activities to retain Collaborator status. There is currently no process by which
-inactive Collaborators are removed from the project.
+The CTC periodically reviews the Collaborator list to identify inactive
+Collaborators. Past Collaborators are typically given _Emeritus_ status. Emeriti
+may request that the CTC restore them to active status.
+
+## Core Technical Committee
+
+The Core Technical Committee (CTC) has final authority over this project
+including:
+
+* Technical direction
+* Project governance and process (including this policy)
+* Contribution policy
+* GitHub repository hosting
+* Conduct guidelines
+* Maintaining the list of additional Collaborators
+
+* [Current list of CTC members](./README.md#current-project-team-members)
## CTC Membership
@@ -83,9 +78,10 @@ membership beyond these rules.
The CTC may add additional members to the CTC by a standard CTC motion.
-When a CTC member's participation in [CTC activities](#ctc-activities) has become
-minimal for a sustained period of time, the CTC will request that the member
-either indicate an intention to increase participation or voluntarily resign.
+When a CTC member's participation in [CTC activities](#ctc-activities) has
+become minimal for a sustained period of time, the CTC will request that the
+member either indicate an intention to increase participation or voluntarily
+resign.
CTC members may only be removed by voluntary resignation or through a standard
CTC motion.
diff --git a/Makefile b/Makefile
index 03377bffc58918..cfbd426033c7f2 100644
--- a/Makefile
+++ b/Makefile
@@ -122,7 +122,7 @@ test: all
$(MAKE) build-addons
$(MAKE) cctest
$(PYTHON) tools/test.py --mode=release -J \
- addons doctool inspector known_issues message pseudo-tty parallel sequential
+ doctool inspector known_issues message pseudo-tty parallel sequential addons
$(MAKE) lint
test-parallel: all
@@ -186,6 +186,14 @@ test/addons/.buildstamp: config.gypi \
# TODO(bnoordhuis) Force rebuild after gyp update.
build-addons: $(NODE_EXE) test/addons/.buildstamp
+clear-stalled:
+ # Clean up any leftover processes but don't error if found.
+ ps awwx | grep Release/node | grep -v grep | cat
+ @PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
+ if [ "$${PS_OUT}" ]; then \
+ echo $${PS_OUT} | xargs kill; \
+ fi
+
test-gc: all test/gc/node_modules/weak/build/Release/weakref.node
$(PYTHON) tools/test.py --mode=release gc
@@ -208,26 +216,28 @@ test-ci-native: | test/addons/.buildstamp
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES)
# This target should not use a native compiler at all
-test-ci-js:
+test-ci-js: | clear-stalled
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) $(CI_JS_SUITES)
- # Clean up any leftover processes
- PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
+ # Clean up any leftover processes, error if found.
+ ps awwx | grep Release/node | grep -v grep | cat
+ @PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
if [ "$${PS_OUT}" ]; then \
echo $${PS_OUT} | $(XARGS) kill; exit 1; \
fi
test-ci: LOGLEVEL := info
-test-ci: | build-addons
+test-ci: | clear-stalled build-addons
out/Release/cctest --gtest_output=tap:cctest.tap
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
- $(TEST_CI_ARGS) $(CI_NATIVE_SUITES) $(CI_JS_SUITES)
- # Clean up any leftover processes
- PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
+ $(TEST_CI_ARGS) $(CI_JS_SUITES) $(CI_NATIVE_SUITES)
+ # Clean up any leftover processes, error if found.
+ ps awwx | grep Release/node | grep -v grep | cat
+ @PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
if [ "$${PS_OUT}" ]; then \
- echo $${PS_OUT} | $(XARGS) kill; exit 1; \
+ echo $${PS_OUT} | xargs kill; exit 1; \
fi
test-release: test-build
@@ -286,13 +296,15 @@ test-timers-clean:
ifneq ("","$(wildcard deps/v8/tools/run-tests.py)")
-test-v8: v8 test-hash-seed
+test-v8: v8
# note: performs full test unless QUICKCHECK is specified
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) $(QUICKCHECK_ARG) \
--no-presubmit \
--shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \
$(TAP_V8)
+ @echo Testing hash seed
+ $(MAKE) test-hash-seed
test-v8-intl: v8
# note: performs full test unless QUICKCHECK is specified
@@ -512,7 +524,7 @@ endif
BINARYTAR=$(BINARYNAME).tar
# OSX doesn't have xz installed by default, http://macpkg.sourceforge.net/
XZ=$(shell which xz > /dev/null 2>&1; echo $$?)
-XZ_COMPRESSION ?= 9
+XZ_COMPRESSION ?= 9e
PKG=$(TARNAME).pkg
PACKAGEMAKER ?= /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
PKGDIR=out/dist-osx
@@ -568,9 +580,9 @@ pkg: $(PKG)
pkg-upload: pkg
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
- chmod 664 node-$(FULLVERSION).pkg
- scp -p node-$(FULLVERSION).pkg $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).pkg
- ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).pkg.done"
+ chmod 664 $(TARNAME).pkg
+ scp -p $(TARNAME).pkg $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).pkg
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).pkg.done"
$(TARBALL): release-only $(NODE_EXE) doc
git checkout-index -a -f --prefix=$(TARNAME)/
@@ -600,19 +612,19 @@ tar: $(TARBALL)
tar-upload: tar
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
- chmod 664 node-$(FULLVERSION).tar.gz
- scp -p node-$(FULLVERSION).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).tar.gz
- ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).tar.gz.done"
+ chmod 664 $(TARNAME).tar.gz
+ scp -p $(TARNAME).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.gz
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.gz.done"
ifeq ($(XZ), 0)
- chmod 664 node-$(FULLVERSION).tar.xz
- scp -p node-$(FULLVERSION).tar.xz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).tar.xz
- ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION).tar.xz.done"
+ chmod 664 $(TARNAME).tar.xz
+ scp -p $(TARNAME).tar.xz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.xz
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME).tar.xz.done"
endif
doc-upload: doc
- ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
+ ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/"
chmod -R ug=rw-x+X,o=r+X out/doc/
- scp -pr out/doc/ $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/
+ scp -pr out/doc/* $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs/
ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/docs.done"
$(TARBALL)-headers: release-only
@@ -670,13 +682,13 @@ binary: $(BINARYTAR)
binary-upload: binary
ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)"
- chmod 664 node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz
- scp -p node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz
- ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.gz.done"
+ chmod 664 $(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz
+ scp -p $(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.gz.done"
ifeq ($(XZ), 0)
- chmod 664 node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.xz
- scp -p node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.xz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.xz
- ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/node-$(FULLVERSION)-$(OSTYPE)-$(ARCH).tar.xz.done"
+ chmod 664 $(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz
+ scp -p $(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz $(STAGINGSERVER):nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz
+ ssh $(STAGINGSERVER) "touch nodejs/$(DISTTYPEDIR)/$(FULLVERSION)/$(TARNAME)-$(OSTYPE)-$(ARCH).tar.xz.done"
endif
haswrk=$(shell which wrk > /dev/null 2>&1; echo $$?)
@@ -739,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
@@ -770,7 +782,7 @@ cpplint:
@$(PYTHON) tools/cpplint.py $(CPPLINT_FILES)
@$(PYTHON) tools/check-imports.py
-ifneq ("","$(wildcard tools/eslint/lib/eslint.js)")
+ifneq ("","$(wildcard tools/eslint/bin/eslint.js)")
lint:
@EXIT_STATUS=0 ; \
$(MAKE) jslint || EXIT_STATUS=$$? ; \
@@ -791,6 +803,7 @@ lint:
@echo "Linting is not available through the source tarball."
@echo "Use the git repo instead:" \
"$ git clone https://github.com/nodejs/node.git"
+ exit 1
lint-ci: lint
endif
@@ -803,5 +816,5 @@ endif
bench-buffer bench-net bench-http bench-fs bench-tls cctest run-ci \
test-v8 test-v8-intl test-v8-benchmarks test-v8-all v8 lint-ci \
bench-ci jslint-ci doc-only $(TARBALL)-headers test-ci test-ci-native \
- test-ci-js build-ci test-hash-seed
+ test-ci-js build-ci test-hash-seed clear-stalled
diff --git a/README.md b/README.md
index 50833e7d08d1c9..25e54f17dc89b9 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,6 @@
-
@@ -193,12 +192,16 @@ more information about the governance of the Node.js project, see
**Evan Lucas** <evanlucas@me.com> (he/him)
* [fhinkel](https://github.com/fhinkel) -
**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com>
-* [fishrock123](https://github.com/fishrock123) -
+* [Fishrock123](https://github.com/Fishrock123) -
**Jeremiah Senkpiel** <fishrock123@rocketmail.com>
* [indutny](https://github.com/indutny) -
**Fedor Indutny** <fedor.indutny@gmail.com>
* [jasnell](https://github.com/jasnell) -
**James M Snell** <jasnell@gmail.com> (he/him)
+* [joyeecheung](https://github.com/joyeecheung) -
+**Joyee Cheung** <joyeec9h3@gmail.com> (she/her)
+* [mcollina](https://github.com/mcollina) -
+**Matteo Collina** <matteo.collina@gmail.com> (he/him)
* [mhdawson](https://github.com/mhdawson) -
**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him)
* [misterdjules](https://github.com/misterdjules) -
@@ -222,6 +225,17 @@ more information about the governance of the Node.js project, see
* [Trott](https://github.com/Trott) -
**Rich Trott** <rtrott@gmail.com> (he/him)
+### CTC Emeriti
+
+* [chrisdickinson](https://github.com/chrisdickinson) -
+**Chris Dickinson** <christopher.s.dickinson@gmail.com>
+* [isaacs](https://github.com/isaacs) -
+**Isaac Z. Schlueter** <i@izs.me>
+* [orangemocha](https://github.com/orangemocha) -
+**Alexis Campailla** <orangemocha@nodejs.org>
+* [piscisaureus](https://github.com/piscisaureus) -
+**Bert Belder** <bertbelder@gmail.com>
+
### Collaborators
* [abouthiroppy](https://github.com/abouthiroppy) -
@@ -248,8 +262,6 @@ more information about the governance of the Node.js project, see
**Bartosz Sosnowski** <bartosz@janeasystems.com>
* [calvinmetcalf](https://github.com/calvinmetcalf) -
**Calvin Metcalf** <calvin.metcalf@gmail.com>
-* [chrisdickinson](https://github.com/chrisdickinson) -
-**Chris Dickinson** <christopher.s.dickinson@gmail.com>
* [claudiorodriguez](https://github.com/claudiorodriguez) -
**Claudio Rodriguez** <cjrodr@yahoo.com>
* [danbev](https://github.com/danbev) -
@@ -272,16 +284,16 @@ more information about the governance of the Node.js project, see
**Gibson Fahnestock** <gibfahn@gmail.com> (he/him)
* [iarna](https://github.com/iarna) -
**Rebecca Turner** <me@re-becca.org>
+* [imran-iq](https://github.com/imran-iq) -
+**Imran Iqbal** <imran@imraniqbal.org>
* [imyller](https://github.com/imyller) -
**Ilkka Myller** <ilkka.myller@nodefield.com>
-* [isaacs](https://github.com/isaacs) -
-**Isaac Z. Schlueter** <i@izs.me>
* [italoacasas](https://github.com/italoacasas) -
**Italo A. Casas** <me@italoacasas.com> (he/him)
-* [iWuzHere](https://github.com/iWuzHere) -
-**Imran Iqbal** <imran@imraniqbal.org>
* [JacksonTian](https://github.com/JacksonTian) -
**Jackson Tian** <shyvo1987@gmail.com>
+* [jasongin](https://github.com/jasongin) -
+**Jason Ginchereau** <jasongin@microsoft.com>
* [jbergstroem](https://github.com/jbergstroem) -
**Johan Bergström** <bugs@bergstroem.nu>
* [jhamhader](https://github.com/jhamhader) -
@@ -292,12 +304,12 @@ more information about the governance of the Node.js project, see
**João Reis** <reis@janeasystems.com>
* [joshgav](https://github.com/joshgav) -
**Josh Gavant** <josh.gavant@outlook.com>
-* [joyeecheung](https://github.com/joyeecheung) -
-**Joyee Cheung** <joyeec9h3@gmail.com> (she/her)
* [julianduque](https://github.com/julianduque) -
**Julian Duque** <julianduquej@gmail.com> (he/him)
* [JungMinu](https://github.com/JungMinu) -
**Minwoo Jung** <minwoo@nodesource.com> (he/him)
+* [kunalspathak](https://github.com/kunalspathak) -
+**Kunal Pathak** <kunal.pathak@microsoft.com>
* [lance](https://github.com/lance) -
**Lance Ball** <lball@redhat.com>
* [lucamaraschi](https://github.com/lucamaraschi) -
@@ -310,8 +322,6 @@ more information about the governance of the Node.js project, see
**Aleksey Smolenchuk** <lxe@lxe.co>
* [matthewloring](https://github.com/matthewloring) -
**Matthew Loring** <mattloring@google.com>
-* [mcollina](https://github.com/mcollina) -
-**Matteo Collina** <matteo.collina@gmail.com> (he/him)
* [micnic](https://github.com/micnic) -
**Nicu Micleușanu** <micnic90@gmail.com> (he/him)
* [mikeal](https://github.com/mikeal) -
@@ -322,21 +332,17 @@ more information about the governance of the Node.js project, see
**Teddy Katz** <teddy.katz@gmail.com>
* [Olegas](https://github.com/Olegas) -
**Oleg Elifantiev** <oleg@elifantiev.ru>
-* [orangemocha](https://github.com/orangemocha) -
-**Alexis Campailla** <orangemocha@nodejs.org>
* [othiym23](https://github.com/othiym23) -
**Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him)
* [petkaantonov](https://github.com/petkaantonov) -
**Petka Antonov** <petka_antonov@hotmail.com>
* [phillipj](https://github.com/phillipj) -
**Phillip Johnsen** <johphi@gmail.com>
-* [piscisaureus](https://github.com/piscisaureus) -
-**Bert Belder** <bertbelder@gmail.com>
* [pmq20](https://github.com/pmq20) -
**Minqi Pan** <pmq2001@gmail.com>
* [princejwesley](https://github.com/princejwesley) -
**Prince John Wesley** <princejohnwesley@gmail.com>
-* [qard](https://github.com/qard) -
+* [Qard](https://github.com/Qard) -
**Stephen Belanger** <admin@stephenbelanger.com> (he/him)
* [refack](https://github.com/refack) -
**Refael Ackermann** <refack@gmail.com> (he/him)
@@ -376,6 +382,8 @@ more information about the governance of the Node.js project, see
**Thorsten Lorenz** <thlorenz@gmx.de>
* [TimothyGu](https://github.com/TimothyGu) -
**Timothy Gu** <timothygu99@gmail.com> (he/him)
+* [tniessen](https://github.com/tniessen) -
+**Tobias Nießen** <tniessen@tnie.de>
* [tunniclm](https://github.com/tunniclm) -
**Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com>
* [vkurchatkin](https://github.com/vkurchatkin) -
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/benchmark/child_process/child-process-params.js b/benchmark/child_process/child-process-params.js
new file mode 100644
index 00000000000000..644b2136a0f03f
--- /dev/null
+++ b/benchmark/child_process/child-process-params.js
@@ -0,0 +1,146 @@
+'use strict';
+
+const common = require('../common.js');
+const cp = require('child_process');
+
+const command = 'echo';
+const args = ['hello'];
+const options = {};
+const cb = () => {};
+
+const configs = {
+ n: [1e3],
+ methodName: [
+ 'exec', 'execSync',
+ 'execFile', 'execFileSync',
+ 'spawn', 'spawnSync',
+ ],
+ params: [1, 2, 3, 4],
+};
+
+const bench = common.createBenchmark(main, configs);
+
+function main(conf) {
+ const n = +conf.n;
+ const methodName = conf.methodName;
+ const params = +conf.params;
+
+ const method = cp[methodName];
+
+ switch (methodName) {
+ case 'exec':
+ switch (params) {
+ case 1:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command).kill();
+ bench.end(n);
+ break;
+ case 2:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, options).kill();
+ bench.end(n);
+ break;
+ case 3:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, options, cb).kill();
+ bench.end(n);
+ break;
+ }
+ break;
+ case 'execSync':
+ switch (params) {
+ case 1:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command);
+ bench.end(n);
+ break;
+ case 2:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, options);
+ bench.end(n);
+ break;
+ }
+ break;
+ case 'execFile':
+ switch (params) {
+ case 1:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command).kill();
+ bench.end(n);
+ break;
+ case 2:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args).kill();
+ bench.end(n);
+ break;
+ case 3:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args, options).kill();
+ bench.end(n);
+ break;
+ case 4:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args, options, cb).kill();
+ bench.end(n);
+ break;
+ }
+ break;
+ case 'execFileSync':
+ switch (params) {
+ case 1:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command);
+ bench.end(n);
+ break;
+ case 2:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args);
+ bench.end(n);
+ break;
+ case 3:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args, options);
+ bench.end(n);
+ break;
+ }
+ break;
+ case 'spawn':
+ switch (params) {
+ case 1:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command).kill();
+ bench.end(n);
+ break;
+ case 2:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args).kill();
+ bench.end(n);
+ break;
+ case 3:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args, options).kill();
+ bench.end(n);
+ break;
+ }
+ break;
+ case 'spawnSync':
+ switch (params) {
+ case 1:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command);
+ bench.end(n);
+ break;
+ case 2:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args);
+ bench.end(n);
+ break;
+ case 3:
+ bench.start();
+ for (let i = 0; i < n; i++) method(command, args, options);
+ bench.end(n);
+ break;
+ }
+ break;
+ }
+}
diff --git a/benchmark/child_process/child-process-read.js b/benchmark/child_process/child-process-read.js
index b0128eb7969056..0d250532efc590 100644
--- a/benchmark/child_process/child-process-read.js
+++ b/benchmark/child_process/child-process-read.js
@@ -1,6 +1,11 @@
'use strict';
const common = require('../common.js');
+
+// This benchmark uses `yes` to a create noisy child_processes with varying
+// output message lengths, and tries to read 8GB of output
+
const os = require('os');
+const child_process = require('child_process');
var messagesLength = [64, 256, 1024, 4096];
// Windows does not support that long arguments
@@ -12,7 +17,6 @@ const bench = common.createBenchmark(main, {
dur: [5]
});
-const spawn = require('child_process').spawn;
function main(conf) {
bench.start();
@@ -21,7 +25,7 @@ function main(conf) {
const msg = '"' + Array(len).join('.') + '"';
const options = { 'stdio': ['ignore', 'pipe', 'ignore'] };
- const child = spawn('yes', [msg], options);
+ const child = child_process.spawn('yes', [msg], options);
var bytes = 0;
child.stdout.on('data', function(msg) {
@@ -29,7 +33,12 @@ function main(conf) {
});
setTimeout(function() {
- child.kill();
+ if (process.platform === 'win32') {
+ // Sometimes there's a yes.exe process left hanging around on Windows...
+ child_process.execSync(`taskkill /f /t /pid ${child.pid}`);
+ } else {
+ child.kill();
+ }
const gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
}, dur * 1000);
diff --git a/benchmark/http/_chunky_http_client.js b/benchmark/http/_chunky_http_client.js
index bde4eed7444e6f..f29f3ed05d8116 100644
--- a/benchmark/http/_chunky_http_client.js
+++ b/benchmark/http/_chunky_http_client.js
@@ -3,7 +3,7 @@
// test HTTP throughput in fragmented header case
var common = require('../common.js');
var net = require('net');
-var test = require('../../test/common.js');
+var test = require('../../test/common');
var bench = common.createBenchmark(main, {
len: [1, 4, 8, 16, 32, 64, 128],
diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js
index 10a5b014f4211f..99b5a54cdfcbd7 100644
--- a/benchmark/http/http_server_for_chunky_client.js
+++ b/benchmark/http/http_server_for_chunky_client.js
@@ -5,8 +5,8 @@ var http = require('http');
var fs = require('fs');
var spawn = require('child_process').spawn;
require('../common.js');
-var test = require('../../test/common.js');
-var pep = path.dirname(process.argv[1]) + '/_chunky_http_client.js';
+var test = require('../../test/common');
+var pep = `${path.dirname(process.argv[1])}/_chunky_http_client.js`;
var PIPE = test.PIPE;
try {
diff --git a/benchmark/misc/function_call/binding.cc b/benchmark/misc/function_call/binding.cc
index c6718e8e33adcc..9008f6c437052a 100644
--- a/benchmark/misc/function_call/binding.cc
+++ b/benchmark/misc/function_call/binding.cc
@@ -14,4 +14,4 @@ extern "C" void init (Local target) {
NODE_SET_METHOD(target, "hello", Hello);
}
-NODE_MODULE(binding, init);
+NODE_MODULE(binding, init)
diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js
index a175533c7bbc6e..0a8e97aea8eadf 100644
--- a/benchmark/module/module-loader.js
+++ b/benchmark/module/module-loader.js
@@ -34,6 +34,8 @@ function main(conf) {
measureFull(n);
else
measureDir(n);
+
+ rmrf(tmpDirectory);
}
function measureFull(n) {
diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js
index fb8da5ea41faf3..b6a61e49dc9748 100644
--- a/benchmark/net/tcp-raw-pipe.js
+++ b/benchmark/net/tcp-raw-pipe.js
@@ -97,8 +97,6 @@ function client() {
if (err)
fail(err, 'connect');
- clientHandle.readStart();
-
clientHandle.onread = function(nread, buffer) {
if (nread < 0)
fail(nread, 'read');
@@ -112,6 +110,8 @@ function client() {
bench.start();
+ clientHandle.readStart();
+
setTimeout(function() {
// multiply by 2 since we're sending it first one way
// then then back again.
diff --git a/common.gypi b/common.gypi
index af9c6bafb0debe..de8cfc660d4229 100644
--- a/common.gypi
+++ b/common.gypi
@@ -35,16 +35,25 @@
['OS == "win"', {
'os_posix': 0,
'v8_postmortem_support%': 'false',
+ 'OBJ_DIR': '<(PRODUCT_DIR)/obj',
+ 'V8_BASE': '<(PRODUCT_DIR)/lib/v8_libbase.lib',
}, {
'os_posix': 1,
'v8_postmortem_support%': 'true',
}],
- ['GENERATOR == "ninja" or OS== "mac"', {
- 'OBJ_DIR': '<(PRODUCT_DIR)/obj',
+ ['OS== "mac"', {
+ 'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
}, {
- 'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
- 'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.a',
+ 'conditions': [
+ ['GENERATOR=="ninja"', {
+ 'OBJ_DIR': '<(PRODUCT_DIR)/obj',
+ 'V8_BASE': '<(PRODUCT_DIR)/obj/deps/v8/tools/gyp/libv8_base.a',
+ }, {
+ 'OBJ_DIR%': '<(PRODUCT_DIR)/obj.target',
+ 'V8_BASE%': '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.a',
+ }],
+ ],
}],
['openssl_fips != ""', {
'OPENSSL_PRODUCT': 'libcrypto.a',
diff --git a/configure b/configure
index 5232ccefdb1606..716964e6145d98 100755
--- a/configure
+++ b/configure
@@ -46,8 +46,8 @@ parser = optparse.OptionParser()
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
'android', 'aix')
-valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 'x32',
- 'x64', 'x86', 's390', 's390x')
+valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
+ 'ppc64', 'x32','x64', 'x86', 's390', 's390x')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon')
valid_mips_arch = ('loongson', 'r1', 'r2', 'r6', 'rx')
@@ -357,7 +357,7 @@ intl_optgroup.add_option('--without-intl',
action='store_const',
dest='with_intl',
const='none',
- help='Disable Intl, same as --with-intl=none')
+ help='Disable Intl, same as --with-intl=none (disables inspector)')
intl_optgroup.add_option('--with-icu-path',
action='store',
@@ -430,7 +430,7 @@ parser.add_option('--without-snapshot',
parser.add_option('--without-ssl',
action='store_true',
dest='without_ssl',
- help='build without SSL')
+ help='build without SSL (disables crypto, https, inspector, etc.)')
parser.add_option('--xcode',
action='store_true',
@@ -461,7 +461,7 @@ parser.add_option('--no-browser-globals',
parser.add_option('--without-inspector',
action='store_true',
dest='without_inspector',
- help='disable experimental V8 inspector support')
+ help='disable the V8 inspector protocol')
parser.add_option('--shared',
action='store_true',
@@ -617,8 +617,8 @@ def check_compiler(o):
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
if not ok:
warn('failed to autodetect C++ compiler version (CXX=%s)' % CXX)
- elif clang_version < '3.4.0' if is_clang else gcc_version < '4.8.0':
- warn('C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=%s)' % CXX)
+ elif clang_version < '3.4.2' if is_clang else gcc_version < '4.8.0':
+ warn('C++ compiler too old, need g++ 4.8 or clang++ 3.4.2 (CXX=%s)' % CXX)
ok, is_clang, clang_version, gcc_version = try_check_compiler(CC, 'c')
if not ok:
diff --git a/deps/openssl/asm/arm-void-gas/aes/bsaes-armv7.S b/deps/openssl/asm/arm-void-gas/aes/bsaes-armv7.S
index 449e7a442e87ce..b21ed7078b194a 100644
--- a/deps/openssl/asm/arm-void-gas/aes/bsaes-armv7.S
+++ b/deps/openssl/asm/arm-void-gas/aes/bsaes-armv7.S
@@ -1298,7 +1298,7 @@ bsaes_cbc_encrypt:
vmov q4,q15 @ just in case ensure that IV
vmov q5,q0 @ and input are preserved
bl AES_decrypt
- vld1.8 {q0}, [r9,:64] @ load result
+ vld1.8 {q0}, [r9] @ load result
veor q0, q0, q4 @ ^= IV
vmov q15, q5 @ q5 holds input
vst1.8 {q0}, [r10] @ write output
diff --git a/deps/openssl/asm/x64-elf-gas/aes/aesni-sha1-x86_64.s b/deps/openssl/asm/x64-elf-gas/aes/aesni-sha1-x86_64.s
index 88042248685372..c7c53e8771e132 100644
--- a/deps/openssl/asm/x64-elf-gas/aes/aesni-sha1-x86_64.s
+++ b/deps/openssl/asm/x64-elf-gas/aes/aesni-sha1-x86_64.s
@@ -2692,6 +2692,7 @@ aesni_cbc_sha1_enc_shaext:
movl 240(%rcx),%r11d
subq %rdi,%rsi
movups (%rcx),%xmm15
+ movups (%r8),%xmm2
movups 16(%rcx),%xmm0
leaq 112(%rcx),%rcx
diff --git a/deps/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s b/deps/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s
index 139ebe3615c46c..70eed05b00c136 100644
--- a/deps/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s
+++ b/deps/openssl/asm/x64-elf-gas/aes/aesni-sha256-x86_64.s
@@ -4012,6 +4012,7 @@ aesni_cbc_sha256_enc_shaext:
movl 240(%rcx),%r11d
subq %rdi,%rsi
movups (%rcx),%xmm15
+ movups (%r8),%xmm6
movups 16(%rcx),%xmm4
leaq 112(%rcx),%rcx
diff --git a/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s b/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s
index 0e81a290e3ec09..06d11dc9c8e95e 100644
--- a/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s
+++ b/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s
@@ -107,14 +107,6 @@ OPENSSL_ia32_cpuid:
shrl $14,%r10d
andl $0xfff,%r10d
- cmpl $7,%r11d
- jb .Lnocacheinfo
-
- movl $7,%eax
- xorl %ecx,%ecx
- cpuid
- movl %ebx,8(%rdi)
-
.Lnocacheinfo:
movl $1,%eax
cpuid
@@ -144,6 +136,15 @@ OPENSSL_ia32_cpuid:
orl %ecx,%r9d
movl %edx,%r10d
+
+ cmpl $7,%r11d
+ jb .Lno_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ cpuid
+ movl %ebx,8(%rdi)
+.Lno_extended_info:
+
btl $27,%r9d
jnc .Lclear_avx
xorl %ecx,%ecx
diff --git a/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha1-x86_64.s b/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha1-x86_64.s
index c7606aec49a95b..cdce52cd0a2358 100644
--- a/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha1-x86_64.s
+++ b/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha1-x86_64.s
@@ -2692,6 +2692,7 @@ aesni_cbc_sha1_enc_shaext:
movl 240(%rcx),%r11d
subq %rdi,%rsi
movups (%rcx),%xmm15
+ movups (%r8),%xmm2
movups 16(%rcx),%xmm0
leaq 112(%rcx),%rcx
diff --git a/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s b/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s
index 89faf46249a9b9..40e75bfedb6d3a 100644
--- a/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s
+++ b/deps/openssl/asm/x64-macosx-gas/aes/aesni-sha256-x86_64.s
@@ -4012,6 +4012,7 @@ aesni_cbc_sha256_enc_shaext:
movl 240(%rcx),%r11d
subq %rdi,%rsi
movups (%rcx),%xmm15
+ movups (%r8),%xmm6
movups 16(%rcx),%xmm4
leaq 112(%rcx),%rcx
diff --git a/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s b/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s
index ef623d5967716c..909270ecae312b 100644
--- a/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s
+++ b/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s
@@ -108,14 +108,6 @@ L$intel:
shrl $14,%r10d
andl $0xfff,%r10d
- cmpl $7,%r11d
- jb L$nocacheinfo
-
- movl $7,%eax
- xorl %ecx,%ecx
- cpuid
- movl %ebx,8(%rdi)
-
L$nocacheinfo:
movl $1,%eax
cpuid
@@ -145,6 +137,15 @@ L$generic:
orl %ecx,%r9d
movl %edx,%r10d
+
+ cmpl $7,%r11d
+ jb L$no_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ cpuid
+ movl %ebx,8(%rdi)
+L$no_extended_info:
+
btl $27,%r9d
jnc L$clear_avx
xorl %ecx,%ecx
diff --git a/deps/openssl/asm/x64-win32-masm/aes/aesni-sha1-x86_64.asm b/deps/openssl/asm/x64-win32-masm/aes/aesni-sha1-x86_64.asm
index 7403dc3ee6bac1..5a2c8e0eb52b0b 100644
--- a/deps/openssl/asm/x64-win32-masm/aes/aesni-sha1-x86_64.asm
+++ b/deps/openssl/asm/x64-win32-masm/aes/aesni-sha1-x86_64.asm
@@ -2793,6 +2793,7 @@ $L$prologue_shaext::
mov r11d,DWORD PTR[240+rcx]
sub rsi,rdi
movups xmm15,XMMWORD PTR[rcx]
+ movups xmm2,XMMWORD PTR[r8]
movups xmm0,XMMWORD PTR[16+rcx]
lea rcx,QWORD PTR[112+rcx]
diff --git a/deps/openssl/asm/x64-win32-masm/aes/aesni-sha256-x86_64.asm b/deps/openssl/asm/x64-win32-masm/aes/aesni-sha256-x86_64.asm
index 602ee5b2655442..d697869bb25b71 100644
--- a/deps/openssl/asm/x64-win32-masm/aes/aesni-sha256-x86_64.asm
+++ b/deps/openssl/asm/x64-win32-masm/aes/aesni-sha256-x86_64.asm
@@ -4146,11 +4146,12 @@ $L$prologue_shaext::
mov r11d,DWORD PTR[240+rcx]
sub rsi,rdi
movups xmm15,XMMWORD PTR[rcx]
+ movups xmm6,XMMWORD PTR[r8]
movups xmm4,XMMWORD PTR[16+rcx]
lea rcx,QWORD PTR[112+rcx]
pshufd xmm0,xmm1,01bh
- pshufd xmm1,xmm1,1h
+ pshufd xmm1,xmm1,0b1h
pshufd xmm2,xmm2,01bh
movdqa xmm7,xmm3
DB 102,15,58,15,202,8
@@ -4475,9 +4476,9 @@ $L$aesenclast4::
lea rdi,QWORD PTR[64+rdi]
jnz $L$oop_shaext
- pshufd xmm2,xmm2,1h
+ pshufd xmm2,xmm2,0b1h
pshufd xmm3,xmm1,01bh
- pshufd xmm1,xmm1,1h
+ pshufd xmm1,xmm1,0b1h
punpckhqdq xmm1,xmm2
DB 102,15,58,15,211,8
diff --git a/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm b/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
index 7cf9277bfb33d4..87338aa6f0edae 100644
--- a/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
+++ b/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
@@ -2051,7 +2051,7 @@ $L$SEH_begin_ecp_nistz256_point_add::
por xmm5,xmm4
movdqu xmm0,XMMWORD PTR[rsi]
- pshufd xmm3,xmm5,1h
+ pshufd xmm3,xmm5,0b1h
movdqu xmm1,XMMWORD PTR[16+rsi]
movdqu xmm2,XMMWORD PTR[32+rsi]
por xmm5,xmm3
@@ -2081,7 +2081,7 @@ DB 102,72,15,110,199
call __ecp_nistz256_sqr_montq
pcmpeqd xmm5,xmm4
- pshufd xmm4,xmm1,1h
+ pshufd xmm4,xmm1,0b1h
por xmm4,xmm1
pshufd xmm5,xmm5,0
pshufd xmm3,xmm4,01eh
@@ -2466,7 +2466,7 @@ $L$SEH_begin_ecp_nistz256_point_add_affine::
por xmm5,xmm4
movdqu xmm0,XMMWORD PTR[rbx]
- pshufd xmm3,xmm5,1h
+ pshufd xmm3,xmm5,0b1h
movdqu xmm1,XMMWORD PTR[16+rbx]
movdqu xmm2,XMMWORD PTR[32+rbx]
por xmm5,xmm3
@@ -2488,7 +2488,7 @@ DB 102,72,15,110,199
call __ecp_nistz256_sqr_montq
pcmpeqd xmm5,xmm4
- pshufd xmm4,xmm3,1h
+ pshufd xmm4,xmm3,0b1h
mov rax,QWORD PTR[rbx]
mov r9,r12
@@ -3117,7 +3117,7 @@ $L$point_addx::
por xmm5,xmm4
movdqu xmm0,XMMWORD PTR[rsi]
- pshufd xmm3,xmm5,1h
+ pshufd xmm3,xmm5,0b1h
movdqu xmm1,XMMWORD PTR[16+rsi]
movdqu xmm2,XMMWORD PTR[32+rsi]
por xmm5,xmm3
@@ -3147,7 +3147,7 @@ DB 102,72,15,110,199
call __ecp_nistz256_sqr_montx
pcmpeqd xmm5,xmm4
- pshufd xmm4,xmm1,1h
+ pshufd xmm4,xmm1,0b1h
por xmm4,xmm1
pshufd xmm5,xmm5,0
pshufd xmm3,xmm4,01eh
@@ -3528,7 +3528,7 @@ $L$point_add_affinex::
por xmm5,xmm4
movdqu xmm0,XMMWORD PTR[rbx]
- pshufd xmm3,xmm5,1h
+ pshufd xmm3,xmm5,0b1h
movdqu xmm1,XMMWORD PTR[16+rbx]
movdqu xmm2,XMMWORD PTR[32+rbx]
por xmm5,xmm3
@@ -3550,7 +3550,7 @@ DB 102,72,15,110,199
call __ecp_nistz256_sqr_montx
pcmpeqd xmm5,xmm4
- pshufd xmm4,xmm3,1h
+ pshufd xmm4,xmm3,0b1h
mov rdx,QWORD PTR[rbx]
mov r9,r12
diff --git a/deps/openssl/asm/x64-win32-masm/sha/sha256-x86_64.asm b/deps/openssl/asm/x64-win32-masm/sha/sha256-x86_64.asm
index ddcaa2c5ec5270..d0892736b713ca 100644
--- a/deps/openssl/asm/x64-win32-masm/sha/sha256-x86_64.asm
+++ b/deps/openssl/asm/x64-win32-masm/sha/sha256-x86_64.asm
@@ -1796,7 +1796,7 @@ $L$prologue_shaext::
movdqa xmm7,XMMWORD PTR[((512-128))+rcx]
pshufd xmm0,xmm1,01bh
- pshufd xmm1,xmm1,1h
+ pshufd xmm1,xmm1,0b1h
pshufd xmm2,xmm2,01bh
movdqa xmm8,xmm7
DB 102,15,58,15,202,8
@@ -1983,9 +1983,9 @@ DB 15,56,203,202
paddd xmm1,xmm9
jnz $L$oop_shaext
- pshufd xmm2,xmm2,1h
+ pshufd xmm2,xmm2,0b1h
pshufd xmm7,xmm1,01bh
- pshufd xmm1,xmm1,1h
+ pshufd xmm1,xmm1,0b1h
punpckhqdq xmm1,xmm2
DB 102,15,58,15,215,8
diff --git a/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm b/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm
index c767b91f9a7cd1..6cb8077b9da0a5 100644
--- a/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm
+++ b/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm
@@ -118,14 +118,6 @@ $L$intel::
shr r10d,14
and r10d,0fffh
- cmp r11d,7
- jb $L$nocacheinfo
-
- mov eax,7
- xor ecx,ecx
- cpuid
- mov DWORD PTR[8+rdi],ebx
-
$L$nocacheinfo::
mov eax,1
cpuid
@@ -155,6 +147,15 @@ $L$generic::
or r9d,ecx
mov r10d,edx
+
+ cmp r11d,7
+ jb $L$no_extended_info
+ mov eax,7
+ xor ecx,ecx
+ cpuid
+ mov DWORD PTR[8+rdi],ebx
+$L$no_extended_info::
+
bt r9d,27
jnc $L$clear_avx
xor ecx,ecx
diff --git a/deps/openssl/asm/x86-elf-gas/x86cpuid.s b/deps/openssl/asm/x86-elf-gas/x86cpuid.s
index 80a4d1a5183adf..08369b42391d75 100644
--- a/deps/openssl/asm/x86-elf-gas/x86cpuid.s
+++ b/deps/openssl/asm/x86-elf-gas/x86cpuid.s
@@ -20,10 +20,10 @@ OPENSSL_ia32_cpuid:
popl %eax
xorl %eax,%ecx
xorl %eax,%eax
- btl $21,%ecx
- jnc .L000nocpuid
movl 20(%esp),%esi
movl %eax,8(%esi)
+ btl $21,%ecx
+ jnc .L000nocpuid
.byte 0x0f,0xa2
movl %eax,%edi
xorl %eax,%eax
@@ -74,40 +74,32 @@ OPENSSL_ia32_cpuid:
andl $4026531839,%edx
jmp .L002generic
.L001intel:
- cmpl $7,%edi
- jb .L003cacheinfo
- movl 20(%esp),%esi
- movl $7,%eax
- xorl %ecx,%ecx
- .byte 0x0f,0xa2
- movl %ebx,8(%esi)
-.L003cacheinfo:
cmpl $4,%edi
- movl $-1,%edi
- jb .L004nocacheinfo
+ movl $-1,%esi
+ jb .L003nocacheinfo
movl $4,%eax
movl $0,%ecx
.byte 0x0f,0xa2
- movl %eax,%edi
- shrl $14,%edi
- andl $4095,%edi
-.L004nocacheinfo:
+ movl %eax,%esi
+ shrl $14,%esi
+ andl $4095,%esi
+.L003nocacheinfo:
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
andl $3220176895,%edx
cmpl $0,%ebp
- jne .L005notintel
+ jne .L004notintel
orl $1073741824,%edx
andb $15,%ah
cmpb $15,%ah
- jne .L005notintel
+ jne .L004notintel
orl $1048576,%edx
-.L005notintel:
+.L004notintel:
btl $28,%edx
jnc .L002generic
andl $4026531839,%edx
- cmpl $0,%edi
+ cmpl $0,%esi
je .L002generic
orl $268435456,%edx
shrl $16,%ebx
@@ -119,7 +111,15 @@ OPENSSL_ia32_cpuid:
andl $4294965247,%ecx
movl %edx,%esi
orl %ecx,%ebp
- btl $27,%ecx
+ cmpl $7,%edi
+ movl 20(%esp),%edi
+ jb .L005no_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ .byte 0x0f,0xa2
+ movl %ebx,8(%edi)
+.L005no_extended_info:
+ btl $27,%ebp
jnc .L006clear_avx
xorl %ecx,%ecx
.byte 15,1,208
@@ -133,7 +133,6 @@ OPENSSL_ia32_cpuid:
andl $4278190079,%esi
.L006clear_avx:
andl $4026525695,%ebp
- movl 20(%esp),%edi
andl $4294967263,8(%edi)
.L007done:
movl %esi,%eax
diff --git a/deps/openssl/asm/x86-macosx-gas/x86cpuid.s b/deps/openssl/asm/x86-macosx-gas/x86cpuid.s
index 3db70b61139e72..c3e9fd6dbaf05b 100644
--- a/deps/openssl/asm/x86-macosx-gas/x86cpuid.s
+++ b/deps/openssl/asm/x86-macosx-gas/x86cpuid.s
@@ -19,10 +19,10 @@ L_OPENSSL_ia32_cpuid_begin:
popl %eax
xorl %eax,%ecx
xorl %eax,%eax
- btl $21,%ecx
- jnc L000nocpuid
movl 20(%esp),%esi
movl %eax,8(%esi)
+ btl $21,%ecx
+ jnc L000nocpuid
.byte 0x0f,0xa2
movl %eax,%edi
xorl %eax,%eax
@@ -73,40 +73,32 @@ L_OPENSSL_ia32_cpuid_begin:
andl $4026531839,%edx
jmp L002generic
L001intel:
- cmpl $7,%edi
- jb L003cacheinfo
- movl 20(%esp),%esi
- movl $7,%eax
- xorl %ecx,%ecx
- .byte 0x0f,0xa2
- movl %ebx,8(%esi)
-L003cacheinfo:
cmpl $4,%edi
- movl $-1,%edi
- jb L004nocacheinfo
+ movl $-1,%esi
+ jb L003nocacheinfo
movl $4,%eax
movl $0,%ecx
.byte 0x0f,0xa2
- movl %eax,%edi
- shrl $14,%edi
- andl $4095,%edi
-L004nocacheinfo:
+ movl %eax,%esi
+ shrl $14,%esi
+ andl $4095,%esi
+L003nocacheinfo:
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
andl $3220176895,%edx
cmpl $0,%ebp
- jne L005notintel
+ jne L004notintel
orl $1073741824,%edx
andb $15,%ah
cmpb $15,%ah
- jne L005notintel
+ jne L004notintel
orl $1048576,%edx
-L005notintel:
+L004notintel:
btl $28,%edx
jnc L002generic
andl $4026531839,%edx
- cmpl $0,%edi
+ cmpl $0,%esi
je L002generic
orl $268435456,%edx
shrl $16,%ebx
@@ -118,7 +110,15 @@ L002generic:
andl $4294965247,%ecx
movl %edx,%esi
orl %ecx,%ebp
- btl $27,%ecx
+ cmpl $7,%edi
+ movl 20(%esp),%edi
+ jb L005no_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ .byte 0x0f,0xa2
+ movl %ebx,8(%edi)
+L005no_extended_info:
+ btl $27,%ebp
jnc L006clear_avx
xorl %ecx,%ecx
.byte 15,1,208
@@ -132,7 +132,6 @@ L008clear_xmm:
andl $4278190079,%esi
L006clear_avx:
andl $4026525695,%ebp
- movl 20(%esp),%edi
andl $4294967263,8(%edi)
L007done:
movl %esi,%eax
diff --git a/deps/openssl/asm/x86-win32-masm/x86cpuid.asm b/deps/openssl/asm/x86-win32-masm/x86cpuid.asm
index b4462fc2aa72bd..d53b6a44d895a3 100644
--- a/deps/openssl/asm/x86-win32-masm/x86cpuid.asm
+++ b/deps/openssl/asm/x86-win32-masm/x86cpuid.asm
@@ -35,10 +35,10 @@ $L_OPENSSL_ia32_cpuid_begin::
pop eax
xor ecx,eax
xor eax,eax
- bt ecx,21
- jnc $L000nocpuid
mov esi,DWORD PTR 20[esp]
mov DWORD PTR 8[esi],eax
+ bt ecx,21
+ jnc $L000nocpuid
cpuid
mov edi,eax
xor eax,eax
@@ -89,40 +89,32 @@ $L_OPENSSL_ia32_cpuid_begin::
and edx,4026531839
jmp $L002generic
$L001intel:
- cmp edi,7
- jb $L003cacheinfo
- mov esi,DWORD PTR 20[esp]
- mov eax,7
- xor ecx,ecx
- cpuid
- mov DWORD PTR 8[esi],ebx
-$L003cacheinfo:
cmp edi,4
- mov edi,-1
- jb $L004nocacheinfo
+ mov esi,-1
+ jb $L003nocacheinfo
mov eax,4
mov ecx,0
cpuid
- mov edi,eax
- shr edi,14
- and edi,4095
-$L004nocacheinfo:
+ mov esi,eax
+ shr esi,14
+ and esi,4095
+$L003nocacheinfo:
mov eax,1
xor ecx,ecx
cpuid
and edx,3220176895
cmp ebp,0
- jne $L005notintel
+ jne $L004notintel
or edx,1073741824
and ah,15
cmp ah,15
- jne $L005notintel
+ jne $L004notintel
or edx,1048576
-$L005notintel:
+$L004notintel:
bt edx,28
jnc $L002generic
and edx,4026531839
- cmp edi,0
+ cmp esi,0
je $L002generic
or edx,268435456
shr ebx,16
@@ -134,7 +126,15 @@ $L002generic:
and ecx,4294965247
mov esi,edx
or ebp,ecx
- bt ecx,27
+ cmp edi,7
+ mov edi,DWORD PTR 20[esp]
+ jb $L005no_extended_info
+ mov eax,7
+ xor ecx,ecx
+ cpuid
+ mov DWORD PTR 8[edi],ebx
+$L005no_extended_info:
+ bt ebp,27
jnc $L006clear_avx
xor ecx,ecx
DB 15,1,208
@@ -148,7 +148,6 @@ $L008clear_xmm:
and esi,4278190079
$L006clear_avx:
and ebp,4026525695
- mov edi,DWORD PTR 20[esp]
and DWORD PTR 8[edi],4294967263
$L007done:
mov eax,esi
diff --git a/deps/openssl/asm_obsolete/arm-void-gas/aes/bsaes-armv7.S b/deps/openssl/asm_obsolete/arm-void-gas/aes/bsaes-armv7.S
index 449e7a442e87ce..b21ed7078b194a 100644
--- a/deps/openssl/asm_obsolete/arm-void-gas/aes/bsaes-armv7.S
+++ b/deps/openssl/asm_obsolete/arm-void-gas/aes/bsaes-armv7.S
@@ -1298,7 +1298,7 @@ bsaes_cbc_encrypt:
vmov q4,q15 @ just in case ensure that IV
vmov q5,q0 @ and input are preserved
bl AES_decrypt
- vld1.8 {q0}, [r9,:64] @ load result
+ vld1.8 {q0}, [r9] @ load result
veor q0, q0, q4 @ ^= IV
vmov q15, q5 @ q5 holds input
vst1.8 {q0}, [r10] @ write output
diff --git a/deps/openssl/asm_obsolete/x64-elf-gas/aes/aesni-sha1-x86_64.s b/deps/openssl/asm_obsolete/x64-elf-gas/aes/aesni-sha1-x86_64.s
index d4ed2047c6db9c..84c5dced020b22 100644
--- a/deps/openssl/asm_obsolete/x64-elf-gas/aes/aesni-sha1-x86_64.s
+++ b/deps/openssl/asm_obsolete/x64-elf-gas/aes/aesni-sha1-x86_64.s
@@ -1389,6 +1389,7 @@ aesni_cbc_sha1_enc_shaext:
movl 240(%rcx),%r11d
subq %rdi,%rsi
movups (%rcx),%xmm15
+ movups (%r8),%xmm2
movups 16(%rcx),%xmm0
leaq 112(%rcx),%rcx
diff --git a/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s b/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s
index 0e81a290e3ec09..06d11dc9c8e95e 100644
--- a/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s
+++ b/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s
@@ -107,14 +107,6 @@ OPENSSL_ia32_cpuid:
shrl $14,%r10d
andl $0xfff,%r10d
- cmpl $7,%r11d
- jb .Lnocacheinfo
-
- movl $7,%eax
- xorl %ecx,%ecx
- cpuid
- movl %ebx,8(%rdi)
-
.Lnocacheinfo:
movl $1,%eax
cpuid
@@ -144,6 +136,15 @@ OPENSSL_ia32_cpuid:
orl %ecx,%r9d
movl %edx,%r10d
+
+ cmpl $7,%r11d
+ jb .Lno_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ cpuid
+ movl %ebx,8(%rdi)
+.Lno_extended_info:
+
btl $27,%r9d
jnc .Lclear_avx
xorl %ecx,%ecx
diff --git a/deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-sha1-x86_64.s b/deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-sha1-x86_64.s
index 015db5faa7facd..8cd95238b020d7 100644
--- a/deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-sha1-x86_64.s
+++ b/deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-sha1-x86_64.s
@@ -1389,6 +1389,7 @@ aesni_cbc_sha1_enc_shaext:
movl 240(%rcx),%r11d
subq %rdi,%rsi
movups (%rcx),%xmm15
+ movups (%r8),%xmm2
movups 16(%rcx),%xmm0
leaq 112(%rcx),%rcx
diff --git a/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s b/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s
index ef623d5967716c..909270ecae312b 100644
--- a/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s
+++ b/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s
@@ -108,14 +108,6 @@ L$intel:
shrl $14,%r10d
andl $0xfff,%r10d
- cmpl $7,%r11d
- jb L$nocacheinfo
-
- movl $7,%eax
- xorl %ecx,%ecx
- cpuid
- movl %ebx,8(%rdi)
-
L$nocacheinfo:
movl $1,%eax
cpuid
@@ -145,6 +137,15 @@ L$generic:
orl %ecx,%r9d
movl %edx,%r10d
+
+ cmpl $7,%r11d
+ jb L$no_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ cpuid
+ movl %ebx,8(%rdi)
+L$no_extended_info:
+
btl $27,%r9d
jnc L$clear_avx
xorl %ecx,%ecx
diff --git a/deps/openssl/asm_obsolete/x64-win32-masm/aes/aesni-sha1-x86_64.asm b/deps/openssl/asm_obsolete/x64-win32-masm/aes/aesni-sha1-x86_64.asm
index bfc5fa17b4aa70..dbad8c5e233db6 100644
--- a/deps/openssl/asm_obsolete/x64-win32-masm/aes/aesni-sha1-x86_64.asm
+++ b/deps/openssl/asm_obsolete/x64-win32-masm/aes/aesni-sha1-x86_64.asm
@@ -1454,6 +1454,7 @@ $L$prologue_shaext::
mov r11d,DWORD PTR[240+rcx]
sub rsi,rdi
movups xmm15,XMMWORD PTR[rcx]
+ movups xmm2,XMMWORD PTR[r8]
movups xmm0,XMMWORD PTR[16+rcx]
lea rcx,QWORD PTR[112+rcx]
diff --git a/deps/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm b/deps/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
index c985159a7b4012..4086b66e461889 100644
--- a/deps/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
+++ b/deps/openssl/asm_obsolete/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
@@ -1537,7 +1537,7 @@ $L$SEH_begin_ecp_nistz256_point_add::
por xmm5,xmm4
movdqu xmm0,XMMWORD PTR[rsi]
- pshufd xmm3,xmm5,1h
+ pshufd xmm3,xmm5,0b1h
movdqu xmm1,XMMWORD PTR[16+rsi]
movdqu xmm2,XMMWORD PTR[32+rsi]
por xmm5,xmm3
@@ -1567,7 +1567,7 @@ DB 102,72,15,110,199
call __ecp_nistz256_sqr_montq
pcmpeqd xmm5,xmm4
- pshufd xmm4,xmm1,1h
+ pshufd xmm4,xmm1,0b1h
por xmm4,xmm1
pshufd xmm5,xmm5,0
pshufd xmm3,xmm4,01eh
@@ -1948,7 +1948,7 @@ $L$SEH_begin_ecp_nistz256_point_add_affine::
por xmm5,xmm4
movdqu xmm0,XMMWORD PTR[rbx]
- pshufd xmm3,xmm5,1h
+ pshufd xmm3,xmm5,0b1h
movdqu xmm1,XMMWORD PTR[16+rbx]
movdqu xmm2,XMMWORD PTR[32+rbx]
por xmm5,xmm3
@@ -1970,7 +1970,7 @@ DB 102,72,15,110,199
call __ecp_nistz256_sqr_montq
pcmpeqd xmm5,xmm4
- pshufd xmm4,xmm3,1h
+ pshufd xmm4,xmm3,0b1h
mov rax,QWORD PTR[rbx]
mov r9,r12
diff --git a/deps/openssl/asm_obsolete/x64-win32-masm/sha/sha256-x86_64.asm b/deps/openssl/asm_obsolete/x64-win32-masm/sha/sha256-x86_64.asm
index 3b1559934f6c27..69a382b8924550 100644
--- a/deps/openssl/asm_obsolete/x64-win32-masm/sha/sha256-x86_64.asm
+++ b/deps/openssl/asm_obsolete/x64-win32-masm/sha/sha256-x86_64.asm
@@ -1788,7 +1788,7 @@ $L$prologue_shaext::
movdqa xmm7,XMMWORD PTR[((512-128))+rcx]
pshufd xmm0,xmm1,01bh
- pshufd xmm1,xmm1,1h
+ pshufd xmm1,xmm1,0b1h
pshufd xmm2,xmm2,01bh
movdqa xmm8,xmm7
DB 102,15,58,15,202,8
@@ -1975,9 +1975,9 @@ DB 15,56,203,202
paddd xmm1,xmm9
jnz $L$oop_shaext
- pshufd xmm2,xmm2,1h
+ pshufd xmm2,xmm2,0b1h
pshufd xmm7,xmm1,01bh
- pshufd xmm1,xmm1,1h
+ pshufd xmm1,xmm1,0b1h
punpckhqdq xmm1,xmm2
DB 102,15,58,15,215,8
diff --git a/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm b/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm
index c767b91f9a7cd1..6cb8077b9da0a5 100644
--- a/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm
+++ b/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm
@@ -118,14 +118,6 @@ $L$intel::
shr r10d,14
and r10d,0fffh
- cmp r11d,7
- jb $L$nocacheinfo
-
- mov eax,7
- xor ecx,ecx
- cpuid
- mov DWORD PTR[8+rdi],ebx
-
$L$nocacheinfo::
mov eax,1
cpuid
@@ -155,6 +147,15 @@ $L$generic::
or r9d,ecx
mov r10d,edx
+
+ cmp r11d,7
+ jb $L$no_extended_info
+ mov eax,7
+ xor ecx,ecx
+ cpuid
+ mov DWORD PTR[8+rdi],ebx
+$L$no_extended_info::
+
bt r9d,27
jnc $L$clear_avx
xor ecx,ecx
diff --git a/deps/openssl/asm_obsolete/x86-elf-gas/x86cpuid.s b/deps/openssl/asm_obsolete/x86-elf-gas/x86cpuid.s
index 80a4d1a5183adf..08369b42391d75 100644
--- a/deps/openssl/asm_obsolete/x86-elf-gas/x86cpuid.s
+++ b/deps/openssl/asm_obsolete/x86-elf-gas/x86cpuid.s
@@ -20,10 +20,10 @@ OPENSSL_ia32_cpuid:
popl %eax
xorl %eax,%ecx
xorl %eax,%eax
- btl $21,%ecx
- jnc .L000nocpuid
movl 20(%esp),%esi
movl %eax,8(%esi)
+ btl $21,%ecx
+ jnc .L000nocpuid
.byte 0x0f,0xa2
movl %eax,%edi
xorl %eax,%eax
@@ -74,40 +74,32 @@ OPENSSL_ia32_cpuid:
andl $4026531839,%edx
jmp .L002generic
.L001intel:
- cmpl $7,%edi
- jb .L003cacheinfo
- movl 20(%esp),%esi
- movl $7,%eax
- xorl %ecx,%ecx
- .byte 0x0f,0xa2
- movl %ebx,8(%esi)
-.L003cacheinfo:
cmpl $4,%edi
- movl $-1,%edi
- jb .L004nocacheinfo
+ movl $-1,%esi
+ jb .L003nocacheinfo
movl $4,%eax
movl $0,%ecx
.byte 0x0f,0xa2
- movl %eax,%edi
- shrl $14,%edi
- andl $4095,%edi
-.L004nocacheinfo:
+ movl %eax,%esi
+ shrl $14,%esi
+ andl $4095,%esi
+.L003nocacheinfo:
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
andl $3220176895,%edx
cmpl $0,%ebp
- jne .L005notintel
+ jne .L004notintel
orl $1073741824,%edx
andb $15,%ah
cmpb $15,%ah
- jne .L005notintel
+ jne .L004notintel
orl $1048576,%edx
-.L005notintel:
+.L004notintel:
btl $28,%edx
jnc .L002generic
andl $4026531839,%edx
- cmpl $0,%edi
+ cmpl $0,%esi
je .L002generic
orl $268435456,%edx
shrl $16,%ebx
@@ -119,7 +111,15 @@ OPENSSL_ia32_cpuid:
andl $4294965247,%ecx
movl %edx,%esi
orl %ecx,%ebp
- btl $27,%ecx
+ cmpl $7,%edi
+ movl 20(%esp),%edi
+ jb .L005no_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ .byte 0x0f,0xa2
+ movl %ebx,8(%edi)
+.L005no_extended_info:
+ btl $27,%ebp
jnc .L006clear_avx
xorl %ecx,%ecx
.byte 15,1,208
@@ -133,7 +133,6 @@ OPENSSL_ia32_cpuid:
andl $4278190079,%esi
.L006clear_avx:
andl $4026525695,%ebp
- movl 20(%esp),%edi
andl $4294967263,8(%edi)
.L007done:
movl %esi,%eax
diff --git a/deps/openssl/asm_obsolete/x86-macosx-gas/x86cpuid.s b/deps/openssl/asm_obsolete/x86-macosx-gas/x86cpuid.s
index 3db70b61139e72..c3e9fd6dbaf05b 100644
--- a/deps/openssl/asm_obsolete/x86-macosx-gas/x86cpuid.s
+++ b/deps/openssl/asm_obsolete/x86-macosx-gas/x86cpuid.s
@@ -19,10 +19,10 @@ L_OPENSSL_ia32_cpuid_begin:
popl %eax
xorl %eax,%ecx
xorl %eax,%eax
- btl $21,%ecx
- jnc L000nocpuid
movl 20(%esp),%esi
movl %eax,8(%esi)
+ btl $21,%ecx
+ jnc L000nocpuid
.byte 0x0f,0xa2
movl %eax,%edi
xorl %eax,%eax
@@ -73,40 +73,32 @@ L_OPENSSL_ia32_cpuid_begin:
andl $4026531839,%edx
jmp L002generic
L001intel:
- cmpl $7,%edi
- jb L003cacheinfo
- movl 20(%esp),%esi
- movl $7,%eax
- xorl %ecx,%ecx
- .byte 0x0f,0xa2
- movl %ebx,8(%esi)
-L003cacheinfo:
cmpl $4,%edi
- movl $-1,%edi
- jb L004nocacheinfo
+ movl $-1,%esi
+ jb L003nocacheinfo
movl $4,%eax
movl $0,%ecx
.byte 0x0f,0xa2
- movl %eax,%edi
- shrl $14,%edi
- andl $4095,%edi
-L004nocacheinfo:
+ movl %eax,%esi
+ shrl $14,%esi
+ andl $4095,%esi
+L003nocacheinfo:
movl $1,%eax
xorl %ecx,%ecx
.byte 0x0f,0xa2
andl $3220176895,%edx
cmpl $0,%ebp
- jne L005notintel
+ jne L004notintel
orl $1073741824,%edx
andb $15,%ah
cmpb $15,%ah
- jne L005notintel
+ jne L004notintel
orl $1048576,%edx
-L005notintel:
+L004notintel:
btl $28,%edx
jnc L002generic
andl $4026531839,%edx
- cmpl $0,%edi
+ cmpl $0,%esi
je L002generic
orl $268435456,%edx
shrl $16,%ebx
@@ -118,7 +110,15 @@ L002generic:
andl $4294965247,%ecx
movl %edx,%esi
orl %ecx,%ebp
- btl $27,%ecx
+ cmpl $7,%edi
+ movl 20(%esp),%edi
+ jb L005no_extended_info
+ movl $7,%eax
+ xorl %ecx,%ecx
+ .byte 0x0f,0xa2
+ movl %ebx,8(%edi)
+L005no_extended_info:
+ btl $27,%ebp
jnc L006clear_avx
xorl %ecx,%ecx
.byte 15,1,208
@@ -132,7 +132,6 @@ L008clear_xmm:
andl $4278190079,%esi
L006clear_avx:
andl $4026525695,%ebp
- movl 20(%esp),%edi
andl $4294967263,8(%edi)
L007done:
movl %esi,%eax
diff --git a/deps/openssl/asm_obsolete/x86-win32-masm/x86cpuid.asm b/deps/openssl/asm_obsolete/x86-win32-masm/x86cpuid.asm
index b4462fc2aa72bd..d53b6a44d895a3 100644
--- a/deps/openssl/asm_obsolete/x86-win32-masm/x86cpuid.asm
+++ b/deps/openssl/asm_obsolete/x86-win32-masm/x86cpuid.asm
@@ -35,10 +35,10 @@ $L_OPENSSL_ia32_cpuid_begin::
pop eax
xor ecx,eax
xor eax,eax
- bt ecx,21
- jnc $L000nocpuid
mov esi,DWORD PTR 20[esp]
mov DWORD PTR 8[esi],eax
+ bt ecx,21
+ jnc $L000nocpuid
cpuid
mov edi,eax
xor eax,eax
@@ -89,40 +89,32 @@ $L_OPENSSL_ia32_cpuid_begin::
and edx,4026531839
jmp $L002generic
$L001intel:
- cmp edi,7
- jb $L003cacheinfo
- mov esi,DWORD PTR 20[esp]
- mov eax,7
- xor ecx,ecx
- cpuid
- mov DWORD PTR 8[esi],ebx
-$L003cacheinfo:
cmp edi,4
- mov edi,-1
- jb $L004nocacheinfo
+ mov esi,-1
+ jb $L003nocacheinfo
mov eax,4
mov ecx,0
cpuid
- mov edi,eax
- shr edi,14
- and edi,4095
-$L004nocacheinfo:
+ mov esi,eax
+ shr esi,14
+ and esi,4095
+$L003nocacheinfo:
mov eax,1
xor ecx,ecx
cpuid
and edx,3220176895
cmp ebp,0
- jne $L005notintel
+ jne $L004notintel
or edx,1073741824
and ah,15
cmp ah,15
- jne $L005notintel
+ jne $L004notintel
or edx,1048576
-$L005notintel:
+$L004notintel:
bt edx,28
jnc $L002generic
and edx,4026531839
- cmp edi,0
+ cmp esi,0
je $L002generic
or edx,268435456
shr ebx,16
@@ -134,7 +126,15 @@ $L002generic:
and ecx,4294965247
mov esi,edx
or ebp,ecx
- bt ecx,27
+ cmp edi,7
+ mov edi,DWORD PTR 20[esp]
+ jb $L005no_extended_info
+ mov eax,7
+ xor ecx,ecx
+ cpuid
+ mov DWORD PTR 8[edi],ebx
+$L005no_extended_info:
+ bt ebp,27
jnc $L006clear_avx
xor ecx,ecx
DB 15,1,208
@@ -148,7 +148,6 @@ $L008clear_xmm:
and esi,4278190079
$L006clear_avx:
and ebp,4026525695
- mov edi,DWORD PTR 20[esp]
and DWORD PTR 8[edi],4294967263
$L007done:
mov eax,esi
diff --git a/deps/openssl/config/archs/aix-gcc/opensslconf.h b/deps/openssl/config/archs/aix-gcc/opensslconf.h
index 0b5a4da2199b20..c647b9485aa624 100644
--- a/deps/openssl/config/archs/aix-gcc/opensslconf.h
+++ b/deps/openssl/config/archs/aix-gcc/opensslconf.h
@@ -235,7 +235,7 @@ extern "C" {
even newer MIPS CPU's, but at the moment one size fits all for
optimization options. Older Sparc's work better with only UNROLL, but
there's no way to tell at compile time what it is you're running on */
-
+
#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */
# define DES_PTR
# define DES_RISC1
diff --git a/deps/openssl/config/archs/aix64-gcc/opensslconf.h b/deps/openssl/config/archs/aix64-gcc/opensslconf.h
index 0cca4cae21dd10..b7632639d750eb 100644
--- a/deps/openssl/config/archs/aix64-gcc/opensslconf.h
+++ b/deps/openssl/config/archs/aix64-gcc/opensslconf.h
@@ -235,7 +235,7 @@ extern "C" {
even newer MIPS CPU's, but at the moment one size fits all for
optimization options. Older Sparc's work better with only UNROLL, but
there's no way to tell at compile time what it is you're running on */
-
+
#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */
# define DES_PTR
# define DES_RISC1
diff --git a/deps/openssl/config/archs/linux-ppc/opensslconf.h b/deps/openssl/config/archs/linux-ppc/opensslconf.h
index e0d62da24e142e..8d7bda716a4b97 100644
--- a/deps/openssl/config/archs/linux-ppc/opensslconf.h
+++ b/deps/openssl/config/archs/linux-ppc/opensslconf.h
@@ -232,7 +232,7 @@ extern "C" {
even newer MIPS CPU's, but at the moment one size fits all for
optimization options. Older Sparc's work better with only UNROLL, but
there's no way to tell at compile time what it is you're running on */
-
+
#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */
# define DES_PTR
# define DES_RISC1
diff --git a/deps/openssl/config/archs/linux-ppc64/opensslconf.h b/deps/openssl/config/archs/linux-ppc64/opensslconf.h
index 3f7202d25427e3..bec911036c26ae 100644
--- a/deps/openssl/config/archs/linux-ppc64/opensslconf.h
+++ b/deps/openssl/config/archs/linux-ppc64/opensslconf.h
@@ -232,7 +232,7 @@ extern "C" {
even newer MIPS CPU's, but at the moment one size fits all for
optimization options. Older Sparc's work better with only UNROLL, but
there's no way to tell at compile time what it is you're running on */
-
+
#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */
# define DES_PTR
# define DES_RISC1
diff --git a/deps/openssl/config/archs/linux32-s390x/opensslconf.h b/deps/openssl/config/archs/linux32-s390x/opensslconf.h
index e0d0f8fa613456..32759db4742fa1 100644
--- a/deps/openssl/config/archs/linux32-s390x/opensslconf.h
+++ b/deps/openssl/config/archs/linux32-s390x/opensslconf.h
@@ -232,7 +232,7 @@ extern "C" {
even newer MIPS CPU's, but at the moment one size fits all for
optimization options. Older Sparc's work better with only UNROLL, but
there's no way to tell at compile time what it is you're running on */
-
+
#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */
# define DES_PTR
# define DES_RISC1
diff --git a/deps/openssl/config/archs/linux64-s390x/opensslconf.h b/deps/openssl/config/archs/linux64-s390x/opensslconf.h
index dbb03486798275..c4865e0b623caa 100644
--- a/deps/openssl/config/archs/linux64-s390x/opensslconf.h
+++ b/deps/openssl/config/archs/linux64-s390x/opensslconf.h
@@ -232,7 +232,7 @@ extern "C" {
even newer MIPS CPU's, but at the moment one size fits all for
optimization options. Older Sparc's work better with only UNROLL, but
there's no way to tell at compile time what it is you're running on */
-
+
#if defined( __sun ) || defined ( sun ) /* Newer Sparc's */
# define DES_PTR
# define DES_RISC1
diff --git a/deps/openssl/doc/UPGRADING.md b/deps/openssl/doc/UPGRADING.md
index 5c8919d2cf349e..fc229f1975776b 100644
--- a/deps/openssl/doc/UPGRADING.md
+++ b/deps/openssl/doc/UPGRADING.md
@@ -280,6 +280,13 @@ and the other is the older one. sections 6.1 and 6.2 describe the two
types of files. Section 6.3 explains the steps to update the files.
In the case of upgrading 1.0.2f there were no changes to the asm files.
+Files changed between two tags can be manually inspected using:
+```
+https://github.com/openssl/openssl/compare/OpenSSL_1_0_2e...OpenSSL_1_0_2f#files_bucket
+```
+If any source files in `asm` directory were changed then please follow the rest of the
+steps in this section otherwise these steps can be skipped.
+
### 6.1. asm files for the latest compiler
This was made in `deps/openssl/asm/Makefile`
- Updated asm files for each platforms which are required in
@@ -339,6 +346,7 @@ ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ make clean
find . -iname '*.asm' -exec rm "{}" \;
find . -iname '*.s' -exec rm "{}" \;
find . -iname '*.S' -exec rm "{}" \;
+ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ make
ohtsu@ubuntu:~/github/node/deps/openssl$ git status
ohtsu@ubuntu:~/github/node/deps/openssl$ git commit asm asm_obsolete
````
@@ -346,6 +354,8 @@ The commit message can be
>deps: update openssl asm and asm_obsolete files
>
->Regenerate asm files with Makefile and CC=gcc and ASM=gcc where
->gcc-4.8.4. Also asm files in asm_obsolete dir to support old compiler
->and assembler are regenerated without CC and ASM envs.
+>Regenerate asm files with Makefile and CC=gcc and ASM=nasm where gcc
+>version was 5.4.0 and nasm version was 2.11.08.
+>
+>Also asm files in asm_obsolete dir to support old compiler and
+>assembler are regenerated without CC and ASM envs.
diff --git a/deps/openssl/openssl/CHANGES b/deps/openssl/openssl/CHANGES
index 95aabc64d05475..307b2ed5e31287 100644
--- a/deps/openssl/openssl/CHANGES
+++ b/deps/openssl/openssl/CHANGES
@@ -2,6 +2,12 @@
OpenSSL CHANGES
_______________
+ Changes between 1.0.2k and 1.0.2l [25 May 2017]
+
+ *) Have 'config' recognise 64-bit mingw and choose 'mingw64' as the target
+ platform rather than 'mingw'.
+ [Richard Levitte]
+
Changes between 1.0.2j and 1.0.2k [26 Jan 2017]
*) Truncated packet could crash via OOB read
diff --git a/deps/openssl/openssl/Configure b/deps/openssl/openssl/Configure
index 5da7cadbf3326c..fd7988e2b3d93a 100755
--- a/deps/openssl/openssl/Configure
+++ b/deps/openssl/openssl/Configure
@@ -109,7 +109,7 @@ my $usage="Usage: Configure [no- ...] [enable- ...] [experimenta
# Minimum warning options... any contributions to OpenSSL should at least get
# past these.
-my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
+my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wundef -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED";
# TODO(openssl-team): fix problems and investigate if (at least) the following
# warnings can also be enabled:
@@ -2041,12 +2041,13 @@ EOF
close(OUT);
} else {
my $make_command = "$make PERL=\'$perl\'";
- my $make_targets = "";
- $make_targets .= " links" if $symlink;
- $make_targets .= " depend" if $depflags ne $default_depflags && $make_depend;
- $make_targets .= " gentests" if $symlink;
- (system $make_command.$make_targets) == 0 or exit $?
- if $make_targets ne "";
+ my @make_targets = ();
+ push @make_targets, "links" if $symlink;
+ push @make_targets, "depend" if $depflags ne $default_depflags && $make_depend;
+ push @make_targets, "gentests" if $symlink;
+ foreach my $make_target (@make_targets) {
+ (system "$make_command $make_target") == 0 or exit $?;
+ }
if ( $perl =~ m@^/@) {
&dofile("tools/c_rehash",$perl,'^#!/', '#!%s','^my \$dir;$', 'my $dir = "' . $openssldir . '";', '^my \$prefix;$', 'my $prefix = "' . $prefix . '";');
&dofile("apps/CA.pl",$perl,'^#!/', '#!%s');
@@ -2056,8 +2057,8 @@ EOF
&dofile("apps/CA.pl",'/usr/local/bin/perl','^#!/', '#!%s');
}
if ($depflags ne $default_depflags && !$make_depend) {
- $warn_make_depend++;
- }
+ $warn_make_depend++;
+ }
}
# create the ms/version32.rc file if needed
diff --git a/deps/openssl/openssl/LICENSE b/deps/openssl/openssl/LICENSE
index fb03713dd11115..bdfd985a691b07 100644
--- a/deps/openssl/openssl/LICENSE
+++ b/deps/openssl/openssl/LICENSE
@@ -2,7 +2,7 @@
LICENSE ISSUES
==============
- The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
+ The OpenSSL toolkit stays under a double license, i.e. both the conditions of
the OpenSSL License and the original SSLeay license apply to the toolkit.
See below for the actual license texts. Actually both licenses are BSD-style
Open Source licenses. In case of any license issues related to OpenSSL
@@ -12,7 +12,7 @@
---------------
/* ====================================================================
- * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2017 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/deps/openssl/openssl/Makefile b/deps/openssl/openssl/Makefile
index 0b894ff47f300b..a3d30318f9178d 100644
--- a/deps/openssl/openssl/Makefile
+++ b/deps/openssl/openssl/Makefile
@@ -4,7 +4,7 @@
## Makefile for OpenSSL
##
-VERSION=1.0.2k
+VERSION=1.0.2l
MAJOR=1
MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0
@@ -426,6 +426,14 @@ clean: libclean
rm -fr $$i/*; \
done
+distclean: clean
+ -$(RM) `find . -name .git -prune -o -type l -print`
+ $(RM) apps/CA.pl
+ $(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem
+ $(RM) tools/c_rehash
+ $(RM) crypto/opensslconf.h
+ $(RM) Makefile Makefile.bak
+
makefile.one: files
$(PERL) util/mk1mf.pl >makefile.one; \
sh util/do_ms.sh
diff --git a/deps/openssl/openssl/Makefile.bak b/deps/openssl/openssl/Makefile.bak
index 402333e809e51a..ea0d92e4d7db50 100644
--- a/deps/openssl/openssl/Makefile.bak
+++ b/deps/openssl/openssl/Makefile.bak
@@ -4,7 +4,7 @@
## Makefile for OpenSSL
##
-VERSION=1.0.2k
+VERSION=1.0.2l
MAJOR=1
MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0
@@ -426,6 +426,14 @@ clean: libclean
rm -fr $$i/*; \
done
+distclean: clean
+ -$(RM) `find . -name .git -prune -o -type l -print`
+ $(RM) apps/CA.pl
+ $(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem
+ $(RM) tools/c_rehash
+ $(RM) crypto/opensslconf.h
+ $(RM) Makefile Makefile.bak
+
makefile.one: files
$(PERL) util/mk1mf.pl >makefile.one; \
sh util/do_ms.sh
diff --git a/deps/openssl/openssl/Makefile.org b/deps/openssl/openssl/Makefile.org
index 61a329b4f20f6e..f51f0a756c3e08 100644
--- a/deps/openssl/openssl/Makefile.org
+++ b/deps/openssl/openssl/Makefile.org
@@ -424,6 +424,14 @@ clean: libclean
rm -fr $$i/*; \
done
+distclean: clean
+ -$(RM) `find . -name .git -prune -o -type l -print`
+ $(RM) apps/CA.pl
+ $(RM) test/evptests.txt test/newkey.pem test/testkey.pem test/testreq.pem
+ $(RM) tools/c_rehash
+ $(RM) crypto/opensslconf.h
+ $(RM) Makefile Makefile.bak
+
makefile.one: files
$(PERL) util/mk1mf.pl >makefile.one; \
sh util/do_ms.sh
diff --git a/deps/openssl/openssl/NEWS b/deps/openssl/openssl/NEWS
index be4a266bac13a4..fd49cedeba4c5c 100644
--- a/deps/openssl/openssl/NEWS
+++ b/deps/openssl/openssl/NEWS
@@ -5,6 +5,10 @@
This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file.
+ Major changes between OpenSSL 1.0.2k and OpenSSL 1.0.2l [25 May 2017]
+
+ o config now recognises 64-bit mingw and chooses mingw64 instead of mingw
+
Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017]
o Truncated packet could crash via OOB read (CVE-2017-3731)
diff --git a/deps/openssl/openssl/README b/deps/openssl/openssl/README
index 615d0c6a5dc8f5..4c357d9a836d08 100644
--- a/deps/openssl/openssl/README
+++ b/deps/openssl/openssl/README
@@ -1,5 +1,5 @@
- OpenSSL 1.0.2k 26 Jan 2017
+ OpenSSL 1.0.2l 25 May 2017
Copyright (c) 1998-2015 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
diff --git a/deps/openssl/openssl/apps/ca.c b/deps/openssl/openssl/apps/ca.c
index 4cea3cb7b1cea8..f90f033baed375 100644
--- a/deps/openssl/openssl/apps/ca.c
+++ b/deps/openssl/openssl/apps/ca.c
@@ -2126,10 +2126,8 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
goto err;
}
- for (i = 0; i < DB_NUMBER; i++) {
+ for (i = 0; i < DB_NUMBER; i++)
irow[i] = row[i];
- row[i] = NULL;
- }
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
@@ -2137,11 +2135,14 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
goto err;
}
+ irow = NULL;
ok = 1;
err:
- for (i = 0; i < DB_NUMBER; i++)
- if (row[i] != NULL)
+ if (irow != NULL) {
+ for (i = 0; i < DB_NUMBER; i++)
OPENSSL_free(row[i]);
+ OPENSSL_free(irow);
+ }
if (CAname != NULL)
X509_NAME_free(CAname);
@@ -2396,18 +2397,20 @@ static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
goto err;
}
- for (i = 0; i < DB_NUMBER; i++) {
+ for (i = 0; i < DB_NUMBER; i++)
irow[i] = row[i];
- row[i] = NULL;
- }
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
BIO_printf(bio_err, "failed to update database\n");
BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
+ OPENSSL_free(irow);
goto err;
}
+ for (i = 0; i < DB_NUMBER; i++)
+ row[i] = NULL;
+
/* Revoke Certificate */
if (type == -1)
ok = 1;
diff --git a/deps/openssl/openssl/apps/dhparam.c b/deps/openssl/openssl/apps/dhparam.c
index 1210adb104d9f3..bd91234abd664d 100644
--- a/deps/openssl/openssl/apps/dhparam.c
+++ b/deps/openssl/openssl/apps/dhparam.c
@@ -381,10 +381,19 @@ int MAIN(int argc, char **argv)
} else
# endif
{
- if (informat == FORMAT_ASN1)
+ if (informat == FORMAT_ASN1) {
+ /*
+ * We have no PEM header to determine what type of DH params it
+ * is. We'll just try both.
+ */
dh = d2i_DHparams_bio(in, NULL);
- else /* informat == FORMAT_PEM */
+ /* BIO_reset() returns 0 for success for file BIOs only!!! */
+ if (dh == NULL && BIO_reset(in) == 0)
+ dh = d2i_DHxparams_bio(in, NULL);
+ } else {
+ /* informat == FORMAT_PEM */
dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL);
+ }
if (dh == NULL) {
BIO_printf(bio_err, "unable to load DH parameters\n");
@@ -484,10 +493,13 @@ int MAIN(int argc, char **argv)
}
if (!noout) {
- if (outformat == FORMAT_ASN1)
- i = i2d_DHparams_bio(out, dh);
- else if (outformat == FORMAT_PEM) {
- if (dh->q)
+ if (outformat == FORMAT_ASN1) {
+ if (dh->q != NULL)
+ i = i2d_DHxparams_bio(out, dh);
+ else
+ i = i2d_DHparams_bio(out, dh);
+ } else if (outformat == FORMAT_PEM) {
+ if (dh->q != NULL)
i = PEM_write_bio_DHxparams(out, dh);
else
i = PEM_write_bio_DHparams(out, dh);
diff --git a/deps/openssl/openssl/apps/enc.c b/deps/openssl/openssl/apps/enc.c
index 8c8f1ef0f90b21..66145b3be770e7 100644
--- a/deps/openssl/openssl/apps/enc.c
+++ b/deps/openssl/openssl/apps/enc.c
@@ -81,20 +81,32 @@ int set_hex(char *in, unsigned char *out, int size);
#define BSIZE (8*1024)
#define PROG enc_main
-static void show_ciphers(const OBJ_NAME *name, void *bio_)
+struct doall_enc_ciphers {
+ BIO *bio;
+ int n;
+};
+
+static void show_ciphers(const OBJ_NAME *name, void *arg)
{
- BIO *bio = bio_;
- static int n;
+ struct doall_enc_ciphers *dec = (struct doall_enc_ciphers *)arg;
+ const EVP_CIPHER *cipher;
if (!islower((unsigned char)*name->name))
return;
- BIO_printf(bio, "-%-25s", name->name);
- if (++n == 3) {
- BIO_printf(bio, "\n");
- n = 0;
+ /* Filter out ciphers that we cannot use */
+ cipher = EVP_get_cipherbyname(name->name);
+ if (cipher == NULL ||
+ (EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) != 0 ||
+ EVP_CIPHER_mode(cipher) == EVP_CIPH_XTS_MODE)
+ return;
+
+ BIO_printf(dec->bio, "-%-25s", name->name);
+ if (++dec->n == 3) {
+ BIO_printf(dec->bio, "\n");
+ dec->n = 0;
} else
- BIO_printf(bio, " ");
+ BIO_printf(dec->bio, " ");
}
int MAIN(int, char **);
@@ -130,6 +142,7 @@ int MAIN(int argc, char **argv)
ENGINE *e = NULL;
const EVP_MD *dgst = NULL;
int non_fips_allow = 0;
+ struct doall_enc_ciphers dec;
apps_startup();
@@ -311,8 +324,10 @@ int MAIN(int argc, char **argv)
#endif
BIO_printf(bio_err, "Cipher Types\n");
+ dec.n = 0;
+ dec.bio = bio_err;
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
- show_ciphers, bio_err);
+ show_ciphers, &dec);
BIO_printf(bio_err, "\n");
goto end;
diff --git a/deps/openssl/openssl/apps/engine.c b/deps/openssl/openssl/apps/engine.c
index f54631b50d819a..a8eed9af5c18cb 100644
--- a/deps/openssl/openssl/apps/engine.c
+++ b/deps/openssl/openssl/apps/engine.c
@@ -108,13 +108,16 @@ static int append_buf(char **buf, const char *s, int *size, int step)
}
if (strlen(*buf) + strlen(s) >= (unsigned int)*size) {
+ char *p = *buf;
+
*size += step;
*buf = OPENSSL_realloc(*buf, *size);
+ if (*buf == NULL) {
+ OPENSSL_free(p);
+ return 0;
+ }
}
- if (*buf == NULL)
- return 0;
-
if (**buf != '\0')
BUF_strlcat(*buf, ", ", *size);
BUF_strlcat(*buf, s, *size);
diff --git a/deps/openssl/openssl/apps/pkeyutl.c b/deps/openssl/openssl/apps/pkeyutl.c
index 7c62d1c8709bcf..19f2e5d9cf9fd1 100644
--- a/deps/openssl/openssl/apps/pkeyutl.c
+++ b/deps/openssl/openssl/apps/pkeyutl.c
@@ -322,8 +322,10 @@ int MAIN(int argc, char **argv)
buf_in, (size_t)buf_inlen);
if (rv == 0)
BIO_puts(out, "Signature Verification Failure\n");
- else if (rv == 1)
+ else if (rv == 1) {
BIO_puts(out, "Signature Verified Successfully\n");
+ ret = 0;
+ }
if (rv >= 0)
goto end;
} else {
diff --git a/deps/openssl/openssl/apps/prime.c b/deps/openssl/openssl/apps/prime.c
index 133167f2d4d1e5..d8f764a3d7f1f0 100644
--- a/deps/openssl/openssl/apps/prime.c
+++ b/deps/openssl/openssl/apps/prime.c
@@ -155,5 +155,8 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err, "options are\n");
BIO_printf(bio_err, "%-14s hex\n", "-hex");
BIO_printf(bio_err, "%-14s number of checks\n", "-checks ");
+ BIO_printf(bio_err, "%-14s generate prime\n", "-generate");
+ BIO_printf(bio_err, "%-14s number of bits\n", "-bits ");
+ BIO_printf(bio_err, "%-14s safe prime\n", "-safe");
return 1;
}
diff --git a/deps/openssl/openssl/apps/progs.h b/deps/openssl/openssl/apps/progs.h
index fb498fd20c2746..d5c0039bd69d13 100644
--- a/deps/openssl/openssl/apps/progs.h
+++ b/deps/openssl/openssl/apps/progs.h
@@ -58,7 +58,7 @@ extern int srp_main(int argc, char *argv[]);
typedef struct {
int type;
const char *name;
- int (*func) (int argc, char *argv[]);
+ int (*func)(int argc, char *argv[]);
} FUNCTION;
DECLARE_LHASH_OF(FUNCTION);
diff --git a/deps/openssl/openssl/apps/progs.pl b/deps/openssl/openssl/apps/progs.pl
index fa6258cf5e1324..73498e3d6efad8 100644
--- a/deps/openssl/openssl/apps/progs.pl
+++ b/deps/openssl/openssl/apps/progs.pl
@@ -6,22 +6,22 @@
grep(s/^asn1pars$/asn1parse/,@ARGV);
foreach (@ARGV)
- { printf "extern int %s_main(int argc,char *argv[]);\n",$_; }
+ { printf "extern int %s_main(int argc, char *argv[]);\n",$_; }
print <<'EOF';
-#define FUNC_TYPE_GENERAL 1
-#define FUNC_TYPE_MD 2
-#define FUNC_TYPE_CIPHER 3
-#define FUNC_TYPE_PKEY 4
-#define FUNC_TYPE_MD_ALG 5
-#define FUNC_TYPE_CIPHER_ALG 6
+#define FUNC_TYPE_GENERAL 1
+#define FUNC_TYPE_MD 2
+#define FUNC_TYPE_CIPHER 3
+#define FUNC_TYPE_PKEY 4
+#define FUNC_TYPE_MD_ALG 5
+#define FUNC_TYPE_CIPHER_ALG 6
typedef struct {
- int type;
- const char *name;
- int (*func)(int argc,char *argv[]);
- } FUNCTION;
+ int type;
+ const char *name;
+ int (*func)(int argc, char *argv[]);
+} FUNCTION;
DECLARE_LHASH_OF(FUNCTION);
FUNCTION functions[] = {
@@ -30,7 +30,7 @@
foreach (@ARGV)
{
push(@files,$_);
- $str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
+ $str=" {FUNC_TYPE_GENERAL, \"$_\", ${_}_main},\n";
if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
{ print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n"; }
elsif ( ($_ =~ /^speed$/))
@@ -60,7 +60,7 @@
foreach ("md2","md4","md5","sha","sha1","mdc2","rmd160")
{
push(@files,$_);
- printf "#ifndef OPENSSL_NO_".uc($_)."\n\t{FUNC_TYPE_MD,\"".$_."\",dgst_main},\n#endif\n";
+ printf "#ifndef OPENSSL_NO_".uc($_)."\n {FUNC_TYPE_MD, \"".$_."\", dgst_main},\n#endif\n";
}
foreach (
@@ -86,7 +86,7 @@
{
push(@files,$_);
- $t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
+ $t=sprintf(" {FUNC_TYPE_CIPHER, \"%s\", enc_main},\n",$_);
if ($_ =~ /des/) { $t="#ifndef OPENSSL_NO_DES\n${t}#endif\n"; }
elsif ($_ =~ /aes/) { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; }
elsif ($_ =~ /camellia/) { $t="#ifndef OPENSSL_NO_CAMELLIA\n${t}#endif\n"; }
@@ -101,4 +101,4 @@
print $t;
}
-print "\t{0,NULL,NULL}\n\t};\n";
+print " {0, NULL, NULL}\n};\n";
diff --git a/deps/openssl/openssl/apps/req.c b/deps/openssl/openssl/apps/req.c
index cdea1f61119472..ede1d32cae62cc 100644
--- a/deps/openssl/openssl/apps/req.c
+++ b/deps/openssl/openssl/apps/req.c
@@ -331,7 +331,6 @@ int MAIN(int argc, char **argv)
else if (strcmp(*argv, "-text") == 0)
text = 1;
else if (strcmp(*argv, "-x509") == 0) {
- newreq = 1;
x509 = 1;
} else if (strcmp(*argv, "-asn1-kludge") == 0)
kludge = 1;
@@ -447,6 +446,9 @@ int MAIN(int argc, char **argv)
goto end;
}
+ if (x509 && infile == NULL)
+ newreq = 1;
+
ERR_load_crypto_strings();
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
BIO_printf(bio_err, "Error getting passwords\n");
@@ -753,7 +755,7 @@ int MAIN(int argc, char **argv)
}
}
- if (newreq) {
+ if (newreq || x509) {
if (pkey == NULL) {
BIO_printf(bio_err, "you need to specify a private key\n");
goto end;
diff --git a/deps/openssl/openssl/apps/s_client.c b/deps/openssl/openssl/apps/s_client.c
index cdea5ff8d857e2..ffb8ffc5af20c7 100644
--- a/deps/openssl/openssl/apps/s_client.c
+++ b/deps/openssl/openssl/apps/s_client.c
@@ -2147,6 +2147,7 @@ int MAIN(int argc, char **argv)
BIO_free(bio_c_msg);
bio_c_msg = NULL;
}
+ SSL_COMP_free_compression_methods();
apps_shutdown();
OPENSSL_EXIT(ret);
}
diff --git a/deps/openssl/openssl/apps/s_server.c b/deps/openssl/openssl/apps/s_server.c
index b561cf3a362bf9..d75871386928f5 100644
--- a/deps/openssl/openssl/apps/s_server.c
+++ b/deps/openssl/openssl/apps/s_server.c
@@ -2132,6 +2132,7 @@ int MAIN(int argc, char *argv[])
BIO_free(bio_s_msg);
bio_s_msg = NULL;
}
+ SSL_COMP_free_compression_methods();
apps_shutdown();
OPENSSL_EXIT(ret);
}
diff --git a/deps/openssl/openssl/apps/srp.c b/deps/openssl/openssl/apps/srp.c
index 37341a5d20ed61..ce01a24f2a78c4 100644
--- a/deps/openssl/openssl/apps/srp.c
+++ b/deps/openssl/openssl/apps/srp.c
@@ -183,10 +183,8 @@ static int update_index(CA_DB *db, BIO *bio, char **row)
return 0;
}
- for (i = 0; i < DB_NUMBER; i++) {
+ for (i = 0; i < DB_NUMBER; i++)
irow[i] = row[i];
- row[i] = NULL;
- }
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
diff --git a/deps/openssl/openssl/appveyor.yml b/deps/openssl/openssl/appveyor.yml
index 8695359488d8dd..8c38feae6d954c 100644
--- a/deps/openssl/openssl/appveyor.yml
+++ b/deps/openssl/openssl/appveyor.yml
@@ -50,11 +50,3 @@ build_script:
test_script:
- nmake /f ms\%MAK% test
-
-notifications:
- - provider: Email
- to:
- - openssl-commits@openssl.org
- on_build_success: false
- on_build_failure: true
- on_build_status_changed: true
diff --git a/deps/openssl/openssl/config b/deps/openssl/openssl/config
index bba370c4f3f1cb..21534e00ba4a28 100755
--- a/deps/openssl/openssl/config
+++ b/deps/openssl/openssl/config
@@ -344,6 +344,15 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
echo "mips-sony-newsos4"; exit 0;
;;
+ # The following combinations are supported
+ # MINGW64* on x86_64 => mingw64
+ # MINGW32* on x86_64 => mingw
+ # MINGW32* on i?86 => mingw
+ #
+ # MINGW64* on i?86 isn't expected to work...
+ MINGW64*:*:*:x86_64)
+ echo "${MACHINE}-whatever-mingw64"; exit 0;
+ ;;
MINGW*)
echo "${MACHINE}-whatever-mingw"; exit 0;
;;
diff --git a/deps/openssl/openssl/crypto/aes/Makefile b/deps/openssl/openssl/crypto/aes/Makefile
index e825c140194f60..05e4a0149ed86d 100644
--- a/deps/openssl/openssl/crypto/aes/Makefile
+++ b/deps/openssl/openssl/crypto/aes/Makefile
@@ -133,7 +133,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/deps/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl b/deps/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
index 8c84260856e164..7a30e893fbe67b 100644
--- a/deps/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
+++ b/deps/openssl/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
@@ -1702,6 +1702,7 @@ ()
mov 240($key),$rounds
sub $in0,$out
movups ($key),$rndkey0 # $key[0]
+ movups ($ivp),$iv # load IV
movups 16($key),$rndkey[0] # forward reference
lea 112($key),$key # size optimization
diff --git a/deps/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl b/deps/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl
index 72f44ecf625345..588ade64ee52c4 100644
--- a/deps/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl
+++ b/deps/openssl/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl
@@ -1299,6 +1299,7 @@ ()
mov 240($key),$rounds
sub $in0,$out
movups ($key),$rndkey0 # $key[0]
+ movups ($ivp),$iv # load IV
movups 16($key),$rndkey[0] # forward reference
lea 112($key),$key # size optimization
diff --git a/deps/openssl/openssl/crypto/aes/asm/bsaes-armv7.pl b/deps/openssl/openssl/crypto/aes/asm/bsaes-armv7.pl
index 83343e2de1af7b..70b3f9656f4fa7 100644
--- a/deps/openssl/openssl/crypto/aes/asm/bsaes-armv7.pl
+++ b/deps/openssl/openssl/crypto/aes/asm/bsaes-armv7.pl
@@ -1333,7 +1333,7 @@ sub bitslice_key {
vmov @XMM[4],@XMM[15] @ just in case ensure that IV
vmov @XMM[5],@XMM[0] @ and input are preserved
bl AES_decrypt
- vld1.8 {@XMM[0]}, [$fp,:64] @ load result
+ vld1.8 {@XMM[0]}, [$fp] @ load result
veor @XMM[0], @XMM[0], @XMM[4] @ ^= IV
vmov @XMM[15], @XMM[5] @ @XMM[5] holds input
vst1.8 {@XMM[0]}, [$rounds] @ write output
diff --git a/deps/openssl/openssl/crypto/asn1/a_bitstr.c b/deps/openssl/openssl/crypto/asn1/a_bitstr.c
index f906188b114b08..c429342e03d42a 100644
--- a/deps/openssl/openssl/crypto/asn1/a_bitstr.c
+++ b/deps/openssl/openssl/crypto/asn1/a_bitstr.c
@@ -114,10 +114,11 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
*(p++) = (unsigned char)bits;
d = a->data;
- memcpy(p, d, len);
- p += len;
- if (len > 0)
+ if (len > 0) {
+ memcpy(p, d, len);
+ p += len;
p[-1] &= (0xff << bits);
+ }
*pp = p;
return (ret);
}
diff --git a/deps/openssl/openssl/crypto/asn1/a_digest.c b/deps/openssl/openssl/crypto/asn1/a_digest.c
index 7cbc4751cd8120..57a04f768ca024 100644
--- a/deps/openssl/openssl/crypto/asn1/a_digest.c
+++ b/deps/openssl/openssl/crypto/asn1/a_digest.c
@@ -86,8 +86,10 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
p = str;
i2d(data, &p);
- if (!EVP_Digest(str, i, md, len, type, NULL))
+ if (!EVP_Digest(str, i, md, len, type, NULL)) {
+ OPENSSL_free(str);
return 0;
+ }
OPENSSL_free(str);
return (1);
}
@@ -104,8 +106,10 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
if (!str)
return (0);
- if (!EVP_Digest(str, i, md, len, type, NULL))
+ if (!EVP_Digest(str, i, md, len, type, NULL)) {
+ OPENSSL_free(str);
return 0;
+ }
OPENSSL_free(str);
return (1);
}
diff --git a/deps/openssl/openssl/crypto/asn1/a_gentm.c b/deps/openssl/openssl/crypto/asn1/a_gentm.c
index fa76dcac91f34b..85118137859f91 100644
--- a/deps/openssl/openssl/crypto/asn1/a_gentm.c
+++ b/deps/openssl/openssl/crypto/asn1/a_gentm.c
@@ -202,7 +202,7 @@ int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d)
if (a[o] == 'Z')
o++;
else if ((a[o] == '+') || (a[o] == '-')) {
- int offsign = a[o] == '-' ? -1 : 1, offset = 0;
+ int offsign = a[o] == '-' ? 1 : -1, offset = 0;
o++;
if (o + 4 > l)
goto err;
diff --git a/deps/openssl/openssl/crypto/asn1/a_strnid.c b/deps/openssl/openssl/crypto/asn1/a_strnid.c
index 2d2303d8599e7a..99ffe737873569 100644
--- a/deps/openssl/openssl/crypto/asn1/a_strnid.c
+++ b/deps/openssl/openssl/crypto/asn1/a_strnid.c
@@ -192,7 +192,8 @@ static const ASN1_STRING_TABLE tbl_standard[] = {
{NID_name, 1, ub_name, DIRSTRING_TYPE, 0},
{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
{NID_domainComponent, 1, -1, B_ASN1_IA5STRING, STABLE_NO_MASK},
- {NID_ms_csp_name, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK}
+ {NID_ms_csp_name, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK},
+ {NID_jurisdictionCountryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}
};
static int sk_table_cmp(const ASN1_STRING_TABLE *const *a,
diff --git a/deps/openssl/openssl/crypto/asn1/a_time.c b/deps/openssl/openssl/crypto/asn1/a_time.c
index fcb2d565cdd0ac..0eeb79cd428ce0 100644
--- a/deps/openssl/openssl/crypto/asn1/a_time.c
+++ b/deps/openssl/openssl/crypto/asn1/a_time.c
@@ -137,7 +137,7 @@ int ASN1_TIME_check(ASN1_TIME *t)
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
ASN1_GENERALIZEDTIME **out)
{
- ASN1_GENERALIZEDTIME *ret;
+ ASN1_GENERALIZEDTIME *ret = NULL;
char *str;
int newlen;
@@ -146,22 +146,21 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
if (!out || !*out) {
if (!(ret = ASN1_GENERALIZEDTIME_new()))
- return NULL;
- if (out)
- *out = ret;
- } else
+ goto err;
+ } else {
ret = *out;
+ }
/* If already GeneralizedTime just copy across */
if (t->type == V_ASN1_GENERALIZEDTIME) {
if (!ASN1_STRING_set(ret, t->data, t->length))
- return NULL;
- return ret;
+ goto err;
+ goto done;
}
/* grow the string */
if (!ASN1_STRING_set(ret, NULL, t->length + 2))
- return NULL;
+ goto err;
/* ASN1_STRING_set() allocated 'len + 1' bytes. */
newlen = t->length + 2 + 1;
str = (char *)ret->data;
@@ -173,9 +172,18 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
BUF_strlcat(str, (char *)t->data, newlen);
- return ret;
+ done:
+ if (out != NULL && *out == NULL)
+ *out = ret;
+ return ret;
+
+ err:
+ if (out == NULL || *out != ret)
+ ASN1_GENERALIZEDTIME_free(ret);
+ return NULL;
}
+
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
{
ASN1_TIME t;
diff --git a/deps/openssl/openssl/crypto/asn1/a_utctm.c b/deps/openssl/openssl/crypto/asn1/a_utctm.c
index 724a10be4ed6ab..0344482cc247f2 100644
--- a/deps/openssl/openssl/crypto/asn1/a_utctm.c
+++ b/deps/openssl/openssl/crypto/asn1/a_utctm.c
@@ -172,7 +172,7 @@ int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d)
if (a[o] == 'Z')
o++;
else if ((a[o] == '+') || (a[o] == '-')) {
- int offsign = a[o] == '-' ? -1 : 1, offset = 0;
+ int offsign = a[o] == '-' ? 1 : -1, offset = 0;
o++;
if (o + 4 > l)
goto err;
diff --git a/deps/openssl/openssl/crypto/asn1/f_enum.c b/deps/openssl/openssl/crypto/asn1/f_enum.c
index 94cd54dbeedd3a..527f1d8f87b3f2 100644
--- a/deps/openssl/openssl/crypto/asn1/f_enum.c
+++ b/deps/openssl/openssl/crypto/asn1/f_enum.c
@@ -138,7 +138,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
bufp = (unsigned char *)buf;
if (first) {
first = 0;
- if ((bufp[0] == '0') && (buf[1] == '0')) {
+ if ((bufp[0] == '0') && (bufp[1] == '0')) {
bufp += 2;
i -= 2;
}
diff --git a/deps/openssl/openssl/crypto/asn1/f_int.c b/deps/openssl/openssl/crypto/asn1/f_int.c
index 2bdc78d74491ce..e6ed7f1e770b99 100644
--- a/deps/openssl/openssl/crypto/asn1/f_int.c
+++ b/deps/openssl/openssl/crypto/asn1/f_int.c
@@ -152,7 +152,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
bufp = (unsigned char *)buf;
if (first) {
first = 0;
- if ((bufp[0] == '0') && (buf[1] == '0')) {
+ if ((bufp[0] == '0') && (bufp[1] == '0')) {
bufp += 2;
i -= 2;
}
diff --git a/deps/openssl/openssl/crypto/asn1/tasn_dec.c b/deps/openssl/openssl/crypto/asn1/tasn_dec.c
index d25402730b8b9d..d49a5d5792a430 100644
--- a/deps/openssl/openssl/crypto/asn1/tasn_dec.c
+++ b/deps/openssl/openssl/crypto/asn1/tasn_dec.c
@@ -673,6 +673,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
}
len -= p - q;
if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, skfield)) {
+ ASN1_item_ex_free(&skfield, ASN1_ITEM_ptr(tt->item));
ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_MALLOC_FAILURE);
goto err;
}
diff --git a/deps/openssl/openssl/crypto/asn1/tasn_new.c b/deps/openssl/openssl/crypto/asn1/tasn_new.c
index b0c73beeb57870..54f459d1ed9cbf 100644
--- a/deps/openssl/openssl/crypto/asn1/tasn_new.c
+++ b/deps/openssl/openssl/crypto/asn1/tasn_new.c
@@ -158,7 +158,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
}
asn1_set_choice_selector(pval, -1, it);
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
- goto auxerr;
+ goto auxerr2;
break;
case ASN1_ITYPE_NDEF_SEQUENCE:
@@ -186,10 +186,10 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
pseqval = asn1_get_field_ptr(pval, tt);
if (!ASN1_template_new(pseqval, tt))
- goto memerr;
+ goto memerr2;
}
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
- goto auxerr;
+ goto auxerr2;
break;
}
#ifdef CRYPTO_MDEBUG
@@ -198,6 +198,8 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
#endif
return 1;
+ memerr2:
+ ASN1_item_ex_free(pval, it);
memerr:
ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ERR_R_MALLOC_FAILURE);
#ifdef CRYPTO_MDEBUG
@@ -206,9 +208,10 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
#endif
return 0;
+ auxerr2:
+ ASN1_item_ex_free(pval, it);
auxerr:
ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ASN1_R_AUX_ERROR);
- ASN1_item_ex_free(pval, it);
#ifdef CRYPTO_MDEBUG
if (it->sname)
CRYPTO_pop_info();
diff --git a/deps/openssl/openssl/crypto/asn1/x_long.c b/deps/openssl/openssl/crypto/asn1/x_long.c
index 3aed44a3ddf753..aecb95069de723 100644
--- a/deps/openssl/openssl/crypto/asn1/x_long.c
+++ b/deps/openssl/openssl/crypto/asn1/x_long.c
@@ -126,7 +126,7 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
* set.
*/
if (ltmp < 0)
- utmp = -ltmp - 1;
+ utmp = 0 - (unsigned long)ltmp - 1;
else
utmp = ltmp;
clen = BN_num_bits_word(utmp);
@@ -155,19 +155,41 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,
static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
int utype, char *free_cont, const ASN1_ITEM *it)
{
- int neg, i;
+ int neg = -1, i;
long ltmp;
unsigned long utmp = 0;
char *cp = (char *)pval;
+
+ if (len) {
+ /*
+ * Check possible pad byte. Worst case, we're skipping past actual
+ * content, but since that's only with 0x00 and 0xff and we set neg
+ * accordingly, the result will be correct in the end anyway.
+ */
+ switch (cont[0]) {
+ case 0xff:
+ cont++;
+ len--;
+ neg = 1;
+ break;
+ case 0:
+ cont++;
+ len--;
+ neg = 0;
+ break;
+ }
+ }
if (len > (int)sizeof(long)) {
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
return 0;
}
- /* Is it negative? */
- if (len && (cont[0] & 0x80))
- neg = 1;
- else
- neg = 0;
+ if (neg == -1) {
+ /* Is it negative? */
+ if (len && (cont[0] & 0x80))
+ neg = 1;
+ else
+ neg = 0;
+ }
utmp = 0;
for (i = 0; i < len; i++) {
utmp <<= 8;
@@ -178,8 +200,8 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
}
ltmp = (long)utmp;
if (neg) {
- ltmp++;
ltmp = -ltmp;
+ ltmp--;
}
if (ltmp == it->size) {
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
diff --git a/deps/openssl/openssl/crypto/asn1/x_name.c b/deps/openssl/openssl/crypto/asn1/x_name.c
index 26378fdb2a02e1..1fb7ad1cbf88af 100644
--- a/deps/openssl/openssl/crypto/asn1/x_name.c
+++ b/deps/openssl/openssl/crypto/asn1/x_name.c
@@ -178,6 +178,16 @@ static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
*pval = NULL;
}
+static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne)
+{
+ sk_X509_NAME_ENTRY_free(ne);
+}
+
+static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne)
+{
+ sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
+}
+
static int x509_name_ex_d2i(ASN1_VALUE **val,
const unsigned char **in, long len,
const ASN1_ITEM *it, int tag, int aclass,
@@ -228,13 +238,14 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
entry->set = i;
if (!sk_X509_NAME_ENTRY_push(nm.x->entries, entry))
goto err;
+ sk_X509_NAME_ENTRY_set(entries, j, NULL);
}
- sk_X509_NAME_ENTRY_free(entries);
}
- sk_STACK_OF_X509_NAME_ENTRY_free(intname.s);
ret = x509_name_canon(nm.x);
if (!ret)
goto err;
+ sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
+ local_sk_X509_NAME_ENTRY_free);
nm.x->modified = 0;
*val = nm.a;
*in = p;
@@ -242,6 +253,8 @@ static int x509_name_ex_d2i(ASN1_VALUE **val,
err:
if (nm.x != NULL)
X509_NAME_free(nm.x);
+ sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
+ local_sk_X509_NAME_ENTRY_pop_free);
ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
return 0;
}
@@ -267,16 +280,6 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out,
return ret;
}
-static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne)
-{
- sk_X509_NAME_ENTRY_free(ne);
-}
-
-static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne)
-{
- sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
-}
-
static int x509_name_encode(X509_NAME *a)
{
union {
@@ -299,8 +302,10 @@ static int x509_name_encode(X509_NAME *a)
entries = sk_X509_NAME_ENTRY_new_null();
if (!entries)
goto memerr;
- if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, entries))
+ if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, entries)) {
+ sk_X509_NAME_ENTRY_free(entries);
goto memerr;
+ }
set = entry->set;
}
if (!sk_X509_NAME_ENTRY_push(entries, entry))
@@ -370,8 +375,10 @@ static int x509_name_canon(X509_NAME *a)
entries = sk_X509_NAME_ENTRY_new_null();
if (!entries)
goto err;
- if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries))
+ if (!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries)) {
+ sk_X509_NAME_ENTRY_free(entries);
goto err;
+ }
set = entry->set;
}
tmpentry = X509_NAME_ENTRY_new();
diff --git a/deps/openssl/openssl/crypto/bio/b_print.c b/deps/openssl/openssl/crypto/bio/b_print.c
index 987fe068c6de10..eb3ab759349cde 100644
--- a/deps/openssl/openssl/crypto/bio/b_print.c
+++ b/deps/openssl/openssl/crypto/bio/b_print.c
@@ -502,7 +502,7 @@ fmtint(char **sbuffer,
if (!(flags & DP_F_UNSIGNED)) {
if (value < 0) {
signvalue = '-';
- uvalue = -value;
+ uvalue = -(unsigned LLONG)value;
} else if (flags & DP_F_PLUS)
signvalue = '+';
else if (flags & DP_F_SPACE)
diff --git a/deps/openssl/openssl/crypto/bio/bio_cb.c b/deps/openssl/openssl/crypto/bio/bio_cb.c
index d3e860686c3c58..f96294bb430475 100644
--- a/deps/openssl/openssl/crypto/bio/bio_cb.c
+++ b/deps/openssl/openssl/crypto/bio/bio_cb.c
@@ -78,6 +78,9 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio);
+ /* Ignore errors and continue printing the other information. */
+ if (len < 0)
+ len = 0;
p = buf + len;
p_maxlen = sizeof(buf) - len;
diff --git a/deps/openssl/openssl/crypto/bio/bss_file.c b/deps/openssl/openssl/crypto/bio/bss_file.c
index a6e3b3ac0130aa..0cf67e5b770b0c 100644
--- a/deps/openssl/openssl/crypto/bio/bss_file.c
+++ b/deps/openssl/openssl/crypto/bio/bss_file.c
@@ -251,7 +251,7 @@ static int MS_CALLBACK file_read(BIO *b, char *out, int outl)
ret = fread(out, 1, (int)outl, (FILE *)b->ptr);
if (ret == 0
&& (b->flags & BIO_FLAGS_UPLINK) ? UP_ferror((FILE *)b->ptr) :
- ferror((FILE *)b->ptr)) {
+ ferror((FILE *)b->ptr)) {
SYSerr(SYS_F_FREAD, get_last_sys_error());
BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB);
ret = -1;
@@ -287,6 +287,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
FILE *fp = (FILE *)b->ptr;
FILE **fpp;
char p[4];
+ int st;
switch (cmd) {
case BIO_C_FILE_SEEK:
@@ -318,8 +319,11 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
# if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES)
# define _IOB_ENTRIES 20
# endif
-# if defined(_IOB_ENTRIES)
/* Safety net to catch purely internal BIO_set_fp calls */
+# if defined(_MSC_VER) && _MSC_VER>=1900
+ if (ptr == stdin || ptr == stdout || ptr == stderr)
+ BIO_clear_flags(b, BIO_FLAGS_UPLINK);
+# elif defined(_IOB_ENTRIES)
if ((size_t)ptr >= (size_t)stdin &&
(size_t)ptr < (size_t)(stdin + _IOB_ENTRIES))
BIO_clear_flags(b, BIO_FLAGS_UPLINK);
@@ -424,10 +428,14 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
b->shutdown = (int)num;
break;
case BIO_CTRL_FLUSH:
- if (b->flags & BIO_FLAGS_UPLINK)
- UP_fflush(b->ptr);
- else
- fflush((FILE *)b->ptr);
+ st = b->flags & BIO_FLAGS_UPLINK
+ ? UP_fflush(b->ptr) : fflush((FILE *)b->ptr);
+ if (st == EOF) {
+ SYSerr(SYS_F_FFLUSH, get_last_sys_error());
+ ERR_add_error_data(1, "fflush()");
+ BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB);
+ ret = 0;
+ }
break;
case BIO_CTRL_DUP:
ret = 1;
diff --git a/deps/openssl/openssl/crypto/bn/Makefile b/deps/openssl/openssl/crypto/bn/Makefile
index c4c6409517596f..20e8ef0a28d7e9 100644
--- a/deps/openssl/openssl/crypto/bn/Makefile
+++ b/deps/openssl/openssl/crypto/bn/Makefile
@@ -187,7 +187,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/deps/openssl/openssl/crypto/bn/asm/sparcv9-mont.pl b/deps/openssl/openssl/crypto/bn/asm/sparcv9-mont.pl
index b8fb1e8a25dc0b..d8662878006eac 100644
--- a/deps/openssl/openssl/crypto/bn/asm/sparcv9-mont.pl
+++ b/deps/openssl/openssl/crypto/bn/asm/sparcv9-mont.pl
@@ -290,7 +290,7 @@
######## .Lbn_sqr_mont gives up to 20% *overall* improvement over
######## code without following dedicated squaring procedure.
########
-$sbit="%i2"; # re-use $bp!
+$sbit="%o5";
$code.=<<___;
.align 32
@@ -403,7 +403,7 @@
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
add $acc0,$car0,$car0
- add $tpj,$car1,$car1
+ add $tpj,$sbit,$sbit
ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0
ld [$np+$j],$npj ! np[j]
@@ -412,7 +412,7 @@
ld [$tp+8],$tpj ! tp[j]
add $acc0,$acc0,$acc0
add $j,4,$j ! j++
- or $sbit,$acc0,$acc0
+ add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
cmp $j,$num
@@ -426,12 +426,12 @@
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
add $acc0,$car0,$car0
- add $tpj,$car1,$car1
+ add $tpj,$sbit,$sbit
and $car0,$mask,$acc0
srlx $car0,32,$car0
add $acc1,$car1,$car1
add $acc0,$acc0,$acc0
- or $sbit,$acc0,$acc0
+ add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
add $acc0,$car1,$car1
@@ -439,7 +439,7 @@
srlx $car1,32,$car1
add $car0,$car0,$car0
- or $sbit,$car0,$car0
+ add $sbit,$car0,$car0
add $car0,$car1,$car1
add $car2,$car1,$car1
st $car1,[$tp+4]
@@ -499,7 +499,7 @@
.Lsqr_inner2:
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
- add $tpj,$car1,$car1
+ add $tpj,$sbit,$sbit
add $acc0,$car0,$car0
ld [$ap+$j],$apj ! ap[j]
and $car0,$mask,$acc0
@@ -507,7 +507,7 @@
srlx $car0,32,$car0
add $acc0,$acc0,$acc0
ld [$tp+8],$tpj ! tp[j]
- or $sbit,$acc0,$acc0
+ add $sbit,$acc0,$acc0
add $j,4,$j ! j++
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
@@ -522,12 +522,12 @@
.Lsqr_no_inner2:
mulx $apj,$mul0,$acc0
mulx $npj,$mul1,$acc1
- add $tpj,$car1,$car1
+ add $tpj,$sbit,$sbit
add $acc0,$car0,$car0
and $car0,$mask,$acc0
srlx $car0,32,$car0
add $acc0,$acc0,$acc0
- or $sbit,$acc0,$acc0
+ add $sbit,$acc0,$acc0
srlx $acc0,32,$sbit
and $acc0,$mask,$acc0
add $acc0,$car1,$car1
@@ -536,7 +536,7 @@
srlx $car1,32,$car1
add $car0,$car0,$car0
- or $sbit,$car0,$car0
+ add $sbit,$car0,$car0
add $car0,$car1,$car1
add $car2,$car1,$car1
st $car1,[$tp+4]
@@ -581,14 +581,17 @@
!.Lsqr_last
mulx $npj,$mul1,$acc1
- add $tpj,$car1,$car1
+ add $tpj,$acc0,$acc0
+ srlx $acc0,32,$tmp0
+ and $acc0,$mask,$acc0
+ add $tmp0,$sbit,$sbit
add $acc0,$car1,$car1
add $acc1,$car1,$car1
st $car1,[$tp]
srlx $car1,32,$car1
add $car0,$car0,$car0 ! recover $car0
- or $sbit,$car0,$car0
+ add $sbit,$car0,$car0
add $car0,$car1,$car1
add $car2,$car1,$car1
st $car1,[$tp+4]
diff --git a/deps/openssl/openssl/crypto/bn/bn_prime.c b/deps/openssl/openssl/crypto/bn/bn_prime.c
index 8177fd294772f2..e911e157859aae 100644
--- a/deps/openssl/openssl/crypto/bn/bn_prime.c
+++ b/deps/openssl/openssl/crypto/bn/bn_prime.c
@@ -252,7 +252,6 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
BN_CTX *ctx = NULL;
BIGNUM *A1, *A1_odd, *check; /* taken from ctx */
BN_MONT_CTX *mont = NULL;
- const BIGNUM *A = NULL;
if (BN_cmp(a, BN_value_one()) <= 0)
return 0;
@@ -278,25 +277,14 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
goto err;
BN_CTX_start(ctx);
- /* A := abs(a) */
- if (a->neg) {
- BIGNUM *t;
- if ((t = BN_CTX_get(ctx)) == NULL)
- goto err;
- if (BN_copy(t, a) == NULL)
- goto err;
- t->neg = 0;
- A = t;
- } else
- A = a;
A1 = BN_CTX_get(ctx);
A1_odd = BN_CTX_get(ctx);
check = BN_CTX_get(ctx);
if (check == NULL)
goto err;
- /* compute A1 := A - 1 */
- if (!BN_copy(A1, A))
+ /* compute A1 := a - 1 */
+ if (!BN_copy(A1, a))
goto err;
if (!BN_sub_word(A1, 1))
goto err;
@@ -312,11 +300,11 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
if (!BN_rshift(A1_odd, A1, k))
goto err;
- /* Montgomery setup for computations mod A */
+ /* Montgomery setup for computations mod a */
mont = BN_MONT_CTX_new();
if (mont == NULL)
goto err;
- if (!BN_MONT_CTX_set(mont, A, ctx))
+ if (!BN_MONT_CTX_set(mont, a, ctx))
goto err;
for (i = 0; i < checks; i++) {
@@ -324,9 +312,9 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
goto err;
if (!BN_add_word(check, 1))
goto err;
- /* now 1 <= check < A */
+ /* now 1 <= check < a */
- j = witness(check, A, A1, A1_odd, k, ctx, mont);
+ j = witness(check, a, A1, A1_odd, k, ctx, mont);
if (j == -1)
goto err;
if (j) {
diff --git a/deps/openssl/openssl/crypto/bn/bn_prime.h b/deps/openssl/openssl/crypto/bn/bn_prime.h
index 5cf0de169e0497..489af8b424ca56 100644
--- a/deps/openssl/openssl/crypto/bn/bn_prime.h
+++ b/deps/openssl/openssl/crypto/bn/bn_prime.h
@@ -64,263 +64,263 @@ typedef unsigned short prime_t;
typedef unsigned char prime_t;
#endif
static const prime_t primes[NUMPRIMES] = {
- 2, 3, 5, 7, 11, 13, 17, 19,
- 23, 29, 31, 37, 41, 43, 47, 53,
- 59, 61, 67, 71, 73, 79, 83, 89,
- 97, 101, 103, 107, 109, 113, 127, 131,
- 137, 139, 149, 151, 157, 163, 167, 173,
- 179, 181, 191, 193, 197, 199, 211, 223,
- 227, 229, 233, 239, 241, 251,
+ 2, 3, 5, 7, 11, 13, 17, 19,
+ 23, 29, 31, 37, 41, 43, 47, 53,
+ 59, 61, 67, 71, 73, 79, 83, 89,
+ 97, 101, 103, 107, 109, 113, 127, 131,
+ 137, 139, 149, 151, 157, 163, 167, 173,
+ 179, 181, 191, 193, 197, 199, 211, 223,
+ 227, 229, 233, 239, 241, 251,
#ifndef EIGHT_BIT
- 257, 263,
- 269, 271, 277, 281, 283, 293, 307, 311,
- 313, 317, 331, 337, 347, 349, 353, 359,
- 367, 373, 379, 383, 389, 397, 401, 409,
- 419, 421, 431, 433, 439, 443, 449, 457,
- 461, 463, 467, 479, 487, 491, 499, 503,
- 509, 521, 523, 541, 547, 557, 563, 569,
- 571, 577, 587, 593, 599, 601, 607, 613,
- 617, 619, 631, 641, 643, 647, 653, 659,
- 661, 673, 677, 683, 691, 701, 709, 719,
- 727, 733, 739, 743, 751, 757, 761, 769,
- 773, 787, 797, 809, 811, 821, 823, 827,
- 829, 839, 853, 857, 859, 863, 877, 881,
- 883, 887, 907, 911, 919, 929, 937, 941,
- 947, 953, 967, 971, 977, 983, 991, 997,
- 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049,
- 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097,
- 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163,
- 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223,
- 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283,
- 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321,
- 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423,
- 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459,
- 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511,
- 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571,
- 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619,
- 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693,
- 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747,
- 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811,
- 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877,
- 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949,
- 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003,
- 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069,
- 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129,
- 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203,
- 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267,
- 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311,
- 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377,
- 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423,
- 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503,
- 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579,
- 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657,
- 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693,
- 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741,
- 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801,
- 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861,
- 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939,
- 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011,
- 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079,
- 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167,
- 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221,
- 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301,
- 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347,
- 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413,
- 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491,
- 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541,
- 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607,
- 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671,
- 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727,
- 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797,
- 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863,
- 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923,
- 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003,
- 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057,
- 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129,
- 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211,
- 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259,
- 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337,
- 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409,
- 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481,
- 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547,
- 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621,
- 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673,
- 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751,
- 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813,
- 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909,
- 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967,
- 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011,
- 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087,
- 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167,
- 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233,
- 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309,
- 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399,
- 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443,
- 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507,
- 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573,
- 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653,
- 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711,
- 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791,
- 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849,
- 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897,
- 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007,
- 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073,
- 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133,
- 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211,
- 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271,
- 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329,
- 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379,
- 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473,
- 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563,
- 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637,
- 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701,
- 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779,
- 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833,
- 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907,
- 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971,
- 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027,
- 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121,
- 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207,
- 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253,
- 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349,
- 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457,
- 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517,
- 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561,
- 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621,
- 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691,
- 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757,
- 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853,
- 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919,
- 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009,
- 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087,
- 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161,
- 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231,
- 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291,
- 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369,
- 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443,
- 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537,
- 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609,
- 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677,
- 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731,
- 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803,
- 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861,
- 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941,
- 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011,
- 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091,
- 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161,
- 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227,
- 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311,
- 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377,
- 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433,
- 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491,
- 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587,
- 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649,
- 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733,
- 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791,
- 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857,
- 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929,
- 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037,
- 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099,
- 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163,
- 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247,
- 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303,
- 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369,
- 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459,
- 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531,
- 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627,
- 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691,
- 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771,
- 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859,
- 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937,
- 10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003,
- 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087,
- 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161,
- 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251,
- 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317,
- 11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399,
- 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483,
- 11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551,
- 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657,
- 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731,
- 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813,
- 11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887,
- 11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941,
- 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011,
- 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101,
- 12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161,
- 12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251,
- 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323,
- 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401,
- 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473,
- 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527,
- 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589,
- 12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653,
- 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739,
- 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821,
- 12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907,
- 12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967,
- 12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033,
- 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109,
- 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177,
- 13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259,
- 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337,
- 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421,
- 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499,
- 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597,
- 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681,
- 13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723,
- 13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799,
- 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879,
- 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933,
- 13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033,
- 14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143,
- 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221,
- 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323,
- 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407,
- 14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461,
- 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549,
- 14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627,
- 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699,
- 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753,
- 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821,
- 14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887,
- 14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957,
- 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073,
- 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137,
- 15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217,
- 15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277,
- 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331,
- 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401,
- 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473,
- 15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569,
- 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643,
- 15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727,
- 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773,
- 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859,
- 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919,
- 15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007,
- 16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087,
- 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183,
- 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249,
- 16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349,
- 16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427,
- 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493,
- 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603,
- 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661,
- 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747,
- 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843,
- 16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927,
- 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993,
- 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053,
- 17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159,
- 17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231,
- 17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327,
- 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389,
- 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467,
- 17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519,
- 17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599,
- 17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683,
- 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783,
- 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863,
+ 257, 263,
+ 269, 271, 277, 281, 283, 293, 307, 311,
+ 313, 317, 331, 337, 347, 349, 353, 359,
+ 367, 373, 379, 383, 389, 397, 401, 409,
+ 419, 421, 431, 433, 439, 443, 449, 457,
+ 461, 463, 467, 479, 487, 491, 499, 503,
+ 509, 521, 523, 541, 547, 557, 563, 569,
+ 571, 577, 587, 593, 599, 601, 607, 613,
+ 617, 619, 631, 641, 643, 647, 653, 659,
+ 661, 673, 677, 683, 691, 701, 709, 719,
+ 727, 733, 739, 743, 751, 757, 761, 769,
+ 773, 787, 797, 809, 811, 821, 823, 827,
+ 829, 839, 853, 857, 859, 863, 877, 881,
+ 883, 887, 907, 911, 919, 929, 937, 941,
+ 947, 953, 967, 971, 977, 983, 991, 997,
+ 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049,
+ 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097,
+ 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163,
+ 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223,
+ 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283,
+ 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321,
+ 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423,
+ 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459,
+ 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511,
+ 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571,
+ 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619,
+ 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693,
+ 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747,
+ 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811,
+ 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877,
+ 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949,
+ 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003,
+ 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069,
+ 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129,
+ 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203,
+ 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267,
+ 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311,
+ 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377,
+ 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423,
+ 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503,
+ 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579,
+ 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657,
+ 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693,
+ 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741,
+ 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801,
+ 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861,
+ 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939,
+ 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011,
+ 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079,
+ 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167,
+ 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221,
+ 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301,
+ 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347,
+ 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413,
+ 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491,
+ 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541,
+ 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607,
+ 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671,
+ 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727,
+ 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797,
+ 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863,
+ 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923,
+ 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003,
+ 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057,
+ 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129,
+ 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211,
+ 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259,
+ 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337,
+ 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409,
+ 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481,
+ 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547,
+ 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621,
+ 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673,
+ 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751,
+ 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813,
+ 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909,
+ 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967,
+ 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011,
+ 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087,
+ 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167,
+ 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233,
+ 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309,
+ 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399,
+ 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443,
+ 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507,
+ 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573,
+ 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653,
+ 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711,
+ 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791,
+ 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849,
+ 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897,
+ 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007,
+ 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073,
+ 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133,
+ 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211,
+ 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271,
+ 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329,
+ 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379,
+ 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473,
+ 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563,
+ 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637,
+ 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701,
+ 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779,
+ 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833,
+ 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907,
+ 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971,
+ 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027,
+ 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121,
+ 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207,
+ 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253,
+ 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349,
+ 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457,
+ 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517,
+ 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561,
+ 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621,
+ 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691,
+ 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757,
+ 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853,
+ 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919,
+ 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009,
+ 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087,
+ 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161,
+ 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231,
+ 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291,
+ 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369,
+ 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443,
+ 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537,
+ 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609,
+ 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677,
+ 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731,
+ 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803,
+ 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861,
+ 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941,
+ 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011,
+ 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091,
+ 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161,
+ 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227,
+ 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311,
+ 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377,
+ 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433,
+ 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491,
+ 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587,
+ 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649,
+ 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733,
+ 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791,
+ 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857,
+ 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929,
+ 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037,
+ 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099,
+ 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163,
+ 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247,
+ 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303,
+ 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369,
+ 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459,
+ 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531,
+ 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627,
+ 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691,
+ 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771,
+ 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859,
+ 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937,
+ 10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003,
+ 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087,
+ 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161,
+ 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251,
+ 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317,
+ 11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399,
+ 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483,
+ 11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551,
+ 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657,
+ 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731,
+ 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813,
+ 11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887,
+ 11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941,
+ 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011,
+ 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101,
+ 12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161,
+ 12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251,
+ 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323,
+ 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401,
+ 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473,
+ 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527,
+ 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589,
+ 12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653,
+ 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739,
+ 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821,
+ 12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907,
+ 12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967,
+ 12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033,
+ 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109,
+ 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177,
+ 13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259,
+ 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337,
+ 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421,
+ 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499,
+ 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597,
+ 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681,
+ 13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723,
+ 13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799,
+ 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879,
+ 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933,
+ 13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033,
+ 14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143,
+ 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221,
+ 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323,
+ 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407,
+ 14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461,
+ 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549,
+ 14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627,
+ 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699,
+ 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753,
+ 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821,
+ 14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887,
+ 14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957,
+ 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073,
+ 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137,
+ 15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217,
+ 15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277,
+ 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331,
+ 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401,
+ 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473,
+ 15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569,
+ 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643,
+ 15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727,
+ 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773,
+ 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859,
+ 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919,
+ 15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007,
+ 16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087,
+ 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183,
+ 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249,
+ 16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349,
+ 16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427,
+ 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493,
+ 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603,
+ 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661,
+ 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747,
+ 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843,
+ 16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927,
+ 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993,
+ 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053,
+ 17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159,
+ 17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231,
+ 17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327,
+ 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389,
+ 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467,
+ 17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519,
+ 17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599,
+ 17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683,
+ 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783,
+ 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863,
#endif
};
diff --git a/deps/openssl/openssl/crypto/bn/bn_prime.pl b/deps/openssl/openssl/crypto/bn/bn_prime.pl
index 3fafb6f3e90aa8..6bede65e1dd45f 100644
--- a/deps/openssl/openssl/crypto/bn/bn_prime.pl
+++ b/deps/openssl/openssl/crypto/bn/bn_prime.pl
@@ -26,7 +26,7 @@
# * the code are not to be removed.
# * See the COPYRIGHT file in the SSLeay distribution for more details.
# */
-#
+#
# EOF
print <<\EOF;
@@ -37,21 +37,21 @@
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
- *
+ *
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
+ *
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -66,10 +66,10 @@
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
+ * 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
+ *
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -81,7 +81,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
+ *
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
@@ -100,20 +100,20 @@
}
printf "#ifndef EIGHT_BIT\n";
-printf "#define NUMPRIMES %d\n",$num;
+printf "# define NUMPRIMES %d\n",$num;
printf "typedef unsigned short prime_t;\n";
printf "#else\n";
-printf "#define NUMPRIMES %d\n",$eight;
+printf "# define NUMPRIMES %d\n",$eight;
printf "typedef unsigned char prime_t;\n";
printf "#endif\n";
-print "static const prime_t primes[NUMPRIMES]=\n\t{\n\t";
+print "static const prime_t primes[NUMPRIMES] = {";
$init=0;
for ($i=0; $i <= $#primes; $i++)
{
- printf "\n#ifndef EIGHT_BIT\n\t" if ($primes[$i] > 256) && !($init++);
- printf("\n\t") if (($i%8) == 0) && ($i != 0);
- printf("%4d,",$primes[$i]);
+ printf "\n#ifndef EIGHT_BIT\n " if ($primes[$i] > 256) && !($init++);
+ printf("\n ") if ($i%8) == 0;
+ printf(" %5d,",$primes[$i]);
}
-print "\n#endif\n\t};\n";
+print "\n#endif\n};\n";
diff --git a/deps/openssl/openssl/crypto/bn/bn_print.c b/deps/openssl/openssl/crypto/bn/bn_print.c
index f121fb6e9a08d8..f85a6550a54ee5 100644
--- a/deps/openssl/openssl/crypto/bn/bn_print.c
+++ b/deps/openssl/openssl/crypto/bn/bn_print.c
@@ -82,8 +82,6 @@ char *BN_bn2hex(const BIGNUM *a)
p = buf;
if (a->neg)
*(p++) = '-';
- if (BN_is_zero(a))
- *(p++) = '0';
for (i = a->top - 1; i >= 0; i--) {
for (j = BN_BITS2 - 8; j >= 0; j -= 8) {
/* strip leading zeros */
diff --git a/deps/openssl/openssl/crypto/comp/c_rle.c b/deps/openssl/openssl/crypto/comp/c_rle.c
index e9aabbd166a2ec..41919613eec5a3 100644
--- a/deps/openssl/openssl/crypto/comp/c_rle.c
+++ b/deps/openssl/openssl/crypto/comp/c_rle.c
@@ -31,12 +31,11 @@ static int rle_compress_block(COMP_CTX *ctx, unsigned char *out,
unsigned int olen, unsigned char *in,
unsigned int ilen)
{
- /* int i; */
+ if (ilen == 0)
+ return 0;
- if (ilen == 0 || olen < (ilen - 1)) {
- /* ZZZZZZZZZZZZZZZZZZZZZZ */
- return (-1);
- }
+ if (olen <= ilen)
+ return -1;
*(out++) = 0;
memcpy(out, in, ilen);
@@ -49,14 +48,16 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
{
int i;
- if (olen < (ilen - 1)) {
- /* ZZZZZZZZZZZZZZZZZZZZZZ */
- return (-1);
- }
+ if (ilen == 0)
+ return 0;
+
+ if (olen < (ilen - 1))
+ return -1;
i = *(in++);
- if (i == 0) {
- memcpy(out, in, ilen - 1);
- }
+ if (i != 0)
+ return -1;
+
+ memcpy(out, in, ilen - 1);
return (ilen - 1);
}
diff --git a/deps/openssl/openssl/crypto/conf/conf.h b/deps/openssl/openssl/crypto/conf/conf.h
index 8d926d5d8268f5..fe49113080b700 100644
--- a/deps/openssl/openssl/crypto/conf/conf.h
+++ b/deps/openssl/openssl/crypto/conf/conf.h
@@ -259,6 +259,7 @@ void ERR_load_CONF_strings(void);
# define CONF_R_NO_VALUE 108
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
# define CONF_R_UNKNOWN_MODULE_NAME 113
+# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
#ifdef __cplusplus
diff --git a/deps/openssl/openssl/crypto/conf/conf_def.c b/deps/openssl/openssl/crypto/conf/conf_def.c
index 68c77cec7d8b46..75e309aaca8184 100644
--- a/deps/openssl/openssl/crypto/conf/conf_def.c
+++ b/deps/openssl/openssl/crypto/conf/conf_def.c
@@ -69,6 +69,12 @@
#include
#include
+/*
+ * The maximum length we can grow a value to after variable expansion. 64k
+ * should be more than enough for all reasonable uses.
+ */
+#define MAX_CONF_VALUE_LENGTH 65536
+
static char *eat_ws(CONF *conf, char *p);
static char *eat_alpha_numeric(CONF *conf, char *p);
static void clear_comments(CONF *conf, char *p);
@@ -530,6 +536,8 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
} else if (IS_EOF(conf, *from))
break;
else if (*from == '$') {
+ size_t newsize;
+
/* try to expand it */
rrp = NULL;
s = &(from[1]);
@@ -584,8 +592,12 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
CONFerr(CONF_F_STR_COPY, CONF_R_VARIABLE_HAS_NO_VALUE);
goto err;
}
- if (!BUF_MEM_grow_clean(buf,
- (strlen(p) + buf->length - (e - from)))) {
+ newsize = strlen(p) + buf->length - (e - from);
+ if (newsize > MAX_CONF_VALUE_LENGTH) {
+ CONFerr(CONF_F_STR_COPY, CONF_R_VARIABLE_EXPANSION_TOO_LONG);
+ goto err;
+ }
+ if (!BUF_MEM_grow_clean(buf, newsize)) {
CONFerr(CONF_F_STR_COPY, ERR_R_MALLOC_FAILURE);
goto err;
}
diff --git a/deps/openssl/openssl/crypto/conf/conf_err.c b/deps/openssl/openssl/crypto/conf/conf_err.c
index bb5e2fe25215b8..b0b6896f837ee8 100644
--- a/deps/openssl/openssl/crypto/conf/conf_err.c
+++ b/deps/openssl/openssl/crypto/conf/conf_err.c
@@ -115,6 +115,8 @@ static ERR_STRING_DATA CONF_str_reasons[] = {
{ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION),
"unable to create new section"},
{ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME), "unknown module name"},
+ {ERR_REASON(CONF_R_VARIABLE_EXPANSION_TOO_LONG),
+ "variable expansion too long"},
{ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"},
{0, NULL}
};
diff --git a/deps/openssl/openssl/crypto/des/Makefile b/deps/openssl/openssl/crypto/des/Makefile
index 8b5166ca9ff5fa..89156ba5ce2dcc 100644
--- a/deps/openssl/openssl/crypto/des/Makefile
+++ b/deps/openssl/openssl/crypto/des/Makefile
@@ -107,7 +107,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f *.s *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f *.s *.S *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/deps/openssl/openssl/crypto/des/set_key.c b/deps/openssl/openssl/crypto/des/set_key.c
index 8fd8fe14bb6316..d9c5e7fcb3bbfb 100644
--- a/deps/openssl/openssl/crypto/des/set_key.c
+++ b/deps/openssl/openssl/crypto/des/set_key.c
@@ -120,7 +120,7 @@ int DES_check_key_parity(const_DES_cblock *key)
}
/*-
- * Weak and semi week keys as take from
+ * Weak and semi weak keys as taken from
* %A D.W. Davies
* %A W.L. Price
* %T Security for Computer Networks
diff --git a/deps/openssl/openssl/crypto/dh/dh.h b/deps/openssl/openssl/crypto/dh/dh.h
index a5bd9016aae85a..a228c7a7a4c3a1 100644
--- a/deps/openssl/openssl/crypto/dh/dh.h
+++ b/deps/openssl/openssl/crypto/dh/dh.h
@@ -182,12 +182,29 @@ struct dh_st {
*/
# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
-# define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
- (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
-# define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
- (unsigned char *)(x))
-# define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
-# define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
+# define d2i_DHparams_fp(fp,x) \
+ (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
+ (char *(*)())d2i_DHparams, \
+ (fp), \
+ (unsigned char **)(x))
+# define i2d_DHparams_fp(fp,x) \
+ ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x))
+# define d2i_DHparams_bio(bp,x) \
+ ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x)
+# define i2d_DHparams_bio(bp,x) \
+ ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
+
+# define d2i_DHxparams_fp(fp,x) \
+ (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
+ (char *(*)())d2i_DHxparams, \
+ (fp), \
+ (unsigned char **)(x))
+# define i2d_DHxparams_fp(fp,x) \
+ ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x))
+# define d2i_DHxparams_bio(bp,x) \
+ ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x)
+# define i2d_DHxparams_bio(bp,x) \
+ ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x)
DH *DHparams_dup(DH *);
diff --git a/deps/openssl/openssl/crypto/ec/ec_ameth.c b/deps/openssl/openssl/crypto/ec/ec_ameth.c
index d089af7a28300b..2c41c6e7a9f181 100644
--- a/deps/openssl/openssl/crypto/ec/ec_ameth.c
+++ b/deps/openssl/openssl/crypto/ec/ec_ameth.c
@@ -342,8 +342,10 @@ static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
}
if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), 0,
- ptype, pval, ep, eplen))
+ ptype, pval, ep, eplen)) {
+ OPENSSL_free(ep);
return 0;
+ }
return 1;
}
diff --git a/deps/openssl/openssl/crypto/ec/ec_asn1.c b/deps/openssl/openssl/crypto/ec/ec_asn1.c
index 33abf61f44417c..b0cd3e1788dcae 100644
--- a/deps/openssl/openssl/crypto/ec/ec_asn1.c
+++ b/deps/openssl/openssl/crypto/ec/ec_asn1.c
@@ -62,17 +62,22 @@
#include
#include
+#define OSSL_NELEM(x) (sizeof(x)/sizeof(x[0]))
+
int EC_GROUP_get_basis_type(const EC_GROUP *group)
{
- int i = 0;
+ int i;
if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
NID_X9_62_characteristic_two_field)
/* everything else is currently not supported */
return 0;
- while (group->poly[i] != 0)
- i++;
+ /* Find the last non-zero element of group->poly[] */
+ for (i = 0;
+ i < (int)OSSL_NELEM(group->poly) && group->poly[i] != 0;
+ i++)
+ continue;
if (i == 4)
return NID_X9_62_ppBasis;
diff --git a/deps/openssl/openssl/crypto/ec/ec_mult.c b/deps/openssl/openssl/crypto/ec/ec_mult.c
index 23b8c3089b2fa8..24ca67a6ef1e71 100644
--- a/deps/openssl/openssl/crypto/ec/ec_mult.c
+++ b/deps/openssl/openssl/crypto/ec/ec_mult.c
@@ -68,10 +68,14 @@
#include "ec_lcl.h"
/*
- * This file implements the wNAF-based interleaving multi-exponentation method
- * ();
- * for multiplication with precomputation, we use wNAF splitting
- * ().
+ * This file implements the wNAF-based interleaving multi-exponentiation method
+ * Formerly at:
+ * http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html#multiexp
+ * You might now find it here:
+ * http://link.springer.com/chapter/10.1007%2F3-540-45537-X_13
+ * http://www.bmoeller.de/pdf/TI-01-08.multiexp.pdf
+ * For multiplication with precomputation, we use wNAF splitting, formerly at:
+ * http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html#fastexp
*/
/* structure for precomputed multiples of the generator */
diff --git a/deps/openssl/openssl/crypto/ec/eck_prn.c b/deps/openssl/openssl/crypto/ec/eck_prn.c
index df9b37a750d625..176ec1f17308bd 100644
--- a/deps/openssl/openssl/crypto/ec/eck_prn.c
+++ b/deps/openssl/openssl/crypto/ec/eck_prn.c
@@ -342,7 +342,7 @@ static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
size_t len, int off)
{
size_t i;
- char str[128];
+ char str[128 + 1 + 4];
if (buf == NULL)
return 1;
diff --git a/deps/openssl/openssl/crypto/engine/eng_cryptodev.c b/deps/openssl/openssl/crypto/engine/eng_cryptodev.c
index 2a2b95ce837e24..af59471c4771cf 100644
--- a/deps/openssl/openssl/crypto/engine/eng_cryptodev.c
+++ b/deps/openssl/openssl/crypto/engine/eng_cryptodev.c
@@ -810,14 +810,15 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
/* if application doesn't support one buffer */
- state->mac_data =
+ char *mac_data =
OPENSSL_realloc(state->mac_data, state->mac_len + count);
- if (!state->mac_data) {
+ if (mac_data == NULL) {
printf("cryptodev_digest_update: realloc failed\n");
return (0);
}
+ state->mac_data = mac_data;
memcpy(state->mac_data + state->mac_len, data, count);
state->mac_len += count;
diff --git a/deps/openssl/openssl/crypto/err/err.c b/deps/openssl/openssl/crypto/err/err.c
index 52dc9a5ddd873c..0b1fcfc1f1a5de 100644
--- a/deps/openssl/openssl/crypto/err/err.c
+++ b/deps/openssl/openssl/crypto/err/err.c
@@ -172,6 +172,7 @@ static ERR_STRING_DATA ERR_str_functs[] = {
# endif
{ERR_PACK(0, SYS_F_OPENDIR, 0), "opendir"},
{ERR_PACK(0, SYS_F_FREAD, 0), "fread"},
+ {ERR_PACK(0, SYS_F_FFLUSH, 0), "fflush"},
{0, NULL},
};
diff --git a/deps/openssl/openssl/crypto/err/err.h b/deps/openssl/openssl/crypto/err/err.h
index 585aa8ba3df935..f42365620db0c0 100644
--- a/deps/openssl/openssl/crypto/err/err.h
+++ b/deps/openssl/openssl/crypto/err/err.h
@@ -258,6 +258,7 @@ typedef struct err_state_st {
# define SYS_F_WSASTARTUP 9/* Winsock stuff */
# define SYS_F_OPENDIR 10
# define SYS_F_FREAD 11
+# define SYS_F_FFLUSH 18
/* reasons */
# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */
diff --git a/deps/openssl/openssl/crypto/evp/e_aes.c b/deps/openssl/openssl/crypto/evp/e_aes.c
index 7c62d327a1f613..b45b364466acb8 100644
--- a/deps/openssl/openssl/crypto/evp/e_aes.c
+++ b/deps/openssl/openssl/crypto/evp/e_aes.c
@@ -1120,6 +1120,8 @@ BLOCK_CIPHER_generic_pack(NID_aes, 128, EVP_CIPH_FLAG_FIPS)
static int aes_gcm_cleanup(EVP_CIPHER_CTX *c)
{
EVP_AES_GCM_CTX *gctx = c->cipher_data;
+ if (gctx == NULL)
+ return 0;
OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm));
if (gctx->iv != c->iv)
OPENSSL_free(gctx->iv);
@@ -1235,10 +1237,15 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
unsigned int len = c->buf[arg - 2] << 8 | c->buf[arg - 1];
/* Correct length for explicit IV */
+ if (len < EVP_GCM_TLS_EXPLICIT_IV_LEN)
+ return 0;
len -= EVP_GCM_TLS_EXPLICIT_IV_LEN;
/* If decrypting correct for tag too */
- if (!c->encrypt)
+ if (!c->encrypt) {
+ if (len < EVP_GCM_TLS_TAG_LEN)
+ return 0;
len -= EVP_GCM_TLS_TAG_LEN;
+ }
c->buf[arg - 2] = len >> 8;
c->buf[arg - 1] = len & 0xff;
}
diff --git a/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c b/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c
index 6dfd590a4a2c8e..d114710e98ec4e 100644
--- a/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha1.c
@@ -859,6 +859,8 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
key->payload_length = len;
if ((key->aux.tls_ver =
p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) {
+ if (len < AES_BLOCK_SIZE)
+ return 0;
len -= AES_BLOCK_SIZE;
p[arg - 2] = len >> 8;
p[arg - 1] = len;
diff --git a/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c b/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c
index 46c9d033895b87..917ae0751dee3f 100644
--- a/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c
+++ b/deps/openssl/openssl/crypto/evp/e_aes_cbc_hmac_sha256.c
@@ -825,15 +825,19 @@ static int aesni_cbc_hmac_sha256_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
case EVP_CTRL_AEAD_TLS1_AAD:
{
unsigned char *p = ptr;
- unsigned int len = p[arg - 2] << 8 | p[arg - 1];
+ unsigned int len;
if (arg != EVP_AEAD_TLS1_AAD_LEN)
return -1;
+ len = p[arg - 2] << 8 | p[arg - 1];
+
if (ctx->encrypt) {
key->payload_length = len;
if ((key->aux.tls_ver =
p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) {
+ if (len < AES_BLOCK_SIZE)
+ return 0;
len -= AES_BLOCK_SIZE;
p[arg - 2] = len >> 8;
p[arg - 1] = len;
diff --git a/deps/openssl/openssl/crypto/evp/e_des3.c b/deps/openssl/openssl/crypto/evp/e_des3.c
index 0e910d6d8085b9..ab8126e5c9cf68 100644
--- a/deps/openssl/openssl/crypto/evp/e_des3.c
+++ b/deps/openssl/openssl/crypto/evp/e_des3.c
@@ -212,6 +212,8 @@ static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
size_t n;
unsigned char c[1], d[1];
+ if (!EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
+ inl *= 8;
for (n = 0; n < inl; ++n) {
c[0] = (in[n / 8] & (1 << (7 - n % 8))) ? 0x80 : 0;
DES_ede3_cfb_encrypt(c, d, 1, 1,
diff --git a/deps/openssl/openssl/crypto/evp/evp_enc.c b/deps/openssl/openssl/crypto/evp/evp_enc.c
index 0e40f09f2f91f4..be577bac767fe9 100644
--- a/deps/openssl/openssl/crypto/evp/evp_enc.c
+++ b/deps/openssl/openssl/crypto/evp/evp_enc.c
@@ -182,6 +182,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
if (ctx->cipher->ctx_size) {
ctx->cipher_data = OPENSSL_malloc(ctx->cipher->ctx_size);
if (!ctx->cipher_data) {
+ ctx->cipher = NULL;
EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -193,6 +194,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
ctx->flags &= EVP_CIPHER_CTX_FLAG_WRAP_ALLOW;
if (ctx->cipher->flags & EVP_CIPH_CTRL_INIT) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) {
+ ctx->cipher = NULL;
EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR);
return 0;
}
@@ -654,6 +656,7 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
if (in->cipher_data && in->cipher->ctx_size) {
out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size);
if (!out->cipher_data) {
+ out->cipher = NULL;
EVPerr(EVP_F_EVP_CIPHER_CTX_COPY, ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -661,6 +664,10 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
}
if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY)
- return in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out);
+ if (!in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out)) {
+ out->cipher = NULL;
+ EVPerr(EVP_F_EVP_CIPHER_CTX_COPY, EVP_R_INITIALIZATION_ERROR);
+ return 0;
+ }
return 1;
}
diff --git a/deps/openssl/openssl/crypto/evp/pmeth_lib.c b/deps/openssl/openssl/crypto/evp/pmeth_lib.c
index d06686290459c7..b7b7bdcd0290e6 100644
--- a/deps/openssl/openssl/crypto/evp/pmeth_lib.c
+++ b/deps/openssl/openssl/crypto/evp/pmeth_lib.c
@@ -188,6 +188,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
if (pmeth->init) {
if (pmeth->init(ret) <= 0) {
+ ret->pmeth = NULL;
EVP_PKEY_CTX_free(ret);
return NULL;
}
@@ -315,6 +316,7 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx)
if (pctx->pmeth->copy(rctx, pctx) > 0)
return rctx;
+ rctx->pmeth = NULL;
EVP_PKEY_CTX_free(rctx);
return NULL;
diff --git a/deps/openssl/openssl/crypto/ex_data.c b/deps/openssl/openssl/crypto/ex_data.c
index f96a51781ab065..108a1959eacfc2 100644
--- a/deps/openssl/openssl/crypto/ex_data.c
+++ b/deps/openssl/openssl/crypto/ex_data.c
@@ -331,7 +331,11 @@ static EX_CLASS_ITEM *def_get_class(int class_index)
* from the insert will be NULL
*/
(void)lh_EX_CLASS_ITEM_insert(ex_data, gen);
- p = gen;
+ p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d);
+ if (p != gen) {
+ sk_CRYPTO_EX_DATA_FUNCS_free(gen->meth);
+ OPENSSL_free(gen);
+ }
}
}
}
@@ -455,7 +459,7 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
CRYPTO_EX_DATA *from)
{
int mx, j, i;
- char *ptr;
+ void *ptr;
CRYPTO_EX_DATA_FUNCS **storage = NULL;
EX_CLASS_ITEM *item;
if (!from->sk)
@@ -469,6 +473,8 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
if (j < mx)
mx = j;
if (mx > 0) {
+ if (!CRYPTO_set_ex_data(to, mx - 1, NULL))
+ goto skip;
storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS *));
if (!storage)
goto skip;
@@ -499,11 +505,12 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
int mx, i;
EX_CLASS_ITEM *item;
void *ptr;
+ CRYPTO_EX_DATA_FUNCS *f;
CRYPTO_EX_DATA_FUNCS **storage = NULL;
if (ex_data == NULL)
- return;
+ goto err;
if ((item = def_get_class(class_index)) == NULL)
- return;
+ goto err;
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth);
if (mx > 0) {
@@ -515,23 +522,23 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
}
skip:
CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA);
- if ((mx > 0) && !storage) {
- CRYPTOerr(CRYPTO_F_INT_FREE_EX_DATA, ERR_R_MALLOC_FAILURE);
- return;
- }
for (i = 0; i < mx; i++) {
- if (storage[i] && storage[i]->free_func) {
+ if (storage != NULL)
+ f = storage[i];
+ else {
+ CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
+ f = sk_CRYPTO_EX_DATA_FUNCS_value(item->meth, i);
+ CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA);
+ }
+ if (f != NULL && f->free_func != NULL) {
ptr = CRYPTO_get_ex_data(ad, i);
- storage[i]->free_func(obj, ptr, ad, i,
- storage[i]->argl, storage[i]->argp);
+ f->free_func(obj, ptr, ad, i, f->argl, f->argp);
}
}
- if (storage)
- OPENSSL_free(storage);
- if (ad->sk) {
- sk_void_free(ad->sk);
- ad->sk = NULL;
- }
+ OPENSSL_free(storage);
+ err:
+ sk_void_free(ad->sk);
+ ad->sk = NULL;
}
/********************************************************************/
diff --git a/deps/openssl/openssl/crypto/hmac/hm_pmeth.c b/deps/openssl/openssl/crypto/hmac/hm_pmeth.c
index 0ffff79cc4503b..0a59a01cf0e81f 100644
--- a/deps/openssl/openssl/crypto/hmac/hm_pmeth.c
+++ b/deps/openssl/openssl/crypto/hmac/hm_pmeth.c
@@ -99,15 +99,18 @@ static int pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
sctx = src->data;
dctx = dst->data;
dctx->md = sctx->md;
- HMAC_CTX_init(&dctx->ctx);
if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx))
- return 0;
- if (sctx->ktmp.data) {
+ goto err;
+ if (sctx->ktmp.data != NULL) {
if (!ASN1_OCTET_STRING_set(&dctx->ktmp,
sctx->ktmp.data, sctx->ktmp.length))
- return 0;
+ goto err;
}
return 1;
+ err:
+ HMAC_CTX_cleanup(&dctx->ctx);
+ OPENSSL_free(dctx);
+ return 0;
}
static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx)
diff --git a/deps/openssl/openssl/crypto/include/internal/bn_conf.h b/deps/openssl/openssl/crypto/include/internal/bn_conf.h
new file mode 100644
index 00000000000000..34bd8b78b4f90f
--- /dev/null
+++ b/deps/openssl/openssl/crypto/include/internal/bn_conf.h
@@ -0,0 +1,28 @@
+/* WARNING: do not edit! */
+/* Generated by Makefile from crypto/include/internal/bn_conf.h.in */
+/*
+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_BN_CONF_H
+# define HEADER_BN_CONF_H
+
+/*
+ * The contents of this file are not used in the UEFI build, as
+ * both 32-bit and 64-bit builds are supported from a single run
+ * of the Configure script.
+ */
+
+/* Should we define BN_DIV2W here? */
+
+/* Only one for the following should be defined */
+#define SIXTY_FOUR_BIT_LONG
+#undef SIXTY_FOUR_BIT
+#undef THIRTY_TWO_BIT
+
+#endif
diff --git a/deps/openssl/openssl/crypto/include/internal/dso_conf.h b/deps/openssl/openssl/crypto/include/internal/dso_conf.h
new file mode 100644
index 00000000000000..7a52dd1f1a1159
--- /dev/null
+++ b/deps/openssl/openssl/crypto/include/internal/dso_conf.h
@@ -0,0 +1,16 @@
+/* WARNING: do not edit! */
+/* Generated by Makefile from crypto/include/internal/dso_conf.h.in */
+/*
+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef HEADER_DSO_CONF_H
+# define HEADER_DSO_CONF_H
+
+# define DSO_EXTENSION ".so"
+#endif
diff --git a/deps/openssl/openssl/crypto/md5/Makefile b/deps/openssl/openssl/crypto/md5/Makefile
index f5240da74cd791..9942cb4e37a692 100644
--- a/deps/openssl/openssl/crypto/md5/Makefile
+++ b/deps/openssl/openssl/crypto/md5/Makefile
@@ -90,7 +90,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/deps/openssl/openssl/crypto/mem.c b/deps/openssl/openssl/crypto/mem.c
index 06c3960cc6c05b..dd4c9ce9e0b86b 100644
--- a/deps/openssl/openssl/crypto/mem.c
+++ b/deps/openssl/openssl/crypto/mem.c
@@ -150,12 +150,12 @@ static long (*get_debug_options_func) (void) = NULL;
int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t),
void (*f) (void *))
{
- /* Dummy call just to ensure OPENSSL_init() gets linked in */
- OPENSSL_init();
if (!allow_customize)
return 0;
if ((m == 0) || (r == 0) || (f == 0))
return 0;
+ /* Dummy call just to ensure OPENSSL_init() gets linked in */
+ OPENSSL_init();
malloc_func = m;
malloc_ex_func = default_malloc_ex;
realloc_func = r;
diff --git a/deps/openssl/openssl/crypto/modes/Makefile b/deps/openssl/openssl/crypto/modes/Makefile
index a7863d98be2f5c..2528f4a1b9cad4 100644
--- a/deps/openssl/openssl/crypto/modes/Makefile
+++ b/deps/openssl/openssl/crypto/modes/Makefile
@@ -106,7 +106,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f *.s *.S *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/deps/openssl/openssl/crypto/o_dir.c b/deps/openssl/openssl/crypto/o_dir.c
index f9dbed87112793..fb3b2fd8e4370f 100644
--- a/deps/openssl/openssl/crypto/o_dir.c
+++ b/deps/openssl/openssl/crypto/o_dir.c
@@ -73,7 +73,8 @@
#include "o_dir.h"
#define LPDIR_H
-#if defined OPENSSL_SYS_UNIX || defined DJGPP
+#if defined OPENSSL_SYS_UNIX || defined DJGPP \
+ || (defined __VMS_VER && __VMS_VER >= 70000000)
# include "LPdir_unix.c"
#elif defined OPENSSL_SYS_VMS
# include "LPdir_vms.c"
diff --git a/deps/openssl/openssl/crypto/o_time.c b/deps/openssl/openssl/crypto/o_time.c
index b99e5990b4e4e9..04d805d9a96d04 100755
--- a/deps/openssl/openssl/crypto/o_time.c
+++ b/deps/openssl/openssl/crypto/o_time.c
@@ -106,11 +106,8 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
struct tm *ts = NULL;
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_OS2) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_SUNOS)
- /*
- * should return &data, but doesn't on some systems, so we don't even
- * look at the return value
- */
- gmtime_r(timer, result);
+ if (gmtime_r(timer, result) == NULL)
+ return NULL;
ts = result;
#elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK)
ts = gmtime(timer);
diff --git a/deps/openssl/openssl/crypto/opensslv.h b/deps/openssl/openssl/crypto/opensslv.h
index 645dd0793f32e0..825a330abc8825 100644
--- a/deps/openssl/openssl/crypto/opensslv.h
+++ b/deps/openssl/openssl/crypto/opensslv.h
@@ -30,11 +30,11 @@ extern "C" {
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
* major minor fix final patch/beta)
*/
-# define OPENSSL_VERSION_NUMBER 0x100020bfL
+# define OPENSSL_VERSION_NUMBER 0x100020cfL
# ifdef OPENSSL_FIPS
-# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k-fips 26 Jan 2017"
+# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l-fips 25 May 2017"
# else
-# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k 26 Jan 2017"
+# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l 25 May 2017"
# endif
# define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
diff --git a/deps/openssl/openssl/crypto/perlasm/x86_64-xlate.pl b/deps/openssl/openssl/crypto/perlasm/x86_64-xlate.pl
index b7ae40b4dbfa98..d19195ea06a87d 100755
--- a/deps/openssl/openssl/crypto/perlasm/x86_64-xlate.pl
+++ b/deps/openssl/openssl/crypto/perlasm/x86_64-xlate.pl
@@ -206,8 +206,9 @@
}
sprintf "\$%s",$self->{value};
} else {
- $self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig if ($masm);
- sprintf "%s",$self->{value};
+ my $value = $self->{value};
+ $value =~ s/0x([0-9a-f]+)/0$1h/ig if ($masm);
+ sprintf "%s",$value;
}
}
}
@@ -414,7 +415,7 @@
}
}
}
-{ package expr; # pick up expressioins
+{ package expr; # pick up expressions
sub re {
my $self = shift; # single instance is enough...
local *line = shift;
@@ -977,7 +978,7 @@ sub rxb {
# the area above user stack pointer in true asynchronous manner...
#
# All the above means that if assembler programmer adheres to Unix
-# register and stack layout, but disregards the "red zone" existense,
+# register and stack layout, but disregards the "red zone" existence,
# it's possible to use following prologue and epilogue to "gear" from
# Unix to Win64 ABI in leaf functions with not more than 6 arguments.
#
diff --git a/deps/openssl/openssl/crypto/pkcs12/p12_mutl.c b/deps/openssl/openssl/crypto/pkcs12/p12_mutl.c
index cbf34da05adadb..b1f7381a6fb5e4 100644
--- a/deps/openssl/openssl/crypto/pkcs12/p12_mutl.c
+++ b/deps/openssl/openssl/crypto/pkcs12/p12_mutl.c
@@ -159,7 +159,10 @@ int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
const EVP_MD *md_type)
{
- if (!(p12->mac = PKCS12_MAC_DATA_new()))
+ PKCS12_MAC_DATA_free(p12->mac);
+ p12->mac = NULL;
+
+ if ((p12->mac = PKCS12_MAC_DATA_new()) == NULL)
return PKCS12_ERROR;
if (iter > 1) {
if (!(p12->mac->iter = M_ASN1_INTEGER_new())) {
diff --git a/deps/openssl/openssl/crypto/ppccap.c b/deps/openssl/openssl/crypto/ppccap.c
index 74af4732b5fa8d..60566b1a5f52fb 100644
--- a/deps/openssl/openssl/crypto/ppccap.c
+++ b/deps/openssl/openssl/crypto/ppccap.c
@@ -7,6 +7,10 @@
#if defined(__linux) || defined(_AIX)
# include
#endif
+#if defined(__APPLE__) && defined(__MACH__)
+# include
+# include
+#endif
#include
#include
@@ -123,6 +127,26 @@ void OPENSSL_cpuid_setup(void)
}
#endif
+#if defined(__APPLE__) && defined(__MACH__)
+ {
+ int val;
+ size_t len = sizeof(val);
+
+ if (sysctlbyname("hw.optional.64bitops", &val, &len, NULL, 0) == 0) {
+ if (val)
+ OPENSSL_ppccap_P |= PPC_FPU64;
+ }
+
+ len = sizeof(val);
+ if (sysctlbyname("hw.optional.altivec", &val, &len, NULL, 0) == 0) {
+ if (val)
+ OPENSSL_ppccap_P |= PPC_ALTIVEC;
+ }
+
+ return;
+ }
+#endif
+
memset(&ill_act, 0, sizeof(ill_act));
ill_act.sa_handler = ill_handler;
ill_act.sa_mask = all_masked;
diff --git a/deps/openssl/openssl/crypto/rand/md_rand.c b/deps/openssl/openssl/crypto/rand/md_rand.c
index bd76e23e3deb33..29e465b07524b1 100644
--- a/deps/openssl/openssl/crypto/rand/md_rand.c
+++ b/deps/openssl/openssl/crypto/rand/md_rand.c
@@ -266,17 +266,21 @@ static void ssleay_rand_add(const void *buf, int num, double add)
j = (num - i);
j = (j > MD_DIGEST_LENGTH) ? MD_DIGEST_LENGTH : j;
- MD_Init(&m);
- MD_Update(&m, local_md, MD_DIGEST_LENGTH);
+ if (!MD_Init(&m) ||
+ !MD_Update(&m, local_md, MD_DIGEST_LENGTH))
+ goto err;
k = (st_idx + j) - STATE_SIZE;
if (k > 0) {
- MD_Update(&m, &(state[st_idx]), j - k);
- MD_Update(&m, &(state[0]), k);
+ if (!MD_Update(&m, &(state[st_idx]), j - k) ||
+ !MD_Update(&m, &(state[0]), k))
+ goto err;
} else
- MD_Update(&m, &(state[st_idx]), j);
+ if (!MD_Update(&m, &(state[st_idx]), j))
+ goto err;
/* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */
- MD_Update(&m, buf, j);
+ if (!MD_Update(&m, buf, j))
+ goto err;
/*
* We know that line may cause programs such as purify and valgrind
* to complain about use of uninitialized data. The problem is not,
@@ -285,8 +289,9 @@ static void ssleay_rand_add(const void *buf, int num, double add)
* insecure keys.
*/
- MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c));
- MD_Final(&m, local_md);
+ if (!MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)) ||
+ !MD_Final(&m, local_md))
+ goto err;
md_c[1]++;
buf = (const char *)buf + j;
@@ -305,7 +310,6 @@ static void ssleay_rand_add(const void *buf, int num, double add)
st_idx = 0;
}
}
- EVP_MD_CTX_cleanup(&m);
if (!do_not_lock)
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
@@ -326,6 +330,9 @@ static void ssleay_rand_add(const void *buf, int num, double add)
#if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
assert(md_c[1] == md_count[1]);
#endif
+
+ err:
+ EVP_MD_CTX_cleanup(&m);
}
static void ssleay_rand_seed(const void *buf, int num)
@@ -469,15 +476,18 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
/* num_ceil -= MD_DIGEST_LENGTH/2 */
j = (num >= MD_DIGEST_LENGTH / 2) ? MD_DIGEST_LENGTH / 2 : num;
num -= j;
- MD_Init(&m);
+ if (!MD_Init(&m))
+ goto err;
#ifndef GETPID_IS_MEANINGLESS
if (curr_pid) { /* just in the first iteration to save time */
- MD_Update(&m, (unsigned char *)&curr_pid, sizeof curr_pid);
+ if (!MD_Update(&m, (unsigned char *)&curr_pid, sizeof curr_pid))
+ goto err;
curr_pid = 0;
}
#endif
- MD_Update(&m, local_md, MD_DIGEST_LENGTH);
- MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c));
+ if (!MD_Update(&m, local_md, MD_DIGEST_LENGTH) ||
+ !MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)))
+ goto err;
#ifndef PURIFY /* purify complains */
/*
@@ -487,16 +497,21 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
* builds it is not used: the removal of such a small source of
* entropy has negligible impact on security.
*/
- MD_Update(&m, buf, j);
+ if (!MD_Update(&m, buf, j))
+ goto err;
#endif
k = (st_idx + MD_DIGEST_LENGTH / 2) - st_num;
if (k > 0) {
- MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2 - k);
- MD_Update(&m, &(state[0]), k);
- } else
- MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2);
- MD_Final(&m, local_md);
+ if (!MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2 - k) ||
+ !MD_Update(&m, &(state[0]), k))
+ goto err;
+ } else {
+ if (!MD_Update(&m, &(state[st_idx]), MD_DIGEST_LENGTH / 2))
+ goto err;
+ }
+ if (!MD_Final(&m, local_md))
+ goto err;
for (i = 0; i < MD_DIGEST_LENGTH / 2; i++) {
/* may compete with other threads */
@@ -508,13 +523,18 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
}
}
- MD_Init(&m);
- MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c));
- MD_Update(&m, local_md, MD_DIGEST_LENGTH);
+ if (!MD_Init(&m) ||
+ !MD_Update(&m, (unsigned char *)&(md_c[0]), sizeof(md_c)) ||
+ !MD_Update(&m, local_md, MD_DIGEST_LENGTH))
+ goto err;
if (lock)
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
- MD_Update(&m, md, MD_DIGEST_LENGTH);
- MD_Final(&m, md);
+ if (!MD_Update(&m, md, MD_DIGEST_LENGTH) ||
+ !MD_Final(&m, md)) {
+ if (lock)
+ CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
+ goto err;
+ }
if (lock)
CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
@@ -529,6 +549,10 @@ int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo, int lock)
"http://www.openssl.org/support/faq.html");
return (0);
}
+
+ err:
+ EVP_MD_CTX_cleanup(&m);
+ return (0);
}
static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num)
diff --git a/deps/openssl/openssl/crypto/rc4/Makefile b/deps/openssl/openssl/crypto/rc4/Makefile
index 7434ff737e6613..a495324cc6b5ae 100644
--- a/deps/openssl/openssl/crypto/rc4/Makefile
+++ b/deps/openssl/openssl/crypto/rc4/Makefile
@@ -100,7 +100,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/deps/openssl/openssl/crypto/rsa/rsa_pmeth.c b/deps/openssl/openssl/crypto/rsa/rsa_pmeth.c
index ac583bf60b0181..8896e2e977149b 100644
--- a/deps/openssl/openssl/crypto/rsa/rsa_pmeth.c
+++ b/deps/openssl/openssl/crypto/rsa/rsa_pmeth.c
@@ -446,19 +446,14 @@ static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx,
int ret;
RSA_PKEY_CTX *rctx = ctx->data;
if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
- int i;
if (!setup_tbuf(rctx, ctx))
return -1;
ret = RSA_private_decrypt(inlen, in, rctx->tbuf,
ctx->pkey->pkey.rsa, RSA_NO_PADDING);
if (ret <= 0)
return ret;
- for (i = 0; i < ret; i++) {
- if (rctx->tbuf[i])
- break;
- }
- ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf + i,
- ret - i, ret,
+ ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf,
+ ret, ret,
rctx->oaep_label,
rctx->oaep_labellen,
rctx->md, rctx->mgf1md);
diff --git a/deps/openssl/openssl/crypto/rsa/rsa_pss.c b/deps/openssl/openssl/crypto/rsa/rsa_pss.c
index 41bc0844e48ed9..2c3fd73b0996a9 100644
--- a/deps/openssl/openssl/crypto/rsa/rsa_pss.c
+++ b/deps/openssl/openssl/crypto/rsa/rsa_pss.c
@@ -122,7 +122,11 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
EM++;
emLen--;
}
- if (emLen < (hLen + sLen + 2)) { /* sLen can be small negative */
+ if (emLen < hLen + 2) {
+ RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE);
+ goto err;
+ }
+ if (sLen > emLen - hLen - 2) { /* sLen can be small negative */
RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE);
goto err;
}
@@ -222,9 +226,14 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
*EM++ = 0;
emLen--;
}
+ if (emLen < hLen + 2) {
+ RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,
+ RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ goto err;
+ }
if (sLen == -2) {
sLen = emLen - hLen - 2;
- } else if (emLen < (hLen + sLen + 2)) {
+ } else if (sLen > emLen - hLen - 2) {
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,
RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
goto err;
diff --git a/deps/openssl/openssl/crypto/sha/Makefile b/deps/openssl/openssl/crypto/sha/Makefile
index de6cdde58a9ca1..8b8f8b285f1c68 100644
--- a/deps/openssl/openssl/crypto/sha/Makefile
+++ b/deps/openssl/openssl/crypto/sha/Makefile
@@ -135,7 +135,7 @@ dclean:
mv -f Makefile.new $(MAKEFILE)
clean:
- rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+ rm -f *.s *.S *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/deps/openssl/openssl/crypto/srp/srp_vfy.c b/deps/openssl/openssl/crypto/srp/srp_vfy.c
index a8ec52a4dadc24..c8bc7a94b26c4b 100644
--- a/deps/openssl/openssl/crypto/srp/srp_vfy.c
+++ b/deps/openssl/openssl/crypto/srp/srp_vfy.c
@@ -86,10 +86,13 @@ static int t_fromb64(unsigned char *a, size_t alen, const char *src)
int i, j;
int size;
+ if (alen == 0 || alen > INT_MAX)
+ return -1;
+
while (*src && (*src == ' ' || *src == '\t' || *src == '\n'))
++src;
size = strlen(src);
- if (alen > INT_MAX || size > (int)alen)
+ if (size < 0 || size >= (int)alen)
return -1;
i = 0;
@@ -127,7 +130,7 @@ static int t_fromb64(unsigned char *a, size_t alen, const char *src)
if (--i < 0)
break;
}
- while (a[j] == 0 && j <= size)
+ while (j <= size && a[j] == 0)
++j;
i = 0;
while (j <= size)
diff --git a/deps/openssl/openssl/crypto/txt_db/txt_db.c b/deps/openssl/openssl/crypto/txt_db/txt_db.c
index f9b42ac6e5880c..ed02efc261834c 100644
--- a/deps/openssl/openssl/crypto/txt_db/txt_db.c
+++ b/deps/openssl/openssl/crypto/txt_db/txt_db.c
@@ -162,6 +162,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
"wrong number of fields on line %ld (looking for field %d, got %d, '%s' left)\n",
ln, num, n, f);
#endif
+ OPENSSL_free(pp);
er = 2;
goto err;
}
@@ -171,6 +172,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num)
* fix :-( */
fprintf(stderr, "failure in sk_push\n");
#endif
+ OPENSSL_free(pp);
er = 2;
goto err;
}
@@ -222,7 +224,7 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
{
LHASH_OF(OPENSSL_STRING) *idx;
- OPENSSL_STRING *r;
+ OPENSSL_STRING *r, *k;
int i, n;
if (field >= db->num_fields) {
@@ -239,13 +241,18 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
r = sk_OPENSSL_PSTRING_value(db->data, i);
if ((qual != NULL) && (qual(r) == 0))
continue;
- if ((r = lh_OPENSSL_STRING_insert(idx, r)) != NULL) {
+ if ((k = lh_OPENSSL_STRING_insert(idx, r)) != NULL) {
db->error = DB_ERROR_INDEX_CLASH;
- db->arg1 = sk_OPENSSL_PSTRING_find(db->data, r);
+ db->arg1 = sk_OPENSSL_PSTRING_find(db->data, k);
db->arg2 = i;
lh_OPENSSL_STRING_free(idx);
return (0);
}
+ if (lh_OPENSSL_STRING_retrieve(idx, r) == NULL) {
+ db->error = DB_ERROR_MALLOC;
+ lh_OPENSSL_STRING_free(idx);
+ return (0);
+ }
}
if (db->index[field] != NULL)
lh_OPENSSL_STRING_free(db->index[field]);
@@ -320,20 +327,29 @@ int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row)
}
}
}
- /* We have passed the index checks, now just append and insert */
- if (!sk_OPENSSL_PSTRING_push(db->data, row)) {
- db->error = DB_ERROR_MALLOC;
- goto err;
- }
for (i = 0; i < db->num_fields; i++) {
if (db->index[i] != NULL) {
if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
continue;
(void)lh_OPENSSL_STRING_insert(db->index[i], row);
+ if (lh_OPENSSL_STRING_retrieve(db->index[i], row) == NULL)
+ goto err1;
}
}
+ if (!sk_OPENSSL_PSTRING_push(db->data, row))
+ goto err1;
return (1);
+
+ err1:
+ db->error = DB_ERROR_MALLOC;
+ while (i-- > 0) {
+ if (db->index[i] != NULL) {
+ if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
+ continue;
+ (void)lh_OPENSSL_STRING_delete(db->index[i], row);
+ }
+ }
err:
return (0);
}
diff --git a/deps/openssl/openssl/crypto/ui/ui_lib.c b/deps/openssl/openssl/crypto/ui/ui_lib.c
index 3cc067c3b7ee80..643ae593439aeb 100644
--- a/deps/openssl/openssl/crypto/ui/ui_lib.c
+++ b/deps/openssl/openssl/crypto/ui/ui_lib.c
@@ -747,7 +747,6 @@ const char *UI_get0_action_string(UI_STRING *uis)
if (!uis)
return NULL;
switch (uis->type) {
- case UIT_PROMPT:
case UIT_BOOLEAN:
return uis->_.boolean_data.action_desc;
default:
diff --git a/deps/openssl/openssl/crypto/x509/x509_lu.c b/deps/openssl/openssl/crypto/x509/x509_lu.c
index 50120a4d70c645..b7424809fdbb2e 100644
--- a/deps/openssl/openssl/crypto/x509/x509_lu.c
+++ b/deps/openssl/openssl/crypto/x509/x509_lu.c
@@ -185,14 +185,16 @@ X509_STORE *X509_STORE_new(void)
if ((ret = (X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
return NULL;
- ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
+ if ((ret->objs = sk_X509_OBJECT_new(x509_object_cmp)) == NULL)
+ goto err0;
ret->cache = 1;
- ret->get_cert_methods = sk_X509_LOOKUP_new_null();
+ if ((ret->get_cert_methods = sk_X509_LOOKUP_new_null()) == NULL)
+ goto err1;
ret->verify = 0;
ret->verify_cb = 0;
if ((ret->param = X509_VERIFY_PARAM_new()) == NULL)
- return NULL;
+ goto err2;
ret->get_issuer = 0;
ret->check_issued = 0;
@@ -204,14 +206,21 @@ X509_STORE *X509_STORE_new(void)
ret->lookup_crls = 0;
ret->cleanup = 0;
- if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) {
- sk_X509_OBJECT_free(ret->objs);
- OPENSSL_free(ret);
- return NULL;
- }
+ if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data))
+ goto err3;
ret->references = 1;
return ret;
+
+ err3:
+ X509_VERIFY_PARAM_free(ret->param);
+ err2:
+ sk_X509_LOOKUP_free(ret->get_cert_methods);
+ err1:
+ sk_X509_OBJECT_free(ret->objs);
+ err0:
+ OPENSSL_free(ret);
+ return NULL;
}
static void cleanup(X509_OBJECT *a)
@@ -360,8 +369,12 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
X509err(X509_F_X509_STORE_ADD_CERT,
X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret = 0;
- } else
- sk_X509_OBJECT_push(ctx->objs, obj);
+ } else if (!sk_X509_OBJECT_push(ctx->objs, obj)) {
+ X509_OBJECT_free_contents(obj);
+ OPENSSL_free(obj);
+ X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);
+ ret = 0;
+ }
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
@@ -392,8 +405,12 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
OPENSSL_free(obj);
X509err(X509_F_X509_STORE_ADD_CRL, X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret = 0;
- } else
- sk_X509_OBJECT_push(ctx->objs, obj);
+ } else if (!sk_X509_OBJECT_push(ctx->objs, obj)) {
+ X509_OBJECT_free_contents(obj);
+ OPENSSL_free(obj);
+ X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
+ ret = 0;
+ }
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
diff --git a/deps/openssl/openssl/crypto/x509v3/v3_alt.c b/deps/openssl/openssl/crypto/x509v3/v3_alt.c
index 7f1e71dd1a4292..a0351faf11192f 100644
--- a/deps/openssl/openssl/crypto/x509v3/v3_alt.c
+++ b/deps/openssl/openssl/crypto/x509v3/v3_alt.c
@@ -119,32 +119,39 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
int i;
switch (gen->type) {
case GEN_OTHERNAME:
- X509V3_add_value("othername", "", &ret);
+ if (!X509V3_add_value("othername", "", &ret))
+ return NULL;
break;
case GEN_X400:
- X509V3_add_value("X400Name", "", &ret);
+ if (!X509V3_add_value("X400Name", "", &ret))
+ return NULL;
break;
case GEN_EDIPARTY:
- X509V3_add_value("EdiPartyName", "", &ret);
+ if (!X509V3_add_value("EdiPartyName", "", &ret))
+ return NULL;
break;
case GEN_EMAIL:
- X509V3_add_value_uchar("email", gen->d.ia5->data, &ret);
+ if (!X509V3_add_value_uchar("email", gen->d.ia5->data, &ret))
+ return NULL;
break;
case GEN_DNS:
- X509V3_add_value_uchar("DNS", gen->d.ia5->data, &ret);
+ if (!X509V3_add_value_uchar("DNS", gen->d.ia5->data, &ret))
+ return NULL;
break;
case GEN_URI:
- X509V3_add_value_uchar("URI", gen->d.ia5->data, &ret);
+ if (!X509V3_add_value_uchar("URI", gen->d.ia5->data, &ret))
+ return NULL;
break;
case GEN_DIRNAME:
- X509_NAME_oneline(gen->d.dirn, oline, 256);
- X509V3_add_value("DirName", oline, &ret);
+ if (X509_NAME_oneline(gen->d.dirn, oline, 256) == NULL
+ || !X509V3_add_value("DirName", oline, &ret))
+ return NULL;
break;
case GEN_IPADD:
@@ -162,15 +169,18 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
strcat(oline, ":");
}
} else {
- X509V3_add_value("IP Address", "", &ret);
+ if (!X509V3_add_value("IP Address", "", &ret))
+ return NULL;
break;
}
- X509V3_add_value("IP Address", oline, &ret);
+ if (!X509V3_add_value("IP Address", oline, &ret))
+ return NULL;
break;
case GEN_RID:
i2t_ASN1_OBJECT(oline, 256, gen->d.rid);
- X509V3_add_value("Registered ID", oline, &ret);
+ if (!X509V3_add_value("Registered ID", oline, &ret))
+ return NULL;
break;
}
return ret;
diff --git a/deps/openssl/openssl/crypto/x509v3/v3_cpols.c b/deps/openssl/openssl/crypto/x509v3/v3_cpols.c
index d97f6226b9ee01..b99269e7f839a5 100644
--- a/deps/openssl/openssl/crypto/x509v3/v3_cpols.c
+++ b/deps/openssl/openssl/crypto/x509v3/v3_cpols.c
@@ -390,10 +390,10 @@ static int nref_nos(STACK_OF(ASN1_INTEGER) *nnums, STACK_OF(CONF_VALUE) *nos)
return 1;
merr:
+ ASN1_INTEGER_free(aint);
X509V3err(X509V3_F_NREF_NOS, ERR_R_MALLOC_FAILURE);
err:
- sk_ASN1_INTEGER_pop_free(nnums, ASN1_STRING_free);
return 0;
}
@@ -458,9 +458,15 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent)
num = sk_ASN1_INTEGER_value(ref->noticenos, i);
if (i)
BIO_puts(out, ", ");
- tmp = i2s_ASN1_INTEGER(NULL, num);
- BIO_puts(out, tmp);
- OPENSSL_free(tmp);
+ if (num == NULL)
+ BIO_puts(out, "(null)");
+ else {
+ tmp = i2s_ASN1_INTEGER(NULL, num);
+ if (tmp == NULL)
+ return;
+ BIO_puts(out, tmp);
+ OPENSSL_free(tmp);
+ }
}
BIO_puts(out, "\n");
}
diff --git a/deps/openssl/openssl/crypto/x509v3/v3_info.c b/deps/openssl/openssl/crypto/x509v3/v3_info.c
index e052a34b940a30..7064c725d98dba 100644
--- a/deps/openssl/openssl/crypto/x509v3/v3_info.c
+++ b/deps/openssl/openssl/crypto/x509v3/v3_info.c
@@ -107,29 +107,30 @@ ASN1_ITEM_TEMPLATE_END(AUTHORITY_INFO_ACCESS)
IMPLEMENT_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
-static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
- *method, AUTHORITY_INFO_ACCESS
- *ainfo, STACK_OF(CONF_VALUE)
- *ret)
+static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(
+ X509V3_EXT_METHOD *method, AUTHORITY_INFO_ACCESS *ainfo,
+ STACK_OF(CONF_VALUE) *ret)
{
ACCESS_DESCRIPTION *desc;
int i, nlen;
char objtmp[80], *ntmp;
CONF_VALUE *vtmp;
+ STACK_OF(CONF_VALUE) *tret = ret;
+
for (i = 0; i < sk_ACCESS_DESCRIPTION_num(ainfo); i++) {
+ STACK_OF(CONF_VALUE) *tmp;
+
desc = sk_ACCESS_DESCRIPTION_value(ainfo, i);
- ret = i2v_GENERAL_NAME(method, desc->location, ret);
- if (!ret)
- break;
- vtmp = sk_CONF_VALUE_value(ret, i);
+ tmp = i2v_GENERAL_NAME(method, desc->location, tret);
+ if (tmp == NULL)
+ goto err;
+ tret = tmp;
+ vtmp = sk_CONF_VALUE_value(tret, i);
i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method);
nlen = strlen(objtmp) + strlen(vtmp->name) + 5;
ntmp = OPENSSL_malloc(nlen);
- if (!ntmp) {
- X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS,
- ERR_R_MALLOC_FAILURE);
- return NULL;
- }
+ if (ntmp == NULL)
+ goto err;
BUF_strlcpy(ntmp, objtmp, nlen);
BUF_strlcat(ntmp, " - ", nlen);
BUF_strlcat(ntmp, vtmp->name, nlen);
@@ -137,9 +138,15 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
vtmp->name = ntmp;
}
- if (!ret)
+ if (ret == NULL && tret == NULL)
return sk_CONF_VALUE_new_null();
- return ret;
+
+ return tret;
+ err:
+ X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, ERR_R_MALLOC_FAILURE);
+ if (ret == NULL && tret != NULL)
+ sk_CONF_VALUE_pop_free(tret, X509V3_conf_free);
+ return NULL;
}
static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
diff --git a/deps/openssl/openssl/crypto/x509v3/v3_purp.c b/deps/openssl/openssl/crypto/x509v3/v3_purp.c
index 845be673b79998..96e629a9301f62 100644
--- a/deps/openssl/openssl/crypto/x509v3/v3_purp.c
+++ b/deps/openssl/openssl/crypto/x509v3/v3_purp.c
@@ -321,6 +321,7 @@ int X509_supported_extension(X509_EXTENSION *ex)
NID_subject_alt_name, /* 85 */
NID_basic_constraints, /* 87 */
NID_certificate_policies, /* 89 */
+ NID_crl_distribution_points, /* 103 */
NID_ext_key_usage, /* 126 */
#ifndef OPENSSL_NO_RFC3779
NID_sbgp_ipAddrBlock, /* 290 */
diff --git a/deps/openssl/openssl/crypto/x86_64cpuid.pl b/deps/openssl/openssl/crypto/x86_64cpuid.pl
index d208d02392e9d2..a3d6f438f91e7b 100644
--- a/deps/openssl/openssl/crypto/x86_64cpuid.pl
+++ b/deps/openssl/openssl/crypto/x86_64cpuid.pl
@@ -59,7 +59,7 @@
mov %rbx,%r8 # save %rbx
xor %eax,%eax
- mov %eax,8(%rdi) # clear 3rd word
+ mov %eax,8(%rdi) # clear extended feature flags
cpuid
mov %eax,%r11d # max value for standard query level
@@ -127,14 +127,6 @@
shr \$14,%r10d
and \$0xfff,%r10d # number of cores -1 per L1D
- cmp \$7,%r11d
- jb .Lnocacheinfo
-
- mov \$7,%eax
- xor %ecx,%ecx
- cpuid
- mov %ebx,8(%rdi)
-
.Lnocacheinfo:
mov \$1,%eax
cpuid
@@ -164,6 +156,15 @@
or %ecx,%r9d # merge AMD XOP flag
mov %edx,%r10d # %r9d:%r10d is copy of %ecx:%edx
+
+ cmp \$7,%r11d
+ jb .Lno_extended_info
+ mov \$7,%eax
+ xor %ecx,%ecx
+ cpuid
+ mov %ebx,8(%rdi) # save extended feature flags
+.Lno_extended_info:
+
bt \$27,%r9d # check OSXSAVE bit
jnc .Lclear_avx
xor %ecx,%ecx # XCR0
diff --git a/deps/openssl/openssl/crypto/x86cpuid.pl b/deps/openssl/openssl/crypto/x86cpuid.pl
index e95f6274f5e063..90ed196c09cd15 100644
--- a/deps/openssl/openssl/crypto/x86cpuid.pl
+++ b/deps/openssl/openssl/crypto/x86cpuid.pl
@@ -20,10 +20,10 @@
&pop ("eax");
&xor ("ecx","eax");
&xor ("eax","eax");
+ &mov ("esi",&wparam(0));
+ &mov (&DWP(8,"esi"),"eax"); # clear extended feature flags
&bt ("ecx",21);
&jnc (&label("nocpuid"));
- &mov ("esi",&wparam(0));
- &mov (&DWP(8,"esi"),"eax"); # clear 3rd word
&cpuid ();
&mov ("edi","eax"); # max value for standard query level
@@ -81,26 +81,16 @@
&jmp (&label("generic"));
&set_label("intel");
- &cmp ("edi",7);
- &jb (&label("cacheinfo"));
-
- &mov ("esi",&wparam(0));
- &mov ("eax",7);
- &xor ("ecx","ecx");
- &cpuid ();
- &mov (&DWP(8,"esi"),"ebx");
-
-&set_label("cacheinfo");
&cmp ("edi",4);
- &mov ("edi",-1);
+ &mov ("esi",-1);
&jb (&label("nocacheinfo"));
&mov ("eax",4);
&mov ("ecx",0); # query L1D
&cpuid ();
- &mov ("edi","eax");
- &shr ("edi",14);
- &and ("edi",0xfff); # number of cores -1 per L1D
+ &mov ("esi","eax");
+ &shr ("esi",14);
+ &and ("esi",0xfff); # number of cores -1 per L1D
&set_label("nocacheinfo");
&mov ("eax",1);
@@ -118,7 +108,7 @@
&bt ("edx",28); # test hyper-threading bit
&jnc (&label("generic"));
&and ("edx",0xefffffff);
- &cmp ("edi",0);
+ &cmp ("esi",0);
&je (&label("generic"));
&or ("edx",0x10000000);
@@ -130,10 +120,19 @@
&set_label("generic");
&and ("ebp",1<<11); # isolate AMD XOP flag
&and ("ecx",0xfffff7ff); # force 11th bit to 0
- &mov ("esi","edx");
+ &mov ("esi","edx"); # %ebp:%esi is copy of %ecx:%edx
&or ("ebp","ecx"); # merge AMD XOP flag
- &bt ("ecx",27); # check OSXSAVE bit
+ &cmp ("edi",7);
+ &mov ("edi",&wparam(0));
+ &jb (&label("no_extended_info"));
+ &mov ("eax",7);
+ &xor ("ecx","ecx");
+ &cpuid ();
+ &mov (&DWP(8,"edi"),"ebx"); # save extended feature flag
+&set_label("no_extended_info");
+
+ &bt ("ebp",27); # check OSXSAVE bit
&jnc (&label("clear_avx"));
&xor ("ecx","ecx");
&data_byte(0x0f,0x01,0xd0); # xgetbv
@@ -147,7 +146,6 @@
&and ("esi",0xfeffffff); # clear FXSR
&set_label("clear_avx");
&and ("ebp",0xefffe7ff); # clear AVX, FMA and AMD XOP bits
- &mov ("edi",&wparam(0));
&and (&DWP(8,"edi"),0xffffffdf); # clear AVX2
&set_label("done");
&mov ("eax","esi");
diff --git a/deps/openssl/openssl/doc-nits b/deps/openssl/openssl/doc-nits
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/deps/openssl/openssl/doc/apps/ciphers.pod b/deps/openssl/openssl/doc/apps/ciphers.pod
index 9224557255ed67..35d40bbf27aeff 100644
--- a/deps/openssl/openssl/doc/apps/ciphers.pod
+++ b/deps/openssl/openssl/doc/apps/ciphers.pod
@@ -179,7 +179,8 @@ When in doubt, include B in your cipherlist.
=item B, B
-cipher suites using RSA key exchange.
+cipher suites using RSA key exchange or authentication. B is an alias for
+B.
=item B, B, B
diff --git a/deps/openssl/openssl/doc/apps/config.pod b/deps/openssl/openssl/doc/apps/config.pod
index e12591528c0cd8..3f607d3b5fc84f 100644
--- a/deps/openssl/openssl/doc/apps/config.pod
+++ b/deps/openssl/openssl/doc/apps/config.pod
@@ -47,7 +47,8 @@ or B<${section::name}>. By using the form B<$ENV::name> environment
variables can be substituted. It is also possible to assign values to
environment variables by using the name B, this will work
if the program looks up environment variables using the B library
-instead of calling B directly.
+instead of calling B directly. The value string must not exceed 64k in
+length after variable expansion. Otherwise an error will occur.
It is possible to escape certain characters by using any kind of quote
or the B<\> character. By making the last character of a line a B<\>
diff --git a/deps/openssl/openssl/doc/apps/genrsa.pod b/deps/openssl/openssl/doc/apps/genrsa.pod
index 3dc9870f34b96a..f4ed9593ae2695 100644
--- a/deps/openssl/openssl/doc/apps/genrsa.pod
+++ b/deps/openssl/openssl/doc/apps/genrsa.pod
@@ -7,11 +7,15 @@ genrsa - generate an RSA private key
=head1 SYNOPSIS
B B
+[B<-help>]
[B<-out filename>]
[B<-passout arg>]
[B<-aes128>]
[B<-aes192>]
[B<-aes256>]
+[B<-aria128>]
+[B<-aria192>]
+[B<-aria256>]
[B<-camellia128>]
[B<-camellia192>]
[B<-camellia256>]
@@ -32,17 +36,21 @@ The B command generates an RSA private key.
=over 4
+=item B<-help>
+
+Print out a usage message.
+
=item B<-out filename>
-the output filename. If this argument is not specified then standard output is
-used.
+Output the key to the specified file. If this argument is not specified then
+standard output is used.
=item B<-passout arg>
the output file password source. For more information about the format of B
-see the B section in L.
+see the B section in L.
-=item B<-aes128|-aes192|-aes256|-camellia128|-camellia192|-camellia256|-des|-des3|-idea>
+=item B<-aes128|-aes192|-aes256|-aria128|-aria192|-aria256|-camellia128|-camellia192|-camellia256|-des|-des3|-idea>
These options encrypt the private key with specified
cipher before outputting it. If none of these options is
@@ -56,8 +64,8 @@ the public exponent to use, either 65537 or 3. The default is 65537.
=item B<-rand file(s)>
a file or files containing random data used to seed the random number
-generator, or an EGD socket (see L).
-Multiple files can be specified separated by a OS-dependent character.
+generator, or an EGD socket (see L).
+Multiple files can be specified separated by an OS-dependent character.
The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
all others.
@@ -71,7 +79,7 @@ for all available algorithms.
=item B
the size of the private key to generate in bits. This must be the last option
-specified. The default is 512.
+specified. The default is 2048.
=back
@@ -96,7 +104,15 @@ be much larger (typically 1024 bits).
=head1 SEE ALSO
-L
+L
-=cut
+=head1 COPYRIGHT
+Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
+
+Licensed under the OpenSSL license (the "License"). You may not use
+this file except in compliance with the License. You can obtain a copy
+in the file LICENSE in the source distribution or at
+L.
+
+=cut
diff --git a/deps/openssl/openssl/doc/apps/req.pod b/deps/openssl/openssl/doc/apps/req.pod
index 30653e50935777..1682ba5143dd02 100644
--- a/deps/openssl/openssl/doc/apps/req.pod
+++ b/deps/openssl/openssl/doc/apps/req.pod
@@ -237,6 +237,9 @@ a self signed root CA. The extensions added to the certificate
using the B option, a large random number will be used for
the serial number.
+If existing request is specified with the B<-in> option, it is converted
+to the self signed certificate otherwise new request is created.
+
=item B<-days n>
when the B<-x509> option is being used this specifies the number of
diff --git a/deps/openssl/openssl/doc/apps/s_client.pod b/deps/openssl/openssl/doc/apps/s_client.pod
index 29675dd213f451..b45acbc5e3e42f 100644
--- a/deps/openssl/openssl/doc/apps/s_client.pod
+++ b/deps/openssl/openssl/doc/apps/s_client.pod
@@ -42,6 +42,8 @@ B B
[B<-no_tls1_2>]
[B<-fallback_scsv>]
[B<-bugs>]
+[B<-sigalgs sigalglist>]
+[B<-curves curvelist>]
[B<-cipher cipherlist>]
[B<-serverpref>]
[B<-starttls protocol>]
@@ -217,6 +219,19 @@ Send TLS_FALLBACK_SCSV in the ClientHello.
there are several known bug in SSL and TLS implementations. Adding this
option enables various workarounds.
+=item B<-sigalgs sigalglist>
+
+Specifies the list of signature algorithms that are sent by the client.
+The server selects one entry in the list based on its preferences.
+For example strings, see L
+
+=item B<-curves curvelist>
+
+Specifies the list of supported curves to be sent by the client. The curve is
+is ultimately selected by the server. For a list of all curves, use:
+
+ $ openssl ecparam -list_curves
+
=item B<-cipher cipherlist>
this allows the cipher list sent by the client to be modified. Although
diff --git a/deps/openssl/openssl/doc/apps/s_server.pod b/deps/openssl/openssl/doc/apps/s_server.pod
index fa17488d917359..1fe93ddfbebb0b 100644
--- a/deps/openssl/openssl/doc/apps/s_server.pod
+++ b/deps/openssl/openssl/doc/apps/s_server.pod
@@ -35,6 +35,8 @@ B B
[B<-CAfile filename>]
[B<-no_alt_chains>]
[B<-nocert>]
+[B<-client_sigalgs sigalglist>]
+[B<-named_curve curve>]
[B<-cipher cipherlist>]
[B<-serverpref>]
[B<-quiet>]
@@ -234,6 +236,18 @@ option enables various workarounds.
this option enables a further workaround for some some early Netscape
SSL code (?).
+=item B<-client_sigalgs sigalglist>
+
+Signature algorithms to support for client certificate authentication
+(colon-separated list)
+
+=item B<-named_curve curve>
+
+Specifies the elliptic curve to use. NOTE: this is single curve, not a list.
+For a list of all possible curves, use:
+
+ $ openssl ecparam -list_curves
+
=item B<-cipher cipherlist>
this allows the cipher list used by the server to be modified. When
diff --git a/deps/openssl/openssl/doc/crypto/EVP_EncryptInit.pod b/deps/openssl/openssl/doc/crypto/EVP_EncryptInit.pod
index d9513338d8aacb..0c0a30c1ffa048 100644
--- a/deps/openssl/openssl/doc/crypto/EVP_EncryptInit.pod
+++ b/deps/openssl/openssl/doc/crypto/EVP_EncryptInit.pod
@@ -19,14 +19,17 @@ EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param,
EVP_CIPHER_CTX_set_padding, EVP_enc_null, EVP_des_cbc, EVP_des_ecb,
EVP_des_cfb, EVP_des_ofb, EVP_des_ede_cbc, EVP_des_ede, EVP_des_ede_ofb,
EVP_des_ede_cfb, EVP_des_ede3_cbc, EVP_des_ede3, EVP_des_ede3_ofb,
-EVP_des_ede3_cfb, EVP_desx_cbc, EVP_rc4, EVP_rc4_40, EVP_idea_cbc,
-EVP_idea_ecb, EVP_idea_cfb, EVP_idea_ofb, EVP_idea_cbc, EVP_rc2_cbc,
+EVP_des_ede3_cfb, EVP_desx_cbc, EVP_rc4, EVP_rc4_40, EVP_rc4_hmac_md5,
+EVP_idea_cbc, EVP_idea_ecb, EVP_idea_cfb, EVP_idea_ofb, EVP_rc2_cbc,
EVP_rc2_ecb, EVP_rc2_cfb, EVP_rc2_ofb, EVP_rc2_40_cbc, EVP_rc2_64_cbc,
EVP_bf_cbc, EVP_bf_ecb, EVP_bf_cfb, EVP_bf_ofb, EVP_cast5_cbc,
EVP_cast5_ecb, EVP_cast5_cfb, EVP_cast5_ofb, EVP_rc5_32_12_16_cbc,
EVP_rc5_32_12_16_ecb, EVP_rc5_32_12_16_cfb, EVP_rc5_32_12_16_ofb,
EVP_aes_128_gcm, EVP_aes_192_gcm, EVP_aes_256_gcm, EVP_aes_128_ccm,
-EVP_aes_192_ccm, EVP_aes_256_ccm - EVP cipher routines
+EVP_aes_192_ccm, EVP_aes_256_ccm,
+EVP_aes_128_cbc_hmac_sha1, EVP_aes_256_cbc_hmac_sha1,
+EVP_aes_128_cbc_hmac_sha256, EVP_aes_256_cbc_hmac_sha256
+- EVP cipher routines
=head1 SYNOPSIS
@@ -395,8 +398,6 @@ Sets the expected tag to B bytes from B. This call is only legal
when decrypting data and must be made B any data is processed (e.g.
before any EVP_DecryptUpdate() call).
-See L below for an example of the use of GCM mode.
-
=head1 CCM Mode
The behaviour of CCM mode ciphers is similar to CCM mode but with a few
diff --git a/deps/openssl/openssl/doc/crypto/RSA_private_encrypt.pod b/deps/openssl/openssl/doc/crypto/RSA_private_encrypt.pod
index 746a80c79ea0c8..3e1f895c5ad8c1 100644
--- a/deps/openssl/openssl/doc/crypto/RSA_private_encrypt.pod
+++ b/deps/openssl/openssl/doc/crypto/RSA_private_encrypt.pod
@@ -8,10 +8,10 @@ RSA_private_encrypt, RSA_public_decrypt - low level signature operations
#include
- int RSA_private_encrypt(int flen, unsigned char *from,
+ int RSA_private_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
- int RSA_public_decrypt(int flen, unsigned char *from,
+ int RSA_public_decrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
=head1 DESCRIPTION
diff --git a/deps/openssl/openssl/doc/crypto/RSA_public_encrypt.pod b/deps/openssl/openssl/doc/crypto/RSA_public_encrypt.pod
index ab0fe3b2cd1c77..0541f348b3e20c 100644
--- a/deps/openssl/openssl/doc/crypto/RSA_public_encrypt.pod
+++ b/deps/openssl/openssl/doc/crypto/RSA_public_encrypt.pod
@@ -8,10 +8,10 @@ RSA_public_encrypt, RSA_private_decrypt - RSA public key cryptography
#include
- int RSA_public_encrypt(int flen, unsigned char *from,
+ int RSA_public_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
- int RSA_private_decrypt(int flen, unsigned char *from,
+ int RSA_private_decrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
=head1 DESCRIPTION
diff --git a/deps/openssl/openssl/doc/crypto/X509_STORE_CTX_new.pod b/deps/openssl/openssl/doc/crypto/X509_STORE_CTX_new.pod
index eb38b0a1090512..1aee1172686385 100644
--- a/deps/openssl/openssl/doc/crypto/X509_STORE_CTX_new.pod
+++ b/deps/openssl/openssl/doc/crypto/X509_STORE_CTX_new.pod
@@ -41,7 +41,7 @@ is no longer valid.
X509_STORE_CTX_init() sets up B for a subsequent verification operation.
It must be called before each call to X509_verify_cert(), i.e. a B is only
good for one call to X509_verify_cert(); if you want to verify a second
-certificate with the same B then you must call X509_XTORE_CTX_cleanup()
+certificate with the same B then you must call X509_STORE_CTX_cleanup()
and then X509_STORE_CTX_init() again before the second call to
X509_verify_cert(). The trusted certificate store is set to B, the end
entity certificate to be verified is set to B and a set of additional
diff --git a/deps/openssl/openssl/doc/crypto/des.pod b/deps/openssl/openssl/doc/crypto/des.pod
index e1add56b5e8139..339617aab02431 100644
--- a/deps/openssl/openssl/doc/crypto/des.pod
+++ b/deps/openssl/openssl/doc/crypto/des.pod
@@ -123,7 +123,7 @@ architecture dependent I via the
DES_set_key_checked() or DES_set_key_unchecked() function.
DES_set_key_checked() will check that the key passed is of odd parity
-and is not a week or semi-weak key. If the parity is wrong, then -1
+and is not a weak or semi-weak key. If the parity is wrong, then -1
is returned. If the key is a weak key, then -2 is returned. If an
error is returned, the key schedule is not generated.
diff --git a/deps/openssl/openssl/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod b/deps/openssl/openssl/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod
new file mode 100644
index 00000000000000..3b0a50956d9bc9
--- /dev/null
+++ b/deps/openssl/openssl/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod
@@ -0,0 +1,62 @@
+=pod
+
+=head1 NAME
+
+SSL_CTX_set_tlsext_servername_callback, SSL_CTX_set_tlsext_servername_arg,
+SSL_get_servername_type, SSL_get_servername - handle server name indication
+(SNI)
+
+=head1 SYNOPSIS
+
+ #include
+
+ long SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx,
+ int (*cb)(SSL *, int *, void *));
+ long SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);
+
+ const char *SSL_get_servername(const SSL *s, const int type);
+ int SSL_get_servername_type(const SSL *s);
+
+=head1 DESCRIPTION
+
+SSL_CTX_set_tlsext_servername_callback() sets the application callback B
+used by a server to perform any actions or configuration required based on
+the servername extension received in the incoming connection. When B
+is NULL, SNI is not used. The B value is a pointer which is passed to
+the application callback.
+
+SSL_CTX_set_tlsext_servername_arg() sets a context-specific argument to be
+passed into the callback for this B.
+
+SSL_get_servername() returns a servername extension value of the specified
+type if provided in the Client Hello or NULL.
+
+SSL_get_servername_type() returns the servername type or -1 if no servername
+is present. Currently the only supported type (defined in RFC3546) is
+B.
+
+=head1 NOTES
+
+The ALPN and SNI callbacks are both executed during Client Hello processing.
+The servername callback is executed first, followed by the ALPN callback.
+
+=head1 RETURN VALUES
+
+SSL_CTX_set_tlsext_servername_callback() and
+SSL_CTX_set_tlsext_servername_arg() both always return 1 indicating success.
+
+=head1 SEE ALSO
+
+L, L,
+L
+
+=head1 COPYRIGHT
+
+Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+
+Licensed under the OpenSSL license (the "License"). You may not use
+this file except in compliance with the License. You can obtain a copy
+in the file LICENSE in the source distribution or at
+L.
+
+=cut
diff --git a/deps/openssl/openssl/include/openssl/conf.h b/deps/openssl/openssl/include/openssl/conf.h
index 8d926d5d8268f5..fe49113080b700 100644
--- a/deps/openssl/openssl/include/openssl/conf.h
+++ b/deps/openssl/openssl/include/openssl/conf.h
@@ -259,6 +259,7 @@ void ERR_load_CONF_strings(void);
# define CONF_R_NO_VALUE 108
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
# define CONF_R_UNKNOWN_MODULE_NAME 113
+# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
#ifdef __cplusplus
diff --git a/deps/openssl/openssl/include/openssl/dh.h b/deps/openssl/openssl/include/openssl/dh.h
index a5bd9016aae85a..a228c7a7a4c3a1 100644
--- a/deps/openssl/openssl/include/openssl/dh.h
+++ b/deps/openssl/openssl/include/openssl/dh.h
@@ -182,12 +182,29 @@ struct dh_st {
*/
# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
-# define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
- (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
-# define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
- (unsigned char *)(x))
-# define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
-# define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
+# define d2i_DHparams_fp(fp,x) \
+ (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
+ (char *(*)())d2i_DHparams, \
+ (fp), \
+ (unsigned char **)(x))
+# define i2d_DHparams_fp(fp,x) \
+ ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x))
+# define d2i_DHparams_bio(bp,x) \
+ ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x)
+# define i2d_DHparams_bio(bp,x) \
+ ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
+
+# define d2i_DHxparams_fp(fp,x) \
+ (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
+ (char *(*)())d2i_DHxparams, \
+ (fp), \
+ (unsigned char **)(x))
+# define i2d_DHxparams_fp(fp,x) \
+ ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x))
+# define d2i_DHxparams_bio(bp,x) \
+ ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x)
+# define i2d_DHxparams_bio(bp,x) \
+ ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x)
DH *DHparams_dup(DH *);
diff --git a/deps/openssl/openssl/include/openssl/err.h b/deps/openssl/openssl/include/openssl/err.h
index 585aa8ba3df935..f42365620db0c0 100644
--- a/deps/openssl/openssl/include/openssl/err.h
+++ b/deps/openssl/openssl/include/openssl/err.h
@@ -258,6 +258,7 @@ typedef struct err_state_st {
# define SYS_F_WSASTARTUP 9/* Winsock stuff */
# define SYS_F_OPENDIR 10
# define SYS_F_FREAD 11
+# define SYS_F_FFLUSH 18
/* reasons */
# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */
diff --git a/deps/openssl/openssl/include/openssl/opensslv.h b/deps/openssl/openssl/include/openssl/opensslv.h
index 645dd0793f32e0..825a330abc8825 100644
--- a/deps/openssl/openssl/include/openssl/opensslv.h
+++ b/deps/openssl/openssl/include/openssl/opensslv.h
@@ -30,11 +30,11 @@ extern "C" {
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
* major minor fix final patch/beta)
*/
-# define OPENSSL_VERSION_NUMBER 0x100020bfL
+# define OPENSSL_VERSION_NUMBER 0x100020cfL
# ifdef OPENSSL_FIPS
-# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k-fips 26 Jan 2017"
+# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l-fips 25 May 2017"
# else
-# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2k 26 Jan 2017"
+# define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l 25 May 2017"
# endif
# define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
diff --git a/deps/openssl/openssl/openssl.spec b/deps/openssl/openssl/openssl.spec
index 7bbcdf69a4310f..add18a4b37c260 100644
--- a/deps/openssl/openssl/openssl.spec
+++ b/deps/openssl/openssl/openssl.spec
@@ -7,7 +7,7 @@ Release: 1
Summary: Secure Sockets Layer and cryptography libraries and tools
Name: openssl
-Version: 1.0.2k
+Version: 1.0.2l
Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz
License: OpenSSL
Group: System Environment/Libraries
diff --git a/deps/openssl/openssl/ssl/d1_both.c b/deps/openssl/openssl/ssl/d1_both.c
index 9bc61536101b5c..e6bc761e8bf236 100644
--- a/deps/openssl/openssl/ssl/d1_both.c
+++ b/deps/openssl/openssl/ssl/d1_both.c
@@ -517,6 +517,17 @@ long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
return i;
}
+ /*
+ * Don't change the *message* read sequence number while listening. For
+ * the *record* write sequence we reflect the ClientHello sequence number
+ * when listening.
+ */
+ if (s->d1->listen)
+ memcpy(s->s3->write_sequence, s->s3->read_sequence,
+ sizeof(s->s3->write_sequence));
+ else
+ s->d1->handshake_read_seq++;
+
if (mt >= 0 && s->s3->tmp.message_type != mt) {
al = SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_DTLS1_GET_MESSAGE, SSL_R_UNEXPECTED_MESSAGE);
@@ -544,10 +555,6 @@ long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
memset(msg_hdr, 0x00, sizeof(struct hm_header_st));
- /* Don't change sequence numbers while listening */
- if (!s->d1->listen)
- s->d1->handshake_read_seq++;
-
s->init_msg = s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
return s->init_num;
@@ -1068,7 +1075,9 @@ int dtls1_send_change_cipher_spec(SSL *s, int a, int b)
int dtls1_read_failed(SSL *s, int code)
{
if (code > 0) {
+#ifdef TLS_DEBUG
fprintf(stderr, "invalid state reached %s:%d", __FILE__, __LINE__);
+#endif
return 1;
}
@@ -1140,7 +1149,9 @@ int dtls1_retransmit_buffered_messages(SSL *s)
(frag->msg_header.seq,
frag->msg_header.is_ccs), 0,
&found) <= 0 && found) {
+#ifdef TLS_DEBUG
fprintf(stderr, "dtls1_retransmit_message() failed\n");
+#endif
return -1;
}
}
@@ -1240,7 +1251,9 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off,
item = pqueue_find(s->d1->sent_messages, seq64be);
if (item == NULL) {
+#ifdef TLS_DEBUG
fprintf(stderr, "retransmit: message %d non-existant\n", seq);
+#endif
*found = 0;
return 0;
}
diff --git a/deps/openssl/openssl/ssl/d1_clnt.c b/deps/openssl/openssl/ssl/d1_clnt.c
index 7e2f5c2830b512..76451a346d86b4 100644
--- a/deps/openssl/openssl/ssl/d1_clnt.c
+++ b/deps/openssl/openssl/ssl/d1_clnt.c
@@ -320,8 +320,13 @@ int dtls1_connect(SSL *s)
s->shutdown = 0;
/* every DTLS ClientHello resets Finished MAC */
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ s->state = SSL_ST_ERR;
+ goto end;
+ }
+ /* fall thru */
case SSL3_ST_CW_CLNT_HELLO_B:
dtls1_start_timer(s);
ret = ssl3_client_hello(s);
diff --git a/deps/openssl/openssl/ssl/d1_pkt.c b/deps/openssl/openssl/ssl/d1_pkt.c
index 7a02459f2b7876..10586fee5408ea 100644
--- a/deps/openssl/openssl/ssl/d1_pkt.c
+++ b/deps/openssl/openssl/ssl/d1_pkt.c
@@ -1323,9 +1323,9 @@ int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
/* XDTLS: check that epoch is consistent */
if ((rr->length != ccs_hdr_len) ||
(rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) {
- i = SSL_AD_ILLEGAL_PARAMETER;
+ al = SSL_AD_ILLEGAL_PARAMETER;
SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_BAD_CHANGE_CIPHER_SPEC);
- goto err;
+ goto f_err;
}
rr->length = 0;
diff --git a/deps/openssl/openssl/ssl/d1_srvr.c b/deps/openssl/openssl/ssl/d1_srvr.c
index bc875b53c9a0d9..8502b242e51cd3 100644
--- a/deps/openssl/openssl/ssl/d1_srvr.c
+++ b/deps/openssl/openssl/ssl/d1_srvr.c
@@ -282,7 +282,12 @@ int dtls1_accept(SSL *s)
goto end;
}
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ s->state = SSL_ST_ERR;
+ goto end;
+ }
+
s->state = SSL3_ST_SR_CLNT_HELLO_A;
s->ctx->stats.sess_accept++;
} else if (!s->s3->send_connection_binding &&
@@ -322,7 +327,11 @@ int dtls1_accept(SSL *s)
s->state = SSL3_ST_SW_FLUSH;
s->init_num = 0;
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ s->state = SSL_ST_ERR;
+ goto end;
+ }
break;
case SSL3_ST_SW_HELLO_REQ_C:
@@ -346,15 +355,6 @@ int dtls1_accept(SSL *s)
s->init_num = 0;
- /*
- * Reflect ClientHello sequence to remain stateless while
- * listening
- */
- if (listen) {
- memcpy(s->s3->write_sequence, s->s3->read_sequence,
- sizeof(s->s3->write_sequence));
- }
-
/* If we're just listening, stop here */
if (listen && s->state == SSL3_ST_SW_SRVR_HELLO_A) {
ret = 2;
@@ -381,7 +381,11 @@ int dtls1_accept(SSL *s)
/* HelloVerifyRequest resets Finished MAC */
if (s->version != DTLS1_BAD_VER)
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ s->state = SSL_ST_ERR;
+ goto end;
+ }
break;
#ifndef OPENSSL_NO_SCTP
diff --git a/deps/openssl/openssl/ssl/s23_clnt.c b/deps/openssl/openssl/ssl/s23_clnt.c
index 6850dc0c670444..b80d1fd8ce6e9d 100644
--- a/deps/openssl/openssl/ssl/s23_clnt.c
+++ b/deps/openssl/openssl/ssl/s23_clnt.c
@@ -204,7 +204,10 @@ int ssl23_connect(SSL *s)
goto end;
}
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ goto end;
+ }
s->state = SSL23_ST_CW_CLNT_HELLO_A;
s->ctx->stats.sess_connect++;
diff --git a/deps/openssl/openssl/ssl/s23_srvr.c b/deps/openssl/openssl/ssl/s23_srvr.c
index 470bd3d94f29a4..d3f6db15cceee7 100644
--- a/deps/openssl/openssl/ssl/s23_srvr.c
+++ b/deps/openssl/openssl/ssl/s23_srvr.c
@@ -195,7 +195,10 @@ int ssl23_accept(SSL *s)
s->init_buf = buf;
}
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ goto end;
+ }
s->state = SSL23_ST_SR_CLNT_HELLO_A;
s->ctx->stats.sess_accept++;
diff --git a/deps/openssl/openssl/ssl/s3_clnt.c b/deps/openssl/openssl/ssl/s3_clnt.c
index 32f2f1aeed2b19..5b8b2da59f544f 100644
--- a/deps/openssl/openssl/ssl/s3_clnt.c
+++ b/deps/openssl/openssl/ssl/s3_clnt.c
@@ -263,6 +263,7 @@ int ssl3_connect(SSL *s)
if (!ssl3_setup_buffers(s)) {
ret = -1;
+ s->state = SSL_ST_ERR;
goto end;
}
@@ -275,7 +276,11 @@ int ssl3_connect(SSL *s)
/* don't push the buffering BIO quite yet */
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ s->state = SSL_ST_ERR;
+ goto end;
+ }
s->state = SSL3_ST_CW_CLNT_HELLO_A;
s->ctx->stats.sess_connect++;
@@ -1864,6 +1869,7 @@ int ssl3_get_key_exchange(SSL *s)
goto err;
}
if (EC_KEY_set_group(ecdh, ngroup) == 0) {
+ EC_GROUP_free(ngroup);
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_EC_LIB);
goto err;
}
diff --git a/deps/openssl/openssl/ssl/s3_enc.c b/deps/openssl/openssl/ssl/s3_enc.c
index fbc954d43c70c7..1eee9d9b21cf5c 100644
--- a/deps/openssl/openssl/ssl/s3_enc.c
+++ b/deps/openssl/openssl/ssl/s3_enc.c
@@ -177,32 +177,34 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
EVP_MD_CTX_init(&s1);
for (i = 0; (int)i < num; i += MD5_DIGEST_LENGTH) {
k++;
- if (k > sizeof buf) {
+ if (k > sizeof(buf))
/* bug: 'buf' is too small for this ciphersuite */
- SSLerr(SSL_F_SSL3_GENERATE_KEY_BLOCK, ERR_R_INTERNAL_ERROR);
- return 0;
- }
+ goto err;
for (j = 0; j < k; j++)
buf[j] = c;
c++;
- EVP_DigestInit_ex(&s1, EVP_sha1(), NULL);
- EVP_DigestUpdate(&s1, buf, k);
- EVP_DigestUpdate(&s1, s->session->master_key,
- s->session->master_key_length);
- EVP_DigestUpdate(&s1, s->s3->server_random, SSL3_RANDOM_SIZE);
- EVP_DigestUpdate(&s1, s->s3->client_random, SSL3_RANDOM_SIZE);
- EVP_DigestFinal_ex(&s1, smd, NULL);
-
- EVP_DigestInit_ex(&m5, EVP_md5(), NULL);
- EVP_DigestUpdate(&m5, s->session->master_key,
- s->session->master_key_length);
- EVP_DigestUpdate(&m5, smd, SHA_DIGEST_LENGTH);
+ if (!EVP_DigestInit_ex(&s1, EVP_sha1(), NULL) ||
+ !EVP_DigestUpdate(&s1, buf, k) ||
+ !EVP_DigestUpdate(&s1, s->session->master_key,
+ s->session->master_key_length) ||
+ !EVP_DigestUpdate(&s1, s->s3->server_random, SSL3_RANDOM_SIZE) ||
+ !EVP_DigestUpdate(&s1, s->s3->client_random, SSL3_RANDOM_SIZE) ||
+ !EVP_DigestFinal_ex(&s1, smd, NULL))
+ goto err2;
+
+ if (!EVP_DigestInit_ex(&m5, EVP_md5(), NULL) ||
+ !EVP_DigestUpdate(&m5, s->session->master_key,
+ s->session->master_key_length) ||
+ !EVP_DigestUpdate(&m5, smd, SHA_DIGEST_LENGTH))
+ goto err2;
if ((int)(i + MD5_DIGEST_LENGTH) > num) {
- EVP_DigestFinal_ex(&m5, smd, NULL);
+ if (!EVP_DigestFinal_ex(&m5, smd, NULL))
+ goto err2;
memcpy(km, smd, (num - i));
} else
- EVP_DigestFinal_ex(&m5, km, NULL);
+ if (!EVP_DigestFinal_ex(&m5, km, NULL))
+ goto err2;
km += MD5_DIGEST_LENGTH;
}
@@ -210,6 +212,12 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
EVP_MD_CTX_cleanup(&m5);
EVP_MD_CTX_cleanup(&s1);
return 1;
+ err:
+ SSLerr(SSL_F_SSL3_GENERATE_KEY_BLOCK, ERR_R_INTERNAL_ERROR);
+ err2:
+ EVP_MD_CTX_cleanup(&m5);
+ EVP_MD_CTX_cleanup(&s1);
+ return 0;
}
int ssl3_change_cipher_state(SSL *s, int which)
@@ -360,25 +368,33 @@ int ssl3_change_cipher_state(SSL *s, int which)
* In here I set both the read and write key/iv to the same value
* since only the correct one will be used :-).
*/
- EVP_DigestInit_ex(&md, EVP_md5(), NULL);
- EVP_DigestUpdate(&md, key, j);
- EVP_DigestUpdate(&md, er1, SSL3_RANDOM_SIZE);
- EVP_DigestUpdate(&md, er2, SSL3_RANDOM_SIZE);
- EVP_DigestFinal_ex(&md, &(exp_key[0]), NULL);
+ if (!EVP_DigestInit_ex(&md, EVP_md5(), NULL) ||
+ !EVP_DigestUpdate(&md, key, j) ||
+ !EVP_DigestUpdate(&md, er1, SSL3_RANDOM_SIZE) ||
+ !EVP_DigestUpdate(&md, er2, SSL3_RANDOM_SIZE) ||
+ !EVP_DigestFinal_ex(&md, &(exp_key[0]), NULL)) {
+ EVP_MD_CTX_cleanup(&md);
+ goto err2;
+ }
key = &(exp_key[0]);
if (k > 0) {
- EVP_DigestInit_ex(&md, EVP_md5(), NULL);
- EVP_DigestUpdate(&md, er1, SSL3_RANDOM_SIZE);
- EVP_DigestUpdate(&md, er2, SSL3_RANDOM_SIZE);
- EVP_DigestFinal_ex(&md, &(exp_iv[0]), NULL);
+ if (!EVP_DigestInit_ex(&md, EVP_md5(), NULL) ||
+ !EVP_DigestUpdate(&md, er1, SSL3_RANDOM_SIZE) ||
+ !EVP_DigestUpdate(&md, er2, SSL3_RANDOM_SIZE) ||
+ !EVP_DigestFinal_ex(&md, &(exp_iv[0]), NULL)) {
+ EVP_MD_CTX_cleanup(&md);
+ goto err2;
+ }
iv = &(exp_iv[0]);
}
}
+ EVP_MD_CTX_cleanup(&md);
s->session->key_arg_length = 0;
- EVP_CipherInit_ex(dd, c, NULL, key, iv, (which & SSL3_CC_WRITE));
+ if (!EVP_CipherInit_ex(dd, c, NULL, key, iv, (which & SSL3_CC_WRITE)))
+ goto err2;
#ifdef OPENSSL_SSL_TRACE_CRYPTO
if (s->msg_callback) {
@@ -399,7 +415,6 @@ int ssl3_change_cipher_state(SSL *s, int which)
OPENSSL_cleanse(&(exp_key[0]), sizeof(exp_key));
OPENSSL_cleanse(&(exp_iv[0]), sizeof(exp_iv));
- EVP_MD_CTX_cleanup(&md);
return (1);
err:
SSLerr(SSL_F_SSL3_CHANGE_CIPHER_STATE, ERR_R_MALLOC_FAILURE);
@@ -555,17 +570,20 @@ int ssl3_enc(SSL *s, int send)
if ((bs != 1) && !send)
return ssl3_cbc_remove_padding(s, rec, bs, mac_size);
}
- return (1);
+ return 1;
}
-void ssl3_init_finished_mac(SSL *s)
+int ssl3_init_finished_mac(SSL *s)
{
if (s->s3->handshake_buffer)
BIO_free(s->s3->handshake_buffer);
if (s->s3->handshake_dgst)
ssl3_free_digest_list(s);
s->s3->handshake_buffer = BIO_new(BIO_s_mem());
+ if (s->s3->handshake_buffer == NULL)
+ return 0;
(void)BIO_set_close(s->s3->handshake_buffer, BIO_CLOSE);
+ return 1;
}
void ssl3_free_digest_list(SSL *s)
@@ -622,6 +640,10 @@ int ssl3_digest_cached_records(SSL *s)
for (i = 0; ssl_get_handshake_digest(i, &mask, &md); i++) {
if ((mask & ssl_get_algorithm2(s)) && md) {
s->s3->handshake_dgst[i] = EVP_MD_CTX_create();
+ if (s->s3->handshake_dgst[i] == NULL) {
+ SSLerr(SSL_F_SSL3_DIGEST_CACHED_RECORDS, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
#ifdef OPENSSL_FIPS
if (EVP_MD_nid(md) == NID_md5) {
EVP_MD_CTX_set_flags(s->s3->handshake_dgst[i],
@@ -903,7 +925,7 @@ int ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
s, s->msg_callback_arg);
}
#endif
- OPENSSL_cleanse(buf, sizeof buf);
+ OPENSSL_cleanse(buf, sizeof(buf));
return (ret);
}
diff --git a/deps/openssl/openssl/ssl/s3_lib.c b/deps/openssl/openssl/ssl/s3_lib.c
index 0385e039c8d46c..1014a3fce16f75 100644
--- a/deps/openssl/openssl/ssl/s3_lib.c
+++ b/deps/openssl/openssl/ssl/s3_lib.c
@@ -4237,7 +4237,7 @@ int ssl3_get_req_cert_type(SSL *s, unsigned char *p)
return (int)s->cert->ctype_num;
}
/* get configured sigalgs */
- siglen = tls12_get_psigalgs(s, &sig);
+ siglen = tls12_get_psigalgs(s, 1, &sig);
if (s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)
nostrict = 0;
for (i = 0; i < siglen; i += 2, sig += 2) {
diff --git a/deps/openssl/openssl/ssl/s3_pkt.c b/deps/openssl/openssl/ssl/s3_pkt.c
index 6ece87d0628c4f..0290c991d8101d 100644
--- a/deps/openssl/openssl/ssl/s3_pkt.c
+++ b/deps/openssl/openssl/ssl/s3_pkt.c
@@ -670,7 +670,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
* promptly send beyond the end of the users buffer ... so we trap and
* report the error in a way the user will notice
*/
- if (len < tot) {
+ if ((len < tot) || ((wb->left != 0) && (len < (tot + s->s3->wpend_tot)))) {
SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH);
return (-1);
}
@@ -699,6 +699,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
len >= 4 * (int)(max_send_fragment = s->max_send_fragment) &&
s->compress == NULL && s->msg_callback == NULL &&
SSL_USE_EXPLICIT_IV(s) &&
+ s->enc_write_ctx != NULL &&
EVP_CIPHER_flags(s->enc_write_ctx->cipher) &
EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK) {
unsigned char aad[13];
diff --git a/deps/openssl/openssl/ssl/s3_srvr.c b/deps/openssl/openssl/ssl/s3_srvr.c
index ea56f9ca81509b..ba17f1b562812c 100644
--- a/deps/openssl/openssl/ssl/s3_srvr.c
+++ b/deps/openssl/openssl/ssl/s3_srvr.c
@@ -311,7 +311,12 @@ int ssl3_accept(SSL *s)
goto end;
}
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ s->state = SSL_ST_ERR;
+ goto end;
+ }
+
s->state = SSL3_ST_SR_CLNT_HELLO_A;
s->ctx->stats.sess_accept++;
} else if (!s->s3->send_connection_binding &&
@@ -348,7 +353,11 @@ int ssl3_accept(SSL *s)
s->state = SSL3_ST_SW_FLUSH;
s->init_num = 0;
- ssl3_init_finished_mac(s);
+ if (!ssl3_init_finished_mac(s)) {
+ ret = -1;
+ s->state = SSL_ST_ERR;
+ goto end;
+ }
break;
case SSL3_ST_SW_HELLO_REQ_C:
@@ -1704,6 +1713,12 @@ int ssl3_send_server_key_exchange(SSL *s)
if (type & SSL_kEECDH) {
const EC_GROUP *group;
+ if (s->s3->tmp.ecdh != NULL) {
+ SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,
+ ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
+
ecdhp = cert->ecdh_tmp;
if (s->cert->ecdh_tmp_auto) {
/* Get NID of appropriate shared curve */
@@ -1724,17 +1739,7 @@ int ssl3_send_server_key_exchange(SSL *s)
goto f_err;
}
- if (s->s3->tmp.ecdh != NULL) {
- SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,
- ERR_R_INTERNAL_ERROR);
- goto err;
- }
-
/* Duplicate the ECDH structure. */
- if (ecdhp == NULL) {
- SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_ECDH_LIB);
- goto err;
- }
if (s->cert->ecdh_tmp_auto)
ecdh = ecdhp;
else if ((ecdh = EC_KEY_dup(ecdhp)) == NULL) {
@@ -2084,7 +2089,7 @@ int ssl3_send_certificate_request(SSL *s)
if (SSL_USE_SIGALGS(s)) {
const unsigned char *psigs;
- nl = tls12_get_psigalgs(s, &psigs);
+ nl = tls12_get_psigalgs(s, 1, &psigs);
s2n(nl, p);
memcpy(p, psigs, nl);
p += nl;
@@ -3018,6 +3023,11 @@ int ssl3_get_cert_verify(SSL *s)
peer = s->session->peer;
pkey = X509_get_pubkey(peer);
+ if (pkey == NULL) {
+ al = SSL_AD_INTERNAL_ERROR;
+ goto f_err;
+ }
+
type = X509_certificate_type(peer, pkey);
if (!(type & EVP_PKT_SIGN)) {
@@ -3154,7 +3164,9 @@ int ssl3_get_cert_verify(SSL *s)
goto f_err;
}
if (i != 64) {
+#ifdef SSL_DEBUG
fprintf(stderr, "GOST signature length is %d", i);
+#endif
}
for (idx = 0; idx < 64; idx++) {
signature[63 - idx] = p[idx];
@@ -3463,8 +3475,22 @@ int ssl3_send_newsession_ticket(SSL *s)
* all the work otherwise use generated values from parent ctx.
*/
if (tctx->tlsext_ticket_key_cb) {
- if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx,
- &hctx, 1) < 0)
+ /* if 0 is returned, write en empty ticket */
+ int ret = tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx,
+ &hctx, 1);
+
+ if (ret == 0) {
+ l2n(0, p); /* timeout */
+ s2n(0, p); /* length */
+ ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET,
+ p - ssl_handshake_start(s));
+ s->state = SSL3_ST_SW_SESSION_TICKET_B;
+ OPENSSL_free(senc);
+ EVP_CIPHER_CTX_cleanup(&ctx);
+ HMAC_CTX_cleanup(&hctx);
+ return ssl_do_write(s);
+ }
+ if (ret < 0)
goto err;
} else {
if (RAND_bytes(iv, 16) <= 0)
diff --git a/deps/openssl/openssl/ssl/ssl_cert.c b/deps/openssl/openssl/ssl/ssl_cert.c
index 1be6fb0032e200..155728d03772b1 100644
--- a/deps/openssl/openssl/ssl/ssl_cert.c
+++ b/deps/openssl/openssl/ssl/ssl_cert.c
@@ -412,6 +412,7 @@ CERT *ssl_cert_dup(CERT *cert)
#endif
ssl_cert_clear_certs(ret);
+ OPENSSL_free(ret);
return NULL;
}
diff --git a/deps/openssl/openssl/ssl/ssl_ciph.c b/deps/openssl/openssl/ssl/ssl_ciph.c
index 2ad8f4392236e6..40021329a93617 100644
--- a/deps/openssl/openssl/ssl/ssl_ciph.c
+++ b/deps/openssl/openssl/ssl/ssl_ciph.c
@@ -2001,7 +2001,7 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
if (id < 193 || id > 255) {
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,
SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
- return 0;
+ return 1;
}
MemCheck_off();
@@ -2013,6 +2013,7 @@ int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
}
comp->id = id;
comp->method = cm;
+ comp->name = cm->name;
load_builtin_compressions();
if (ssl_comp_methods && sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) {
OPENSSL_free(comp);
diff --git a/deps/openssl/openssl/ssl/ssl_lib.c b/deps/openssl/openssl/ssl/ssl_lib.c
index f8054dae6b6b10..24be376c9fdf6e 100644
--- a/deps/openssl/openssl/ssl/ssl_lib.c
+++ b/deps/openssl/openssl/ssl/ssl_lib.c
@@ -1838,13 +1838,21 @@ int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,
static unsigned long ssl_session_hash(const SSL_SESSION *a)
{
+ const unsigned char *session_id = a->session_id;
unsigned long l;
+ unsigned char tmp_storage[4];
+
+ if (a->session_id_length < sizeof(tmp_storage)) {
+ memset(tmp_storage, 0, sizeof(tmp_storage));
+ memcpy(tmp_storage, a->session_id, a->session_id_length);
+ session_id = tmp_storage;
+ }
l = (unsigned long)
- ((unsigned int)a->session_id[0]) |
- ((unsigned int)a->session_id[1] << 8L) |
- ((unsigned long)a->session_id[2] << 16L) |
- ((unsigned long)a->session_id[3] << 24L);
+ ((unsigned long)session_id[0]) |
+ ((unsigned long)session_id[1] << 8L) |
+ ((unsigned long)session_id[2] << 16L) |
+ ((unsigned long)session_id[3] << 24L);
return (l);
}
@@ -3186,6 +3194,9 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)
ssl->cert->alpn_proposed_len = ocert->alpn_proposed_len;
ocert->alpn_proposed = NULL;
ssl->cert->alpn_sent = ocert->alpn_sent;
+
+ if (!custom_exts_copy_flags(&ssl->cert->srv_ext, &ocert->srv_ext))
+ return NULL;
#endif
ssl_cert_free(ocert);
}
diff --git a/deps/openssl/openssl/ssl/ssl_locl.h b/deps/openssl/openssl/ssl/ssl_locl.h
index d50edd18c91658..aeffc006347171 100644
--- a/deps/openssl/openssl/ssl/ssl_locl.h
+++ b/deps/openssl/openssl/ssl/ssl_locl.h
@@ -1158,7 +1158,7 @@ long ssl2_default_timeout(void);
const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
-void ssl3_init_finished_mac(SSL *s);
+int ssl3_init_finished_mac(SSL *s);
int ssl3_send_server_certificate(SSL *s);
int ssl3_send_newsession_ticket(SSL *s);
int ssl3_send_cert_status(SSL *s);
@@ -1430,7 +1430,7 @@ int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len,
long ssl_get_algorithm2(SSL *s);
int tls1_save_sigalgs(SSL *s, const unsigned char *data, int dsize);
int tls1_process_sigalgs(SSL *s);
-size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs);
+size_t tls12_get_psigalgs(SSL *s, int sent, const unsigned char **psigs);
int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s,
const unsigned char *sig, EVP_PKEY *pkey);
void ssl_set_client_disabled(SSL *s);
@@ -1482,6 +1482,8 @@ int custom_ext_add(SSL *s, int server,
unsigned char **pret, unsigned char *limit, int *al);
int custom_exts_copy(custom_ext_methods *dst, const custom_ext_methods *src);
+int custom_exts_copy_flags(custom_ext_methods *dst,
+ const custom_ext_methods *src);
void custom_exts_free(custom_ext_methods *exts);
# else
diff --git a/deps/openssl/openssl/ssl/ssl_rsa.c b/deps/openssl/openssl/ssl/ssl_rsa.c
index f679801a297c8f..af03d45c2e9ae9 100644
--- a/deps/openssl/openssl/ssl/ssl_rsa.c
+++ b/deps/openssl/openssl/ssl/ssl_rsa.c
@@ -964,6 +964,7 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
int ret = 0;
BIO *bin = NULL;
size_t num_extensions = 0;
+ unsigned char *new_serverinfo;
if (ctx == NULL || file == NULL) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE,
@@ -1014,12 +1015,13 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
goto end;
}
/* Append the decoded extension to the serverinfo buffer */
- serverinfo =
+ new_serverinfo =
OPENSSL_realloc(serverinfo, serverinfo_length + extension_length);
- if (serverinfo == NULL) {
+ if (new_serverinfo == NULL) {
SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_MALLOC_FAILURE);
goto end;
}
+ serverinfo = new_serverinfo;
memcpy(serverinfo + serverinfo_length, extension, extension_length);
serverinfo_length += extension_length;
diff --git a/deps/openssl/openssl/ssl/ssl_sess.c b/deps/openssl/openssl/ssl/ssl_sess.c
index c3369a44aea7e2..f50f5142126f80 100644
--- a/deps/openssl/openssl/ssl/ssl_sess.c
+++ b/deps/openssl/openssl/ssl/ssl_sess.c
@@ -1006,7 +1006,8 @@ int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,
return 0;
}
s->sid_ctx_length = sid_ctx_len;
- memcpy(s->sid_ctx, sid_ctx, sid_ctx_len);
+ if (s->sid_ctx != sid_ctx)
+ memcpy(s->sid_ctx, sid_ctx, sid_ctx_len);
return 1;
}
diff --git a/deps/openssl/openssl/ssl/ssltest.c b/deps/openssl/openssl/ssl/ssltest.c
index 890e47685350bb..b75cac61fbdc42 100644
--- a/deps/openssl/openssl/ssl/ssltest.c
+++ b/deps/openssl/openssl/ssl/ssltest.c
@@ -311,6 +311,10 @@ static const char *sn_client;
static const char *sn_server1;
static const char *sn_server2;
static int sn_expect = 0;
+static int s_ticket1 = 0;
+static int s_ticket2 = 0;
+static int c_ticket = 0;
+static int ticket_expect = -1;
static int servername_cb(SSL *s, int *ad, void *arg)
{
@@ -325,6 +329,9 @@ static int servername_cb(SSL *s, int *ad, void *arg)
!strcasecmp(servername, sn_server2)) {
BIO_printf(bio_stdout, "Switching server context.\n");
SSL_set_SSL_CTX(s, s_ctx2);
+ /* Copy over all the SSL_CTX options */
+ SSL_clear_options(s, 0xFFFFFFFFL);
+ SSL_set_options(s, SSL_CTX_get_options(s_ctx2));
}
}
return SSL_TLSEXT_ERR_OK;
@@ -349,6 +356,21 @@ static int verify_servername(SSL *client, SSL *server)
return -1;
}
+static int verify_ticket(SSL* ssl)
+{
+ if (ticket_expect == -1)
+ return 0;
+ if (ticket_expect == 0 &&
+ (ssl->session->tlsext_tick == NULL ||
+ ssl->session->tlsext_ticklen == 0))
+ return 1;
+ if (ticket_expect == 1 &&
+ (ssl->session->tlsext_tick != NULL &&
+ ssl->session->tlsext_ticklen != 0))
+ return 1;
+ return -1;
+}
+
/*-
* next_protos_parse parses a comma separated list of strings into a string
* in a format suitable for passing to SSL_CTX_set_next_protos_advertised.
@@ -477,6 +499,42 @@ static int verify_alpn(SSL *client, SSL *server)
return -1;
}
+#ifndef OPENSSL_NO_TLSEXT
+
+static int cb_ticket0(SSL* s, unsigned char* key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc)
+{
+ return 0;
+}
+
+static int cb_ticket1(SSL* s, unsigned char* key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc)
+{
+ static unsigned char key[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ static char name[] = "ticket11ticket11";
+ if (SSL_get_options(s) & SSL_OP_NO_TICKET)
+ return 0;
+ if (enc) {
+ RAND_pseudo_bytes(iv, EVP_MAX_IV_LENGTH);
+ EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
+ HMAC_Init_ex(hctx, key, sizeof(key), EVP_sha1(), NULL);
+ memcpy(key_name, name, 16);
+ return 1;
+ } else {
+ if (memcmp(key_name, name, 16) == 0) {
+ EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
+ HMAC_Init_ex(hctx, key, sizeof(key), EVP_sha1(), NULL);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int cb_ticket2(SSL* s, unsigned char* key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc)
+{
+ fprintf(stderr, "ticket callback for SNI context should never be called\n");
+ EXIT(1);
+}
+#endif
+
#define SCT_EXT_TYPE 18
/*
@@ -820,6 +878,12 @@ static void sv_usage(void)
fprintf(stderr, " -sn_server2 - have server context 2 respond to this servername\n");
fprintf(stderr, " -sn_expect1 - expected server 1\n");
fprintf(stderr, " -sn_expect2 - expected server 2\n");
+#ifndef OPENSSL_NO_TLSEXT
+ fprintf(stderr, " -s_ticket1 - enable/disable session tickets on context 1\n");
+ fprintf(stderr, " -s_ticket2 - enable/disable session tickets on context 2\n");
+ fprintf(stderr, " -c_ticket - enable/disable session tickets on the client\n");
+ fprintf(stderr, " -ticket_expect - indicate that the client should (or should not) have a ticket\n");
+#endif
}
static void print_details(SSL *c_ssl, const char *prefix)
@@ -1175,13 +1239,21 @@ int main(int argc, char *argv[])
} else if (strcmp(*argv, "-time") == 0) {
print_time = 1;
}
-#ifndef OPENSSL_NO_COMP
else if (strcmp(*argv, "-zlib") == 0) {
+#ifndef OPENSSL_NO_COMP
comp = COMP_ZLIB;
+#else
+ fprintf(stderr,
+ "ignoring -zlib, since I'm compiled without COMP\n");
+#endif
} else if (strcmp(*argv, "-rle") == 0) {
+#ifndef OPENSSL_NO_COMP
comp = COMP_RLE;
- }
+#else
+ fprintf(stderr,
+ "ignoring -rle, since I'm compiled without COMP\n");
#endif
+ }
else if (strcmp(*argv, "-named_curve") == 0) {
if (--argc < 1)
goto bad;
@@ -1241,6 +1313,36 @@ int main(int argc, char *argv[])
sn_expect = 1;
} else if (strcmp(*argv, "-sn_expect2") == 0) {
sn_expect = 2;
+#ifndef OPENSSL_NO_TLSEXT
+ } else if (strcmp(*argv, "-s_ticket1") == 0) {
+ if (--argc < 1)
+ goto bad;
+ argv++;
+ if (strcmp(*argv, "yes") == 0)
+ s_ticket1 = 1;
+ if (strcmp(*argv, "broken") == 0)
+ s_ticket1 = 2;
+ } else if (strcmp(*argv, "-s_ticket2") == 0) {
+ if (--argc < 1)
+ goto bad;
+ argv++;
+ if (strcmp(*argv, "yes") == 0)
+ s_ticket2 = 1;
+ } else if (strcmp(*argv, "-c_ticket") == 0) {
+ if (--argc < 1)
+ goto bad;
+ argv++;
+ if (strcmp(*argv, "yes") == 0)
+ c_ticket = 1;
+ } else if (strcmp(*argv, "-ticket_expect") == 0) {
+ if (--argc < 1)
+ goto bad;
+ argv++;
+ if (strcmp(*argv, "yes") == 0)
+ ticket_expect = 1;
+ else if (strcmp(*argv, "no") == 0)
+ ticket_expect = 0;
+#endif
} else {
fprintf(stderr, "unknown option %s\n", *argv);
badop = 1;
@@ -1679,6 +1781,24 @@ int main(int argc, char *argv[])
if (sn_server1 || sn_server2)
SSL_CTX_set_tlsext_servername_callback(s_ctx, servername_cb);
+#ifndef OPENSSL_NO_TLSEXT
+ if (s_ticket1 == 0)
+ SSL_CTX_set_options(s_ctx, SSL_OP_NO_TICKET);
+ /* always set the callback */
+ if (s_ticket1 == 2)
+ SSL_CTX_set_tlsext_ticket_key_cb(s_ctx, cb_ticket0);
+ else
+ SSL_CTX_set_tlsext_ticket_key_cb(s_ctx, cb_ticket1);
+
+ if (!s_ticket2)
+ SSL_CTX_set_options(s_ctx2, SSL_OP_NO_TICKET);
+ /* always set the callback - this should never be called */
+ SSL_CTX_set_tlsext_ticket_key_cb(s_ctx2, cb_ticket2);
+
+ if (!c_ticket)
+ SSL_CTX_set_options(c_ctx, SSL_OP_NO_TICKET);
+#endif
+
c_ssl = SSL_new(c_ctx);
s_ssl = SSL_new(s_ctx);
@@ -1742,6 +1862,8 @@ int main(int argc, char *argv[])
ret = 1;
if (verify_servername(c_ssl, s_ssl) < 0)
ret = 1;
+ if (verify_ticket(c_ssl) < 0)
+ ret = 1;
SSL_free(s_ssl);
SSL_free(c_ssl);
diff --git a/deps/openssl/openssl/ssl/t1_ext.c b/deps/openssl/openssl/ssl/t1_ext.c
index 79ed946a514226..0f4aba0226b423 100644
--- a/deps/openssl/openssl/ssl/t1_ext.c
+++ b/deps/openssl/openssl/ssl/t1_ext.c
@@ -179,6 +179,25 @@ int custom_ext_add(SSL *s, int server,
return 1;
}
+/* Copy the flags from src to dst for any extensions that exist in both */
+int custom_exts_copy_flags(custom_ext_methods *dst,
+ const custom_ext_methods *src)
+{
+ size_t i;
+ custom_ext_method *methsrc = src->meths;
+
+ for (i = 0; i < src->meths_count; i++, methsrc++) {
+ custom_ext_method *methdst = custom_ext_find(dst, methsrc->ext_type);
+
+ if (methdst == NULL)
+ continue;
+
+ methdst->ext_flags = methsrc->ext_flags;
+ }
+
+ return 1;
+}
+
/* Copy table of custom extensions */
int custom_exts_copy(custom_ext_methods *dst, const custom_ext_methods *src)
{
@@ -223,16 +242,14 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
/* Search for duplicate */
if (custom_ext_find(exts, ext_type))
return 0;
- exts->meths = OPENSSL_realloc(exts->meths,
- (exts->meths_count +
- 1) * sizeof(custom_ext_method));
-
- if (!exts->meths) {
- exts->meths_count = 0;
+ meth = OPENSSL_realloc(exts->meths,
+ (exts->meths_count + 1)
+ * sizeof(custom_ext_method));
+ if (meth == NULL)
return 0;
- }
- meth = exts->meths + exts->meths_count;
+ exts->meths = meth;
+ meth += exts->meths_count;
memset(meth, 0, sizeof(custom_ext_method));
meth->parse_cb = parse_cb;
meth->add_cb = add_cb;
diff --git a/deps/openssl/openssl/ssl/t1_lib.c b/deps/openssl/openssl/ssl/t1_lib.c
index e60c88bd5b2766..6587e8bb685c94 100644
--- a/deps/openssl/openssl/ssl/t1_lib.c
+++ b/deps/openssl/openssl/ssl/t1_lib.c
@@ -1035,7 +1035,7 @@ static unsigned char suiteb_sigalgs[] = {
tlsext_sigalg_ecdsa(TLSEXT_hash_sha384)
};
# endif
-size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs)
+size_t tls12_get_psigalgs(SSL *s, int sent, const unsigned char **psigs)
{
/*
* If Suite B mode use Suite B sigalgs only, ignore any other
@@ -1057,7 +1057,7 @@ size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs)
}
# endif
/* If server use client authentication sigalgs if not NULL */
- if (s->server && s->cert->client_sigalgs) {
+ if (s->server == sent && s->cert->client_sigalgs) {
*psigs = s->cert->client_sigalgs;
return s->cert->client_sigalgslen;
} else if (s->cert->conf_sigalgs) {
@@ -1121,7 +1121,7 @@ int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s,
# endif
/* Check signature matches a type we sent */
- sent_sigslen = tls12_get_psigalgs(s, &sent_sigs);
+ sent_sigslen = tls12_get_psigalgs(s, 1, &sent_sigs);
for (i = 0; i < sent_sigslen; i += 2, sent_sigs += 2) {
if (sig[0] == sent_sigs[0] && sig[1] == sent_sigs[1])
break;
@@ -1169,7 +1169,7 @@ void ssl_set_client_disabled(SSL *s)
* Now go through all signature algorithms seeing if we support any for
* RSA, DSA, ECDSA. Do this for all versions not just TLS 1.2.
*/
- sigalgslen = tls12_get_psigalgs(s, &sigalgs);
+ sigalgslen = tls12_get_psigalgs(s, 1, &sigalgs);
for (i = 0; i < sigalgslen; i += 2, sigalgs += 2) {
switch (sigalgs[1]) {
# ifndef OPENSSL_NO_RSA
@@ -1440,7 +1440,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf,
if (SSL_CLIENT_USE_SIGALGS(s)) {
size_t salglen;
const unsigned char *salg;
- salglen = tls12_get_psigalgs(s, &salg);
+ salglen = tls12_get_psigalgs(s, 1, &salg);
/*-
* check for enough space.
@@ -1769,6 +1769,9 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf,
return NULL;
s2n(TLSEXT_TYPE_session_ticket, ret);
s2n(0, ret);
+ } else {
+ /* if we don't add the above TLSEXT, we can't add a session ticket later */
+ s->tlsext_ticket_expected = 0;
}
if (s->tlsext_status_expected) {
@@ -3574,8 +3577,14 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
p = sdec;
sess = d2i_SSL_SESSION(NULL, &p, slen);
+ slen -= p - sdec;
OPENSSL_free(sdec);
if (sess) {
+ /* Some additional consistency checks */
+ if (slen != 0 || sess->session_id_length != 0) {
+ SSL_SESSION_free(sess);
+ return 2;
+ }
/*
* The session ID, if non-empty, is used by some clients to detect
* that the ticket has been accepted. So we copy it to the session
@@ -3803,7 +3812,7 @@ static int tls1_set_shared_sigalgs(SSL *s)
conf = c->conf_sigalgs;
conflen = c->conf_sigalgslen;
} else
- conflen = tls12_get_psigalgs(s, &conf);
+ conflen = tls12_get_psigalgs(s, 0, &conf);
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || is_suiteb) {
pref = conf;
preflen = conflen;
diff --git a/deps/openssl/openssl/test/Makefile b/deps/openssl/openssl/test/Makefile
index 8f272ef99d5ee2..a324eeb39ac317 100644
--- a/deps/openssl/openssl/test/Makefile
+++ b/deps/openssl/openssl/test/Makefile
@@ -307,6 +307,7 @@ test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
fi
../util/shlib_wrap.sh ./$(SSLTEST) -test_cipherlist
@sh ./testssl keyU.ss certU.ss certCA.ss
+ @sh ./testssl keyU.ss certU.ss certCA.ss -rle
@sh ./testsslproxy keyP1.ss certP1.ss intP1.ss
@sh ./testsslproxy keyP2.ss certP2.ss intP2.ss
diff --git a/deps/openssl/openssl/test/ssltest_old b/deps/openssl/openssl/test/ssltest_old
new file mode 100755
index 00000000000000..3e3a27d41d7daf
Binary files /dev/null and b/deps/openssl/openssl/test/ssltest_old differ
diff --git a/deps/openssl/openssl/test/testssl b/deps/openssl/openssl/test/testssl
index a6f9fa770b3647..d7dda6e9a5af4c 100644
--- a/deps/openssl/openssl/test/testssl
+++ b/deps/openssl/openssl/test/testssl
@@ -292,4 +292,25 @@ if [ -z "$extra" -a `uname -m` = "x86_64" ]; then
$ssltest -cipher AES128-SHA256 -bytes 8m || exit 1
fi
+
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 no -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 no -c_ticket yes -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 yes -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 yes -c_ticket yes -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 no -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 no -c_ticket yes -ticket_expect yes || exit 1
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 yes -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client alice -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 yes -c_ticket yes -ticket_expect yes || exit 1
+
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 no -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 no -c_ticket yes -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 yes -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 no -s_ticket2 yes -c_ticket yes -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 no -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 no -c_ticket yes -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 yes -c_ticket no -ticket_expect no || exit 1
+$ssltest -bio_pair -sn_client bob -sn_server1 alice -sn_server2 bob -s_ticket1 yes -s_ticket2 yes -c_ticket yes -ticket_expect yes || exit 1
+
+$ssltest -bio_pair -s_ticket1 broken -c_ticket yes -ticket_expect no || exit 1
+
exit 0
diff --git a/deps/openssl/openssl/test/testutil.h b/deps/openssl/openssl/test/testutil.h
index 75f0c8ae01ee14..e40b37ed6e7a70 100644
--- a/deps/openssl/openssl/test/testutil.h
+++ b/deps/openssl/openssl/test/testutil.h
@@ -103,7 +103,7 @@
* TEST_CASE_NAME is defined as the name of the test case function where
* possible; otherwise we get by with the file name and line number.
*/
-# if __STDC_VERSION__ < 199901L
+# if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
# if defined(_MSC_VER)
# define TEST_CASE_NAME __FUNCTION__
# else
diff --git a/deps/openssl/openssl/test/v3ext b/deps/openssl/openssl/test/v3ext
new file mode 100755
index 00000000000000..09a0c3aa326f4b
Binary files /dev/null and b/deps/openssl/openssl/test/v3ext differ
diff --git a/deps/openssl/openssl/test/x509aux b/deps/openssl/openssl/test/x509aux
new file mode 100755
index 00000000000000..35378a8ff9aee5
Binary files /dev/null and b/deps/openssl/openssl/test/x509aux differ
diff --git a/deps/openssl/openssl/util/domd b/deps/openssl/openssl/util/domd
index bc2a85f7dd5076..5a92559c9b7a83 100755
--- a/deps/openssl/openssl/util/domd
+++ b/deps/openssl/openssl/util/domd
@@ -34,11 +34,11 @@ else
${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new
RC=$?
fi
-if ! cmp -s Makefile.save Makefile.new; then
- mv Makefile.new Makefile
-else
+if cmp -s Makefile.save Makefile.new; then
mv Makefile.save Makefile
rm -f Makefile.new
+else
+ mv Makefile.new Makefile
fi
# unfake the presence of Kerberos
rm $TOP/krb5.h
diff --git a/deps/openssl/openssl/util/mk1mf.pl b/deps/openssl/openssl/util/mk1mf.pl
index 7a3ae11f7865fe..490a034e4037e6 100755
--- a/deps/openssl/openssl/util/mk1mf.pl
+++ b/deps/openssl/openssl/util/mk1mf.pl
@@ -1207,6 +1207,7 @@ sub read_options
"no-ssl3-method" => 0,
"no-tlsext" => \$no_tlsext,
"no-tls1" => \$no_tls1,
+ "no-dtls1" => 0,
"no-srp" => \$no_srp,
"no-cms" => \$no_cms,
"no-jpake" => \$no_jpake,
diff --git a/deps/v8/src/objects-body-descriptors.h b/deps/v8/src/objects-body-descriptors.h
index 91cb8883be8873..a1c3634bd762d7 100644
--- a/deps/v8/src/objects-body-descriptors.h
+++ b/deps/v8/src/objects-body-descriptors.h
@@ -99,7 +99,7 @@ class FixedBodyDescriptor final : public BodyDescriptorBase {
template
static inline void IterateBody(HeapObject* obj, int object_size) {
- IterateBody(obj);
+ IterateBody(obj);
}
};
diff --git a/deps/v8/src/objects-inl.h b/deps/v8/src/objects-inl.h
index 11f4d7498d7558..72208c2f00f4a9 100644
--- a/deps/v8/src/objects-inl.h
+++ b/deps/v8/src/objects-inl.h
@@ -36,6 +36,27 @@
namespace v8 {
namespace internal {
+template
+uint32_t HashTable::Hash(Key key) {
+ if (Shape::UsesSeed) {
+ return Shape::SeededHash(key, GetHeap()->HashSeed());
+ } else {
+ return Shape::Hash(key);
+ }
+}
+
+
+template
+uint32_t HashTable::HashForObject(Key key,
+ Object* object) {
+ if (Shape::UsesSeed) {
+ return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
+ } else {
+ return Shape::HashForObject(key, object);
+ }
+}
+
+
PropertyDetails::PropertyDetails(Smi* smi) {
value_ = smi->value();
}
diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h
index d1632c9deb2982..47b02dadcff965 100644
--- a/deps/v8/src/objects.h
+++ b/deps/v8/src/objects.h
@@ -3261,22 +3261,10 @@ class HashTableBase : public FixedArray {
template
class HashTable : public HashTableBase {
public:
- // Wrapper methods
- inline uint32_t Hash(Key key) {
- if (Shape::UsesSeed) {
- return Shape::SeededHash(key, GetHeap()->HashSeed());
- } else {
- return Shape::Hash(key);
- }
- }
-
- inline uint32_t HashForObject(Key key, Object* object) {
- if (Shape::UsesSeed) {
- return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
- } else {
- return Shape::HashForObject(key, object);
- }
- }
+ // Wrapper methods. Defined in src/objects-inl.h
+ // to break a cycle with src/heap/heap.h.
+ inline uint32_t Hash(Key key);
+ inline uint32_t HashForObject(Key key, Object* object);
// Returns a new HashTable object.
MUST_USE_RESULT static Handle New(
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/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md
index 0d3fc001073fcb..32be23d126f101 100644
--- a/doc/STYLE_GUIDE.md
+++ b/doc/STYLE_GUIDE.md
@@ -1,16 +1,17 @@
# Style Guide
* Documents are written in markdown files.
-* Those files should be written in **`lowercase-with-dashes.md`.**
+* Those files should be written in **`lowercase-with-dashes.md`**.
* Underscores in filenames are allowed only when they are present in the
- topic the document will describe (e.g., `child_process`.)
+ topic the document will describe (e.g., `child_process`).
* Filenames should be **lowercase**.
* Some files, such as top-level markdown files, are exceptions.
* Older files may use the `.markdown` extension. These may be ported to `.md`
at will. **Prefer `.md` for all new documents.**
* Documents should be word-wrapped at 80 characters.
* The formatting described in `.editorconfig` is preferred.
- * A [plugin][] is available for some editors to automatically apply these rules.
+ * A [plugin][] is available for some editors to automatically apply these
+ rules.
* Mechanical issues, like spelling and grammar, should be identified by tools,
insofar as is possible. If not caught by a tool, they should be pointed out by
human reviewers.
@@ -18,12 +19,12 @@
"color" vs. "colour", etc.
* Though controversial, the [Oxford comma][] is preferred for clarity's sake.
* Generally avoid personal pronouns in reference documentation ("I", "you",
- "we".)
+ "we").
* Pronouns are acceptable in more colloquial documentation, like guides.
* Use **gender-neutral pronouns** and **mass nouns**. Non-comprehensive
examples:
* **OK**: "they", "their", "them", "folks", "people", "developers", "cats"
- * **NOT OK**: "his", "hers", "him", "her", "guys", "dudes".
+ * **NOT OK**: "his", "hers", "him", "her", "guys", "dudes"
* When combining wrapping elements (parentheses and quotes), terminal
punctuation should be placed:
* Inside the wrapping element if the wrapping element contains a complete
@@ -39,8 +40,8 @@
* When documenting APIs, note the version the API was introduced in at
the end of the section. If an API has been deprecated, also note the first
version that the API appeared deprecated in.
-* When using dashes, use emdashes ("—", Ctrl+Alt+"-" on macOS) surrounded by
- spaces, per the New York Times usage.
+* When using dashes, use [Em dashes][] ("—" or `Option+Shift+"-"` on macOS)
+ surrounded by spaces, as per [The New York Times Manual of Style and Usage][].
* Including assets:
* If you wish to add an illustration or full program, add it to the
appropriate sub-directory in the `assets/` dir.
@@ -54,10 +55,14 @@
your point, not as complete running programs. If a complete running program
is necessary, include it as an asset in `assets/code-examples` and link to
it.
-* When using underscores, asterisks and backticks please use proper escaping (**\\\_**, **\\\*** and **\\\`** instead of **\_**, **\*** and **\`**)
-* References to constructor functions should use PascalCase
-* References to constructor instances should be camelCased
-* References to methods should be used with parentheses: `socket.end()` instead of `socket.end`
+* When using underscores, asterisks, and backticks, please use proper escaping
+ (**\\\_**, **\\\*** and **\\\`** instead of **\_**, **\*** and **\`**).
+* References to constructor functions should use PascalCase.
+* References to constructor instances should use camelCase.
+* References to methods should be used with parentheses: for example,
+ `socket.end()` instead of `socket.end`.
[plugin]: http://editorconfig.org/#download
[Oxford comma]: https://en.wikipedia.org/wiki/Serial_comma
+[Em dashes]: https://en.wikipedia.org/wiki/Dash#Em_dash
+[The New York Times Manual of Style and Usage]: https://en.wikipedia.org/wiki/The_New_York_Times_Manual_of_Style_and_Usage
diff --git a/doc/api/addons.md b/doc/api/addons.md
index 58f029fb20e98b..4d29b718ab9dcd 100644
--- a/doc/api/addons.md
+++ b/doc/api/addons.md
@@ -1096,7 +1096,7 @@ void init(Local exports) {
AtExit(at_exit_cb1, exports->GetIsolate());
}
-NODE_MODULE(addon, init);
+NODE_MODULE(addon, init)
} // namespace demo
```
diff --git a/doc/api/assert.md b/doc/api/assert.md
index 873f03e77553b2..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
```
@@ -199,7 +199,7 @@ added: v0.1.21
* `actual` {any}
* `expected` {any}
* `message` {any}
-* `operator` {String}
+* `operator` {string}
Throws an `AssertionError`. If `message` is falsy, the error message is set as
the values of `actual` and `expected` separated by the provided `operator`.
@@ -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 106d4f58f0c4fa..69e800ae09e761 100644
--- a/doc/api/buffer.md
+++ b/doc/api/buffer.md
@@ -350,8 +350,8 @@ deprecated: v6.0.0
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a
[`TypedArray`].
-* `byteOffset` {Integer} Index of first byte to expose. **Default:** `0`
-* `length` {Integer} Number of bytes to expose.
+* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`
+* `length` {integer} Number of bytes to expose.
**Default:** `arrayBuffer.length - byteOffset`
This creates a view of the [`ArrayBuffer`] without copying the underlying
@@ -391,7 +391,7 @@ deprecated: v6.0.0
> Stability: 0 - Deprecated: Use [`Buffer.alloc()`] instead (also see
> [`Buffer.allocUnsafe()`]).
-* `size` {Integer} The desired length of the new `Buffer`
+* `size` {integer} The desired length of the new `Buffer`
Allocates a new `Buffer` of `size` bytes. The `size` must be less than or equal
to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is thrown.
@@ -424,8 +424,8 @@ deprecated: v6.0.0
> Stability: 0 - Deprecated:
> Use [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] instead.
-* `string` {String} String to encode
-* `encoding` {String} The encoding of `string`. **Default:** `'utf8'`
+* `string` {string} String to encode
+* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`
Creates a new `Buffer` containing the given JavaScript string `string`. If
provided, the `encoding` parameter identifies the character encoding of `string`.
@@ -453,10 +453,10 @@ console.log(buf2.toString());
added: v5.10.0
-->
-* `size` {Integer} The desired length of the new `Buffer`
-* `fill` {String | Buffer | Integer} A value to pre-fill the new `Buffer` with.
+* `size` {integer} The desired length of the new `Buffer`
+* `fill` {string|Buffer|integer} A value to pre-fill the new `Buffer` with.
**Default:** `0`
-* `encoding` {String} If `fill` is a string, this is its encoding.
+* `encoding` {string} If `fill` is a string, this is its encoding.
**Default:** `'utf8'`
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
@@ -510,7 +510,7 @@ A `TypeError` will be thrown if `size` is not a number.
added: v5.10.0
-->
-* `size` {Integer} The desired length of the new `Buffer`
+* `size` {integer} The desired length of the new `Buffer`
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must
be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a
@@ -556,7 +556,7 @@ additional performance that [`Buffer.allocUnsafe()`] provides.
added: v5.10.0
-->
-* `size` {Integer} The desired length of the new `Buffer`
+* `size` {integer} The desired length of the new `Buffer`
Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The
`size` must be less than or equal to the value of [`buffer.kMaxLength`].
@@ -609,11 +609,11 @@ A `TypeError` will be thrown if `size` is not a number.
added: v0.1.90
-->
-* `string` {String | Buffer | TypedArray | DataView | ArrayBuffer} A value to
+* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer} A value to
calculate the length of
-* `encoding` {String} If `string` is a string, this is its encoding.
+* `encoding` {string} If `string` is a string, this is its encoding.
**Default:** `'utf8'`
-* Returns: {Integer} The number of bytes contained within `string`
+* Returns: {integer} The number of bytes contained within `string`
Returns the actual byte length of a string. This is not the same as
[`String.prototype.length`] since that returns the number of *characters* in
@@ -645,7 +645,7 @@ added: v0.11.13
* `buf1` {Buffer}
* `buf2` {Buffer}
-* Returns: {Integer}
+* Returns: {integer}
Compares `buf1` to `buf2` typically for the purpose of sorting arrays of
`Buffer` instances. This is equivalent to calling
@@ -669,7 +669,7 @@ added: v0.7.11
-->
* `list` {Array} List of `Buffer` instances to concat
-* `totalLength` {Integer} Total length of the `Buffer` instances in `list`
+* `totalLength` {integer} Total length of the `Buffer` instances in `list`
when concatenated
* Returns: {Buffer}
@@ -684,6 +684,10 @@ in `list`. This however causes an additional loop to be executed in order to
calculate the `totalLength`, so it is faster to provide the length explicitly if
it is already known.
+If `totalLength` is provided, it is coerced to an unsigned integer. If the
+combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
+truncated to `totalLength`.
+
Example: Create a single `Buffer` from a list of three `Buffer` instances
```js
@@ -729,8 +733,8 @@ added: v5.10.0
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a
[`TypedArray`].
-* `byteOffset` {Integer} Index of first byte to expose. **Default:** `0`
-* `length` {Integer} Number of bytes to expose.
+* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`
+* `length` {integer} Number of bytes to expose.
**Default:** `arrayBuffer.length - byteOffset`
This creates a view of the [`ArrayBuffer`] without copying the underlying
@@ -805,8 +809,8 @@ A `TypeError` will be thrown if `buffer` is not a `Buffer`.
added: v5.10.0
-->
-* `string` {String} A string to encode.
-* `encoding` {String} The encoding of `string`. **Default:** `'utf8'`
+* `string` {string} A string to encode.
+* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`
Creates a new `Buffer` containing the given JavaScript string `string`. If
provided, the `encoding` parameter identifies the character encoding of `string`.
@@ -837,7 +841,7 @@ added: v0.1.101
-->
* `obj` {Object}
-* Returns: {Boolean}
+* Returns: {boolean}
Returns `true` if `obj` is a `Buffer`, `false` otherwise.
@@ -846,8 +850,8 @@ Returns `true` if `obj` is a `Buffer`, `false` otherwise.
added: v0.9.1
-->
-* `encoding` {String} A character encoding name to check
-* Returns: {Boolean}
+* `encoding` {string} A character encoding name to check
+* Returns: {boolean}
Returns `true` if `encoding` contains a supported character encoding, or `false`
otherwise.
@@ -857,7 +861,7 @@ otherwise.
added: v0.11.3
-->
-* {Integer} **Default:** `8192`
+* {integer} **Default:** `8192`
This is the number of bytes used to determine the size of pre-allocated, internal
`Buffer` instances used for pooling. This value may be modified.
@@ -882,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);
}
@@ -896,17 +900,17 @@ added: v0.11.13
-->
* `target` {Buffer} A `Buffer` to compare to
-* `targetStart` {Integer} The offset within `target` at which to begin
+* `targetStart` {integer} The offset within `target` at which to begin
comparison. **Default:** `0`
-* `targetEnd` {Integer} The offset with `target` at which to end comparison
+* `targetEnd` {integer} The offset with `target` at which to end comparison
(not inclusive). Ignored when `targetStart` is `undefined`.
**Default:** `target.length`
-* `sourceStart` {Integer} The offset within `buf` at which to begin comparison.
+* `sourceStart` {integer} The offset within `buf` at which to begin comparison.
Ignored when `targetStart` is `undefined`. **Default:** `0`
-* `sourceEnd` {Integer} The offset within `buf` at which to end comparison
+* `sourceEnd` {integer} The offset within `buf` at which to end comparison
(not inclusive). Ignored when `targetStart` is `undefined`.
**Default:** [`buf.length`]
-* Returns: {Integer}
+* Returns: {integer}
Compares `buf` with `target` and returns a number indicating whether `buf`
comes before, after, or is the same as `target` in sort order.
@@ -972,13 +976,13 @@ added: v0.1.90
-->
* `target` {Buffer|Uint8Array} A `Buffer` or [`Uint8Array`] to copy into.
-* `targetStart` {Integer} The offset within `target` at which to begin
+* `targetStart` {integer} The offset within `target` at which to begin
copying to. **Default:** `0`
-* `sourceStart` {Integer} The offset within `buf` at which to begin copying from.
+* `sourceStart` {integer} The offset within `buf` at which to begin copying from.
Ignored when `targetStart` is `undefined`. **Default:** `0`
-* `sourceEnd` {Integer} The offset within `buf` at which to stop copying (not
+* `sourceEnd` {integer} The offset within `buf` at which to stop copying (not
inclusive). Ignored when `sourceStart` is `undefined`. **Default:** [`buf.length`]
-* Returns: {Integer} The number of bytes copied.
+* Returns: {integer} The number of bytes copied.
Copies data from a region of `buf` to a region in `target` even if the `target`
memory region overlaps with `buf`.
@@ -990,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;
}
@@ -1007,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;
}
@@ -1051,7 +1055,7 @@ added: v0.11.13
-->
* `otherBuffer` {Buffer} A `Buffer` to compare to
-* Returns: {Boolean}
+* Returns: {boolean}
Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,
`false` otherwise.
@@ -1075,10 +1079,10 @@ console.log(buf1.equals(buf3));
added: v0.5.0
-->
-* `value` {String | Buffer | Integer} The value to fill `buf` with
-* `offset` {Integer} Where to start filling `buf`. **Default:** `0`
-* `end` {Integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`]
-* `encoding` {String} If `value` is a string, this is its encoding.
+* `value` {string|Buffer|integer} The value to fill `buf` with
+* `offset` {integer} Where to start filling `buf`. **Default:** `0`
+* `end` {integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`]
+* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Returns: {Buffer} A reference to `buf`
@@ -1107,16 +1111,57 @@ Example: Fill a `Buffer` with a two-byte character
console.log(Buffer.allocUnsafe(3).fill('\u0222'));
```
+### buf.includes(value[, byteOffset][, encoding])
+
+
+* `value` {string|Buffer|integer} What to search for
+* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`
+* `encoding` {string} If `value` is a string, this is its encoding.
+ **Default:** `'utf8'`
+* Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise
+
+Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`].
+
+Examples:
+
+```js
+const buf = Buffer.from('this is a buffer');
+
+// Prints: true
+console.log(buf.includes('this'));
+
+// Prints: true
+console.log(buf.includes('is'));
+
+// Prints: true
+console.log(buf.includes(Buffer.from('a buffer')));
+
+// Prints: true
+// (97 is the decimal ASCII value for 'a')
+console.log(buf.includes(97));
+
+// Prints: false
+console.log(buf.includes(Buffer.from('a buffer example')));
+
+// Prints: true
+console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));
+
+// Prints: false
+console.log(buf.includes('this', 4));
+```
+
### buf.indexOf(value[, byteOffset][, encoding])
-* `value` {String | Buffer | Integer} What to search for
-* `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0`
-* `encoding` {String} If `value` is a string, this is its encoding.
+* `value` {string | Buffer | integer} What to search for
+* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`
+* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
-* Returns: {Integer} The index of the first occurrence of `value` in `buf` or `-1`
+* Returns: {integer} The index of the first occurrence of `value` in `buf` or `-1`
if `buf` does not contain `value`
If `value` is:
@@ -1258,12 +1303,12 @@ for (const key of buf.keys()) {
added: v6.0.0
-->
-* `value` {String | Buffer | Integer} What to search for
-* `byteOffset` {Integer} Where to begin searching in `buf`.
+* `value` {string | Buffer | integer} What to search for
+* `byteOffset` {integer} Where to begin searching in `buf`.
**Default:** [`buf.length`]` - 1`
-* `encoding` {String} If `value` is a string, this is its encoding.
+* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
-* Returns: {Integer} The index of the last occurrence of `value` in `buf` or `-1`
+* Returns: {integer} The index of the last occurrence of `value` in `buf` or `-1`
if `buf` does not contain `value`
Identical to [`buf.indexOf()`], except `buf` is searched from back to front
@@ -1338,7 +1383,7 @@ console.log(b.lastIndexOf('b', []));
added: v0.1.90
-->
-* {Integer}
+* {integer}
Returns the amount of memory allocated for `buf` in bytes. Note that this
does not necessarily reflect the amount of "usable" data within `buf`.
@@ -1384,9 +1429,9 @@ console.log(buf.length);
added: v0.11.15
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Number}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {number}
Reads a 64-bit double from `buf` at the specified `offset` with specified
endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns
@@ -1420,9 +1465,9 @@ console.log(buf.readDoubleLE(1, true));
added: v0.11.15
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Number}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {number}
Reads a 32-bit float from `buf` at the specified `offset` with specified
endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns
@@ -1455,9 +1500,9 @@ console.log(buf.readFloatLE(1, true));
added: v0.5.0
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {integer}
Reads a signed 8-bit integer from `buf` at the specified `offset`.
@@ -1487,9 +1532,9 @@ console.log(buf.readInt8(2));
added: v0.5.5
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {integer}
Reads a signed 16-bit integer from `buf` at the specified `offset` with
the specified endian format (`readInt16BE()` returns big endian,
@@ -1521,9 +1566,9 @@ console.log(buf.readInt16LE(1));
added: v0.5.5
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {integer}
Reads a signed 32-bit integer from `buf` at the specified `offset` with
the specified endian format (`readInt32BE()` returns big endian,
@@ -1555,10 +1600,10 @@ console.log(buf.readInt32LE(1));
added: v0.11.15
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
-* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
-* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
+* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
+* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
+* Returns: {integer}
Reads `byteLength` number of bytes from `buf` at the specified `offset`
and interprets the result as a two's complement signed value. Supports up to 48
@@ -1587,9 +1632,9 @@ console.log(buf.readIntBE(1, 6).toString(16));
added: v0.5.0
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {integer}
Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
@@ -1617,9 +1662,9 @@ console.log(buf.readUInt8(2));
added: v0.5.5
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {integer}
Reads an unsigned 16-bit integer from `buf` at the specified `offset` with
specified endian format (`readUInt16BE()` returns big endian, `readUInt16LE()`
@@ -1655,9 +1700,9 @@ console.log(buf.readUInt16LE(2).toString(16));
added: v0.5.5
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
-* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
+* `noAssert` {boolean} Skip `offset` validation? **Default:** `false`
+* Returns: {integer}
Reads an unsigned 32-bit integer from `buf` at the specified `offset` with
specified endian format (`readUInt32BE()` returns big endian,
@@ -1687,10 +1732,10 @@ console.log(buf.readUInt32LE(1).toString(16));
added: v0.11.15
-->
-* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
-* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
-* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
-* Returns: {Integer}
+* `offset` {integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
+* `byteLength` {integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
+* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
+* Returns: {integer}
Reads `byteLength` number of bytes from `buf` at the specified `offset`
and interprets the result as an unsigned integer. Supports up to 48
@@ -1719,8 +1764,8 @@ console.log(buf.readUIntBE(1, 6).toString(16));
added: v0.3.0
-->
-* `start` {Integer} Where the new `Buffer` will start. **Default:** `0`
-* `end` {Integer} Where the new `Buffer` will end (not inclusive).
+* `start` {integer} Where the new `Buffer` will start. **Default:** `0`
+* `end` {integer} Where the new `Buffer` will end (not inclusive).
**Default:** [`buf.length`]
* Returns: {Buffer}
@@ -1736,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;
}
@@ -1871,11 +1916,11 @@ for working with 64-bit floats.
added: v0.1.90
-->
-* `encoding` {String} The character encoding to decode to. **Default:** `'utf8'`
-* `start` {Integer} The byte offset to start decoding at. **Default:** `0`
-* `end` {Integer} The byte offset to stop decoding at (not inclusive).
+* `encoding` {string} The character encoding to decode to. **Default:** `'utf8'`
+* `start` {integer} The byte offset to start decoding at. **Default:** `0`
+* `end` {integer} The byte offset to stop decoding at (not inclusive).
**Default:** [`buf.length`]
-* Returns: {String}
+* Returns: {string}
Decodes `buf` to a string according to the specified character encoding in
`encoding`. `start` and `end` may be passed to decode only a subset of `buf`.
@@ -1885,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;
}
@@ -1929,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:
@@ -1981,11 +2026,11 @@ for (const value of buf) {
added: v0.1.90
-->
-* `string` {String} String to be written to `buf`
-* `offset` {Integer} Where to start writing `string`. **Default:** `0`
-* `length` {Integer} How many bytes to write. **Default:** `buf.length - offset`
-* `encoding` {String} The character encoding of `string`. **Default:** `'utf8'`
-* Returns: {Integer} Number of bytes written
+* `string` {string} String to be written to `buf`
+* `offset` {integer} Where to start writing `string`. **Default:** `0`
+* `length` {integer} How many bytes to write. **Default:** `buf.length - offset`
+* `encoding` {string} The character encoding of `string`. **Default:** `'utf8'`
+* Returns: {integer} Number of bytes written
Writes `string` to `buf` at `offset` according to the character encoding in `encoding`.
The `length` parameter is the number of bytes to write. If `buf` did not contain
@@ -2009,10 +2054,10 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
added: v0.11.15
-->
-* `value` {Number} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {number} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little
@@ -2044,10 +2089,10 @@ console.log(buf);
added: v0.11.15
-->
-* `value` {Number} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {number} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little
@@ -2078,10 +2123,10 @@ console.log(buf);
added: v0.5.0
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid
signed 8-bit integer. Behavior is undefined when `value` is anything other than
@@ -2110,10 +2155,10 @@ console.log(buf);
added: v0.5.5
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little
@@ -2143,10 +2188,10 @@ console.log(buf);
added: v0.5.5
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little
@@ -2176,12 +2221,12 @@ console.log(buf);
added: v0.11.15
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength`
-* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
-* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation?
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength`
+* `byteLength` {integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
+* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation?
**Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* Returns: {integer} `offset` plus the number of bytes written
Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is
@@ -2211,10 +2256,10 @@ console.log(buf);
added: v0.5.0
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset`. `value` *should* be a
valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
@@ -2243,10 +2288,10 @@ console.log(buf);
added: v0.5.5
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little
@@ -2280,10 +2325,10 @@ console.log(buf);
added: v0.5.5
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
-* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
+* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false`
+* Returns: {integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little
@@ -2315,12 +2360,12 @@ console.log(buf);
added: v0.5.5
-->
-* `value` {Integer} Number to be written to `buf`
-* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength`
-* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
-* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation?
+* `value` {integer} Number to be written to `buf`
+* `offset` {integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength`
+* `byteLength` {integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
+* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation?
**Default:** `false`
-* Returns: {Integer} `offset` plus the number of bytes written
+* Returns: {integer} `offset` plus the number of bytes written
Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is
@@ -2350,7 +2395,7 @@ console.log(buf);
added: v0.5.4
-->
-* {Integer} **Default:** `50`
+* {integer} **Default:** `50`
Returns the maximum number of bytes that will be returned when
`buf.inspect()` is called. This can be overridden by user modules. See
@@ -2364,7 +2409,7 @@ Note that this is a property on the `buffer` module as returned by
added: v3.0.0
-->
-* {Integer} The largest size allowed for a single `Buffer` instance
+* {integer} The largest size allowed for a single `Buffer` instance
On 32-bit architectures, this value is `(2^30)-1` (~1GB).
On 64-bit architectures, this value is `(2^31)-1` (~2GB).
@@ -2416,7 +2461,7 @@ deprecated: v6.0.0
> Stability: 0 - Deprecated: Use [`Buffer.allocUnsafeSlow()`] instead.
-* `size` {Integer} The desired length of the new `SlowBuffer`
+* `size` {integer} The desired length of the new `SlowBuffer`
Allocates a new `SlowBuffer` of `size` bytes. The `size` must be less than
or equal to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index d7a94e7debb2ec..11c40f425fd93e 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) => {
@@ -125,25 +127,25 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => {
added: v0.1.90
-->
-* `command` {String} The command to run, with space-separated arguments
+* `command` {string} The command to run, with space-separated arguments
* `options` {Object}
- * `cwd` {String} Current working directory of the child process
+ * `cwd` {string} Current working directory of the child process
* `env` {Object} Environment key-value pairs
- * `encoding` {String} (Default: `'utf8'`)
- * `shell` {String} Shell to execute the command with
+ * `encoding` {string} (Default: `'utf8'`)
+ * `shell` {string} Shell to execute the command with
(Default: `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows, The shell should
understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows,
command line parsing should be compatible with `cmd.exe`.)
- * `timeout` {Number} (Default: `0`)
- * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on
+ * `timeout` {number} (Default: `0`)
+ * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
stdout or stderr - if exceeded child process is killed (Default: `200*1024`)
- * `killSignal` {String|Integer} (Default: `'SIGTERM'`)
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
+ * `killSignal` {string|integer} (Default: `'SIGTERM'`)
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
* `callback` {Function} called with the output when process terminates
* `error` {Error}
- * `stdout` {String|Buffer}
- * `stderr` {String|Buffer}
+ * `stdout` {string|Buffer}
+ * `stderr` {string|Buffer}
* Returns: {ChildProcess}
Spawns a shell then executes the `command` within that shell, buffering any
@@ -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,
+ maxBuffer: 200 * 1024,
killSignal: 'SIGTERM',
cwd: null,
env: null
-}
+};
```
If `timeout` is greater than `0`, the parent will send the signal
@@ -205,22 +207,22 @@ replace the existing process and uses a shell to execute the command.*
added: v0.1.91
-->
-* `file` {String} The name or path of the executable file to run
+* `file` {string} The name or path of the executable file to run
* `args` {Array} List of string arguments
* `options` {Object}
- * `cwd` {String} Current working directory of the child process
+ * `cwd` {string} Current working directory of the child process
* `env` {Object} Environment key-value pairs
- * `encoding` {String} (Default: `'utf8'`)
- * `timeout` {Number} (Default: `0`)
- * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on
+ * `encoding` {string} (Default: `'utf8'`)
+ * `timeout` {number} (Default: `0`)
+ * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
stdout or stderr - if exceeded child process is killed (Default: `200*1024`)
- * `killSignal` {String|Integer} (Default: `'SIGTERM'`)
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
+ * `killSignal` {string|integer} (Default: `'SIGTERM'`)
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
* `callback` {Function} called with the output when process terminates
* `error` {Error}
- * `stdout` {String|Buffer}
- * `stderr` {String|Buffer}
+ * `stdout` {string|Buffer}
+ * `stderr` {string|Buffer}
* Returns: {ChildProcess}
The `child_process.execFile()` function is similar to [`child_process.exec()`][]
@@ -253,15 +255,15 @@ encoding, `Buffer` objects will be passed to the callback instead.
added: v0.5.0
-->
-* `modulePath` {String} The module to run in the child
+* `modulePath` {string} The module to run in the child
* `args` {Array} List of string arguments
* `options` {Object}
- * `cwd` {String} Current working directory of the child process
+ * `cwd` {string} Current working directory of the child process
* `env` {Object} Environment key-value pairs
- * `execPath` {String} Executable used to create the child process
+ * `execPath` {string} Executable used to create the child process
* `execArgv` {Array} List of string arguments passed to the executable
(Default: `process.execArgv`)
- * `silent` {Boolean} If `true`, stdin, stdout, and stderr of the child will be
+ * `silent` {boolean} If `true`, stdin, stdout, and stderr of the child will be
piped to the parent, otherwise they will be inherited from the parent, see
the `'pipe'` and `'inherit'` options for [`child_process.spawn()`][]'s
[`stdio`][] for more details (Default: `false`)
@@ -269,8 +271,8 @@ added: v0.5.0
[`stdio`][] option. When this option is provided, it overrides `silent`.
The array must contain exactly one item with value `'ipc'` or an error will
be thrown. For instance `[0, 1, 2, 'ipc']`.
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
* Returns: {ChildProcess}
The `child_process.fork()` method is a special case of
@@ -304,21 +306,21 @@ not clone the current process.*
added: v0.1.90
-->
-* `command` {String} The command to run
+* `command` {string} The command to run
* `args` {Array} List of string arguments
* `options` {Object}
- * `cwd` {String} Current working directory of the child process
+ * `cwd` {string} Current working directory of the child process
* `env` {Object} Environment key-value pairs
- * `argv0` {String} Explicitly set the value of `argv[0]` sent to the child
+ * `argv0` {string} Explicitly set the value of `argv[0]` sent to the child
process. This will be set to `command` if not specified.
- * `stdio` {Array|String} Child's stdio configuration. (See
+ * `stdio` {Array|string} Child's stdio configuration. (See
[`options.stdio`][`stdio`])
- * `detached` {Boolean} Prepare child to run independently of its parent
+ * `detached` {boolean} Prepare child to run independently of its parent
process. Specific behavior depends on the platform, see
[`options.detached`][])
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
- * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
+ * `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses
`'/bin/sh'` on UNIX, and `'cmd.exe'` on Windows. A different shell can be
specified as a string. The shell should understand the `-c` switch on UNIX,
or `/s /c` on Windows. Defaults to `false` (no shell).
@@ -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.
@@ -576,27 +578,27 @@ configuration at startup.
added: v0.11.12
-->
-* `file` {String} The name or path of the executable file to run
+* `file` {string} The name or path of the executable file to run
* `args` {Array} List of string arguments
* `options` {Object}
- * `cwd` {String} Current working directory of the child process
- * `input` {String|Buffer} The value which will be passed as stdin to the
+ * `cwd` {string} Current working directory of the child process
+ * `input` {string|Buffer} The value which will be passed as stdin to the
spawned process
- supplying this value will override `stdio[0]`
- * `stdio` {String | Array} Child's stdio configuration. (Default: `'pipe'`)
+ * `stdio` {string|Array} Child's stdio configuration. (Default: `'pipe'`)
- `stderr` by default will be output to the parent process' stderr unless
`stdio` is specified
* `env` {Object} Environment key-value pairs
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
- * `timeout` {Number} In milliseconds the maximum amount of time the process
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
+ * `timeout` {number} In milliseconds the maximum amount of time the process
is allowed to run. (Default: `undefined`)
- * `killSignal` {String|Integer} The signal value to be used when the spawned
+ * `killSignal` {string|integer} The signal value to be used when the spawned
process will be killed. (Default: `'SIGTERM'`)
- * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on
+ * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
stdout or stderr - if exceeded child process is killed
- * `encoding` {String} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`)
-* Returns: {Buffer|String} The stdout from the command
+ * `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`)
+* Returns: {Buffer|string} The stdout from the command
The `child_process.execFileSync()` method is generally identical to
[`child_process.execFile()`][] with the exception that the method will not return
@@ -615,31 +617,31 @@ throw. The [`Error`][] object will contain the entire result from
added: v0.11.12
-->
-* `command` {String} The command to run
+* `command` {string} The command to run
* `options` {Object}
- * `cwd` {String} Current working directory of the child process
- * `input` {String|Buffer} The value which will be passed as stdin to the
+ * `cwd` {string} Current working directory of the child process
+ * `input` {string|Buffer} The value which will be passed as stdin to the
spawned process
- supplying this value will override `stdio[0]`
- * `stdio` {String | Array} Child's stdio configuration. (Default: `'pipe'`)
+ * `stdio` {string|Array} Child's stdio configuration. (Default: `'pipe'`)
- `stderr` by default will be output to the parent process' stderr unless
`stdio` is specified
* `env` {Object} Environment key-value pairs
- * `shell` {String} Shell to execute the command with
+ * `shell` {string} Shell to execute the command with
(Default: `'/bin/sh'` on UNIX, `'cmd.exe'` on Windows, The shell should
understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows,
command line parsing should be compatible with `cmd.exe`.)
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
- * `timeout` {Number} In milliseconds the maximum amount of time the process
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
+ * `timeout` {number} In milliseconds the maximum amount of time the process
is allowed to run. (Default: `undefined`)
- * `killSignal` {String|Integer} The signal value to be used when the spawned
+ * `killSignal` {string|integer} The signal value to be used when the spawned
process will be killed. (Default: `'SIGTERM'`)
- * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on
+ * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
stdout or stderr - if exceeded child process is killed
- * `encoding` {String} The encoding used for all stdio inputs and outputs.
+ * `encoding` {string} The encoding used for all stdio inputs and outputs.
(Default: `'buffer'`)
-* Returns: {Buffer|String} The stdout from the command
+* Returns: {Buffer|string} The stdout from the command
The `child_process.execSync()` method is generally identical to
[`child_process.exec()`][] with the exception that the method will not return until
@@ -662,36 +664,36 @@ execution.**
added: v0.11.12
-->
-* `command` {String} The command to run
+* `command` {string} The command to run
* `args` {Array} List of string arguments
* `options` {Object}
- * `cwd` {String} Current working directory of the child process
- * `input` {String|Buffer} The value which will be passed as stdin to the
+ * `cwd` {string} Current working directory of the child process
+ * `input` {string|Buffer} The value which will be passed as stdin to the
spawned process
- supplying this value will override `stdio[0]`
- * `stdio` {String | Array} Child's stdio configuration.
+ * `stdio` {string|Array} Child's stdio configuration.
* `env` {Object} Environment key-value pairs
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
- * `timeout` {Number} In milliseconds the maximum amount of time the process
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
+ * `timeout` {number} In milliseconds the maximum amount of time the process
is allowed to run. (Default: `undefined`)
- * `killSignal` {String|Integer} The signal value to be used when the spawned
+ * `killSignal` {string|integer} The signal value to be used when the spawned
process will be killed. (Default: `'SIGTERM'`)
- * [`maxBuffer`][] {Number} largest amount of data (in bytes) allowed on
+ * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
stdout or stderr - if exceeded child process is killed
- * `encoding` {String} The encoding used for all stdio inputs and outputs.
+ * `encoding` {string} The encoding used for all stdio inputs and outputs.
(Default: `'buffer'`)
- * `shell` {Boolean|String} If `true`, runs `command` inside of a shell. Uses
+ * `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses
`'/bin/sh'` on UNIX, and `'cmd.exe'` on Windows. A different shell can be
specified as a string. The shell should understand the `-c` switch on UNIX,
or `/s /c` on Windows. Defaults to `false` (no shell).
* Returns: {Object}
- * `pid` {Number} Pid of the child process
+ * `pid` {number} Pid of the child process
* `output` {Array} Array of results from stdio output
- * `stdout` {Buffer|String} The contents of `output[1]`
- * `stderr` {Buffer|String} The contents of `output[2]`
- * `status` {Number} The exit code of the child process
- * `signal` {String} The signal used to kill the child process
+ * `stdout` {Buffer|string} The contents of `output[1]`
+ * `stderr` {Buffer|string} The contents of `output[2]`
+ * `status` {number} The exit code of the child process
+ * `signal` {string} The signal used to kill the child process
* `error` {Error} The error object if the child process failed or timed out
The `child_process.spawnSync()` method is generally identical to
@@ -724,8 +726,8 @@ instances of `ChildProcess`.
added: v0.7.7
-->
-* `code` {Number} the exit code if the child exited on its own.
-* `signal` {String} the signal by which the child process was terminated.
+* `code` {number} the exit code if the child exited on its own.
+* `signal` {string} the signal by which the child process was terminated.
The `'close'` event is emitted when the stdio streams of a child process have
been closed. This is distinct from the [`'exit'`][] event, since multiple
@@ -762,8 +764,8 @@ See also [`child.kill()`][] and [`child.send()`][].
added: v0.1.90
-->
-* `code` {Number} the exit code if the child exited on its own.
-* `signal` {String} the signal by which the child process was terminated.
+* `code` {number} the exit code if the child exited on its own.
+* `signal` {string} the signal by which the child process was terminated.
The `'exit'` event is emitted after the child process ends. If the process
exited, `code` is the final exit code of the process, otherwise `null`. If the
@@ -797,7 +799,7 @@ to send messages.
added: v0.7.2
-->
-* {Boolean} Set to `false` after `child.disconnect()` is called
+* {boolean} Set to `false` after `child.disconnect()` is called
The `child.connected` property indicates whether it is still possible to send
and receive messages from a child process. When `child.connected` is `false`, it
@@ -827,7 +829,7 @@ within the child process to close the IPC channel as well.
added: v0.1.90
-->
-* `signal` {String}
+* `signal` {string}
The `child.kill()` methods sends a signal to the child process. If no argument
is given, the process will be sent the `'SIGTERM'` signal. See signal(7) for
@@ -866,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
@@ -884,7 +890,7 @@ setTimeout(() => {
added: v0.1.90
-->
-* {Number} Integer
+* {number} Integer
Returns the process identifier (PID) of the child process.
@@ -907,7 +913,7 @@ added: v0.5.9
* `sendHandle` {Handle}
* `options` {Object}
* `callback` {Function}
-* Returns: {Boolean}
+* Returns: {boolean}
When an IPC channel has been established between the parent and child (
i.e. when using [`child_process.fork()`][]), the `child.send()` method can be
diff --git a/doc/api/cluster.md b/doc/api/cluster.md
index 01a2aaf6a8cc86..1d605503848963 100644
--- a/doc/api/cluster.md
+++ b/doc/api/cluster.md
@@ -148,8 +148,8 @@ In a worker you can also use `process.on('error')`.
added: v0.11.2
-->
-* `code` {Number} the exit code, if it exited normally.
-* `signal` {String} the name of the signal (e.g. `'SIGHUP'`) that caused
+* `code` {number} the exit code, if it exited normally.
+* `signal` {string} the name of the signal (e.g. `'SIGHUP'`) that caused
the process to be killed.
Similar to the `cluster.on('exit')` event, but specific to this worker.
@@ -328,7 +328,7 @@ if (cluster.isMaster) {
added: v6.0.0
-->
-* {Boolean}
+* {boolean}
Set by calling `.kill()` or `.disconnect()`. Until then, it is `undefined`.
@@ -352,7 +352,7 @@ worker.kill();
added: v0.8.0
-->
-* {Number}
+* {number}
Each new worker is given its own unique id, this id is stored in the
`id`.
@@ -382,7 +382,7 @@ because of exiting or being signaled). Otherwise, it returns `false`.
added: v0.9.12
-->
-* `signal` {String} Name of the kill signal to send to the worker
+* `signal` {string} Name of the kill signal to send to the worker
process.
This function will kill the worker. In the master, it does this by disconnecting
@@ -502,8 +502,8 @@ added: v0.7.9
-->
* `worker` {cluster.Worker}
-* `code` {Number} the exit code, if it exited normally.
-* `signal` {String} the name of the signal (e.g. `'SIGHUP'`) that caused
+* `code` {number} the exit code, if it exited normally.
+* `signal` {string} the name of the signal (e.g. `'SIGHUP'`) that caused
the process to be killed.
When any of the workers die the cluster module will emit the `'exit'` event.
@@ -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'][].
@@ -672,7 +675,7 @@ This can only be called from the master process.
added: v0.8.1
-->
-* {Boolean}
+* {boolean}
True if the process is a master. This is determined
by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` is
@@ -683,7 +686,7 @@ undefined, then `isMaster` is `true`.
added: v0.6.0
-->
-* {Boolean}
+* {boolean}
True if the process is not a master (it is the negation of `cluster.isMaster`).
@@ -713,16 +716,16 @@ added: v0.7.1
* {Object}
* `execArgv` {Array} list of string arguments passed to the Node.js
executable. (Default=`process.execArgv`)
- * `exec` {String} file path to worker file. (Default=`process.argv[1]`)
+ * `exec` {string} file path to worker file. (Default=`process.argv[1]`)
* `args` {Array} string arguments passed to worker.
(Default=`process.argv.slice(2)`)
- * `silent` {Boolean} whether or not to send output to parent's stdio.
+ * `silent` {boolean} whether or not to send output to parent's stdio.
(Default=`false`)
* `stdio` {Array} Configures the stdio of forked processes. Because the
cluster module relies on IPC to function, this configuration must contain an
`'ipc'` entry. When this option is provided, it overrides `silent`.
- * `uid` {Number} Sets the user identity of the process. (See setuid(2).)
- * `gid` {Number} Sets the group identity of the process. (See setgid(2).)
+ * `uid` {number} Sets the user identity of the process. (See setuid(2).)
+ * `gid` {number} Sets the group identity of the process. (See setgid(2).)
After calling `.setupMaster()` (or `.fork()`) this settings object will contain
the settings, including the default values.
@@ -735,10 +738,10 @@ added: v0.7.1
-->
* `settings` {Object}
- * `exec` {String} file path to worker file. (Default=`process.argv[1]`)
+ * `exec` {string} file path to worker file. (Default=`process.argv[1]`)
* `args` {Array} string arguments passed to worker.
(Default=`process.argv.slice(2)`)
- * `silent` {Boolean} whether or not to send output to parent's stdio.
+ * `silent` {boolean} whether or not to send output to parent's stdio.
(Default=`false`)
* `stdio` {Array} Configures the stdio of forked processes. When this option
is provided, it overrides `silent`.
diff --git a/doc/api/console.md b/doc/api/console.md
index 7bc54641a21714..5b687140253d26 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;
```
@@ -127,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) {
@@ -155,6 +158,11 @@ console.log('this will also print');
+* `obj` {any}
+* `options` {Object}
+ * `showHidden` {boolean}
+ * `depth` {number}
+ * `colors` {boolean}
Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`.
This function bypasses any custom `inspect()` function defined on `obj`. An
@@ -227,6 +235,7 @@ values are concatenated. See [`util.format()`][] for more information.
+* `label` {string}
Starts a timer that can be used to compute the duration of an operation. Timers
are identified by a unique `label`. Use the same `label` when you call
@@ -237,15 +246,14 @@ milliseconds to `stdout`. Timer durations are accurate to the sub-millisecond.
+* `label` {string}
Stops a timer that was previously started by calling [`console.time()`][] and
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 17d273d115cea4..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);
@@ -901,8 +903,8 @@ The `private_key` argument can be an object or a string. If `private_key` is a
string, it is treated as a raw key with no passphrase. If `private_key` is an
object, it is interpreted as a hash containing two properties:
-* `key` : {String} - PEM encoded private key
-* `passphrase` : {String} - passphrase for the private key
+* `key`: {string} - PEM encoded private key
+* `passphrase`: {string} - passphrase for the private key
The `output_format` can specify one of `'latin1'`, `'hex'` or `'base64'`. If
`output_format` is provided a string is returned; otherwise a [`Buffer`][] is
@@ -1410,8 +1412,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
If `private_key` is an object, it is interpreted as a hash object with the
keys:
-* `key` : {String} - PEM encoded private key
-* `passphrase` : {String} - Optional passphrase for the private key
+* `key`: {string} - PEM encoded private key
+* `passphrase`: {string} - Optional passphrase for the private key
* `padding` : An optional padding value, one of the following:
* `crypto.constants.RSA_NO_PADDING`
* `crypto.constants.RSA_PKCS1_PADDING`
@@ -1447,8 +1449,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
If `private_key` is an object, it is interpreted as a hash object with the
keys:
-* `key` : {String} - PEM encoded private key
-* `passphrase` : {String} - Optional passphrase for the private key
+* `key`: {string} - PEM encoded private key
+* `passphrase`: {string} - Optional passphrase for the private key
* `padding` : An optional padding value, one of the following:
* `crypto.constants.RSA_NO_PADDING`
* `crypto.constants.RSA_PKCS1_PADDING`
@@ -1467,8 +1469,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
If `public_key` is an object, it is interpreted as a hash object with the
keys:
-* `key` : {String} - PEM encoded public key
-* `passphrase` : {String} - Optional passphrase for the private key
+* `key`: {string} - PEM encoded public key
+* `passphrase`: {string} - Optional passphrase for the private key
* `padding` : An optional padding value, one of the following:
* `crypto.constants.RSA_NO_PADDING`
* `crypto.constants.RSA_PKCS1_PADDING`
@@ -1491,8 +1493,8 @@ treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
If `public_key` is an object, it is interpreted as a hash object with the
keys:
-* `key` : {String} - PEM encoded public key
-* `passphrase` : {String} - Optional passphrase for the private key
+* `key`: {string} - PEM encoded public key
+* `passphrase`: {string} - Optional passphrase for the private key
* `padding` : An optional padding value, one of the following:
* `crypto.constants.RSA_NO_PADDING`
* `crypto.constants.RSA_PKCS1_PADDING`
@@ -1645,7 +1647,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
SSL_OP_CIPHER_SERVER_PREFERENCE
Attempts to use the server's preferences instead of the client's when
- selecting a cipher. Behaviour depends on protocol version. See
+ selecting a cipher. Behavior depends on protocol version. See
https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html.
diff --git a/doc/api/debugger.md b/doc/api/debugger.md
index 7112b403fe35f3..1c9b1049e82491 100644
--- a/doc/api/debugger.md
+++ b/doc/api/debugger.md
@@ -11,10 +11,10 @@ will be displayed indicating successful launch of the debugger:
```txt
$ node debug myscript.js
-< debugger listening on port 5858
-connecting... ok
+< Debugger listening on [::]:5858
+connecting to 127.0.0.1:5858 ... ok
break in /home/indutny/Code/git/indutny/myscript.js:1
- 1 x = 5;
+> 1 global.x = 5;
2 setTimeout(() => {
3 debugger;
debug>
@@ -26,9 +26,10 @@ 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
-x = 5;
+global.x = 5;
setTimeout(() => {
debugger;
console.log('world');
@@ -36,29 +37,29 @@ setTimeout(() => {
console.log('hello');
```
-Once the debugger is run, a breakpoint will occur at line 4:
+Once the debugger is run, a breakpoint will occur at line 3:
```txt
$ node debug myscript.js
-< debugger listening on port 5858
-connecting... ok
+< Debugger listening on [::]:5858
+connecting to 127.0.0.1:5858 ... ok
break in /home/indutny/Code/git/indutny/myscript.js:1
- 1 x = 5;
+> 1 global.x = 5;
2 setTimeout(() => {
3 debugger;
debug> cont
< hello
break in /home/indutny/Code/git/indutny/myscript.js:3
- 1 x = 5;
+ 1 global.x = 5;
2 setTimeout(() => {
- 3 debugger;
+> 3 debugger;
4 console.log('world');
5 }, 1000);
debug> next
break in /home/indutny/Code/git/indutny/myscript.js:4
2 setTimeout(() => {
3 debugger;
- 4 console.log('world');
+> 4 console.log('world');
5 }, 1000);
6 console.log('hello');
debug> repl
@@ -68,11 +69,11 @@ Press Ctrl + C to leave debug repl
> 2+2
4
debug> next
-< world
break in /home/indutny/Code/git/indutny/myscript.js:5
+< world
3 debugger;
4 console.log('world');
- 5 }, 1000);
+> 5 }, 1000);
6 console.log('hello');
7
debug> quit
@@ -121,24 +122,26 @@ is not loaded yet:
```txt
$ node debug test/fixtures/break-in-module/main.js
-< debugger listening on port 5858
-connecting to port 5858... ok
+< Debugger listening on [::]:5858
+connecting to 127.0.0.1:5858 ... ok
break in test/fixtures/break-in-module/main.js:1
- 1 var mod = require('./mod.js');
+> 1 var mod = require('./mod.js');
2 mod.hello();
3 mod.hello();
-debug> setBreakpoint('mod.js', 23)
+debug> setBreakpoint('mod.js', 2)
Warning: script 'mod.js' was not loaded yet.
- 1 var mod = require('./mod.js');
+> 1 var mod = require('./mod.js');
2 mod.hello();
3 mod.hello();
+ 4 debugger;
+ 5
+ 6 });
debug> c
-break in test/fixtures/break-in-module/mod.js:23
- 21
- 22 exports.hello = () => {
- 23 return 'hello from module';
- 24 };
- 25
+break in test/fixtures/break-in-module/mod.js:2
+ 1 exports.hello = function() {
+> 2 return 'hello from module';
+ 3 };
+ 4
debug>
```
@@ -198,7 +201,11 @@ $ node --inspect index.js
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
- chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node
+ chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/3a6d0a9e-0707-48f8-a7c6-48f157b67ab5
```
+(In the example above, the UUID 3a6d0a9e-0707-48f8-a7c6-48f157b67ab5
+at the end of the URL is generated on the fly, it varies in different
+debugging sessions.)
+
[TCP-based protocol]: https://github.com/v8/v8/wiki/Debugging-Protocol
diff --git a/doc/api/dgram.md b/doc/api/dgram.md
index 2e214beb2ff7d2..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}`);
});
@@ -74,18 +74,18 @@ The `'message'` event is emitted when a new datagram is available on a socket.
The event handler function is passed two arguments: `msg` and `rinfo`.
* `msg` {Buffer} - The message
* `rinfo` {Object} - Remote address information
- * `address` {String} The sender address
- * `family` {String} The address family (`'IPv4'` or `'IPv6'`)
- * `port` {Number} The sender port
- * `size` {Number} The message size
+ * `address` {string} The sender address
+ * `family` {string} The address family (`'IPv4'` or `'IPv6'`)
+ * `port` {number} The sender port
+ * `size` {number} The message size
### socket.addMembership(multicastAddress[, multicastInterface])
-* `multicastAddress` {String}
-* `multicastInterface` {String}, Optional
+* `multicastAddress` {string}
+* `multicastInterface` {string}, Optional
Tells the kernel to join a multicast group at the given `multicastAddress` and
`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the
@@ -107,8 +107,8 @@ properties.
added: v0.1.99
-->
-* `port` {Number} - Integer, Optional
-* `address` {String}, Optional
+* `port` {number} - Integer, Optional
+* `address` {string}, Optional
* `callback` {Function} with no parameters, Optional. Called when
binding is complete.
@@ -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}`);
});
@@ -160,9 +160,9 @@ added: v0.11.14
-->
* `options` {Object} - Required. Supports the following properties:
- * `port` {Number} - Optional.
- * `address` {String} - Optional.
- * `exclusive` {Boolean} - Optional.
+ * `port` {number} - Optional.
+ * `address` {string} - Optional.
+ * `exclusive` {boolean} - Optional.
* `callback` {Function} - Optional.
For UDP sockets, causes the `dgram.Socket` to listen for datagram
@@ -214,8 +214,8 @@ provided, it is added as a listener for the [`'close'`][] event.
added: v0.6.9
-->
-* `multicastAddress` {String}
-* `multicastInterface` {String}, Optional
+* `multicastAddress` {string}
+* `multicastInterface` {string}, Optional
Instructs the kernel to leave a multicast group at `multicastAddress` using the
`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
@@ -230,11 +230,11 @@ drop membership on all valid interfaces.
added: v0.1.99
-->
-* `msg` {Buffer|String|Array} Message to be sent
-* `offset` {Number} Integer. Optional. Offset in the buffer where the message starts.
-* `length` {Number} Integer. Optional. Number of bytes in the message.
-* `port` {Number} Integer. Destination port.
-* `address` {String} Destination hostname or IP address.
+* `msg` {Buffer|string|array} Message to be sent
+* `offset` {number} Integer. Optional. Offset in the buffer where the message starts.
+* `length` {number} Integer. Optional. Number of bytes in the message.
+* `port` {number} Integer. Destination port.
+* `address` {string} Destination hostname or IP address.
* `callback` {Function} Called when the message has been sent. Optional.
Broadcasts a datagram on the socket. The destination `port` and `address` must
@@ -330,7 +330,7 @@ source that the data did not reach its intended recipient.
added: v0.6.9
-->
-* `flag` {Boolean}
+* `flag` {boolean}
Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
packets may be sent to a local interface's broadcast address.
@@ -340,7 +340,7 @@ packets may be sent to a local interface's broadcast address.
added: v0.3.8
-->
-* `flag` {Boolean}
+* `flag` {boolean}
Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
multicast packets will also be received on the local interface.
@@ -350,7 +350,7 @@ multicast packets will also be received on the local interface.
added: v0.3.8
-->
-* `ttl` {Number} Integer
+* `ttl` {number} Integer
Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
"Time to Live", in this context it specifies the number of IP hops that a
@@ -366,7 +366,7 @@ between 0 and 255. The default on most systems is `1` but can vary.
added: v0.1.101
-->
-* `ttl` {Number} Integer
+* `ttl` {number} Integer
Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
in this context it specifies the number of IP hops that a packet is allowed to
@@ -463,7 +463,7 @@ and `udp6` sockets). The bound address and port can be retrieved using
added: v0.1.99
-->
-* `type` {String} - Either 'udp4' or 'udp6'
+* `type` {string} - Either 'udp4' or 'udp6'
* `callback` {Function} - Attached as a listener to `'message'` events.
Optional
* Returns: {dgram.Socket}
diff --git a/doc/api/dns.md b/doc/api/dns.md
index cdb468de232136..457559d0ce692c 100644
--- a/doc/api/dns.md
+++ b/doc/api/dns.md
@@ -74,15 +74,15 @@ an integer, then it must be `4` or `6`.
Alternatively, `options` can be an object containing these properties:
-* `family` {Number} - The record family. If present, must be the integer
+* `family` {number} - The record family. If present, must be the integer
`4` or `6`. If not provided, both IP v4 and v6 addresses are accepted.
-* `hints`: {Number} - If present, it should be one or more of the supported
+* `hints`: {number} - If present, it should be one or more of the supported
`getaddrinfo` flags. If `hints` is not provided, then no flags are passed to
`getaddrinfo`. Multiple flags can be passed through `hints` by bitwise
`OR`ing their values.
See [supported `getaddrinfo` flags][] for more information on supported
flags.
-* `all`: {Boolean} - When `true`, the callback returns all resolved addresses
+* `all`: {boolean} - When `true`, the callback returns all resolved addresses
in an array, otherwise returns a single address. Defaults to `false`.
All properties are optional.
@@ -169,31 +169,32 @@ dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
added: v0.1.27
-->
-Uses the DNS protocol to resolve a hostname (e.g. `'nodejs.org'`) into an
-array of the record types specified by `rrtype`.
-
-Valid values for `rrtype` are:
-
- * `'A'` - IPV4 addresses, default
- * `'AAAA'` - IPV6 addresses
- * `'MX'` - mail exchange records
- * `'TXT'` - text records
- * `'SRV'` - SRV records
- * `'PTR'` - PTR records
- * `'NS'` - name server records
- * `'CNAME'` - canonical name records
- * `'SOA'` - start of authority record
- * `'NAPTR'` - name authority pointer record
-
-The `callback` function has arguments `(err, addresses)`. When successful,
-`addresses` will be an array, except when resolving an SOA record which returns
-an object structured in the same manner as one returned by the
-[`dns.resolveSoa()`][] method. The type of each item in `addresses` is
-determined by the record type, and described in the documentation for the
-corresponding lookup methods.
-
-On error, `err` is an [`Error`][] object, where `err.code` is
-one of the error codes listed [here](#dns_error_codes).
+- `hostname` {string} Hostname to resolve.
+- `rrtype` {string} Resource record type. Default: `'A'`.
+- `callback` {Function}
+ - `err` {Error}
+ - `records` {string[] | Object[] | string[][] | Object}
+
+Uses the DNS protocol to resolve a hostname (e.g. `'nodejs.org'`) into an array
+of the resource records. The `callback` function has arguments
+`(err, records)`. When successful, `records` will be an array of resource
+records. The type and structure of individual results varies based on `rrtype`:
+
+| `rrtype` | `records` contains | Result type | Shorthand method |
+|-----------|--------------------------------|-------------|--------------------------|
+| `'A'` | IPv4 addresses (default) | {string} | [`dns.resolve4()`][] |
+| `'AAAA'` | IPv6 addresses | {string} | [`dns.resolve6()`][] |
+| `'CNAME'` | canonical name records | {string} | [`dns.resolveCname()`][] |
+| `'MX'` | mail exchange records | {Object} | [`dns.resolveMx()`][] |
+| `'NAPTR'` | name authority pointer records | {Object} | [`dns.resolveNaptr()`][] |
+| `'NS'` | name server records | {string} | [`dns.resolveNs()`][] |
+| `'PTR'` | pointer records | {string} | [`dns.resolvePtr()`][] |
+| `'SOA'` | start of authority records | {Object} | [`dns.resolveSoa()`][] |
+| `'SRV'` | service records | {Object} | [`dns.resolveSrv()`][] |
+| `'TXT'` | text records | {string} | [`dns.resolveTxt()`][] |
+
+On error, `err` is an [`Error`][] object, where `err.code` is one of the
+[DNS error codes](#dns_error_codes).
## dns.resolve4(hostname[, options], callback)
```js
{
flags: 's',
@@ -305,6 +307,7 @@ be an object with the following properties:
* `expire`
* `minttl`
+
```js
{
nsname: 'ns.example.com',
@@ -331,6 +334,7 @@ be an array of objects with the following properties:
* `port`
* `name`
+
```js
{
priority: 10,
@@ -463,7 +467,16 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
[DNS error codes]: #dns_error_codes
[`dns.lookup()`]: #dns_dns_lookup_hostname_options_callback
+[`dns.resolve4()`]: #dns_dns_resolve4_hostname_options_callback
+[`dns.resolve6()`]: #dns_dns_resolve6_hostname_options_callback
+[`dns.resolveCname()`]: #dns_dns_resolvecname_hostname_callback
+[`dns.resolveMx()`]: #dns_dns_resolvemx_hostname_callback
+[`dns.resolveNaptr()`]: #dns_dns_resolvenaptr_hostname_callback
+[`dns.resolveNs()`]: #dns_dns_resolvens_hostname_callback
+[`dns.resolvePtr()`]: #dns_dns_resolveptr_hostname_callback
[`dns.resolveSoa()`]: #dns_dns_resolvesoa_hostname_callback
+[`dns.resolveSrv()`]: #dns_dns_resolvesrv_hostname_callback
+[`dns.resolveTxt()`]: #dns_dns_resolvetxt_hostname_callback
[`Error`]: errors.html#errors_class_error
[Implementation considerations section]: #dns_implementation_considerations
[supported `getaddrinfo` flags]: #dns_supported_getaddrinfo_flags
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/errors.md b/doc/api/errors.md
index ea60f2b0e51ddb..34fa2cb8a5694c 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -196,7 +196,7 @@ will either be instances of, or inherit from, the `Error` class.
### new Error(message)
-* `message` {String}
+* `message` {string}
Creates a new `Error` object and sets the `error.message` property to the
provided text message. If an object is passed as `message`, the text message
@@ -238,13 +238,13 @@ function MyError() {
// Without passing MyError to captureStackTrace, the MyError
// frame would show up in the .stack property. By passing
-// the constructor, we omit that frame and all frames above it.
+// the constructor, we omit that frame, and retain all frames below it.
new MyError().stack;
```
### Error.stackTraceLimit
-* {Number}
+* {number}
The `Error.stackTraceLimit` property specifies the number of stack frames
collected by a stack trace (whether generated by `new Error().stack` or
@@ -258,7 +258,7 @@ not capture any frames.
### error.message
-* {String}
+* {string}
The `error.message` property is the string description of the error as set by calling `new Error(message)`.
The `message` passed to the constructor will also appear in the first line of
@@ -274,7 +274,7 @@ console.error(err.message);
### error.stack
-* {String}
+* {string}
The `error.stack` property is a string describing the point in the code at which
the `Error` was instantiated.
@@ -450,14 +450,14 @@ added properties.
#### error.code
-* {String}
+* {string}
The `error.code` property is a string representing the error code, which is always
`E` followed by a sequence of capital letters.
#### error.errno
-* {String | Number}
+* {string|number}
The `error.errno` property is a number or a string.
The number is a **negative** value which corresponds to the error code defined in
@@ -467,27 +467,27 @@ In case of a string, it is the same as `error.code`.
#### error.syscall
-* {String}
+* {string}
The `error.syscall` property is a string describing the [syscall][] that failed.
#### error.path
-* {String}
+* {string}
When present (e.g. in `fs` or `child_process`), the `error.path` property is a string
containing a relevant invalid pathname.
#### error.address
-* {String}
+* {string}
When present (e.g. in `net` or `dgram`), the `error.address` property is a string
describing the address to which the connection failed.
#### error.port
-* {Number}
+* {number}
When present (e.g. in `net` or `dgram`), the `error.port` property is a number representing
the connection's port that is not available.
diff --git a/doc/api/events.md b/doc/api/events.md
index 8864e78d9fc4c7..7462902e09479a 100644
--- a/doc/api/events.md
+++ b/doc/api/events.md
@@ -185,7 +185,7 @@ added and `'removeListener'` when existing listeners are removed.
added: v0.1.26
-->
-* `eventName` {String|Symbol} The name of the event being listened for
+* `eventName` {string|symbol} The name of the event being listened for
* `listener` {Function} The event handler function
The `EventEmitter` instance will emit its own `'newListener'` event *before*
@@ -224,7 +224,7 @@ myEmitter.emit('event');
added: v0.9.3
-->
-* `eventName` {String|Symbol} The event name
+* `eventName` {string|symbol} The event name
* `listener` {Function} The event handler function
The `'removeListener'` event is emitted *after* the `listener` is removed.
@@ -339,7 +339,7 @@ set by [`emitter.setMaxListeners(n)`][] or defaults to
added: v3.2.0
-->
-* `eventName` {String|Symbol} The name of the event being listened for
+* `eventName` {string|symbol} The name of the event being listened for
Returns the number of listeners listening to the event named `eventName`.
@@ -363,7 +363,7 @@ console.log(util.inspect(server.listeners('connection')));
added: v0.1.101
-->
-* `eventName` {String|Symbol} The name of the event.
+* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
Adds the `listener` function to the end of the listeners array for the
@@ -399,7 +399,7 @@ myEE.emit('foo');
added: v0.3.0
-->
-* `eventName` {String|Symbol} The name of the event.
+* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
Adds a **one time** `listener` function for the event named `eventName`. The
@@ -432,7 +432,7 @@ myEE.emit('foo');
added: v6.0.0
-->
-* `eventName` {String|Symbol} The name of the event.
+* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
Adds the `listener` function to the *beginning* of the listeners array for the
@@ -454,7 +454,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
added: v6.0.0
-->
-* `eventName` {String|Symbol} The name of the event.
+* `eventName` {string|symbol} The name of the event.
* `listener` {Function} The callback function
Adds a **one time** `listener` function for the event named `eventName` to the
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 3594b3812e6b62..56969fc1d67dff 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -121,8 +121,8 @@ The object itself emits these events:
added: v0.5.8
-->
-* `eventType` {String} The type of fs change
-* `filename` {String | Buffer} The filename that changed (if relevant/available)
+* `eventType` {string} The type of fs change
+* `filename` {string|Buffer} The filename that changed (if relevant/available)
Emitted when something changes in a watched directory or file.
See more details in [`fs.watch()`][].
@@ -178,8 +178,9 @@ Emitted when the ReadStream's file is opened.
added: v0.1.93
-->
-Emitted when the `ReadStream`'s underlying file descriptor has been closed
-using the `fs.close()` method.
+* `fd` {integer} Integer file descriptor used by the ReadStream.
+
+Emitted when the ReadStream's file is opened.
### readStream.bytesRead
-Emitted when the `WriteStream`'s underlying file descriptor has been closed
-using the `fs.close()` method.
+* `fd` {integer} Integer file descriptor used by the WriteStream.
+
+Emitted when the WriteStream's file is opened.
### writeStream.bytesWritten
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
* `callback` {Function}
Tests a user's permissions for the file or directory specified by `path`.
@@ -438,8 +440,8 @@ process.
added: v0.11.15
-->
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
Synchronous version of [`fs.access()`][]. This throws if any accessibility
checks fail, and does nothing otherwise.
@@ -449,12 +451,12 @@ checks fail, and does nothing otherwise.
added: v0.6.7
-->
-* `file` {String | Buffer | Number} filename or file descriptor
-* `data` {String | Buffer}
-* `options` {Object | String}
- * `encoding` {String | Null} default = `'utf8'`
- * `mode` {Integer} default = `0o666`
- * `flag` {String} default = `'a'`
+* `file` {string|Buffer|number} filename or file descriptor
+* `data` {string|Buffer}
+* `options` {Object|string}
+ * `encoding` {string|null} default = `'utf8'`
+ * `mode` {integer} default = `0o666`
+ * `flag` {string} default = `'a'`
* `callback` {Function}
Asynchronously append data to a file, creating the file if it does not yet exist.
@@ -477,20 +479,20 @@ fs.appendFile('message.txt', 'data to append', 'utf8', callback);
Any specified file descriptor has to have been opened for appending.
-_Note: If a file descriptor is specified as the `file`, it will not be closed
-automatically._
+*Note*: If a file descriptor is specified as the `file`, it will not be closed
+automatically.
## fs.appendFileSync(file, data[, options])
-* `file` {String | Buffer | Number} filename or file descriptor
-* `data` {String | Buffer}
-* `options` {Object | String}
- * `encoding` {String | Null} default = `'utf8'`
- * `mode` {Integer} default = `0o666`
- * `flag` {String} default = `'a'`
+* `file` {string|Buffer|number} filename or file descriptor
+* `data` {string|Buffer}
+* `options` {Object|string}
+ * `encoding` {string|null} default = `'utf8'`
+ * `mode` {integer} default = `0o666`
+ * `flag` {string} default = `'a'`
The synchronous version of [`fs.appendFile()`][]. Returns `undefined`.
@@ -499,8 +501,8 @@ The synchronous version of [`fs.appendFile()`][]. Returns `undefined`.
added: v0.1.30
-->
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
* `callback` {Function}
Asynchronous chmod(2). No arguments other than a possible exception are given
@@ -511,8 +513,8 @@ to the completion callback.
added: v0.6.7
-->
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
Synchronous chmod(2). Returns `undefined`.
@@ -521,9 +523,9 @@ Synchronous chmod(2). Returns `undefined`.
added: v0.1.97
-->
-* `path` {String | Buffer}
-* `uid` {Integer}
-* `gid` {Integer}
+* `path` {string|Buffer}
+* `uid` {integer}
+* `gid` {integer}
* `callback` {Function}
Asynchronous chown(2). No arguments other than a possible exception are given
@@ -534,9 +536,9 @@ to the completion callback.
added: v0.1.97
-->
-* `path` {String | Buffer}
-* `uid` {Integer}
-* `gid` {Integer}
+* `path` {string|Buffer}
+* `uid` {integer}
+* `gid` {integer}
Synchronous chown(2). Returns `undefined`.
@@ -545,7 +547,7 @@ Synchronous chown(2). Returns `undefined`.
added: v0.0.2
-->
-* `fd` {Integer}
+* `fd` {integer}
* `callback` {Function}
Asynchronous close(2). No arguments other than a possible exception are given
@@ -556,7 +558,7 @@ to the completion callback.
added: v0.1.21
-->
-* `fd` {Integer}
+* `fd` {integer}
Synchronous close(2). Returns `undefined`.
@@ -571,15 +573,15 @@ operations. The specific constants currently defined are described in
added: v0.1.31
-->
-* `path` {String | Buffer}
-* `options` {String | Object}
- * `flags` {String}
- * `encoding` {String}
- * `fd` {Integer}
- * `mode` {Integer}
- * `autoClose` {Boolean}
- * `start` {Integer}
- * `end` {Integer}
+* `path` {string|Buffer}
+* `options` {string|Object}
+ * `flags` {string}
+ * `encoding` {string}
+ * `fd` {integer}
+ * `mode` {integer}
+ * `autoClose` {boolean}
+ * `start` {integer}
+ * `end` {integer}
Returns a new [`ReadStream`][] object. (See [Readable Stream][]).
@@ -590,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
@@ -632,27 +634,27 @@ If `options` is a string, then it specifies the encoding.
added: v0.1.31
-->
-* `path` {String | Buffer}
-* `options` {String | Object}
- * `flags` {String}
- * `defaultEncoding` {String}
- * `fd` {Integer}
- * `mode` {Integer}
- * `autoClose` {Boolean}
- * `start` {Integer}
+* `path` {string|Buffer}
+* `options` {string|Object}
+ * `flags` {string}
+ * `defaultEncoding` {string}
+ * `fd` {integer}
+ * `mode` {integer}
+ * `autoClose` {boolean}
+ * `start` {integer}
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
@@ -682,7 +684,7 @@ deprecated: v1.0.0
> Stability: 0 - Deprecated: Use [`fs.stat()`][] or [`fs.access()`][] instead.
-* `path` {String | Buffer}
+* `path` {string|Buffer}
* `callback` {Function}
Test whether or not the given path exists by checking with the file system.
@@ -784,7 +786,7 @@ process.
added: v0.1.21
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
Synchronous version of [`fs.exists()`][].
Returns `true` if the file exists, `false` otherwise.
@@ -799,8 +801,8 @@ a callback.)
added: v0.4.7
-->
-* `fd` {Integer}
-* `mode` {Integer}
+* `fd` {integer}
+* `mode` {integer}
* `callback` {Function}
Asynchronous fchmod(2). No arguments other than a possible exception
@@ -811,8 +813,8 @@ are given to the completion callback.
added: v0.4.7
-->
-* `fd` {Integer}
-* `mode` {Integer}
+* `fd` {integer}
+* `mode` {integer}
Synchronous fchmod(2). Returns `undefined`.
@@ -821,9 +823,9 @@ Synchronous fchmod(2). Returns `undefined`.
added: v0.4.7
-->
-* `fd` {Integer}
-* `uid` {Integer}
-* `gid` {Integer}
+* `fd` {integer}
+* `uid` {integer}
+* `gid` {integer}
* `callback` {Function}
Asynchronous fchown(2). No arguments other than a possible exception are given
@@ -834,9 +836,9 @@ to the completion callback.
added: v0.4.7
-->
-* `fd` {Integer}
-* `uid` {Integer}
-* `gid` {Integer}
+* `fd` {integer}
+* `uid` {integer}
+* `gid` {integer}
Synchronous fchown(2). Returns `undefined`.
@@ -845,7 +847,7 @@ Synchronous fchown(2). Returns `undefined`.
added: v0.1.96
-->
-* `fd` {Integer}
+* `fd` {integer}
* `callback` {Function}
Asynchronous fdatasync(2). No arguments other than a possible exception are
@@ -856,7 +858,7 @@ given to the completion callback.
added: v0.1.96
-->
-* `fd` {Integer}
+* `fd` {integer}
Synchronous fdatasync(2). Returns `undefined`.
@@ -865,7 +867,7 @@ Synchronous fdatasync(2). Returns `undefined`.
added: v0.1.95
-->
-* `fd` {Integer}
+* `fd` {integer}
* `callback` {Function}
Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where
@@ -877,7 +879,7 @@ except that the file to be stat-ed is specified by the file descriptor `fd`.
added: v0.1.95
-->
-* `fd` {Integer}
+* `fd` {integer}
Synchronous fstat(2). Returns an instance of [`fs.Stats`][].
@@ -886,7 +888,7 @@ Synchronous fstat(2). Returns an instance of [`fs.Stats`][].
added: v0.1.96
-->
-* `fd` {Integer}
+* `fd` {integer}
* `callback` {Function}
Asynchronous fsync(2). No arguments other than a possible exception are given
@@ -897,7 +899,7 @@ to the completion callback.
added: v0.1.96
-->
-* `fd` {Integer}
+* `fd` {integer}
Synchronous fsync(2). Returns `undefined`.
@@ -906,8 +908,8 @@ Synchronous fsync(2). Returns `undefined`.
added: v0.8.6
-->
-* `fd` {Integer}
-* `len` {Integer} default = `0`
+* `fd` {integer}
+* `len` {integer} default = `0`
* `callback` {Function}
Asynchronous ftruncate(2). No arguments other than a possible exception are
@@ -959,8 +961,8 @@ The last three bytes are null bytes ('\0'), to compensate the over-truncation.
added: v0.8.6
-->
-* `fd` {Integer}
-* `len` {Integer} default = `0`
+* `fd` {integer}
+* `len` {integer} default = `0`
Synchronous ftruncate(2). Returns `undefined`.
@@ -969,9 +971,9 @@ Synchronous ftruncate(2). Returns `undefined`.
added: v0.4.2
-->
-* `fd` {Integer}
-* `atime` {Integer}
-* `mtime` {Integer}
+* `fd` {integer}
+* `atime` {integer}
+* `mtime` {integer}
* `callback` {Function}
Change the file timestamps of a file referenced by the supplied file
@@ -982,9 +984,9 @@ descriptor.
added: v0.4.2
-->
-* `fd` {Integer}
-* `atime` {Integer}
-* `mtime` {Integer}
+* `fd` {integer}
+* `atime` {integer}
+* `mtime` {integer}
Synchronous version of [`fs.futimes()`][]. Returns `undefined`.
@@ -993,8 +995,8 @@ Synchronous version of [`fs.futimes()`][]. Returns `undefined`.
deprecated: v0.4.7
-->
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
* `callback` {Function}
Asynchronous lchmod(2). No arguments other than a possible exception
@@ -1007,8 +1009,8 @@ Only available on macOS.
deprecated: v0.4.7
-->
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
Synchronous lchmod(2). Returns `undefined`.
@@ -1017,9 +1019,9 @@ Synchronous lchmod(2). Returns `undefined`.
deprecated: v0.4.7
-->
-* `path` {String | Buffer}
-* `uid` {Integer}
-* `gid` {Integer}
+* `path` {string|Buffer}
+* `uid` {integer}
+* `gid` {integer}
* `callback` {Function}
Asynchronous lchown(2). No arguments other than a possible exception are given
@@ -1030,9 +1032,9 @@ to the completion callback.
deprecated: v0.4.7
-->
-* `path` {String | Buffer}
-* `uid` {Integer}
-* `gid` {Integer}
+* `path` {string|Buffer}
+* `uid` {integer}
+* `gid` {integer}
Synchronous lchown(2). Returns `undefined`.
@@ -1041,8 +1043,8 @@ Synchronous lchown(2). Returns `undefined`.
added: v0.1.31
-->
-* `existingPath` {String | Buffer}
-* `newPath` {String | Buffer}
+* `existingPath` {string|Buffer}
+* `newPath` {string|Buffer}
* `callback` {Function}
Asynchronous link(2). No arguments other than a possible exception are given to
@@ -1053,8 +1055,8 @@ the completion callback.
added: v0.1.31
-->
-* `existingPath` {String | Buffer}
-* `newPath` {String | Buffer}
+* `existingPath` {string|Buffer}
+* `newPath` {string|Buffer}
Synchronous link(2). Returns `undefined`.
@@ -1063,7 +1065,7 @@ Synchronous link(2). Returns `undefined`.
added: v0.1.30
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
* `callback` {Function}
Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where
@@ -1076,7 +1078,7 @@ not the file that it refers to.
added: v0.1.30
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
Synchronous lstat(2). Returns an instance of [`fs.Stats`][].
@@ -1085,8 +1087,8 @@ Synchronous lstat(2). Returns an instance of [`fs.Stats`][].
added: v0.1.8
-->
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
* `callback` {Function}
Asynchronous mkdir(2). No arguments other than a possible exception are given
@@ -1097,8 +1099,8 @@ to the completion callback. `mode` defaults to `0o777`.
added: v0.1.21
-->
-* `path` {String | Buffer}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `mode` {integer}
Synchronous mkdir(2). Returns `undefined`.
@@ -1107,9 +1109,9 @@ Synchronous mkdir(2). Returns `undefined`.
added: v5.10.0
-->
-* `prefix` {String}
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `prefix` {string}
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
* `callback` {Function}
Creates a unique temporary directory.
@@ -1169,9 +1171,9 @@ fs.mkdtemp(`${tmpDir}${sep}`, (err, folder) => {
added: v5.10.0
-->
-* `prefix` {String}
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `prefix` {string}
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
The synchronous version of [`fs.mkdtemp()`][]. Returns the created
folder path.
@@ -1184,9 +1186,9 @@ object with an `encoding` property specifying the character encoding to use.
added: v0.0.2
-->
-* `path` {String | Buffer}
-* `flags` {String | Number}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `flags` {string|number}
+* `mode` {integer}
* `callback` {Function}
Asynchronous file open. See open(2). `flags` can be:
@@ -1246,10 +1248,10 @@ On Linux, positional writes don't work when the file is opened in append mode.
The kernel ignores the position argument and always appends the data to
the end of the file.
-_Note: The behavior of `fs.open()` is platform specific for some flags. As such,
+*Note*: The behavior of `fs.open()` is platform-specific for some flags. As such,
opening a directory on macOS and Linux with the `'a+'` flag - see example
below - will return an error. In contrast, on Windows and FreeBSD, a file
-descriptor will be returned._
+descriptor will be returned.
```js
// macOS and Linux
@@ -1268,9 +1270,9 @@ fs.open('', 'a+', (err, fd) => {
added: v0.1.21
-->
-* `path` {String | Buffer}
-* `flags` {String | Number}
-* `mode` {Integer}
+* `path` {string|Buffer}
+* `flags` {string|number}
+* `mode` {integer}
Synchronous version of [`fs.open()`][]. Returns an integer representing the file
descriptor.
@@ -1280,11 +1282,11 @@ descriptor.
added: v0.0.2
-->
-* `fd` {Integer}
-* `buffer` {String | Buffer}
-* `offset` {Integer}
-* `length` {Integer}
-* `position` {Integer}
+* `fd` {integer}
+* `buffer` {string | Buffer}
+* `offset` {integer}
+* `length` {integer}
+* `position` {integer}
* `callback` {Function}
Read data from the file specified by `fd`.
@@ -1305,9 +1307,9 @@ The callback is given the three arguments, `(err, bytesRead, buffer)`.
added: v0.1.8
-->
-* `path` {String | Buffer}
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `path` {string|Buffer}
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
* `callback` {Function}
Asynchronous readdir(3). Reads the contents of a directory.
@@ -1324,9 +1326,9 @@ the filenames returned will be passed as `Buffer` objects.
added: v0.1.21
-->
-* `path` {String | Buffer}
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `path` {string|Buffer}
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
Synchronous readdir(3). Returns an array of filenames excluding `'.'` and
`'..'`.
@@ -1341,10 +1343,10 @@ the filenames returned will be passed as `Buffer` objects.
added: v0.1.29
-->
-* `file` {String | Buffer | Integer} filename or file descriptor
-* `options` {Object | String}
- * `encoding` {String | Null} default = `null`
- * `flag` {String} default = `'r'`
+* `file` {string|Buffer|integer} filename or file descriptor
+* `options` {Object|string}
+ * `encoding` {string|null} default = `null`
+ * `flag` {string} default = `'r'`
* `callback` {Function}
Asynchronously reads the entire contents of a file. Example:
@@ -1366,35 +1368,63 @@ If `options` is a string, then it specifies the encoding. Example:
```js
fs.readFile('/etc/passwd', 'utf8', callback);
```
+*Note*: When the path is a directory, the behavior of
+`fs.readFile()` and [`fs.readFileSync()`][] is platform-specific. On macOS,
+Linux, and Windows, an error will be returned. On FreeBSD, a representation
+of the directory's contents will be returned.
+
+```js
+// macOS, Linux and Windows
+fs.readFile('', (err, data) => {
+ // => [Error: EISDIR: illegal operation on a directory, read ]
+});
+
+// FreeBSD
+fs.readFile('', (err, data) => {
+ // => null,
+});
+```
Any specified file descriptor has to support reading.
-_Note: If a file descriptor is specified as the `file`, it will not be closed
-automatically._
+*Note*: If a file descriptor is specified as the `path`, it will not be closed
+automatically.
## fs.readFileSync(file[, options])
-* `file` {String | Buffer | Integer} filename or file descriptor
-* `options` {Object | String}
- * `encoding` {String | Null} default = `null`
- * `flag` {String} default = `'r'`
+* `file` {string|Buffer|integer} filename or file descriptor
+* `options` {Object|string}
+ * `encoding` {string|null} default = `null`
+ * `flag` {string} default = `'r'`
Synchronous version of [`fs.readFile`][]. Returns the contents of the `file`.
If the `encoding` option is specified then this function returns a
string. Otherwise it returns a buffer.
+*Note*: Similar to [`fs.readFile()`][], when the path is a directory, the
+behavior of `fs.readFileSync()` is platform-specific.
+
+```js
+// macOS, Linux and Windows
+fs.readFileSync('');
+// => [Error: EISDIR: illegal operation on a directory, read ]
+
+// FreeBSD
+fs.readFileSync(''); // => null,
+```
+
## fs.readlink(path[, options], callback)
-* `path` {String | Buffer}
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `path` {string|Buffer}
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
* `callback` {Function}
Asynchronous readlink(2). The callback gets two arguments `(err,
@@ -1410,9 +1440,9 @@ the link path returned will be passed as a `Buffer` object.
added: v0.1.31
-->
-* `path` {String | Buffer}
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `path` {string|Buffer}
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
Synchronous readlink(2). Returns the symbolic link's string value.
@@ -1426,11 +1456,11 @@ the link path returned will be passed as a `Buffer` object.
added: v0.1.21
-->
-* `fd` {Integer}
-* `buffer` {String | Buffer}
-* `offset` {Integer}
-* `length` {Integer}
-* `position` {Integer}
+* `fd` {integer}
+* `buffer` {string | Buffer}
+* `offset` {integer}
+* `length` {integer}
+* `position` {integer}
Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`.
@@ -1439,9 +1469,9 @@ Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`.
added: v0.1.31
-->
-* `path` {String | Buffer}
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `path` {string|Buffer}
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
* `callback` {Function}
Asynchronous realpath(3). The `callback` gets two arguments `(err,
@@ -1459,9 +1489,9 @@ the path returned will be passed as a `Buffer` object.
added: v0.1.31
-->
-* `path` {String | Buffer};
-* `options` {String | Object}
- * `encoding` {String} default = `'utf8'`
+* `path` {string|Buffer};
+* `options` {string|Object}
+ * `encoding` {string} default = `'utf8'`
Synchronous realpath(3). Returns the resolved path.
@@ -1477,8 +1507,8 @@ will be passed as a `Buffer` object.
added: v0.0.2
-->
-* `oldPath` {String | Buffer}
-* `newPath` {String | Buffer}
+* `oldPath` {string|Buffer}
+* `newPath` {string|Buffer}
* `callback` {Function}
Asynchronous rename(2). No arguments other than a possible exception are given
@@ -1489,8 +1519,8 @@ to the completion callback.
added: v0.1.21
-->
-* `oldPath` {String | Buffer}
-* `newPath` {String | Buffer}
+* `oldPath` {string|Buffer}
+* `newPath` {string|Buffer}
Synchronous rename(2). Returns `undefined`.
@@ -1499,7 +1529,7 @@ Synchronous rename(2). Returns `undefined`.
added: v0.0.2
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
* `callback` {Function}
Asynchronous rmdir(2). No arguments other than a possible exception are given
@@ -1510,7 +1540,7 @@ to the completion callback.
added: v0.1.21
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
Synchronous rmdir(2). Returns `undefined`.
@@ -1519,7 +1549,7 @@ Synchronous rmdir(2). Returns `undefined`.
added: v0.0.2
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
* `callback` {Function}
Asynchronous stat(2). The callback gets two arguments `(err, stats)` where
@@ -1540,7 +1570,7 @@ is recommended.
added: v0.1.21
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
Synchronous stat(2). Returns an instance of [`fs.Stats`][].
@@ -1549,9 +1579,9 @@ Synchronous stat(2). Returns an instance of [`fs.Stats`][].
added: v0.1.31
-->
-* `target` {String | Buffer}
-* `path` {String | Buffer}
-* `type` {String}
+* `target` {string|Buffer}
+* `path` {string|Buffer}
+* `type` {string}
* `callback` {Function}
Asynchronous symlink(2). No arguments other than a possible exception are given
@@ -1574,9 +1604,9 @@ It creates a symbolic link named "new-port" that points to "foo".
added: v0.1.31
-->
-* `target` {String | Buffer}
-* `path` {String | Buffer}
-* `type` {String}
+* `target` {string|Buffer}
+* `path` {string|Buffer}
+* `type` {string}
Synchronous symlink(2). Returns `undefined`.
@@ -1585,8 +1615,8 @@ Synchronous symlink(2). Returns `undefined`.
added: v0.8.6
-->
-* `path` {String | Buffer}
-* `len` {Integer} default = `0`
+* `path` {string|Buffer}
+* `len` {integer} default = `0`
* `callback` {Function}
Asynchronous truncate(2). No arguments other than a possible exception are
@@ -1598,8 +1628,8 @@ first argument. In this case, `fs.ftruncate()` is called.
added: v0.8.6
-->
-* `path` {String | Buffer}
-* `len` {Integer} default = `0`
+* `path` {string|Buffer}
+* `len` {integer} default = `0`
Synchronous truncate(2). Returns `undefined`. A file descriptor can also be
passed as the first argument. In this case, `fs.ftruncateSync()` is called.
@@ -1609,7 +1639,7 @@ passed as the first argument. In this case, `fs.ftruncateSync()` is called.
added: v0.0.2
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
* `callback` {Function}
Asynchronous unlink(2). No arguments other than a possible exception are given
@@ -1620,7 +1650,7 @@ to the completion callback.
added: v0.1.21
-->
-* `path` {String | Buffer}
+* `path` {string|Buffer}
Synchronous unlink(2). Returns `undefined`.
@@ -1629,7 +1659,7 @@ Synchronous unlink(2). Returns `undefined`.
added: v0.1.31
-->
-* `filename` {String | Buffer}
+* `filename` {string|Buffer}
* `listener` {Function}
Stop watching for changes on `filename`. If `listener` is specified, only that
@@ -1639,18 +1669,18 @@ have effectively stopped watching `filename`.
Calling `fs.unwatchFile()` with a filename that is not being watched is a
no-op, not an error.
-_Note: [`fs.watch()`][] is more efficient than `fs.watchFile()` and `fs.unwatchFile()`.
+*Note*: [`fs.watch()`][] is more efficient than `fs.watchFile()` and `fs.unwatchFile()`.
`fs.watch()` should be used instead of `fs.watchFile()` and `fs.unwatchFile()`
-when possible._
+when possible.
## fs.utimes(path, atime, mtime, callback)
-* `path` {String | Buffer}
-* `atime` {Integer}
-* `mtime` {Integer}
+* `path` {string|Buffer}
+* `atime` {integer}
+* `mtime` {integer}
* `callback` {Function}
Change file timestamps of the file referenced by the supplied path.
@@ -1670,9 +1700,9 @@ follow these rules:
added: v0.4.2
-->
-* `path` {String | Buffer}
-* `atime` {Integer}
-* `mtime` {Integer}
+* `path` {string|Buffer}
+* `atime` {integer}
+* `mtime` {integer}
Synchronous version of [`fs.utimes()`][]. Returns `undefined`.
@@ -1681,15 +1711,15 @@ Synchronous version of [`fs.utimes()`][]. Returns `undefined`.
added: v0.5.10
-->
-* `filename` {String | Buffer}
-* `options` {String | Object}
- * `persistent` {Boolean} Indicates whether the process should continue to run
+* `filename` {string|Buffer}
+* `options` {string|Object}
+ * `persistent` {boolean} Indicates whether the process should continue to run
as long as files are being watched. default = `true`
- * `recursive` {Boolean} Indicates whether all subdirectories should be
+ * `recursive` {boolean} Indicates whether all subdirectories should be
watched, or only the current directory. The applies when a directory is
specified, and only on supported platforms (See [Caveats][]). default =
`false`
- * `encoding` {String} Specifies the character encoding to be used for the
+ * `encoding` {string} Specifies the character encoding to be used for the
filename passed to the listener. default = `'utf8'`
* `listener` {Function}
@@ -1784,10 +1814,10 @@ fs.watch('somedir', (eventType, filename) => {
added: v0.1.31
-->
-* `filename` {String | Buffer}
+* `filename` {string|Buffer}
* `options` {Object}
- * `persistent` {Boolean}
- * `interval` {Integer}
+ * `persistent` {boolean}
+ * `interval` {integer}
* `listener` {Function}
Watch for changes on `filename`. The callback `listener` will be called each
@@ -1815,26 +1845,26 @@ These stat objects are instances of `fs.Stat`.
If you want to be notified when the file was modified, not just accessed,
you need to compare `curr.mtime` and `prev.mtime`.
-_Note: when an `fs.watchFile` operation results in an `ENOENT` error, it will
+*Note*: when an `fs.watchFile` operation results in an `ENOENT` error, it will
invoke the listener once, with all the fields zeroed (or, for dates, the Unix
Epoch). In Windows, `blksize` and `blocks` fields will be `undefined`, instead
of zero. If the file is created later on, the listener will be called again,
- with the latest stat objects. This is a change in functionality since v0.10._
+ with the latest stat objects. This is a change in functionality since v0.10.
-_Note: [`fs.watch()`][] is more efficient than `fs.watchFile` and
+*Note*: [`fs.watch()`][] is more efficient than `fs.watchFile` and
`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and
-`fs.unwatchFile` when possible._
+`fs.unwatchFile` when possible.
## fs.write(fd, buffer, offset, length[, position], callback)
-* `fd` {Integer}
-* `buffer` {String | Buffer}
-* `offset` {Integer}
-* `length` {Integer}
-* `position` {Integer}
+* `fd` {integer}
+* `buffer` {string | Buffer}
+* `offset` {integer}
+* `length` {integer}
+* `position` {integer}
* `callback` {Function}
Write `buffer` to the file specified by `fd`.
@@ -1862,10 +1892,10 @@ the end of the file.
added: v0.11.5
-->
-* `fd` {Integer}
-* `data` {String | Buffer}
-* `position` {Integer}
-* `encoding` {String}
+* `fd` {integer}
+* `data` {string | Buffer}
+* `position` {integer}
+* `encoding` {string}
* `callback` {Function}
Write `data` to the file specified by `fd`. If `data` is not a Buffer instance
@@ -1898,12 +1928,12 @@ the end of the file.
added: v0.1.29
-->
-* `file` {String | Buffer | Integer} filename or file descriptor
-* `data` {String | Buffer}
-* `options` {Object | String}
- * `encoding` {String | Null} default = `'utf8'`
- * `mode` {Integer} default = `0o666`
- * `flag` {String} default = `'w'`
+* `file` {string | Buffer | integer} filename or file descriptor
+* `data` {string | Buffer}
+* `options` {Object | string}
+ * `encoding` {string | Null} default = `'utf8'`
+ * `mode` {integer} default = `0o666`
+ * `flag` {string} default = `'w'`
* `callback` {Function}
Asynchronously writes data to a file, replacing the file if it already exists.
@@ -1933,20 +1963,20 @@ Note that it is unsafe to use `fs.writeFile` multiple times on the same file
without waiting for the callback. For this scenario,
`fs.createWriteStream` is strongly recommended.
-_Note: If a file descriptor is specified as the `file`, it will not be closed
-automatically._
+*Note*: If a file descriptor is specified as the `file`, it will not be closed
+automatically.
## fs.writeFileSync(file, data[, options])
-* `file` {String | Buffer | Integer} filename or file descriptor
-* `data` {String | Buffer}
-* `options` {Object | String}
- * `encoding` {String | Null} default = `'utf8'`
- * `mode` {Integer} default = `0o666`
- * `flag` {String} default = `'w'`
+* `file` {string | Buffer | integer} filename or file descriptor
+* `data` {string | Buffer}
+* `options` {Object | string}
+ * `encoding` {string | Null} default = `'utf8'`
+ * `mode` {integer} default = `0o666`
+ * `flag` {string} default = `'w'`
The synchronous version of [`fs.writeFile()`][]. Returns `undefined`.
@@ -1955,21 +1985,21 @@ The synchronous version of [`fs.writeFile()`][]. Returns `undefined`.
added: v0.1.21
-->
-* `fd` {Integer}
-* `buffer` {String | Buffer}
-* `offset` {Integer}
-* `length` {Integer}
-* `position` {Integer}
+* `fd` {integer}
+* `buffer` {string | Buffer}
+* `offset` {integer}
+* `length` {integer}
+* `position` {integer}
## fs.writeSync(fd, data[, position[, encoding]])
-* `fd` {Integer}
-* `data` {String | Buffer}
-* `position` {Integer}
-* `encoding` {String}
+* `fd` {integer}
+* `data` {string | Buffer}
+* `position` {integer}
+* `encoding` {string}
Synchronous versions of [`fs.write()`][]. Returns the number of bytes written.
diff --git a/doc/api/globals.md b/doc/api/globals.md
index a60cd4cc226fb2..b0467cdacde3a5 100644
--- a/doc/api/globals.md
+++ b/doc/api/globals.md
@@ -27,7 +27,7 @@ added: v0.1.27
-* {String}
+* {string}
The directory name of the current module. This the same as the
[`path.dirname()`][] of the [`__filename`][].
@@ -50,7 +50,7 @@ added: v0.0.1
-* {String}
+* {string}
The file name of the current module. This is the resolved absolute path of the
current module file.
diff --git a/doc/api/http.md b/doc/api/http.md
index cdbdacb94c939e..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',
@@ -110,16 +112,16 @@ added: v0.3.4
* `options` {Object} Set of configurable options to set on the agent.
Can have the following fields:
- * `keepAlive` {Boolean} Keep sockets around even when there are no
+ * `keepAlive` {boolean} Keep sockets around even when there are no
outstanding requests, so they can be used for future requests without
having to reestablish a TCP connection. Default = `false`
* `keepAliveMsecs` {Integer} When using the `keepAlive` option, specifies
the [initial delay](#net_socket_setkeepalive_enable_initialdelay)
for TCP Keep-Alive packets. Ignored when the
`keepAlive` option is `false` or `undefined`. Default = `1000`.
- * `maxSockets` {Number} Maximum number of sockets to allow per
+ * `maxSockets` {number} Maximum number of sockets to allow per
host. Default = `Infinity`.
- * `maxFreeSockets` {Number} Maximum number of sockets to leave open
+ * `maxFreeSockets` {number} Maximum number of sockets to leave open
in a free state. Only relevant if `keepAlive` is set to `true`.
Default = `256`.
@@ -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);
```
@@ -184,9 +186,9 @@ added: v0.11.4
-->
* `options` {Object} A set of options providing information for name generation
- * `host` {String} A domain name or IP address of the server to issue the request to
- * `port` {Number} Port of remote server
- * `localAddress` {String} Local interface to bind for network connections
+ * `host` {string} A domain name or IP address of the server to issue the request to
+ * `port` {number} Port of remote server
+ * `localAddress` {string} Local interface to bind for network connections
when issuing the request
* Returns: {String}
@@ -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) => {
@@ -463,8 +465,8 @@ aborted, in milliseconds since 1 January 1970 00:00:00 UTC.
added: v0.1.90
-->
-* `data` {String | Buffer}
-* `encoding` {String}
+* `data` {string|Buffer}
+* `encoding` {string}
* `callback` {Function}
Finishes sending the request. If any parts of the body are
@@ -497,7 +499,7 @@ the optimization and kickstart the request.
added: v0.5.9
-->
-* `noDelay` {Boolean}
+* `noDelay` {boolean}
Once a socket is assigned to this request and is connected
[`socket.setNoDelay()`][] will be called.
@@ -507,8 +509,8 @@ Once a socket is assigned to this request and is connected
added: v0.5.9
-->
-* `enable` {Boolean}
-* `initialDelay` {Number}
+* `enable` {boolean}
+* `initialDelay` {number}
Once a socket is assigned to this request and is connected
[`socket.setKeepAlive()`][] will be called.
@@ -518,7 +520,7 @@ Once a socket is assigned to this request and is connected
added: v0.5.9
-->
-* `timeout` {Number} Milliseconds before a request is considered to be timed out.
+* `timeout` {number} Milliseconds before a request is considered to be timed out.
* `callback` {Function} Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.
Once a socket is assigned to this request and is connected
@@ -531,8 +533,8 @@ Returns `request`.
added: v0.1.29
-->
-* `chunk` {String | Buffer}
-* `encoding` {String}
+* `chunk` {string|Buffer}
+* `encoding` {string}
* `callback` {Function}
Sends a chunk of the body. By calling this method
@@ -731,7 +733,7 @@ subsequent call will *re-open* the server using the provided options.
added: v0.1.90
-->
-* `path` {String}
+* `path` {string}
* `callback` {Function}
Start a UNIX socket server listening for connections on the given `path`.
@@ -747,9 +749,9 @@ subsequent call will *re-open* the server using the provided options.
added: v0.1.90
-->
-* `port` {Number}
-* `hostname` {String}
-* `backlog` {Number}
+* `port` {number}
+* `hostname` {string}
+* `backlog` {number}
* `callback` {Function}
Begin accepting connections on the specified `port` and `hostname`. If the
@@ -797,7 +799,7 @@ no limit will be applied.
added: v0.9.12
-->
-* `msecs` {Number}
+* `msecs` {number}
* `callback` {Function}
Sets the timeout value for sockets, and emits a `'timeout'` event on
@@ -895,8 +897,8 @@ will result in a [`TypeError`][] being thrown.
added: v0.1.90
-->
-* `data` {String | Buffer}
-* `encoding` {String}
+* `data` {string|Buffer}
+* `encoding` {string}
* `callback` {Function}
This method signals to the server that all of the response headers and body
@@ -924,7 +926,7 @@ as `false`. After [`response.end()`][] executes, the value will be `true`.
added: v0.4.0
-->
-* `name` {String}
+* `name` {string}
* Returns: {String}
Reads out a header that's already been queued but not sent to the client.
@@ -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
@@ -950,7 +952,7 @@ Boolean (read-only). True if headers were sent, false otherwise.
added: v0.4.0
-->
-* `name` {String}
+* `name` {string}
Removes a header that's queued for implicit sending.
@@ -978,8 +980,8 @@ in responses.
added: v0.4.0
-->
-* `name` {String}
-* `value` {String}
+* `name` {string}
+* `value` {string}
Sets a single header value for implicit headers. If this header already exists
in the to-be-sent headers, its value will be replaced. Use an array of strings
@@ -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'});
@@ -1019,7 +1021,7 @@ const server = http.createServer((req,res) => {
added: v0.9.12
-->
-* `msecs` {Number}
+* `msecs` {number}
* `callback` {Function}
Sets the Socket's timeout value to `msecs`. If a callback is
@@ -1080,8 +1082,8 @@ status message which was sent out.
added: v0.1.29
-->
-* `chunk` {String | Buffer}
-* `encoding` {String}
+* `chunk` {string|Buffer}
+* `encoding` {string}
* `callback` {Function}
* Returns: {Boolean}
@@ -1126,8 +1128,8 @@ the request body should be sent. See the [`'checkContinue'`][] event on `Server`
added: v0.1.30
-->
-* `statusCode` {Number}
-* `statusMessage` {String}
+* `statusCode` {number}
+* `statusMessage` {string}
* `headers` {Object}
Sends a response header to the request. The status code is a 3-digit HTTP
@@ -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'});
@@ -1315,7 +1317,7 @@ received. Only populated at the `'end'` event.
added: v0.5.9
-->
-* `msecs` {Number}
+* `msecs` {number}
* `callback` {Function}
Calls `message.connection.setTimeout(msecs, callback)`.
@@ -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);
@@ -1533,28 +1536,28 @@ added: v0.3.6
-->
* `options` {Object}
- * `protocol` {String} Protocol to use. Defaults to `'http:'`.
- * `host` {String} A domain name or IP address of the server to issue the
+ * `protocol` {string} Protocol to use. Defaults to `'http:'`.
+ * `host` {string} A domain name or IP address of the server to issue the
request to. Defaults to `'localhost'`.
- * `hostname` {String} Alias for `host`. To support [`url.parse()`][],
+ * `hostname` {string} Alias for `host`. To support [`url.parse()`][],
`hostname` is preferred over `host`.
- * `family` {Number} IP address family to use when resolving `host` and
+ * `family` {number} IP address family to use when resolving `host` and
`hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and
v6 will be used.
- * `port` {Number} Port of remote server. Defaults to 80.
- * `localAddress` {String} Local interface to bind for network connections.
- * `socketPath` {String} Unix Domain Socket (use one of host:port or
+ * `port` {number} Port of remote server. Defaults to 80.
+ * `localAddress` {string} Local interface to bind for network connections.
+ * `socketPath` {string} Unix Domain Socket (use one of host:port or
socketPath).
- * `method` {String} A string specifying the HTTP request method. Defaults to
+ * `method` {string} A string specifying the HTTP request method. Defaults to
`'GET'`.
- * `path` {String} Request path. Defaults to `'/'`. Should include query
+ * `path` {string} Request path. Defaults to `'/'`. Should include query
string if any. E.G. `'/index.html?page=12'`. An exception is thrown when
the request path contains illegal characters. Currently, only spaces are
rejected but that may change in the future.
* `headers` {Object} An object containing request headers.
- * `auth` {String} Basic authentication i.e. `'user:password'` to compute an
+ * `auth` {string} Basic authentication i.e. `'user:password'` to compute an
Authorization header.
- * `agent` {http.Agent|Boolean} Controls [`Agent`][] behavior. Possible values:
+ * `agent` {http.Agent|boolean} Controls [`Agent`][] behavior. Possible values:
* `undefined` (default): use [`http.globalAgent`][] for this host and port.
* `Agent` object: explicitly use the passed in `Agent`.
* `false`: causes a new `Agent` with default values to be used.
@@ -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/https.md b/doc/api/https.md
index 12ebef2bf8ce4b..ea99d8bcdb99b0 100644
--- a/doc/api/https.md
+++ b/doc/api/https.md
@@ -21,17 +21,20 @@ added: v0.3.4
This class is a subclass of `tls.Server` and emits events same as
[`http.Server`][]. See [`http.Server`][] for more information.
-### server.setTimeout(msecs, callback)
+### server.setTimeout([msecs][, callback])
+- `msecs` {number} Defaults to 120000 (2 minutes).
+- `callback` {Function}
See [`http.Server#setTimeout()`][].
-### server.timeout
+### server.timeout([msecs])
+- `msecs` {number} Defaults to 120000 (2 minutes).
See [`http.Server#timeout`][].
@@ -39,10 +42,8 @@ See [`http.Server#timeout`][].
-
-Returns a new HTTPS web server object. The `options` is similar to
-[`tls.createServer()`][]. The `requestListener` is a function which is
-automatically added to the `'request'` event.
+- `options` {Object} Accepts `options` from [`tls.createServer()`][] and [`tls.createSecureContext()`][].
+- `requestListener` {Function} A listener to be added to the `request` event.
Example:
@@ -83,19 +84,33 @@ https.createServer(options, (req, res) => {
+- `callback` {Function}
See [`http.close()`][] for details.
### server.listen(handle[, callback])
+- `handle` {Object}
+- `callback` {Function}
+
### server.listen(path[, callback])
-### server.listen(port[, host][, backlog][, callback])
+- `path` {string}
+- `callback` {Function}
+
+### server.listen([port][, host][, backlog][, callback])
+- `port` {number}
+- `hostname` {string}
+- `backlog` {number}
+- `callback` {Function}
See [`http.listen()`][] for details.
-## https.get(options, callback)
+## https.get(options[, callback])
+- `options` {Object | string} Accepts the same `options` as
+ [`https.request()`][], with the `method` always set to `GET`.
+- `callback` {Function}
Like [`http.get()`][] but for HTTPS.
@@ -127,18 +142,27 @@ added: v0.5.9
Global instance of [`https.Agent`][] for all HTTPS client requests.
-## https.request(options, callback)
+## https.request(options[, callback])
+- `options` {Object | string} Accepts all `options` from [`http.request()`][],
+ with some differences in default values:
+ - `protocol` Defaults to `https:`
+ - `port` Defaults to `443`.
+ - `agent` Defaults to `https.globalAgent`.
+- `callback` {Function}
+
Makes a request to a secure web server.
+The following additional `options` from [`tls.connect()`][] are also accepted when using a
+ custom [`Agent`][]:
+ `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`, `secureProtocol`, `servername`
+
`options` can be an object or a string. If `options` is a string, it is
automatically parsed with [`url.parse()`][].
-All options from [`http.request()`][] are valid.
-
Example:
```js
@@ -165,58 +189,7 @@ req.on('error', (e) => {
});
req.end();
```
-
-The options argument has the following options
-
-- `host`: A domain name or IP address of the server to issue the request to.
- Defaults to `'localhost'`.
-- `hostname`: Alias for `host`. To support `url.parse()` `hostname` is
- preferred over `host`.
-- `family`: IP address family to use when resolving `host` and `hostname`.
- Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be
- used.
-- `port`: Port of remote server. Defaults to 443.
-- `localAddress`: Local interface to bind for network connections.
-- `socketPath`: Unix Domain Socket (use one of host:port or socketPath).
-- `method`: A string specifying the HTTP request method. Defaults to `'GET'`.
-- `path`: Request path. Defaults to `'/'`. Should include query string if any.
- E.G. `'/index.html?page=12'`. An exception is thrown when the request path
- contains illegal characters. Currently, only spaces are rejected but that
- may change in the future.
-- `headers`: An object containing request headers.
-- `auth`: Basic authentication i.e. `'user:password'` to compute an
- Authorization header.
-- `agent`: Controls [`Agent`][] behavior. When an Agent is used request will
- default to `Connection: keep-alive`. Possible values:
- - `undefined` (default): use [`globalAgent`][] for this host and port.
- - `Agent` object: explicitly use the passed in `Agent`.
- - `false`: opts out of connection pooling with an Agent, defaults request to
- `Connection: close`.
-
-The following options from [`tls.connect()`][] can also be specified:
-
-- `pfx`: Certificate, Private key and CA certificates to use for SSL. Default `null`.
-- `key`: Private key to use for SSL. Default `null`.
-- `passphrase`: A string of passphrase for the private key or pfx. Default `null`.
-- `cert`: Public x509 certificate to use. Default `null`.
-- `ca`: A string, [`Buffer`][] or array of strings or [`Buffer`][]s of trusted
- certificates in PEM format. If this is omitted several well known "root"
- CAs will be used, like VeriSign. These are used to authorize connections.
-- `ciphers`: A string describing the ciphers to use or exclude. Consult
- for
- details on the format.
-- `rejectUnauthorized`: If `true`, the server certificate is verified against
- the list of supplied CAs. An `'error'` event is emitted if verification
- fails. Verification happens at the connection level, *before* the HTTP
- request is sent. Default `true`.
-- `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force
- SSL version 3. The possible values depend on your installation of
- OpenSSL and are defined in the constant [`SSL_METHODS`][].
-- `servername`: Servername for SNI (Server Name Indication) TLS extension.
-
-In order to specify these options, use a custom [`Agent`][].
-
-Example:
+Example using options from [`tls.connect()`][]:
```js
const options = {
@@ -270,4 +243,5 @@ const req = https.request(options, (res) => {
[`SSL_METHODS`]: https://www.openssl.org/docs/man1.0.2/ssl/ssl.html#DEALING-WITH-PROTOCOL-METHODS
[`tls.connect()`]: tls.html#tls_tls_connect_options_callback
[`tls.createServer()`]: tls.html#tls_tls_createserver_options_secureconnectionlistener
+[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options
[`url.parse()`]: url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
diff --git a/doc/api/modules.md b/doc/api/modules.md
index cdbbf14fa43310..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,9 +552,11 @@ 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.
+ // ... etc.
+};
```
To illustrate the behavior, imagine this hypothetical implementation of
@@ -586,7 +584,7 @@ function require(/* ... */) {
added: v0.1.16
-->
-* {String}
+* {string}
The fully resolved filename to the module.
@@ -595,7 +593,7 @@ The fully resolved filename to the module.
added: v0.1.16
-->
-* {String}
+* {string}
The identifier for the module. Typically this is the fully resolved
filename.
@@ -605,7 +603,7 @@ filename.
added: v0.1.16
-->
-* {Boolean}
+* {boolean}
Whether or not the module is done loading, or is in the process of
loading.
@@ -624,7 +622,7 @@ The module that first required this one.
added: v0.5.1
-->
-* `id` {String}
+* `id` {string}
* Returns: {Object} `module.exports` from the resolved module
The `module.require` method provides a way to load a module as if
diff --git a/doc/api/net.md b/doc/api/net.md
index d7219efe5b3548..72adf6306db77c 100644
--- a/doc/api/net.md
+++ b/doc/api/net.md
@@ -58,11 +58,14 @@ added: v0.1.90
-->
Returns the bound address, the address family name, and port of the server
-as reported by the operating system.
+as reported by the operating system if listening on an IP socket.
Useful to find which port was assigned when getting an OS-assigned address.
Returns an object with `port`, `family`, and `address` properties:
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
+For a server listening on a pipe or UNIX domain socket, the name is returned
+as a string.
+
Example:
```js
@@ -86,6 +89,8 @@ Don't call `server.address()` until the `'listening'` event has been emitted.
added: v0.1.90
-->
+* Returns: {net.Server}
+
Stops the server from accepting new connections and keeps existing
connections. This function is asynchronous, the server is finally
closed when all connections are ended and the server emits a [`'close'`][] event.
@@ -93,6 +98,8 @@ The optional `callback` will be called once the `'close'` event occurs. Unlike
that event, it will be called with an Error as its only argument if the server
was not open when it was closed.
+Returns `server`.
+
### server.connections
* `handle` {Object}
-* `backlog` {Number}
+* `backlog` {number}
* `callback` {Function}
+* Returns: {net.Server}
The `handle` object can be set to either a server or socket (anything
with an underlying `_handle` member), or a `{fd: }` object.
@@ -149,12 +157,13 @@ added: v0.11.14
-->
* `options` {Object} - Required. Supports the following properties:
- * `port` {Number} - Optional.
- * `host` {String} - Optional.
- * `backlog` {Number} - Optional.
- * `path` {String} - Optional.
- * `exclusive` {Boolean} - Optional.
+ * `port` {number} - Optional.
+ * `host` {string} - Optional.
+ * `backlog` {number} - Optional.
+ * `path` {string} - Optional.
+ * `exclusive` {boolean} - Optional.
* `callback` {Function} - Optional.
+* Returns: {net.Server}
The `port`, `host`, and `backlog` properties of `options`, as well as the
optional callback function, behave as they do on a call to
@@ -183,9 +192,10 @@ subsequent call will *re-open* the server using the provided options.
added: v0.1.90
-->
-* `path` {String}
-* `backlog` {Number}
+* `path` {string}
+* `backlog` {number}
* `callback` {Function}
+* Returns: {net.Server}
Start a local socket server listening for connections on the given `path`.
@@ -224,6 +234,7 @@ subsequent call will *re-open* the server using the provided options.
+* Returns: {net.Server}
Begin accepting connections on the specified `port` and `hostname`. If the
`hostname` is omitted, the server will accept connections on any IPv6 address
@@ -286,23 +297,23 @@ with [`child_process.fork()`][].
added: v0.9.1
-->
+* Returns: {net.Server}
+
Opposite of `unref`, calling `ref` on a previously `unref`d server will *not*
let the program exit if it's the only server left (the default behavior). If
the server is `ref`d calling `ref` again will have no effect.
-Returns `server`.
-
### server.unref()
+* Returns: {net.Server}
+
Calling `unref` on a server will allow the program to exit if this is the only
active server in the event system. If the server is already `unref`d calling
`unref` again will have no effect.
-Returns `server`.
-
## Class: net.Socket
```js
{
fd: null,
@@ -343,7 +355,7 @@ About `allowHalfOpen`, refer to [`net.createServer()`][] and [`'end'`][] event.
added: v0.1.90
-->
-* `had_error` {Boolean} `true` if the socket had a transmission error.
+* `had_error` {boolean} `true` if the socket had a transmission error.
Emitted once the socket is fully closed. The argument `had_error` is a boolean
which says if the socket was closed due to a transmission error.
@@ -410,10 +422,10 @@ added: v0.11.3
Emitted after resolving the hostname but before connecting.
Not applicable to UNIX sockets.
-* `err` {Error|Null} The error object. See [`dns.lookup()`][].
-* `address` {String} The IP address.
-* `family` {String|Null} The address type. See [`dns.lookup()`][].
-* `host` {String} The hostname.
+* `err` {Error|null} The error object. See [`dns.lookup()`][].
+* `address` {string} The IP address.
+* `family` {string|null} The address type. See [`dns.lookup()`][].
+* `host` {string} The hostname.
### Event: 'timeout'
+* Returns: {net.Socket} The socket itself.
+
Half-closes the socket. i.e., it sends a FIN packet. It is possible the
server will still send some data.
@@ -572,6 +592,8 @@ The numeric representation of the local port. For example,
### socket.pause()
+* Returns: {net.Socket} The socket itself.
+
Pauses the reading of data. That is, [`'data'`][] events will not be emitted.
Useful to throttle back an upload.
@@ -580,12 +602,12 @@ Useful to throttle back an upload.
added: v0.9.1
-->
+* Returns: {net.Socket} The socket itself.
+
Opposite of `unref`, calling `ref` on a previously `unref`d socket will *not*
let the program exit if it's the only socket left (the default behavior). If
the socket is `ref`d calling `ref` again will have no effect.
-Returns `socket`.
-
### socket.remoteAddress
+* Returns: {net.Socket} The socket itself.
+
Set the encoding for the socket as a [Readable Stream][]. See
[`stream.setEncoding()`][] for more information.
@@ -627,6 +653,8 @@ Set the encoding for the socket as a [Readable Stream][]. See
added: v0.1.92
-->
+* Returns: {net.Socket} The socket itself.
+
Enable/disable keep-alive functionality, and optionally set the initial
delay before the first keepalive probe is sent on an idle socket.
`enable` defaults to `false`.
@@ -636,25 +664,25 @@ data packet received and the first keepalive probe. Setting 0 for
initialDelay will leave the value unchanged from the default
(or previous) setting. Defaults to `0`.
-Returns `socket`.
-
### socket.setNoDelay([noDelay])
+* Returns: {net.Socket} The socket itself.
+
Disables the Nagle algorithm. By default TCP connections use the Nagle
algorithm, they buffer data before sending it off. Setting `true` for
`noDelay` will immediately fire off data each time `socket.write()` is called.
`noDelay` defaults to `true`.
-Returns `socket`.
-
### socket.setTimeout(timeout[, callback])
+* Returns: {net.Socket} The socket itself.
+
Sets the socket to timeout after `timeout` milliseconds of inactivity on
the socket. By default `net.Socket` do not have a timeout.
@@ -667,19 +695,17 @@ If `timeout` is 0, then the existing idle timeout is disabled.
The optional `callback` parameter will be added as a one time listener for the
[`'timeout'`][] event.
-Returns `socket`.
-
### socket.unref()
+* Returns: {net.Socket} The socket itself.
+
Calling `unref` on a socket will allow the program to exit if this is the only
active socket in the event system. If the socket is already `unref`d calling
`unref` again will have no effect.
-Returns `socket`.
-
### socket.write(data[, encoding][, callback])
```js
{
allowHalfOpen: false,
@@ -841,6 +868,8 @@ automatically set as a listener for the [`'connection'`][] event.
}
```
+* Returns: {net.Server}
+
If `allowHalfOpen` is `true`, then the socket won't automatically send a FIN
packet when the other end of the socket sends a FIN packet. The socket becomes
non-readable, but still writable. You should call the [`end()`][] method explicitly.
diff --git a/doc/api/os.md b/doc/api/os.md
index b2e096d8d9ff0b..84cb2ba3ff6b7c 100644
--- a/doc/api/os.md
+++ b/doc/api/os.md
@@ -14,7 +14,7 @@ const os = require('os');
added: v0.7.8
-->
-* {String}
+* {string}
A string constant defining the operating system-specific end-of-line marker:
@@ -26,7 +26,7 @@ A string constant defining the operating system-specific end-of-line marker:
added: v0.5.0
-->
-* Returns: {String}
+* Returns: {string}
The `os.arch()` method returns a string identifying the operating system CPU
architecture *for which the Node.js binary was compiled*.
@@ -60,7 +60,7 @@ each CPU/core installed.
The properties included on each object include:
-* `model` {String}
+* `model` {string}
* `speed` {number} (in MHz)
* `times` {Object}
* `user` {number} The number of milliseconds the CPU has spent in user mode.
@@ -71,6 +71,7 @@ The properties included on each object include:
For example:
+
```js
[
{
@@ -172,7 +173,7 @@ all processors are always 0.
added: v0.9.4
-->
-* Returns: {String}
+* Returns: {string}
The `os.endianness()` method returns a string identifying the endianness of the
CPU *for which the Node.js binary was compiled*.
@@ -187,7 +188,7 @@ Possible values are:
added: v0.3.3
-->
-* Returns: {Integer}
+* Returns: {integer}
The `os.freemem()` method returns the amount of free system memory in bytes as
an integer.
@@ -197,7 +198,7 @@ an integer.
added: v2.3.0
-->
-* Returns: {String}
+* Returns: {string}
The `os.homedir()` method returns the home directory of the current user as a
string.
@@ -207,7 +208,7 @@ string.
added: v0.3.3
-->
-* Returns: {String}
+* Returns: {string}
The `os.hostname()` method returns the hostname of the operating system as a
string.
@@ -244,15 +245,16 @@ value is an array of objects that each describe an assigned network address.
The properties available on the assigned network address object include:
-* `address` {String} The assigned IPv4 or IPv6 address
-* `netmask` {String} The IPv4 or IPv6 network mask
-* `family` {String} Either `IPv4` or `IPv6`
-* `mac` {String} The MAC address of the network interface
+* `address` {string} The assigned IPv4 or IPv6 address
+* `netmask` {string} The IPv4 or IPv6 network mask
+* `family` {string} Either `IPv4` or `IPv6`
+* `mac` {string} The MAC address of the network interface
* `internal` {boolean} `true` if the network interface is a loopback or
similar interface that is not remotely accessible; otherwise `false`
* `scopeid` {number} The numeric IPv6 scope ID (only specified when `family`
is `IPv6`)
+
```js
{
lo: [
@@ -295,7 +297,7 @@ The properties available on the assigned network address object include:
added: v0.5.0
-->
-* Returns: {String}
+* Returns: {string}
The `os.platform()` method returns a string identifying the operating system
platform as set during compile time of Node.js.
@@ -321,7 +323,7 @@ to be experimental at this time.
added: v0.3.3
-->
-* Returns: {String}
+* Returns: {string}
The `os.release()` method returns a string identifying the operating system
release.
@@ -335,7 +337,7 @@ https://en.wikipedia.org/wiki/Uname#Examples for more information.
added: v0.9.9
-->
-* Returns: {String}
+* Returns: {string}
The `os.tmpdir()` method returns a string specifying the operating system's
default directory for temporary files.
@@ -345,7 +347,7 @@ default directory for temporary files.
added: v0.3.3
-->
-* Returns: {Integer}
+* Returns: {integer}
The `os.totalmem()` method returns the total amount of system memory in bytes
as an integer.
@@ -355,7 +357,7 @@ as an integer.
added: v0.3.3
-->
-* Returns: {String}
+* Returns: {string}
The `os.type()` method returns a string identifying the operating system name
as returned by uname(3). For example `'Linux'` on Linux, `'Darwin'` on macOS and
@@ -369,13 +371,12 @@ information about the output of running uname(3) on various operating systems.
added: v0.3.3
-->
-* Returns: {Integer}
+* Returns: {integer}
The `os.uptime()` method returns the system uptime in number of seconds.
-*Note*: Within Node.js' internals, this number is represented as a `double`.
-However, fractional seconds are not returned and the value can typically be
-treated as an integer.
+*Note*: On Windows the returned value includes fractions of a second.
+Use `Math.floor()` to get whole seconds.
## os.userInfo([options])
* `options` {Object}
- * `encoding` {String} Character encoding used to interpret resulting strings.
+ * `encoding` {string} Character encoding used to interpret resulting strings.
If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir`
values will be `Buffer` instances. (Default: 'utf8')
* Returns: {Object}
diff --git a/doc/api/path.md b/doc/api/path.md
index 0c78c916497f6c..27ca6be6fed7ac 100644
--- a/doc/api/path.md
+++ b/doc/api/path.md
@@ -59,9 +59,9 @@ path.posix.basename('/tmp/myfile.html');
added: v0.1.25
-->
-* `path` {String}
-* `ext` {String} An optional file extension
-* Returns: {String}
+* `path` {string}
+* `ext` {string} An optional file extension
+* Returns: {string}
The `path.basename()` methods returns the last portion of a `path`, similar to
the Unix `basename` command. Trailing directory separators are ignored, see
@@ -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'
```
@@ -85,7 +85,7 @@ and is not a string.
added: v0.9.3
-->
-* {String}
+* {string}
Provides the platform-specific path delimiter:
@@ -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)
@@ -117,8 +117,8 @@ process.env.PATH.split(path.delimiter)
added: v0.1.16
-->
-* `path` {String}
-* Returns: {String}
+* `path` {string}
+* Returns: {string}
The `path.dirname()` method returns the directory name of a `path`, similar to
the Unix `dirname` command. Trailing directory separators are ignored, see
@@ -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'
```
@@ -138,8 +138,8 @@ A [`TypeError`][] is thrown if `path` is not a string.
added: v0.1.25
-->
-* `path` {String}
-* Returns: {String}
+* `path` {string}
+* Returns: {string}
The `path.extname()` method returns the extension of the `path`, from the last
occurrence of the `.` (period) character to end of string in the last portion of
@@ -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: ''
```
@@ -174,12 +174,12 @@ added: v0.11.15
-->
* `pathObject` {Object}
- * `dir` {String}
- * `root` {String}
- * `base` {String}
- * `name` {String}
- * `ext` {String}
-* Returns: {String}
+ * `dir` {string}
+ * `root` {string}
+ * `base` {string}
+ * `name` {string}
+ * `ext` {string}
+* Returns: {string}
The `path.format()` method returns a path string from an object. This is the
opposite of [`path.parse()`][].
@@ -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'
```
@@ -237,8 +237,8 @@ path.format({
added: v0.11.2
-->
-* `path` {String}
-* Returns: {Boolean}
+* `path` {string}
+* Returns: {boolean}
The `path.isAbsolute()` method determines if `path` is an absolute path.
@@ -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.
@@ -272,8 +272,8 @@ A [`TypeError`][] is thrown if `path` is not a string.
added: v0.1.16
-->
-* `...paths` {String} A sequence of path segments
-* Returns: {String}
+* `...paths` {string} A sequence of path segments
+* Returns: {string}
The `path.join()` method joins all given `path` segments together using the
platform specific separator as a delimiter, then normalizes the resulting path.
@@ -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.
@@ -299,15 +299,16 @@ A [`TypeError`][] is thrown if any of the path segments is not a string.
added: v0.1.23
-->
-* `path` {String}
-* Returns: {String}
+* `path` {string}
+* Returns: {string}
The `path.normalize()` method normalizes the given `path`, resolving `'..'` and
`'.'` segments.
When multiple, sequential path segment separation characters are found (e.g.
-`/` on POSIX and `\` on Windows), they are replaced by a single instance of the
-platform specific path segment separator. Trailing separators are preserved.
+`/` on POSIX and either `\` or `/` on Windows), they are replaced by a single
+instance of the platform specific path segment separator (`/` on POSIX and
+`\` on Windows). Trailing separators are preserved.
If the `path` is a zero-length string, `'.'` is returned, representing the
current working directory.
@@ -315,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'
```
@@ -326,6 +327,14 @@ path.normalize('C:\\temp\\\\foo\\bar\\..\\');
// Returns: 'C:\\temp\\foo\\'
```
+Since Windows recognizes multiple path separators, both separators will be
+replaced by instances of the Windows preferred separator (`\`):
+
+```js
+path.win32.normalize('C:////temp\\\\/\\/\\/foo/bar');
+// Returns: 'C:\\temp\\foo\\bar'
+```
+
A [`TypeError`][] is thrown if `path` is not a string.
## path.parse(path)
@@ -333,7 +342,7 @@ A [`TypeError`][] is thrown if `path` is not a string.
added: v0.11.15
-->
-* `path` {String}
+* `path` {string}
* Returns: {Object}
The `path.parse()` method returns an object whose properties represent
@@ -342,16 +351,16 @@ see [`path.sep`][].
The returned object will have the following properties:
-* `root` {String}
-* `dir` {String}
-* `base` {String}
-* `ext` {String}
-* `name` {String}
+* `root` {string}
+* `dir` {string}
+* `base` {string}
+* `ext` {string}
+* `name` {string}
For example on POSIX:
```js
-path.parse('/home/user/dir/file.txt')
+path.parse('/home/user/dir/file.txt');
// Returns:
// {
// root : "/",
@@ -375,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:\\",
@@ -413,13 +422,13 @@ of the `path` methods.
added: v0.5.0
-->
-* `from` {String}
-* `to` {String}
-* Returns: {String}
+* `from` {string}
+* `to` {string}
+* Returns: {string}
-The `path.relative()` method returns the relative path from `from` to `to`.
-If `from` and `to` each resolve to the same path (after calling `path.resolve()`
-on each), a zero-length string is returned.
+The `path.relative()` method returns the relative path from `from` to `to` based
+on the current working directory. If `from` and `to` each resolve to the same
+path (after calling `path.resolve()` on each), a zero-length string is returned.
If a zero-length string is passed as `from` or `to`, the current working
directory will be used instead of the zero-length strings.
@@ -427,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'
```
@@ -445,8 +454,8 @@ A [`TypeError`][] is thrown if neither `from` nor `to` is a string.
added: v0.3.4
-->
-* `...paths` {String} A sequence of paths or path segments
-* Returns: {String}
+* `...paths` {string} A sequence of paths or path segments
+* Returns: {string}
The `path.resolve()` method resolves a sequence of paths or path segments into
an absolute path.
@@ -470,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'
```
@@ -488,7 +497,7 @@ A [`TypeError`][] is thrown if any of the arguments is not a string.
added: v0.7.9
-->
-* {String}
+* {string}
Provides the platform-specific path segment separator:
@@ -498,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 5d4c08f1438189..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
```
@@ -268,9 +268,9 @@ lead to sub-optimal application performance, bugs or security vulnerabilities.
The listener function is called with a single `warning` argument whose value is
an `Error` object. There are three key properties that describe the warning:
-* `name` {String} The name of the warning (currently `Warning` by default).
-* `message` {String} A system-provided description of the warning.
-* `stack` {String} A stack trace to the location in the code where the warning
+* `name` {string} The name of the warning (currently `Warning` by default).
+* `message` {string} A system-provided description of the warning.
+* `stack` {string} A stack trace to the location in the code where the warning
was issued.
```js
@@ -447,7 +447,7 @@ generate a core file.
added: v0.5.0
-->
-* {String}
+* {string}
The `process.arch` property returns a String identifying the processor
architecture that the Node.js process is currently running on. For instance
@@ -501,7 +501,7 @@ Would generate the output:
added: 6.4.0
-->
-* {String}
+* {string}
The `process.argv0` property stores a read-only copy of the original value of
`argv[0]` passed when Node.js starts.
@@ -519,7 +519,7 @@ $ bash -c 'exec -a customArgv0 ./node'
added: v0.1.17
-->
-* `directory` {String}
+* `directory` {string}
The `process.chdir()` method changes the current working directory of the
Node.js process or throws an exception if doing so fails (for instance, if
@@ -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,6 +549,7 @@ running the `./configure` script.
An example of the possible output looks like:
+
```js
{
target_defaults:
@@ -586,7 +586,7 @@ replace the value of `process.config`.
added: v0.7.2
-->
-* {Boolean}
+* {boolean}
If the Node.js process is spawned with an IPC channel (see the [Child Process][]
and [Cluster][] documentation), the `process.connected` property will return
@@ -604,8 +604,8 @@ added: v6.1.0
* `previousValue` {Object} A previous return value from calling
`process.cpuUsage()`
* Returns: {Object}
- * `user` {Integer}
- * `system` {Integer}
+ * `user` {integer}
+ * `system` {integer}
The `process.cpuUsage()` method returns the user and system CPU time usage of
the current process, in an object with properties `user` and `system`, whose
@@ -633,7 +633,7 @@ console.log(process.cpuUsage(startUsage));
added: v0.1.8
-->
-* Returns: {String}
+* Returns: {string}
The `process.cwd()` method returns the current working directory of the Node.js
process.
@@ -670,6 +670,7 @@ See environ(7).
An example of this object looks like:
+
```js
{
TERM: 'xterm-256color',
@@ -740,8 +741,8 @@ console.log(process.env.test);
added: v6.0.0
-->
-* `warning` {String | Error} The warning to emit.
-* `name` {String} When `warning` is a String, `name` is the name to use
+* `warning` {string | Error} The warning to emit.
+* `name` {string} When `warning` is a String, `name` is the name to use
for the warning. Default: `Warning`.
* `ctor` {Function} When `warning` is a String, `ctor` is an optional
function used to limit the generated stack trace. Default
@@ -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']
```
@@ -861,13 +864,14 @@ And `process.argv`:
added: v0.1.100
-->
-* {String}
+* {string}
The `process.execPath` property returns the absolute pathname of the executable
that started the Node.js process.
For example:
+
```js
'/usr/local/bin/node'
```
@@ -878,7 +882,7 @@ For example:
added: v0.1.13
-->
-* `code` {Integer} The exit code. Defaults to `0`.
+* `code` {integer} The exit code. Defaults to `0`.
The `process.exit()` method instructs Node.js to terminate the process
synchronously with an exit status of `code`. If `code` is omitted, exit uses
@@ -943,7 +947,7 @@ is safer than calling `process.exit()`.
added: v0.11.8
-->
-* {Integer}
+* {integer}
A number which will be the process exit code, when the process either
exits gracefully, or is exited via [`process.exit()`][] without specifying
@@ -1028,7 +1032,7 @@ Android)
added: v0.1.28
-->
-* Returns: {Integer}
+* Returns: {integer}
The `process.getuid()` method returns the numeric user identity of the process.
(See getuid(2).)
@@ -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`);
@@ -1080,8 +1084,8 @@ passing the result to process.hrtime() will result in undefined behavior.
added: v0.9.4
-->
-* `user` {String|number} The user name or numeric identifier.
-* `extra_group` {String|number} A group name or numeric identifier.
+* `user` {string|number} The user name or numeric identifier.
+* `extra_group` {string|number} A group name or numeric identifier.
The `process.initgroups()` method reads the `/etc/group` file and initializes
the group access list, using all groups of which the user is a member. This is
@@ -1107,7 +1111,7 @@ added: v0.0.6
-->
* `pid` {number} A process ID
-* `signal` {String|number} The signal to send, either as a string or number.
+* `signal` {string|number} The signal to send, either as a string or number.
Defaults to `'SIGTERM'`.
The `process.kill()` method sends the `signal` to the process identified by
@@ -1163,10 +1167,10 @@ added: v0.1.16
-->
* Returns: {Object}
- * `rss` {Integer}
- * `heapTotal` {Integer}
- * `heapUsed` {Integer}
- * `external` {Integer}
+ * `rss` {integer}
+ * `heapTotal` {integer}
+ * `heapUsed` {integer}
+ * `external` {integer}
The `process.memoryUsage()` method returns an object describing the memory usage
of the Node.js process measured in bytes.
@@ -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.
@@ -1291,7 +1296,7 @@ happening, just like a `while(true);` loop.
added: v0.1.15
-->
-* {Integer}
+* {integer}
The `process.pid` property returns the PID of the process.
@@ -1304,7 +1309,7 @@ console.log(`This process is pid ${process.pid}`);
added: v0.1.16
-->
-* {String}
+* {string}
The `process.platform` property returns a string identifying the operating
system platform on which the Node.js process is running. For instance
@@ -1325,7 +1330,7 @@ tarball.
`process.release` contains the following properties:
-* `name` {String} A value that will always be `'node'` for Node.js. For
+* `name` {string} A value that will always be `'node'` for Node.js. For
legacy io.js releases, this will be `'io.js'`.
* `lts`: a string with a value indicating the _codename_ of the LTS (Long-term
Support) line the current release is part of. This property only exists for
@@ -1333,21 +1338,22 @@ tarball.
releases. Current valid values are:
- `"Argon"` for the v4.x LTS line beginning with v4.2.0.
- `"Boron"` for the v6.x LTS line beginning with v6.9.0.
-* `sourceUrl` {String} an absolute URL pointing to a _`.tar.gz`_ file containing
+* `sourceUrl` {string} an absolute URL pointing to a _`.tar.gz`_ file containing
the source code of the current release.
-* `headersUrl`{String} an absolute URL pointing to a _`.tar.gz`_ file containing
+* `headersUrl`{string} an absolute URL pointing to a _`.tar.gz`_ file containing
only the source header files for the current release. This file is
significantly smaller than the full source file and can be used for compiling
Node.js native add-ons.
-* `libUrl` {String} an absolute URL pointing to a _`node.lib`_ file matching the
+* `libUrl` {string} an absolute URL pointing to a _`node.lib`_ file matching the
architecture and version of the current release. This file is used for
compiling Node.js native add-ons. _This property is only present on Windows
builds of Node.js and will be missing on all other platforms._
-* `lts` {String} a string label identifying the [LTS][] label for this release.
+* `lts` {string} a string label identifying the [LTS][] label for this release.
If the Node.js release is not an LTS release, this will be `undefined`.
For example:
+
```js
{
name: 'node',
@@ -1371,7 +1377,7 @@ added: v0.5.9
* `sendHandle` {Handle object}
* `options` {Object}
* `callback` {Function}
-* Returns: {Boolean}
+* Returns: {boolean}
If Node.js is spawned with an IPC channel, the `process.send()` method can be
used to send messages to the parent process. Messages will be received as a
@@ -1388,7 +1394,7 @@ If Node.js was not spawned with an IPC channel, `process.send()` will be
added: v2.0.0
-->
-* `id` {String|number} A group name or ID
+* `id` {string|number} A group name or ID
The `process.setegid()` method sets the effective group identity of the process.
(See setegid(2).) The `id` can be passed as either a numeric ID or a group
@@ -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}`);
}
}
@@ -1417,7 +1422,7 @@ Android)
added: v2.0.0
-->
-* `id` {String|number} A user name or ID
+* `id` {string|number} A user name or ID
The `process.seteuid()` method sets the effective user identity of the process.
(See seteuid(2).) The `id` can be passed as either a numeric ID or a username
@@ -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}`);
}
}
@@ -1445,7 +1449,7 @@ Android)
added: v0.1.31
-->
-* `id` {String|number} The group name or ID
+* `id` {string|number} The group name or ID
The `process.setgid()` method sets the group identity of the process. (See
setgid(2).) The `id` can be passed as either a numeric ID or a group name
@@ -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}`);
}
@@ -1590,7 +1592,7 @@ important ways:
- TTYs (Terminals): *asynchronous* on Windows, *synchronous* on Unix
- Pipes (and sockets): *synchronous* on Windows, *asynchronous* on Unix
-These behaviours are partly for historical reasons, as changing them would
+These behaviors are partly for historical reasons, as changing them would
create backwards incompatibility, but they are also expected by some users.
Synchronous writes avoid problems such as output written with `console.log()` or
@@ -1629,7 +1631,7 @@ See the [TTY][] documentation for more information.
added: v0.1.104
-->
-* {String}
+* {string}
The `process.title` property returns the current process title (i.e. returns
the current value of `ps`). Assigning a new value to `process.title` modifies
@@ -1670,17 +1672,20 @@ console.log(
added: v0.5.0
-->
-* Returns: {Number}
+* Returns: {number}
The `process.uptime()` method returns the number of seconds the current Node.js
process has been running.
+*Note*: the return value includes fractions of a second. Use `Math.floor()`
+to get whole seconds.
+
## process.version
-* {String}
+* {string}
The `process.version` property returns the Node.js version string.
@@ -1704,8 +1709,9 @@ 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
{
http_parser: '2.3.0',
diff --git a/doc/api/punycode.md b/doc/api/punycode.md
index a5d1908a8c40b6..87d1c7d80ad431 100644
--- a/doc/api/punycode.md
+++ b/doc/api/punycode.md
@@ -34,7 +34,7 @@ the module must be directed to the [Punycode.js][] project.
added: v0.5.1
-->
-* `string` {String}
+* `string` {string}
The `punycode.decode()` method converts a [Punycode][] string of ASCII-only
characters to the equivalent string of Unicode codepoints.
@@ -49,7 +49,7 @@ punycode.decode('--dqo34k'); // '☃-⌘'
added: v0.5.1
-->
-* `string` {String}
+* `string` {string}
The `punycode.encode()` method converts a string of Unicode codepoints to a
[Punycode][] string of ASCII-only characters.
@@ -64,7 +64,7 @@ punycode.encode('☃-⌘'); // '--dqo34k'
added: v0.6.1
-->
-* `domain` {String}
+* `domain` {string}
The `punycode.toASCII()` method converts a Unicode string representing an
Internationalized Domain Name to [Punycode][]. Only the non-ASCII parts of the
@@ -83,7 +83,7 @@ punycode.toASCII('example.com'); // 'example.com'
added: v0.6.1
-->
-* `domain` {String}
+* `domain` {string}
The `punycode.toUnicode()` method converts a string representing a domain name
containing [Punycode][] encoded characters into Unicode. Only the [Punycode][]
@@ -106,7 +106,7 @@ added: v0.7.0
added: v0.7.0
-->
-* `string` {String}
+* `string` {string}
The `punycode.ucs2.decode()` method returns an array containing the numeric
codepoint values of each Unicode symbol in the string.
diff --git a/doc/api/querystring.md b/doc/api/querystring.md
index 4dc6585397c063..3a10604020db90 100644
--- a/doc/api/querystring.md
+++ b/doc/api/querystring.md
@@ -16,7 +16,7 @@ const querystring = require('querystring');
added: v0.1.25
-->
-* `str` {String}
+* `str` {string}
The `querystring.escape()` method performs URL percent-encoding on the given
`str` in a manner that is optimized for the specific requirements of URL
@@ -32,10 +32,10 @@ necessary by assigning `querystring.escape` to an alternative function.
added: v0.1.25
-->
-* `str` {String} The URL query string to parse
-* `sep` {String} The substring used to delimit key and value pairs in the
+* `str` {string} The URL query string to parse
+* `sep` {string} The substring used to delimit key and value pairs in the
query string. Defaults to `'&'`.
-* `eq` {String}. The substring used to delimit keys and values in the
+* `eq` {string}. The substring used to delimit keys and values in the
query string. Defaults to `'='`.
* `options` {Object}
* `decodeURIComponent` {Function} The function to use when decoding
@@ -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]]])
@@ -79,9 +80,9 @@ added: v0.1.25
-->
* `obj` {Object} The object to serialize into a URL query string
-* `sep` {String} The substring used to delimit key and value pairs in the
+* `sep` {string} The substring used to delimit key and value pairs in the
query string. Defaults to `'&'`.
-* `eq` {String}. The substring used to delimit keys and values in the
+* `eq` {string}. The substring used to delimit keys and values in the
query string. Defaults to `'='`.
* `options`
* `encodeURIComponent` {Function} The function to use when converting
@@ -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,14 +115,14 @@ following example:
// Assuming gbkEncodeURIComponent function already exists,
querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
- { encodeURIComponent: gbkEncodeURIComponent })
+ { encodeURIComponent: gbkEncodeURIComponent });
```
## querystring.unescape(str)
-* `str` {String}
+* `str` {string}
The `querystring.unescape()` method performs decoding of URL percent-encoded
diff --git a/doc/api/readline.md b/doc/api/readline.md
index acbb94c3e95edb..fab1e9b3ed80f3 100644
--- a/doc/api/readline.md
+++ b/doc/api/readline.md
@@ -158,7 +158,7 @@ For example:
```js
rl.on('SIGINT', () => {
- rl.question('Are you sure you want to exit?', (answer) => {
+ rl.question('Are you sure you want to exit? ', (answer) => {
if (answer.match(/^y(es)?$/i)) rl.pause();
});
});
@@ -237,7 +237,7 @@ If the `readline.Interface` was created with `output` set to `null` or
added: v0.3.3
-->
-* `query` {String} A statement or query to write to `output`, prepended to the
+* `query` {string} A statement or query to write to `output`, prepended to the
prompt.
* `callback` {Function} A callback function that is invoked with the user's
input in response to the `query`.
@@ -255,7 +255,7 @@ If the `readline.Interface` was created with `output` set to `null` or
Example usage:
```js
-rl.question('What is your favorite food?', (answer) => {
+rl.question('What is your favorite food? ', (answer) => {
console.log(`Oh, so your favorite food is ${answer}`);
});
```
@@ -276,7 +276,7 @@ The `rl.resume()` method resumes the `input` stream if it has been paused.
added: v0.1.98
-->
-* `prompt` {String}
+* `prompt` {string}
The `rl.setPrompt()` method sets the prompt that will be written to `output`
whenever `rl.prompt()` is called.
@@ -286,12 +286,12 @@ whenever `rl.prompt()` is called.
added: v0.1.98
-->
-* `data` {String}
+* `data` {string}
* `key` {Object}
* `ctrl` {boolean} `true` to indicate the `` key.
* `meta` {boolean} `true` to indicate the ` ` key.
* `shift` {boolean} `true` to indicate the `` key.
- * `name` {String} The name of the a key.
+ * `name` {string} The name of the a key.
The `rl.write()` method will write either `data` or a key sequence identified
by `key` to the `output`. The `key` argument is supported only if `output` is
@@ -407,7 +407,7 @@ For instance: `[[substr1, substr2, ...], originalsubstring]`.
```js
function completer(line) {
const completions = '.help .error .exit .quit .q'.split(' ');
- const hits = completions.filter((c) => { return c.indexOf(line) === 0 });
+ const hits = completions.filter((c) => c.startsWith(line));
// show all completions if none found
return [hits.length ? hits : completions, line];
}
@@ -463,7 +463,7 @@ added: v0.7.7
* `stream` {Writable}
* `dx` {number}
-* `dy` {Number}
+* `dy` {number}
The `readline.moveCursor()` method moves the cursor *relative* to its current
position in a given [TTY][] `stream`.
@@ -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 9ff416e004f4b3..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
@@ -304,7 +310,7 @@ Clearing context...
added: v0.3.0
-->
-* `keyword` {String} The command keyword (*without* a leading `.` character).
+* `keyword` {string} The command keyword (*without* a leading `.` character).
* `cmd` {Object|Function} The function to invoke when the command is processed.
The `replServer.defineCommand()` method is used to add new `.`-prefixed commands
@@ -312,7 +318,7 @@ to the REPL instance. Such commands are invoked by typing a `.` followed by the
`keyword`. The `cmd` is either a Function or an object with the following
properties:
-* `help` {String} Help text to be displayed when `.help` is entered (Optional).
+* `help` {string} Help text to be displayed when `.help` is entered (Optional).
* `action` {Function} The function to execute, optionally accepting a single
string argument.
@@ -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) {
@@ -351,7 +357,7 @@ Goodbye!
added: v0.1.91
-->
-* `preserveCursor` {Boolean}
+* `preserveCursor` {boolean}
The `replServer.displayPrompt()` method readies the REPL instance for input
from the user, printing the configured `prompt` to a new line in the `output`
@@ -371,8 +377,8 @@ within the action function for commands registered using the
added: v0.1.91
-->
-* `options` {Object | String}
- * `prompt` {String} The input prompt to display. Defaults to `> `.
+* `options` {Object | string}
+ * `prompt` {string} The input prompt to display. Defaults to `> `.
* `input` {Readable} The Readable stream from which REPL input will be read.
Defaults to `process.stdin`.
* `output` {Writable} The Writable stream to which REPL output will be
@@ -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 35755185eb9c4e..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
@@ -134,7 +134,7 @@ const server = http.createServer( (req, res) => {
res.write(typeof data);
res.end();
} catch (er) {
- // uh oh! bad json!
+ // uh oh! bad json!
res.statusCode = 400;
return res.end(`error: ${er.message}`);
}
@@ -143,12 +143,12 @@ const server = http.createServer( (req, res) => {
server.listen(1337);
-// $ curl localhost:1337 -d '{}'
+// $ curl localhost:1337 -d "{}"
// object
-// $ curl localhost:1337 -d '"foo"'
+// $ curl localhost:1337 -d "\"foo\""
// string
-// $ curl localhost:1337 -d 'not json'
-// error: Unexpected token o
+// $ curl localhost:1337 -d "not json"
+// error: Unexpected token o in JSON at position 1
```
[Writable][] streams (such as `res` in the example) expose methods such as
@@ -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');
@@ -354,10 +354,10 @@ See also: [`writable.uncork()`][].
added: v0.9.4
-->
-* `chunk` {String|Buffer|any} Optional data to write. For streams not operating
+* `chunk` {string|Buffer|any} Optional data to write. For streams not operating
in object mode, `chunk` must be a string or a `Buffer`. For object mode
streams, `chunk` may be any JavaScript value other than `null`.
-* `encoding` {String} The encoding, if `chunk` is a String
+* `encoding` {string} The encoding, if `chunk` is a String
* `callback` {Function} Optional callback for when the stream is finished
Calling the `writable.end()` method signals that no more data will be written
@@ -382,7 +382,7 @@ file.end('world!');
added: v0.11.15
-->
-* `encoding` {String} The new default encoding
+* `encoding` {string} The new default encoding
* Returns: `this`
The `writable.setDefaultEncoding()` method sets the default `encoding` for a
@@ -431,10 +431,10 @@ See also: [`writable.cork()`][].
added: v0.9.4
-->
-* `chunk` {String|Buffer} The data to write
-* `encoding` {String} The encoding, if `chunk` is a String
+* `chunk` {string|Buffer} The data to write
+* `encoding` {string} The encoding, if `chunk` is a String
* `callback` {Function} Callback for when this chunk of data is flushed
-* Returns: {Boolean} `false` if the stream wishes for the calling code to
+* Returns: {boolean} `false` if the stream wishes for the calling code to
wait for the `'drain'` event to be emitted before continuing to write
additional data; otherwise `true`.
@@ -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.
@@ -566,9 +566,8 @@ possible states:
* `readable._readableState.flowing = true`
When `readable._readableState.flowing` is `null`, no mechanism for consuming the
-streams data is provided so the stream will not generate its data.
-
-Attaching a listener for the `'data'` event, calling the `readable.pipe()`
+streams data is provided so the stream will not generate its data. While in this
+state, attaching a listener for the `'data'` event, calling the `readable.pipe()`
method, or calling the `readable.resume()` method will switch
`readable._readableState.flowing` to `true`, causing the Readable to begin
actively emitting events as data is generated.
@@ -576,7 +575,22 @@ actively emitting events as data is generated.
Calling `readable.pause()`, `readable.unpipe()`, or receiving "back pressure"
will cause the `readable._readableState.flowing` to be set as `false`,
temporarily halting the flowing of events but *not* halting the generation of
-data.
+data. While in this state, attaching a listener for the `'data'` event
+would not cause `readable._readableState.flowing` to switch to `true`.
+
+```js
+const { PassThrough, Writable } = require('stream');
+const pass = new PassThrough();
+const writable = new Writable();
+
+pass.pipe(writable);
+pass.unpipe(writable);
+// flowing is now false
+
+pass.on('data', (chunk) => { console.log(chunk.toString()); });
+pass.write('ok'); // will not emit 'data'
+pass.resume(); // must be called to make 'data' being emitted
+```
While `readable._readableState.flowing` is `false`, data may be accumulating
within the streams internal buffer.
@@ -616,7 +630,7 @@ Not all [Readable][] streams will emit the `'close'` event.
added: v0.9.4
-->
-* `chunk` {Buffer|String|any} The chunk of data. For streams that are not
+* `chunk` {Buffer|string|any} The chunk of data. For streams that are not
operating in object mode, the chunk will be either a string or `Buffer`.
For streams that are in object mode, the chunk can be any JavaScript value
other than `null`.
@@ -675,7 +689,7 @@ added: v0.9.4
* {Error}
The `'error'` event may be emitted by a Readable implementation at any time.
-Typically, this may occur if the underlying stream in unable to generate data
+Typically, this may occur if the underlying stream is unable to generate data
due to an underlying internal failure, or when a stream implementation attempts
to push an invalid chunk of data.
@@ -725,14 +739,15 @@ end
```
*Note*: In general, the `readable.pipe()` and `'data'` event mechanisms are
-preferred over the use of the `'readable'` event.
+easier to understand than the `'readable'` event.
+However, handling `'readable'` might result in increased throughput.
##### readable.isPaused()
-* Returns: {Boolean}
+* Returns: {boolean}
The `readable.isPaused()` method returns the current operating state of the
Readable. This is used primarily by the mechanism that underlies the
@@ -740,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()
@@ -780,7 +795,7 @@ added: v0.9.4
* `destination` {stream.Writable} The destination for writing data
* `options` {Object} Pipe options
- * `end` {Boolean} End the writer when the reader ends. Defaults to `true`.
+ * `end` {boolean} End the writer when the reader ends. Defaults to `true`.
The `readable.pipe()` method attaches a [Writable][] stream to the `readable`,
causing it to switch automatically into flowing mode and push all of its data
@@ -836,8 +851,8 @@ options.
added: v0.9.4
-->
-* `size` {Number} Optional argument to specify how much data to read.
-* Return {String|Buffer|Null}
+* `size` {number} Optional argument to specify how much data to read.
+* Return {string|Buffer|null}
The `readable.read()` method pulls some data out of the internal buffer and
returns it. If no data available to be read, `null` is returned. By default,
@@ -860,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.`);
}
@@ -908,16 +923,17 @@ getReadableStreamSomehow()
added: v0.9.4
-->
-* `encoding` {String} The encoding to use.
+* `encoding` {string} The encoding to use.
* Returns: `this`
-The `readable.setEncoding()` method sets the default character encoding for
+The `readable.setEncoding()` method sets the character encoding for
data read from the Readable stream.
-Setting an encoding causes the stream data
-to be returned as string of the specified encoding rather than as `Buffer`
+By default, no encoding is assigned and stream data will be returned as
+`Buffer` objects. Setting an encoding causes the stream data
+to be returned as strings of the specified encoding rather than as `Buffer`
objects. For instance, calling `readable.setEncoding('utf8')` will cause the
-output data will be interpreted as UTF-8 data, and passed as strings. Calling
+output data to be interpreted as UTF-8 data, and passed as strings. Calling
`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal
string format.
@@ -925,10 +941,6 @@ The Readable stream will properly handle multi-byte characters delivered through
the stream that would otherwise become improperly decoded if simply pulled from
the stream as `Buffer` objects.
-Encoding can be disabled by calling `readable.setEncoding(null)`. This approach
-is useful when working with binary data or with large multi-byte strings spread
-out over multiple chunks.
-
```js
const readable = getReadableStreamSomehow();
readable.setEncoding('utf8');
@@ -972,7 +984,7 @@ setTimeout(() => {
added: v0.9.11
-->
-* `chunk` {Buffer|String} Chunk of data to unshift onto the read queue
+* `chunk` {Buffer|string} Chunk of data to unshift onto the read queue
The `readable.unshift()` method pushes a chunk of data back into the internal
buffer. This is useful in certain situations where a stream is being consumed by
@@ -995,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');
@@ -1056,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', () => {
@@ -1117,6 +1129,7 @@ const Writable = require('stream').Writable;
class MyWritable extends Writable {
constructor(options) {
super(options);
+ // ...
}
}
```
@@ -1219,13 +1232,13 @@ constructor and implement the `writable._write()` method. The
#### Constructor: new stream.Writable([options])
* `options` {Object}
- * `highWaterMark` {Number} Buffer level when
+ * `highWaterMark` {number} Buffer level when
[`stream.write()`][stream-write] starts returning `false`. Defaults to
`16384` (16kb), or `16` for `objectMode` streams.
- * `decodeStrings` {Boolean} Whether or not to decode strings into
+ * `decodeStrings` {boolean} Whether or not to decode strings into
Buffers before passing them to [`stream._write()`][stream-_write].
Defaults to `true`
- * `objectMode` {Boolean} Whether or not the
+ * `objectMode` {boolean} Whether or not the
[`stream.write(anyObj)`][stream-write] is a valid operation. When set,
it becomes possible to write JavaScript values other than string or
`Buffer` if supported by the stream implementation. Defaults to `false`
@@ -1243,6 +1256,7 @@ class MyWritable extends Writable {
constructor(options) {
// Calls the stream.Writable() constructor
super(options);
+ // ...
}
}
```
@@ -1278,9 +1292,9 @@ const myWritable = new Writable({
#### writable.\_write(chunk, encoding, callback)
-* `chunk` {Buffer|String} The chunk to be written. Will **always**
+* `chunk` {Buffer|string} The chunk to be written. Will **always**
be a buffer unless the `decodeStrings` option was set to `false`.
-* `encoding` {String} If the chunk is a string, then `encoding` is the
+* `encoding` {string} If the chunk is a string, then `encoding` is the
character encoding of that string. If chunk is a `Buffer`, or if the
stream is operating in object mode, `encoding` may be ignored.
* `callback` {Function} Call this function (optionally with an error
@@ -1378,6 +1392,7 @@ const Writable = require('stream').Writable;
class MyWritable extends Writable {
constructor(options) {
super(options);
+ // ...
}
_write(chunk, encoding, callback) {
@@ -1400,12 +1415,12 @@ constructor and implement the `readable._read()` method.
#### new stream.Readable([options])
* `options` {Object}
- * `highWaterMark` {Number} The maximum number of bytes to store in
+ * `highWaterMark` {number} The maximum number of bytes to store in
the internal buffer before ceasing to read from the underlying
resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams
- * `encoding` {String} If specified, then buffers will be decoded to
+ * `encoding` {string} If specified, then buffers will be decoded to
strings using the specified encoding. Defaults to `null`
- * `objectMode` {Boolean} Whether this stream should behave
+ * `objectMode` {boolean} Whether this stream should behave
as a stream of objects. Meaning that [`stream.read(n)`][stream-read] returns
a single value instead of a Buffer of size n. Defaults to `false`
* `read` {Function} Implementation for the [`stream._read()`][stream-_read]
@@ -1420,6 +1435,7 @@ class MyReadable extends Readable {
constructor(options) {
// Calls the stream.Readable(options) constructor
super(options);
+ // ...
}
}
```
@@ -1452,7 +1468,7 @@ const myReadable = new Readable({
#### readable.\_read(size)
-* `size` {Number} Number of bytes to read asynchronously
+* `size` {number} Number of bytes to read asynchronously
*Note*: **This function MUST NOT be called by application code directly.** It
should be implemented by child classes, and called only by the internal Readable
@@ -1483,10 +1499,10 @@ user programs.
#### readable.push(chunk[, encoding])
-* `chunk` {Buffer|Null|String} Chunk of data to push into the read queue
-* `encoding` {String} Encoding of String chunks. Must be a valid
+* `chunk` {Buffer|null|string} Chunk of data to push into the read queue
+* `encoding` {string} Encoding of String chunks. Must be a valid
Buffer encoding, such as `'utf8'` or `'ascii'`
-* Returns {Boolean} `true` if additional chunks of data may continued to be
+* Returns {boolean} `true` if additional chunks of data may continued to be
pushed; `false` otherwise.
When `chunk` is a `Buffer` or `string`, the `chunk` of data will be added to the
@@ -1581,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);
}
}
@@ -1615,13 +1631,13 @@ constructor and implement *both* the `readable._read()` and
* `options` {Object} Passed to both Writable and Readable
constructors. Also has the following fields:
- * `allowHalfOpen` {Boolean} Defaults to `true`. If set to `false`, then
+ * `allowHalfOpen` {boolean} Defaults to `true`. If set to `false`, then
the stream will automatically end the readable side when the
writable side ends and vice versa.
- * `readableObjectMode` {Boolean} Defaults to `false`. Sets `objectMode`
+ * `readableObjectMode` {boolean} Defaults to `false`. Sets `objectMode`
for readable side of the stream. Has no effect if `objectMode`
is `true`.
- * `writableObjectMode` {Boolean} Defaults to `false`. Sets `objectMode`
+ * `writableObjectMode` {boolean} Defaults to `false`. Sets `objectMode`
for writable side of the stream. Has no effect if `objectMode`
is `true`.
@@ -1633,6 +1649,7 @@ const Duplex = require('stream').Duplex;
class MyDuplex extends Duplex {
constructor(options) {
super(options);
+ // ...
}
}
```
@@ -1788,6 +1805,7 @@ const Transform = require('stream').Transform;
class MyTransform extends Transform {
constructor(options) {
super(options);
+ // ...
}
}
```
@@ -1857,9 +1875,9 @@ user programs.
#### transform.\_transform(chunk, encoding, callback)
-* `chunk` {Buffer|String} The chunk to be transformed. Will **always**
+* `chunk` {Buffer|string} The chunk to be transformed. Will **always**
be a buffer unless the `decodeStrings` option was set to `false`.
-* `encoding` {String} If the chunk is a string, then this is the
+* `encoding` {string} If the chunk is a string, then this is the
encoding type. If chunk is a buffer, then this is the special
value - 'buffer', ignore it in this case.
* `callback` {Function} A callback function (optionally with an error
@@ -1888,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/tls.md b/doc/api/tls.md
index 158d41a0a283de..b7e5c8f15e2bf4 100644
--- a/doc/api/tls.md
+++ b/doc/api/tls.md
@@ -954,7 +954,7 @@ added: v0.11.13
`"SSLv23_method"`. The possible values are listed as [SSL_METHODS][], use
the function names as strings. For example, `"SSLv3_method"` to force SSL
version 3.
- * `secureOptions` {number} Optionally affect the OpenSSL protocol behaviour,
+ * `secureOptions` {number} Optionally affect the OpenSSL protocol behavior,
which is not usually necessary. This should be used carefully if at all!
Value is a numeric bitmask of the `SSL_OP_*` options from
[OpenSSL Options][].
@@ -982,8 +982,8 @@ added: v0.3.2
* `options` {Object}
* `handshakeTimeout` {number} Abort the connection if the SSL/TLS handshake
does not finish in the specified number of milliseconds. Defaults to `120`
- seconds. A `'clientError'` is emitted on the `tls.Server` object whenever a
- handshake times out.
+ seconds. A `'tlsClientError'` is emitted on the `tls.Server` object whenever
+ a handshake times out.
* `requestCert` {boolean} If `true` the server will request a certificate from
clients that connect and attempt to verify that certificate. Defaults to
`false`.
@@ -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/url.md b/doc/api/url.md
index 40a3440195e69a..1cb3e2f89f0fd8 100644
--- a/doc/api/url.md
+++ b/doc/api/url.md
@@ -136,7 +136,7 @@ For example: `'#hash'`
added: v0.1.25
-->
-* `urlObject` {Object | String} A URL object (as returned by `url.parse()` or
+* `urlObject` {Object | string} A URL object (as returned by `url.parse()` or
constructed otherwise). If a string, it is converted to an object by passing
it to `url.parse()`.
@@ -204,12 +204,12 @@ The formatting process operates as follows:
added: v0.1.25
-->
-* `urlString` {String} The URL string to parse.
-* `parseQueryString` {Boolean} If `true`, the `query` property will always
+* `urlString` {string} The URL string to parse.
+* `parseQueryString` {boolean} If `true`, the `query` property will always
be set to an object returned by the [`querystring`][] module's `parse()`
method. If `false`, the `query` property on the returned URL object will be an
unparsed, undecoded string. Defaults to `false`.
-* `slashesDenoteHost` {Boolean} If `true`, the first token after the literal
+* `slashesDenoteHost` {boolean} If `true`, the first token after the literal
string `//` and preceding the next `/` will be interpreted as the `host`.
For instance, given `//foo/bar`, the result would be
`{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`.
@@ -223,8 +223,8 @@ object.
added: v0.1.25
-->
-* `from` {String} The Base URL being resolved against.
-* `to` {String} The HREF URL being resolved.
+* `from` {string} The Base URL being resolved against.
+* `to` {string} The HREF URL being resolved.
The `url.resolve()` method resolves a target URL relative to a base URL in a
manner similar to that of a Web browser resolving an anchor tag HREF.
@@ -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
@@ -250,7 +250,6 @@ properties of URL objects:
For example, the ASCII space character (`' '`) is encoded as `%20`. The ASCII
forward slash (`/`) character is encoded as `%3C`.
-
[`Error`]: errors.html#errors_class_error
[`querystring`]: querystring.html
[`TypeError`]: errors.html#errors_class_typeerror
diff --git a/doc/api/util.md b/doc/api/util.md
index 28ceac1c54d7a9..ec5ec635d16fdf 100644
--- a/doc/api/util.md
+++ b/doc/api/util.md
@@ -15,7 +15,7 @@ const util = require('util');
added: v0.11.3
-->
-* `section` {String} A string identifying the portion of the application for
+* `section` {string} A string identifying the portion of the application for
which the `debuglog` function is being created.
* Returns: {Function} The logging function
@@ -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');
@@ -93,7 +93,7 @@ property take precedence over `--trace-deprecation` and
added: v0.5.3
-->
-* `format` {String} A `printf`-like format string.
+* `format` {string} A `printf`-like format string.
The `util.format()` method returns a formatted string using the first argument
as a `printf`-like format.
@@ -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 + ' >';
}
}
@@ -391,7 +392,7 @@ deprecated: v0.11.3
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
-* `string` {String} The message to print to `stderr`
+* `string` {string} The message to print to `stderr`
Deprecated predecessor of `console.error`.
@@ -403,7 +404,7 @@ deprecated: v0.11.3
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
-* `...strings` {String} The message to print to `stderr`
+* `...strings` {string} The message to print to `stderr`
Deprecated predecessor of `console.error`.
@@ -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
@@ -557,7 +558,7 @@ Returns `true` if the given `object` is a `Function`. Otherwise, returns
const util = require('util');
function Foo() {}
-const Bar = function() {};
+const Bar = () => {};
util.isFunction({});
// Returns: false
@@ -662,7 +663,7 @@ util.isObject(null);
// Returns: false
util.isObject({});
// Returns: true
-util.isObject(function(){});
+util.isObject(function() {});
// Returns: false
```
@@ -805,7 +806,7 @@ deprecated: v6.0.0
> Stability: 0 - Deprecated: Use a third party module instead.
-* `string` {String}
+* `string` {string}
The `util.log()` method prints the given `string` to `stdout` with an included
timestamp.
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 3a98f59677866a..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);
}
@@ -116,6 +116,10 @@ console.log(util.inspect(sandbox));
// { animal: 'cat', count: 12, name: 'kitty' }
```
+*Note*: Using the `timeout` or `breakOnSigint` options will result in new
+event loops and corresponding threads being started, which have a non-zero
+performance overhead.
+
### script.runInNewContext([sandbox][, options])
```js
const vm = require('vm');
-var localVar = 'initial value';
+let localVar = 'initial value';
const vmResult = vm.runInThisContext('localVar = "vm";');
console.log('vmResult:', vmResult);
@@ -426,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');
@@ -439,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 a2e1c7e730f0ee..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
@@ -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.
@@ -92,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 = '';
}
@@ -123,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.
@@ -147,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
@@ -157,7 +162,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.
@@ -165,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
@@ -408,6 +413,10 @@ added: v0.5.8
Returns a new [DeflateRaw][] object with an [options][].
+*Note*: The zlib library rejects requests for 256-byte windows (i.e.,
+`{ windowBits: 8 }` in `options`). An `Error` will be thrown when creating a
+[DeflateRaw][] object with this specific value of the `windowBits` option.
+
## zlib.createGunzip([options])
+```js
+const common = require('../common');
+
+someAsyncAPI('foo', common.mustCall(common.noop));
+```
+
+### opensslCli
+* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
+
+Checks whether 'opensslCli' is supported.
+
+### platformTimeout(ms)
+* `ms` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)
+* return [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)
+
+Platform normalizes timeout.
+
+### PIPE
+* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
+
+Path to the test sock.
+
+### PORT
+* return [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = `12346`
+
+Port tests are running on.
+
+### refreshTmpDir
+* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
+
+Deletes the 'tmp' dir and recreates it
+
+### rootDir
+* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
+
+Path to the 'root' directory. either `/` or `c:\\` (windows)
+
+### skip(msg)
+* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
+
+Logs '1..0 # Skipped: ' + `msg`
+
+### spawnPwd(options)
+* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
+* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
+
+Platform normalizes the `pwd` command.
+
+### spawnSyncPwd(options)
+* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
+* return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
+
+Synchronous version of `spawnPwd`.
+
+### tmpDir
+* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
+
+The realpath of the 'tmp' directory.
+
+### tmpDirName
+* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
+
+Name of the temp directory used by tests.
+
+## WPT Module
+
+The wpt.js module is a port of parts of
+[W3C testharness.js](https://github.com/w3c/testharness.js) for testing the
+Node.js
+[WHATWG URL API](https://nodejs.org/api/url.html#url_the_whatwg_url_api)
+implementation with tests from
+[W3C Web Platform Tests](https://github.com/w3c/web-platform-tests).
diff --git a/test/common/index.js b/test/common/index.js
new file mode 100644
index 00000000000000..455d50fe6c344a
--- /dev/null
+++ b/test/common/index.js
@@ -0,0 +1,563 @@
+/* eslint-disable required-modules */
+'use strict';
+const path = require('path');
+const fs = require('fs');
+const assert = require('assert');
+const os = require('os');
+const child_process = require('child_process');
+const stream = require('stream');
+const util = require('util');
+const Timer = process.binding('timer_wrap').Timer;
+
+const testRoot = process.env.NODE_TEST_DIR ?
+ fs.realpathSync(process.env.NODE_TEST_DIR) : path.resolve(__dirname, '..');
+
+exports.fixturesDir = path.join(__dirname, '..', 'fixtures');
+exports.tmpDirName = 'tmp';
+// PORT should match the definition in test/testpy/__init__.py.
+exports.PORT = +process.env.NODE_COMMON_PORT || 12346;
+exports.isWindows = process.platform === 'win32';
+exports.isWOW64 = exports.isWindows &&
+ (process.env.PROCESSOR_ARCHITEW6432 !== undefined);
+exports.isAix = process.platform === 'aix';
+exports.isLinuxPPCBE = (process.platform === 'linux') &&
+ (process.arch === 'ppc64') &&
+ (os.endianness() === 'BE');
+exports.isSunOS = process.platform === 'sunos';
+exports.isFreeBSD = process.platform === 'freebsd';
+exports.isLinux = process.platform === 'linux';
+exports.isOSX = process.platform === 'darwin';
+
+exports.enoughTestMem = os.totalmem() > 0x40000000; /* 1 Gb */
+
+const cpus = os.cpus();
+exports.enoughTestCpu = Array.isArray(cpus) &&
+ (cpus.length > 1 || cpus[0].speed > 999);
+
+exports.rootDir = exports.isWindows ? 'c:\\' : '/';
+exports.buildType = process.config.target_defaults.default_configuration;
+
+function rimrafSync(p) {
+ let st;
+ try {
+ st = fs.lstatSync(p);
+ } catch (e) {
+ if (e.code === 'ENOENT')
+ return;
+ }
+
+ try {
+ if (st && st.isDirectory())
+ rmdirSync(p, null);
+ else
+ fs.unlinkSync(p);
+ } catch (e) {
+ if (e.code === 'ENOENT')
+ return;
+ if (e.code === 'EPERM')
+ return rmdirSync(p, e);
+ if (e.code !== 'EISDIR')
+ throw e;
+ rmdirSync(p, e);
+ }
+}
+
+function rmdirSync(p, originalEr) {
+ try {
+ fs.rmdirSync(p);
+ } catch (e) {
+ if (e.code === 'ENOTDIR')
+ throw originalEr;
+ if (e.code === 'ENOTEMPTY' || e.code === 'EEXIST' || e.code === 'EPERM') {
+ const enc = exports.isLinux ? 'buffer' : 'utf8';
+ fs.readdirSync(p, enc).forEach((f) => {
+ if (f instanceof Buffer) {
+ const buf = Buffer.concat([Buffer.from(p), Buffer.from(path.sep), f]);
+ rimrafSync(buf);
+ } else {
+ rimrafSync(path.join(p, f));
+ }
+ });
+ fs.rmdirSync(p);
+ }
+ }
+}
+
+exports.refreshTmpDir = function() {
+ rimrafSync(exports.tmpDir);
+ fs.mkdirSync(exports.tmpDir);
+};
+
+if (process.env.TEST_THREAD_ID) {
+ exports.PORT += process.env.TEST_THREAD_ID * 100;
+ exports.tmpDirName += `.${process.env.TEST_THREAD_ID}`;
+}
+exports.tmpDir = path.join(testRoot, exports.tmpDirName);
+
+let opensslCli = null;
+let inFreeBSDJail = null;
+let localhostIPv4 = null;
+
+exports.localIPv6Hosts = ['localhost'];
+if (exports.isLinux) {
+ exports.localIPv6Hosts = [
+ // Debian/Ubuntu
+ 'ip6-localhost',
+ 'ip6-loopback',
+
+ // SUSE
+ 'ipv6-localhost',
+ 'ipv6-loopback',
+
+ // Typically universal
+ 'localhost',
+ ];
+}
+
+Object.defineProperty(exports, 'inFreeBSDJail', {
+ get: function() {
+ if (inFreeBSDJail !== null) return inFreeBSDJail;
+
+ if (exports.isFreeBSD &&
+ child_process.execSync('sysctl -n security.jail.jailed').toString() ===
+ '1\n') {
+ inFreeBSDJail = true;
+ } else {
+ inFreeBSDJail = false;
+ }
+ return inFreeBSDJail;
+ }
+});
+
+Object.defineProperty(exports, 'localhostIPv4', {
+ get: function() {
+ if (localhostIPv4 !== null) return localhostIPv4;
+
+ if (exports.inFreeBSDJail) {
+ // Jailed network interfaces are a bit special - since we need to jump
+ // through loops, as well as this being an exception case, assume the
+ // user will provide this instead.
+ if (process.env.LOCALHOST) {
+ localhostIPv4 = process.env.LOCALHOST;
+ } else {
+ console.error('Looks like we\'re in a FreeBSD Jail. ' +
+ 'Please provide your default interface address ' +
+ 'as LOCALHOST or expect some tests to fail.');
+ }
+ }
+
+ if (localhostIPv4 === null) localhostIPv4 = '127.0.0.1';
+
+ return localhostIPv4;
+ }
+});
+
+// opensslCli defined lazily to reduce overhead of spawnSync
+Object.defineProperty(exports, 'opensslCli', {get: function() {
+ if (opensslCli !== null) return opensslCli;
+
+ if (process.config.variables.node_shared_openssl) {
+ // use external command
+ opensslCli = 'openssl';
+ } else {
+ // use command built from sources included in Node.js repository
+ opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli');
+ }
+
+ if (exports.isWindows) opensslCli += '.exe';
+
+ const opensslCmd = child_process.spawnSync(opensslCli, ['version']);
+ if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) {
+ // openssl command cannot be executed
+ opensslCli = false;
+ }
+ return opensslCli;
+}, enumerable: true});
+
+Object.defineProperty(exports, 'hasCrypto', {
+ get: function() {
+ return process.versions.openssl ? true : false;
+ }
+});
+
+Object.defineProperty(exports, 'hasFipsCrypto', {
+ get: function() {
+ return exports.hasCrypto && require('crypto').fips;
+ }
+});
+
+if (exports.isWindows) {
+ exports.PIPE = '\\\\.\\pipe\\libuv-test';
+ if (process.env.TEST_THREAD_ID) {
+ exports.PIPE += `.${process.env.TEST_THREAD_ID}`;
+ }
+} else {
+ exports.PIPE = `${exports.tmpDir}/test.sock`;
+}
+
+const ifaces = os.networkInterfaces();
+const re = /lo/;
+exports.hasIPv6 = Object.keys(ifaces).some(function(name) {
+ return re.test(name) && ifaces[name].some(function(info) {
+ return info.family === 'IPv6';
+ });
+});
+
+/*
+ * Check that when running a test with
+ * `$node --abort-on-uncaught-exception $file child`
+ * the process aborts.
+ */
+exports.childShouldThrowAndAbort = function() {
+ let testCmd = '';
+ if (!exports.isWindows) {
+ // Do not create core files, as it can take a lot of disk space on
+ // continuous testing and developers' machines
+ testCmd += 'ulimit -c 0 && ';
+ }
+ testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception `;
+ testCmd += `"${process.argv[1]}" child`;
+ const child = child_process.exec(testCmd);
+ child.on('exit', function onExit(exitCode, signal) {
+ const errMsg = 'Test should have aborted ' +
+ `but instead exited with exit code ${exitCode}` +
+ ` and signal ${signal}`;
+ assert(exports.nodeProcessAborted(exitCode, signal), errMsg);
+ });
+};
+
+exports.ddCommand = function(filename, kilobytes) {
+ if (exports.isWindows) {
+ const p = path.resolve(exports.fixturesDir, 'create-file.js');
+ return `"${process.argv[0]}" "${p}" "${filename}" ${kilobytes * 1024}`;
+ } else {
+ return `dd if=/dev/zero of="${filename}" bs=1024 count=${kilobytes}`;
+ }
+};
+
+
+exports.spawnCat = function(options) {
+ const spawn = require('child_process').spawn;
+
+ if (exports.isWindows) {
+ return spawn('more', [], options);
+ } else {
+ return spawn('cat', [], options);
+ }
+};
+
+
+exports.spawnSyncCat = function(options) {
+ const spawnSync = require('child_process').spawnSync;
+
+ if (exports.isWindows) {
+ return spawnSync('more', [], options);
+ } else {
+ return spawnSync('cat', [], options);
+ }
+};
+
+
+exports.spawnPwd = function(options) {
+ const spawn = require('child_process').spawn;
+
+ if (exports.isWindows) {
+ return spawn('cmd.exe', ['/c', 'cd'], options);
+ } else {
+ return spawn('pwd', [], options);
+ }
+};
+
+
+exports.spawnSyncPwd = function(options) {
+ const spawnSync = require('child_process').spawnSync;
+
+ if (exports.isWindows) {
+ return spawnSync('cmd.exe', ['/c', 'cd'], options);
+ } else {
+ return spawnSync('pwd', [], options);
+ }
+};
+
+exports.platformTimeout = function(ms) {
+ if (process.config.target_defaults.default_configuration === 'Debug')
+ ms = 2 * ms;
+
+ if (exports.isAix)
+ return 2 * ms; // default localhost speed is slower on AIX
+
+ if (process.arch !== 'arm')
+ return ms;
+
+ const armv = process.config.variables.arm_version;
+
+ if (armv === '6')
+ return 7 * ms; // ARMv6
+
+ if (armv === '7')
+ return 2 * ms; // ARMv7
+
+ return ms; // ARMv8+
+};
+
+let knownGlobals = [
+ Buffer,
+ clearImmediate,
+ clearInterval,
+ clearTimeout,
+ console,
+ constructor, // Enumerable in V8 3.21.
+ global,
+ process,
+ setImmediate,
+ setInterval,
+ setTimeout
+];
+
+if (global.gc) {
+ knownGlobals.push(global.gc);
+}
+
+if (global.DTRACE_HTTP_SERVER_RESPONSE) {
+ knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE);
+ knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST);
+ knownGlobals.push(DTRACE_HTTP_CLIENT_RESPONSE);
+ knownGlobals.push(DTRACE_HTTP_CLIENT_REQUEST);
+ knownGlobals.push(DTRACE_NET_STREAM_END);
+ knownGlobals.push(DTRACE_NET_SERVER_CONNECTION);
+}
+
+if (global.COUNTER_NET_SERVER_CONNECTION) {
+ knownGlobals.push(COUNTER_NET_SERVER_CONNECTION);
+ knownGlobals.push(COUNTER_NET_SERVER_CONNECTION_CLOSE);
+ knownGlobals.push(COUNTER_HTTP_SERVER_REQUEST);
+ knownGlobals.push(COUNTER_HTTP_SERVER_RESPONSE);
+ knownGlobals.push(COUNTER_HTTP_CLIENT_REQUEST);
+ knownGlobals.push(COUNTER_HTTP_CLIENT_RESPONSE);
+}
+
+if (global.LTTNG_HTTP_SERVER_RESPONSE) {
+ knownGlobals.push(LTTNG_HTTP_SERVER_RESPONSE);
+ knownGlobals.push(LTTNG_HTTP_SERVER_REQUEST);
+ knownGlobals.push(LTTNG_HTTP_CLIENT_RESPONSE);
+ knownGlobals.push(LTTNG_HTTP_CLIENT_REQUEST);
+ knownGlobals.push(LTTNG_NET_STREAM_END);
+ knownGlobals.push(LTTNG_NET_SERVER_CONNECTION);
+}
+
+if (global.ArrayBuffer) {
+ knownGlobals.push(ArrayBuffer);
+ knownGlobals.push(Int8Array);
+ knownGlobals.push(Uint8Array);
+ knownGlobals.push(Uint8ClampedArray);
+ knownGlobals.push(Int16Array);
+ knownGlobals.push(Uint16Array);
+ knownGlobals.push(Int32Array);
+ knownGlobals.push(Uint32Array);
+ knownGlobals.push(Float32Array);
+ knownGlobals.push(Float64Array);
+ knownGlobals.push(DataView);
+}
+
+// Harmony features.
+if (global.Proxy) {
+ knownGlobals.push(Proxy);
+}
+
+if (global.Symbol) {
+ knownGlobals.push(Symbol);
+}
+
+function allowGlobals(...whitelist) {
+ knownGlobals = knownGlobals.concat(whitelist);
+}
+exports.allowGlobals = allowGlobals;
+
+function leakedGlobals() {
+ const leaked = [];
+
+ for (const val in global)
+ if (!knownGlobals.includes(global[val]))
+ leaked.push(val);
+
+ return leaked;
+}
+exports.leakedGlobals = leakedGlobals;
+
+// Turn this off if the test should not check for global leaks.
+exports.globalCheck = true;
+
+process.on('exit', function() {
+ if (!exports.globalCheck) return;
+ const leaked = leakedGlobals();
+ if (leaked.length > 0) {
+ fail(`Unexpected global(s) found: ${leaked.join(', ')}`);
+ }
+});
+
+
+const mustCallChecks = [];
+
+
+function runCallChecks(exitCode) {
+ if (exitCode !== 0) return;
+
+ const failed = mustCallChecks.filter(function(context) {
+ return context.actual !== context.expected;
+ });
+
+ failed.forEach(function(context) {
+ console.log('Mismatched %s function calls. Expected %d, actual %d.',
+ context.name,
+ context.expected,
+ context.actual);
+ console.log(context.stack.split('\n').slice(2).join('\n'));
+ });
+
+ if (failed.length) process.exit(1);
+}
+
+
+exports.mustCall = function(fn, expected) {
+ if (expected === undefined)
+ expected = 1;
+ else if (typeof expected !== 'number')
+ throw new TypeError(`Invalid expected value: ${expected}`);
+
+ const context = {
+ expected: expected,
+ actual: 0,
+ stack: (new Error()).stack,
+ name: fn.name || ''
+ };
+
+ // add the exit listener only once to avoid listener leak warnings
+ if (mustCallChecks.length === 0) process.on('exit', runCallChecks);
+
+ mustCallChecks.push(context);
+
+ return function() {
+ context.actual++;
+ return fn.apply(this, arguments);
+ };
+};
+
+exports.hasMultiLocalhost = function hasMultiLocalhost() {
+ const TCP = process.binding('tcp_wrap').TCP;
+ const t = new TCP();
+ const ret = t.bind('127.0.0.2', exports.PORT);
+ t.close();
+ return ret === 0;
+};
+
+exports.fileExists = function(pathname) {
+ try {
+ fs.accessSync(pathname);
+ return true;
+ } catch (err) {
+ return false;
+ }
+};
+
+function fail(msg) {
+ assert.fail(null, null, msg);
+}
+exports.fail = fail;
+
+exports.mustNotCall = function(msg) {
+ return function mustNotCall() {
+ fail(msg || 'function should not have been called');
+ };
+};
+
+exports.skip = function(msg) {
+ console.log(`1..0 # Skipped: ${msg}`);
+};
+
+// A stream to push an array into a REPL
+function ArrayStream() {
+ this.run = function(data) {
+ data.forEach((line) => {
+ this.emit('data', `${line}\n`);
+ });
+ };
+}
+
+util.inherits(ArrayStream, stream.Stream);
+exports.ArrayStream = ArrayStream;
+ArrayStream.prototype.readable = true;
+ArrayStream.prototype.writable = true;
+ArrayStream.prototype.pause = function() {};
+ArrayStream.prototype.resume = function() {};
+ArrayStream.prototype.write = function() {};
+
+// Returns true if the exit code "exitCode" and/or signal name "signal"
+// represent the exit code and/or signal name of a node process that aborted,
+// false otherwise.
+exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) {
+ // Depending on the compiler used, node will exit with either
+ // exit code 132 (SIGILL), 133 (SIGTRAP) or 134 (SIGABRT).
+ let expectedExitCodes = [132, 133, 134];
+
+ // On platforms using KSH as the default shell (like SmartOS),
+ // when a process aborts, KSH exits with an exit code that is
+ // greater than 256, and thus the exit code emitted with the 'exit'
+ // event is null and the signal is set to either SIGILL, SIGTRAP,
+ // or SIGABRT (depending on the compiler).
+ const expectedSignals = ['SIGILL', 'SIGTRAP', 'SIGABRT'];
+
+ // On Windows, 'aborts' are of 2 types, depending on the context:
+ // (i) Forced access violation, if --abort-on-uncaught-exception is on
+ // which corresponds to exit code 3221225477 (0xC0000005)
+ // (ii) raise(SIGABRT) or abort(), which lands up in CRT library calls
+ // which corresponds to exit code 3.
+ if (exports.isWindows)
+ expectedExitCodes = [3221225477, 3];
+
+ // When using --abort-on-uncaught-exception, V8 will use
+ // base::OS::Abort to terminate the process.
+ // Depending on the compiler used, the shell or other aspects of
+ // the platform used to build the node binary, this will actually
+ // make V8 exit by aborting or by raising a signal. In any case,
+ // one of them (exit code or signal) needs to be set to one of
+ // the expected exit codes or signals.
+ if (signal !== null) {
+ return expectedSignals.includes(signal);
+ } else {
+ return expectedExitCodes.includes(exitCode);
+ }
+};
+
+exports.busyLoop = function busyLoop(time) {
+ const startTime = Timer.now();
+ const stopTime = startTime + time;
+ while (Timer.now() < stopTime) {}
+};
+
+exports.isAlive = function isAlive(pid) {
+ try {
+ process.kill(pid, 'SIGCONT');
+ return true;
+ } catch (e) {
+ return false;
+ }
+};
+
+exports.expectWarning = function(name, expected) {
+ if (typeof expected === 'string')
+ expected = [expected];
+ process.on('warning', exports.mustCall((warning) => {
+ assert.strictEqual(warning.name, name);
+ assert.ok(expected.includes(warning.message),
+ `unexpected error message: "${warning.message}"`);
+ // Remove a warning message after it is seen so that we guarantee that we
+ // get each message only once.
+ expected.splice(expected.indexOf(warning.message), 1);
+ }, expected.length));
+};
+
+// Crash the process on unhandled rejections.
+exports.crashOnUnhandledRejection = function() {
+ process.on('unhandledRejection',
+ (err) => process.nextTick(() => { throw err; }));
+};
diff --git a/test/common/wpt.js b/test/common/wpt.js
new file mode 100644
index 00000000000000..c56acce24d5ca4
--- /dev/null
+++ b/test/common/wpt.js
@@ -0,0 +1,30 @@
+/* eslint-disable required-modules */
+'use strict';
+
+const assert = require('assert');
+
+// https://github.com/w3c/testharness.js/blob/master/testharness.js
+module.exports = {
+ test: (fn, desc) => {
+ try {
+ fn();
+ } catch (err) {
+ console.error(`In ${desc}:`);
+ throw err;
+ }
+ },
+ assert_equals: assert.strictEqual,
+ assert_true: (value, message) => assert.strictEqual(value, true, message),
+ assert_false: (value, message) => assert.strictEqual(value, false, message),
+ assert_throws: (code, func, desc) => {
+ assert.throws(func, function(err) {
+ return typeof err === 'object' &&
+ 'name' in err &&
+ err.name.startsWith(code.name);
+ }, desc);
+ },
+ assert_array_equals: assert.deepStrictEqual,
+ assert_unreached(desc) {
+ assert.fail(null, null, `Reached unreachable code: ${desc}`);
+ }
+};
diff --git a/test/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js
index 38c65a03fa590d..ca2dd37e835ee5 100644
--- a/test/debugger/helper-debugger-repl.js
+++ b/test/debugger/helper-debugger-repl.js
@@ -13,11 +13,11 @@ let quit;
function startDebugger(scriptToDebug) {
scriptToDebug = process.env.NODE_DEBUGGER_TEST_SCRIPT ||
- common.fixturesDir + '/' + scriptToDebug;
+ `${common.fixturesDir}/${scriptToDebug}`;
- child = spawn(process.execPath, ['debug', '--port=' + port, scriptToDebug]);
+ child = spawn(process.execPath, ['debug', `--port=${port}`, scriptToDebug]);
- console.error('./node', 'debug', '--port=' + port, scriptToDebug);
+ console.error('./node', 'debug', `--port=${port}`, scriptToDebug);
child.stdout.setEncoding('utf-8');
child.stdout.on('data', function(data) {
@@ -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);
+ 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;
@@ -62,7 +62,7 @@ function startDebugger(scriptToDebug) {
console.error('dying badly buffer=%j', buffer);
let err = 'Timeout';
if (expected.length > 0 && expected[0].lines) {
- err = err + '. Expected: ' + expected[0].lines.shift();
+ err = `${err}. Expected: ${expected[0].lines.shift()}`;
}
child.on('close', function() {
@@ -91,8 +91,8 @@ function startDebugger(scriptToDebug) {
function addTest(input, output) {
function next() {
if (expected.length > 0) {
- console.log('debug> ' + expected[0].input);
- child.stdin.write(expected[0].input + '\n');
+ console.log(`debug> ${expected[0].input}`);
+ child.stdin.write(`${expected[0].input}\n`);
if (!expected[0].lines) {
const callback = expected[0].callback;
diff --git a/test/debugger/test-debugger-repl-utf8.js b/test/debugger/test-debugger-repl-utf8.js
index 90214158884371..83ef20db7817a4 100644
--- a/test/debugger/test-debugger-repl-utf8.js
+++ b/test/debugger/test-debugger-repl-utf8.js
@@ -1,6 +1,6 @@
'use strict';
const common = require('../common');
-const script = common.fixturesDir + '/breakpoints_utf8.js';
+const script = `${common.fixturesDir}/breakpoints_utf8.js`;
process.env.NODE_DEBUGGER_TEST_SCRIPT = script;
require('./test-debugger-repl.js');
diff --git a/test/disabled/test-dgram-send-error.js b/test/disabled/test-dgram-send-error.js
deleted file mode 100644
index 271e6689046a00..00000000000000
--- a/test/disabled/test-dgram-send-error.js
+++ /dev/null
@@ -1,60 +0,0 @@
-'use strict';
-// Some operating systems report errors when an UDP message is sent to an
-// unreachable host. This error can be reported by sendto() and even by
-// recvfrom(). Node should not propagate this error to the user.
-
-// We test this by sending a bunch of packets to random IPs. In the meantime
-// we also send packets to ourselves to verify that after receiving an error
-// we can still receive packets successfully.
-
-const common = require('../common');
-var ITERATIONS = 1000;
-
-var assert = require('assert'),
- dgram = require('dgram');
-
-var buf = Buffer.alloc(1024, 42);
-
-var packetsReceived = 0,
- packetsSent = 0;
-
-var socket = dgram.createSocket('udp4');
-
-socket.on('message', onMessage);
-socket.on('listening', doSend);
-socket.bind(common.PORT);
-
-function onMessage(message, info) {
- packetsReceived++;
- if (packetsReceived < ITERATIONS) {
- doSend();
- } else {
- socket.close();
- }
-}
-
-function afterSend(err) {
- if (err) throw err;
- packetsSent++;
-}
-
-function doSend() {
- // Generate a random IP.
- var parts = [];
- for (var i = 0; i < 4; i++) {
- // Generate a random number in the range 1..254.
- parts.push(Math.floor(Math.random() * 254) + 1);
- }
- var ip = parts.join('.');
-
- socket.send(buf, 0, buf.length, 1, ip, afterSend);
- socket.send(buf, 0, buf.length, common.PORT, '127.0.0.1', afterSend);
-}
-
-process.on('exit', function() {
- console.log(packetsSent + ' UDP packets sent, ' +
- packetsReceived + ' received');
-
- assert.strictEqual(packetsSent, ITERATIONS * 2);
- assert.strictEqual(packetsReceived, ITERATIONS);
-});
diff --git a/test/disabled/test-setuidgid.js b/test/disabled/test-setuidgid.js
deleted file mode 100644
index ff674f869039d2..00000000000000
--- a/test/disabled/test-setuidgid.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-// Requires special privileges
-var common = require('../common');
-var assert = require('assert');
-
-var oldgid = process.getgid();
-process.setgid('nobody');
-var newgid = process.getgid();
-assert.notEqual(newgid, oldgid, 'gids expected to be different');
-
-var olduid = process.getuid();
-process.setuid('nobody');
-var newuid = process.getuid();
-assert.notEqual(newuid, olduid, 'uids expected to be different');
-
-try {
- process.setuid('nobody1234');
-} catch (e) {
- assert.strictEqual(e.message,
- 'failed to resolve group',
- 'unexpected error message'
- );
-}
diff --git a/test/disabled/tls_server.js b/test/disabled/tls_server.js
deleted file mode 100644
index 1e72809a8a04ad..00000000000000
--- a/test/disabled/tls_server.js
+++ /dev/null
@@ -1,47 +0,0 @@
-'use strict';
-var common = require('../common');
-var assert = require('assert');
-
-var util = require('util');
-var net = require('net');
-var fs = require('fs');
-var crypto = require('crypto');
-
-var keyPem = fs.readFileSync(common.fixturesDir + '/cert.pem');
-var certPem = fs.readFileSync(common.fixturesDir + '/cert.pem');
-
-try {
- var credentials = crypto.createCredentials({key: keyPem, cert: certPem});
-} catch (e) {
- common.skip('node compiled without OpenSSL.');
- return;
-}
-var i = 0;
-var server = net.createServer(function(connection) {
- connection.setSecure(credentials);
- connection.setEncoding('latin1');
-
- connection.on('secure', function() {
- //console.log('Secure');
- });
-
- connection.on('data', function(chunk) {
- console.log('recved: ' + JSON.stringify(chunk));
- connection.write('HTTP/1.0 200 OK\r\n' +
- 'Content-type: text/plain\r\n' +
- 'Content-length: 9\r\n' +
- '\r\n' +
- 'OK : ' + i +
- '\r\n\r\n');
- i = i + 1;
- connection.end();
- });
-
- connection.on('end', function() {
- connection.end();
- });
-
-});
-server.listen(4443);
-
-
diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js
index 442381b54d7b72..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) => {
@@ -94,14 +96,14 @@ testData.forEach((item) => {
{
input: preprocessed,
filename: 'foo',
- template: 'doc/template.html',
+ template: path.resolve(__dirname, '../../doc/template.html'),
nodeVersion: process.version,
analytics: item.analyticsId,
},
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/fixtures/.empty-hidden-repl-history-file b/test/fixtures/.empty-hidden-repl-history-file
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/test/gc/test-http-client-connaborted.js b/test/gc/test-http-client-connaborted.js
index 6ff2a282d89c98..905174aee71649 100644
--- a/test/gc/test-http-client-connaborted.js
+++ b/test/gc/test-http-client-connaborted.js
@@ -16,7 +16,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/gc/test-http-client-onerror.js b/test/gc/test-http-client-onerror.js
index b17ab428a2ccd7..25b2a564de5388 100644
--- a/test/gc/test-http-client-onerror.js
+++ b/test/gc/test-http-client-onerror.js
@@ -18,7 +18,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, runTest);
diff --git a/test/gc/test-http-client-timeout.js b/test/gc/test-http-client-timeout.js
index fb4e8ba0f7058d..1703cd6e3df192 100644
--- a/test/gc/test-http-client-timeout.js
+++ b/test/gc/test-http-client-timeout.js
@@ -20,7 +20,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/gc/test-http-client.js b/test/gc/test-http-client.js
index f81cab0b09d2c2..39b9c35afd9d05 100644
--- a/test/gc/test-http-client.js
+++ b/test/gc/test-http-client.js
@@ -16,7 +16,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = http.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/gc/test-net-timeout.js b/test/gc/test-net-timeout.js
index 34893707a07d84..2484651e7f14ff 100644
--- a/test/gc/test-net-timeout.js
+++ b/test/gc/test-net-timeout.js
@@ -27,7 +27,7 @@ let done = 0;
let count = 0;
let countGC = 0;
-console.log('We should do ' + todo + ' requests');
+console.log(`We should do ${todo} requests`);
const server = net.createServer(serverHandler);
server.listen(0, getall);
diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js
index 8ef6e5cb6d7f33..e34f2870357bd2 100644
--- a/test/inspector/inspector-helper.js
+++ b/test/inspector/inspector-helper.js
@@ -120,7 +120,7 @@ function timeout(message, multiplicator) {
TIMEOUT * (multiplicator || 1));
}
-const TestSession = function(socket, harness) {
+function TestSession(socket, harness) {
this.mainScriptPath = harness.mainScriptPath;
this.mainScriptId = null;
@@ -145,7 +145,7 @@ const TestSession = function(socket, harness) {
buffer = buffer.slice(consumed);
} while (consumed);
}).on('close', () => assert(this.expectClose_, 'Socket closed prematurely'));
-};
+}
TestSession.prototype.scriptUrlForId = function(id) {
return this.scripts_[id];
@@ -167,13 +167,15 @@ TestSession.prototype.processMessage_ = function(message) {
assert.strictEqual(id, this.expectedId_);
this.expectedId_++;
if (this.responseCheckers_[id]) {
- assert(message['result'], JSON.stringify(message) + ' (response to ' +
- JSON.stringify(this.messages_[id]) + ')');
+ const messageJSON = JSON.stringify(message);
+ const idJSON = JSON.stringify(this.messages_[id]);
+ assert(message['result'], `${messageJSON} (response to ${idJSON})`);
this.responseCheckers_[id](message['result']);
delete this.responseCheckers_[id];
}
- assert(!message['error'], JSON.stringify(message) + ' (replying to ' +
- JSON.stringify(this.messages_[id]) + ')');
+ const messageJSON = JSON.stringify(message);
+ const idJSON = JSON.stringify(this.messages_[id]);
+ assert(!message['error'], `${messageJSON} (replying to ${idJSON})`);
delete this.messages_[id];
if (id === this.lastId_) {
this.lastMessageResponseCallback_ && this.lastMessageResponseCallback_();
@@ -211,12 +213,8 @@ TestSession.prototype.sendInspectorCommands = function(commands) {
};
this.sendAll_(commands, () => {
timeoutId = setTimeout(() => {
- let s = '';
- for (const id in this.messages_) {
- s += id + ', ';
- }
- common.fail('Messages without response: ' +
- s.substring(0, s.length - 2));
+ common.fail(`Messages without response: ${
+ Object.keys(this.messages_).join(', ')}`);
}, TIMEOUT);
});
});
@@ -239,7 +237,7 @@ TestSession.prototype.expectMessages = function(expects) {
if (!(expects instanceof Array)) expects = [ expects ];
const callback = this.createCallbackWithTimeout_(
- 'Matching response was not received:\n' + expects[0]);
+ `Matching response was not received:\n${expects[0]}`);
this.messagefilter_ = (message) => {
if (expects[0](message))
expects.shift();
@@ -254,7 +252,7 @@ TestSession.prototype.expectMessages = function(expects) {
TestSession.prototype.expectStderrOutput = function(regexp) {
this.harness_.addStderrFilter(
regexp,
- this.createCallbackWithTimeout_('Timed out waiting for ' + regexp));
+ this.createCallbackWithTimeout_(`Timed out waiting for ${regexp}`));
return this;
};
@@ -302,7 +300,7 @@ TestSession.prototype.testHttpResponse = function(path, check) {
};
-const Harness = function(port, childProcess) {
+function Harness(port, childProcess) {
this.port = port;
this.mainScriptPath = mainScript;
this.stderrFilters_ = [];
@@ -327,7 +325,7 @@ const Harness = function(port, childProcess) {
this.returnCode_ = code;
this.running_ = false;
});
-};
+}
Harness.prototype.addStderrFilter = function(regexp, callback) {
this.stderrFilters_.push((message) => {
diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js
index 08c0938c87e832..59d6d4cf71d796 100644
--- a/test/inspector/test-inspector.js
+++ b/test/inspector/test-inspector.js
@@ -10,15 +10,15 @@ 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) {
assert.ifError(err);
assert.ok(response);
const expected = {
- 'Browser': 'node.js/' + process.version,
+ 'Browser': `node.js/${process.version}`,
'Protocol-Version': '1.1',
};
assert.strictEqual(JSON.stringify(response),
@@ -34,8 +34,8 @@ function checkBadPath(err, response) {
function expectMainScriptSource(result) {
const expected = helper.mainScriptSource();
const source = result['scriptSource'];
- assert(source && (source.indexOf(expected) >= 0),
- 'Script source is wrong: ' + source);
+ assert(source && (source.includes(expected)),
+ `Script source is wrong: ${source}`);
}
function setupExpectBreakOnLine(line, url, session, scopeIdCallback) {
diff --git a/test/internet/test-dns-cares-domains.js b/test/internet/test-dns-cares-domains.js
index 5328d7e3d97925..62c1847ea29adf 100644
--- a/test/internet/test-dns-cares-domains.js
+++ b/test/internet/test-dns-cares-domains.js
@@ -21,7 +21,7 @@ methods.forEach(function(method) {
const d = domain.create();
d.run(function() {
dns[method]('google.com', function() {
- assert.strictEqual(process.domain, d, method + ' retains domain');
+ assert.strictEqual(process.domain, d, `${method} retains domain`);
});
});
});
diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js
index b872af746bf25d..f6e8aacdbcf02f 100644
--- a/test/internet/test-dns-ipv6.js
+++ b/test/internet/test-dns-ipv6.js
@@ -164,7 +164,7 @@ TEST(function test_lookup_all_ipv6(done) {
ips.forEach((ip) => {
assert.ok(isIPv6(ip.address),
- 'Invalid IPv6: ' + ip.address.toString());
+ `Invalid IPv6: ${ip.address.toString()}`);
assert.strictEqual(ip.family, 6);
});
diff --git a/test/internet/test-dns-setserver-in-callback-of-resolve4.js b/test/internet/test-dns-setserver-in-callback-of-resolve4.js
new file mode 100644
index 00000000000000..9ee853b5e4080b
--- /dev/null
+++ b/test/internet/test-dns-setserver-in-callback-of-resolve4.js
@@ -0,0 +1,12 @@
+'use strict';
+
+// We don't care about `err` in the callback function of `dns.resolve4`. We just
+// want to test whether `dns.setServers` that is run after `resolve4` will cause
+// a crash or not. If it doesn't crash, the test succeeded.
+
+const common = require('../common');
+const dns = require('dns');
+
+dns.resolve4('google.com', common.mustCall(function(/* err, nameServers */) {
+ dns.setServers([ '8.8.8.8' ]);
+}));
diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js
index 01561f96bcc954..ba40146c58342b 100644
--- a/test/internet/test-dns.js
+++ b/test/internet/test-dns.js
@@ -541,7 +541,7 @@ req.oncomplete = function(err, domains) {
};
process.on('exit', function() {
- console.log(completed + ' tests completed');
+ console.log(`${completed} tests completed`);
assert.strictEqual(running, false);
assert.strictEqual(expected, completed);
assert.ok(getaddrinfoCallbackCalled);
diff --git a/test/internet/test-tls-add-ca-cert.js b/test/internet/test-tls-add-ca-cert.js
index 05f3b4dc10e36c..440d4b9a1afb1b 100644
--- a/test/internet/test-tls-add-ca-cert.js
+++ b/test/internet/test-tls-add-ca-cert.js
@@ -13,7 +13,7 @@ const fs = require('fs');
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/known_issues/test-http-path-contains-unicode.js b/test/known_issues/test-http-path-contains-unicode.js
new file mode 100644
index 00000000000000..8f90a0d57f07b4
--- /dev/null
+++ b/test/known_issues/test-http-path-contains-unicode.js
@@ -0,0 +1,41 @@
+'use strict';
+const common = require('../common');
+
+// This test ensures that Unicode characters in the URL get handled correctly
+// by `http`
+// Refs: https://github.com/nodejs/node/issues/13296
+
+const assert = require('assert');
+const http = require('http');
+
+const expected = '/café🐶';
+
+assert.strictEqual(
+ expected,
+ '/caf\u{e9}\u{1f436}',
+ 'Sanity check that string literal produced the expected string'
+);
+
+const server = http.createServer(common.mustCall(function(req, res) {
+ assert.strictEqual(req.url, expected);
+ req.on('data', common.mustCall(function() {
+ })).on('end', common.mustCall(function() {
+ server.close();
+ res.writeHead(200);
+ res.end('hello world\n');
+ }));
+
+}));
+
+server.listen(0, function() {
+ http.request({
+ port: this.address().port,
+ path: expected,
+ method: 'GET'
+ }, common.mustCall(function(res) {
+ res.resume();
+ })).on('error', function(e) {
+ console.log(e.message);
+ process.exit(1);
+ }).end();
+});
diff --git a/test/known_issues/test-stdout-buffer-flush-on-exit.js b/test/known_issues/test-stdout-buffer-flush-on-exit.js
index e966d02e324ba7..931f1026cfa9c6 100644
--- a/test/known_issues/test-stdout-buffer-flush-on-exit.js
+++ b/test/known_issues/test-stdout-buffer-flush-on-exit.js
@@ -18,7 +18,8 @@ if (process.argv[2] === 'child') {
[22, 21, 20, 19, 18, 17, 16, 16, 17, 18, 19, 20, 21, 22].forEach((exponent) => {
const bigNum = Math.pow(2, exponent);
const longLine = lineSeed.repeat(bigNum);
- const cmd = `${process.execPath} ${__filename} child ${exponent} ${bigNum}`;
+ const cmd =
+ `"${process.execPath}" "${__filename}" child ${exponent} ${bigNum}`;
const stdout = execSync(cmd).toString().trim();
assert.strictEqual(stdout, longLine, `failed with exponent ${exponent}`);
diff --git a/test/message/throw_in_line_with_tabs.js b/test/message/throw_in_line_with_tabs.js
index ad95d66e97ec55..2281b61fc355cd 100644
--- a/test/message/throw_in_line_with_tabs.js
+++ b/test/message/throw_in_line_with_tabs.js
@@ -1,4 +1,4 @@
-/* eslint-disable indent, no-tabs */
+/* eslint-disable indent-legacy, no-tabs */
'use strict';
require('../common');
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:*)
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index 5b84bb1a250ee2..97e7803f4d40a5 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -13,6 +13,8 @@ prefix parallel
[$system==macos]
[$arch==arm || $arch==arm64]
+test-fs-readdir-ucs2 : PASS,FLAKY
+test-npm-install: PASS,FLAKY
[$system==solaris] # Also applies to SmartOS
test-debug-signal-cluster : PASS,FLAKY
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js
index ca25c9965d0640..3a81c6f810425a 100644
--- a/test/parallel/test-assert.js
+++ b/test/parallel/test-assert.js
@@ -139,7 +139,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, a1, a2));
// having an identical prototype property
const nbRoot = {
- toString: function() { return this.first + ' ' + this.last; }
+ toString: function() { return `${this.first} ${this.last}`; }
};
function nameBuilder(first, last) {
@@ -240,7 +240,8 @@ assert.throws(
{
const re1 = /a/;
re1.lastIndex = 3;
- assert.throws(makeBlock(a.deepStrictEqual, re1, /a/));
+ assert.throws(makeBlock(a.deepStrictEqual, re1, /a/),
+ /^AssertionError: \/a\/ deepStrictEqual \/a\/$/);
}
// 7.4 - strict
@@ -262,10 +263,12 @@ assert.doesNotThrow(makeBlock(a.deepStrictEqual, {a: 4}, {a: 4}));
assert.doesNotThrow(makeBlock(a.deepStrictEqual,
{a: 4, b: '2'},
{a: 4, b: '2'}));
-assert.throws(makeBlock(a.deepStrictEqual, [4], ['4']));
+assert.throws(makeBlock(a.deepStrictEqual, [4], ['4']),
+ /^AssertionError: \[ 4 ] deepStrictEqual \[ '4' ]$/);
assert.throws(makeBlock(a.deepStrictEqual, {a: 4}, {a: 4, b: true}),
- a.AssertionError);
-assert.throws(makeBlock(a.deepStrictEqual, ['a'], {0: 'a'}));
+ /^AssertionError: { a: 4 } deepStrictEqual { a: 4, b: true }$/);
+assert.throws(makeBlock(a.deepStrictEqual, ['a'], {0: 'a'}),
+ /^AssertionError: \[ 'a' ] deepStrictEqual { '0': 'a' }$/);
//(although not necessarily the same order),
assert.doesNotThrow(makeBlock(a.deepStrictEqual,
{a: 4, b: '1'},
@@ -342,9 +345,11 @@ function thrower(errorConstructor) {
assert.throws(makeBlock(thrower, a.AssertionError),
a.AssertionError, 'message');
assert.throws(makeBlock(thrower, a.AssertionError), a.AssertionError);
+// eslint-disable-next-line assert-throws-arguments
assert.throws(makeBlock(thrower, a.AssertionError));
// if not passing an error, catch all.
+// eslint-disable-next-line assert-throws-arguments
assert.throws(makeBlock(thrower, TypeError));
// when passing a type, only catch errors of the appropriate type
@@ -423,7 +428,7 @@ try {
AnotherErrorType = class extends Error {};
- const functionThatThrows = function() {
+ const functionThatThrows = () => {
throw new AnotherErrorType('foo');
};
@@ -466,6 +471,7 @@ a.throws(makeBlock(a.deepEqual, args, []));
// more checking that arguments objects are handled correctly
{
+ // eslint-disable-next-line func-style
const returnArguments = function() { return arguments; };
const someArgs = returnArguments('a');
@@ -517,6 +523,7 @@ testAssertionMessage({a: NaN, b: Infinity, c: -Infinity},
// #2893
try {
+ // eslint-disable-next-line assert-throws-arguments
assert.throws(function() {
assert.ifError(null);
});
diff --git a/test/parallel/test-async-wrap-check-providers.js b/test/parallel/test-async-wrap-check-providers.js
index f4b50df576fb6f..916ab4efe154d5 100644
--- a/test/parallel/test-async-wrap-check-providers.js
+++ b/test/parallel/test-async-wrap-check-providers.js
@@ -91,8 +91,8 @@ process.on('SIGINT', () => process.exit());
// Run from closed net server above.
function checkTLS() {
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
};
const server = tls.createServer(options, noop)
.listen(0, function() {
diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js
index 7f910807917063..7ebe34b21edb1e 100644
--- a/test/parallel/test-buffer-alloc.js
+++ b/test/parallel/test-buffer-alloc.js
@@ -984,8 +984,8 @@ Buffer.poolSize = ps;
assert.throws(() => Buffer.allocUnsafe(10).copy(),
/TypeError: argument should be a Buffer/);
-const regErrorMsg = new RegExp('First argument must be a string, Buffer, ' +
- 'ArrayBuffer, Array, or array-like object.');
+const regErrorMsg =
+ /First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object\./;
assert.throws(() => Buffer.from(), regErrorMsg);
assert.throws(() => Buffer.from(null), regErrorMsg);
diff --git a/test/parallel/test-buffer-badhex.js b/test/parallel/test-buffer-badhex.js
index ad0b5133958e3a..c3d151ba18c694 100644
--- a/test/parallel/test-buffer-badhex.js
+++ b/test/parallel/test-buffer-badhex.js
@@ -44,6 +44,6 @@ const Buffer = require('buffer').Buffer;
const hex = buf.toString('hex');
assert.deepStrictEqual(Buffer.from(hex, 'hex'), buf);
- const badHex = hex.slice(0, 256) + 'xx' + hex.slice(256, 510);
+ const badHex = `${hex.slice(0, 256)}xx${hex.slice(256, 510)}`;
assert.deepStrictEqual(Buffer.from(badHex, 'hex'), buf.slice(0, 128));
}
diff --git a/test/parallel/test-buffer-compare.js b/test/parallel/test-buffer-compare.js
index c0db39a6e3c8bc..6182d0967d4900 100644
--- a/test/parallel/test-buffer-compare.js
+++ b/test/parallel/test-buffer-compare.js
@@ -23,8 +23,11 @@ assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(0)), 0);
assert.strictEqual(Buffer.compare(Buffer.alloc(0), Buffer.alloc(1)), -1);
assert.strictEqual(Buffer.compare(Buffer.alloc(1), Buffer.alloc(0)), 1);
-assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'));
+assert.throws(() => Buffer.compare(Buffer.alloc(1), 'abc'),
+ /^TypeError: Arguments must be Buffers$/);
-assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)));
+assert.throws(() => Buffer.compare('abc', Buffer.alloc(1)),
+ /^TypeError: Arguments must be Buffers$/);
-assert.throws(() => Buffer.alloc(1).compare('abc'));
+assert.throws(() => Buffer.alloc(1).compare('abc'),
+ /^TypeError: Argument must be a Buffer$/);
diff --git a/test/parallel/test-buffer-equals.js b/test/parallel/test-buffer-equals.js
index 2b460c5c6aea1b..3851f05c7b9a6d 100644
--- a/test/parallel/test-buffer-equals.js
+++ b/test/parallel/test-buffer-equals.js
@@ -13,4 +13,5 @@ assert.ok(!c.equals(d));
assert.ok(!d.equals(e));
assert.ok(d.equals(d));
-assert.throws(() => Buffer.alloc(1).equals('abc'));
+assert.throws(() => Buffer.alloc(1).equals('abc'),
+ /^TypeError: Argument must be a Buffer$/);
diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js
index 2b65ce41889cdc..112cf546502372 100644
--- a/test/parallel/test-buffer-includes.js
+++ b/test/parallel/test-buffer-includes.js
@@ -199,7 +199,7 @@ const longBufferString = Buffer.from(longString);
let pattern = 'ABACABADABACABA';
for (let i = 0; i < longBufferString.length - pattern.length; i += 7) {
const includes = longBufferString.includes(pattern, i);
- assert(includes, 'Long ABACABA...-string at index ' + i);
+ assert(includes, `Long ABACABA...-string at index ${i}`);
}
assert(longBufferString.includes('AJABACA'), 'Long AJABACA, First J');
assert(longBufferString.includes('AJABACA', 511), 'Long AJABACA, Second J');
@@ -273,15 +273,17 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
}
}
-assert.throws(function() {
- b.includes(function() { });
-});
-assert.throws(function() {
+const expectedError =
+ /^TypeError: "val" argument must be string, number or Buffer$/;
+assert.throws(() => {
+ b.includes(() => {});
+}, expectedError);
+assert.throws(() => {
b.includes({});
-});
-assert.throws(function() {
+}, expectedError);
+assert.throws(() => {
b.includes([]);
-});
+}, expectedError);
// test truncation of Number arguments to uint8
{
diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js
index f4eba91b8abded..e389b09e384500 100644
--- a/test/parallel/test-buffer-indexof.js
+++ b/test/parallel/test-buffer-indexof.js
@@ -255,7 +255,7 @@ let pattern = 'ABACABADABACABA';
for (let i = 0; i < longBufferString.length - pattern.length; i += 7) {
const index = longBufferString.indexOf(pattern, i);
assert.strictEqual((i + 15) & ~0xf, index,
- 'Long ABACABA...-string at index ' + i);
+ `Long ABACABA...-string at index ${i}`);
}
assert.strictEqual(510, longBufferString.indexOf('AJABACA'),
'Long AJABACA, First J');
@@ -346,15 +346,20 @@ assert.strictEqual(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1);
}
}
-assert.throws(function() {
- b.indexOf(function() { });
-});
-assert.throws(function() {
+const argumentExpected =
+ /^TypeError: "val" argument must be string, number or Buffer$/;
+
+assert.throws(() => {
+ b.indexOf(() => { });
+}, argumentExpected);
+
+assert.throws(() => {
b.indexOf({});
-});
-assert.throws(function() {
+}, argumentExpected);
+
+assert.throws(() => {
b.indexOf([]);
-});
+}, argumentExpected);
// Test weird offset arguments.
// The following offsets coerce to NaN or 0, searching the whole Buffer
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-buffer.js b/test/parallel/test-buffer.js
index 805c8b9e7ac347..a2fdab55b772a8 100644
--- a/test/parallel/test-buffer.js
+++ b/test/parallel/test-buffer.js
@@ -41,11 +41,11 @@ for (const [key, value] of e.entries()) {
assert.throws(function() {
Buffer(8).fill('a', -1);
-});
+}, /^RangeError: Out of range index$/);
assert.throws(function() {
Buffer(8).fill('a', 0, 9);
-});
+}, /^RangeError: Out of range index$/);
// Make sure this doesn't hang indefinitely.
Buffer(8).fill('');
@@ -1433,17 +1433,17 @@ if (common.hasCrypto) {
assert.throws(function() {
const b = Buffer(1);
Buffer.compare(b, 'abc');
-});
+}, /^TypeError: Arguments must be Buffers$/);
assert.throws(function() {
const b = Buffer(1);
Buffer.compare('abc', b);
-});
+}, /^TypeError: Arguments must be Buffers$/);
assert.throws(function() {
const b = Buffer(1);
b.compare('abc');
-});
+}, /^TypeError: Argument must be a Buffer$/);
// Test Equals
{
@@ -1461,10 +1461,12 @@ assert.throws(function() {
assert.throws(function() {
const b = Buffer(1);
b.equals('abc');
-});
+}, /^TypeError: Argument must be a Buffer$/);
// Regression test for https://github.com/nodejs/node/issues/649.
-assert.throws(function() { Buffer(1422561062959).toString('utf8'); });
+assert.throws(function() {
+ Buffer(1422561062959).toString('utf8');
+}, /^RangeError: Invalid typed array length$/);
const ps = Buffer.poolSize;
Buffer.poolSize = 0;
@@ -1474,7 +1476,7 @@ Buffer.poolSize = ps;
// Test Buffer.copy() segfault
assert.throws(function() {
Buffer(10).copy();
-});
+}, /^TypeError: argument should be a Buffer$/);
const regErrorMsg = new RegExp('First argument must be a string, Buffer, ' +
'ArrayBuffer, Array, or array-like object.');
diff --git a/test/parallel/test-child-process-bad-stdio.js b/test/parallel/test-child-process-bad-stdio.js
index e92bbcf11fbac8..45294d7d82d4f6 100644
--- a/test/parallel/test-child-process-bad-stdio.js
+++ b/test/parallel/test-child-process-bad-stdio.js
@@ -27,7 +27,7 @@ ChildProcess.prototype.spawn = function() {
};
function createChild(options, callback) {
- const cmd = `${process.execPath} ${__filename} child`;
+ const cmd = `"${process.execPath}" "${__filename}" child`;
return cp.exec(cmd, options, common.mustCall(callback));
}
diff --git a/test/parallel/test-child-process-buffering.js b/test/parallel/test-child-process-buffering.js
index 1c04a6f8130f12..91ef2780ad61cc 100644
--- a/test/parallel/test-child-process-buffering.js
+++ b/test/parallel/test-child-process-buffering.js
@@ -8,12 +8,12 @@ function pwd(callback) {
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(s) {
- console.log('stdout: ' + JSON.stringify(s));
+ console.log(`stdout: ${JSON.stringify(s)}`);
output += s;
});
child.on('exit', common.mustCall(function(c) {
- console.log('exit: ' + c);
+ console.log(`exit: ${c}`);
assert.strictEqual(0, c);
}));
diff --git a/test/parallel/test-child-process-default-options.js b/test/parallel/test-child-process-default-options.js
index 37e7ea7494670e..9d994a6d210977 100644
--- a/test/parallel/test-child-process-default-options.js
+++ b/test/parallel/test-child-process-default-options.js
@@ -18,11 +18,11 @@ let response = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(chunk) {
- console.log('stdout: ' + chunk);
+ console.log(`stdout: ${chunk}`);
response += chunk;
});
process.on('exit', function() {
- assert.ok(response.indexOf('HELLO=WORLD') >= 0,
+ assert.ok(response.includes('HELLO=WORLD'),
'spawn did not use process.env as default');
});
diff --git a/test/parallel/test-child-process-double-pipe.js b/test/parallel/test-child-process-double-pipe.js
index dac48a2db7212a..33722c264be64f 100644
--- a/test/parallel/test-child-process-double-pipe.js
+++ b/test/parallel/test-child-process-double-pipe.js
@@ -35,7 +35,7 @@ if (common.isWindows) {
// pipe echo | grep
echo.stdout.on('data', function(data) {
- console.error('grep stdin write ' + data.length);
+ console.error(`grep stdin write ${data.length}`);
if (!grep.stdin.write(data)) {
echo.stdout.pause();
}
@@ -65,7 +65,7 @@ sed.on('exit', function() {
// pipe grep | sed
grep.stdout.on('data', function(data) {
- console.error('grep stdout ' + data.length);
+ console.error(`grep stdout ${data.length}`);
if (!sed.stdin.write(data)) {
grep.stdout.pause();
}
diff --git a/test/parallel/test-child-process-env.js b/test/parallel/test-child-process-env.js
index ad41f978e21768..9430e79593e0fd 100644
--- a/test/parallel/test-child-process-env.js
+++ b/test/parallel/test-child-process-env.js
@@ -24,11 +24,11 @@ let response = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(chunk) {
- console.log('stdout: ' + chunk);
+ console.log(`stdout: ${chunk}`);
response += chunk;
});
process.on('exit', function() {
- assert.ok(response.indexOf('HELLO=WORLD') >= 0);
- assert.ok(response.indexOf('FOO=BAR') >= 0);
+ assert.ok(response.includes('HELLO=WORLD'));
+ assert.ok(response.includes('FOO=BAR'));
});
diff --git a/test/parallel/test-child-process-exec-encoding.js b/test/parallel/test-child-process-exec-encoding.js
index ba80ccda8c6aee..781ee51d96dcb2 100644
--- a/test/parallel/test-child-process-exec-encoding.js
+++ b/test/parallel/test-child-process-exec-encoding.js
@@ -13,7 +13,7 @@ if (process.argv[2] === 'child') {
console.error(stderrData);
} else {
function run(options, callback) {
- const cmd = `${process.execPath} ${__filename} child`;
+ const cmd = `"${process.execPath}" "${__filename}" child`;
cp.exec(cmd, options, common.mustCall((err, stdout, stderr) => {
assert.ifError(err);
diff --git a/test/parallel/test-child-process-exec-env.js b/test/parallel/test-child-process-exec-env.js
index 6af3bea2113a89..15156bbd311eb3 100644
--- a/test/parallel/test-child-process-exec-env.js
+++ b/test/parallel/test-child-process-exec-env.js
@@ -10,9 +10,9 @@ let child;
function after(err, stdout, stderr) {
if (err) {
error_count++;
- console.log('error!: ' + err.code);
- console.log('stdout: ' + JSON.stringify(stdout));
- console.log('stderr: ' + JSON.stringify(stderr));
+ console.log(`error!: ${err.code}`);
+ console.log(`stdout: ${JSON.stringify(stdout)}`);
+ console.log(`stderr: ${JSON.stringify(stderr)}`);
assert.strictEqual(false, err.killed);
} else {
success_count++;
@@ -35,5 +35,5 @@ process.on('exit', function() {
console.log('response: ', response);
assert.strictEqual(1, success_count);
assert.strictEqual(0, error_count);
- assert.ok(response.indexOf('HELLO=WORLD') >= 0);
+ assert.ok(response.includes('HELLO=WORLD'));
});
diff --git a/test/parallel/test-child-process-exec-timeout.js b/test/parallel/test-child-process-exec-timeout.js
index 8754246aa80d6a..20923d922ab84c 100644
--- a/test/parallel/test-child-process-exec-timeout.js
+++ b/test/parallel/test-child-process-exec-timeout.js
@@ -12,7 +12,7 @@ if (process.argv[2] === 'child') {
return;
}
-const cmd = `${process.execPath} ${__filename} child`;
+const cmd = `"${process.execPath}" "${__filename}" child`;
// Test the case where a timeout is set, and it expires.
cp.exec(cmd, { timeout: 1 }, common.mustCall((err, stdout, stderr) => {
diff --git a/test/parallel/test-child-process-fork-close.js b/test/parallel/test-child-process-fork-close.js
index d8b1aa0bf3267c..e87b7d0af4958c 100644
--- a/test/parallel/test-child-process-fork-close.js
+++ b/test/parallel/test-child-process-fork-close.js
@@ -3,7 +3,7 @@ const common = require('../common');
const assert = require('assert');
const fork = require('child_process').fork;
-const cp = fork(common.fixturesDir + '/child-process-message-and-exit.js');
+const cp = fork(`${common.fixturesDir}/child-process-message-and-exit.js`);
let gotMessage = false;
let gotExit = false;
diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js
index 7b9f0b8e23fbf4..4516f3cc7b8f81 100644
--- a/test/parallel/test-child-process-fork-dgram.js
+++ b/test/parallel/test-child-process-fork-dgram.js
@@ -57,7 +57,7 @@ if (process.argv[2] === 'child') {
});
});
- const sendMessages = function() {
+ function sendMessages() {
const serverPort = parentServer.address().port;
const timer = setInterval(function() {
@@ -81,7 +81,7 @@ if (process.argv[2] === 'child') {
);
}
}, 1);
- };
+ }
parentServer.bind(0, '127.0.0.1');
diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js
index d224643184733f..665eb6f3270cf8 100644
--- a/test/parallel/test-child-process-fork-net.js
+++ b/test/parallel/test-child-process-fork-net.js
@@ -66,7 +66,7 @@ if (process.argv[2] === 'child') {
}));
// send net.Server to child and test by connecting
- const testServer = function(callback) {
+ function testServer(callback) {
// destroy server execute callback when done
const progress = new ProgressTracker(2, function() {
@@ -95,7 +95,7 @@ if (process.argv[2] === 'child') {
server.listen(0);
// handle client messages
- const messageHandlers = function(msg) {
+ function messageHandlers(msg) {
if (msg.what === 'listening') {
// make connections
@@ -117,13 +117,13 @@ if (process.argv[2] === 'child') {
child.removeListener('message', messageHandlers);
callback();
}
- };
+ }
child.on('message', messageHandlers);
- };
+ }
// send net.Socket to child
- const testSocket = function(callback) {
+ function testSocket(callback) {
// create a new server and connect to it,
// but the socket will be handled by the child
@@ -158,7 +158,7 @@ if (process.argv[2] === 'child') {
server.close();
});
});
- };
+ }
// create server and send it to child
let serverSuccess = false;
diff --git a/test/parallel/test-child-process-fork-net2.js b/test/parallel/test-child-process-fork-net2.js
index f5c7a7d8ac5519..41ba49c24ca06c 100644
--- a/test/parallel/test-child-process-fork-net2.js
+++ b/test/parallel/test-child-process-fork-net2.js
@@ -123,7 +123,7 @@ if (process.argv[2] === 'child') {
server.listen(0, '127.0.0.1');
- let closeServer = function() {
+ function closeServer() {
server.close();
setTimeout(function() {
@@ -132,7 +132,7 @@ if (process.argv[2] === 'child') {
child2.send('close');
child3.disconnect();
}, 200);
- };
+ }
process.on('exit', function() {
assert.strictEqual(disconnected, count);
diff --git a/test/parallel/test-child-process-fork-regr-gh-2847.js b/test/parallel/test-child-process-fork-regr-gh-2847.js
index fe95e8dbb5b4ac..923e2a280a93ea 100644
--- a/test/parallel/test-child-process-fork-regr-gh-2847.js
+++ b/test/parallel/test-child-process-fork-regr-gh-2847.js
@@ -1,3 +1,5 @@
+// Before https://github.com/nodejs/node/pull/2847 a child process trying
+// (asynchronously) to use the closed channel to it's creator caused a segfault.
'use strict';
const common = require('../common');
@@ -33,11 +35,14 @@ const server = net.createServer(function(s) {
worker.send({}, s, callback);
});
- // Errors can happen if this connection
- // is still happening while the server has been closed.
+ // https://github.com/nodejs/node/issues/3635#issuecomment-157714683
+ // ECONNREFUSED or ECONNRESET errors can happen if this connection is still
+ // establishing while the server has already closed.
+ // EMFILE can happen if the worker __and__ the server had already closed.
s.on('error', function(err) {
if ((err.code !== 'ECONNRESET') &&
- ((err.code !== 'ECONNREFUSED'))) {
+ (err.code !== 'ECONNREFUSED') &&
+ (err.code !== 'EMFILE')) {
throw err;
}
});
diff --git a/test/parallel/test-child-process-fork.js b/test/parallel/test-child-process-fork.js
index 36864cbd663ce0..587c7e2c596c89 100644
--- a/test/parallel/test-child-process-fork.js
+++ b/test/parallel/test-child-process-fork.js
@@ -4,7 +4,7 @@ const assert = require('assert');
const fork = require('child_process').fork;
const args = ['foo', 'bar'];
-const n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
+const n = fork(`${common.fixturesDir}/child-process-spawn-node.js`, args);
assert.deepStrictEqual(args, ['foo', 'bar']);
n.on('message', function(m) {
diff --git a/test/parallel/test-child-process-fork3.js b/test/parallel/test-child-process-fork3.js
index 5588c41422e21b..ecd43ab56d3ffe 100644
--- a/test/parallel/test-child-process-fork3.js
+++ b/test/parallel/test-child-process-fork3.js
@@ -2,4 +2,4 @@
const common = require('../common');
const child_process = require('child_process');
-child_process.fork(common.fixturesDir + '/empty.js'); // should not hang
+child_process.fork(`${common.fixturesDir}/empty.js`); // should not hang
diff --git a/test/parallel/test-child-process-internal.js b/test/parallel/test-child-process-internal.js
index d795b69d7ee0e5..bf5554bc2d45f9 100644
--- a/test/parallel/test-child-process-internal.js
+++ b/test/parallel/test-child-process-internal.js
@@ -4,8 +4,8 @@ const assert = require('assert');
//messages
const PREFIX = 'NODE_';
-const normal = {cmd: 'foo' + PREFIX};
-const internal = {cmd: PREFIX + 'bar'};
+const normal = {cmd: `foo${PREFIX}`};
+const internal = {cmd: `${PREFIX}bar`};
if (process.argv[2] === 'child') {
//send non-internal message containing PREFIX at a non prefix position
diff --git a/test/parallel/test-child-process-ipc.js b/test/parallel/test-child-process-ipc.js
index da952e6c9bf1ae..4926751797a6b1 100644
--- a/test/parallel/test-child-process-ipc.js
+++ b/test/parallel/test-child-process-ipc.js
@@ -15,13 +15,13 @@ let gotEcho = false;
const child = spawn(process.argv[0], [sub]);
child.stderr.on('data', function(data) {
- console.log('parent stderr: ' + data);
+ console.log(`parent stderr: ${data}`);
});
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(data) {
- console.log('child said: ' + JSON.stringify(data));
+ console.log(`child said: ${JSON.stringify(data)}`);
if (!gotHelloWorld) {
console.error('testing for hello world');
assert.strictEqual('hello world\r\n', data);
diff --git a/test/parallel/test-child-process-send-utf8.js b/test/parallel/test-child-process-send-utf8.js
index c5d0943301c730..4cedc589b1db95 100644
--- a/test/parallel/test-child-process-send-utf8.js
+++ b/test/parallel/test-child-process-send-utf8.js
@@ -3,7 +3,7 @@ const common = require('../common');
const assert = require('assert');
const fork = require('child_process').fork;
-const expected = Array(1e5).join('ßßßß');
+const expected = 'ßßßß'.repeat(1e5 - 1);
if (process.argv[2] === 'child') {
process.send(expected);
} else {
diff --git a/test/parallel/test-child-process-set-blocking.js b/test/parallel/test-child-process-set-blocking.js
index d6a044619b6479..fa72036389acba 100644
--- a/test/parallel/test-child-process-set-blocking.js
+++ b/test/parallel/test-child-process-set-blocking.js
@@ -5,7 +5,7 @@ const ch = require('child_process');
const SIZE = 100000;
-const cp = ch.spawn('python', ['-c', 'print ' + SIZE + ' * "C"'], {
+const cp = ch.spawn('python', ['-c', `print ${SIZE} * "C"`], {
stdio: 'inherit'
});
diff --git a/test/parallel/test-child-process-spawn-error.js b/test/parallel/test-child-process-spawn-error.js
index 6cd3c47eef46ad..d0b92d57ddd6f1 100644
--- a/test/parallel/test-child-process-spawn-error.js
+++ b/test/parallel/test-child-process-spawn-error.js
@@ -11,7 +11,7 @@ const enoentChild = spawn(enoentPath, spawnargs);
enoentChild.on('error', common.mustCall(function(err) {
assert.strictEqual(err.code, 'ENOENT');
assert.strictEqual(err.errno, 'ENOENT');
- assert.strictEqual(err.syscall, 'spawn ' + enoentPath);
+ assert.strictEqual(err.syscall, `spawn ${enoentPath}`);
assert.strictEqual(err.path, enoentPath);
assert.deepStrictEqual(err.spawnargs, spawnargs);
}));
diff --git a/test/parallel/test-child-process-spawn-typeerror.js b/test/parallel/test-child-process-spawn-typeerror.js
index 14f3127dbe7b59..280484490140b1 100644
--- a/test/parallel/test-child-process-spawn-typeerror.js
+++ b/test/parallel/test-child-process-spawn-typeerror.js
@@ -9,7 +9,7 @@ const cmd = common.isWindows ? 'rundll32' : 'ls';
const invalidcmd = 'hopefully_you_dont_have_this_on_your_machine';
const invalidArgsMsg = /Incorrect value of args option/;
const invalidOptionsMsg = /"options" argument must be an object/;
-const empty = common.fixturesDir + '/empty.js';
+const empty = `${common.fixturesDir}/empty.js`;
assert.throws(function() {
const child = spawn(invalidcmd, 'this is not an array');
@@ -57,7 +57,7 @@ assert.throws(function() {
// Argument types for combinatorics
const a = [];
const o = {};
-const c = function c() {};
+function c() {}
const s = 'string';
const u = undefined;
const n = null;
diff --git a/test/parallel/test-child-process-spawnsync-input.js b/test/parallel/test-child-process-spawnsync-input.js
index 1bda3d5dcf9da2..466a859c663e7e 100644
--- a/test/parallel/test-child-process-spawnsync-input.js
+++ b/test/parallel/test-child-process-spawnsync-input.js
@@ -9,8 +9,8 @@ const msgOut = 'this is stdout';
const msgErr = 'this is stderr';
// this is actually not os.EOL?
-const msgOutBuf = Buffer.from(msgOut + '\n');
-const msgErrBuf = Buffer.from(msgErr + '\n');
+const msgOutBuf = Buffer.from(`${msgOut}\n`);
+const msgErrBuf = Buffer.from(`${msgErr}\n`);
const args = [
'-e',
@@ -31,7 +31,7 @@ function verifyBufOutput(ret) {
assert.deepStrictEqual(ret.stderr, msgErrBuf);
}
-if (process.argv.indexOf('spawnchild') !== -1) {
+if (process.argv.includes('spawnchild')) {
switch (process.argv[3]) {
case '1':
ret = spawnSync(process.execPath, args, { stdio: 'inherit' });
@@ -85,5 +85,5 @@ verifyBufOutput(spawnSync(process.execPath, args));
ret = spawnSync(process.execPath, args, { encoding: 'utf8' });
checkSpawnSyncRet(ret);
-assert.strictEqual(ret.stdout, msgOut + '\n');
-assert.strictEqual(ret.stderr, msgErr + '\n');
+assert.strictEqual(ret.stdout, `${msgOut}\n`);
+assert.strictEqual(ret.stderr, `${msgErr}\n`);
diff --git a/test/parallel/test-child-process-spawnsync-maxbuf.js b/test/parallel/test-child-process-spawnsync-maxbuf.js
index 87099737ecb5b0..665cfd11bd2224 100644
--- a/test/parallel/test-child-process-spawnsync-maxbuf.js
+++ b/test/parallel/test-child-process-spawnsync-maxbuf.js
@@ -7,7 +7,7 @@ const spawnSync = require('child_process').spawnSync;
const msgOut = 'this is stdout';
// This is actually not os.EOL?
-const msgOutBuf = Buffer.from(msgOut + '\n');
+const msgOutBuf = Buffer.from(`${msgOut}\n`);
const args = [
'-e',
diff --git a/test/parallel/test-child-process-stdin.js b/test/parallel/test-child-process-stdin.js
index 8782e46f8f7229..3da722ec71de2d 100644
--- a/test/parallel/test-child-process-stdin.js
+++ b/test/parallel/test-child-process-stdin.js
@@ -18,7 +18,7 @@ let response = '';
cat.stdout.setEncoding('utf8');
cat.stdout.on('data', function(chunk) {
- console.log('stdout: ' + chunk);
+ console.log(`stdout: ${chunk}`);
response += chunk;
});
diff --git a/test/parallel/test-child-process-stdio-big-write-end.js b/test/parallel/test-child-process-stdio-big-write-end.js
index 24991492f63d32..5e32314cc87a33 100644
--- a/test/parallel/test-child-process-stdio-big-write-end.js
+++ b/test/parallel/test-child-process-stdio-big-write-end.js
@@ -1,7 +1,7 @@
'use strict';
require('../common');
const assert = require('assert');
-const BUFSIZE = 1024;
+let bufsize = 0;
switch (process.argv[2]) {
case undefined:
@@ -30,14 +30,15 @@ function parent() {
// Write until the buffer fills up.
let buf;
do {
- buf = Buffer.alloc(BUFSIZE, '.');
- sent += BUFSIZE;
+ bufsize += 1024;
+ buf = Buffer.alloc(bufsize, '.');
+ sent += bufsize;
} while (child.stdin.write(buf));
// then write a bunch more times.
for (let i = 0; i < 100; i++) {
- const buf = Buffer.alloc(BUFSIZE, '.');
- sent += BUFSIZE;
+ const buf = Buffer.alloc(bufsize, '.');
+ sent += bufsize;
child.stdin.write(buf);
}
diff --git a/test/parallel/test-cli-eval.js b/test/parallel/test-cli-eval.js
index 93de319a56a58e..6094395cdd8883 100644
--- a/test/parallel/test-cli-eval.js
+++ b/test/parallel/test-cli-eval.js
@@ -73,6 +73,8 @@ child.exec(`${nodejs} --print "os.platform()"`,
}));
// Module path resolve bug regression test.
+const cwd = process.cwd();
+process.chdir(path.resolve(__dirname, '../../'));
child.exec(`${nodejs} --eval "require('./test/parallel/test-cli-eval.js')"`,
common.mustCall((err, stdout, stderr) => {
assert.strictEqual(err.code, 42);
@@ -80,6 +82,7 @@ child.exec(`${nodejs} --eval "require('./test/parallel/test-cli-eval.js')"`,
stdout, 'Loaded as a module, exiting with status code 42.\n');
assert.strictEqual(stderr, '');
}));
+process.chdir(cwd);
// Missing argument should not crash.
child.exec(`${nodejs} -e`, common.mustCall((err, stdout, stderr) => {
@@ -179,7 +182,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
const opt = ' --eval "console.log(process.argv.slice(1).join(\' \'))"';
const cmd = `${nodejs}${opt} -- ${args}`;
child.exec(cmd, common.mustCall(function(err, stdout, stderr) {
- assert.strictEqual(stdout, args + '\n');
+ assert.strictEqual(stdout, `${args}\n`);
assert.strictEqual(stderr, '');
assert.strictEqual(err, null);
}));
@@ -188,7 +191,7 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
const popt = ' --print "process.argv.slice(1).join(\' \')"';
const pcmd = `${nodejs}${popt} -- ${args}`;
child.exec(pcmd, common.mustCall(function(err, stdout, stderr) {
- assert.strictEqual(stdout, args + '\n');
+ assert.strictEqual(stdout, `${args}\n`);
assert.strictEqual(stderr, '');
assert.strictEqual(err, null);
}));
@@ -196,9 +199,9 @@ child.exec(`${nodejs} --use-strict -p process.execArgv`,
// Ensure that arguments are successfully passed to a script.
// The first argument after '--' should be interpreted as a script
// filename.
- const filecmd = `${nodejs} -- ${__filename} ${args}`;
+ const filecmd = `${nodejs} -- "${__filename}" ${args}`;
child.exec(filecmd, common.mustCall(function(err, stdout, stderr) {
- assert.strictEqual(stdout, args + '\n');
+ assert.strictEqual(stdout, `${args}\n`);
assert.strictEqual(stderr, '');
assert.strictEqual(err, null);
}));
diff --git a/test/parallel/test-cli-syntax.js b/test/parallel/test-cli-syntax.js
index d7781eddffbb42..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',
@@ -31,7 +34,7 @@ const syntaxArgs = [
// no output should be produced
assert.strictEqual(c.stdout, '', 'stdout produced');
assert.strictEqual(c.stderr, '', 'stderr produced');
- assert.strictEqual(c.status, 0, 'code == ' + c.status);
+ assert.strictEqual(c.status, 0, `code == ${c.status}`);
});
});
@@ -53,10 +56,9 @@ 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);
+ assert.strictEqual(c.status, 1, `code == ${c.status}`);
});
});
@@ -76,9 +78,8 @@ 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);
+ assert.strictEqual(c.status, 1, `code == ${c.status}`);
});
});
diff --git a/test/parallel/test-cluster-bind-twice.js b/test/parallel/test-cluster-bind-twice.js
index af3e89e05ce056..11384d8df939ef 100644
--- a/test/parallel/test-cluster-bind-twice.js
+++ b/test/parallel/test-cluster-bind-twice.js
@@ -33,14 +33,14 @@ if (!id) {
a.on('exit', common.mustCall((c) => {
if (c) {
b.send('QUIT');
- throw new Error('A exited with ' + c);
+ throw new Error(`A exited with ${c}`);
}
}));
b.on('exit', common.mustCall((c) => {
if (c) {
a.send('QUIT');
- throw new Error('B exited with ' + c);
+ throw new Error(`B exited with ${c}`);
}
}));
diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js
index 0d3d435c312916..7acd3a77fe2415 100644
--- a/test/parallel/test-cluster-dgram-1.js
+++ b/test/parallel/test-cluster-dgram-1.js
@@ -9,8 +9,7 @@ const dgram = require('dgram');
if (common.isWindows) {
- common.skip('dgram clustering is currently not supported ' +
- 'on windows.');
+ common.skip('dgram clustering is currently not supported on Windows.');
return;
}
diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js
index 277434f79b7102..a4ee9fb12b20de 100644
--- a/test/parallel/test-cluster-dgram-2.js
+++ b/test/parallel/test-cluster-dgram-2.js
@@ -9,8 +9,7 @@ const assert = require('assert');
if (common.isWindows) {
- common.skip('dgram clustering is currently not supported ' +
- 'on windows.');
+ common.skip('dgram clustering is currently not supported on Windows.');
return;
}
diff --git a/test/parallel/test-cluster-dgram-reuse.js b/test/parallel/test-cluster-dgram-reuse.js
index aed565a3806e97..1472dcc5238a63 100644
--- a/test/parallel/test-cluster-dgram-reuse.js
+++ b/test/parallel/test-cluster-dgram-reuse.js
@@ -5,8 +5,7 @@ const cluster = require('cluster');
const dgram = require('dgram');
if (common.isWindows) {
- common.skip('dgram clustering is currently not supported ' +
- 'on windows.');
+ common.skip('dgram clustering is currently not supported on windows.');
return;
}
@@ -17,24 +16,22 @@ if (cluster.isMaster) {
return;
}
-const sockets = [];
-function next() {
- sockets.push(this);
- if (sockets.length !== 2)
- return;
-
- // Work around health check issue
- process.nextTick(() => {
- for (let i = 0; i < sockets.length; i++)
- sockets[i].close(close);
- });
-}
-
let waiting = 2;
function close() {
if (--waiting === 0)
cluster.worker.disconnect();
}
-for (let i = 0; i < 2; i++)
- dgram.createSocket({ type: 'udp4', reuseAddr: true }).bind(common.PORT, next);
+const options = { type: 'udp4', reuseAddr: true };
+const socket1 = dgram.createSocket(options);
+const socket2 = dgram.createSocket(options);
+
+socket1.bind(0, () => {
+ socket2.bind(socket1.address().port, () => {
+ // Work around health check issue
+ process.nextTick(() => {
+ socket1.close(close);
+ socket2.close(close);
+ });
+ });
+});
diff --git a/test/parallel/test-cluster-disconnect.js b/test/parallel/test-cluster-disconnect.js
index 62ad2956fec4eb..491cae9b1e6c20 100644
--- a/test/parallel/test-cluster-disconnect.js
+++ b/test/parallel/test-cluster-disconnect.js
@@ -7,17 +7,17 @@ const net = require('net');
if (cluster.isWorker) {
net.createServer((socket) => {
socket.end('echo');
- }).listen(common.PORT, '127.0.0.1');
+ }).listen(0, '127.0.0.1');
net.createServer((socket) => {
socket.end('echo');
- }).listen(common.PORT + 1, '127.0.0.1');
-
+ }).listen(0, '127.0.0.1');
} else if (cluster.isMaster) {
const servers = 2;
+ const serverPorts = new Set();
// test a single TCP server
- const testConnection = function(port, cb) {
+ const testConnection = (port, cb) => {
const socket = net.connect(port, '127.0.0.1', () => {
// buffer result
let result = '';
@@ -26,16 +26,18 @@ if (cluster.isWorker) {
// check result
socket.on('end', common.mustCall(() => {
cb(result === 'echo');
+ serverPorts.delete(port);
}));
});
};
// test both servers created in the cluster
- const testCluster = function(cb) {
+ const testCluster = (cb) => {
let done = 0;
+ const portsArray = Array.from(serverPorts);
for (let i = 0; i < servers; i++) {
- testConnection(common.PORT + i, (success) => {
+ testConnection(portsArray[i], (success) => {
assert.ok(success);
done += 1;
if (done === servers) {
@@ -46,12 +48,14 @@ if (cluster.isWorker) {
};
// start two workers and execute callback when both is listening
- const startCluster = function(cb) {
+ const startCluster = (cb) => {
const workers = 8;
let online = 0;
for (let i = 0, l = workers; i < l; i++) {
- cluster.fork().on('listening', common.mustCall(() => {
+ cluster.fork().on('listening', common.mustCall((address) => {
+ serverPorts.add(address.port);
+
online += 1;
if (online === workers * servers) {
cb();
@@ -60,7 +64,7 @@ if (cluster.isWorker) {
}
};
- const test = function(again) {
+ const test = (again) => {
//1. start cluster
startCluster(common.mustCall(() => {
//2. test cluster
diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js
index 75b60248a22381..3682bac69064df 100644
--- a/test/parallel/test-cluster-eaccess.js
+++ b/test/parallel/test-cluster-eaccess.js
@@ -37,7 +37,7 @@ if (cluster.isMaster) {
} else {
common.refreshTmpDir();
- const cp = fork(common.fixturesDir + '/listen-on-socket-and-exit.js',
+ const cp = fork(`${common.fixturesDir}/listen-on-socket-and-exit.js`,
{ stdio: 'inherit' });
// message from the child indicates it's ready and listening
diff --git a/test/parallel/test-cluster-eaddrinuse.js b/test/parallel/test-cluster-eaddrinuse.js
index 8d90ad5c87b553..d25c8507c0a17f 100644
--- a/test/parallel/test-cluster-eaddrinuse.js
+++ b/test/parallel/test-cluster-eaddrinuse.js
@@ -8,8 +8,8 @@ const assert = require('assert');
const fork = require('child_process').fork;
const net = require('net');
-const id = '' + process.argv[2];
-const port = '' + process.argv[3];
+const id = String(process.argv[2]);
+const port = String(process.argv[3]);
if (id === 'undefined') {
const server = net.createServer(common.mustNotCall());
diff --git a/test/parallel/test-cluster-fork-env.js b/test/parallel/test-cluster-fork-env.js
index 55ea684f3b4ce3..112aeb087c49a1 100644
--- a/test/parallel/test-cluster-fork-env.js
+++ b/test/parallel/test-cluster-fork-env.js
@@ -36,8 +36,9 @@ if (cluster.isWorker) {
process.once('exit', function() {
assert.ok(checks.using, 'The worker did not receive the correct env.');
- assert.ok(checks.overwrite, 'The custom environment did not overwrite ' +
- 'the existing environment.');
+ assert.ok(
+ checks.overwrite,
+ 'The custom environment did not overwrite the existing environment.');
});
}
diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js
index 6db581564a124c..bfea393b375666 100644
--- a/test/parallel/test-cluster-http-pipe.js
+++ b/test/parallel/test-cluster-http-pipe.js
@@ -6,8 +6,8 @@ const cluster = require('cluster');
const http = require('http');
if (common.isWindows) {
- common.skip('It is not possible to send pipe handles over ' +
- 'the IPC pipe on Windows');
+ common.skip(
+ 'It is not possible to send pipe handles over the IPC pipe on Windows');
return;
}
diff --git a/test/parallel/test-cluster-master-error.js b/test/parallel/test-cluster-master-error.js
index 11ed09c64ed04e..568d3646a2b382 100644
--- a/test/parallel/test-cluster-master-error.js
+++ b/test/parallel/test-cluster-master-error.js
@@ -10,7 +10,7 @@ if (cluster.isWorker) {
const http = require('http');
http.Server(() => {
- }).listen(common.PORT, '127.0.0.1');
+ }).listen(0, '127.0.0.1');
} else if (process.argv[2] === 'cluster') {
@@ -80,7 +80,7 @@ if (cluster.isWorker) {
// Check that the cluster died accidentally (non-zero exit code)
masterExited = !!code;
- const pollWorkers = function() {
+ const pollWorkers = () => {
// When master is dead all workers should be dead too
let alive = false;
workers.forEach((pid) => alive = common.isAlive(pid));
diff --git a/test/parallel/test-cluster-master-kill.js b/test/parallel/test-cluster-master-kill.js
index 094e5ad256de7d..60700ab1f5733c 100644
--- a/test/parallel/test-cluster-master-kill.js
+++ b/test/parallel/test-cluster-master-kill.js
@@ -7,7 +7,7 @@ if (cluster.isWorker) {
// keep the worker alive
const http = require('http');
- http.Server().listen(common.PORT, '127.0.0.1');
+ http.Server().listen(0, '127.0.0.1');
} else if (process.argv[2] === 'cluster') {
@@ -47,7 +47,7 @@ if (cluster.isWorker) {
assert.strictEqual(code, 0);
// check worker process status
- const pollWorker = function() {
+ const pollWorker = () => {
alive = common.isAlive(pid);
if (alive) {
setTimeout(pollWorker, 50);
diff --git a/test/parallel/test-cluster-message.js b/test/parallel/test-cluster-message.js
index 74c96f2f8342ce..57fb8eb59c7f7c 100644
--- a/test/parallel/test-cluster-message.js
+++ b/test/parallel/test-cluster-message.js
@@ -59,7 +59,7 @@ if (cluster.isWorker) {
let client;
- const check = function(type, result) {
+ const check = (type, result) => {
checks[type].receive = true;
checks[type].correct = result;
console.error('check', checks);
@@ -102,7 +102,7 @@ if (cluster.isWorker) {
if (data.code === 'received message') {
check('worker', data.echo === 'message from master');
} else {
- throw new Error('wrong TCP message recived: ' + data);
+ throw new Error(`wrong TCP message received: ${data}`);
}
});
@@ -118,9 +118,8 @@ if (cluster.isWorker) {
process.once('exit', function() {
forEach(checks, function(check, type) {
- assert.ok(check.receive, 'The ' + type + ' did not receive any message');
- assert.ok(check.correct,
- 'The ' + type + ' did not get the correct message');
+ assert.ok(check.receive, `The ${type} did not receive any message`);
+ assert.ok(check.correct, `The ${type} did not get the correct message`);
});
});
}
diff --git a/test/parallel/test-cluster-net-send.js b/test/parallel/test-cluster-net-send.js
index d375920e91b18b..73442bd4594a9f 100644
--- a/test/parallel/test-cluster-net-send.js
+++ b/test/parallel/test-cluster-net-send.js
@@ -46,8 +46,8 @@ if (process.argv[2] !== 'child') {
socketConnected();
});
- server.listen(common.PORT, function() {
- socket = net.connect(common.PORT, '127.0.0.1', socketConnected);
+ server.listen(0, function() {
+ socket = net.connect(server.address().port, '127.0.0.1', socketConnected);
});
process.on('disconnect', function() {
diff --git a/test/parallel/test-cluster-rr-domain-listen.js b/test/parallel/test-cluster-rr-domain-listen.js
index ee507cd47b2a23..44d6aea560d3c8 100644
--- a/test/parallel/test-cluster-rr-domain-listen.js
+++ b/test/parallel/test-cluster-rr-domain-listen.js
@@ -1,5 +1,5 @@
'use strict';
-const common = require('../common');
+require('../common');
const cluster = require('cluster');
const domain = require('domain');
@@ -11,7 +11,7 @@ if (cluster.isWorker) {
d.run(function() { });
const http = require('http');
- http.Server(function() { }).listen(common.PORT, '127.0.0.1');
+ http.Server(function() { }).listen(0, '127.0.0.1');
} else if (cluster.isMaster) {
let worker;
diff --git a/test/parallel/test-cluster-rr-ref.js b/test/parallel/test-cluster-rr-ref.js
index 19420fed83f9f1..cf5e4f346bf7e2 100644
--- a/test/parallel/test-cluster-rr-ref.js
+++ b/test/parallel/test-cluster-rr-ref.js
@@ -10,7 +10,7 @@ if (cluster.isMaster) {
});
} else {
const server = net.createServer(common.mustNotCall());
- server.listen(common.PORT, function() {
+ server.listen(0, function() {
server.unref();
server.ref();
server.close(function() {
diff --git a/test/parallel/test-cluster-shared-leak.js b/test/parallel/test-cluster-shared-leak.js
index d578ee6373f3b6..a7b3023f3ed3ba 100644
--- a/test/parallel/test-cluster-shared-leak.js
+++ b/test/parallel/test-cluster-shared-leak.js
@@ -13,10 +13,10 @@ if (cluster.isMaster) {
let conn, worker2;
const worker1 = cluster.fork();
- worker1.on('message', common.mustCall(function() {
+ worker1.on('listening', common.mustCall(function(address) {
worker2 = cluster.fork();
worker2.on('online', function() {
- conn = net.connect(common.PORT, common.mustCall(function() {
+ conn = net.connect(address.port, common.mustCall(function() {
worker1.disconnect();
worker2.disconnect();
}));
@@ -48,6 +48,4 @@ const server = net.createServer(function(c) {
c.end('bye');
});
-server.listen(common.PORT, function() {
- process.send('listening');
-});
+server.listen(0);
diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js
index 8f1eceaf9e66ac..80190c1453336f 100644
--- a/test/parallel/test-cluster-worker-exit.js
+++ b/test/parallel/test-cluster-worker-exit.js
@@ -82,7 +82,7 @@ if (cluster.isWorker) {
}
}));
- const finish_test = function() {
+ const finish_test = () => {
try {
checkResults(expected_results, results);
} catch (exc) {
@@ -104,9 +104,8 @@ function checkResults(expected_results, results) {
const actual = results[k];
const expected = expected_results[k];
- assert.strictEqual(actual,
- expected && expected.length ? expected[0] : expected,
- (expected[1] || '') +
- ` [expected: ${expected[0]} / actual: ${actual}]`);
+ assert.strictEqual(
+ actual, expected && expected.length ? expected[0] : expected,
+ `${expected[1] || ''} [expected: ${expected[0]} / actual: ${actual}]`);
}
}
diff --git a/test/parallel/test-cluster-worker-isconnected.js b/test/parallel/test-cluster-worker-isconnected.js
index 8b2ad865899c60..a0ada77bd023b1 100644
--- a/test/parallel/test-cluster-worker-isconnected.js
+++ b/test/parallel/test-cluster-worker-isconnected.js
@@ -1,38 +1,30 @@
'use strict';
-require('../common');
+const common = require('../common');
const cluster = require('cluster');
const assert = require('assert');
if (cluster.isMaster) {
const worker = cluster.fork();
- assert.ok(worker.isConnected(),
- 'isConnected() should return true as soon as the worker has ' +
- 'been created.');
+ assert.strictEqual(worker.isConnected(), true);
- worker.on('disconnect', function() {
- assert.ok(!worker.isConnected(),
- 'After a disconnect event has been emitted, ' +
- 'isConncted should return false');
- });
+ worker.on('disconnect', common.mustCall(() => {
+ assert.strictEqual(worker.isConnected(), false);
+ }));
worker.on('message', function(msg) {
if (msg === 'readyToDisconnect') {
worker.disconnect();
}
});
-
} else {
- assert.ok(cluster.worker.isConnected(),
- 'isConnected() should return true from within a worker at all ' +
- 'times.');
+ function assertNotConnected() {
+ assert.strictEqual(cluster.worker.isConnected(), false);
+ }
- cluster.worker.process.on('disconnect', function() {
- assert.ok(!cluster.worker.isConnected(),
- 'isConnected() should return false from within a worker ' +
- 'after its underlying process has been disconnected from ' +
- 'the master');
- });
+ assert.strictEqual(cluster.worker.isConnected(), true);
+ cluster.worker.on('disconnect', common.mustCall(assertNotConnected));
+ cluster.worker.process.on('disconnect', common.mustCall(assertNotConnected));
process.send('readyToDisconnect');
}
diff --git a/test/parallel/test-cluster-worker-isdead.js b/test/parallel/test-cluster-worker-isdead.js
index cd360ff248aa13..4850f6eae96707 100644
--- a/test/parallel/test-cluster-worker-isdead.js
+++ b/test/parallel/test-cluster-worker-isdead.js
@@ -5,14 +5,13 @@ const assert = require('assert');
if (cluster.isMaster) {
const worker = cluster.fork();
- assert.ok(!worker.isDead(),
- 'isDead() should return false right after the worker has been ' +
- 'created.');
+ assert.ok(
+ !worker.isDead(),
+ 'isDead() should return false right after the worker has been created.');
worker.on('exit', function() {
assert.ok(worker.isDead(),
- 'After an event has been emitted, ' +
- 'isDead should return true');
+ 'After an event has been emitted, isDead should return true');
});
worker.on('message', function(msg) {
diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js
index 050f61ed47b4b7..f642baf7d5b8b0 100644
--- a/test/parallel/test-cluster-worker-kill.js
+++ b/test/parallel/test-cluster-worker-kill.js
@@ -90,9 +90,8 @@ function checkResults(expected_results, results) {
const actual = results[k];
const expected = expected_results[k];
- assert.strictEqual(actual,
- expected && expected.length ? expected[0] : expected,
- (expected[1] || '') +
- ` [expected: ${expected[0]} / actual: ${actual}]`);
+ assert.strictEqual(
+ actual, expected && expected.length ? expected[0] : expected,
+ `${expected[1] || ''} [expected: ${expected[0]} / actual: ${actual}]`);
}
}
diff --git a/test/parallel/test-cluster-worker-no-exit.js b/test/parallel/test-cluster-worker-no-exit.js
index 9cfd8401a0c678..11ecbfef144154 100644
--- a/test/parallel/test-cluster-worker-no-exit.js
+++ b/test/parallel/test-cluster-worker-no-exit.js
@@ -1,5 +1,5 @@
'use strict';
-const common = require('../common');
+require('../common');
const assert = require('assert');
const cluster = require('cluster');
const net = require('net');
@@ -34,7 +34,7 @@ if (cluster.isMaster) {
success = true;
});
- }).listen(common.PORT, function() {
+ }).listen(0, function() {
const port = this.address().port;
worker = cluster.fork()
diff --git a/test/parallel/test-cluster-worker-wait-server-close.js b/test/parallel/test-cluster-worker-wait-server-close.js
index d1a0d73678d67a..1d19398a3d8799 100644
--- a/test/parallel/test-cluster-worker-wait-server-close.js
+++ b/test/parallel/test-cluster-worker-wait-server-close.js
@@ -12,7 +12,7 @@ if (cluster.isWorker) {
// Wait for any data, then close connection
socket.write('.');
socket.on('data', function discard() {});
- }).listen(common.PORT, common.localhostIPv4);
+ }).listen(0, common.localhostIPv4);
server.once('close', function() {
serverClosed = true;
@@ -33,8 +33,8 @@ if (cluster.isWorker) {
const worker = cluster.fork();
// Disconnect worker when it is ready
- worker.once('listening', function() {
- const socket = net.createConnection(common.PORT, common.localhostIPv4);
+ worker.once('listening', function(address) {
+ const socket = net.createConnection(address.port, common.localhostIPv4);
socket.on('connect', function() {
socket.on('data', function() {
diff --git a/test/parallel/test-console-not-call-toString.js b/test/parallel/test-console-not-call-toString.js
index 0c1c209374ac17..211472a35dbf7c 100644
--- a/test/parallel/test-console-not-call-toString.js
+++ b/test/parallel/test-console-not-call-toString.js
@@ -2,7 +2,7 @@
require('../common');
const assert = require('assert');
-const func = function() {};
+function func() {}
let toStringCalled = false;
func.toString = function() {
toStringCalled = true;
diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js
index 64dc75caa02e01..4618bbd28cf091 100644
--- a/test/parallel/test-console.js
+++ b/test/parallel/test-console.js
@@ -102,13 +102,13 @@ const expectedStrings = [
];
for (const expected of expectedStrings) {
- assert.strictEqual(expected + '\n', strings.shift());
- assert.strictEqual(expected + '\n', errStrings.shift());
+ assert.strictEqual(`${expected}\n`, strings.shift());
+ assert.strictEqual(`${expected}\n`, errStrings.shift());
}
for (const expected of expectedStrings) {
- assert.strictEqual(expected + '\n', strings.shift());
- assert.strictEqual(expected + '\n', errStrings.shift());
+ assert.strictEqual(`${expected}\n`, strings.shift());
+ assert.strictEqual(`${expected}\n`, errStrings.shift());
}
assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js
index 1a628023b5c46e..b92d6d681d55c8 100644
--- a/test/parallel/test-crypto-authenticated.js
+++ b/test/parallel/test-crypto-authenticated.js
@@ -307,13 +307,20 @@ 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) {
const test = TEST_CASES[i];
if (!ciphers.includes(test.algo)) {
- common.skip('unsupported ' + test.algo + ' test');
+ common.skip(`unsupported ${test.algo} test`);
continue;
}
@@ -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-binary-default.js b/test/parallel/test-crypto-binary-default.js
index 6ee3aeac36dd89..987fdbc046d940 100644
--- a/test/parallel/test-crypto-binary-default.js
+++ b/test/parallel/test-crypto-binary-default.js
@@ -16,17 +16,16 @@ const fs = require('fs');
const path = require('path');
const tls = require('tls');
const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR;
+const fixtDir = common.fixturesDir;
crypto.DEFAULT_ENCODING = 'latin1';
// Test Certificates
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
-const rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem',
- 'ascii');
-const rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem',
- 'ascii');
+const certPem = fs.readFileSync(`${fixtDir}/test_cert.pem`, 'ascii');
+const certPfx = fs.readFileSync(`${fixtDir}/test_cert.pfx`);
+const keyPem = fs.readFileSync(`${fixtDir}/test_key.pem`, 'ascii');
+const rsaPubPem = fs.readFileSync(`${fixtDir}/test_rsa_pubkey.pem`, 'ascii');
+const rsaKeyPem = fs.readFileSync(`${fixtDir}/test_rsa_privkey.pem`, 'ascii');
// PFX tests
assert.doesNotThrow(function() {
@@ -387,7 +386,7 @@ const h2 = crypto.createHash('sha1').update('Test').update('123').digest('hex');
assert.strictEqual(h1, h2, 'multipled updates');
// Test hashing for binary files
-const fn = path.join(common.fixturesDir, 'sample.png');
+const fn = path.join(fixtDir, 'sample.png');
const sha1Hash = crypto.createHash('sha1');
const fileStream = fs.createReadStream(fn);
fileStream.on('data', function(data) {
@@ -596,11 +595,9 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
// Test RSA signing and verification
//
{
- const privateKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_privkey_2.pem');
+ const privateKey = fs.readFileSync(`${fixtDir}/test_rsa_privkey_2.pem`);
- const publicKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_pubkey_2.pem');
+ const publicKey = fs.readFileSync(`${fixtDir}/test_rsa_pubkey_2.pem`);
const input = 'I AM THE WALRUS';
@@ -628,11 +625,9 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
// Test DSA signing and verification
//
{
- const privateKey = fs.readFileSync(
- common.fixturesDir + '/test_dsa_privkey.pem');
+ const privateKey = fs.readFileSync(`${fixtDir}/test_dsa_privkey.pem`);
- const publicKey = fs.readFileSync(
- common.fixturesDir + '/test_dsa_pubkey.pem');
+ const publicKey = fs.readFileSync(`${fixtDir}/test_dsa_pubkey.pem`);
const input = 'I AM THE WALRUS';
diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js
index c051716556410d..fe47b3ff49455e 100644
--- a/test/parallel/test-crypto-certificate.js
+++ b/test/parallel/test-crypto-certificate.js
@@ -13,9 +13,9 @@ crypto.DEFAULT_ENCODING = 'buffer';
const fs = require('fs');
// Test Certificates
-const spkacValid = fs.readFileSync(common.fixturesDir + '/spkac.valid');
-const spkacFail = fs.readFileSync(common.fixturesDir + '/spkac.fail');
-const spkacPem = fs.readFileSync(common.fixturesDir + '/spkac.pem');
+const spkacValid = fs.readFileSync(`${common.fixturesDir}/spkac.valid`);
+const spkacFail = fs.readFileSync(`${common.fixturesDir}/spkac.fail`);
+const spkacPem = fs.readFileSync(`${common.fixturesDir}/spkac.pem`);
const certificate = new crypto.Certificate();
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 cfe896026f6af5..ccc30353af6867 100644
--- a/test/parallel/test-crypto-dh.js
+++ b/test/parallel/test-crypto-dh.js
@@ -19,25 +19,28 @@ let key2 = dh2.generateKeys('hex');
let secret1 = dh1.computeSecret(key2, 'hex', 'base64');
let secret2 = dh2.computeSecret(key1, 'latin1', 'buffer');
-assert.strictEqual(secret1, secret2.toString('base64'));
+assert.strictEqual(secret2.toString('base64'), secret1);
assert.strictEqual(dh1.verifyError, 0);
assert.strictEqual(dh2.verifyError, 0);
-assert.throws(function() {
+const argumentsError =
+ /^TypeError: First argument should be number, string or Buffer$/;
+
+assert.throws(() => {
crypto.createDiffieHellman([0x1, 0x2]);
-});
+}, argumentsError);
-assert.throws(function() {
- crypto.createDiffieHellman(function() { });
-});
+assert.throws(() => {
+ crypto.createDiffieHellman(() => { });
+}, argumentsError);
-assert.throws(function() {
+assert.throws(() => {
crypto.createDiffieHellman(/abc/);
-});
+}, argumentsError);
-assert.throws(function() {
+assert.throws(() => {
crypto.createDiffieHellman({});
-});
+}, argumentsError);
// Create "another dh1" using generated keys from dh1,
// and compute secret again
@@ -56,21 +59,29 @@ const secret3 = dh3.computeSecret(key2, 'hex', 'base64');
assert.strictEqual(secret1, secret3);
+const wrongBlockLength =
+ new RegExp('^Error: error:0606506D:digital envelope' +
+ ' routines:EVP_DecryptFinal_ex:wrong final block length$');
+
// Run this one twice to make sure that the dh3 clears its error properly
{
const c = crypto.createDecipheriv('aes-128-ecb', crypto.randomBytes(16), '');
- assert.throws(function() { c.final('utf8'); }, /wrong final block length/);
+ assert.throws(() => {
+ c.final('utf8');
+ }, wrongBlockLength);
}
-assert.throws(function() {
- dh3.computeSecret('');
-}, /key is too small/i);
-
{
const c = crypto.createDecipheriv('aes-128-ecb', crypto.randomBytes(16), '');
- assert.throws(function() { c.final('utf8'); }, /wrong final block length/);
+ assert.throws(() => {
+ c.final('utf8');
+ }, wrongBlockLength);
}
+assert.throws(() => {
+ dh3.computeSecret('');
+}, /^Error: Supplied key is too small$/);
+
// Create a shared using a DH group.
const alice = crypto.createDiffieHellmanGroup('modp5');
const bob = crypto.createDiffieHellmanGroup('modp5');
@@ -150,125 +161,158 @@ const bad_dh = crypto.createDiffieHellman(p, 'hex');
assert.strictEqual(bad_dh.verifyError, DH_NOT_SUITABLE_GENERATOR);
-// Test ECDH
-const ecdh1 = crypto.createECDH('prime256v1');
-const ecdh2 = crypto.createECDH('prime256v1');
-key1 = ecdh1.generateKeys();
-key2 = ecdh2.generateKeys('hex');
-secret1 = ecdh1.computeSecret(key2, 'hex', 'base64');
-secret2 = ecdh2.computeSecret(key1, 'latin1', 'buffer');
-
-assert.strictEqual(secret1, secret2.toString('base64'));
+const availableCurves = new Set(crypto.getCurves());
// Oakley curves do not clean up ERR stack, it was causing unexpected failure
// when accessing other OpenSSL APIs afterwards.
-crypto.createECDH('Oakley-EC2N-3');
-crypto.createHash('sha256');
-
-// Point formats
-assert.strictEqual(ecdh1.getPublicKey('buffer', 'uncompressed')[0], 4);
-let firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0];
-assert(firstByte === 2 || firstByte === 3);
-firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0];
-assert(firstByte === 6 || firstByte === 7);
-// format value should be string
-assert.throws(() => {
- ecdh1.getPublicKey('buffer', 10);
-}, /^TypeError: Bad format: 10$/);
-
-// ECDH should check that point is on curve
-const ecdh3 = crypto.createECDH('secp256k1');
-const key3 = ecdh3.generateKeys();
-
-assert.throws(function() {
- ecdh2.computeSecret(key3, 'latin1', 'buffer');
-});
-
-// ECDH should allow .setPrivateKey()/.setPublicKey()
-const ecdh4 = crypto.createECDH('prime256v1');
-
-ecdh4.setPrivateKey(ecdh1.getPrivateKey());
-ecdh4.setPublicKey(ecdh1.getPublicKey());
-
-assert.throws(function() {
- ecdh4.setPublicKey(ecdh3.getPublicKey());
-}, /Failed to convert Buffer to EC_POINT/);
-
-// Verify that we can use ECDH without having to use newly generated keys.
-const ecdh5 = crypto.createECDH('secp256k1');
-
-// Verify errors are thrown when retrieving keys from an uninitialized object.
-assert.throws(function() {
- ecdh5.getPublicKey();
-}, /Failed to get ECDH public key/);
-assert.throws(function() {
- ecdh5.getPrivateKey();
-}, /Failed to get ECDH private key/);
-
-// A valid private key for the secp256k1 curve.
-const cafebabeKey = 'cafebabe'.repeat(8);
-// Associated compressed and uncompressed public keys (points).
-const cafebabePubPtComp =
-'03672a31bfc59d3f04548ec9b7daeeba2f61814e8ccc40448045007f5479f693a3';
-const cafebabePubPtUnComp =
-'04672a31bfc59d3f04548ec9b7daeeba2f61814e8ccc40448045007f5479f693a3' +
-'2e02c7f93d13dc2732b760ca377a5897b9dd41a1c1b29dc0442fdce6d0a04d1d';
-ecdh5.setPrivateKey(cafebabeKey, 'hex');
-assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey);
-// Show that the public point (key) is generated while setting the private key.
-assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
-
-// Compressed and uncompressed public points/keys for other party's private key
-// 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF
-const peerPubPtComp =
-'02c6b754b20826eb925e052ee2c25285b162b51fdca732bcf67e39d647fb6830ae';
-const peerPubPtUnComp =
-'04c6b754b20826eb925e052ee2c25285b162b51fdca732bcf67e39d647fb6830ae' +
-'b651944a574a362082a77e3f2b5d9223eb54d7f2f76846522bf75f3bedb8178e';
-
-const sharedSecret =
-'1da220b5329bbe8bfd19ceef5a5898593f411a6f12ea40f2a8eead9a5cf59970';
-
-assert.strictEqual(ecdh5.computeSecret(peerPubPtComp, 'hex', 'hex'),
- sharedSecret);
-assert.strictEqual(ecdh5.computeSecret(peerPubPtUnComp, 'hex', 'hex'),
- sharedSecret);
-
-// Verify that we still have the same key pair as before the computation.
-assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey);
-assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
-
-// Verify setting and getting compressed and non-compressed serializations.
-ecdh5.setPublicKey(cafebabePubPtComp, 'hex');
-assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
-assert.strictEqual(ecdh5.getPublicKey('hex', 'compressed'), cafebabePubPtComp);
-ecdh5.setPublicKey(cafebabePubPtUnComp, 'hex');
-assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
-assert.strictEqual(ecdh5.getPublicKey('hex', 'compressed'), cafebabePubPtComp);
-
-// Show why allowing the public key to be set on this type does not make sense.
-ecdh5.setPublicKey(peerPubPtComp, 'hex');
-assert.strictEqual(ecdh5.getPublicKey('hex'), peerPubPtUnComp);
-assert.throws(function() {
- // Error because the public key does not match the private key anymore.
- ecdh5.computeSecret(peerPubPtComp, 'hex', 'hex');
-}, /Invalid key pair/);
-
-// Set to a valid key to show that later attempts to set an invalid key are
-// rejected.
-ecdh5.setPrivateKey(cafebabeKey, 'hex');
-
-[ // Some invalid private keys for the secp256k1 curve.
- '0000000000000000000000000000000000000000000000000000000000000000',
- 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141',
- 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
-].forEach(function(element, index, object) {
- assert.throws(function() {
- ecdh5.setPrivateKey(element, 'hex');
- }, /Private key is not valid for specified curve/);
- // Verify object state did not change.
+if (availableCurves.has('Oakley-EC2N-3')) {
+ crypto.createECDH('Oakley-EC2N-3');
+ crypto.createHash('sha256');
+}
+
+// Test ECDH
+if (availableCurves.has('prime256v1') && availableCurves.has('secp256k1')) {
+ const ecdh1 = crypto.createECDH('prime256v1');
+ const ecdh2 = crypto.createECDH('prime256v1');
+ key1 = ecdh1.generateKeys();
+ key2 = ecdh2.generateKeys('hex');
+ secret1 = ecdh1.computeSecret(key2, 'hex', 'base64');
+ secret2 = ecdh2.computeSecret(key1, 'latin1', 'buffer');
+
+ assert.strictEqual(secret1, secret2.toString('base64'));
+
+ // Point formats
+ assert.strictEqual(ecdh1.getPublicKey('buffer', 'uncompressed')[0], 4);
+ let firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0];
+ assert(firstByte === 2 || firstByte === 3);
+ firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0];
+ assert(firstByte === 6 || firstByte === 7);
+ // format value should be string
+ assert.throws(() => {
+ ecdh1.getPublicKey('buffer', 10);
+ }, /^TypeError: Bad format: 10$/);
+
+ // ECDH should check that point is on curve
+ const ecdh3 = crypto.createECDH('secp256k1');
+ const key3 = ecdh3.generateKeys();
+
+ assert.throws(() => {
+ ecdh2.computeSecret(key3, 'latin1', 'buffer');
+ }, /^Error: Failed to translate Buffer to a EC_POINT$/);
+
+ // ECDH should allow .setPrivateKey()/.setPublicKey()
+ const ecdh4 = crypto.createECDH('prime256v1');
+
+ ecdh4.setPrivateKey(ecdh1.getPrivateKey());
+ ecdh4.setPublicKey(ecdh1.getPublicKey());
+
+ assert.throws(() => {
+ ecdh4.setPublicKey(ecdh3.getPublicKey());
+ }, /^Error: Failed to convert Buffer to EC_POINT$/);
+
+ // Verify that we can use ECDH without having to use newly generated keys.
+ const ecdh5 = crypto.createECDH('secp256k1');
+
+ // Verify errors are thrown when retrieving keys from an uninitialized object.
+ assert.throws(() => {
+ ecdh5.getPublicKey();
+ }, /^Error: Failed to get ECDH public key$/);
+
+ assert.throws(() => {
+ ecdh5.getPrivateKey();
+ }, /^Error: Failed to get ECDH private key$/);
+
+ // A valid private key for the secp256k1 curve.
+ const cafebabeKey = 'cafebabe'.repeat(8);
+ // Associated compressed and uncompressed public keys (points).
+ const cafebabePubPtComp =
+ '03672a31bfc59d3f04548ec9b7daeeba2f61814e8ccc40448045007f5479f693a3';
+ const cafebabePubPtUnComp =
+ '04672a31bfc59d3f04548ec9b7daeeba2f61814e8ccc40448045007f5479f693a3' +
+ '2e02c7f93d13dc2732b760ca377a5897b9dd41a1c1b29dc0442fdce6d0a04d1d';
+ ecdh5.setPrivateKey(cafebabeKey, 'hex');
assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey);
-});
+ // Show that the public point (key) is generated while setting the
+ // private key.
+ assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
+
+ // Compressed and uncompressed public points/keys for other party's
+ // private key.
+ // 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF
+ const peerPubPtComp =
+ '02c6b754b20826eb925e052ee2c25285b162b51fdca732bcf67e39d647fb6830ae';
+ const peerPubPtUnComp =
+ '04c6b754b20826eb925e052ee2c25285b162b51fdca732bcf67e39d647fb6830ae' +
+ 'b651944a574a362082a77e3f2b5d9223eb54d7f2f76846522bf75f3bedb8178e';
+
+ const sharedSecret =
+ '1da220b5329bbe8bfd19ceef5a5898593f411a6f12ea40f2a8eead9a5cf59970';
+
+ assert.strictEqual(ecdh5.computeSecret(peerPubPtComp, 'hex', 'hex'),
+ sharedSecret);
+ assert.strictEqual(ecdh5.computeSecret(peerPubPtUnComp, 'hex', 'hex'),
+ sharedSecret);
+
+ // Verify that we still have the same key pair as before the computation.
+ assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey);
+ assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
+
+ // Verify setting and getting compressed and non-compressed serializations.
+ ecdh5.setPublicKey(cafebabePubPtComp, 'hex');
+ assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
+ assert.strictEqual(ecdh5.getPublicKey('hex', 'compressed'),
+ cafebabePubPtComp);
+ ecdh5.setPublicKey(cafebabePubPtUnComp, 'hex');
+ assert.strictEqual(ecdh5.getPublicKey('hex'), cafebabePubPtUnComp);
+ assert.strictEqual(ecdh5.getPublicKey('hex', 'compressed'),
+ cafebabePubPtComp);
+
+ // Show why allowing the public key to be set on this type
+ // does not make sense.
+ ecdh5.setPublicKey(peerPubPtComp, 'hex');
+ assert.strictEqual(ecdh5.getPublicKey('hex'), peerPubPtUnComp);
+ assert.throws(() => {
+ // Error because the public key does not match the private key anymore.
+ ecdh5.computeSecret(peerPubPtComp, 'hex', 'hex');
+ }, /^Error: Invalid key pair$/);
+
+ // Set to a valid key to show that later attempts to set an invalid key are
+ // rejected.
+ ecdh5.setPrivateKey(cafebabeKey, 'hex');
+
+ // 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');
+ }, errMessage);
+ // Verify object state did not change.
+ assert.strictEqual(ecdh5.getPrivateKey('hex'), cafebabeKey);
+ });
+
+ // Use of invalid keys was not cleaning up ERR stack, and was causing
+ // unexpected failure in subsequent signing operations.
+ const ecdh6 = crypto.createECDH('prime256v1');
+ const invalidKey = Buffer.alloc(65);
+ invalidKey.fill('\0');
+ ecdh6.generateKeys();
+ assert.throws(() => {
+ ecdh6.computeSecret(invalidKey);
+ }, /^Error: Failed to translate Buffer to a EC_POINT$/);
+ // Check that signing operations are not impacted by the above error.
+ const ecPrivateKey =
+ '-----BEGIN EC PRIVATE KEY-----\n' +
+ 'MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49\n' +
+ 'AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2\n' +
+ 'pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng==\n' +
+ '-----END EC PRIVATE KEY-----';
+ assert.doesNotThrow(() => {
+ crypto.createSign('SHA256').sign(ecPrivateKey);
+ });
+}
// invalid test: curve argument is undefined
assert.throws(() => {
diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js
index 0b5c0a04584300..b5d89593b923d2 100644
--- a/test/parallel/test-crypto-fips.js
+++ b/test/parallel/test-crypto-fips.js
@@ -31,19 +31,18 @@ function addToEnv(newVar, value) {
}
function testHelper(stream, args, expectedOutput, cmd, env) {
- const fullArgs = args.concat(['-e', 'console.log(' + cmd + ')']);
+ const fullArgs = args.concat(['-e', `console.log(${cmd})`]);
const child = spawnSync(process.execPath, fullArgs, {
cwd: path.dirname(process.execPath),
env: env
});
- console.error('Spawned child [pid:' + child.pid + '] with cmd \'' +
- cmd + '\' expect %j with args \'' + args + '\'' +
- ' OPENSSL_CONF=%j', expectedOutput, env.OPENSSL_CONF);
+ console.error(
+ `Spawned child [pid:${child.pid}] with cmd '${cmd}' expect %j with args '${
+ args}' OPENSSL_CONF=%j`, expectedOutput, env.OPENSSL_CONF);
function childOk(child) {
- console.error('Child #' + ++num_children_ok +
- ' [pid:' + child.pid + '] OK.');
+ console.error(`Child #${++num_children_ok} [pid:${child.pid}] OK.`);
}
function responseHandler(buffer, expectedOutput) {
diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js
index 0d55d4236a656e..28f0f2f30349ba 100644
--- a/test/parallel/test-crypto-hash.js
+++ b/test/parallel/test-crypto-hash.js
@@ -108,10 +108,12 @@ const h3 = crypto.createHash('sha256');
h3.digest();
assert.throws(function() {
h3.digest();
-},
- /Digest already called/);
+}, /Digest already called/);
assert.throws(function() {
h3.update('foo');
-},
- /Digest already called/);
+}, /Digest already called/);
+
+assert.throws(function() {
+ crypto.createHash('sha256').digest('ucs2');
+}, /^Error: hash\.digest\(\) does not support UTF-16$/);
diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js
index a3372bcb7242b9..94c5cefa058d02 100644
--- a/test/parallel/test-crypto-hmac.js
+++ b/test/parallel/test-crypto-hmac.js
@@ -377,3 +377,7 @@ for (let i = 0, l = rfc2202_sha1.length; i < l; i++) {
`Test HMAC-SHA1 : Test case ${i + 1} rfc 2202`
);
}
+
+assert.throws(function() {
+ crypto.createHmac('sha256', 'w00t').digest('ucs2');
+}, /^Error: hmac\.digest\(\) does not support UTF-16$/);
diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js
index 40bbfed0f2824f..0e302f22e06fbd 100644
--- a/test/parallel/test-crypto-padding-aes256.js
+++ b/test/parallel/test-crypto-padding-aes256.js
@@ -13,7 +13,7 @@ crypto.DEFAULT_ENCODING = 'buffer';
function aes256(decipherFinal) {
const iv = Buffer.from('00000000000000000000000000000000', 'hex');
const key = Buffer.from('0123456789abcdef0123456789abcdef' +
- '0123456789abcdef0123456789abcdef', 'hex');
+ '0123456789abcdef0123456789abcdef', 'hex');
function encrypt(val, pad) {
const c = crypto.createCipheriv('aes256', key, iv);
diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js
index 70905a8a9bd1e7..7dbccdcf8639f7 100644
--- a/test/parallel/test-crypto-padding.js
+++ b/test/parallel/test-crypto-padding.js
@@ -45,8 +45,7 @@ const EVEN_LENGTH_ENCRYPTED =
// openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \
// -iv 626c616846697a7a3230313142757a7a -nopad | xxd -p -c256
const EVEN_LENGTH_ENCRYPTED_NOPAD =
- '7f57859550d4d2fdb9806da2a750461ab46e' +
- '71b3d78ebe2d9684dfc87f7575b9';
+ '7f57859550d4d2fdb9806da2a750461ab46e71b3d78ebe2d9684dfc87f7575b9';
/*
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
index e15efe1a73cd3c..5189da15174aa7 100644
--- a/test/parallel/test-crypto-rsa-dsa.js
+++ b/test/parallel/test-crypto-rsa-dsa.js
@@ -10,21 +10,22 @@ if (!common.hasCrypto) {
}
const crypto = require('crypto');
+const fixtDir = common.fixturesDir;
+
// Test certificates
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
-const rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem',
- 'ascii');
-const rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem',
- 'ascii');
+const certPem = fs.readFileSync(`${fixtDir}/test_cert.pem`, 'ascii');
+const keyPem = fs.readFileSync(`${fixtDir}/test_key.pem`, 'ascii');
+const rsaPubPem = fs.readFileSync(`${fixtDir}/test_rsa_pubkey.pem`, 'ascii');
+const rsaKeyPem = fs.readFileSync(`${fixtDir}/test_rsa_privkey.pem`, 'ascii');
const rsaKeyPemEncrypted = fs.readFileSync(
- common.fixturesDir + '/test_rsa_privkey_encrypted.pem', 'ascii');
-const dsaPubPem = fs.readFileSync(common.fixturesDir + '/test_dsa_pubkey.pem',
- 'ascii');
-const dsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_dsa_privkey.pem',
- 'ascii');
+ `${fixtDir}/test_rsa_privkey_encrypted.pem`, 'ascii');
+const dsaPubPem = fs.readFileSync(`${fixtDir}/test_dsa_pubkey.pem`, 'ascii');
+const dsaKeyPem = fs.readFileSync(`${fixtDir}/test_dsa_privkey.pem`, 'ascii');
const dsaKeyPemEncrypted = fs.readFileSync(
- common.fixturesDir + '/test_dsa_privkey_encrypted.pem', 'ascii');
+ `${fixtDir}/test_dsa_privkey_encrypted.pem`, 'ascii');
+
+const decryptError = new RegExp('^Error: error:06065064:digital envelope ' +
+ 'routines:EVP_DecryptFinal_ex:bad decrypt$');
// Test RSA encryption/decryption
{
@@ -34,13 +35,13 @@ const dsaKeyPemEncrypted = fs.readFileSync(
let encryptedBuffer = crypto.publicEncrypt(rsaPubPem, bufferToEncrypt);
let decryptedBuffer = crypto.privateDecrypt(rsaKeyPem, encryptedBuffer);
- assert.strictEqual(input, decryptedBuffer.toString());
+ assert.strictEqual(decryptedBuffer.toString(), input);
let decryptedBufferWithPassword = crypto.privateDecrypt({
key: rsaKeyPemEncrypted,
passphrase: 'password'
}, encryptedBuffer);
- assert.strictEqual(input, decryptedBufferWithPassword.toString());
+ assert.strictEqual(decryptedBufferWithPassword.toString(), input);
encryptedBuffer = crypto.publicEncrypt({
key: rsaKeyPemEncrypted,
@@ -51,7 +52,7 @@ const dsaKeyPemEncrypted = fs.readFileSync(
key: rsaKeyPemEncrypted,
passphrase: 'password'
}, encryptedBuffer);
- assert.strictEqual(input, decryptedBufferWithPassword.toString());
+ assert.strictEqual(decryptedBufferWithPassword.toString(), input);
encryptedBuffer = crypto.privateEncrypt({
key: rsaKeyPemEncrypted,
@@ -62,53 +63,53 @@ const dsaKeyPemEncrypted = fs.readFileSync(
key: rsaKeyPemEncrypted,
passphrase: Buffer.from('password')
}, encryptedBuffer);
- assert.strictEqual(input, decryptedBufferWithPassword.toString());
+ assert.strictEqual(decryptedBufferWithPassword.toString(), input);
encryptedBuffer = crypto.publicEncrypt(certPem, bufferToEncrypt);
decryptedBuffer = crypto.privateDecrypt(keyPem, encryptedBuffer);
- assert.strictEqual(input, decryptedBuffer.toString());
+ assert.strictEqual(decryptedBuffer.toString(), input);
encryptedBuffer = crypto.publicEncrypt(keyPem, bufferToEncrypt);
decryptedBuffer = crypto.privateDecrypt(keyPem, encryptedBuffer);
- assert.strictEqual(input, decryptedBuffer.toString());
+ assert.strictEqual(decryptedBuffer.toString(), input);
encryptedBuffer = crypto.privateEncrypt(keyPem, bufferToEncrypt);
decryptedBuffer = crypto.publicDecrypt(keyPem, encryptedBuffer);
- assert.strictEqual(input, decryptedBuffer.toString());
+ assert.strictEqual(decryptedBuffer.toString(), input);
- assert.throws(function() {
+ assert.throws(() => {
crypto.privateDecrypt({
key: rsaKeyPemEncrypted,
passphrase: 'wrong'
}, bufferToEncrypt);
- });
+ }, decryptError);
- assert.throws(function() {
+ assert.throws(() => {
crypto.publicEncrypt({
key: rsaKeyPemEncrypted,
passphrase: 'wrong'
}, encryptedBuffer);
- });
+ }, decryptError);
encryptedBuffer = crypto.privateEncrypt({
key: rsaKeyPemEncrypted,
passphrase: Buffer.from('password')
}, bufferToEncrypt);
- assert.throws(function() {
+ assert.throws(() => {
crypto.publicDecrypt({
key: rsaKeyPemEncrypted,
passphrase: [].concat.apply([], Buffer.from('password'))
}, encryptedBuffer);
- });
+ }, decryptError);
}
function test_rsa(padding) {
- const input = Buffer
- .allocUnsafe(padding === 'RSA_NO_PADDING' ? 1024 / 8 : 32);
+ const size = (padding === 'RSA_NO_PADDING') ? 1024 / 8 : 32;
+ const input = Buffer.allocUnsafe(size);
for (let i = 0; i < input.length; i++)
input[i] = (i * 7 + 11) & 0xff;
const bufferToEncrypt = Buffer.from(input);
@@ -124,7 +125,7 @@ function test_rsa(padding) {
key: rsaKeyPem,
padding: padding
}, encryptedBuffer);
- assert.strictEqual(input.toString(), decryptedBuffer.toString());
+ assert.deepStrictEqual(decryptedBuffer, input);
}
test_rsa('RSA_NO_PADDING');
@@ -137,14 +138,16 @@ let rsaVerify = crypto.createVerify('RSA-SHA1');
assert.ok(rsaSign);
assert.ok(rsaVerify);
+const expectedSignature =
+ '5c50e3145c4e2497aadb0eabc83b342d0b0021ece0d4c4a064b7c' +
+ '8f020d7e2688b122bfb54c724ac9ee169f83f66d2fe90abeb95e8' +
+ 'e1290e7e177152a4de3d944cf7d4883114a20ed0f78e70e25ef0f' +
+ '60f06b858e6af42a2f276ede95bbc6bc9a9bbdda15bd663186a6f' +
+ '40819a7af19e577bb2efa5e579a1f5ce8a0d4ca8b8f6';
+
rsaSign.update(rsaPubPem);
let rsaSignature = rsaSign.sign(rsaKeyPem, 'hex');
-assert.strictEqual(rsaSignature,
- '5c50e3145c4e2497aadb0eabc83b342d0b0021ece0d4c4a064b7c' +
- '8f020d7e2688b122bfb54c724ac9ee169f83f66d2fe90abeb95e8' +
- 'e1290e7e177152a4de3d944cf7d4883114a20ed0f78e70e25ef0f' +
- '60f06b858e6af42a2f276ede95bbc6bc9a9bbdda15bd663186a6f' +
- '40819a7af19e577bb2efa5e579a1f5ce8a0d4ca8b8f6');
+assert.strictEqual(rsaSignature, expectedSignature);
rsaVerify.update(rsaPubPem);
assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
@@ -152,16 +155,11 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
// Test RSA key signing/verification with encrypted key
rsaSign = crypto.createSign('RSA-SHA1');
rsaSign.update(rsaPubPem);
-assert.doesNotThrow(function() {
+assert.doesNotThrow(() => {
const signOptions = { key: rsaKeyPemEncrypted, passphrase: 'password' };
rsaSignature = rsaSign.sign(signOptions, 'hex');
});
-assert.strictEqual(rsaSignature,
- '5c50e3145c4e2497aadb0eabc83b342d0b0021ece0d4c4a064b7c' +
- '8f020d7e2688b122bfb54c724ac9ee169f83f66d2fe90abeb95e8' +
- 'e1290e7e177152a4de3d944cf7d4883114a20ed0f78e70e25ef0f' +
- '60f06b858e6af42a2f276ede95bbc6bc9a9bbdda15bd663186a6f' +
- '40819a7af19e577bb2efa5e579a1f5ce8a0d4ca8b8f6');
+assert.strictEqual(rsaSignature, expectedSignature);
rsaVerify = crypto.createVerify('RSA-SHA1');
rsaVerify.update(rsaPubPem);
@@ -169,20 +167,18 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true);
rsaSign = crypto.createSign('RSA-SHA1');
rsaSign.update(rsaPubPem);
-assert.throws(function() {
+assert.throws(() => {
const signOptions = { key: rsaKeyPemEncrypted, passphrase: 'wrong' };
rsaSign.sign(signOptions, 'hex');
-});
+}, decryptError);
//
// Test RSA signing and verification
//
{
- const privateKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_privkey_2.pem');
+ const privateKey = fs.readFileSync(`${fixtDir}/test_rsa_privkey_2.pem`);
- const publicKey = fs.readFileSync(
- common.fixturesDir + '/test_rsa_pubkey_2.pem');
+ const publicKey = fs.readFileSync(`${fixtDir}/test_rsa_pubkey_2.pem`);
const input = 'I AM THE WALRUS';
@@ -197,7 +193,7 @@ assert.throws(function() {
sign.update(input);
const output = sign.sign(privateKey, 'hex');
- assert.strictEqual(output, signature);
+ assert.strictEqual(signature, output);
const verify = crypto.createVerify('RSA-SHA256');
verify.update(input);
@@ -233,9 +229,9 @@ const input = 'I AM THE WALRUS';
{
const sign = crypto.createSign('DSS1');
sign.update(input);
- assert.throws(function() {
+ assert.throws(() => {
sign.sign({ key: dsaKeyPemEncrypted, passphrase: 'wrong' }, 'hex');
- });
+ }, decryptError);
}
{
@@ -245,7 +241,7 @@ const input = 'I AM THE WALRUS';
sign.update(input);
let signature;
- assert.doesNotThrow(function() {
+ assert.doesNotThrow(() => {
const signOptions = { key: dsaKeyPemEncrypted, passphrase: 'password' };
signature = sign.sign(signOptions, 'hex');
});
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
index 81b2c109b69b20..3fe98647a7776a 100644
--- a/test/parallel/test-crypto-sign-verify.js
+++ b/test/parallel/test-crypto-sign-verify.js
@@ -10,8 +10,8 @@ if (!common.hasCrypto) {
const crypto = require('crypto');
// Test certificates
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
+const certPem = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`, 'ascii');
+const keyPem = fs.readFileSync(`${common.fixturesDir}/test_key.pem`, 'ascii');
// Test signing and verifying
{
diff --git a/test/parallel/test-crypto-verify-failure.js b/test/parallel/test-crypto-verify-failure.js
index 7e11522f6ddc85..c21858b16a1fb1 100644
--- a/test/parallel/test-crypto-verify-failure.js
+++ b/test/parallel/test-crypto-verify-failure.js
@@ -12,11 +12,11 @@ crypto.DEFAULT_ENCODING = 'buffer';
const fs = require('fs');
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
+const certPem = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`, 'ascii');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.Server(options, (socket) => {
diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js
index 5edf748994ebdd..a923694f3d7b61 100644
--- a/test/parallel/test-crypto.js
+++ b/test/parallel/test-crypto.js
@@ -14,10 +14,10 @@ const tls = require('tls');
crypto.DEFAULT_ENCODING = 'buffer';
// Test Certificates
-const caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii');
-const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
-const certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
-const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
+const caPem = fs.readFileSync(`${common.fixturesDir}/test_ca.pem`, 'ascii');
+const certPem = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`, 'ascii');
+const certPfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`);
+const keyPem = fs.readFileSync(`${common.fixturesDir}/test_key.pem`, 'ascii');
// 'this' safety
// https://github.com/joyent/node/issues/6690
@@ -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.
@@ -156,8 +157,8 @@ assert.throws(function() {
// $ openssl pkcs8 -topk8 -inform PEM -outform PEM -in mykey.pem \
// -out private_key.pem -nocrypt;
// Then open private_key.pem and change its header and footer.
- const sha1_privateKey = fs.readFileSync(common.fixturesDir +
- '/test_bad_rsa_privkey.pem', 'ascii');
+ const sha1_privateKey = fs.readFileSync(
+ `${common.fixturesDir}/test_bad_rsa_privkey.pem`, 'ascii');
// this would inject errors onto OpenSSL's error stack
crypto.createSign('sha1').sign(sha1_privateKey);
}, /asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag/);
diff --git a/test/parallel/test-cwd-enoent-preload.js b/test/parallel/test-cwd-enoent-preload.js
index 8418e1177e6c89..5d44814d2fe430 100644
--- a/test/parallel/test-cwd-enoent-preload.js
+++ b/test/parallel/test-cwd-enoent-preload.js
@@ -10,7 +10,7 @@ if (common.isSunOS || common.isWindows || common.isAix) {
return;
}
-const dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid;
+const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`;
const abspathFile = require('path').join(common.fixturesDir, 'a.js');
common.refreshTmpDir();
fs.mkdirSync(dirname);
diff --git a/test/parallel/test-cwd-enoent-repl.js b/test/parallel/test-cwd-enoent-repl.js
index 942fc07b64a90b..c82083668aab43 100644
--- a/test/parallel/test-cwd-enoent-repl.js
+++ b/test/parallel/test-cwd-enoent-repl.js
@@ -10,7 +10,7 @@ if (common.isSunOS || common.isWindows || common.isAix) {
return;
}
-const dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid;
+const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`;
common.refreshTmpDir();
fs.mkdirSync(dirname);
process.chdir(dirname);
diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js
index 736121a7c89d6e..dac23e4084aaf5 100644
--- a/test/parallel/test-cwd-enoent.js
+++ b/test/parallel/test-cwd-enoent.js
@@ -10,7 +10,7 @@ if (common.isSunOS || common.isWindows || common.isAix) {
return;
}
-const dirname = common.tmpDir + '/cwd-does-not-exist-' + process.pid;
+const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`;
common.refreshTmpDir();
fs.mkdirSync(dirname);
process.chdir(dirname);
diff --git a/test/parallel/test-debugger-pid.js b/test/parallel/test-debugger-pid.js
index 7617e84bb409d8..94e2c8add6c6cb 100644
--- a/test/parallel/test-debugger-pid.js
+++ b/test/parallel/test-debugger-pid.js
@@ -11,7 +11,7 @@ const interfacer = spawn(process.execPath, ['debug', '-p', '655555']);
console.error(process.execPath, 'debug', '-p', '655555');
interfacer.stdout.setEncoding('utf-8');
interfacer.stderr.setEncoding('utf-8');
-const onData = function(data) {
+const onData = (data) => {
data = (buffer + data).split('\n');
buffer = data.pop();
data.forEach(function(line) {
diff --git a/test/parallel/test-dgram-close-in-listening.js b/test/parallel/test-dgram-close-in-listening.js
index e181f40de67dcf..902384e7e082d0 100644
--- a/test/parallel/test-dgram-close-in-listening.js
+++ b/test/parallel/test-dgram-close-in-listening.js
@@ -13,6 +13,14 @@ socket.on('listening', function() {
socket.close();
});
-// adds a listener to 'listening' to send the data when
-// the socket is available
-socket.send(buf, 0, buf.length, common.PORT, 'localhost');
+// get a random port for send
+const portGetter = dgram.createSocket('udp4')
+ .bind(0, 'localhost', common.mustCall(() => {
+ // adds a listener to 'listening' to send the data when
+ // the socket is available
+ socket.send(buf, 0, buf.length,
+ portGetter.address().port,
+ portGetter.address().address);
+
+ portGetter.close();
+ }));
diff --git a/test/parallel/test-dgram-close-is-not-callback.js b/test/parallel/test-dgram-close-is-not-callback.js
index d0f23d5808c7b7..416c5b305e1c49 100644
--- a/test/parallel/test-dgram-close-is-not-callback.js
+++ b/test/parallel/test-dgram-close-is-not-callback.js
@@ -6,9 +6,16 @@ const buf = Buffer.alloc(1024, 42);
const socket = dgram.createSocket('udp4');
-socket.send(buf, 0, buf.length, common.PORT, 'localhost');
+// get a random port for send
+const portGetter = dgram.createSocket('udp4')
+ .bind(0, 'localhost', common.mustCall(() => {
+ socket.send(buf, 0, buf.length,
+ portGetter.address().port,
+ portGetter.address().address);
-// if close callback is not function, ignore the argument.
-socket.close('bad argument');
+ // if close callback is not function, ignore the argument.
+ socket.close('bad argument');
+ portGetter.close();
-socket.on('close', common.mustCall(function() {}));
+ socket.on('close', common.mustCall(function() {}));
+ }));
diff --git a/test/parallel/test-dgram-close.js b/test/parallel/test-dgram-close.js
index 43047db697a2eb..482cf529e6720f 100644
--- a/test/parallel/test-dgram-close.js
+++ b/test/parallel/test-dgram-close.js
@@ -11,14 +11,23 @@ const buf = Buffer.alloc(1024, 42);
let socket = dgram.createSocket('udp4');
const handle = socket._handle;
-socket.send(buf, 0, buf.length, common.PORT, 'localhost');
-assert.strictEqual(socket.close(common.mustCall(function() {})), socket);
-socket.on('close', common.mustCall(function() {}));
-socket = null;
+// get a random port for send
+const portGetter = dgram.createSocket('udp4')
+ .bind(0, 'localhost', common.mustCall(() => {
+ socket.send(buf, 0, buf.length,
+ portGetter.address().port,
+ portGetter.address().address);
-// Verify that accessing handle after closure doesn't throw
-setImmediate(function() {
- setImmediate(function() {
- console.log('Handle fd is: ', handle.fd);
- });
-});
+ assert.strictEqual(socket.close(common.mustCall(function() {})), socket);
+ socket.on('close', common.mustCall(function() {}));
+ socket = null;
+
+ // Verify that accessing handle after closure doesn't throw
+ setImmediate(function() {
+ setImmediate(function() {
+ console.log('Handle fd is: ', handle.fd);
+ });
+ });
+
+ portGetter.close();
+ }));
diff --git a/test/parallel/test-dgram-error-message-address.js b/test/parallel/test-dgram-error-message-address.js
index 457883c573a43b..211adcffcc67b5 100644
--- a/test/parallel/test-dgram-error-message-address.js
+++ b/test/parallel/test-dgram-error-message-address.js
@@ -28,7 +28,7 @@ socket_ipv6.on('error', common.mustCall(function(e) {
const allowed = ['EADDRNOTAVAIL', 'EAFNOSUPPORT', 'EPROTONOSUPPORT'];
assert.notStrictEqual(allowed.indexOf(e.code), -1);
assert.strictEqual(e.port, undefined);
- assert.strictEqual(e.message, 'bind ' + e.code + ' 111::1');
+ assert.strictEqual(e.message, `bind ${e.code} 111::1`);
assert.strictEqual(e.address, '111::1');
socket_ipv6.close();
}));
diff --git a/test/parallel/test-dgram-exclusive-implicit-bind.js b/test/parallel/test-dgram-exclusive-implicit-bind.js
index d6ec7097e40827..3a3e88bbdc8d84 100644
--- a/test/parallel/test-dgram-exclusive-implicit-bind.js
+++ b/test/parallel/test-dgram-exclusive-implicit-bind.js
@@ -70,15 +70,15 @@ if (cluster.isMaster) {
});
target.on('listening', function() {
- cluster.fork();
- cluster.fork();
+ cluster.fork({PORT: target.address().port});
+ cluster.fork({PORT: target.address().port});
if (!common.isWindows) {
- cluster.fork({BOUND: 'y'});
- cluster.fork({BOUND: 'y'});
+ cluster.fork({BOUND: 'y', PORT: target.address().port});
+ cluster.fork({BOUND: 'y', PORT: target.address().port});
}
});
- target.bind({port: common.PORT, exclusive: true});
+ target.bind({port: 0, exclusive: true});
return;
}
@@ -99,7 +99,8 @@ if (process.env.BOUND === 'y') {
source.unref();
}
+assert(process.env.PORT);
const buf = Buffer.from(process.pid.toString());
interval = setInterval(() => {
- source.send(buf, common.PORT, '127.0.0.1');
+ source.send(buf, process.env.PORT, '127.0.0.1');
}, 1).unref();
diff --git a/test/parallel/test-dgram-oob-buffer.js b/test/parallel/test-dgram-oob-buffer.js
index 5d869114b3a4e4..b49baa2e0d8dad 100644
--- a/test/parallel/test-dgram-oob-buffer.js
+++ b/test/parallel/test-dgram-oob-buffer.js
@@ -8,13 +8,18 @@ const dgram = require('dgram');
const socket = dgram.createSocket('udp4');
const buf = Buffer.from([1, 2, 3, 4]);
+const portGetter = dgram.createSocket('udp4')
+ .bind(0, 'localhost', common.mustCall(() => {
+ const address = portGetter.address();
+ portGetter.close(common.mustCall(() => {
+ function ok() {}
+ socket.send(buf, 0, 0, address.port, address.address, ok);
+ socket.send(buf, 0, 4, address.port, address.address, ok);
+ socket.send(buf, 1, 3, address.port, address.address, ok);
+ socket.send(buf, 3, 1, address.port, address.address, ok);
+ // Since length of zero means nothing, don't error despite OOB.
+ socket.send(buf, 4, 0, address.port, address.address, ok);
-function ok() {}
-socket.send(buf, 0, 0, common.PORT, '127.0.0.1', ok); // useful? no
-socket.send(buf, 0, 4, common.PORT, '127.0.0.1', ok);
-socket.send(buf, 1, 3, common.PORT, '127.0.0.1', ok);
-socket.send(buf, 3, 1, common.PORT, '127.0.0.1', ok);
-// Since length of zero means nothing, don't error despite OOB.
-socket.send(buf, 4, 0, common.PORT, '127.0.0.1', ok);
-
-socket.close();
+ socket.close();
+ }));
+ }));
diff --git a/test/parallel/test-dgram-send-callback-buffer-length.js b/test/parallel/test-dgram-send-callback-buffer-length.js
index 8551e97387ea51..2cfe1b49ede84a 100644
--- a/test/parallel/test-dgram-send-callback-buffer-length.js
+++ b/test/parallel/test-dgram-send-callback-buffer-length.js
@@ -17,4 +17,7 @@ const messageSent = common.mustCall(function messageSent(err, bytes) {
client.close();
});
-client.send(buf, offset, len, common.PORT, '127.0.0.1', messageSent);
+client.bind(0, () => client.send(buf, offset, len,
+ client.address().port,
+ '127.0.0.1',
+ messageSent));
diff --git a/test/parallel/test-dgram-send-callback-buffer.js b/test/parallel/test-dgram-send-callback-buffer.js
index e0b2a581bf74aa..c174e585d61282 100644
--- a/test/parallel/test-dgram-send-callback-buffer.js
+++ b/test/parallel/test-dgram-send-callback-buffer.js
@@ -14,4 +14,7 @@ const onMessage = common.mustCall(function(err, bytes) {
client.close();
});
-client.send(buf, common.PORT, common.localhostIPv4, onMessage);
+client.bind(0, () => client.send(buf,
+ client.address().port,
+ common.localhostIPv4,
+ onMessage));
diff --git a/test/parallel/test-domain-enter-exit.js b/test/parallel/test-domain-enter-exit.js
index 4a11c3a206a5fe..9b81b1b5799f40 100644
--- a/test/parallel/test-domain-enter-exit.js
+++ b/test/parallel/test-domain-enter-exit.js
@@ -20,20 +20,20 @@ c.name = 'c';
a.enter(); // push
assert.deepStrictEqual(domain._stack, [a],
- 'a not pushed: ' + names(domain._stack));
+ `a not pushed: ${names(domain._stack)}`);
b.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b],
- 'b not pushed: ' + names(domain._stack));
+ `b not pushed: ${names(domain._stack)}`);
c.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b, c],
- 'c not pushed: ' + names(domain._stack));
+ `c not pushed: ${names(domain._stack)}`);
b.exit(); // pop
assert.deepStrictEqual(domain._stack, [a],
- 'b and c not popped: ' + names(domain._stack));
+ `b and c not popped: ${names(domain._stack)}`);
b.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b],
- 'b not pushed: ' + names(domain._stack));
+ `b not pushed: ${names(domain._stack)}`);
diff --git a/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js b/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js
index a1699d106d9c7c..79ded2dd9d1424 100644
--- a/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js
+++ b/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js
@@ -7,9 +7,9 @@ const assert = require('assert');
const d = domain.create();
process.on('uncaughtException', common.mustCall(function onUncaught() {
- assert.strictEqual(process.domain, null,
- 'domains stack should be empty in uncaughtException' +
- ' handler');
+ assert.strictEqual(
+ process.domain, null,
+ 'domains stack should be empty in uncaughtException handler');
}));
process.on('beforeExit', common.mustCall(function onBeforeExit() {
diff --git a/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js b/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js
index d2de9b2a448cf9..089300bc481c10 100644
--- a/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js
+++ b/test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js
@@ -17,7 +17,7 @@ const RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE = 42;
if (process.argv[2] === 'child') {
process.on('uncaughtException', common.mustCall(function onUncaught() {
- if (process.execArgv.indexOf('--abort-on-uncaught-exception') !== -1) {
+ if (process.execArgv.includes('--abort-on-uncaught-exception')) {
// When passing --abort-on-uncaught-exception to the child process,
// we want to make sure that this handler (the process' uncaughtException
// event handler) wasn't called. Unfortunately we can't parse the child
@@ -90,13 +90,13 @@ function createTestCmdLine(options) {
testCmd += 'ulimit -c 0 && ';
}
- testCmd += process.argv[0];
+ testCmd += `"${process.argv[0]}"`;
if (options && options.withAbortOnUncaughtException) {
testCmd += ' --abort-on-uncaught-exception';
}
- testCmd += ` ${process.argv[1]} child`;
+ testCmd += ` "${process.argv[1]}" child`;
return testCmd;
}
diff --git a/test/parallel/test-domain-uncaught-exception.js b/test/parallel/test-domain-uncaught-exception.js
index 58df4ac59a7818..594cee542f80fb 100644
--- a/test/parallel/test-domain-uncaught-exception.js
+++ b/test/parallel/test-domain-uncaught-exception.js
@@ -184,17 +184,15 @@ if (process.argv[2] === 'child') {
test.expectedMessages.forEach(function(expectedMessage) {
if (test.messagesReceived === undefined ||
test.messagesReceived.indexOf(expectedMessage) === -1)
- assert(false, 'test ' + test.fn.name +
- ' should have sent message: ' + expectedMessage +
- ' but didn\'t');
+ assert(false, `test ${test.fn.name} should have sent message: ${
+ expectedMessage} but didn't`);
});
if (test.messagesReceived) {
test.messagesReceived.forEach(function(receivedMessage) {
if (test.expectedMessages.indexOf(receivedMessage) === -1) {
- assert(false, 'test ' + test.fn.name +
- ' should not have sent message: ' + receivedMessage +
- ' but did');
+ assert(false, `test ${test.fn.name} should not have sent message: ${
+ receivedMessage} but did`);
}
});
}
diff --git a/test/parallel/test-domain-with-abort-on-uncaught-exception.js b/test/parallel/test-domain-with-abort-on-uncaught-exception.js
index 0da8f1368f7c98..03ab39dbfc05d2 100644
--- a/test/parallel/test-domain-with-abort-on-uncaught-exception.js
+++ b/test/parallel/test-domain-with-abort-on-uncaught-exception.js
@@ -43,11 +43,11 @@ if (process.argv[2] === 'child') {
d.on('error', function(err) {
// Swallowing the error on purpose if 'throwInDomainErrHandler' is not
// set
- if (process.argv.indexOf('throwInDomainErrHandler') !== -1) {
+ if (process.argv.includes('throwInDomainErrHandler')) {
// If useTryCatch is set, wrap the throw in a try/catch block.
// This is to make sure that a caught exception does not trigger
// an abort.
- if (process.argv.indexOf('useTryCatch') !== -1) {
+ if (process.argv.includes('useTryCatch')) {
try {
throw new Error(domainErrHandlerExMessage);
} catch (e) {
@@ -103,14 +103,8 @@ if (process.argv[2] === 'child') {
if (options.useTryCatch)
useTryCatchOpt = 'useTryCatch';
- cmdToExec += process.argv[0] + ' ';
- cmdToExec += (cmdLineOption ? cmdLineOption : '') + ' ';
- cmdToExec += process.argv[1] + ' ';
- cmdToExec += [
- 'child',
- throwInDomainErrHandlerOpt,
- useTryCatchOpt
- ].join(' ');
+ cmdToExec += `"${process.argv[0]}" ${cmdLineOption ? cmdLineOption : ''} "${
+ process.argv[1]}" child ${throwInDomainErrHandlerOpt} ${useTryCatchOpt}`;
const child = exec(cmdToExec);
diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js
index fe51cc46820770..ab286429f5c5d5 100644
--- a/test/parallel/test-domain.js
+++ b/test/parallel/test-domain.js
@@ -230,9 +230,7 @@ assert.strictEqual(result, 'return value');
// check if the executed function take in count the applied parameters
-result = d.run(function(a, b) {
- return a + ' ' + b;
-}, 'return', 'value');
+result = d.run((a, b) => `${a} ${b}`, 'return', 'value');
assert.strictEqual(result, 'return value');
diff --git a/test/parallel/test-dsa-fips-invalid-key.js b/test/parallel/test-dsa-fips-invalid-key.js
index 6055a9b4c47862..b22be9d077922b 100644
--- a/test/parallel/test-dsa-fips-invalid-key.js
+++ b/test/parallel/test-dsa-fips-invalid-key.js
@@ -12,8 +12,8 @@ const fs = require('fs');
const input = 'hello';
-const dsapri = fs.readFileSync(common.fixturesDir +
- '/keys/dsa_private_1025.pem');
+const dsapri = fs.readFileSync(
+ `${common.fixturesDir}/keys/dsa_private_1025.pem`);
const sign = crypto.createSign('DSS1');
sign.update(input);
diff --git a/test/parallel/test-env-var-no-warnings.js b/test/parallel/test-env-var-no-warnings.js
index 53b7d302683cf4..1df31d8920753d 100644
--- a/test/parallel/test-env-var-no-warnings.js
+++ b/test/parallel/test-env-var-no-warnings.js
@@ -7,7 +7,7 @@ if (process.argv[2] === 'child') {
process.emitWarning('foo');
} else {
function test(env) {
- const cmd = `${process.execPath} ${__filename} child`;
+ const cmd = `"${process.execPath}" "${__filename}" child`;
cp.exec(cmd, { env }, common.mustCall((err, stdout, stderr) => {
assert.strictEqual(err, null);
diff --git a/test/parallel/test-error-reporting.js b/test/parallel/test-error-reporting.js
index fa7332a67a482b..73799cda48365e 100644
--- a/test/parallel/test-error-reporting.js
+++ b/test/parallel/test-error-reporting.js
@@ -5,8 +5,7 @@ const exec = require('child_process').exec;
const path = require('path');
function errExec(script, callback) {
- const cmd = '"' + process.argv[0] + '" "' +
- path.join(common.fixturesDir, script) + '"';
+ const cmd = `"${process.argv[0]}" "${path.join(common.fixturesDir, script)}"`;
return exec(cmd, function(err, stdout, stderr) {
// There was some error
assert.ok(err);
@@ -15,13 +14,15 @@ function errExec(script, callback) {
assert.ok(stderr.split('\n').length > 2);
// Assert the script is mentioned in error output.
- assert.ok(stderr.indexOf(script) >= 0);
+ assert.ok(stderr.includes(script));
// Proxy the args for more tests.
callback(err, stdout, stderr);
});
}
+const syntaxErrorMessage = /SyntaxError/;
+
// Simple throw error
errExec('throws_error.js', common.mustCall(function(err, stdout, stderr) {
@@ -31,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-eval.js b/test/parallel/test-eval.js
index cddbe86795a967..f286c3c02bec19 100644
--- a/test/parallel/test-eval.js
+++ b/test/parallel/test-eval.js
@@ -8,7 +8,7 @@ const cmd = [
`"${process.execPath}"`, '-e',
'"console.error(process.argv)"',
'foo', 'bar'].join(' ');
-const expected = util.format([process.execPath, 'foo', 'bar']) + '\n';
+const expected = `${util.format([process.execPath, 'foo', 'bar'])}\n`;
exec(cmd, common.mustCall((err, stdout, stderr) => {
assert.ifError(err);
assert.strictEqual(stderr, expected);
diff --git a/test/parallel/test-event-emitter-add-listeners.js b/test/parallel/test-event-emitter-add-listeners.js
index 33125daabdb3b3..ffeb4b0349637f 100644
--- a/test/parallel/test-event-emitter-add-listeners.js
+++ b/test/parallel/test-event-emitter-add-listeners.js
@@ -47,8 +47,8 @@ const EventEmitter = require('events');
}
{
- const listen1 = function listen1() {};
- const listen2 = function listen2() {};
+ const listen1 = () => {};
+ const listen2 = () => {};
const ee = new EventEmitter();
ee.once('newListener', function() {
diff --git a/test/parallel/test-event-emitter-max-listeners-warning.js b/test/parallel/test-event-emitter-max-listeners-warning.js
index df363e43d9cbb7..21f4ee0cc6bcde 100644
--- a/test/parallel/test-event-emitter-max-listeners-warning.js
+++ b/test/parallel/test-event-emitter-max-listeners-warning.js
@@ -19,4 +19,5 @@ process.on('warning', common.mustCall((warning) => {
}));
e.on('event-type', function() {});
-e.on('event-type', function() {});
+e.on('event-type', function() {}); // Trigger warning.
+e.on('event-type', function() {}); // Verify that warning is emitted only once.
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-event-emitter-once.js b/test/parallel/test-event-emitter-once.js
index 724b2ffd16aad1..e304bccb6e2d42 100644
--- a/test/parallel/test-event-emitter-once.js
+++ b/test/parallel/test-event-emitter-once.js
@@ -12,9 +12,9 @@ e.emit('hello', 'a', 'b');
e.emit('hello', 'a', 'b');
e.emit('hello', 'a', 'b');
-const remove = function() {
+function remove() {
common.fail('once->foo should not be emitted');
-};
+}
e.once('foo', remove);
e.removeListener('foo', remove);
@@ -34,3 +34,23 @@ assert.throws(() => {
ee.once('foo', null);
}, /^TypeError: "listener" argument must be a function$/);
+
+{
+ // once() has different code paths based on the number of arguments being
+ // emitted. Verify that all of the cases are covered.
+ const maxArgs = 4;
+
+ for (let i = 0; i <= maxArgs; ++i) {
+ const ee = new EventEmitter();
+ const args = ['foo'];
+
+ for (let j = 0; j < i; ++j)
+ args.push(j);
+
+ ee.once('foo', common.mustCall((...params) => {
+ assert.deepStrictEqual(params, args.slice(1));
+ }));
+
+ EventEmitter.prototype.emit.apply(ee, args);
+ }
+}
diff --git a/test/parallel/test-event-emitter-remove-listeners.js b/test/parallel/test-event-emitter-remove-listeners.js
index dfdae52d1cf21d..727523eabdb29a 100644
--- a/test/parallel/test-event-emitter-remove-listeners.js
+++ b/test/parallel/test-event-emitter-remove-listeners.js
@@ -136,3 +136,20 @@ assert.throws(() => {
const e = ee.removeListener('foo', listener);
assert.strictEqual(e, ee);
}
+
+{
+ const ee = new EventEmitter();
+
+ ee.on('foo', listener1);
+ ee.on('foo', listener2);
+ assert.deepStrictEqual(ee.listeners('foo'), [listener1, listener2]);
+
+ ee.removeListener('foo', listener1);
+ assert.strictEqual(ee._events.foo, listener2);
+
+ ee.on('foo', listener1);
+ assert.deepStrictEqual(ee.listeners('foo'), [listener2, listener1]);
+
+ ee.removeListener('foo', listener1);
+ assert.strictEqual(ee._events.foo, listener2);
+}
diff --git a/test/parallel/test-exception-handler2.js b/test/parallel/test-exception-handler2.js
index 1dabedf4c68730..23d78d838ad76f 100644
--- a/test/parallel/test-exception-handler2.js
+++ b/test/parallel/test-exception-handler2.js
@@ -2,7 +2,7 @@
const common = require('../common');
process.on('uncaughtException', function(err) {
- console.log('Caught exception: ' + err);
+ console.log(`Caught exception: ${err}`);
});
setTimeout(common.mustCall(function() {
diff --git a/test/parallel/test-file-write-stream2.js b/test/parallel/test-file-write-stream2.js
index 504a572dde67d7..1d11f6de3e96ec 100644
--- a/test/parallel/test-file-write-stream2.js
+++ b/test/parallel/test-file-write-stream2.js
@@ -22,9 +22,9 @@ process.on('exit', function() {
console.log(' Test callback events missing or out of order:');
console.log(' expected: %j', cb_expected);
console.log(' occurred: %j', cb_occurred);
- assert.strictEqual(cb_occurred, cb_expected,
- 'events missing or out of order: "' +
- cb_occurred + '" !== "' + cb_expected + '"');
+ assert.strictEqual(
+ cb_occurred, cb_expected,
+ `events missing or out of order: "${cb_occurred}" !== "${cb_expected}"`);
} else {
console.log('ok');
}
@@ -80,7 +80,7 @@ file.on('error', function(err) {
for (let i = 0; i < 11; i++) {
- const ret = file.write(i + '');
+ const ret = file.write(String(i));
console.error('%d %j', i, ret);
// return false when i hits 10
diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js
index 961f51ba82be7a..89ec1a7379981e 100644
--- a/test/parallel/test-file-write-stream3.js
+++ b/test/parallel/test-file-write-stream3.js
@@ -23,9 +23,9 @@ process.on('exit', function() {
console.log(' Test callback events missing or out of order:');
console.log(' expected: %j', cb_expected);
console.log(' occurred: %j', cb_occurred);
- assert.strictEqual(cb_occurred, cb_expected,
- 'events missing or out of order: "' +
- cb_occurred + '" !== "' + cb_expected + '"');
+ assert.strictEqual(
+ cb_occurred, cb_expected,
+ `events missing or out of order: "${cb_occurred}" !== "${cb_expected}"`);
}
});
diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js
index 514c62939e8bda..1579b71ae6e370 100644
--- a/test/parallel/test-fs-access.js
+++ b/test/parallel/test-fs-access.js
@@ -7,7 +7,7 @@ const doesNotExist = path.join(common.tmpDir, '__this_should_not_exist');
const readOnlyFile = path.join(common.tmpDir, 'read_only_file');
const readWriteFile = path.join(common.tmpDir, 'read_write_file');
-const removeFile = function(file) {
+const removeFile = (file) => {
try {
fs.unlinkSync(file);
} catch (err) {
@@ -15,11 +15,11 @@ const removeFile = function(file) {
}
};
-const createFileWithPerms = function(file, mode) {
+function createFileWithPerms(file, mode) {
removeFile(file);
fs.writeFileSync(file, '');
fs.chmodSync(file, mode);
-};
+}
common.refreshTmpDir();
createFileWithPerms(readOnlyFile, 0o444);
diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js
index c13fc8953ed5fa..defb4bd7f23995 100644
--- a/test/parallel/test-fs-append-file-sync.js
+++ b/test/parallel/test-fs-append-file-sync.js
@@ -62,7 +62,7 @@ if (!common.isWindows) {
const fileData4 = fs.readFileSync(filename4);
-assert.strictEqual(Buffer.byteLength('' + num) + currentFileData.length,
+assert.strictEqual(Buffer.byteLength(String(num)) + currentFileData.length,
fileData4.length);
// test that appendFile accepts file descriptors
diff --git a/test/parallel/test-fs-append-file.js b/test/parallel/test-fs-append-file.js
index 00691b1e74e6fe..a600d1030383a7 100644
--- a/test/parallel/test-fs-append-file.js
+++ b/test/parallel/test-fs-append-file.js
@@ -88,7 +88,7 @@ fs.appendFile(filename4, n, { mode: m }, function(e) {
fs.readFile(filename4, function(e, buffer) {
assert.ifError(e);
ncallbacks++;
- assert.strictEqual(Buffer.byteLength('' + n) + currentFileData.length,
+ assert.strictEqual(Buffer.byteLength(String(n)) + currentFileData.length,
buffer.length);
});
});
diff --git a/test/parallel/test-fs-buffertype-writesync.js b/test/parallel/test-fs-buffertype-writesync.js
index 0c8bf4b0fcf811..02d2cb58f83112 100644
--- a/test/parallel/test-fs-buffertype-writesync.js
+++ b/test/parallel/test-fs-buffertype-writesync.js
@@ -16,5 +16,5 @@ common.refreshTmpDir();
v.forEach((value) => {
const fd = fs.openSync(filePath, 'w');
fs.writeSync(fd, value);
- assert.strictEqual(fs.readFileSync(filePath).toString(), value + '');
+ assert.strictEqual(fs.readFileSync(filePath).toString(), String(value));
});
diff --git a/test/parallel/test-fs-chmod.js b/test/parallel/test-fs-chmod.js
index 5121fd89f99466..cbe9ef54bac6b3 100644
--- a/test/parallel/test-fs-chmod.js
+++ b/test/parallel/test-fs-chmod.js
@@ -93,7 +93,7 @@ fs.open(file2, 'a', common.mustCall((err, fd) => {
assert.strictEqual(mode_sync, fs.fstatSync(fd).mode & 0o777);
}
- fs.close(fd);
+ fs.close(fd, assert.ifError);
}));
}));
diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js
index f2ea85531bf463..b6677726fc77f0 100644
--- a/test/parallel/test-fs-error-messages.js
+++ b/test/parallel/test-fs-error-messages.js
@@ -13,66 +13,66 @@ const existingDir2 = path.join(common.fixturesDir, 'keys');
fs.stat(fn, function(err) {
assert.strictEqual(fn, err.path);
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.lstat(fn, function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.readlink(fn, function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.link(fn, 'foo', function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.link(existingFile, existingFile2, function(err) {
- assert.ok(0 <= err.message.indexOf(existingFile));
- assert.ok(0 <= err.message.indexOf(existingFile2));
+ assert.ok(err.message.includes(existingFile));
+ assert.ok(err.message.includes(existingFile2));
});
fs.symlink(existingFile, existingFile2, function(err) {
- assert.ok(0 <= err.message.indexOf(existingFile));
- assert.ok(0 <= err.message.indexOf(existingFile2));
+ assert.ok(err.message.includes(existingFile));
+ assert.ok(err.message.includes(existingFile2));
});
fs.unlink(fn, function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.rename(fn, 'foo', function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.rename(existingDir, existingDir2, function(err) {
- assert.ok(0 <= err.message.indexOf(existingDir));
- assert.ok(0 <= err.message.indexOf(existingDir2));
+ assert.ok(err.message.includes(existingDir));
+ assert.ok(err.message.includes(existingDir2));
});
fs.rmdir(fn, function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.mkdir(existingFile, 0o666, function(err) {
- assert.ok(0 <= err.message.indexOf(existingFile));
+ assert.ok(err.message.includes(existingFile));
});
fs.rmdir(existingFile, function(err) {
- assert.ok(0 <= err.message.indexOf(existingFile));
+ assert.ok(err.message.includes(existingFile));
});
fs.chmod(fn, 0o666, function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.open(fn, 'r', 0o666, function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
fs.readFile(fn, function(err) {
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
});
// Sync
@@ -85,7 +85,7 @@ try {
fs.statSync(fn);
} catch (err) {
errors.push('stat');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -93,7 +93,7 @@ try {
fs.mkdirSync(existingFile, 0o666);
} catch (err) {
errors.push('mkdir');
- assert.ok(0 <= err.message.indexOf(existingFile));
+ assert.ok(err.message.includes(existingFile));
}
try {
@@ -101,7 +101,7 @@ try {
fs.chmodSync(fn, 0o666);
} catch (err) {
errors.push('chmod');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -109,7 +109,7 @@ try {
fs.lstatSync(fn);
} catch (err) {
errors.push('lstat');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -117,7 +117,7 @@ try {
fs.readlinkSync(fn);
} catch (err) {
errors.push('readlink');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -125,7 +125,7 @@ try {
fs.linkSync(fn, 'foo');
} catch (err) {
errors.push('link');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -133,8 +133,8 @@ try {
fs.linkSync(existingFile, existingFile2);
} catch (err) {
errors.push('link');
- assert.ok(0 <= err.message.indexOf(existingFile));
- assert.ok(0 <= err.message.indexOf(existingFile2));
+ assert.ok(err.message.includes(existingFile));
+ assert.ok(err.message.includes(existingFile2));
}
try {
@@ -142,8 +142,8 @@ try {
fs.symlinkSync(existingFile, existingFile2);
} catch (err) {
errors.push('symlink');
- assert.ok(0 <= err.message.indexOf(existingFile));
- assert.ok(0 <= err.message.indexOf(existingFile2));
+ assert.ok(err.message.includes(existingFile));
+ assert.ok(err.message.includes(existingFile2));
}
try {
@@ -151,7 +151,7 @@ try {
fs.unlinkSync(fn);
} catch (err) {
errors.push('unlink');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -159,7 +159,7 @@ try {
fs.rmdirSync(fn);
} catch (err) {
errors.push('rmdir');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -167,7 +167,7 @@ try {
fs.rmdirSync(existingFile);
} catch (err) {
errors.push('rmdir');
- assert.ok(0 <= err.message.indexOf(existingFile));
+ assert.ok(err.message.includes(existingFile));
}
try {
@@ -175,7 +175,7 @@ try {
fs.openSync(fn, 'r');
} catch (err) {
errors.push('opens');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -183,7 +183,7 @@ try {
fs.renameSync(fn, 'foo');
} catch (err) {
errors.push('rename');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
try {
@@ -191,8 +191,8 @@ try {
fs.renameSync(existingDir, existingDir2);
} catch (err) {
errors.push('rename');
- assert.ok(0 <= err.message.indexOf(existingDir));
- assert.ok(0 <= err.message.indexOf(existingDir2));
+ assert.ok(err.message.includes(existingDir));
+ assert.ok(err.message.includes(existingDir2));
}
try {
@@ -200,11 +200,12 @@ try {
fs.readdirSync(fn);
} catch (err) {
errors.push('readdir');
- assert.ok(0 <= err.message.indexOf(fn));
+ assert.ok(err.message.includes(fn));
}
process.on('exit', function() {
- assert.strictEqual(expected, errors.length,
- 'Test fs sync exceptions raised, got ' + errors.length +
- ' expected ' + expected);
+ assert.strictEqual(
+ expected, errors.length,
+ `Test fs sync exceptions raised, got ${errors.length} expected ${expected}`
+ );
});
diff --git a/test/parallel/test-fs-exists.js b/test/parallel/test-fs-exists.js
index 14e1446f5a6d3d..aef18ace88a87e 100644
--- a/test/parallel/test-fs-exists.js
+++ b/test/parallel/test-fs-exists.js
@@ -8,9 +8,9 @@ fs.exists(f, common.mustCall(function(y) {
assert.strictEqual(y, true);
}));
-fs.exists(f + '-NO', common.mustCall(function(y) {
+fs.exists(`${f}-NO`, common.mustCall(function(y) {
assert.strictEqual(y, false);
}));
assert(fs.existsSync(f));
-assert(!fs.existsSync(f + '-NO'));
+assert(!fs.existsSync(`${f}-NO`));
diff --git a/test/parallel/test-fs-link.js b/test/parallel/test-fs-link.js
index 2cba47bfec83df..525392aa2be01c 100644
--- a/test/parallel/test-fs-link.js
+++ b/test/parallel/test-fs-link.js
@@ -11,11 +11,11 @@ const srcPath = path.join(common.tmpDir, 'hardlink-target.txt');
const dstPath = path.join(common.tmpDir, 'link1.js');
fs.writeFileSync(srcPath, 'hello world');
-const callback = function(err) {
- if (err) throw err;
+function callback(err) {
+ assert.ifError(err);
const dstContent = fs.readFileSync(dstPath, 'utf8');
assert.strictEqual('hello world', dstContent);
-};
+}
fs.link(srcPath, dstPath, common.mustCall(callback));
diff --git a/test/parallel/test-fs-make-callback.js b/test/parallel/test-fs-make-callback.js
index 2dc9874a546574..034b22f789104b 100644
--- a/test/parallel/test-fs-make-callback.js
+++ b/test/parallel/test-fs-make-callback.js
@@ -1,28 +1,28 @@
'use strict';
-require('../common');
+const common = require('../common');
const assert = require('assert');
const fs = require('fs');
+const cbTypeError = /^TypeError: "callback" argument must be a function$/;
+const callbackThrowValues = [null, true, false, 0, 1, 'foo', /foo/, [], {}];
-function test(cb) {
+const { sep } = require('path');
+
+common.refreshTmpDir();
+
+function testMakeCallback(cb) {
return function() {
- // fs.stat() calls makeCallback() on its second argument
- fs.stat(__filename, cb);
+ // fs.mkdtemp() calls makeCallback() on its third argument
+ fs.mkdtemp(`${common.tmpDir}${sep}`, {}, cb);
};
}
-// Verify the case where a callback function is provided
-assert.doesNotThrow(test(function() {}));
+// Passing undefined/nothing calls rethrow() internally
+assert.doesNotThrow(testMakeCallback());
-// Passing undefined calls rethrow() internally, which is fine
-assert.doesNotThrow(test(undefined));
+function invalidCallbackThrowsTests() {
+ callbackThrowValues.forEach((value) => {
+ assert.throws(testMakeCallback(value), cbTypeError);
+ });
+}
-// Anything else should throw
-assert.throws(test(null));
-assert.throws(test(true));
-assert.throws(test(false));
-assert.throws(test(1));
-assert.throws(test(0));
-assert.throws(test('foo'));
-assert.throws(test(/foo/));
-assert.throws(test([]));
-assert.throws(test({}));
+invalidCallbackThrowsTests();
diff --git a/test/parallel/test-fs-makeStatsCallback.js b/test/parallel/test-fs-makeStatsCallback.js
new file mode 100644
index 00000000000000..67e6b18dd3d4f7
--- /dev/null
+++ b/test/parallel/test-fs-makeStatsCallback.js
@@ -0,0 +1,27 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const fs = require('fs');
+const cbTypeError = /^TypeError: "callback" argument must be a function$/;
+const callbackThrowValues = [null, true, false, 0, 1, 'foo', /foo/, [], {}];
+
+function testMakeStatsCallback(cb) {
+ return function() {
+ // fs.stat() calls makeStatsCallback() on its second argument
+ fs.stat(__filename, cb);
+ };
+}
+
+// Verify the case where a callback function is provided
+assert.doesNotThrow(testMakeStatsCallback(common.noop));
+
+// Passing undefined/nothing calls rethrow() internally
+assert.doesNotThrow(testMakeStatsCallback());
+
+function invalidCallbackThrowsTests() {
+ callbackThrowValues.forEach((value) => {
+ assert.throws(testMakeStatsCallback(value), cbTypeError);
+ });
+}
+
+invalidCallbackThrowsTests();
diff --git a/test/parallel/test-fs-mkdir-rmdir.js b/test/parallel/test-fs-mkdir-rmdir.js
index bac18fc027931d..8c22331e85e3cd 100644
--- a/test/parallel/test-fs-mkdir-rmdir.js
+++ b/test/parallel/test-fs-mkdir-rmdir.js
@@ -24,14 +24,15 @@ fs.rmdirSync(d);
assert(!common.fileExists(d));
// Similarly test the Async version
-fs.mkdir(d, 0o666, function(err) {
+fs.mkdir(d, 0o666, common.mustCall(function(err) {
assert.ifError(err);
- fs.mkdir(d, 0o666, function(err) {
- assert.ok(err.message.match(/^EEXIST/), 'got EEXIST message');
- assert.strictEqual(err.code, 'EEXIST', 'got EEXIST code');
- assert.strictEqual(err.path, d, 'got proper path for EEXIST');
+ fs.mkdir(d, 0o666, common.mustCall(function(err) {
+ assert.ok(err, 'got no error');
+ assert.ok(/^EEXIST/.test(err.message), 'got no EEXIST message');
+ assert.strictEqual(err.code, 'EEXIST', 'got no EEXIST code');
+ assert.strictEqual(err.path, d, 'got no proper path for EEXIST');
fs.rmdir(d, assert.ifError);
- });
-});
+ }));
+}));
diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js
index 73fc899ce57597..e70880ef981d7e 100644
--- a/test/parallel/test-fs-mkdir.js
+++ b/test/parallel/test-fs-mkdir.js
@@ -13,7 +13,7 @@ function unlink(pathname) {
common.refreshTmpDir();
{
- const pathname = common.tmpDir + '/test1';
+ const pathname = `${common.tmpDir}/test1`;
unlink(pathname);
@@ -28,7 +28,7 @@ common.refreshTmpDir();
}
{
- const pathname = common.tmpDir + '/test2';
+ const pathname = `${common.tmpDir}/test2`;
unlink(pathname);
@@ -43,7 +43,7 @@ common.refreshTmpDir();
}
{
- const pathname = common.tmpDir + '/test3';
+ const pathname = `${common.tmpDir}/test3`;
unlink(pathname);
fs.mkdirSync(pathname);
diff --git a/test/parallel/test-fs-non-number-arguments-throw.js b/test/parallel/test-fs-non-number-arguments-throw.js
index 3e40a5fd41be38..5e4deb12a8734b 100644
--- a/test/parallel/test-fs-non-number-arguments-throw.js
+++ b/test/parallel/test-fs-non-number-arguments-throw.js
@@ -29,6 +29,7 @@ assert.throws(function() {
"start as string didn't throw an error for createWriteStream");
saneEmitter.on('data', common.mustCall(function(data) {
- assert.strictEqual(sanity, data.toString('utf8'), 'read ' +
- data.toString('utf8') + ' instead of ' + sanity);
+ assert.strictEqual(
+ sanity, data.toString('utf8'),
+ `read ${data.toString('utf8')} instead of ${sanity}`);
}));
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-open-flags.js b/test/parallel/test-fs-open-flags.js
index 2c8eceb4095ceb..c59e0ab31c1667 100644
--- a/test/parallel/test-fs-open-flags.js
+++ b/test/parallel/test-fs-open-flags.js
@@ -39,20 +39,27 @@ assert.strictEqual(fs._stringToFlags('xa+'),
('+ +a +r +w rw wa war raw r++ a++ w++ x +x x+ rx rx+ wxx wax xwx xxx')
.split(' ')
.forEach(function(flags) {
- assert.throws(function() { fs._stringToFlags(flags); });
+ assert.throws(
+ () => fs._stringToFlags(flags),
+ new RegExp(`^Error: Unknown file open flag: ${escapeRegExp(flags)}`)
+ );
});
assert.throws(
() => fs._stringToFlags({}),
- /Unknown file open flag: \[object Object\]/
+ /^Error: Unknown file open flag: \[object Object\]$/
);
assert.throws(
() => fs._stringToFlags(true),
- /Unknown file open flag: true/
+ /^Error: Unknown file open flag: true$/
);
assert.throws(
() => fs._stringToFlags(null),
- /Unknown file open flag: null/
+ /Error: Unknown file open flag: null$/
);
+
+function escapeRegExp(string) {
+ return string.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
+}
diff --git a/test/parallel/test-fs-read-stream-fd-leak.js b/test/parallel/test-fs-read-stream-fd-leak.js
index 0a7a42a3bab3c1..e6594afefcd58a 100644
--- a/test/parallel/test-fs-read-stream-fd-leak.js
+++ b/test/parallel/test-fs-read-stream-fd-leak.js
@@ -29,7 +29,7 @@ function testLeak(endFn, callback) {
let i = 0;
let check = 0;
- const checkFunction = function() {
+ function checkFunction() {
if (openCount !== 0 && check < totalCheck) {
check++;
setTimeout(checkFunction, 100);
@@ -44,7 +44,7 @@ function testLeak(endFn, callback) {
openCount = 0;
callback && setTimeout(callback, 100);
- };
+ }
setInterval(function() {
const s = fs.createReadStream(emptyTxt);
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-fs-readdir.js b/test/parallel/test-fs-readdir.js
index 57612f3e26b183..a5c7ebfe688c41 100644
--- a/test/parallel/test-fs-readdir.js
+++ b/test/parallel/test-fs-readdir.js
@@ -12,7 +12,7 @@ common.refreshTmpDir();
// Create the necessary files
files.forEach(function(currentFile) {
- fs.closeSync(fs.openSync(readdirDir + '/' + currentFile, 'w'));
+ fs.closeSync(fs.openSync(`${readdirDir}/${currentFile}`, 'w'));
});
// Check the readdir Sync version
diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js
index 7a0d2447b56a0e..9c1f6527e9b5c6 100644
--- a/test/parallel/test-fs-readfile-error.js
+++ b/test/parallel/test-fs-readfile-error.js
@@ -13,13 +13,13 @@ if (common.isFreeBSD) {
function test(env, cb) {
const filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
- const execPath = '"' + process.execPath + '" "' + filename + '"';
+ const execPath = `"${process.execPath}" "${filename}"`;
const options = { env: Object.assign(process.env, env) };
exec(execPath, options, common.mustCall((err, stdout, stderr) => {
assert(err);
assert.strictEqual(stdout, '');
assert.notStrictEqual(stderr, '');
- cb('' + stderr);
+ cb(String(stderr));
}));
}
diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js
index 3152ff80a38688..5edbf47dddaf02 100644
--- a/test/parallel/test-fs-realpath.js
+++ b/test/parallel/test-fs-realpath.js
@@ -7,6 +7,7 @@ const exec = require('child_process').exec;
let async_completed = 0, async_expected = 0;
const unlink = [];
let skipSymlinks = false;
+const tmpDir = common.tmpDir;
common.refreshTmpDir();
@@ -40,11 +41,11 @@ if (common.isWindows) {
function tmp(p) {
- return path.join(common.tmpDir, p);
+ return path.join(tmpDir, p);
}
-const targetsAbsDir = path.join(common.tmpDir, 'targets');
-const tmpAbsDir = common.tmpDir;
+const targetsAbsDir = path.join(tmpDir, 'targets');
+const tmpAbsDir = tmpDir;
// Set up targetsAbsDir and expected subdirectories
fs.mkdirSync(targetsAbsDir);
@@ -83,10 +84,10 @@ function test_simple_relative_symlink(callback) {
common.skip('symlink test (no privs)');
return runNextTest();
}
- const entry = common.tmpDir + '/symlink';
- const expected = common.tmpDir + '/cycles/root.js';
+ const entry = `${tmpDir}/symlink`;
+ const expected = `${tmpDir}/cycles/root.js`;
[
- [entry, '../' + common.tmpDirName + '/cycles/root.js']
+ [entry, `../${common.tmpDirName}/cycles/root.js`]
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file');
@@ -109,8 +110,8 @@ function test_simple_absolute_symlink(callback) {
console.log('using type=%s', type);
- const entry = tmpAbsDir + '/symlink';
- const expected = common.fixturesDir + '/nested-index/one';
+ const entry = `${tmpAbsDir}/symlink`;
+ const expected = `${common.fixturesDir}/nested-index/one`;
[
[entry, expected]
].forEach(function(t) {
@@ -190,21 +191,25 @@ function test_cyclic_link_protection(callback) {
common.skip('symlink test (no privs)');
return runNextTest();
}
- const entry = common.tmpDir + '/cycles/realpath-3a';
+ const entry = path.join(tmpDir, '/cycles/realpath-3a');
[
[entry, '../cycles/realpath-3b'],
- [common.tmpDir + '/cycles/realpath-3b', '../cycles/realpath-3c'],
- [common.tmpDir + '/cycles/realpath-3c', '../cycles/realpath-3a']
+ [path.join(tmpDir, '/cycles/realpath-3b'), '../cycles/realpath-3c'],
+ [path.join(tmpDir, '/cycles/realpath-3c'), '../cycles/realpath-3a']
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
fs.symlinkSync(t[1], t[0], 'dir');
unlink.push(t[0]);
});
- assert.throws(function() { fs.realpathSync(entry); });
- asynctest(fs.realpath, [entry], callback, function(err, result) {
- assert.ok(err && true);
- return true;
- });
+ assert.throws(() => {
+ fs.realpathSync(entry);
+ }, /^Error: ELOOP: too many symbolic links encountered, stat /);
+ asynctest(
+ fs.realpath, [entry], callback, common.mustCall(function(err, result) {
+ assert.strictEqual(err.path, entry);
+ assert.strictEqual(result, undefined);
+ return true;
+ }));
}
function test_cyclic_link_overprotection(callback) {
@@ -213,10 +218,10 @@ function test_cyclic_link_overprotection(callback) {
common.skip('symlink test (no privs)');
return runNextTest();
}
- const cycles = common.tmpDir + '/cycles';
+ const cycles = `${tmpDir}/cycles`;
const expected = fs.realpathSync(cycles);
- const folder = cycles + '/folder';
- const link = folder + '/cycles';
+ const folder = `${cycles}/folder`;
+ const link = `${folder}/cycles`;
let testPath = cycles;
testPath += '/folder/cycles'.repeat(10);
try { fs.unlinkSync(link); } catch (ex) {}
@@ -238,12 +243,12 @@ function test_relative_input_cwd(callback) {
// we need to calculate the relative path to the tmp dir from cwd
const entrydir = process.cwd();
const entry = path.relative(entrydir,
- path.join(common.tmpDir + '/cycles/realpath-3a'));
- const expected = common.tmpDir + '/cycles/root.js';
+ path.join(`${tmpDir}/cycles/realpath-3a`));
+ const expected = `${tmpDir}/cycles/root.js`;
[
[entry, '../cycles/realpath-3b'],
- [common.tmpDir + '/cycles/realpath-3b', '../cycles/realpath-3c'],
- [common.tmpDir + '/cycles/realpath-3c', 'root.js']
+ [`${tmpDir}/cycles/realpath-3b`, '../cycles/realpath-3c'],
+ [`${tmpDir}/cycles/realpath-3c`, 'root.js']
].forEach(function(t) {
const fn = t[0];
console.error('fn=%j', fn);
@@ -291,16 +296,16 @@ function test_deep_symlink_mix(callback) {
fs.mkdirSync(tmp('node-test-realpath-d2'), 0o700);
try {
[
- [entry, common.tmpDir + '/node-test-realpath-d1/foo'],
+ [entry, `${tmpDir}/node-test-realpath-d1/foo`],
[tmp('node-test-realpath-d1'),
- common.tmpDir + '/node-test-realpath-d2'],
+ `${tmpDir}/node-test-realpath-d2`],
[tmp('node-test-realpath-d2/foo'), '../node-test-realpath-f2'],
- [tmp('node-test-realpath-f2'), targetsAbsDir +
- '/nested-index/one/realpath-c'],
- [targetsAbsDir + '/nested-index/one/realpath-c', targetsAbsDir +
- '/nested-index/two/realpath-c'],
- [targetsAbsDir + '/nested-index/two/realpath-c',
- common.tmpDir + '/cycles/root.js']
+ [tmp('node-test-realpath-f2'),
+ `${targetsAbsDir}/nested-index/one/realpath-c`],
+ [`${targetsAbsDir}/nested-index/one/realpath-c`,
+ `${targetsAbsDir}/nested-index/two/realpath-c`],
+ [`${targetsAbsDir}/nested-index/two/realpath-c`,
+ `${tmpDir}/cycles/root.js`]
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
fs.symlinkSync(t[1], t[0]);
@@ -309,7 +314,7 @@ function test_deep_symlink_mix(callback) {
} finally {
unlink.push(tmp('node-test-realpath-d2'));
}
- const expected = tmpAbsDir + '/cycles/root.js';
+ const expected = `${tmpAbsDir}/cycles/root.js`;
assertEqualPath(fs.realpathSync(entry), path.resolve(expected));
asynctest(fs.realpath, [entry], callback, function(err, result) {
assertEqualPath(result, path.resolve(expected));
@@ -320,8 +325,8 @@ function test_deep_symlink_mix(callback) {
function test_non_symlinks(callback) {
console.log('test_non_symlinks');
const entrydir = path.dirname(tmpAbsDir);
- const entry = tmpAbsDir.substr(entrydir.length + 1) + '/cycles/root.js';
- const expected = tmpAbsDir + '/cycles/root.js';
+ const entry = `${tmpAbsDir.substr(entrydir.length + 1)}/cycles/root.js`;
+ const expected = `${tmpAbsDir}/cycles/root.js`;
const origcwd = process.cwd();
process.chdir(entrydir);
assertEqualPath(fs.realpathSync(entry), path.resolve(expected));
@@ -336,15 +341,15 @@ const upone = path.join(process.cwd(), '..');
function test_escape_cwd(cb) {
console.log('test_escape_cwd');
asynctest(fs.realpath, ['..'], cb, function(er, uponeActual) {
- assertEqualPath(upone, uponeActual,
- 'realpath("..") expected: ' + path.resolve(upone) +
- ' actual:' + uponeActual);
+ assertEqualPath(
+ upone, uponeActual,
+ `realpath("..") expected: ${path.resolve(upone)} actual:${uponeActual}`);
});
}
const uponeActual = fs.realpathSync('..');
-assertEqualPath(upone, uponeActual,
- 'realpathSync("..") expected: ' + path.resolve(upone) +
- ' actual:' + uponeActual);
+assertEqualPath(
+ upone, uponeActual,
+ `realpathSync("..") expected: ${path.resolve(upone)} actual:${uponeActual}`);
// going up with .. multiple times
@@ -416,7 +421,7 @@ function test_abs_with_kids(cb) {
console.log('using type=%s', type);
- const root = tmpAbsDir + '/node-test-realpath-abs-kids';
+ const root = `${tmpAbsDir}/node-test-realpath-abs-kids`;
function cleanup() {
['/a/b/c/x.txt',
'/a/link'
@@ -438,15 +443,15 @@ function test_abs_with_kids(cb) {
'/a/b',
'/a/b/c'
].forEach(function(folder) {
- console.log('mkdir ' + root + folder);
+ console.log(`mkdir ${root}${folder}`);
fs.mkdirSync(root + folder, 0o700);
});
- fs.writeFileSync(root + '/a/b/c/x.txt', 'foo');
- fs.symlinkSync(root + '/a/b', root + '/a/link', type);
+ fs.writeFileSync(`${root}/a/b/c/x.txt`, 'foo');
+ fs.symlinkSync(`${root}/a/b`, `${root}/a/link`, type);
}
setup();
- const linkPath = root + '/a/link/c/x.txt';
- const expectPath = root + '/a/b/c/x.txt';
+ const linkPath = `${root}/a/link/c/x.txt`;
+ const expectPath = `${root}/a/b/c/x.txt`;
const actual = fs.realpathSync(linkPath);
// console.log({link:linkPath,expect:expectPath,actual:actual},'sync');
assertEqualPath(actual, path.resolve(expectPath));
@@ -480,8 +485,7 @@ function runNextTest(err) {
if (err) throw err;
const test = tests.shift();
if (!test) {
- return console.log(numtests +
- ' subtests completed OK for fs.realpath');
+ return console.log(`${numtests} subtests completed OK for fs.realpath`);
}
testsRun++;
test(runNextTest);
diff --git a/test/parallel/test-fs-sir-writes-alot.js b/test/parallel/test-fs-sir-writes-alot.js
index dab1cb2447c46a..2d37e2f6ad041a 100644
--- a/test/parallel/test-fs-sir-writes-alot.js
+++ b/test/parallel/test-fs-sir-writes-alot.js
@@ -34,7 +34,7 @@ function testBuffer(b) {
for (let i = 0; i < b.length; i++) {
bytesChecked++;
if (b[i] !== 'a'.charCodeAt(0) && b[i] !== '\n'.charCodeAt(0)) {
- throw new Error('invalid char ' + i + ',' + b[i]);
+ throw new Error(`invalid char ${i},${b[i]}`);
}
}
}
diff --git a/test/parallel/test-fs-stat.js b/test/parallel/test-fs-stat.js
index 00fcc1df21c586..083461a4d7bcee 100644
--- a/test/parallel/test-fs-stat.js
+++ b/test/parallel/test-fs-stat.js
@@ -28,7 +28,7 @@ fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
fs.fstat(fd, common.mustCall(function(err, stats) {
assert.ifError(err);
assert.ok(stats.mtime instanceof Date);
- fs.close(fd);
+ fs.close(fd, assert.ifError);
assert.strictEqual(this, global);
}));
@@ -47,7 +47,7 @@ fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
console.dir(stats);
assert.ok(stats.mtime instanceof Date);
}
- fs.close(fd);
+ fs.close(fd, assert.ifError);
}));
console.log(`stating: ${__filename}`);
@@ -56,25 +56,25 @@ fs.stat(__filename, common.mustCall(function(err, s) {
console.dir(s);
- console.log('isDirectory: ' + JSON.stringify(s.isDirectory()));
+ console.log(`isDirectory: ${JSON.stringify(s.isDirectory())}`);
assert.strictEqual(false, s.isDirectory());
- console.log('isFile: ' + JSON.stringify(s.isFile()));
+ console.log(`isFile: ${JSON.stringify(s.isFile())}`);
assert.strictEqual(true, s.isFile());
- console.log('isSocket: ' + JSON.stringify(s.isSocket()));
+ console.log(`isSocket: ${JSON.stringify(s.isSocket())}`);
assert.strictEqual(false, s.isSocket());
- console.log('isBlockDevice: ' + JSON.stringify(s.isBlockDevice()));
+ console.log(`isBlockDevice: ${JSON.stringify(s.isBlockDevice())}`);
assert.strictEqual(false, s.isBlockDevice());
- console.log('isCharacterDevice: ' + JSON.stringify(s.isCharacterDevice()));
+ console.log(`isCharacterDevice: ${JSON.stringify(s.isCharacterDevice())}`);
assert.strictEqual(false, s.isCharacterDevice());
- console.log('isFIFO: ' + JSON.stringify(s.isFIFO()));
+ console.log(`isFIFO: ${JSON.stringify(s.isFIFO())}`);
assert.strictEqual(false, s.isFIFO());
- console.log('isSymbolicLink: ' + JSON.stringify(s.isSymbolicLink()));
+ console.log(`isSymbolicLink: ${JSON.stringify(s.isSymbolicLink())}`);
assert.strictEqual(false, s.isSymbolicLink());
assert.ok(s.mtime instanceof Date);
diff --git a/test/parallel/test-fs-stream-double-close.js b/test/parallel/test-fs-stream-double-close.js
index ae6429a62b4f3c..ed237baa1b19c4 100644
--- a/test/parallel/test-fs-stream-double-close.js
+++ b/test/parallel/test-fs-stream-double-close.js
@@ -8,9 +8,9 @@ test1(fs.createReadStream(__filename));
test2(fs.createReadStream(__filename));
test3(fs.createReadStream(__filename));
-test1(fs.createWriteStream(common.tmpDir + '/dummy1'));
-test2(fs.createWriteStream(common.tmpDir + '/dummy2'));
-test3(fs.createWriteStream(common.tmpDir + '/dummy3'));
+test1(fs.createWriteStream(`${common.tmpDir}/dummy1`));
+test2(fs.createWriteStream(`${common.tmpDir}/dummy2`));
+test3(fs.createWriteStream(`${common.tmpDir}/dummy3`));
function test1(stream) {
stream.destroy();
diff --git a/test/parallel/test-fs-symlink-dir-junction-relative.js b/test/parallel/test-fs-symlink-dir-junction-relative.js
index 9244dd20b4349c..117f449bcd10b8 100644
--- a/test/parallel/test-fs-symlink-dir-junction-relative.js
+++ b/test/parallel/test-fs-symlink-dir-junction-relative.js
@@ -27,8 +27,8 @@ function verifyLink(linkPath) {
const stats = fs.lstatSync(linkPath);
assert.ok(stats.isSymbolicLink());
- const data1 = fs.readFileSync(linkPath + '/x.txt', 'ascii');
- const data2 = fs.readFileSync(linkTarget + '/x.txt', 'ascii');
+ const data1 = fs.readFileSync(`${linkPath}/x.txt`, 'ascii');
+ const data2 = fs.readFileSync(`${linkTarget}/x.txt`, 'ascii');
assert.strictEqual(data1, data2);
// Clean up.
diff --git a/test/parallel/test-fs-symlink-dir-junction.js b/test/parallel/test-fs-symlink-dir-junction.js
index 58ddb7ca38ae1c..e99d2ceb8cac91 100644
--- a/test/parallel/test-fs-symlink-dir-junction.js
+++ b/test/parallel/test-fs-symlink-dir-junction.js
@@ -10,8 +10,8 @@ const linkPath = path.join(common.tmpDir, 'cycles_link');
common.refreshTmpDir();
-console.log('linkData: ' + linkData);
-console.log('linkPath: ' + linkPath);
+console.log(`linkData: ${linkData}`);
+console.log(`linkPath: ${linkPath}`);
fs.symlink(linkData, linkPath, 'junction', common.mustCall(function(err) {
if (err) throw err;
diff --git a/test/parallel/test-fs-truncate-GH-6233.js b/test/parallel/test-fs-truncate-GH-6233.js
index 95eaf12cbb77f9..04af7b0f3f252e 100644
--- a/test/parallel/test-fs-truncate-GH-6233.js
+++ b/test/parallel/test-fs-truncate-GH-6233.js
@@ -3,7 +3,7 @@ const common = require('../common');
const assert = require('assert');
const fs = require('fs');
-const filename = common.tmpDir + '/truncate-file.txt';
+const filename = `${common.tmpDir}/truncate-file.txt`;
common.refreshTmpDir();
diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js
index acc69764fe1425..40b62dd2e00bed 100644
--- a/test/parallel/test-fs-write-file.js
+++ b/test/parallel/test-fs-write-file.js
@@ -56,7 +56,7 @@ fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) {
fs.readFile(filename3, common.mustCall(function(e, buffer) {
assert.ifError(e);
- assert.strictEqual(Buffer.byteLength('' + n), buffer.length);
+ assert.strictEqual(Buffer.byteLength(String(n)), buffer.length);
}));
}));
diff --git a/test/parallel/test-fs-write-stream-err.js b/test/parallel/test-fs-write-stream-err.js
index 4a2b3cd130b4c4..77978807c8a907 100644
--- a/test/parallel/test-fs-write-stream-err.js
+++ b/test/parallel/test-fs-write-stream-err.js
@@ -5,7 +5,7 @@ const fs = require('fs');
common.refreshTmpDir();
-const stream = fs.createWriteStream(common.tmpDir + '/out', {
+const stream = fs.createWriteStream(`${common.tmpDir}/out`, {
highWaterMark: 10
});
const err = new Error('BAM');
diff --git a/test/parallel/test-fs-write-string-coerce.js b/test/parallel/test-fs-write-string-coerce.js
index df19de1378d0f4..afeab5b05464ea 100644
--- a/test/parallel/test-fs-write-string-coerce.js
+++ b/test/parallel/test-fs-write-string-coerce.js
@@ -9,7 +9,7 @@ common.refreshTmpDir();
const fn = path.join(common.tmpDir, 'write-string-coerce.txt');
const data = true;
-const expected = data + '';
+const expected = String(data);
fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) {
if (err) throw err;
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-abort-client.js b/test/parallel/test-http-abort-client.js
index 6c00a1e6c64328..8d3960376761e5 100644
--- a/test/parallel/test-http-abort-client.js
+++ b/test/parallel/test-http-abort-client.js
@@ -17,11 +17,11 @@ server.listen(0, common.mustCall(function() {
}, common.mustCall(function(res) {
server.close();
- console.log('Got res: ' + res.statusCode);
+ console.log(`Got res: ${res.statusCode}`);
console.dir(res.headers);
res.on('data', function(chunk) {
- console.log('Read ' + chunk.length + ' bytes');
+ console.log(`Read ${chunk.length} bytes`);
console.log(' chunk=%j', chunk.toString());
});
diff --git a/test/parallel/test-http-abort-queued.js b/test/parallel/test-http-abort-queued.js
index 60dde248df542c..5f7259f7db968c 100644
--- a/test/parallel/test-http-abort-queued.js
+++ b/test/parallel/test-http-abort-queued.js
@@ -59,11 +59,11 @@ server.listen(0, function() {
assert.strictEqual(Object.keys(agent.sockets).length, 1);
assert.strictEqual(Object.keys(agent.requests).length, 1);
- console.log('Got res: ' + res1.statusCode);
+ console.log(`Got res: ${res1.statusCode}`);
console.dir(res1.headers);
res1.on('data', function(chunk) {
- console.log('Read ' + chunk.length + ' bytes');
+ console.log(`Read ${chunk.length} bytes`);
console.log(' chunk=%j', chunk.toString());
complete();
});
diff --git a/test/parallel/test-http-after-connect.js b/test/parallel/test-http-after-connect.js
index a93d0b83aa6f4f..8be887c58082da 100644
--- a/test/parallel/test-http-after-connect.js
+++ b/test/parallel/test-http-after-connect.js
@@ -43,7 +43,7 @@ server.listen(0, function() {
function doRequest(i) {
http.get({
port: server.address().port,
- path: '/request' + i
+ path: `/request${i}`
}, common.mustCall(function(res) {
console.error('Client got GET response');
let data = '';
@@ -52,7 +52,7 @@ function doRequest(i) {
data += chunk;
});
res.on('end', function() {
- assert.strictEqual(data, '/request' + i);
+ assert.strictEqual(data, `/request${i}`);
++clientResponses;
if (clientResponses === 2) {
server.close();
diff --git a/test/parallel/test-http-agent-error-on-idle.js b/test/parallel/test-http-agent-error-on-idle.js
index 23fa4dddfab57c..2f270c0d30ca0b 100644
--- a/test/parallel/test-http-agent-error-on-idle.js
+++ b/test/parallel/test-http-agent-error-on-idle.js
@@ -29,7 +29,7 @@ server.listen(0, function() {
process.nextTick(function() {
const freeSockets = agent.freeSockets[socketKey];
assert.strictEqual(freeSockets.length, 1,
- 'expect a free socket on ' + socketKey);
+ `expect a free socket on ${socketKey}`);
//generate a random error on the free socket
const freeSocket = freeSockets[0];
diff --git a/test/parallel/test-http-agent-getname.js b/test/parallel/test-http-agent-getname.js
index 45e1817cf5ee1e..f84996ec013eec 100644
--- a/test/parallel/test-http-agent-getname.js
+++ b/test/parallel/test-http-agent-getname.js
@@ -35,4 +35,4 @@ for (const family of [0, null, undefined, 'bogus'])
assert.strictEqual(agent.getName({ family }), 'localhost::');
for (const family of [4, 6])
- assert.strictEqual(agent.getName({ family }), 'localhost:::' + family);
+ assert.strictEqual(agent.getName({ family }), `localhost:::${family}`);
diff --git a/test/parallel/test-http-agent-maxsockets.js b/test/parallel/test-http-agent-maxsockets.js
index fc7618c5c02fe7..513906160048d9 100644
--- a/test/parallel/test-http-agent-maxsockets.js
+++ b/test/parallel/test-http-agent-maxsockets.js
@@ -30,7 +30,7 @@ function done() {
}
const freepool = agent.freeSockets[Object.keys(agent.freeSockets)[0]];
assert.strictEqual(freepool.length, 2,
- 'expect keep 2 free sockets, but got ' + freepool.length);
+ `expect keep 2 free sockets, but got ${freepool.length}`);
agent.destroy();
server.close();
}
diff --git a/test/parallel/test-http-buffer-sanity.js b/test/parallel/test-http-buffer-sanity.js
index 4226f1c65237fa..717ca23ce8bc16 100644
--- a/test/parallel/test-http-buffer-sanity.js
+++ b/test/parallel/test-http-buffer-sanity.js
@@ -37,7 +37,7 @@ const web = http.Server(function(req, res) {
});
req.connection.on('error', function(e) {
- console.log('http server-side error: ' + e.message);
+ console.log(`http server-side error: ${e.message}`);
process.exit(1);
});
});
diff --git a/test/parallel/test-http-chunk-problem.js b/test/parallel/test-http-chunk-problem.js
index 13f7a5cfc00411..a2b5dccf16c6b6 100644
--- a/test/parallel/test-http-chunk-problem.js
+++ b/test/parallel/test-http-chunk-problem.js
@@ -42,13 +42,13 @@ const filename = require('path').join(common.tmpDir, 'big');
let server;
function executeRequest(cb) {
- cp.exec([process.execPath,
- __filename,
+ cp.exec([`"${process.execPath}"`,
+ `"${__filename}"`,
'request',
server.address().port,
'|',
- process.execPath,
- __filename,
+ `"${process.execPath}"`,
+ `"${__filename}"`,
'shasum' ].join(' '),
(err, stdout, stderr) => {
if (err) throw err;
@@ -82,7 +82,7 @@ cp.exec(ddcmd, function(err, stdout, stderr) {
// End the response on exit (and log errors)
cat.on('exit', (code) => {
if (code !== 0) {
- console.error('subprocess exited with code ' + code);
+ console.error(`subprocess exited with code ${code}`);
process.exit(1);
}
});
diff --git a/test/parallel/test-http-client-abort.js b/test/parallel/test-http-client-abort.js
index 5c5b319bfa4f5f..68b76d1548de27 100644
--- a/test/parallel/test-http-client-abort.js
+++ b/test/parallel/test-http-client-abort.js
@@ -15,7 +15,7 @@ const server = http.Server(function(req, res) {
// event like "aborted" or something.
req.on('aborted', function() {
clientAborts++;
- console.log('Got abort ' + clientAborts);
+ console.log(`Got abort ${clientAborts}`);
if (clientAborts === N) {
console.log('All aborts detected, you win.');
server.close();
@@ -31,10 +31,10 @@ server.listen(0, function() {
console.log('Server listening.');
for (let i = 0; i < N; i++) {
- console.log('Making client ' + i);
- const options = { port: this.address().port, path: '/?id=' + i };
+ console.log(`Making client ${i}`);
+ const options = { port: this.address().port, path: `/?id=${i}` };
const req = http.get(options, function(res) {
- console.log('Client response code ' + res.statusCode);
+ console.log(`Client response code ${res.statusCode}`);
res.resume();
if (++responses === N) {
diff --git a/test/parallel/test-http-client-agent.js b/test/parallel/test-http-client-agent.js
index 277c7a33ae586a..b90694523745d4 100644
--- a/test/parallel/test-http-client-agent.js
+++ b/test/parallel/test-http-client-agent.js
@@ -28,7 +28,7 @@ server.listen(0, function() {
function request(i) {
const req = http.get({
port: server.address().port,
- path: '/' + i
+ path: `/${i}`
}, function(res) {
const socket = req.socket;
socket.on('close', function() {
diff --git a/test/parallel/test-http-client-default-headers-exist.js b/test/parallel/test-http-client-default-headers-exist.js
index 2271944773d9db..06923b6c79c5c0 100644
--- a/test/parallel/test-http-client-default-headers-exist.js
+++ b/test/parallel/test-http-client-default-headers-exist.js
@@ -21,21 +21,21 @@ const server = http.createServer(function(req, res) {
res.end();
assert(expectedHeaders.hasOwnProperty(req.method),
- req.method + ' was an unexpected method');
+ `${req.method} was an unexpected method`);
const requestHeaders = Object.keys(req.headers);
requestHeaders.forEach(function(header) {
assert.notStrictEqual(
expectedHeaders[req.method].indexOf(header.toLowerCase()),
-1,
- header + ' shoud not exist for method ' + req.method
+ `${header} should not exist for method ${req.method}`
);
});
assert.strictEqual(
requestHeaders.length,
expectedHeaders[req.method].length,
- 'some headers were missing for method: ' + req.method
+ `some headers were missing for method: ${req.method}`
);
if (expectedMethods.length === requestCount)
diff --git a/test/parallel/test-http-client-parse-error.js b/test/parallel/test-http-client-parse-error.js
index e649f983a51626..77cd2cb193a680 100644
--- a/test/parallel/test-http-client-parse-error.js
+++ b/test/parallel/test-http-client-parse-error.js
@@ -26,7 +26,7 @@ net.createServer(function(c) {
path: '/'
}).on('error', function(e) {
console.log('got error from client');
- assert.ok(e.message.indexOf('Parse Error') >= 0);
+ assert.ok(e.message.includes('Parse Error'));
assert.strictEqual(e.code, 'HPE_INVALID_CONSTANT');
parseErrors++;
}).end();
diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js
index 16a18342468f94..55c7d39ab4eec7 100644
--- a/test/parallel/test-http-client-timeout-agent.js
+++ b/test/parallel/test-http-client-timeout-agent.js
@@ -30,27 +30,27 @@ server.listen(0, options.host, function() {
let req;
for (requests_sent = 0; requests_sent < 30; requests_sent += 1) {
- options.path = '/' + requests_sent;
+ options.path = `/${requests_sent}`;
req = http.request(options);
req.id = requests_sent;
req.on('response', function(res) {
res.on('data', function(data) {
- console.log('res#' + this.req.id + ' data:' + data);
+ console.log(`res#${this.req.id} data:${data}`);
});
res.on('end', function(data) {
- console.log('res#' + this.req.id + ' end');
+ console.log(`res#${this.req.id} end`);
requests_done += 1;
});
});
req.on('close', function() {
- console.log('req#' + this.id + ' close');
+ console.log(`req#${this.id} close`);
});
req.on('error', function() {
- console.log('req#' + this.id + ' error');
+ console.log(`req#${this.id} error`);
this.destroy();
});
req.setTimeout(50, function() {
- console.log('req#' + this.id + ' timeout');
+ console.log(`req#${this.id} timeout`);
this.abort();
requests_done += 1;
});
diff --git a/test/parallel/test-http-client-timeout-with-data.js b/test/parallel/test-http-client-timeout-with-data.js
index a21a2181752701..fe507f00d56fd1 100644
--- a/test/parallel/test-http-client-timeout-with-data.js
+++ b/test/parallel/test-http-client-timeout-with-data.js
@@ -30,7 +30,7 @@ server.listen(0, options.host, function() {
}));
res.on('data', common.mustCall(function(data) {
- assert.strictEqual('' + data, '*');
+ assert.strictEqual(String(data), '*');
nchunks++;
}, 2));
diff --git a/test/parallel/test-http-client-unescaped-path.js b/test/parallel/test-http-client-unescaped-path.js
index eefae90541f66d..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/);
+ const path = `bad${String.fromCharCode(i)}path`;
+ assert.throws(() => http.get({ path }, common.mustNotCall()), errMessage);
}
diff --git a/test/parallel/test-http-client-upload.js b/test/parallel/test-http-client-upload.js
index 474dc333d142cd..cc58e5731809a7 100644
--- a/test/parallel/test-http-client-upload.js
+++ b/test/parallel/test-http-client-upload.js
@@ -10,7 +10,7 @@ const server = http.createServer(common.mustCall(function(req, res) {
let sent_body = '';
req.on('data', function(chunk) {
- console.log('server got: ' + JSON.stringify(chunk));
+ console.log(`server got: ${JSON.stringify(chunk)}`);
sent_body += chunk;
});
diff --git a/test/parallel/test-http-connect-req-res.js b/test/parallel/test-http-connect-req-res.js
index 8af9ba55b467b6..7a2194cabc6d4c 100644
--- a/test/parallel/test-http-connect-req-res.js
+++ b/test/parallel/test-http-connect-req-res.js
@@ -39,7 +39,7 @@ server.listen(0, common.mustCall(function() {
console.error('Client got CONNECT request');
// Make sure this request got removed from the pool.
- const name = 'localhost:' + server.address().port;
+ const name = `localhost:${server.address().port}`;
assert(!http.globalAgent.sockets.hasOwnProperty(name));
assert(!http.globalAgent.requests.hasOwnProperty(name));
diff --git a/test/parallel/test-http-connect.js b/test/parallel/test-http-connect.js
index 9eef52146b6971..8fd17bf136fdb9 100644
--- a/test/parallel/test-http-connect.js
+++ b/test/parallel/test-http-connect.js
@@ -32,7 +32,7 @@ server.listen(0, common.mustCall(function() {
req.on('connect', common.mustCall((res, socket, firstBodyChunk) => {
// Make sure this request got removed from the pool.
- const name = 'localhost:' + server.address().port;
+ const name = `localhost:${server.address().port}`;
assert(!http.globalAgent.sockets.hasOwnProperty(name));
assert(!http.globalAgent.requests.hasOwnProperty(name));
diff --git a/test/parallel/test-http-contentLength0.js b/test/parallel/test-http-contentLength0.js
index 537c7c0691af16..0cbdb380ac0166 100644
--- a/test/parallel/test-http-contentLength0.js
+++ b/test/parallel/test-http-contentLength0.js
@@ -15,7 +15,7 @@ s.listen(0, function() {
const request =
http.request({ port: this.address().port }, function(response) {
- console.log('STATUS: ' + response.statusCode);
+ console.log(`STATUS: ${response.statusCode}`);
s.close();
response.resume();
});
diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js
index c939282a43af3e..981288ecf20dde 100644
--- a/test/parallel/test-http-default-port.js
+++ b/test/parallel/test-http-default-port.js
@@ -7,8 +7,8 @@ const fs = require('fs');
const path = require('path');
const fixtures = path.join(common.fixturesDir, 'keys');
const options = {
- key: fs.readFileSync(fixtures + '/agent1-key.pem'),
- cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
+ key: fs.readFileSync(`${fixtures}/agent1-key.pem`),
+ cert: fs.readFileSync(`${fixtures}/agent1-cert.pem`)
};
let gotHttpsResp = false;
let gotHttpResp = false;
diff --git a/test/parallel/test-http-exceptions.js b/test/parallel/test-http-exceptions.js
index c003db131065a3..154f70f3ae5252 100644
--- a/test/parallel/test-http-exceptions.js
+++ b/test/parallel/test-http-exceptions.js
@@ -11,14 +11,14 @@ const server = http.createServer(function(req, res) {
server.listen(0, function() {
for (let i = 0; i < 4; i += 1) {
- http.get({ port: this.address().port, path: '/busy/' + i });
+ http.get({ port: this.address().port, path: `/busy/${i}` });
}
});
let exception_count = 0;
process.on('uncaughtException', function(err) {
- console.log('Caught an exception: ' + err);
+ console.log(`Caught an exception: ${err}`);
if (err.name === 'AssertionError') throw err;
if (++exception_count === 4) process.exit(0);
});
diff --git a/test/parallel/test-http-expect-continue.js b/test/parallel/test-http-expect-continue.js
index 01f285d29e54fb..58893134d45576 100644
--- a/test/parallel/test-http-expect-continue.js
+++ b/test/parallel/test-http-expect-continue.js
@@ -10,8 +10,8 @@ let sent_continue = false;
let got_continue = false;
function handler(req, res) {
- assert.strictEqual(sent_continue, true, 'Full response sent before ' +
- '100 Continue');
+ assert.strictEqual(sent_continue, true,
+ 'Full response sent before 100 Continue');
console.error('Server sending full response...');
res.writeHead(200, {
'Content-Type': 'text/plain',
@@ -50,8 +50,8 @@ server.on('listening', function() {
req.on('response', function(res) {
assert.strictEqual(got_continue, true,
'Full response received before 100 Continue');
- assert.strictEqual(200, res.statusCode, 'Final status code was ' +
- res.statusCode + ', not 200.');
+ assert.strictEqual(200, res.statusCode,
+ `Final status code was ${res.statusCode}, not 200.`);
res.setEncoding('utf8');
res.on('data', function(chunk) { body += chunk; });
res.on('end', function() {
diff --git a/test/parallel/test-http-expect-handling.js b/test/parallel/test-http-expect-handling.js
index fed715bc2ace7d..fd1f244979459f 100644
--- a/test/parallel/test-http-expect-handling.js
+++ b/test/parallel/test-http-expect-handling.js
@@ -35,8 +35,8 @@ function nextTest() {
}
http.get(options, function(response) {
- console.log('client: expected status: ' + test);
- console.log('client: statusCode: ' + response.statusCode);
+ console.log(`client: expected status: ${test}`);
+ console.log(`client: statusCode: ${response.statusCode}`);
assert.strictEqual(response.statusCode, test);
assert.strictEqual(response.statusMessage, 'Expectation Failed');
diff --git a/test/parallel/test-http-extra-response.js b/test/parallel/test-http-extra-response.js
index 5e994134c2e2ad..acd6e3288be18d 100644
--- a/test/parallel/test-http-extra-response.js
+++ b/test/parallel/test-http-extra-response.js
@@ -28,7 +28,7 @@ const server = net.createServer(function(socket) {
socket.on('data', function(chunk) {
postBody += chunk;
- if (postBody.indexOf('\r\n') > -1) {
+ if (postBody.includes('\r\n')) {
socket.write(fullResponse);
// omg, I wrote the response twice, what a terrible HTTP server I am.
socket.end(fullResponse);
@@ -44,7 +44,7 @@ const server = net.createServer(function(socket) {
server.listen(0, common.mustCall(function() {
http.get({ port: this.address().port }, common.mustCall(function(res) {
let buffer = '';
- console.log('Got res code: ' + res.statusCode);
+ console.log(`Got res code: ${res.statusCode}`);
res.setEncoding('utf8');
res.on('data', function(chunk) {
@@ -52,7 +52,7 @@ server.listen(0, common.mustCall(function() {
});
res.on('end', common.mustCall(function() {
- console.log('Response ended, read ' + buffer.length + ' bytes');
+ console.log(`Response ended, read ${buffer.length} bytes`);
assert.strictEqual(body, buffer);
server.close();
}));
diff --git a/test/parallel/test-http-full-response.js b/test/parallel/test-http-full-response.js
index 881734ceb1af6f..0e834cee5b8932 100644
--- a/test/parallel/test-http-full-response.js
+++ b/test/parallel/test-http-full-response.js
@@ -22,7 +22,7 @@ function runAb(opts, callback) {
exec(command, function(err, stdout, stderr) {
if (err) {
if (/ab|apr/mi.test(stderr)) {
- common.skip('problem spawning `ab`.\n' + stderr);
+ common.skip(`problem spawning \`ab\`.\n${stderr}`);
process.reallyExit(0);
}
process.exit();
diff --git a/test/parallel/test-http-get-pipeline-problem.js b/test/parallel/test-http-get-pipeline-problem.js
index 56bfb33456dff7..b0a991f448dea7 100644
--- a/test/parallel/test-http-get-pipeline-problem.js
+++ b/test/parallel/test-http-get-pipeline-problem.js
@@ -11,9 +11,9 @@ http.globalAgent.maxSockets = 1;
common.refreshTmpDir();
-const image = fs.readFileSync(common.fixturesDir + '/person.jpg');
+const image = fs.readFileSync(`${common.fixturesDir}/person.jpg`);
-console.log('image.length = ' + image.length);
+console.log(`image.length = ${image.length}`);
const total = 10;
let requests = 0, responses = 0;
@@ -45,12 +45,12 @@ server.listen(0, function() {
};
http.get(opts, function(res) {
- console.error('recv ' + x);
- const s = fs.createWriteStream(common.tmpDir + '/' + x + '.jpg');
+ console.error(`recv ${x}`);
+ const s = fs.createWriteStream(`${common.tmpDir}/${x}.jpg`);
res.pipe(s);
s.on('finish', function() {
- console.error('done ' + x);
+ console.error(`done ${x}`);
if (++responses === total) {
checkFiles();
}
@@ -71,12 +71,12 @@ function checkFiles() {
assert(total <= files.length);
for (let i = 0; i < total; i++) {
- const fn = i + '.jpg';
- assert.ok(files.indexOf(fn) >= 0, "couldn't find '" + fn + "'");
- const stat = fs.statSync(common.tmpDir + '/' + fn);
- assert.strictEqual(image.length, stat.size,
- "size doesn't match on '" + fn +
- "'. Got " + stat.size + ' bytes');
+ const fn = `${i}.jpg`;
+ assert.ok(files.includes(fn), `couldn't find '${fn}'`);
+ const stat = fs.statSync(`${common.tmpDir}/${fn}`);
+ assert.strictEqual(
+ image.length, stat.size,
+ `size doesn't match on '${fn}'. Got ${stat.size} bytes`);
}
checkedFiles = true;
diff --git a/test/parallel/test-http-host-headers.js b/test/parallel/test-http-host-headers.js
index a6667c64034835..c9ada7b84f842d 100644
--- a/test/parallel/test-http-host-headers.js
+++ b/test/parallel/test-http-host-headers.js
@@ -8,9 +8,9 @@ function reqHandler(req, res) {
if (req.url === '/setHostFalse5') {
assert.strictEqual(req.headers.host, undefined);
} else {
- assert.strictEqual(req.headers.host, `localhost:${this.address().port}`,
- 'Wrong host header for req[' + req.url + ']: ' +
- req.headers.host);
+ assert.strictEqual(
+ req.headers.host, `localhost:${this.address().port}`,
+ `Wrong host header for req[${req.url}]: ${req.headers.host}`);
}
res.writeHead(200, {});
res.end('ok');
@@ -34,7 +34,7 @@ function testHttp() {
assert.ifError(er);
http.get({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -42,7 +42,7 @@ function testHttp() {
http.request({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -50,7 +50,7 @@ function testHttp() {
http.request({
method: 'POST',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -58,7 +58,7 @@ function testHttp() {
http.request({
method: 'PUT',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
@@ -66,7 +66,7 @@ function testHttp() {
http.request({
method: 'DELETE',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
port: httpServer.address().port,
rejectUnauthorized: false
diff --git a/test/parallel/test-http-invalidheaderfield2.js b/test/parallel/test-http-invalidheaderfield2.js
index e7e8013c37c170..2267c8565cb634 100644
--- a/test/parallel/test-http-invalidheaderfield2.js
+++ b/test/parallel/test-http-invalidheaderfield2.js
@@ -28,11 +28,9 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'4+2',
'3.14159265359'
].forEach(function(str) {
- assert.strictEqual(checkIsHttpToken(str),
- true,
- 'checkIsHttpToken(' +
- inspect(str) +
- ') unexpectedly failed');
+ assert.strictEqual(
+ checkIsHttpToken(str), true,
+ `checkIsHttpToken(${inspect(str)}) unexpectedly failed`);
});
// Bad header field names
[
@@ -56,11 +54,9 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'"Quote"',
'This,That'
].forEach(function(str) {
- assert.strictEqual(checkIsHttpToken(str),
- false,
- 'checkIsHttpToken(' +
- inspect(str) +
- ') unexpectedly succeeded');
+ assert.strictEqual(
+ checkIsHttpToken(str), false,
+ `checkIsHttpToken(${inspect(str)}) unexpectedly succeeded`);
});
@@ -71,11 +67,9 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'0123456789ABCdef',
'!@#$%^&*()-_=+\\;\':"[]{}<>,./?|~`'
].forEach(function(str) {
- assert.strictEqual(checkInvalidHeaderChar(str),
- false,
- 'checkInvalidHeaderChar(' +
- inspect(str) +
- ') unexpectedly failed');
+ assert.strictEqual(
+ checkInvalidHeaderChar(str), false,
+ `checkInvalidHeaderChar(${inspect(str)}) unexpectedly failed`);
});
// Bad header field values
@@ -89,9 +83,7 @@ const checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;
'foo\vbar',
'Ding!\x07'
].forEach(function(str) {
- assert.strictEqual(checkInvalidHeaderChar(str),
- true,
- 'checkInvalidHeaderChar(' +
- inspect(str) +
- ') unexpectedly succeeded');
+ assert.strictEqual(
+ checkInvalidHeaderChar(str), true,
+ `checkInvalidHeaderChar(${inspect(str)}) unexpectedly succeeded`);
});
diff --git a/test/parallel/test-http-keepalive-client.js b/test/parallel/test-http-keepalive-client.js
index daa55d64a97c92..1c501467421ba9 100644
--- a/test/parallel/test-http-keepalive-client.js
+++ b/test/parallel/test-http-keepalive-client.js
@@ -38,7 +38,7 @@ function makeRequest(n) {
const req = http.request({
port: server.address().port,
agent: agent,
- path: '/' + n
+ path: `/${n}`
});
req.end();
@@ -58,7 +58,7 @@ function makeRequest(n) {
data += c;
});
res.on('end', function() {
- assert.strictEqual(data, '/' + n);
+ assert.strictEqual(data, `/${n}`);
setTimeout(function() {
actualRequests++;
makeRequest(n - 1);
diff --git a/test/parallel/test-http-keepalive-maxsockets.js b/test/parallel/test-http-keepalive-maxsockets.js
index 0d684a43f778f9..fd01fa02750853 100644
--- a/test/parallel/test-http-keepalive-maxsockets.js
+++ b/test/parallel/test-http-keepalive-maxsockets.js
@@ -63,7 +63,7 @@ server.listen(0, function() {
function makeReq(i, cb) {
http.request({
port: server.address().port,
- path: '/' + i,
+ path: `/${i}`,
agent: agent
}, function(res) {
let data = '';
@@ -72,7 +72,7 @@ server.listen(0, function() {
data += c;
});
res.on('end', function() {
- assert.strictEqual(data, '/' + i);
+ assert.strictEqual(data, `/${i}`);
cb();
});
}).end();
diff --git a/test/parallel/test-http-keepalive-request.js b/test/parallel/test-http-keepalive-request.js
index cce6dc1786c8ea..bfff82c7f5d09e 100644
--- a/test/parallel/test-http-keepalive-request.js
+++ b/test/parallel/test-http-keepalive-request.js
@@ -37,7 +37,7 @@ function makeRequest(n) {
const req = http.request({
port: server.address().port,
- path: '/' + n,
+ path: `/${n}`,
agent: agent
});
@@ -58,7 +58,7 @@ function makeRequest(n) {
data += c;
});
res.on('end', function() {
- assert.strictEqual(data, '/' + n);
+ assert.strictEqual(data, `/${n}`);
setTimeout(function() {
actualRequests++;
makeRequest(n - 1);
diff --git a/test/parallel/test-http-localaddress-bind-error.js b/test/parallel/test-http-localaddress-bind-error.js
index a23c6f2a4452a6..99c0bac89be2ab 100644
--- a/test/parallel/test-http-localaddress-bind-error.js
+++ b/test/parallel/test-http-localaddress-bind-error.js
@@ -5,11 +5,11 @@ const http = require('http');
const invalidLocalAddress = '1.2.3.4';
const server = http.createServer(function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
@@ -24,7 +24,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
}, function(res) {
common.fail('unexpectedly got response from server');
}).on('error', common.mustCall(function(e) {
- console.log('client got error: ' + e.message);
+ console.log(`client got error: ${e.message}`);
server.close();
})).end();
}));
diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js
index d48a4ec8f5b0ee..a815e6a3ac9a39 100644
--- a/test/parallel/test-http-localaddress.js
+++ b/test/parallel/test-http-localaddress.js
@@ -9,12 +9,12 @@ if (!common.hasMultiLocalhost()) {
}
const server = http.createServer(function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
assert.strictEqual('127.0.0.2', req.connection.remoteAddress);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
diff --git a/test/parallel/test-http-malformed-request.js b/test/parallel/test-http-malformed-request.js
index 93aff802c7afbd..f0846edadbddd3 100644
--- a/test/parallel/test-http-malformed-request.js
+++ b/test/parallel/test-http-malformed-request.js
@@ -12,7 +12,7 @@ let nrequests_completed = 0;
const nrequests_expected = 1;
const server = http.createServer(function(req, res) {
- console.log('req: ' + JSON.stringify(url.parse(req.url)));
+ console.log(`req: ${JSON.stringify(url.parse(req.url))}`);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World');
diff --git a/test/parallel/test-http-max-headers-count.js b/test/parallel/test-http-max-headers-count.js
index fd92637f7ac10b..6e1450e47b02f6 100644
--- a/test/parallel/test-http-max-headers-count.js
+++ b/test/parallel/test-http-max-headers-count.js
@@ -9,7 +9,7 @@ let responses = 0;
const headers = {};
const N = 2000;
for (let i = 0; i < N; ++i) {
- headers['key' + i] = i;
+ headers[`key${i}`] = i;
}
const maxAndExpected = [ // for server
diff --git a/test/parallel/test-http-mutable-headers.js b/test/parallel/test-http-mutable-headers.js
index 8f9d597efbec92..2a4b0dc6c1c99b 100644
--- a/test/parallel/test-http-mutable-headers.js
+++ b/test/parallel/test-http-mutable-headers.js
@@ -22,10 +22,18 @@ const cookies = [
const s = http.createServer(function(req, res) {
switch (test) {
case 'headers':
- assert.throws(function() { res.setHeader(); });
- assert.throws(function() { res.setHeader('someHeader'); });
- assert.throws(function() { res.getHeader(); });
- assert.throws(function() { res.removeHeader(); });
+ assert.throws(() => {
+ res.setHeader();
+ }, /^TypeError: Header name must be a valid HTTP Token \["undefined"\]$/);
+ assert.throws(() => {
+ res.setHeader('someHeader');
+ }, /^Error: "value" required in setHeader\("someHeader", value\)$/);
+ assert.throws(() => {
+ res.getHeader();
+ }, /^Error: "name" argument is required for getHeader\(name\)$/);
+ assert.throws(() => {
+ res.removeHeader();
+ }, /^Error: "name" argument is required for removeHeader\(name\)$/);
res.setHeader('x-test-header', 'testing');
res.setHeader('X-TEST-HEADER2', 'testing');
diff --git a/test/parallel/test-http-outgoing-finish.js b/test/parallel/test-http-outgoing-finish.js
index 73654909d88e1b..3ed9c5090b7f9f 100644
--- a/test/parallel/test-http-outgoing-finish.js
+++ b/test/parallel/test-http-outgoing-finish.js
@@ -39,7 +39,7 @@ function write(out) {
finishEvent = true;
console.error('%s finish event', name);
process.nextTick(function() {
- assert(endCb, name + ' got finish event before endcb!');
+ assert(endCb, `${name} got finish event before endcb!`);
console.log('ok - %s finishEvent', name);
});
});
@@ -48,7 +48,7 @@ function write(out) {
endCb = true;
console.error('%s endCb', name);
process.nextTick(function() {
- assert(finishEvent, name + ' got endCb event before finishEvent!');
+ assert(finishEvent, `${name} got endCb event before finishEvent!`);
console.log('ok - %s endCb', name);
});
});
diff --git a/test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js b/test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js
new file mode 100644
index 00000000000000..214287a6ffc157
--- /dev/null
+++ b/test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js
@@ -0,0 +1,36 @@
+'use strict';
+const common = require('../common');
+
+// Regression test for https://github.com/nodejs/node/issues/11788.
+
+const assert = require('assert');
+const http = require('http');
+const net = require('net');
+
+for (const enc of ['utf8', 'utf16le', 'latin1', 'UTF-8']) {
+ const server = http.createServer(common.mustCall((req, res) => {
+ res.setHeader('content-type', `text/plain; charset=${enc}`);
+ res.write('helloworld', enc);
+ res.end();
+ })).listen(0);
+
+ server.on('listening', common.mustCall(() => {
+ const buffers = [];
+ const socket = net.connect(server.address().port);
+ socket.write('GET / HTTP/1.0\r\n\r\n');
+ socket.on('data', (data) => buffers.push(data));
+ socket.on('end', common.mustCall(() => {
+ const received = Buffer.concat(buffers);
+ const headerEnd = received.indexOf('\r\n\r\n', 'utf8');
+ assert.notStrictEqual(headerEnd, -1);
+
+ const header = received.toString('utf8', 0, headerEnd).split(/\r\n/g);
+ const body = received.toString(enc, headerEnd + 4);
+
+ assert.strictEqual(header[0], 'HTTP/1.1 200 OK');
+ assert.strictEqual(header[1], `content-type: text/plain; charset=${enc}`);
+ assert.strictEqual(body, 'helloworld');
+ server.close();
+ }));
+ }));
+}
diff --git a/test/parallel/test-http-parser.js b/test/parallel/test-http-parser.js
index de7302e60d91ba..74f8abfa3b70c8 100644
--- a/test/parallel/test-http-parser.js
+++ b/test/parallel/test-http-parser.js
@@ -63,7 +63,7 @@ function mustCall(f, times) {
function expectBody(expected) {
return mustCall(function(buf, start, len) {
- const body = '' + buf.slice(start, start + len);
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, expected);
});
}
@@ -73,13 +73,11 @@ function expectBody(expected) {
// Simple request test.
//
{
- const request = Buffer.from(
- 'GET /hello HTTP/1.1' + CRLF +
- CRLF);
+ const request = Buffer.from(`GET /hello HTTP/1.1${CRLF}${CRLF}`);
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(versionMajor, 1);
assert.strictEqual(versionMinor, 1);
assert.strictEqual(method, methods.indexOf('GET'));
@@ -118,9 +116,9 @@ function expectBody(expected) {
CRLF +
'pong');
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, undefined);
assert.strictEqual(versionMajor, 1);
assert.strictEqual(versionMinor, 1);
@@ -128,8 +126,8 @@ function expectBody(expected) {
assert.strictEqual(statusMessage, 'OK');
};
- const onBody = function(buf, start, len) {
- const body = '' + buf.slice(start, start + len);
+ const onBody = (buf, start, len) => {
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, 'pong');
};
@@ -145,12 +143,11 @@ function expectBody(expected) {
//
{
const request = Buffer.from(
- 'HTTP/1.0 200 Connection established' + CRLF +
- CRLF);
+ `HTTP/1.0 200 Connection established${CRLF}${CRLF}`);
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(versionMajor, 1);
assert.strictEqual(versionMinor, 0);
assert.strictEqual(method, undefined);
@@ -182,15 +179,15 @@ function expectBody(expected) {
let seen_body = false;
- const onHeaders = function(headers, url) {
+ const onHeaders = (headers, url) => {
assert.ok(seen_body); // trailers should come after the body
assert.deepStrictEqual(headers,
['Vary', '*', 'Content-Type', 'text/plain']);
};
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('POST'));
assert.strictEqual(url || parser.url, '/it');
assert.strictEqual(versionMajor, 1);
@@ -199,8 +196,8 @@ function expectBody(expected) {
parser[kOnHeaders] = mustCall(onHeaders);
};
- const onBody = function(buf, start, len) {
- const body = '' + buf.slice(start, start + len);
+ const onBody = (buf, start, len) => {
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, 'ping');
seen_body = true;
};
@@ -223,9 +220,9 @@ function expectBody(expected) {
'X-Filler2: 42' + CRLF +
CRLF);
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('GET'));
assert.strictEqual(versionMajor, 1);
assert.strictEqual(versionMinor, 0);
@@ -245,17 +242,16 @@ function expectBody(expected) {
//
{
// 256 X-Filler headers
- let lots_of_headers = 'X-Filler: 42' + CRLF;
- lots_of_headers = lots_of_headers.repeat(256);
+ const lots_of_headers = `X-Filler: 42${CRLF}`.repeat(256);
const request = Buffer.from(
'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF +
lots_of_headers +
CRLF);
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('GET'));
assert.strictEqual(url || parser.url, '/foo/bar/baz?quux=42#1337');
assert.strictEqual(versionMajor, 1);
@@ -287,17 +283,17 @@ function expectBody(expected) {
CRLF +
'foo=42&bar=1337');
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('POST'));
assert.strictEqual(url || parser.url, '/it');
assert.strictEqual(versionMajor, 1);
assert.strictEqual(versionMinor, 1);
};
- const onBody = function(buf, start, len) {
- const body = '' + buf.slice(start, start + len);
+ const onBody = (buf, start, len) => {
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, 'foo=42&bar=1337');
};
@@ -325,9 +321,9 @@ function expectBody(expected) {
'1234567890' + CRLF +
'0' + CRLF);
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('POST'));
assert.strictEqual(url || parser.url, '/it');
assert.strictEqual(versionMajor, 1);
@@ -337,8 +333,8 @@ function expectBody(expected) {
let body_part = 0;
const body_parts = ['123', '123456', '1234567890'];
- const onBody = function(buf, start, len) {
- const body = '' + buf.slice(start, start + len);
+ const onBody = (buf, start, len) => {
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, body_parts[body_part++]);
};
@@ -363,9 +359,9 @@ function expectBody(expected) {
'6' + CRLF +
'123456' + CRLF);
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('POST'));
assert.strictEqual(url || parser.url, '/it');
assert.strictEqual(versionMajor, 1);
@@ -376,8 +372,8 @@ function expectBody(expected) {
const body_parts =
['123', '123456', '123456789', '123456789ABC', '123456789ABCDEF'];
- const onBody = function(buf, start, len) {
- const body = '' + buf.slice(start, start + len);
+ const onBody = (buf, start, len) => {
+ const body = String(buf.slice(start, start + len));
assert.strictEqual(body, body_parts[body_part++]);
};
@@ -421,9 +417,9 @@ function expectBody(expected) {
'0' + CRLF);
function test(a, b) {
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('POST'));
assert.strictEqual(url || parser.url, '/helpme');
assert.strictEqual(versionMajor, 1);
@@ -432,8 +428,8 @@ function expectBody(expected) {
let expected_body = '123123456123456789123456789ABC123456789ABCDEF';
- const onBody = function(buf, start, len) {
- const chunk = '' + buf.slice(start, start + len);
+ const onBody = (buf, start, len) => {
+ const chunk = String(buf.slice(start, start + len));
assert.strictEqual(expected_body.indexOf(chunk), 0);
expected_body = expected_body.slice(chunk.length);
};
@@ -449,11 +445,9 @@ function expectBody(expected) {
for (let i = 1; i < request.length - 1; ++i) {
const a = request.slice(0, i);
- console.error('request.slice(0, ' + i + ') = ',
- JSON.stringify(a.toString()));
+ console.error(`request.slice(0, ${i}) = ${JSON.stringify(a.toString())}`);
const b = request.slice(i);
- console.error('request.slice(' + i + ') = ',
- JSON.stringify(b.toString()));
+ console.error(`request.slice(${i}) = ${JSON.stringify(b.toString())}`);
test(a, b);
}
}
@@ -480,9 +474,9 @@ function expectBody(expected) {
'123456789ABCDEF' + CRLF +
'0' + CRLF);
- const onHeadersComplete = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('POST'));
assert.strictEqual(url || parser.url, '/it');
assert.strictEqual(versionMajor, 1);
@@ -494,8 +488,8 @@ function expectBody(expected) {
let expected_body = '123123456123456789123456789ABC123456789ABCDEF';
- const onBody = function(buf, start, len) {
- const chunk = '' + buf.slice(start, start + len);
+ const onBody = (buf, start, len) => {
+ const chunk = String(buf.slice(start, start + len));
assert.strictEqual(expected_body.indexOf(chunk), 0);
expected_body = expected_body.slice(chunk.length);
};
@@ -532,9 +526,9 @@ function expectBody(expected) {
CRLF +
'pong');
- const onHeadersComplete1 = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete1 = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('PUT'));
assert.strictEqual(url, '/this');
assert.strictEqual(versionMajor, 1);
@@ -544,9 +538,9 @@ function expectBody(expected) {
['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']);
};
- const onHeadersComplete2 = function(versionMajor, versionMinor, headers,
- method, url, statusCode, statusMessage,
- upgrade, shouldKeepAlive) {
+ const onHeadersComplete2 = (versionMajor, versionMinor, headers,
+ method, url, statusCode, statusMessage,
+ upgrade, shouldKeepAlive) => {
assert.strictEqual(method, methods.indexOf('POST'));
assert.strictEqual(url, '/that');
assert.strictEqual(versionMajor, 1);
@@ -571,9 +565,7 @@ function expectBody(expected) {
// Test parser 'this' safety
// https://github.com/joyent/node/issues/6690
assert.throws(function() {
- const request = Buffer.from(
- 'GET /hello HTTP/1.1' + CRLF +
- CRLF);
+ const request = Buffer.from(`GET /hello HTTP/1.1${CRLF}${CRLF}`);
const parser = newParser(REQUEST);
const notparser = { execute: parser.execute };
diff --git a/test/parallel/test-http-pipe-fs.js b/test/parallel/test-http-pipe-fs.js
index 5348637bd07145..4dc86a2022527e 100644
--- a/test/parallel/test-http-pipe-fs.js
+++ b/test/parallel/test-http-pipe-fs.js
@@ -28,7 +28,7 @@ const server = http.createServer(common.mustCall(function(req, res) {
}
}, function(res) {
res.on('end', function() {
- console.error('res' + i + ' end');
+ console.error(`res${i} end`);
if (i === 2) {
server.close();
}
@@ -36,7 +36,7 @@ const server = http.createServer(common.mustCall(function(req, res) {
res.resume();
});
req.on('socket', function(s) {
- console.error('req' + i + ' start');
+ console.error(`req${i} start`);
});
req.end('12345');
}(i + 1));
diff --git a/test/parallel/test-http-proxy.js b/test/parallel/test-http-proxy.js
index 91dce932dc576b..ce1322972b491d 100644
--- a/test/parallel/test-http-proxy.js
+++ b/test/parallel/test-http-proxy.js
@@ -21,13 +21,13 @@ const backend = http.createServer(function(req, res) {
});
const proxy = http.createServer(function(req, res) {
- console.error('proxy req headers: ' + JSON.stringify(req.headers));
+ console.error(`proxy req headers: ${JSON.stringify(req.headers)}`);
http.get({
port: backend.address().port,
path: url.parse(req.url).pathname
}, function(proxy_res) {
- console.error('proxy res headers: ' + JSON.stringify(proxy_res.headers));
+ console.error(`proxy res headers: ${JSON.stringify(proxy_res.headers)}`);
assert.strictEqual('world', proxy_res.headers['hello']);
assert.strictEqual('text/plain', proxy_res.headers['content-type']);
diff --git a/test/parallel/test-http-request-methods.js b/test/parallel/test-http-request-methods.js
index e4579791ef301a..a08e9bbee73b0b 100644
--- a/test/parallel/test-http-request-methods.js
+++ b/test/parallel/test-http-request-methods.js
@@ -23,7 +23,7 @@ const http = require('http');
c.setEncoding('utf8');
c.on('connect', function() {
- c.write(method + ' / HTTP/1.0\r\n\r\n');
+ c.write(`${method} / HTTP/1.0\r\n\r\n`);
});
c.on('data', function(chunk) {
diff --git a/test/parallel/test-http-response-no-headers.js b/test/parallel/test-http-response-no-headers.js
index e10571af4ccf25..8d81e95f05f378 100644
--- a/test/parallel/test-http-response-no-headers.js
+++ b/test/parallel/test-http-response-no-headers.js
@@ -12,8 +12,7 @@ const expected = {
function test(httpVersion, callback) {
const server = net.createServer(function(conn) {
- const reply = 'HTTP/' + httpVersion + ' 200 OK\r\n\r\n' +
- expected[httpVersion];
+ const reply = `HTTP/${httpVersion} 200 OK\r\n\r\n${expected[httpVersion]}`;
conn.end(reply);
});
diff --git a/test/parallel/test-http-response-status-message.js b/test/parallel/test-http-response-status-message.js
index 95859634ac394a..d4dd9a60e73801 100644
--- a/test/parallel/test-http-response-status-message.js
+++ b/test/parallel/test-http-response-status-message.js
@@ -38,15 +38,15 @@ const server = net.createServer(function(connection) {
});
});
-const runTest = function(testCaseIndex) {
+function runTest(testCaseIndex) {
const testCase = testCases[testCaseIndex];
http.get({
port: server.address().port,
path: testCase.path
}, function(response) {
- console.log('client: expected status message: ' + testCase.statusMessage);
- console.log('client: actual status message: ' + response.statusMessage);
+ console.log(`client: expected status message: ${testCase.statusMessage}`);
+ console.log(`client: actual status message: ${response.statusMessage}`);
assert.strictEqual(testCase.statusMessage, response.statusMessage);
response.on('end', function() {
@@ -61,7 +61,7 @@ const runTest = function(testCaseIndex) {
response.resume();
});
-};
+}
server.listen(0, function() { runTest(0); });
diff --git a/test/parallel/test-http-server-multiheaders2.js b/test/parallel/test-http-server-multiheaders2.js
index 53e68e6f0d3e74..5a6c499c9aa25a 100644
--- a/test/parallel/test-http-server-multiheaders2.js
+++ b/test/parallel/test-http-server-multiheaders2.js
@@ -50,12 +50,12 @@ const multipleForbidden = [
const srv = http.createServer(function(req, res) {
multipleForbidden.forEach(function(header) {
- assert.strictEqual(req.headers[header.toLowerCase()],
- 'foo', 'header parsed incorrectly: ' + header);
+ assert.strictEqual(req.headers[header.toLowerCase()], 'foo',
+ `header parsed incorrectly: ${header}`);
});
multipleAllowed.forEach(function(header) {
assert.strictEqual(req.headers[header.toLowerCase()],
- 'foo, bar', 'header parsed incorrectly: ' + header);
+ 'foo, bar', `header parsed incorrectly: ${header}`);
});
res.writeHead(200, {'Content-Type': 'text/plain'});
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-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js
index 190c8c8d8843ad..5dfcbdd4707fc3 100644
--- a/test/parallel/test-http-should-keep-alive.js
+++ b/test/parallel/test-http-should-keep-alive.js
@@ -30,10 +30,10 @@ const server = net.createServer(function(socket) {
}).listen(0, function() {
function makeRequest() {
const req = http.get({port: server.address().port}, function(res) {
- assert.strictEqual(req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses],
- SERVER_RESPONSES[responses] + ' should ' +
- (SHOULD_KEEP_ALIVE[responses] ? '' : 'not ') +
- 'Keep-Alive');
+ assert.strictEqual(
+ req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses],
+ `${SERVER_RESPONSES[responses]} should ${
+ SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`);
++responses;
if (responses < SHOULD_KEEP_ALIVE.length) {
makeRequest();
diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js
index 111b5db16daecb..5005550d145700 100644
--- a/test/parallel/test-http-status-code.js
+++ b/test/parallel/test-http-status-code.js
@@ -13,7 +13,7 @@ let testIdx = 0;
const s = http.createServer(function(req, res) {
const t = tests[testIdx];
res.writeHead(t, {'Content-Type': 'text/plain'});
- console.log('--\nserver: statusCode after writeHead: ' + res.statusCode);
+ console.log(`--\nserver: statusCode after writeHead: ${res.statusCode}`);
assert.strictEqual(res.statusCode, t);
res.end('hello world\n');
});
@@ -28,8 +28,8 @@ function nextTest() {
const test = tests[testIdx];
http.get({ port: s.address().port }, function(response) {
- console.log('client: expected status: ' + test);
- console.log('client: statusCode: ' + response.statusCode);
+ console.log(`client: expected status: ${test}`);
+ console.log(`client: statusCode: ${response.statusCode}`);
assert.strictEqual(response.statusCode, test);
response.on('end', function() {
testsComplete++;
diff --git a/test/parallel/test-http-upgrade-agent.js b/test/parallel/test-http-upgrade-agent.js
index e0e1c6d1f3fb6d..98f201f5d3f47a 100644
--- a/test/parallel/test-http-upgrade-agent.js
+++ b/test/parallel/test-http-upgrade-agent.js
@@ -35,7 +35,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() {
'upgrade': 'websocket'
}
};
- const name = options.host + ':' + options.port;
+ const name = `${options.host}:${options.port}`;
const req = http.request(options);
req.end();
diff --git a/test/parallel/test-http-url.parse-auth-with-header-in-request.js b/test/parallel/test-http-url.parse-auth-with-header-in-request.js
index cdf3f7a5aea8af..40c1a72f5aecde 100644
--- a/test/parallel/test-http-url.parse-auth-with-header-in-request.js
+++ b/test/parallel/test-http-url.parse-auth-with-header-in-request.js
@@ -19,7 +19,7 @@ const server = http.createServer(function(request, response) {
server.listen(0, function() {
const testURL =
- url.parse(`http://asdf:qwer@localhost:${this.address().port}`);
+ url.parse(`http://asdf:qwer@localhost:${this.address().port}`);
// the test here is if you set a specific authorization header in the
// request we should not override that with basic auth
testURL.headers = {
diff --git a/test/parallel/test-http-url.parse-basic.js b/test/parallel/test-http-url.parse-basic.js
index ac22b6e38d80e1..5620119d352b6b 100644
--- a/test/parallel/test-http-url.parse-basic.js
+++ b/test/parallel/test-http-url.parse-basic.js
@@ -14,7 +14,7 @@ function check(request) {
assert.strictEqual(request.url, '/');
// the host header should use the url.parse.hostname
assert.strictEqual(request.headers.host,
- testURL.hostname + ':' + testURL.port);
+ `${testURL.hostname}:${testURL.port}`);
}
const server = http.createServer(function(request, response) {
diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js
index ad40e76debee90..069322288a4cde 100644
--- a/test/parallel/test-http-url.parse-https.request.js
+++ b/test/parallel/test-http-url.parse-https.request.js
@@ -13,8 +13,8 @@ const fs = require('fs');
// https options
const httpsOptions = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
function check(request) {
diff --git a/test/parallel/test-http-url.parse-only-support-http-https-protocol.js b/test/parallel/test-http-url.parse-only-support-http-https-protocol.js
index b3d7795e72cefa..d17a541d028b8b 100644
--- a/test/parallel/test-http-url.parse-only-support-http-https-protocol.js
+++ b/test/parallel/test-http-url.parse-only-support-http-https-protocol.js
@@ -9,8 +9,8 @@ assert.throws(function() {
http.request(url.parse('file:///whatever'));
}, function(err) {
if (err instanceof Error) {
- assert.strictEqual(err.message, 'Protocol "file:" not supported.' +
- ' Expected "http:"');
+ assert.strictEqual(
+ err.message, 'Protocol "file:" not supported. Expected "http:"');
return true;
}
});
@@ -19,8 +19,8 @@ assert.throws(function() {
http.request(url.parse('mailto:asdf@asdf.com'));
}, function(err) {
if (err instanceof Error) {
- assert.strictEqual(err.message, 'Protocol "mailto:" not supported.' +
- ' Expected "http:"');
+ assert.strictEqual(
+ err.message, 'Protocol "mailto:" not supported. Expected "http:"');
return true;
}
});
@@ -29,8 +29,8 @@ assert.throws(function() {
http.request(url.parse('ftp://www.example.com'));
}, function(err) {
if (err instanceof Error) {
- assert.strictEqual(err.message, 'Protocol "ftp:" not supported.' +
- ' Expected "http:"');
+ assert.strictEqual(
+ err.message, 'Protocol "ftp:" not supported. Expected "http:"');
return true;
}
});
@@ -39,8 +39,8 @@ assert.throws(function() {
http.request(url.parse('javascript:alert(\'hello\');'));
}, function(err) {
if (err instanceof Error) {
- assert.strictEqual(err.message, 'Protocol "javascript:" not supported.' +
- ' Expected "http:"');
+ assert.strictEqual(
+ err.message, 'Protocol "javascript:" not supported. Expected "http:"');
return true;
}
});
@@ -49,8 +49,8 @@ assert.throws(function() {
http.request(url.parse('xmpp:isaacschlueter@jabber.org'));
}, function(err) {
if (err instanceof Error) {
- assert.strictEqual(err.message, 'Protocol "xmpp:" not supported.' +
- ' Expected "http:"');
+ assert.strictEqual(
+ err.message, 'Protocol "xmpp:" not supported. Expected "http:"');
return true;
}
});
@@ -59,8 +59,8 @@ assert.throws(function() {
http.request(url.parse('f://some.host/path'));
}, function(err) {
if (err instanceof Error) {
- assert.strictEqual(err.message, 'Protocol "f:" not supported.' +
- ' Expected "http:"');
+ assert.strictEqual(
+ err.message, 'Protocol "f:" not supported. Expected "http:"');
return true;
}
});
diff --git a/test/parallel/test-http-url.parse-post.js b/test/parallel/test-http-url.parse-post.js
index d63f404c5403dd..6f922f5f27c26a 100644
--- a/test/parallel/test-http-url.parse-post.js
+++ b/test/parallel/test-http-url.parse-post.js
@@ -13,7 +13,7 @@ function check(request) {
assert.strictEqual(request.url, '/asdf?qwer=zxcv');
//the host header should use the url.parse.hostname
assert.strictEqual(request.headers.host,
- testURL.hostname + ':' + testURL.port);
+ `${testURL.hostname}:${testURL.port}`);
}
const server = http.createServer(function(request, response) {
diff --git a/test/parallel/test-http-write-empty-string.js b/test/parallel/test-http-write-empty-string.js
index 81ebc61eef2af4..6814f7f8ebf4fa 100644
--- a/test/parallel/test-http-write-empty-string.js
+++ b/test/parallel/test-http-write-empty-string.js
@@ -5,7 +5,7 @@ const assert = require('assert');
const http = require('http');
const server = http.createServer(function(request, response) {
- console.log('responding to ' + request.url);
+ console.log(`responding to ${request.url}`);
response.writeHead(200, {'Content-Type': 'text/plain'});
response.write('1\n');
diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js
index 1178c745e1e12a..37810f0179f1fa 100644
--- a/test/parallel/test-http.js
+++ b/test/parallel/test-http.js
@@ -30,7 +30,7 @@ const server = http.Server(function(req, res) {
req.on('end', function() {
res.writeHead(200, {'Content-Type': 'text/plain'});
- res.write('The path was ' + url.parse(req.url).pathname);
+ res.write(`The path was ${url.parse(req.url).pathname}`);
res.end();
responses_sent += 1;
});
diff --git a/test/parallel/test-https-agent-constructor.js b/test/parallel/test-https-agent-constructor.js
new file mode 100644
index 00000000000000..942ad07b4a3870
--- /dev/null
+++ b/test/parallel/test-https-agent-constructor.js
@@ -0,0 +1,7 @@
+'use strict';
+require('../common');
+const assert = require('assert');
+const https = require('https');
+
+assert.doesNotThrow(() => { https.Agent(); });
+assert.ok(https.Agent() instanceof https.Agent);
diff --git a/test/parallel/test-https-agent-create-connection.js b/test/parallel/test-https-agent-create-connection.js
index 6bd86fe166d3f2..faaa8ef78f5e46 100644
--- a/test/parallel/test-https-agent-create-connection.js
+++ b/test/parallel/test-https-agent-create-connection.js
@@ -14,8 +14,8 @@ const agent = new https.Agent();
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
};
const expectedHeader = /^HTTP\/1.1 200 OK/;
diff --git a/test/parallel/test-https-agent-disable-session-reuse.js b/test/parallel/test-https-agent-disable-session-reuse.js
index 7cca9c713ae011..0331cd4e283c17 100644
--- a/test/parallel/test-https-agent-disable-session-reuse.js
+++ b/test/parallel/test-https-agent-disable-session-reuse.js
@@ -14,8 +14,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const clientSessions = [];
diff --git a/test/parallel/test-https-agent-servername.js b/test/parallel/test-https-agent-servername.js
index a321f7140396a3..8562d021c997ad 100644
--- a/test/parallel/test-https-agent-servername.js
+++ b/test/parallel/test-https-agent-servername.js
@@ -10,9 +10,9 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
};
diff --git a/test/parallel/test-https-agent-session-eviction.js b/test/parallel/test-https-agent-session-eviction.js
index d27b968a4d0d10..acead806ed066e 100644
--- a/test/parallel/test-https-agent-session-eviction.js
+++ b/test/parallel/test-https-agent-session-eviction.js
@@ -13,8 +13,8 @@ const fs = require('fs');
const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
secureOptions: SSL_OP_NO_TICKET
};
diff --git a/test/parallel/test-https-agent-session-reuse.js b/test/parallel/test-https-agent-session-reuse.js
index 3f06d1699f2cde..a9977d8ce9a915 100644
--- a/test/parallel/test-https-agent-session-reuse.js
+++ b/test/parallel/test-https-agent-session-reuse.js
@@ -13,11 +13,11 @@ const crypto = require('crypto');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
-const ca = fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem');
+const ca = fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`);
const clientSessions = {};
let serverRequests = 0;
diff --git a/test/parallel/test-https-agent-sni.js b/test/parallel/test-https-agent-sni.js
index 9bfbe3d5c6525d..fb7bee16ec004a 100644
--- a/test/parallel/test-https-agent-sni.js
+++ b/test/parallel/test-https-agent-sni.js
@@ -11,8 +11,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const TOTAL = 4;
@@ -31,7 +31,7 @@ server.listen(0, function() {
function expectResponse(id) {
return common.mustCall(function(res) {
res.resume();
- assert.strictEqual(res.headers['x-sni'], 'sni.' + id);
+ assert.strictEqual(res.headers['x-sni'], `sni.${id}`);
});
}
@@ -45,7 +45,7 @@ server.listen(0, function() {
path: '/',
port: this.address().port,
host: '127.0.0.1',
- servername: 'sni.' + j,
+ servername: `sni.${j}`,
rejectUnauthorized: false
}, expectResponse(j));
}
diff --git a/test/parallel/test-https-agent-sockets-leak.js b/test/parallel/test-https-agent-sockets-leak.js
index 27b37dc4fe202b..bc86b9c24128b3 100644
--- a/test/parallel/test-https-agent-sockets-leak.js
+++ b/test/parallel/test-https-agent-sockets-leak.js
@@ -11,9 +11,9 @@ const https = require('https');
const assert = require('assert');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
};
const server = https.Server(options, common.mustCall((req, res) => {
diff --git a/test/parallel/test-https-agent.js b/test/parallel/test-https-agent.js
index 392bdcbf033000..b32cd15bd2e7e5 100644
--- a/test/parallel/test-https-agent.js
+++ b/test/parallel/test-https-agent.js
@@ -11,8 +11,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
diff --git a/test/parallel/test-https-byteswritten.js b/test/parallel/test-https-byteswritten.js
index cdea4d1ee930f3..dcff869078ccae 100644
--- a/test/parallel/test-https-byteswritten.js
+++ b/test/parallel/test-https-byteswritten.js
@@ -10,8 +10,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const body = 'hello world\n';
diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js
index 043e21bf7e3b5f..fe7723ac229535 100644
--- a/test/parallel/test-https-client-get-url.js
+++ b/test/parallel/test-https-client-get-url.js
@@ -14,8 +14,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, common.mustCall(function(req, res) {
diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js
index 79e1a716bd77cf..f788c61e2e25b4 100644
--- a/test/parallel/test-https-client-resume.js
+++ b/test/parallel/test-https-client-resume.js
@@ -15,8 +15,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
// create server
diff --git a/test/parallel/test-https-close.js b/test/parallel/test-https-close.js
index cf950f29d6f8ad..a9b2a579637408 100644
--- a/test/parallel/test-https-close.js
+++ b/test/parallel/test-https-close.js
@@ -9,8 +9,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const connections = {};
@@ -23,7 +23,7 @@ const server = https.createServer(options, function(req, res) {
});
server.on('connection', function(connection) {
- const key = connection.remoteAddress + ':' + connection.remotePort;
+ const key = `${connection.remoteAddress}:${connection.remotePort}`;
connection.on('close', function() {
delete connections[key];
});
diff --git a/test/parallel/test-https-connect-address-family.js b/test/parallel/test-https-connect-address-family.js
index ab13e060be06ac..e7f41ce861cb27 100644
--- a/test/parallel/test-https-connect-address-family.js
+++ b/test/parallel/test-https-connect-address-family.js
@@ -19,10 +19,10 @@ function runTest() {
https.createServer({ ciphers }, common.mustCall(function(req, res) {
this.close();
res.end();
- })).listen(common.PORT, '::1', common.mustCall(function() {
+ })).listen(0, '::1', common.mustCall(function() {
const options = {
host: 'localhost',
- port: common.PORT,
+ port: this.address().port,
family: 6,
ciphers: ciphers,
rejectUnauthorized: false,
diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js
index 8e85ca70b97c47..410c673dccbdd6 100644
--- a/test/parallel/test-https-drain.js
+++ b/test/parallel/test-https-drain.js
@@ -43,7 +43,7 @@ server.listen(0, function() {
return process.nextTick(send);
}
sent += bufSize;
- console.error('sent: ' + sent);
+ console.error(`sent: ${sent}`);
resumed = true;
res.resume();
console.error('resumed');
@@ -60,7 +60,7 @@ server.listen(0, function() {
}
received += data.length;
if (received >= sent) {
- console.error('received: ' + received);
+ console.error(`received: ${received}`);
req.end();
server.close();
}
diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js
index cb48f71e51a226..6ab0cc7162c554 100644
--- a/test/parallel/test-https-eof-for-eom.js
+++ b/test/parallel/test-https-eof-for-eom.js
@@ -20,8 +20,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js
index 5a9b8eb832cae3..1772fe5577a232 100644
--- a/test/parallel/test-https-foafssl.js
+++ b/test/parallel/test-https-foafssl.js
@@ -19,8 +19,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/agent.key'),
- cert: fs.readFileSync(common.fixturesDir + '/agent.crt'),
+ key: fs.readFileSync(`${common.fixturesDir}/agent.key`),
+ cert: fs.readFileSync(`${common.fixturesDir}/agent.crt`),
requestCert: true
};
diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js
index cc5047bea7f488..6ea1c642420ada 100644
--- a/test/parallel/test-https-host-headers.js
+++ b/test/parallel/test-https-host-headers.js
@@ -10,19 +10,19 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const httpsServer = https.createServer(options, reqHandler);
function reqHandler(req, res) {
- console.log('Got request: ' + req.headers.host + ' ' + req.url);
+ console.log(`Got request: ${req.headers.host} ${req.url}`);
if (req.url === '/setHostFalse5') {
assert.strictEqual(req.headers.host, undefined);
} else {
- assert.strictEqual(req.headers.host, `localhost:${this.address().port}`,
- 'Wrong host header for req[' + req.url + ']: ' +
- req.headers.host);
+ assert.strictEqual(
+ req.headers.host, `localhost:${this.address().port}`,
+ `Wrong host header for req[${req.url}]: ${req.headers.host}`);
}
res.writeHead(200, {});
//process.nextTick(function() { res.end('ok'); });
@@ -41,7 +41,7 @@ function testHttps() {
function cb(res) {
counter--;
- console.log('back from https request. counter = ' + counter);
+ console.log(`back from https request. counter = ${counter}`);
if (counter === 0) {
httpsServer.close();
console.log('ok');
@@ -56,7 +56,7 @@ function testHttps() {
https.get({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -65,7 +65,7 @@ function testHttps() {
https.request({
method: 'GET',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -74,7 +74,7 @@ function testHttps() {
https.request({
method: 'POST',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -83,7 +83,7 @@ function testHttps() {
https.request({
method: 'PUT',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -92,7 +92,7 @@ function testHttps() {
https.request({
method: 'DELETE',
- path: '/' + (counter++),
+ path: `/${counter++}`,
host: 'localhost',
//agent: false,
port: this.address().port,
@@ -101,7 +101,7 @@ function testHttps() {
https.get({
method: 'GET',
- path: '/setHostFalse' + (counter++),
+ path: `/setHostFalse${counter++}`,
host: 'localhost',
setHost: false,
port: this.address().port,
diff --git a/test/parallel/test-https-localaddress-bind-error.js b/test/parallel/test-https-localaddress-bind-error.js
index 662d6f080a0fff..406625aa4fbc62 100644
--- a/test/parallel/test-https-localaddress-bind-error.js
+++ b/test/parallel/test-https-localaddress-bind-error.js
@@ -9,18 +9,18 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const invalidLocalAddress = '1.2.3.4';
const server = https.createServer(options, function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
@@ -35,7 +35,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
}, function(res) {
common.fail('unexpectedly got response from server');
}).on('error', common.mustCall(function(e) {
- console.log('client got error: ' + e.message);
+ console.log(`client got error: ${e.message}`);
server.close();
})).end();
}));
diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js
index 1c796f5843c63c..d660019951118e 100644
--- a/test/parallel/test-https-localaddress.js
+++ b/test/parallel/test-https-localaddress.js
@@ -15,17 +15,17 @@ if (!common.hasMultiLocalhost()) {
}
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, function(req, res) {
- console.log('Connect from: ' + req.connection.remoteAddress);
+ console.log(`Connect from: ${req.connection.remoteAddress}`);
assert.strictEqual('127.0.0.2', req.connection.remoteAddress);
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
- res.end('You are from: ' + req.connection.remoteAddress);
+ res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});
diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js
index 0e3a2ba3cd2663..f771555ed79969 100644
--- a/test/parallel/test-https-pfx.js
+++ b/test/parallel/test-https-pfx.js
@@ -9,7 +9,7 @@ if (!common.hasCrypto) {
}
const https = require('https');
-const pfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
+const pfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`);
const options = {
host: '127.0.0.1',
diff --git a/test/parallel/test-https-req-split.js b/test/parallel/test-https-req-split.js
index 4298abe5eff43d..b7acc41521c76a 100644
--- a/test/parallel/test-https-req-split.js
+++ b/test/parallel/test-https-req-split.js
@@ -13,8 +13,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
// Force splitting incoming data
@@ -23,7 +23,7 @@ tls.SLAB_BUFFER_SIZE = 1;
const server = https.createServer(options);
server.on('upgrade', common.mustCall(function(req, socket, upgrade) {
socket.on('data', function(data) {
- throw new Error('Unexpected data: ' + data);
+ throw new Error(`Unexpected data: ${data}`);
});
socket.end('HTTP/1.1 200 Ok\r\n\r\n');
}));
diff --git a/test/parallel/test-https-resume-after-renew.js b/test/parallel/test-https-resume-after-renew.js
index 72006b03750d82..da27f6e499ccca 100644
--- a/test/parallel/test-https-resume-after-renew.js
+++ b/test/parallel/test-https-resume-after-renew.js
@@ -5,9 +5,9 @@ const https = require('https');
const crypto = require('crypto');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
};
const server = https.createServer(options, function(req, res) {
diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js
index 8616e6c710c463..b161d78afabaaf 100644
--- a/test/parallel/test-https-simple.js
+++ b/test/parallel/test-https-simple.js
@@ -11,14 +11,14 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const tests = 2;
let successful = 0;
-const testSucceeded = function() {
+const testSucceeded = () => {
successful = successful + 1;
if (successful === tests) {
server.close();
@@ -34,28 +34,31 @@ const serverCallback = common.mustCall(function(req, res) {
const server = https.createServer(options, serverCallback);
-server.listen(0, function() {
+server.listen(0, common.mustCall(() => {
// Do a request ignoring the unauthorized server certs
+ const port = server.address().port;
+
const noCertCheckOptions = {
hostname: '127.0.0.1',
- port: this.address().port,
+ port: port,
path: '/',
method: 'GET',
rejectUnauthorized: false
};
+
noCertCheckOptions.Agent = new https.Agent(noCertCheckOptions);
- const req = https.request(noCertCheckOptions, function(res) {
+ const req = https.request(noCertCheckOptions, common.mustCall((res) => {
let responseBody = '';
res.on('data', function(d) {
responseBody = responseBody + d;
});
- res.on('end', function() {
+ res.on('end', common.mustCall(() => {
assert.strictEqual(responseBody, body);
testSucceeded();
- });
- });
+ }));
+ }));
req.end();
req.on('error', function(e) {
@@ -65,7 +68,7 @@ server.listen(0, function() {
// Do a request that throws error due to the invalid server certs
const checkCertOptions = {
hostname: '127.0.0.1',
- port: this.address().port,
+ port: port,
path: '/',
method: 'GET'
};
@@ -81,11 +84,11 @@ server.listen(0, function() {
});
checkCertReq.end();
- checkCertReq.on('error', function(e) {
+ checkCertReq.on('error', common.mustCall((e) => {
assert.strictEqual(e.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE');
testSucceeded();
- });
-});
+ }));
+}));
process.on('exit', function() {
assert.strictEqual(successful, tests);
diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js
index 05137b35c437ff..a9b01b375da61a 100644
--- a/test/parallel/test-https-socket-options.js
+++ b/test/parallel/test-https-socket-options.js
@@ -12,8 +12,8 @@ const fs = require('fs');
const http = require('http');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const body = 'hello world\n';
diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js
index d36b413021643f..765887f2af0e78 100644
--- a/test/parallel/test-https-strict.js
+++ b/test/parallel/test-https-strict.js
@@ -111,11 +111,11 @@ function makeReq(path, port, error, host, ca) {
options.agent = agent0;
} else {
if (!Array.isArray(ca)) ca = [ca];
- if (-1 !== ca.indexOf(ca1) && -1 !== ca.indexOf(ca2)) {
+ if (ca.includes(ca1) && ca.includes(ca2)) {
options.agent = agent3;
- } else if (-1 !== ca.indexOf(ca1)) {
+ } else if (ca.includes(ca1)) {
options.agent = agent1;
- } else if (-1 !== ca.indexOf(ca2)) {
+ } else if (ca.includes(ca2)) {
options.agent = agent2;
} else {
options.agent = agent0;
@@ -132,7 +132,7 @@ function makeReq(path, port, error, host, ca) {
: port === server3.address().port ? server3
: null;
- if (!server) throw new Error('invalid port: ' + port);
+ if (!server) throw new Error(`invalid port: ${port}`);
server.expectCount++;
req.on('response', function(res) {
diff --git a/test/parallel/test-https-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js
index ec629f39314959..20156207404022 100644
--- a/test/parallel/test-https-timeout-server-2.js
+++ b/test/parallel/test-https-timeout-server-2.js
@@ -13,8 +13,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, common.mustNotCall());
diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js
index 230ad6f64a03eb..b1c53319166395 100644
--- a/test/parallel/test-https-timeout-server.js
+++ b/test/parallel/test-https-timeout-server.js
@@ -12,8 +12,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
handshakeTimeout: 50
};
diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js
index ad8decc03cf474..fddaea576d864a 100644
--- a/test/parallel/test-https-timeout.js
+++ b/test/parallel/test-https-timeout.js
@@ -10,8 +10,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
// a server that never replies
diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js
index c96b385fc37fde..d526148f9b0cf4 100644
--- a/test/parallel/test-https-truncate.js
+++ b/test/parallel/test-https-truncate.js
@@ -11,8 +11,8 @@ const https = require('https');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
// number of bytes discovered empirically to trigger the bug
const data = Buffer.alloc(1024 * 32 + 1);
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
+ });
+}));
diff --git a/test/parallel/test-internal-socket-list-receive.js b/test/parallel/test-internal-socket-list-receive.js
new file mode 100644
index 00000000000000..db781cb505c981
--- /dev/null
+++ b/test/parallel/test-internal-socket-list-receive.js
@@ -0,0 +1,67 @@
+// Flags: --expose-internals
+'use strict';
+
+const common = require('../common');
+const assert = require('assert');
+const EventEmitter = require('events');
+const SocketListReceive = require('internal/socket_list').SocketListReceive;
+
+const key = 'test-key';
+
+// Verify that the message won't be sent when slave is not connected.
+{
+ const slave = Object.assign(new EventEmitter(), {
+ connected: false,
+ send: common.mustNotCall()
+ });
+
+ const list = new SocketListReceive(slave, key);
+ list.slave.emit('internalMessage', { key, cmd: 'NODE_SOCKET_NOTIFY_CLOSE' });
+}
+
+// Verify that a "NODE_SOCKET_ALL_CLOSED" message will be sent.
+{
+ const slave = Object.assign(new EventEmitter(), {
+ connected: true,
+ send: common.mustCall((msg) => {
+ assert.strictEqual(msg.cmd, 'NODE_SOCKET_ALL_CLOSED');
+ assert.strictEqual(msg.key, key);
+ })
+ });
+
+ const list = new SocketListReceive(slave, key);
+ list.slave.emit('internalMessage', { key, cmd: 'NODE_SOCKET_NOTIFY_CLOSE' });
+}
+
+// Verify that a "NODE_SOCKET_COUNT" message will be sent.
+{
+ const slave = Object.assign(new EventEmitter(), {
+ connected: true,
+ send: common.mustCall((msg) => {
+ assert.strictEqual(msg.cmd, 'NODE_SOCKET_COUNT');
+ assert.strictEqual(msg.key, key);
+ assert.strictEqual(msg.count, 0);
+ })
+ });
+
+ const list = new SocketListReceive(slave, key);
+ list.slave.emit('internalMessage', { key, cmd: 'NODE_SOCKET_GET_COUNT' });
+}
+
+// Verify that the connections count is added and an "empty" event
+// will be emitted when all sockets in obj were closed.
+{
+ const slave = new EventEmitter();
+ const obj = { socket: new EventEmitter() };
+
+ const list = new SocketListReceive(slave, key);
+ assert.strictEqual(list.connections, 0);
+
+ list.add(obj);
+ assert.strictEqual(list.connections, 1);
+
+ list.on('empty', common.mustCall((self) => assert.strictEqual(self, list)));
+
+ obj.socket.emit('close');
+ assert.strictEqual(list.connections, 0);
+}
diff --git a/test/parallel/test-internal-socket-list-send.js b/test/parallel/test-internal-socket-list-send.js
new file mode 100644
index 00000000000000..391ecc234076d5
--- /dev/null
+++ b/test/parallel/test-internal-socket-list-send.js
@@ -0,0 +1,114 @@
+// Flags: --expose-internals
+'use strict';
+
+const common = require('../common');
+const assert = require('assert');
+const EventEmitter = require('events');
+const SocketListSend = require('internal/socket_list').SocketListSend;
+
+const key = 'test-key';
+
+// Verify that an error will be received in callback when slave is not
+// connected.
+{
+ const slave = Object.assign(new EventEmitter(), { connected: false });
+ assert.strictEqual(slave.listenerCount('internalMessage'), 0);
+
+ const list = new SocketListSend(slave, 'test');
+
+ list._request('msg', 'cmd', common.mustCall((err) => {
+ assert.strictEqual(err.message, 'Slave closed before reply');
+ assert.strictEqual(slave.listenerCount('internalMessage'), 0);
+ }));
+}
+
+// Verify that the given message will be received in callback.
+{
+ const slave = Object.assign(new EventEmitter(), {
+ connected: true,
+ send: function(msg) {
+ process.nextTick(() =>
+ this.emit('internalMessage', { key, cmd: 'cmd' })
+ );
+ }
+ });
+
+ const list = new SocketListSend(slave, key);
+
+ list._request('msg', 'cmd', common.mustCall((err, msg) => {
+ assert.strictEqual(err, null);
+ assert.strictEqual(msg.cmd, 'cmd');
+ assert.strictEqual(msg.key, key);
+ assert.strictEqual(slave.listenerCount('internalMessage'), 0);
+ assert.strictEqual(slave.listenerCount('disconnect'), 0);
+ }));
+}
+
+// Verify that an error will be received in callback when slave was
+// disconnected.
+{
+ const slave = Object.assign(new EventEmitter(), {
+ connected: true,
+ send: function(msg) { process.nextTick(() => this.emit('disconnect')); }
+ });
+
+ const list = new SocketListSend(slave, key);
+
+ list._request('msg', 'cmd', common.mustCall((err) => {
+ assert.strictEqual(err.message, 'Slave closed before reply');
+ assert.strictEqual(slave.listenerCount('internalMessage'), 0);
+ }));
+}
+
+// Verify that a "NODE_SOCKET_ALL_CLOSED" message will be received
+// in callback.
+{
+ const slave = Object.assign(new EventEmitter(), {
+ connected: true,
+ send: function(msg) {
+ assert.strictEqual(msg.cmd, 'NODE_SOCKET_NOTIFY_CLOSE');
+ assert.strictEqual(msg.key, key);
+ process.nextTick(() =>
+ this.emit('internalMessage', { key, cmd: 'NODE_SOCKET_ALL_CLOSED' })
+ );
+ }
+ });
+
+ const list = new SocketListSend(slave, key);
+
+ list.close(common.mustCall((err, msg) => {
+ assert.strictEqual(err, null);
+ assert.strictEqual(msg.cmd, 'NODE_SOCKET_ALL_CLOSED');
+ assert.strictEqual(msg.key, key);
+ assert.strictEqual(slave.listenerCount('internalMessage'), 0);
+ assert.strictEqual(slave.listenerCount('disconnect'), 0);
+ }));
+}
+
+// Verify that the count of connections will be received in callback.
+{
+ const count = 1;
+ const slave = Object.assign(new EventEmitter(), {
+ connected: true,
+ send: function(msg) {
+ assert.strictEqual(msg.cmd, 'NODE_SOCKET_GET_COUNT');
+ assert.strictEqual(msg.key, key);
+ process.nextTick(() =>
+ this.emit('internalMessage', {
+ key,
+ count,
+ cmd: 'NODE_SOCKET_COUNT'
+ })
+ );
+ }
+ });
+
+ const list = new SocketListSend(slave, key);
+
+ list.getConnections(common.mustCall((err, msg) => {
+ assert.strictEqual(err, null);
+ assert.strictEqual(msg, count);
+ assert.strictEqual(slave.listenerCount('internalMessage'), 0);
+ assert.strictEqual(slave.listenerCount('disconnect'), 0);
+ }));
+}
diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js
index 3b56defe471af0..2113728682829d 100644
--- a/test/parallel/test-intl.js
+++ b/test/parallel/test-intl.js
@@ -16,21 +16,19 @@ const haveIntl = (global.Intl !== undefined);
// Else, returns false
function haveLocale(loc) {
const locs = process.config.variables.icu_locales.split(',');
- return locs.indexOf(loc) !== -1;
+ return locs.includes(loc);
}
if (!haveIntl) {
const erMsg =
- '"Intl" object is NOT present but v8_enable_i18n_support is ' +
- enablei18n;
+ `"Intl" object is NOT present but v8_enable_i18n_support is ${enablei18n}`;
assert.strictEqual(enablei18n, 0, erMsg);
common.skip('Intl tests because Intl object not present.');
} else {
const erMsg =
- '"Intl" object is present but v8_enable_i18n_support is ' +
- enablei18n +
- '. Is this test out of date?';
+ `"Intl" object is present but v8_enable_i18n_support is ${
+ enablei18n}. Is this test out of date?`;
assert.strictEqual(enablei18n, 1, erMsg);
// Construct a new date at the beginning of Unix time
@@ -46,10 +44,10 @@ if (!haveIntl) {
// If list is specified and doesn't contain 'en' then return.
if (process.config.variables.icu_locales && !haveLocale('en')) {
- common.skip('detailed Intl tests because English is not ' +
- 'listed as supported.');
+ common.skip(
+ 'detailed Intl tests because English is not listed as supported.');
// Smoke test. Does it format anything, or fail?
- console.log('Date(0) formatted to: ' + dtf.format(date0));
+ console.log(`Date(0) formatted to: ${dtf.format(date0)}`);
return;
}
diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js
index 36e4df28897383..f921ba0bbf8d6d 100644
--- a/test/parallel/test-listen-fd-detached-inherit.js
+++ b/test/parallel/test-listen-fd-detached-inherit.js
@@ -29,7 +29,7 @@ function test() {
let json = '';
parent.stdout.on('data', function(c) {
json += c.toString();
- if (json.indexOf('\n') !== -1) next();
+ if (json.includes('\n')) next();
});
function next() {
console.error('output from parent = %s', json);
diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js
index ec9d039e96e3f2..de878726af5761 100644
--- a/test/parallel/test-listen-fd-detached.js
+++ b/test/parallel/test-listen-fd-detached.js
@@ -29,7 +29,7 @@ function test() {
let json = '';
parent.stdout.on('data', function(c) {
json += c.toString();
- if (json.indexOf('\n') !== -1) next();
+ if (json.includes('\n')) next();
});
function next() {
console.error('output from parent = %s', json);
diff --git a/test/parallel/test-module-globalpaths-nodepath.js b/test/parallel/test-module-globalpaths-nodepath.js
index a4781d27a7a9c6..c9ba7fc5b9921d 100644
--- a/test/parallel/test-module-globalpaths-nodepath.js
+++ b/test/parallel/test-module-globalpaths-nodepath.js
@@ -10,17 +10,17 @@ const partC = '';
if (common.isWindows) {
partA = 'C:\\Users\\Rocko Artischocko\\AppData\\Roaming\\npm';
partB = 'C:\\Program Files (x86)\\nodejs\\';
- process.env['NODE_PATH'] = partA + ';' + partB + ';' + partC;
+ process.env['NODE_PATH'] = `${partA};${partB};${partC}`;
} else {
partA = '/usr/test/lib/node_modules';
partB = '/usr/test/lib/node';
- process.env['NODE_PATH'] = partA + ':' + partB + ':' + partC;
+ process.env['NODE_PATH'] = `${partA}:${partB}:${partC}`;
}
mod._initPaths();
-assert.ok(mod.globalPaths.indexOf(partA) !== -1);
-assert.ok(mod.globalPaths.indexOf(partB) !== -1);
-assert.ok(mod.globalPaths.indexOf(partC) === -1);
+assert.ok(mod.globalPaths.includes(partA));
+assert.ok(mod.globalPaths.includes(partB));
+assert.ok(!mod.globalPaths.includes(partC));
assert.ok(Array.isArray(mod.globalPaths));
diff --git a/test/parallel/test-module-loading-globalpaths.js b/test/parallel/test-module-loading-globalpaths.js
index d789f5409901ba..418e5ac4753c0a 100644
--- a/test/parallel/test-module-loading-globalpaths.js
+++ b/test/parallel/test-module-loading-globalpaths.js
@@ -51,7 +51,7 @@ if (process.argv[2] === 'child') {
child_process.execFileSync(testExecPath, [ __filename, 'child' ],
{ encoding: 'utf8', env: env });
},
- new RegExp('Cannot find module \'' + pkgName + '\''));
+ new RegExp(`Cannot find module '${pkgName}'`));
// Test module in $HOME/.node_modules.
const modHomeDir = path.join(testFixturesDir, 'home-pkg-in-node_modules');
@@ -75,8 +75,8 @@ if (process.argv[2] === 'child') {
fs.mkdirSync(prefixLibPath);
const prefixLibNodePath = path.join(prefixLibPath, 'node');
fs.mkdirSync(prefixLibNodePath);
- const pkgPath = path.join(prefixLibNodePath, pkgName + '.js');
- fs.writeFileSync(pkgPath, 'exports.string = \'' + expectedString + '\';');
+ const pkgPath = path.join(prefixLibNodePath, `${pkgName}.js`);
+ fs.writeFileSync(pkgPath, `exports.string = '${expectedString}';`);
env['HOME'] = env['USERPROFILE'] = noPkgHomeDir;
runTest(expectedString, env);
diff --git a/test/parallel/test-module-nodemodulepaths.js b/test/parallel/test-module-nodemodulepaths.js
index 02ea79b49e1ab3..dde679dcd3d9f1 100644
--- a/test/parallel/test-module-nodemodulepaths.js
+++ b/test/parallel/test-module-nodemodulepaths.js
@@ -100,6 +100,7 @@ node-gyp/node_modules/glob/node_modules',
const platformCases = common.isWindows ? cases.WIN : cases.POSIX;
platformCases.forEach((c) => {
const paths = _module._nodeModulePaths(c.file);
- assert.deepStrictEqual(c.expect, paths, 'case ' + c.file +
- ' failed, actual paths is ' + JSON.stringify(paths));
+ assert.deepStrictEqual(
+ c.expect, paths,
+ `case ${c.file} failed, actual paths is ${JSON.stringify(paths)}`);
});
diff --git a/test/parallel/test-module-require-depth.js b/test/parallel/test-module-require-depth.js
index 4d2ddac151be68..12a963e9b6c6be 100644
--- a/test/parallel/test-module-require-depth.js
+++ b/test/parallel/test-module-require-depth.js
@@ -6,8 +6,8 @@ const internalModule = require('internal/module');
// Module one loads two too so the expected depth for two is, well, two.
assert.strictEqual(internalModule.requireDepth, 0);
-const one = require(common.fixturesDir + '/module-require-depth/one');
-const two = require(common.fixturesDir + '/module-require-depth/two');
+const one = require(`${common.fixturesDir}/module-require-depth/one`);
+const two = require(`${common.fixturesDir}/module-require-depth/two`);
assert.deepStrictEqual(one, { requireDepth: 1 });
assert.deepStrictEqual(two, { requireDepth: 2 });
assert.strictEqual(internalModule.requireDepth, 0);
diff --git a/test/parallel/test-net-better-error-messages-path.js b/test/parallel/test-net-better-error-messages-path.js
index 692e5c4cfe8d95..f4d00c7aebf055 100644
--- a/test/parallel/test-net-better-error-messages-path.js
+++ b/test/parallel/test-net-better-error-messages-path.js
@@ -9,5 +9,5 @@ c.on('connect', common.mustNotCall());
c.on('error', common.mustCall(function(e) {
assert.strictEqual(e.code, 'ENOENT');
- assert.strictEqual(e.message, 'connect ENOENT ' + fp);
+ assert.strictEqual(e.message, `connect ENOENT ${fp}`);
}));
diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js
index 14f84eb15b1613..04974908c91e87 100644
--- a/test/parallel/test-net-better-error-messages-port-hostname.js
+++ b/test/parallel/test-net-better-error-messages-port-hostname.js
@@ -3,12 +3,13 @@ const common = require('../common');
const net = require('net');
const assert = require('assert');
-const c = net.createConnection(common.PORT, '***');
+// Using port 0 as hostname used is already invalid.
+const c = net.createConnection(0, '***');
c.on('connect', common.mustNotCall());
c.on('error', common.mustCall(function(e) {
assert.strictEqual(e.code, 'ENOTFOUND');
- assert.strictEqual(e.port, common.PORT);
+ assert.strictEqual(e.port, 0);
assert.strictEqual(e.hostname, '***');
}));
diff --git a/test/parallel/test-net-bytes-stats.js b/test/parallel/test-net-bytes-stats.js
index 33e089da50880a..4058a618e82da5 100644
--- a/test/parallel/test-net-bytes-stats.js
+++ b/test/parallel/test-net-bytes-stats.js
@@ -15,7 +15,7 @@ const tcp = net.Server(function(s) {
s.on('end', function() {
bytesRead += s.bytesRead;
- console.log('tcp socket disconnect #' + count);
+ console.log(`tcp socket disconnect #${count}`);
});
});
@@ -40,8 +40,8 @@ tcp.listen(0, function doTest() {
socket.on('close', function() {
console.error('CLIENT close event #%d', count);
- console.log('Bytes read: ' + bytesRead);
- console.log('Bytes written: ' + bytesWritten);
+ console.log(`Bytes read: ${bytesRead}`);
+ console.log(`Bytes written: ${bytesWritten}`);
if (count < 2) {
console.error('RECONNECTING');
socket.connect(tcp.address().port);
diff --git a/test/parallel/test-net-connect-buffer.js b/test/parallel/test-net-connect-buffer.js
index 1e296675879130..40681d82132d5b 100644
--- a/test/parallel/test-net-connect-buffer.js
+++ b/test/parallel/test-net-connect-buffer.js
@@ -24,7 +24,7 @@ const tcp = net.Server(function(s) {
});
s.on('error', function(e) {
- console.log('tcp server-side error: ' + e.message);
+ console.log(`tcp server-side error: ${e.message}`);
process.exit(1);
});
});
@@ -39,7 +39,7 @@ tcp.listen(0, function() {
connectHappened = true;
});
- console.log('connecting = ' + socket.connecting);
+ console.log(`connecting = ${socket.connecting}`);
assert.strictEqual('opening', socket.readyState);
diff --git a/test/parallel/test-net-connect-handle-econnrefused.js b/test/parallel/test-net-connect-handle-econnrefused.js
index 029390353eb793..5502062b464079 100644
--- a/test/parallel/test-net-connect-handle-econnrefused.js
+++ b/test/parallel/test-net-connect-handle-econnrefused.js
@@ -3,13 +3,14 @@ const common = require('../common');
const net = require('net');
const assert = require('assert');
-
-// Hopefully nothing is running on common.PORT
-const c = net.createConnection(common.PORT);
+const server = net.createServer();
+server.listen(0);
+const port = server.address().port;
+const c = net.createConnection(port);
c.on('connect', common.mustNotCall());
-c.on('error', common.mustCall(function(e) {
- console.error('couldn\'t connect.');
+c.on('error', common.mustCall((e) => {
assert.strictEqual('ECONNREFUSED', e.code);
}));
+server.close();
diff --git a/test/parallel/test-net-connect-immediate-destroy.js b/test/parallel/test-net-connect-immediate-destroy.js
index 9a029b5d605a0d..3ca58c356b44d1 100644
--- a/test/parallel/test-net-connect-immediate-destroy.js
+++ b/test/parallel/test-net-connect-immediate-destroy.js
@@ -2,7 +2,10 @@
const common = require('../common');
const net = require('net');
-const socket = net.connect(common.PORT, common.localhostIPv4,
- common.mustNotCall());
+const server = net.createServer();
+server.listen(0);
+const port = server.address().port;
+const socket = net.connect(port, common.localhostIPv4, common.mustNotCall());
socket.on('error', common.mustNotCall());
+server.close();
socket.destroy();
diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js
index 6114233677f5cb..2c0f45f956df16 100644
--- a/test/parallel/test-net-connect-immediate-finish.js
+++ b/test/parallel/test-net-connect-immediate-finish.js
@@ -5,7 +5,7 @@ const net = require('net');
const client = net.connect({host: '***', port: common.PORT});
-client.once('error', common.mustCall(function(err) {
+client.once('error', common.mustCall((err) => {
assert(err);
assert.strictEqual(err.code, err.errno);
assert.strictEqual(err.code, 'ENOTFOUND');
diff --git a/test/parallel/test-net-connect-local-error.js b/test/parallel/test-net-connect-local-error.js
deleted file mode 100644
index f23245ac93a49f..00000000000000
--- a/test/parallel/test-net-connect-local-error.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-const common = require('../common');
-const assert = require('assert');
-const net = require('net');
-
-const client = net.connect({
- port: common.PORT + 1,
- localPort: common.PORT,
- localAddress: common.localhostIPv4
-});
-
-client.on('error', common.mustCall(function onError(err) {
- assert.strictEqual(
- err.localPort,
- common.PORT,
- `${err.localPort} !== ${common.PORT} in ${err}`
- );
- assert.strictEqual(
- err.localAddress,
- common.localhostIPv4,
- `${err.localAddress} !== ${common.localhostIPv4} in ${err}`
- );
-}));
diff --git a/test/parallel/test-net-eaddrinuse.js b/test/parallel/test-net-eaddrinuse.js
index cf4293e8230875..9c30f933108d6f 100644
--- a/test/parallel/test-net-eaddrinuse.js
+++ b/test/parallel/test-net-eaddrinuse.js
@@ -9,7 +9,7 @@ const server2 = net.createServer(function(socket) {
});
server1.listen(0, function() {
server2.on('error', function(error) {
- assert.strictEqual(true, error.message.indexOf('EADDRINUSE') >= 0);
+ assert.strictEqual(true, error.message.includes('EADDRINUSE'));
server1.close();
});
server2.listen(this.address().port);
diff --git a/test/parallel/test-net-end-close.js b/test/parallel/test-net-end-close.js
index d9f33fd7d8d1cf..44a539a3e800a6 100644
--- a/test/parallel/test-net-end-close.js
+++ b/test/parallel/test-net-end-close.js
@@ -14,7 +14,7 @@ const s = new net.Socket({
},
writable: false
});
-s.resume();
+assert.strictEqual(s, s.resume());
const events = [];
diff --git a/test/parallel/test-net-internal.js b/test/parallel/test-net-internal.js
index a79d022a5d7eaa..309b56d4d9aafc 100644
--- a/test/parallel/test-net-internal.js
+++ b/test/parallel/test-net-internal.js
@@ -8,7 +8,7 @@ const isLegalPort = require('internal/net').isLegalPort;
for (let n = 0; n <= 0xFFFF; n++) {
assert(isLegalPort(n));
- assert(isLegalPort('' + n));
+ assert(isLegalPort(String(n)));
assert(`0x${n.toString(16)}`);
assert(`0o${n.toString(8)}`);
assert(`0b${n.toString(2)}`);
diff --git a/test/parallel/test-net-listen-shared-ports.js b/test/parallel/test-net-listen-shared-ports.js
deleted file mode 100644
index e7bc036ff3986c..00000000000000
--- a/test/parallel/test-net-listen-shared-ports.js
+++ /dev/null
@@ -1,46 +0,0 @@
-'use strict';
-const common = require('../common');
-const assert = require('assert');
-const cluster = require('cluster');
-const net = require('net');
-
-function noop() {}
-
-if (cluster.isMaster) {
- const worker1 = cluster.fork();
-
- worker1.on('message', function(msg) {
- assert.strictEqual(msg, 'success');
- const worker2 = cluster.fork();
-
- worker2.on('message', function(msg) {
- assert.strictEqual(msg, 'server2:EADDRINUSE');
- worker1.kill();
- worker2.kill();
- });
- });
-} else {
- const server1 = net.createServer(noop);
- const server2 = net.createServer(noop);
-
- server1.on('error', function(err) {
- // no errors expected
- process.send('server1:' + err.code);
- });
-
- server2.on('error', function(err) {
- // an error is expected on the second worker
- process.send('server2:' + err.code);
- });
-
- server1.listen({
- host: 'localhost',
- port: common.PORT,
- exclusive: false
- }, function() {
- server2.listen({port: common.PORT + 1, exclusive: true}, function() {
- // the first worker should succeed
- process.send('success');
- });
- });
-}
diff --git a/test/parallel/test-net-localerror.js b/test/parallel/test-net-localerror.js
index 184e55c890b2bb..b553bd88ab5690 100644
--- a/test/parallel/test-net-localerror.js
+++ b/test/parallel/test-net-localerror.js
@@ -1,22 +1,23 @@
'use strict';
-const common = require('../common');
+require('../common');
const assert = require('assert');
const net = require('net');
+// Using port 0 as localPort / localAddress is already invalid.
connect({
host: 'localhost',
- port: common.PORT,
+ port: 0,
localPort: 'foobar',
}, /^TypeError: "localPort" option should be a number: foobar$/);
connect({
host: 'localhost',
- port: common.PORT,
+ port: 0,
localAddress: 'foobar',
}, /^TypeError: "localAddress" option must be a valid IP: foobar$/);
function connect(opts, msg) {
- assert.throws(function() {
+ assert.throws(() => {
net.connect(opts);
}, msg);
}
diff --git a/test/parallel/test-net-options-lookup.js b/test/parallel/test-net-options-lookup.js
new file mode 100644
index 00000000000000..d3cecc6f947d58
--- /dev/null
+++ b/test/parallel/test-net-options-lookup.js
@@ -0,0 +1,35 @@
+'use strict';
+require('../common');
+const assert = require('assert');
+const net = require('net');
+
+const expectedError = /^TypeError: "lookup" option should be a function$/;
+
+['foobar', 1, {}, []].forEach((input) => connectThrows(input));
+
+// Using port 0 as lookup is emitted before connecting.
+function connectThrows(input) {
+ const opts = {
+ host: 'localhost',
+ port: 0,
+ lookup: input
+ };
+
+ assert.throws(() => {
+ net.connect(opts);
+ }, expectedError);
+}
+
+[() => {}].forEach((input) => connectDoesNotThrow(input));
+
+function connectDoesNotThrow(input) {
+ const opts = {
+ host: 'localhost',
+ port: 0,
+ lookup: input
+ };
+
+ assert.doesNotThrow(() => {
+ net.connect(opts);
+ });
+}
diff --git a/test/parallel/test-net-pipe-connect-errors.js b/test/parallel/test-net-pipe-connect-errors.js
index 6dc2a340651ef1..16e60a2525bd33 100644
--- a/test/parallel/test-net-pipe-connect-errors.js
+++ b/test/parallel/test-net-pipe-connect-errors.js
@@ -20,7 +20,7 @@ if (common.isWindows) {
// on CI for a POSIX socket. Even though this isn't actually a socket file,
// the error will be different from the one we are expecting if we exceed the
// limit.
- emptyTxt = common.tmpDir + '0.txt';
+ emptyTxt = `${common.tmpDir}0.txt`;
function cleanup() {
try {
diff --git a/test/parallel/test-net-reconnect.js b/test/parallel/test-net-reconnect.js
index c970ad7fc5c135..74d8b6692e9639 100644
--- a/test/parallel/test-net-reconnect.js
+++ b/test/parallel/test-net-reconnect.js
@@ -22,7 +22,7 @@ const server = net.createServer(function(socket) {
});
socket.on('close', function(had_error) {
- console.log('SERVER had_error: ' + JSON.stringify(had_error));
+ console.log(`SERVER had_error: ${JSON.stringify(had_error)}`);
assert.strictEqual(false, had_error);
});
});
@@ -39,7 +39,7 @@ server.listen(0, function() {
client.on('data', function(chunk) {
client_recv_count += 1;
- console.log('client_recv_count ' + client_recv_count);
+ console.log(`client_recv_count ${client_recv_count}`);
assert.strictEqual('hello\r\n', chunk);
console.error('CLIENT: calling end', client._writableState);
client.end();
diff --git a/test/parallel/test-net-server-bind.js b/test/parallel/test-net-server-bind.js
index 0332b364df1ca2..2804271f6f19d4 100644
--- a/test/parallel/test-net-server-bind.js
+++ b/test/parallel/test-net-server-bind.js
@@ -75,9 +75,9 @@ process.on('exit', function() {
let expectedConnectionKey1;
if (address1.family === 'IPv6')
- expectedConnectionKey1 = '6::::' + address1.port;
+ expectedConnectionKey1 = `6::::${address1.port}`;
else
- expectedConnectionKey1 = '4:0.0.0.0:' + address1.port;
+ expectedConnectionKey1 = `4:0.0.0.0:${address1.port}`;
assert.strictEqual(connectionKey1, expectedConnectionKey1);
assert.strictEqual(common.PORT + 1, address2.port);
diff --git a/test/parallel/test-net-server-close.js b/test/parallel/test-net-server-close.js
index 28519fdafdbc9c..5affadfac42930 100644
--- a/test/parallel/test-net-server-close.js
+++ b/test/parallel/test-net-server-close.js
@@ -23,7 +23,7 @@ let server = net.createServer(function(c) {
sockets.push(c);
if (sockets.length === 2) {
- server.close();
+ assert.strictEqual(server.close(), server);
sockets.forEach(function(c) { c.destroy(); });
}
});
@@ -32,7 +32,7 @@ server.on('close', function() {
events.push('server');
});
-server.listen(0, function() {
+assert.strictEqual(server, server.listen(0, function() {
net.createConnection(this.address().port);
net.createConnection(this.address().port);
-});
+}));
diff --git a/test/parallel/test-net-server-max-connections-close-makes-more-available.js b/test/parallel/test-net-server-max-connections-close-makes-more-available.js
index 60f7c304a9ff6b..f7ab54b7b83b48 100644
--- a/test/parallel/test-net-server-max-connections-close-makes-more-available.js
+++ b/test/parallel/test-net-server-max-connections-close-makes-more-available.js
@@ -17,13 +17,13 @@ const connections = [];
const received = [];
const sent = [];
-const createConnection = function(index) {
- console.error('creating connection ' + index);
+function createConnection(index) {
+ console.error(`creating connection ${index}`);
return new Promise(function(resolve, reject) {
const connection = net.createConnection(server.address().port, function() {
- const msg = '' + index;
- console.error('sending message: ' + msg);
+ const msg = String(index);
+ console.error(`sending message: ${msg}`);
this.write(msg);
sent.push(msg);
});
@@ -34,33 +34,33 @@ const createConnection = function(index) {
});
connection.on('data', function(e) {
- console.error('connection ' + index + ' received response');
+ console.error(`connection ${index} received response`);
resolve();
});
connection.on('end', function() {
- console.error('ending ' + index);
+ console.error(`ending ${index}`);
resolve();
});
connections[index] = connection;
});
-};
+}
-const closeConnection = function(index) {
- console.error('closing connection ' + index);
+function closeConnection(index) {
+ console.error(`closing connection ${index}`);
return new Promise(function(resolve, reject) {
connections[index].on('end', function() {
resolve();
});
connections[index].end();
});
-};
+}
let server = net.createServer(function(socket) {
socket.on('data', function(data) {
- console.error('received message: ' + data);
- received.push('' + data);
+ console.error(`received message: ${data}`);
+ received.push(String(data));
socket.write('acknowledged');
});
});
diff --git a/test/parallel/test-net-server-pause-on-connect.js b/test/parallel/test-net-server-pause-on-connect.js
index 5b42876e6d652e..90206982d5dcca 100644
--- a/test/parallel/test-net-server-pause-on-connect.js
+++ b/test/parallel/test-net-server-pause-on-connect.js
@@ -7,7 +7,7 @@ let stopped = true;
let server1Sock;
-const server1ConnHandler = function(socket) {
+const server1ConnHandler = (socket) => {
socket.on('data', function(data) {
if (stopped) {
common.fail('data event should not have happened yet');
@@ -23,7 +23,7 @@ const server1ConnHandler = function(socket) {
const server1 = net.createServer({pauseOnConnect: true}, server1ConnHandler);
-const server2ConnHandler = function(socket) {
+const server2ConnHandler = (socket) => {
socket.on('data', function(data) {
assert.strictEqual(data.toString(), msg, 'invalid data received');
socket.end();
diff --git a/test/parallel/test-net-socket-destroy-twice.js b/test/parallel/test-net-socket-destroy-twice.js
index 998ad05a1d6487..749964751b39ad 100644
--- a/test/parallel/test-net-socket-destroy-twice.js
+++ b/test/parallel/test-net-socket-destroy-twice.js
@@ -2,10 +2,14 @@
const common = require('../common');
const net = require('net');
-const conn = net.createConnection(common.PORT);
+const server = net.createServer();
+server.listen(0);
+const port = server.address().port;
+const conn = net.createConnection(port);
-conn.on('error', common.mustCall(function() {
+conn.on('error', common.mustCall(() => {
conn.destroy();
}));
conn.on('close', common.mustCall(function() {}));
+server.close();
diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js
index e888667eab4c4f..19749bde9552b6 100644
--- a/test/parallel/test-net-socket-local-address.js
+++ b/test/parallel/test-net-socket-local-address.js
@@ -34,7 +34,10 @@ function connect() {
conns++;
client.once('close', connect);
- client.connect(server.address().port, common.localhostIPv4, () => {
- clientLocalPorts.push(client.localPort);
- });
+ assert.strictEqual(
+ client,
+ client.connect(server.address().port, common.localhostIPv4, () => {
+ clientLocalPorts.push(client.localPort);
+ })
+ );
}
diff --git a/test/parallel/test-net-socket-timeout.js b/test/parallel/test-net-socket-timeout.js
index 61ea54debeaa61..841c1e5f134461 100644
--- a/test/parallel/test-net-socket-timeout.js
+++ b/test/parallel/test-net-socket-timeout.js
@@ -4,7 +4,7 @@ const net = require('net');
const assert = require('assert');
// Verify that invalid delays throw
-const noop = function() {};
+const noop = () => {};
const s = new net.Socket();
const nonNumericDelays = [
'100', true, false, undefined, null, '', {}, noop, []
diff --git a/test/parallel/test-net-socket-write-after-close.js b/test/parallel/test-net-socket-write-after-close.js
new file mode 100644
index 00000000000000..6d2d2fdd026333
--- /dev/null
+++ b/test/parallel/test-net-socket-write-after-close.js
@@ -0,0 +1,39 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const net = require('net');
+
+{
+ const server = net.createServer();
+
+ server.listen(common.mustCall(() => {
+ const port = server.address().port;
+ const client = net.connect({port}, common.mustCall(() => {
+ client.on('error', common.mustCall((err) => {
+ server.close();
+ assert.strictEqual(err.constructor, Error);
+ assert.strictEqual(err.message, 'write EBADF');
+ }));
+ client._handle.close();
+ client.write('foo');
+ }));
+ }));
+}
+
+{
+ const server = net.createServer();
+
+ server.listen(common.mustCall(() => {
+ const port = server.address().port;
+ const client = net.connect({port}, common.mustCall(() => {
+ client.on('error', common.mustCall((err) => {
+ server.close();
+ assert.strictEqual(err.constructor, Error);
+ assert.strictEqual(err.message, 'This socket is closed');
+ }));
+ client._handle.close();
+ client._handle = null;
+ client.write('foo');
+ }));
+ }));
+}
diff --git a/test/parallel/test-net-stream.js b/test/parallel/test-net-stream.js
index 9e1ca670e1e145..2d3cdd76be788f 100644
--- a/test/parallel/test-net-stream.js
+++ b/test/parallel/test-net-stream.js
@@ -39,7 +39,7 @@ const server = net.createServer(function(socket) {
}).listen(0, function() {
const conn = net.connect(this.address().port);
conn.on('data', function(buf) {
- conn.pause();
+ assert.strictEqual(conn, conn.pause());
setTimeout(function() {
conn.destroy();
}, 20);
diff --git a/test/parallel/test-next-tick-ordering.js b/test/parallel/test-next-tick-ordering.js
index ea019facdd8fa0..4e19f3a5fdf228 100644
--- a/test/parallel/test-next-tick-ordering.js
+++ b/test/parallel/test-next-tick-ordering.js
@@ -8,7 +8,7 @@ const done = [];
function get_printer(timeout) {
return function() {
- console.log('Running from setTimeout ' + timeout);
+ console.log(`Running from setTimeout ${timeout}`);
done.push(timeout);
};
}
diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js
index 3952088d02edeb..315f7885e840d6 100644
--- a/test/parallel/test-npm-install.js
+++ b/test/parallel/test-npm-install.js
@@ -29,7 +29,7 @@ const args = [
const pkgContent = JSON.stringify({
dependencies: {
- 'package-name': common.fixturesDir + '/packages/main'
+ 'package-name': `${common.fixturesDir}/packages/main`
}
});
@@ -52,7 +52,7 @@ function handleExit(code, signalCode) {
assert.strictEqual(code, 0, `npm install got error code ${code}`);
assert.strictEqual(signalCode, null, `unexpected signal: ${signalCode}`);
assert.doesNotThrow(function() {
- fs.accessSync(installDir + '/node_modules/package-name');
+ fs.accessSync(`${installDir}/node_modules/package-name`);
});
}
diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js
index ce0d2ee054d1f9..447d88c164456e 100644
--- a/test/parallel/test-os.js
+++ b/test/parallel/test-os.js
@@ -22,7 +22,7 @@ if (common.isWindows) {
process.env.TEMP = '';
assert.strictEqual(os.tmpdir(), '/tmp');
process.env.TMP = '';
- const expected = (process.env.SystemRoot || process.env.windir) + '\\temp';
+ const expected = `${process.env.SystemRoot || process.env.windir}\\temp`;
assert.strictEqual(os.tmpdir(), expected);
process.env.TEMP = '\\temp\\';
assert.strictEqual(os.tmpdir(), '\\temp');
@@ -104,7 +104,7 @@ console.error(interfaces);
switch (platform) {
case 'linux':
{
- const filter = function(e) { return e.address === '127.0.0.1'; };
+ const filter = (e) => e.address === '127.0.0.1';
const actual = interfaces.lo.filter(filter);
const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0',
mac: '00:00:00:00:00:00', family: 'IPv4',
@@ -114,7 +114,7 @@ switch (platform) {
}
case 'win32':
{
- const filter = function(e) { return e.address === '127.0.0.1'; };
+ const filter = (e) => e.address === '127.0.0.1';
const actual = interfaces['Loopback Pseudo-Interface 1'].filter(filter);
const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0',
mac: '00:00:00:00:00:00', family: 'IPv4',
diff --git a/test/parallel/test-path-makelong.js b/test/parallel/test-path-makelong.js
index 1284f625160ebe..769f81bdb81735 100644
--- a/test/parallel/test-path-makelong.js
+++ b/test/parallel/test-path-makelong.js
@@ -7,9 +7,9 @@ if (common.isWindows) {
const file = path.join(common.fixturesDir, 'a.js');
const resolvedFile = path.resolve(file);
- assert.strictEqual('\\\\?\\' + resolvedFile, path._makeLong(file));
- assert.strictEqual('\\\\?\\' + resolvedFile, path._makeLong('\\\\?\\' +
- file));
+ assert.strictEqual(`\\\\?\\${resolvedFile}`, path._makeLong(file));
+ assert.strictEqual(`\\\\?\\${resolvedFile}`,
+ path._makeLong(`\\\\?\\${file}`));
assert.strictEqual('\\\\?\\UNC\\someserver\\someshare\\somefile',
path._makeLong('\\\\someserver\\someshare\\somefile'));
assert.strictEqual('\\\\?\\UNC\\someserver\\someshare\\somefile', path
diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js
index 9d5c149924ff4c..af175ba340deeb 100644
--- a/test/parallel/test-path-parse-format.js
+++ b/test/parallel/test-path-parse-format.js
@@ -136,12 +136,8 @@ trailingTests.forEach(function(test) {
test[1].forEach(function(test) {
const actual = parse(test[0]);
const expected = test[1];
- const fn = `path.${os}.parse(`;
- const message = fn +
- JSON.stringify(test[0]) +
- ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.parse(${JSON.stringify(test[0])})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
const actualKeys = Object.keys(actual);
const expectedKeys = Object.keys(expected);
let failed = (actualKeys.length !== expectedKeys.length);
@@ -155,7 +151,7 @@ trailingTests.forEach(function(test) {
}
}
if (failed)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js
index 3c5374175abd8e..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,19 +170,17 @@ 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';
}
const actual = extname(input);
const expected = test[1];
- const fn = `path.${os}.extname(`;
- const message = fn + JSON.stringify(input) + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.extname(${JSON.stringify(input)})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
@@ -326,15 +327,14 @@ 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';
}
- const fn = `path.${os}.join(`;
- const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message =
+ `path.${os}.join(${test[0].map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected && actualAlt !== expected)
failures.push(`\n${message}`);
});
@@ -433,17 +433,16 @@ 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 fn = `path.${os}.resolve(`;
- const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message =
+ `path.${os}.resolve(${test[0].map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected && actualAlt !== expected)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
@@ -539,12 +538,9 @@ relativeTests.forEach((test) => {
const actual = relative(test[0], test[1]);
const expected = test[2];
const os = relative === path.win32.relative ? 'win32' : 'posix';
- const fn = `path.${os}.relative(`;
- const message = fn +
- test.slice(0, 2).map(JSON.stringify).join(',') +
- ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.relative(${
+ test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected)
failures.push(`\n${message}`);
});
diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js
index 2d478862b60ce6..2b1695f1e41f8d 100644
--- a/test/parallel/test-preload.js
+++ b/test/parallel/test-preload.js
@@ -13,17 +13,15 @@ if (common.isSunOS) {
const nodeBinary = process.argv[0];
-const preloadOption = function(preloads) {
+const preloadOption = (preloads) => {
let option = '';
preloads.forEach(function(preload, index) {
- option += '-r ' + preload + ' ';
+ option += `-r "${preload}" `;
});
return option;
};
-const fixture = function(name) {
- return path.join(common.fixturesDir, name);
-};
+const fixture = (name) => path.join(common.fixturesDir, name);
const fixtureA = fixture('printA.js');
const fixtureB = fixture('printB.js');
@@ -32,7 +30,7 @@ const fixtureD = fixture('define-global.js');
const fixtureThrows = fixture('throws_error4.js');
// test preloading a single module works
-childProcess.exec(nodeBinary + ' ' + preloadOption([fixtureA]) + ' ' + fixtureB,
+childProcess.exec(`"${nodeBinary}" ${preloadOption([fixtureA])} "${fixtureB}"`,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\n');
@@ -40,7 +38,7 @@ childProcess.exec(nodeBinary + ' ' + preloadOption([fixtureA]) + ' ' + fixtureB,
// test preloading multiple modules works
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA, fixtureB]) + ' ' + fixtureC,
+ `"${nodeBinary}" ${preloadOption([fixtureA, fixtureB])} "${fixtureC}"`,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nC\n');
@@ -49,7 +47,7 @@ childProcess.exec(
// test that preloading a throwing module aborts
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA, fixtureThrows]) + ' ' + fixtureB,
+ `"${nodeBinary}" ${preloadOption([fixtureA, fixtureThrows])} "${fixtureB}"`,
function(err, stdout, stderr) {
if (err) {
assert.strictEqual(stdout, 'A\n');
@@ -61,7 +59,7 @@ childProcess.exec(
// test that preload can be used with --eval
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA]) + '-e "console.log(\'hello\');"',
+ `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');"`,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nhello\n');
@@ -107,8 +105,8 @@ replProc.on('close', function(code) {
// test that preload placement at other points in the cmdline
// also test that duplicated preload only gets loaded once
childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureA]) +
- '-e "console.log(\'hello\');" ' + preloadOption([fixtureA, fixtureB]),
+ `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');" ${
+ preloadOption([fixtureA, fixtureB])}`,
function(err, stdout, stderr) {
if (err) throw err;
assert.strictEqual(stdout, 'A\nB\nhello\n');
@@ -117,7 +115,7 @@ childProcess.exec(
// test that preload works with -i
const interactive = childProcess.exec(
- nodeBinary + ' ' + preloadOption([fixtureD]) + '-i',
+ `"${nodeBinary}" ${preloadOption([fixtureD])}-i`,
common.mustCall(function(err, stdout, stderr) {
assert.ifError(err);
assert.strictEqual(stdout, "> 'test'\n> ");
@@ -128,8 +126,8 @@ interactive.stdin.write('a\n');
interactive.stdin.write('process.exit()\n');
childProcess.exec(
- `${nodeBinary} --require ${fixture('cluster-preload.js')} ` +
- fixture('cluster-preload-test.js'),
+ `"${nodeBinary}" --require "${fixture('cluster-preload.js')}" "${
+ fixture('cluster-preload-test.js')}"`,
function(err, stdout, stderr) {
if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout));
@@ -139,8 +137,8 @@ childProcess.exec(
// https://github.com/nodejs/node/issues/1691
process.chdir(common.fixturesDir);
childProcess.exec(
- `${nodeBinary} --expose_natives_as=v8natives --require ` +
- `${fixture('cluster-preload.js')} cluster-preload-test.js`,
+ `"${nodeBinary}" --expose_natives_as=v8natives --require ` +
+ `"${fixture('cluster-preload.js')}" cluster-preload-test.js`,
function(err, stdout, stderr) {
if (err) throw err;
assert.ok(/worker terminated with code 43/.test(stdout));
diff --git a/test/parallel/test-process-chdir.js b/test/parallel/test-process-chdir.js
index f54026467eb6cd..61707706a322bc 100644
--- a/test/parallel/test-process-chdir.js
+++ b/test/parallel/test-process-chdir.js
@@ -5,6 +5,7 @@ const assert = require('assert');
const fs = require('fs');
const path = require('path');
+process.chdir('..');
assert.notStrictEqual(process.cwd(), __dirname);
process.chdir(__dirname);
assert.strictEqual(process.cwd(), __dirname);
@@ -30,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-exit-code.js b/test/parallel/test-process-exit-code.js
index 8d0ed1b33bae76..a956ee19310f26 100644
--- a/test/parallel/test-process-exit-code.js
+++ b/test/parallel/test-process-exit-code.js
@@ -75,9 +75,9 @@ function test(arg, exit) {
const f = __filename;
const option = { stdio: [ 0, 1, 'ignore' ] };
spawn(node, [f, arg], option).on('exit', function(code) {
- assert.strictEqual(code, exit, 'wrong exit for ' +
- arg + '\nexpected:' + exit +
- ' but got:' + code);
+ assert.strictEqual(
+ code, exit,
+ `wrong exit for ${arg}\nexpected:${exit} but got:${code}`);
console.log('ok - %s exited with %d', arg, exit);
});
}
diff --git a/test/parallel/test-process-getactivehandles.js b/test/parallel/test-process-getactivehandles.js
index 8ceb2bcd2a32f7..2db3da3c563e6e 100644
--- a/test/parallel/test-process-getactivehandles.js
+++ b/test/parallel/test-process-getactivehandles.js
@@ -33,15 +33,15 @@ function checkAll() {
const handles = process._getActiveHandles();
clients.forEach(function(item) {
- assert.ok(handles.indexOf(item) > -1);
+ assert.ok(handles.includes(item));
item.destroy();
});
connections.forEach(function(item) {
- assert.ok(handles.indexOf(item) > -1);
+ assert.ok(handles.includes(item));
item.end();
});
- assert.ok(handles.indexOf(server) > -1);
+ assert.ok(handles.includes(server));
server.close();
}
diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js
index dc31c3737ae1cb..23163654d88c79 100644
--- a/test/parallel/test-process-raw-debug.js
+++ b/test/parallel/test-process-raw-debug.js
@@ -9,7 +9,7 @@ switch (process.argv[2]) {
case undefined:
return parent();
default:
- throw new Error('wtf? ' + process.argv[2]);
+ throw new Error(`wtf? ${process.argv[2]}`);
}
function parent() {
@@ -25,7 +25,7 @@ function parent() {
child.stderr.setEncoding('utf8');
child.stderr.on('end', function() {
- assert.strictEqual(output, 'I can still debug!' + os.EOL);
+ assert.strictEqual(output, `I can still debug!${os.EOL}`);
console.log('ok - got expected message');
});
diff --git a/test/parallel/test-process-setuid-setgid.js b/test/parallel/test-process-setuid-setgid.js
new file mode 100644
index 00000000000000..33cb718eaedfb3
--- /dev/null
+++ b/test/parallel/test-process-setuid-setgid.js
@@ -0,0 +1,48 @@
+'use strict';
+
+const common = require('../common');
+
+const assert = require('assert');
+
+if (common.isWindows) {
+ // uid/gid functions are POSIX only
+ assert.strictEqual(process.getuid, undefined);
+ assert.strictEqual(process.setuid, undefined);
+ assert.strictEqual(process.getgid, undefined);
+ assert.strictEqual(process.setgid, undefined);
+ return;
+}
+
+assert.throws(() => {
+ process.setuid('fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf');
+}, /^Error: setuid user id does not exist$/);
+
+// If we're not running as super user...
+if (process.getuid() !== 0) {
+ assert.doesNotThrow(() => {
+ process.getgid();
+ process.getuid();
+ });
+
+ assert.throws(
+ () => { process.setgid('nobody'); },
+ /^Error: (?:EPERM, .+|setgid group id does not exist)$/
+ );
+
+ assert.throws(
+ () => { process.setuid('nobody'); },
+ /^Error: (?:EPERM, .+|setuid user id does not exist)$/
+ );
+ return;
+}
+
+// If we are running as super user...
+const oldgid = process.getgid();
+process.setgid('nobody');
+const newgid = process.getgid();
+assert.notStrictEqual(newgid, oldgid);
+
+const olduid = process.getuid();
+process.setuid('nobody');
+const newuid = process.getuid();
+assert.notStrictEqual(newuid, olduid);
diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js
index 31afa09a6c3d95..87dc743625a0ab 100644
--- a/test/parallel/test-promises-unhandled-rejections.js
+++ b/test/parallel/test-promises-unhandled-rejections.js
@@ -12,11 +12,11 @@ const asyncTest = (function() {
function fail(error) {
const stack = currentTest
- ? error.stack + '\nFrom previous event:\n' + currentTest.stack
+ ? `${error.stack}\nFrom previous event:\n${currentTest.stack}`
: error.stack;
if (currentTest)
- process.stderr.write('\'' + currentTest.description + '\' failed\n\n');
+ process.stderr.write(`'${currentTest.description}' failed\n\n`);
process.stderr.write(stack);
process.exit(2);
diff --git a/test/parallel/test-querystring-maxKeys-non-finite.js b/test/parallel/test-querystring-maxKeys-non-finite.js
index 3df381405d650a..da72dbf17cf969 100644
--- a/test/parallel/test-querystring-maxKeys-non-finite.js
+++ b/test/parallel/test-querystring-maxKeys-non-finite.js
@@ -23,7 +23,7 @@ function createManyParams(count) {
for (let i = 1; i < count; i++) {
const n = i.toString(36);
- str += '&' + n + '=' + n;
+ str += `&${n}=${n}`;
}
return str;
diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js
index d8d1fbfbcf927e..bc28eddd2a8a3a 100644
--- a/test/parallel/test-querystring.js
+++ b/test/parallel/test-querystring.js
@@ -67,7 +67,7 @@ const qsColonTestCases = [
];
// [wonkyObj, qs, canonicalObj]
-const extendedFunction = function() {};
+function extendedFunction() {}
extendedFunction.prototype = {a: 'b'};
const qsWeirdObjects = [
[{regexp: /./g}, 'regexp=', {'regexp': ''}],
@@ -197,7 +197,7 @@ qsWeirdObjects.forEach(function(testCase) {
// invalid surrogate pair throws URIError
assert.throws(function() {
qs.stringify({ foo: '\udc00' });
-}, URIError);
+}, /^URIError: URI malformed$/);
// coerce numbers to string
assert.strictEqual('foo=0', qs.stringify({ foo: 0 }));
@@ -256,43 +256,47 @@ assert.strictEqual(
1);
// Test removing limit
-function testUnlimitedKeys() {
- const query = {};
+{
+ function testUnlimitedKeys() {
+ const query = {};
- for (let i = 0; i < 2000; i++) query[i] = i;
+ for (let i = 0; i < 2000; i++) query[i] = i;
- const url = qs.stringify(query);
+ const url = qs.stringify(query);
- assert.strictEqual(
- Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length,
+ assert.strictEqual(
+ Object.keys(qs.parse(url, null, null, {maxKeys: 0})).length,
2000);
-}
-testUnlimitedKeys();
+ }
+ testUnlimitedKeys();
+}
-const b = qs.unescapeBuffer('%d3%f2Ug%1f6v%24%5e%98%cb' +
- '%0d%ac%a2%2f%9d%eb%d8%a2%e6');
+{
+ const b = qs.unescapeBuffer('%d3%f2Ug%1f6v%24%5e%98%cb' +
+ '%0d%ac%a2%2f%9d%eb%d8%a2%e6');
//
-assert.strictEqual(0xd3, b[0]);
-assert.strictEqual(0xf2, b[1]);
-assert.strictEqual(0x55, b[2]);
-assert.strictEqual(0x67, b[3]);
-assert.strictEqual(0x1f, b[4]);
-assert.strictEqual(0x36, b[5]);
-assert.strictEqual(0x76, b[6]);
-assert.strictEqual(0x24, b[7]);
-assert.strictEqual(0x5e, b[8]);
-assert.strictEqual(0x98, b[9]);
-assert.strictEqual(0xcb, b[10]);
-assert.strictEqual(0x0d, b[11]);
-assert.strictEqual(0xac, b[12]);
-assert.strictEqual(0xa2, b[13]);
-assert.strictEqual(0x2f, b[14]);
-assert.strictEqual(0x9d, b[15]);
-assert.strictEqual(0xeb, b[16]);
-assert.strictEqual(0xd8, b[17]);
-assert.strictEqual(0xa2, b[18]);
-assert.strictEqual(0xe6, b[19]);
+ assert.strictEqual(0xd3, b[0]);
+ assert.strictEqual(0xf2, b[1]);
+ assert.strictEqual(0x55, b[2]);
+ assert.strictEqual(0x67, b[3]);
+ assert.strictEqual(0x1f, b[4]);
+ assert.strictEqual(0x36, b[5]);
+ assert.strictEqual(0x76, b[6]);
+ assert.strictEqual(0x24, b[7]);
+ assert.strictEqual(0x5e, b[8]);
+ assert.strictEqual(0x98, b[9]);
+ assert.strictEqual(0xcb, b[10]);
+ assert.strictEqual(0x0d, b[11]);
+ assert.strictEqual(0xac, b[12]);
+ assert.strictEqual(0xa2, b[13]);
+ assert.strictEqual(0x2f, b[14]);
+ assert.strictEqual(0x9d, b[15]);
+ assert.strictEqual(0xeb, b[16]);
+ assert.strictEqual(0xd8, b[17]);
+ assert.strictEqual(0xa2, b[18]);
+ assert.strictEqual(0xe6, b[19]);
+}
assert.strictEqual(qs.unescapeBuffer('a+b', true).toString(), 'a b');
assert.strictEqual(qs.unescapeBuffer('a%').toString(), 'a%');
@@ -303,29 +307,38 @@ assert.strictEqual(qs.unescapeBuffer('a%%').toString(), 'a%%');
// Test custom decode
-function demoDecode(str) {
- return str + str;
+{
+ function demoDecode(str) {
+ return str + str;
+ }
+
+ check(qs.parse('a=a&b=b&c=c', null, null, {decodeURIComponent: demoDecode}),
+ {aa: 'aa', bb: 'bb', cc: 'cc'});
+ check(qs.parse('a=a&b=b&c=c', null, '==', {decodeURIComponent: (str) => str}),
+ {'a=a': '', 'b=b': '', 'c=c': ''});
}
-check(qs.parse('a=a&b=b&c=c', null, null, { decodeURIComponent: demoDecode }),
- { aa: 'aa', bb: 'bb', cc: 'cc' });
-check(qs.parse('a=a&b=b&c=c', null, '==', { decodeURIComponent: (str) => str }),
- { 'a=a': '', 'b=b': '', 'c=c': '' });
// Test QueryString.unescape
-function errDecode(str) {
- throw new Error('To jump to the catch scope');
+{
+ function errDecode(str) {
+ throw new Error('To jump to the catch scope');
+ }
+
+ check(qs.parse('a=a', null, null, {decodeURIComponent: errDecode}),
+ {a: 'a'});
}
-check(qs.parse('a=a', null, null, { decodeURIComponent: errDecode }),
- { a: 'a' });
// Test custom encode
-function demoEncode(str) {
- return str[0];
+{
+ function demoEncode(str) {
+ return str[0];
+ }
+
+ const obj = {aa: 'aa', bb: 'bb', cc: 'cc'};
+ assert.strictEqual(
+ qs.stringify(obj, null, null, {encodeURIComponent: demoEncode}),
+ 'a=a&b=b&c=c');
}
-const obj = { aa: 'aa', bb: 'bb', cc: 'cc' };
-assert.strictEqual(
- qs.stringify(obj, null, null, { encodeURIComponent: demoEncode }),
- 'a=a&b=b&c=c');
// Test QueryString.unescapeBuffer
qsUnescapeTestCases.forEach(function(testCase) {
@@ -334,12 +347,15 @@ qsUnescapeTestCases.forEach(function(testCase) {
});
// test overriding .unescape
-const prevUnescape = qs.unescape;
-qs.unescape = function(str) {
- return str.replace(/o/g, '_');
-};
-check(qs.parse('foo=bor'), createWithNoPrototype([{key: 'f__', value: 'b_r'}]));
-qs.unescape = prevUnescape;
-
+{
+ const prevUnescape = qs.unescape;
+ qs.unescape = function(str) {
+ return str.replace(/o/g, '_');
+ };
+ check(
+ qs.parse('foo=bor'),
+ createWithNoPrototype([{key: 'f__', value: 'b_r'}]));
+ qs.unescape = prevUnescape;
+}
// test separator and "equals" parsing order
check(qs.parse('foo&bar', '&', '&'), { foo: '', bar: '' });
diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js
index 59bfb872bee52e..e89da72a6fb738 100644
--- a/test/parallel/test-readline-interface.js
+++ b/test/parallel/test-readline-interface.js
@@ -132,7 +132,7 @@ function isWarned(emitter) {
assert.strictEqual(line, expectedLines[callCount]);
callCount++;
});
- fi.emit('data', expectedLines.join('\n') + '\n');
+ fi.emit('data', `${expectedLines.join('\n')}\n`);
assert.strictEqual(callCount, expectedLines.length);
rli.close();
@@ -193,7 +193,7 @@ function isWarned(emitter) {
callCount++;
});
expectedLines.forEach(function(line) {
- fi.emit('data', line + '\r');
+ fi.emit('data', `${line}\r`);
fi.emit('data', '\n');
});
assert.strictEqual(callCount, expectedLines.length);
@@ -265,9 +265,7 @@ function isWarned(emitter) {
// \t does not become part of the input when there is a completer function
fi = new FakeInput();
- const completer = function(line) {
- return [[], line];
- };
+ const completer = (line) => [[], line];
rli = new readline.Interface({
input: fi,
output: fi,
@@ -318,7 +316,7 @@ function isWarned(emitter) {
assert.strictEqual(line, expectedLines[callCount]);
callCount++;
});
- fi.emit('data', expectedLines.join('\n') + '\n');
+ fi.emit('data', `${expectedLines.join('\n')}\n`);
assert.strictEqual(callCount, expectedLines.length);
fi.emit('keypress', '.', { name: 'up' }); // 'bat'
assert.strictEqual(rli.line, expectedLines[--callCount]);
@@ -348,7 +346,7 @@ function isWarned(emitter) {
assert.strictEqual(line, expectedLines[callCount]);
callCount++;
});
- fi.emit('data', expectedLines.join('\n') + '\n');
+ fi.emit('data', `${expectedLines.join('\n')}\n`);
assert.strictEqual(callCount, expectedLines.length);
fi.emit('keypress', '.', { name: 'up' }); // 'bat'
assert.strictEqual(rli.line, expectedLines[--callCount]);
diff --git a/test/parallel/test-readline.js b/test/parallel/test-readline.js
new file mode 100644
index 00000000000000..62a4fe6f4830fd
--- /dev/null
+++ b/test/parallel/test-readline.js
@@ -0,0 +1,45 @@
+'use strict';
+const common = require('../common');
+const { PassThrough } = require('stream');
+const readline = require('readline');
+const assert = require('assert');
+
+{
+ const input = new PassThrough();
+ const rl = readline.createInterface({
+ terminal: true,
+ input: input
+ });
+
+ rl.on('line', common.mustCall((data) => {
+ assert.strictEqual(data, 'abc');
+ }));
+
+ input.end('abc');
+}
+
+{
+ const input = new PassThrough();
+ const rl = readline.createInterface({
+ terminal: true,
+ input: input
+ });
+
+ rl.on('line', common.mustNotCall('must not be called before newline'));
+
+ input.write('abc');
+}
+
+{
+ const input = new PassThrough();
+ const rl = readline.createInterface({
+ terminal: true,
+ input: input
+ });
+
+ rl.on('line', common.mustCall((data) => {
+ assert.strictEqual(data, 'abc');
+ }));
+
+ input.write('abc\n');
+}
diff --git a/test/parallel/test-regress-GH-12371.js b/test/parallel/test-regress-GH-12371.js
new file mode 100644
index 00000000000000..6ab65a8e348e1e
--- /dev/null
+++ b/test/parallel/test-regress-GH-12371.js
@@ -0,0 +1,37 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const execFile = require('child_process').execFile;
+
+const scripts = [
+ `os.userInfo({
+ get encoding() {
+ throw new Error('xyz');
+ }
+ })`
+];
+
+['filename', 'cachedData', 'produceCachedData', 'lineOffset', 'columnOffset']
+ .forEach((prop) => {
+ scripts.push(`vm.createScript('', {
+ get ${prop} () {
+ throw new Error('xyz');
+ }
+ })`);
+ });
+
+['breakOnSigint', 'timeout', 'displayErrors']
+ .forEach((prop) => {
+ scripts.push(`vm.createScript('').runInThisContext({
+ get ${prop} () {
+ throw new Error('xyz');
+ }
+ })`);
+ });
+
+scripts.forEach((script) => {
+ const node = process.execPath;
+ execFile(node, [ '-e', script ], common.mustCall((err, stdout, stderr) => {
+ assert(stderr.includes('Error: xyz'), 'createScript crashes');
+ }));
+});
diff --git a/test/parallel/test-regress-GH-1531.js b/test/parallel/test-regress-GH-1531.js
index 5189e50929105c..3cf342b869d418 100644
--- a/test/parallel/test-regress-GH-1531.js
+++ b/test/parallel/test-regress-GH-1531.js
@@ -10,8 +10,8 @@ const https = require('https');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = https.createServer(options, function(req, res) {
diff --git a/test/parallel/test-regress-GH-3739.js b/test/parallel/test-regress-GH-3739.js
index 6b4a62700c6dec..f762e3e6bbc839 100644
--- a/test/parallel/test-regress-GH-3739.js
+++ b/test/parallel/test-regress-GH-3739.js
@@ -12,7 +12,7 @@ common.refreshTmpDir();
// Make a long path.
for (let i = 0; i < 50; i++) {
- dir = dir + '/1234567890';
+ dir = `${dir}/1234567890`;
try {
fs.mkdirSync(dir, '0777');
} catch (e) {
diff --git a/test/parallel/test-regress-GH-5051.js b/test/parallel/test-regress-GH-5051.js
index f2562bd7eb8020..ecaf55d625b815 100644
--- a/test/parallel/test-regress-GH-5051.js
+++ b/test/parallel/test-regress-GH-5051.js
@@ -1,5 +1,5 @@
'use strict';
-const common = require('../common');
+require('../common');
const assert = require('assert');
const agent = require('http').globalAgent;
@@ -12,20 +12,22 @@ agent.maxSockets = 0;
// localAddress is used when naming requests / sockets
// while using the Legacy API
-agent.addRequest(req, 'localhost', common.PORT, '127.0.0.1');
+// port 8080 is hardcoded since this does not create a network connection
+agent.addRequest(req, 'localhost', 8080, '127.0.0.1');
assert.strictEqual(Object.keys(agent.requests).length, 1);
assert.strictEqual(
Object.keys(agent.requests)[0],
- 'localhost:' + common.PORT + ':127.0.0.1');
+ 'localhost:8080:127.0.0.1');
// path is *not* used when naming requests / sockets
+// port 8080 is hardcoded since this does not create a network connection
agent.addRequest(req, {
host: 'localhost',
- port: common.PORT,
+ port: 8080,
localAddress: '127.0.0.1',
path: '/foo'
});
assert.strictEqual(Object.keys(agent.requests).length, 1);
assert.strictEqual(
Object.keys(agent.requests)[0],
- 'localhost:' + common.PORT + ':127.0.0.1');
+ 'localhost:8080:127.0.0.1');
diff --git a/test/parallel/test-regress-GH-5727.js b/test/parallel/test-regress-GH-5727.js
index 8cbec2a178a5f7..7cedd831b2f783 100644
--- a/test/parallel/test-regress-GH-5727.js
+++ b/test/parallel/test-regress-GH-5727.js
@@ -6,9 +6,9 @@ const net = require('net');
const invalidPort = -1 >>> 0;
const errorMessage = /"port" argument must be >= 0 and < 65536/;
-net.Server().listen(common.PORT, function() {
+net.Server().listen(0, function() {
const address = this.address();
- const key = `${address.family.slice(-1)}:${address.address}:${common.PORT}`;
+ const key = `${address.family.slice(-1)}:${address.address}:0`;
assert.strictEqual(this._connectionKey, key);
this.close();
diff --git a/test/parallel/test-regress-GH-9819.js b/test/parallel/test-regress-GH-9819.js
index f043bc3b2848e7..fb9bb489a081cf 100644
--- a/test/parallel/test-regress-GH-9819.js
+++ b/test/parallel/test-regress-GH-9819.js
@@ -17,7 +17,7 @@ const scripts = [
scripts.forEach((script) => {
const node = process.execPath;
- const code = setup + ';' + script;
+ const code = `${setup};${script}`;
execFile(node, [ '-e', code ], common.mustCall((err, stdout, stderr) => {
assert(stderr.includes('Error: xyz'), 'digest crashes');
}));
diff --git a/test/parallel/test-repl-autolibs.js b/test/parallel/test-repl-autolibs.js
index 74d400e2e226c6..bcb173e7126b52 100644
--- a/test/parallel/test-repl-autolibs.js
+++ b/test/parallel/test-repl-autolibs.js
@@ -19,8 +19,8 @@ function test1() {
if (data.length) {
// inspect output matches repl output
- assert.strictEqual(data, util.inspect(require('fs'), null, 2, false) +
- '\n');
+ assert.strictEqual(data,
+ `${util.inspect(require('fs'), null, 2, false)}\n`);
// globally added lib matches required lib
assert.strictEqual(global.fs, require('fs'));
test2();
diff --git a/test/parallel/test-repl-context.js b/test/parallel/test-repl-context.js
index 2287a247d81bb2..a2f04214311c13 100644
--- a/test/parallel/test-repl-context.js
+++ b/test/parallel/test-repl-context.js
@@ -22,5 +22,5 @@ function testContext(repl) {
assert.strictEqual(context.global, context);
// ensure that the repl console instance does not have a setter
- assert.throws(() => context.console = 'foo');
+ assert.throws(() => context.console = 'foo', TypeError);
}
diff --git a/test/parallel/test-repl-definecommand.js b/test/parallel/test-repl-definecommand.js
index 07732d534e9def..80a06af6b077d2 100644
--- a/test/parallel/test-repl-definecommand.js
+++ b/test/parallel/test-repl-definecommand.js
@@ -23,7 +23,7 @@ r.defineCommand('say1', {
help: 'help for say1',
action: function(thing) {
output = '';
- this.write('hello ' + thing);
+ this.write(`hello ${thing}`);
this.displayPrompt();
}
});
diff --git a/test/parallel/test-repl-envvars.js b/test/parallel/test-repl-envvars.js
index a5e48a66454758..5f597e0abb78ca 100644
--- a/test/parallel/test-repl-envvars.js
+++ b/test/parallel/test-repl-envvars.js
@@ -50,10 +50,10 @@ function run(test) {
// The REPL registers 'module' and 'require' globals
common.allowGlobals(repl.context.module, repl.context.require);
- assert.strictEqual(expected.terminal, repl.terminal, 'Expected ' +
- inspect(expected) + ' with ' + inspect(env));
- assert.strictEqual(expected.useColors, repl.useColors, 'Expected ' +
- inspect(expected) + ' with ' + inspect(env));
+ assert.strictEqual(expected.terminal, repl.terminal,
+ `Expected ${inspect(expected)} with ${inspect(env)}`);
+ assert.strictEqual(expected.useColors, repl.useColors,
+ `Expected ${inspect(expected)} with ${inspect(env)}`);
repl.close();
});
}
diff --git a/test/parallel/test-repl-mode.js b/test/parallel/test-repl-mode.js
index 00e9cd577ece90..7c113e2fc620c5 100644
--- a/test/parallel/test-repl-mode.js
+++ b/test/parallel/test-repl-mode.js
@@ -19,46 +19,34 @@ tests.forEach(function(test) {
function testSloppyMode() {
const cli = initRepl(repl.REPL_MODE_SLOPPY);
- cli.input.emit('data', `
- x = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'x = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), '> 3\n> ');
cli.output.accumulator.length = 0;
- cli.input.emit('data', `
- let y = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'let y = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> ');
}
function testStrictMode() {
const cli = initRepl(repl.REPL_MODE_STRICT);
- cli.input.emit('data', `
- x = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'x = 3\n');
assert.ok(/ReferenceError: x is not defined/.test(
cli.output.accumulator.join('')));
cli.output.accumulator.length = 0;
- cli.input.emit('data', `
- let y = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'let y = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> ');
}
function testAutoMode() {
const cli = initRepl(repl.REPL_MODE_MAGIC);
- cli.input.emit('data', `
- x = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'x = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), '> 3\n> ');
cli.output.accumulator.length = 0;
- cli.input.emit('data', `
- let y = 3
- `.trim() + '\n');
+ cli.input.emit('data', 'let y = 3\n');
assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> ');
}
diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js
index 2b0ceac530a65f..2c31a13119fe2e 100644
--- a/test/parallel/test-repl-persistent-history.js
+++ b/test/parallel/test-repl-persistent-history.js
@@ -35,7 +35,7 @@ class ActionStream extends stream.Stream {
if (typeof action === 'object') {
this.emit('keypress', '', action);
} else {
- this.emit('data', action + '\n');
+ this.emit('data', `${action}\n`);
}
setImmediate(doAction);
};
@@ -76,6 +76,10 @@ const oldHistoryPath = path.join(fixtures, 'old-repl-history-file.json');
const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
+const emptyHiddenHistoryPath = path.join(fixtures,
+ '.empty-hidden-repl-history-file');
+const devNullHistoryPath = path.join(common.tmpDir,
+ '.dev-null-repl-history-file');
const tests = [
{
@@ -113,19 +117,19 @@ const tests = [
{
env: { NODE_REPL_HISTORY: historyPath },
test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: { NODE_REPL_HISTORY: historyPath,
NODE_REPL_HISTORY_FILE: oldHistoryPath },
test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: { NODE_REPL_HISTORY: historyPath,
NODE_REPL_HISTORY_FILE: '' },
test: [UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: {},
@@ -135,27 +139,27 @@ const tests = [
{
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath },
test: [UP, CLEAR, '\'42\'', ENTER],
- expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt, '\'',
+ expected: [prompt, convertMsg, prompt, `${prompt}'=^.^='`, prompt, '\'',
'4', '2', '\'', '\'42\'\n', prompt, prompt],
clean: false
},
{ // Requires the above testcase
env: {},
test: [UP, UP, ENTER],
- expected: [prompt, prompt + '\'42\'', prompt + '\'=^.^=\'', '\'=^.^=\'\n',
+ expected: [prompt, `${prompt}'42'`, `${prompt}'=^.^='`, '\'=^.^=\'\n',
prompt]
},
{
env: { NODE_REPL_HISTORY: historyPath,
NODE_REPL_HISTORY_SIZE: 1 },
test: [UP, UP, CLEAR],
- expected: [prompt, prompt + '\'you look fabulous today\'', prompt]
+ expected: [prompt, `${prompt}'you look fabulous today'`, prompt]
},
{
env: { NODE_REPL_HISTORY_FILE: oldHistoryPath,
NODE_REPL_HISTORY_SIZE: 1 },
test: [UP, UP, UP, CLEAR],
- expected: [prompt, convertMsg, prompt, prompt + '\'=^.^=\'', prompt]
+ expected: [prompt, convertMsg, prompt, `${prompt}'=^.^='`, prompt]
},
{
env: { NODE_REPL_HISTORY: historyPathFail,
@@ -163,6 +167,28 @@ const tests = [
test: [UP],
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
},
+ {
+ before: function before() {
+ if (common.isWindows) {
+ const execSync = require('child_process').execSync;
+ execSync(`ATTRIB +H "${emptyHiddenHistoryPath}"`, (err) => {
+ assert.ifError(err);
+ });
+ }
+ },
+ env: { NODE_REPL_HISTORY: emptyHiddenHistoryPath },
+ test: [UP],
+ expected: [prompt]
+ },
+ {
+ before: function before() {
+ if (!common.isWindows)
+ fs.symlinkSync('/dev/null', devNullHistoryPath);
+ },
+ env: { NODE_REPL_HISTORY: devNullHistoryPath },
+ test: [UP],
+ expected: [prompt]
+ },
{ // Make sure this is always the last test, since we change os.homedir()
before: function before() {
// Mock os.homedir() failure
@@ -178,12 +204,6 @@ const tests = [
const numtests = tests.length;
-let testsNotRan = tests.length;
-
-process.on('beforeExit', () =>
- assert.strictEqual(testsNotRan, 0)
-);
-
function cleanupTmpFile() {
try {
// Write over the file, clearing any history
@@ -199,6 +219,8 @@ function cleanupTmpFile() {
fs.createReadStream(historyFixturePath)
.pipe(fs.createWriteStream(historyPath)).on('unpipe', () => runTest());
+const runTestWrap = common.mustCall(runTest, numtests);
+
function runTest(assertCleaned) {
const opts = tests.shift();
if (!opts) return; // All done
@@ -268,8 +290,7 @@ function runTest(assertCleaned) {
try {
// Ensure everything that we expected was output
assert.strictEqual(expected.length, 0);
- testsNotRan--;
- setImmediate(runTest, cleaned);
+ setImmediate(runTestWrap, cleaned);
} catch (err) {
console.error(`Failed test # ${numtests - tests.length}`);
throw err;
diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js
index 2eca418acb01d9..e2b9b363fa53c6 100644
--- a/test/parallel/test-repl-tab-complete.js
+++ b/test/parallel/test-repl-tab-complete.js
@@ -186,7 +186,7 @@ putIn.run(['.clear']);
testMe.complete('require(\'', common.mustCall(function(error, data) {
assert.strictEqual(error, null);
repl._builtinLibs.forEach(function(lib) {
- assert.notStrictEqual(data[0].indexOf(lib), -1, lib + ' not found');
+ assert.notStrictEqual(data[0].indexOf(lib), -1, `${lib} not found`);
});
}));
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index 49ace9e68b45f4..2fc888de67b1f8 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -26,19 +26,19 @@ console.error('repl test');
// function for REPL to run
global.invoke_me = function(arg) {
- return 'invoked ' + arg;
+ return `invoked ${arg}`;
};
function send_expect(list) {
if (list.length > 0) {
const cur = list.shift();
- console.error('sending ' + JSON.stringify(cur.send));
+ console.error(`sending ${JSON.stringify(cur.send)}`);
cur.client.expect = cur.expect;
cur.client.list = list;
if (cur.send.length > 0) {
- cur.client.write(cur.send + '\n');
+ cur.client.write(`${cur.send}\n`);
}
}
}
@@ -63,18 +63,19 @@ function error_test() {
client_unix.on('data', function(data) {
read_buffer += data.toString('ascii', 0, data.length);
- console.error('Unix data: ' + JSON.stringify(read_buffer) + ', expecting ' +
- (client_unix.expect.exec ?
- client_unix.expect :
- JSON.stringify(client_unix.expect)));
+ console.error(
+ `Unix data: ${JSON.stringify(read_buffer)}, expecting ${
+ client_unix.expect.exec ?
+ client_unix.expect :
+ JSON.stringify(client_unix.expect)}`);
- if (read_buffer.indexOf(prompt_unix) !== -1) {
+ if (read_buffer.includes(prompt_unix)) {
// if it's an exact match, then don't do the regexp
if (read_buffer !== client_unix.expect) {
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 = '';
@@ -89,7 +90,7 @@ function error_test() {
tcp_test();
}
- } else if (read_buffer.indexOf(prompt_multiline) !== -1) {
+ } else if (read_buffer.includes(prompt_multiline)) {
// Check that you meant to send a multiline test
assert.strictEqual(prompt_multiline, client_unix.expect);
read_buffer = '';
@@ -197,7 +198,7 @@ function error_test() {
{ client: client_unix, send: 'function blah() { return 1; }',
expect: prompt_unix },
{ client: client_unix, send: 'blah()',
- expect: '1\n' + prompt_unix },
+ expect: `1\n${prompt_unix}` },
// Functions should not evaluate twice (#2773)
{ client: client_unix, send: 'var I = [1,2,3,function() {}]; I.pop()',
expect: '[Function]' },
@@ -221,7 +222,7 @@ function error_test() {
{ client: client_unix, send: '2)',
expect: prompt_multiline },
{ client: client_unix, send: ')',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
// npm prompt error message
{ client: client_unix, send: 'npm install foobar',
expect: expect_npm },
@@ -236,18 +237,18 @@ function error_test() {
// this makes sure that we don't print `undefined` when we actually print
// the error message
{ client: client_unix, send: '.invalid_repl_command',
- expect: 'Invalid REPL keyword\n' + prompt_unix },
+ expect: `Invalid REPL keyword\n${prompt_unix}` },
// this makes sure that we don't crash when we use an inherited property as
// a REPL command
{ client: client_unix, send: '.toString',
- expect: 'Invalid REPL keyword\n' + prompt_unix },
+ expect: `Invalid REPL keyword\n${prompt_unix}` },
// fail when we are not inside a String and a line continuation is used
{ client: client_unix, send: '[] \\',
expect: /\bSyntaxError: Invalid or unexpected token/ },
// do not fail when a String is created with line continuation
{ client: client_unix, send: '\'the\\\nfourth\\\neye\'',
- expect: prompt_multiline + prompt_multiline +
- '\'thefourtheye\'\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}'thefourtheye'\n${
+ prompt_unix}` },
// Don't fail when a partial String is created and line continuation is used
// with whitespace characters at the end of the string. We are to ignore it.
// This test is to make sure that we properly remove the whitespace
@@ -256,12 +257,12 @@ function error_test() {
expect: prompt_unix },
// multiline strings preserve whitespace characters in them
{ client: client_unix, send: '\'the \\\n fourth\t\t\\\n eye \'',
- expect: prompt_multiline + prompt_multiline +
- '\'the fourth\\t\\t eye \'\n' + prompt_unix },
+ expect: `${prompt_multiline}${
+ prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` },
// more than one multiline strings also should preserve whitespace chars
{ client: client_unix, send: '\'the \\\n fourth\' + \'\t\t\\\n eye \'',
- expect: prompt_multiline + prompt_multiline +
- '\'the fourth\\t\\t eye \'\n' + prompt_unix },
+ expect: `${prompt_multiline}${
+ prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` },
// using REPL commands within a string literal should still work
{ client: client_unix, send: '\'\\\n.break',
expect: prompt_unix },
@@ -273,8 +274,8 @@ function error_test() {
expect: prompt_unix + prompt_unix + prompt_unix },
// empty lines in the string literals should not affect the string
{ client: client_unix, send: '\'the\\\n\\\nfourtheye\'\n',
- expect: prompt_multiline + prompt_multiline +
- '\'thefourtheye\'\n' + prompt_unix },
+ expect: `${prompt_multiline}${
+ prompt_multiline}'thefourtheye'\n${prompt_unix}` },
// Regression test for https://github.com/nodejs/node/issues/597
{ client: client_unix,
send: '/(.)(.)(.)(.)(.)(.)(.)(.)(.)/.test(\'123456789\')\n',
@@ -287,39 +288,39 @@ function error_test() {
'\'7\'\n', '\'8\'\n', '\'9\'\n'].join(`${prompt_unix}`) },
// regression tests for https://github.com/nodejs/node/issues/2749
{ client: client_unix, send: 'function x() {\nreturn \'\\n\';\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x() {\nreturn \'\\\\\';\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
// regression tests for https://github.com/nodejs/node/issues/3421
{ client: client_unix, send: 'function x() {\n//\'\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x() {\n//"\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x() {//\'\n }',
- expect: prompt_multiline + 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}undefined\n${prompt_unix}` },
{ client: client_unix, send: 'function x() {//"\n }',
- expect: prompt_multiline + 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}undefined\n${prompt_unix}` },
{ client: client_unix, send: 'function x() {\nvar i = "\'";\n }',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${
+ prompt_unix}` },
{ client: client_unix, send: 'function x(/*optional*/) {}',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: 'function x(/* // 5 */) {}',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: '// /* 5 */',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: '"//"',
- expect: '\'//\'\n' + prompt_unix },
+ expect: `'//'\n${prompt_unix}` },
{ client: client_unix, send: '"data /*with*/ comment"',
- expect: '\'data /*with*/ comment\'\n' + prompt_unix },
+ expect: `'data /*with*/ comment'\n${prompt_unix}` },
{ client: client_unix, send: 'function x(/*fn\'s optional params*/) {}',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
{ client: client_unix, send: '/* \'\n"\n\'"\'\n*/',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
// REPL should get a normal require() function, not one that allows
// access to internal modules without the --expose_internals flag.
{ client: client_unix, send: 'require("internal/repl")',
@@ -327,37 +328,37 @@ function error_test() {
// REPL should handle quotes within regexp literal in multiline mode
{ client: client_unix,
send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix,
send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix,
send: 'function x(s) {\nreturn s.replace(/"/,"");\n}',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix,
send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}',
- expect: prompt_multiline + prompt_multiline +
- 'undefined\n' + prompt_unix },
+ expect: `${prompt_multiline}${prompt_multiline}` +
+ `undefined\n${prompt_unix}` },
{ client: client_unix, send: '{ var x = 4; }',
- expect: 'undefined\n' + prompt_unix },
+ expect: `undefined\n${prompt_unix}` },
// Illegal token is not recoverable outside string literal, RegExp literal,
// or block comment. https://github.com/nodejs/node/issues/3611
{ client: client_unix, send: 'a = 3.5e',
expect: /\bSyntaxError: Invalid or unexpected token/ },
// Mitigate https://github.com/nodejs/node/issues/548
{ client: client_unix, send: 'function name(){ return "node"; };name()',
- expect: "'node'\n" + prompt_unix },
+ expect: `'node'\n${prompt_unix}` },
{ client: client_unix, send: 'function name(){ return "nodejs"; };name()',
- expect: "'nodejs'\n" + prompt_unix },
+ expect: `'nodejs'\n${prompt_unix}` },
// Avoid emitting repl:line-number for SyntaxError
{ client: client_unix, send: 'a = 3.5e',
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();',
@@ -380,12 +381,12 @@ function error_test() {
{
client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix
+ expect: `${prompt_multiline}${prompt_multiline}NaN\n${prompt_unix}`
},
{
client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${prompt_unix}`
}
]);
}
@@ -418,16 +419,16 @@ function tcp_test() {
{ client: client_tcp, send: 'a += 1',
expect: (`12346\n${prompt_tcp}`) },
{ client: client_tcp,
- send: 'require(' + JSON.stringify(moduleFilename) + ').number',
+ send: `require(${JSON.stringify(moduleFilename)}).number`,
expect: (`42\n${prompt_tcp}`) }
]);
});
client_tcp.on('data', function(data) {
read_buffer += data.toString('ascii', 0, data.length);
- console.error('TCP data: ' + JSON.stringify(read_buffer) +
- ', expecting ' + JSON.stringify(client_tcp.expect));
- if (read_buffer.indexOf(prompt_tcp) !== -1) {
+ console.error(`TCP data: ${JSON.stringify(read_buffer)}, expecting ${
+ JSON.stringify(client_tcp.expect)}`);
+ if (read_buffer.includes(prompt_tcp)) {
assert.strictEqual(client_tcp.expect, read_buffer);
console.error('match');
read_buffer = '';
@@ -495,9 +496,9 @@ function unix_test() {
client_unix.on('data', function(data) {
read_buffer += data.toString('ascii', 0, data.length);
- console.error('Unix data: ' + JSON.stringify(read_buffer) +
- ', expecting ' + JSON.stringify(client_unix.expect));
- if (read_buffer.indexOf(prompt_unix) !== -1) {
+ console.error(`Unix data: ${JSON.stringify(read_buffer)}, expecting ${
+ JSON.stringify(client_unix.expect)}`);
+ if (read_buffer.includes(prompt_unix)) {
assert.strictEqual(client_unix.expect, read_buffer);
console.error('match');
read_buffer = '';
diff --git a/test/parallel/test-require-dot.js b/test/parallel/test-require-dot.js
index 26733c7fc438a1..04e978df56e200 100644
--- a/test/parallel/test-require-dot.js
+++ b/test/parallel/test-require-dot.js
@@ -3,13 +3,13 @@ const common = require('../common');
const assert = require('assert');
const m = require('module');
-const a = require(common.fixturesDir + '/module-require/relative/dot.js');
-const b = require(common.fixturesDir + '/module-require/relative/dot-slash.js');
+const a = require(`${common.fixturesDir}/module-require/relative/dot.js`);
+const b = require(`${common.fixturesDir}/module-require/relative/dot-slash.js`);
assert.strictEqual(a.value, 42);
assert.strictEqual(a, b, 'require(".") should resolve like require("./")');
-process.env.NODE_PATH = common.fixturesDir + '/module-require/relative';
+process.env.NODE_PATH = `${common.fixturesDir}/module-require/relative`;
m._initPaths();
const c = require('.');
diff --git a/test/parallel/test-require-exceptions.js b/test/parallel/test-require-exceptions.js
index e6b7977b48770b..4af19ef7e68971 100644
--- a/test/parallel/test-require-exceptions.js
+++ b/test/parallel/test-require-exceptions.js
@@ -4,12 +4,12 @@ const assert = require('assert');
// A module with an error in it should throw
assert.throws(function() {
- require(common.fixturesDir + '/throws_error');
+ require(`${common.fixturesDir}/throws_error`);
}, /^Error: blah$/);
// Requiring the same module again should throw as well
assert.throws(function() {
- require(common.fixturesDir + '/throws_error');
+ require(`${common.fixturesDir}/throws_error`);
}, /^Error: blah$/);
// Requiring a module that does not exist should throw an
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-setproctitle.js b/test/parallel/test-setproctitle.js
index d0bb54a9709709..179d48c0343971 100644
--- a/test/parallel/test-setproctitle.js
+++ b/test/parallel/test-setproctitle.js
@@ -14,13 +14,19 @@ const path = require('path');
// The title shouldn't be too long; libuv's uv_set_process_title() out of
// security considerations no longer overwrites envp, only argv, so the
// maximum title length is possibly quite short.
-let title = 'testme';
+let title = String(process.pid);
assert.notStrictEqual(process.title, title);
process.title = title;
assert.strictEqual(process.title, title);
-exec(`ps -p ${process.pid} -o args=`, function callback(error, stdout, stderr) {
+// To pass this test on alpine, since Busybox `ps` does not
+// support `-p` switch, use `ps -o` and `grep` instead.
+const cmd = common.isLinux ?
+ `ps -o pid,args | grep '${process.pid} ${title}' | grep -v grep` :
+ `ps -p ${process.pid} -o args=`;
+
+exec(cmd, common.mustCall((error, stdout, stderr) => {
assert.ifError(error);
assert.strictEqual(stderr, '');
@@ -29,5 +35,5 @@ exec(`ps -p ${process.pid} -o args=`, function callback(error, stdout, stderr) {
title += ` (${path.basename(process.execPath)})`;
// omitting trailing whitespace and \n
- assert.strictEqual(stdout.replace(/\s+$/, ''), title);
-});
+ assert.strictEqual(stdout.replace(/\s+$/, '').endsWith(title), true);
+}));
diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js
index f1dc26b4cef6dd..004878ac741595 100644
--- a/test/parallel/test-signal-handler.js
+++ b/test/parallel/test-signal-handler.js
@@ -7,7 +7,7 @@ if (common.isWindows) {
return;
}
-console.log('process.pid: ' + process.pid);
+console.log(`process.pid: ${process.pid}`);
process.on('SIGUSR1', common.mustCall(function() {}));
@@ -20,7 +20,7 @@ process.on('SIGUSR1', common.mustCall(function() {
let i = 0;
setInterval(function() {
- console.log('running process...' + ++i);
+ console.log(`running process...${++i}`);
if (i === 5) {
process.kill(process.pid, 'SIGUSR1');
diff --git a/test/parallel/test-signal-unregister.js b/test/parallel/test-signal-unregister.js
index 88c6a367a9cb37..f28c73c0997dd9 100644
--- a/test/parallel/test-signal-unregister.js
+++ b/test/parallel/test-signal-unregister.js
@@ -3,7 +3,7 @@ const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
-const child = spawn(process.argv[0], [common.fixturesDir + '/should_exit.js']);
+const child = spawn(process.argv[0], [`${common.fixturesDir}/should_exit.js`]);
child.stdout.once('data', function() {
child.kill('SIGINT');
});
diff --git a/test/parallel/test-socket-write-after-fin-error.js b/test/parallel/test-socket-write-after-fin-error.js
index 37d042b4c6031a..4626729c0598a0 100644
--- a/test/parallel/test-socket-write-after-fin-error.js
+++ b/test/parallel/test-socket-write-after-fin-error.js
@@ -17,7 +17,7 @@ let gotServerError = false;
const server = net.createServer(function(sock) {
sock.setEncoding('utf8');
sock.on('error', function(er) {
- console.error(er.code + ': ' + er.message);
+ console.error(`${er.code}: ${er.message}`);
gotServerError = er;
});
diff --git a/test/parallel/test-spawn-cmd-named-pipe.js b/test/parallel/test-spawn-cmd-named-pipe.js
index b4264880165d39..7ff4b33b77207b 100644
--- a/test/parallel/test-spawn-cmd-named-pipe.js
+++ b/test/parallel/test-spawn-cmd-named-pipe.js
@@ -14,9 +14,9 @@ if (!process.argv[2]) {
const spawn = require('child_process').spawn;
const path = require('path');
- const pipeNamePrefix = path.basename(__filename) + '.' + process.pid;
- const stdinPipeName = '\\\\.\\pipe\\' + pipeNamePrefix + '.stdin';
- const stdoutPipeName = '\\\\.\\pipe\\' + pipeNamePrefix + '.stdout';
+ const pipeNamePrefix = `${path.basename(__filename)}.${process.pid}`;
+ const stdinPipeName = `\\\\.\\pipe\\${pipeNamePrefix}.stdin`;
+ const stdoutPipeName = `\\\\.\\pipe\\${pipeNamePrefix}.stdout`;
const stdinPipeServer = net.createServer(function(c) {
c.on('end', common.mustCall(function() {
diff --git a/test/parallel/test-stdin-from-file.js b/test/parallel/test-stdin-from-file.js
index 9a847118bd670d..908416e721c2bb 100644
--- a/test/parallel/test-stdin-from-file.js
+++ b/test/parallel/test-stdin-from-file.js
@@ -8,8 +8,7 @@ const fs = require('fs');
const stdoutScript = join(common.fixturesDir, 'echo-close-check.js');
const tmpFile = join(common.tmpDir, 'stdin.txt');
-const cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' +
- tmpFile + '"';
+const cmd = `"${process.argv[0]}" "${stdoutScript}" < "${tmpFile}"`;
const string = 'abc\nümlaut.\nsomething else\n' +
'南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' +
@@ -26,7 +25,7 @@ const string = 'abc\nümlaut.\nsomething else\n' +
common.refreshTmpDir();
-console.log(cmd + '\n\n');
+console.log(`${cmd}\n\n`);
fs.writeFileSync(tmpFile, string);
@@ -34,6 +33,6 @@ childProcess.exec(cmd, common.mustCall(function(err, stdout, stderr) {
fs.unlinkSync(tmpFile);
assert.ifError(err);
- assert.strictEqual(stdout, 'hello world\r\n' + string);
+ assert.strictEqual(stdout, `hello world\r\n${string}`);
assert.strictEqual('', stderr);
}));
diff --git a/test/parallel/test-stdin-script-child.js b/test/parallel/test-stdin-script-child.js
index a8a161686eeeef..81eb3ea5b4aaac 100644
--- a/test/parallel/test-stdin-script-child.js
+++ b/test/parallel/test-stdin-script-child.js
@@ -8,7 +8,7 @@ const child = spawn(process.execPath, [], {
NODE_DEBUG: process.argv[2]
})
});
-const wanted = child.pid + '\n';
+const wanted = `${child.pid}\n`;
let found = '';
child.stdout.setEncoding('utf8');
@@ -18,7 +18,7 @@ child.stdout.on('data', function(c) {
child.stderr.setEncoding('utf8');
child.stderr.on('data', function(c) {
- console.error('> ' + c.trim().split(/\n/).join('\n> '));
+ console.error(`> ${c.trim().split(/\n/).join('\n> ')}`);
});
child.on('close', common.mustCall(function(c) {
diff --git a/test/parallel/test-stdout-stderr-reading.js b/test/parallel/test-stdout-stderr-reading.js
index 11cdcc390768a3..6466366a4f07cb 100644
--- a/test/parallel/test-stdout-stderr-reading.js
+++ b/test/parallel/test-stdout-stderr-reading.js
@@ -31,7 +31,7 @@ function parent() {
});
c1.stderr.setEncoding('utf8');
c1.stderr.on('data', function(chunk) {
- console.error('c1err: ' + chunk.split('\n').join('\nc1err: '));
+ console.error(`c1err: ${chunk.split('\n').join('\nc1err: ')}`);
});
c1.on('close', common.mustCall(function(code, signal) {
assert(!code);
@@ -48,7 +48,7 @@ function parent() {
});
c1.stderr.setEncoding('utf8');
c1.stderr.on('data', function(chunk) {
- console.error('c1err: ' + chunk.split('\n').join('\nc1err: '));
+ console.error(`c1err: ${chunk.split('\n').join('\nc1err: ')}`);
});
c2.on('close', common.mustCall(function(code, signal) {
assert(!code);
diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js
index 870d77eadf41f3..9be09cd9ab1cdc 100644
--- a/test/parallel/test-stdout-to-file.js
+++ b/test/parallel/test-stdout-to-file.js
@@ -13,13 +13,8 @@ const tmpFile = path.join(common.tmpDir, 'stdout.txt');
common.refreshTmpDir();
function test(size, useBuffer, cb) {
- const cmd = '"' + process.argv[0] + '"' +
- ' ' +
- '"' + (useBuffer ? scriptBuffer : scriptString) + '"' +
- ' ' +
- size +
- ' > ' +
- '"' + tmpFile + '"';
+ const cmd = `"${process.argv[0]}" "${
+ useBuffer ? scriptBuffer : scriptString}" ${size} > "${tmpFile}"`;
try {
fs.unlinkSync(tmpFile);
diff --git a/test/parallel/test-stream-base-no-abort.js b/test/parallel/test-stream-base-no-abort.js
index 5a26f04e5567b2..e9ef7bb57b1cf0 100644
--- a/test/parallel/test-stream-base-no-abort.js
+++ b/test/parallel/test-stream-base-no-abort.js
@@ -37,8 +37,8 @@ async_wrap.enable();
const checkTLS = common.mustCall(function checkTLS() {
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
};
const server = tls.createServer(options, () => {})
.listen(0, function() {
diff --git a/test/parallel/test-stream-base-typechecking.js b/test/parallel/test-stream-base-typechecking.js
new file mode 100644
index 00000000000000..8d559a42dfc54a
--- /dev/null
+++ b/test/parallel/test-stream-base-typechecking.js
@@ -0,0 +1,14 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const net = require('net');
+
+const server = net.createServer().listen(0, common.mustCall(() => {
+ const client = net.connect(server.address().port, common.mustCall(() => {
+ assert.throws(() => {
+ client.write('broken', 'buffer');
+ }, /^TypeError: Second argument must be a buffer$/);
+ client.destroy();
+ server.close();
+ }));
+}));
diff --git a/test/parallel/test-stream-big-packet.js b/test/parallel/test-stream-big-packet.js
index 8e5af3ea4ba342..72c4526973a9ad 100644
--- a/test/parallel/test-stream-big-packet.js
+++ b/test/parallel/test-stream-big-packet.js
@@ -22,7 +22,7 @@ util.inherits(TestStream, stream.Transform);
TestStream.prototype._transform = function(chunk, encoding, done) {
if (!passed) {
// Char 'a' only exists in the last write
- passed = chunk.toString().indexOf('a') >= 0;
+ passed = chunk.toString().includes('a');
}
done();
};
diff --git a/test/parallel/test-stream-pipe-await-drain-push-while-write.js b/test/parallel/test-stream-pipe-await-drain-push-while-write.js
index 67a8f304c31614..adefad70adc20c 100644
--- a/test/parallel/test-stream-pipe-await-drain-push-while-write.js
+++ b/test/parallel/test-stream-pipe-await-drain-push-while-write.js
@@ -17,7 +17,7 @@ const writable = new stream.Writable({
write: common.mustCall(function(chunk, encoding, cb) {
if (chunk.length === 32 * 1024) { // first chunk
const beforePush = readable._readableState.awaitDrain;
- readable.push(new Buffer(34 * 1024)); // above hwm
+ readable.push(Buffer.alloc(34 * 1024)); // above hwm
// We should check if awaitDrain counter is increased.
const afterPush = readable._readableState.awaitDrain;
assert.strictEqual(afterPush - beforePush, 1,
@@ -34,7 +34,7 @@ const writable = new stream.Writable({
});
// A readable stream which produces two buffers.
-const bufs = [new Buffer(32 * 1024), new Buffer(33 * 1024)]; // above hwm
+const bufs = [Buffer.alloc(32 * 1024), Buffer.alloc(33 * 1024)]; // above hwm
const readable = new stream.Readable({
read: function() {
while (bufs.length > 0) {
diff --git a/test/parallel/test-stream-push-strings.js b/test/parallel/test-stream-push-strings.js
index e77d8a48c679ef..7ccda9246c30ed 100644
--- a/test/parallel/test-stream-push-strings.js
+++ b/test/parallel/test-stream-push-strings.js
@@ -35,7 +35,7 @@ const results = [];
ms.on('readable', function() {
let chunk;
while (null !== (chunk = ms.read()))
- results.push(chunk + '');
+ results.push(String(chunk));
});
const expect = [ 'first chunksecond to last chunk', 'last chunk' ];
diff --git a/test/parallel/test-stream-readable-flow-recursion.js b/test/parallel/test-stream-readable-flow-recursion.js
index e29553900511c3..b9039d39844eee 100644
--- a/test/parallel/test-stream-readable-flow-recursion.js
+++ b/test/parallel/test-stream-readable-flow-recursion.js
@@ -37,11 +37,11 @@ function flow(stream, size, callback) {
callback(chunk);
depth -= 1;
- console.log('flow(' + depth + '): exit');
+ console.log(`flow(${depth}): exit`);
}
flow(stream, 5000, function() {
- console.log('complete (' + depth + ')');
+ console.log(`complete (${depth})`);
});
process.on('exit', function(code) {
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-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js
index 975ef2262490d5..0f5b9c8f892631 100644
--- a/test/parallel/test-stream2-base64-single-char-read-end.js
+++ b/test/parallel/test-stream2-base64-single-char-read-end.js
@@ -26,7 +26,7 @@ dst._write = function(chunk, enc, cb) {
};
src.on('end', function() {
- assert.strictEqual(Buffer.concat(accum) + '', 'MQ==');
+ assert.strictEqual(String(Buffer.concat(accum)), 'MQ==');
clearTimeout(timeout);
});
diff --git a/test/parallel/test-stream2-decode-partial.js b/test/parallel/test-stream2-decode-partial.js
index b43101dbc84c3a..9b1baf7fd677f4 100644
--- a/test/parallel/test-stream2-decode-partial.js
+++ b/test/parallel/test-stream2-decode-partial.js
@@ -4,8 +4,8 @@ const Readable = require('_stream_readable');
const assert = require('assert');
let buf = '';
-const euro = new Buffer([0xE2, 0x82, 0xAC]);
-const cent = new Buffer([0xC2, 0xA2]);
+const euro = Buffer.from([0xE2, 0x82, 0xAC]);
+const cent = Buffer.from([0xC2, 0xA2]);
const source = Buffer.concat([euro, cent]);
const readable = Readable({ encoding: 'utf8' });
diff --git a/test/parallel/test-stream2-pipe-error-once-listener.js b/test/parallel/test-stream2-pipe-error-once-listener.js
index 908ac1bdb8e4ab..c36a48dcbd6e12 100644
--- a/test/parallel/test-stream2-pipe-error-once-listener.js
+++ b/test/parallel/test-stream2-pipe-error-once-listener.js
@@ -5,9 +5,9 @@ const util = require('util');
const stream = require('stream');
-const Read = function() {
+function Read() {
stream.Readable.call(this);
-};
+}
util.inherits(Read, stream.Readable);
Read.prototype._read = function(size) {
@@ -16,9 +16,9 @@ Read.prototype._read = function(size) {
};
-const Write = function() {
+function Write() {
stream.Writable.call(this);
-};
+}
util.inherits(Write, stream.Writable);
Write.prototype._write = function(buffer, encoding, cb) {
diff --git a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js
index 71d6f1e7236db2..7702ceea16bdd0 100644
--- a/test/parallel/test-stream2-readable-empty-buffer-no-eof.js
+++ b/test/parallel/test-stream2-readable-empty-buffer-no-eof.js
@@ -54,7 +54,7 @@ function test1() {
function flow() {
let chunk;
while (null !== (chunk = r.read()))
- results.push(chunk + '');
+ results.push(String(chunk));
}
r.on('readable', flow);
r.on('end', function() {
@@ -82,7 +82,7 @@ function test2() {
function flow() {
let chunk;
while (null !== (chunk = r.read()))
- results.push(chunk + '');
+ results.push(String(chunk));
}
r.on('readable', flow);
r.on('end', function() {
diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js
index 2695ac21b752c4..2c4636a4bf71de 100644
--- a/test/parallel/test-stream2-transform.js
+++ b/test/parallel/test-stream2-transform.js
@@ -323,7 +323,7 @@ test('passthrough event emission', function(t) {
t.equal(emits, 1);
t.equal(pt.read(5).toString(), 'foogb');
- t.equal(pt.read(5) + '', 'null');
+ t.equal(String(pt.read(5)), 'null');
console.error('need emit 1');
diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js
index c377ce9a510caa..dd470db9624050 100644
--- a/test/parallel/test-stream2-writable.js
+++ b/test/parallel/test-stream2-writable.js
@@ -206,7 +206,7 @@ test('write callbacks', function(t) {
callbacks._called[i] = chunk;
}];
}).reduce(function(set, x) {
- set['callback-' + x[0]] = x[1];
+ set[`callback-${x[0]}`] = x[1];
return set;
}, {});
callbacks._called = [];
@@ -224,7 +224,7 @@ test('write callbacks', function(t) {
});
chunks.forEach(function(chunk, i) {
- tw.write(chunk, callbacks['callback-' + i]);
+ tw.write(chunk, callbacks[`callback-${i}`]);
});
tw.end();
});
diff --git a/test/parallel/test-stream3-cork-end.js b/test/parallel/test-stream3-cork-end.js
index 7227f87ada7fa1..85781cdf7187f2 100644
--- a/test/parallel/test-stream3-cork-end.js
+++ b/test/parallel/test-stream3-cork-end.js
@@ -79,7 +79,7 @@ writeChunks(inputChunks, () => {
// there was a chunk
assert.ok(seen);
- const expected = new Buffer(expectedChunks[i]);
+ const expected = Buffer.from(expectedChunks[i]);
// it was what we expected
assert.ok(seen.equals(expected));
}
diff --git a/test/parallel/test-stream3-cork-uncork.js b/test/parallel/test-stream3-cork-uncork.js
index 98f74a45c6624e..2e8e86be1ef058 100644
--- a/test/parallel/test-stream3-cork-uncork.js
+++ b/test/parallel/test-stream3-cork-uncork.js
@@ -74,7 +74,7 @@ writeChunks(inputChunks, () => {
// there was a chunk
assert.ok(seen);
- const expected = new Buffer(expectedChunks[i]);
+ const expected = Buffer.from(expectedChunks[i]);
// it was what we expected
assert.ok(seen.equals(expected));
}
diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js
index 07883a14ec8b7a..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);
@@ -151,7 +152,7 @@ function test(encoding, input, expected, singleSequence) {
function unicodeEscape(str) {
let r = '';
for (let i = 0; i < str.length; i++) {
- r += '\\u' + str.charCodeAt(i).toString(16);
+ r += `\\u${str.charCodeAt(i).toString(16)}`;
}
return r;
}
diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js
index 94b58d9c6eadf0..3775ecc13ec2dd 100644
--- a/test/parallel/test-stringbytes-external.js
+++ b/test/parallel/test-stringbytes-external.js
@@ -23,9 +23,9 @@ assert.strictEqual(b[1], 0);
assert.strictEqual(ucs2_control, c);
// now create big strings
-const size = 1 + (1 << 20);
-write_str = Array(size).join(write_str);
-ucs2_control = Array(size).join(ucs2_control);
+const size = 1 << 20;
+write_str = write_str.repeat(size);
+ucs2_control = ucs2_control.repeat(size);
// check resultant buffer and output string
b = Buffer.from(write_str, 'ucs2');
@@ -110,7 +110,7 @@ const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
// https://github.com/nodejs/node/issues/1024
{
- const a = Array(1 << 20).join('x');
+ const a = 'x'.repeat(1 << 20 - 1);
const b = Buffer.from(a, 'ucs2').toString('ucs2');
const c = Buffer.from(b, 'utf8').toString('utf8');
diff --git a/test/parallel/test-tcp-wrap-listen.js b/test/parallel/test-tcp-wrap-listen.js
index 687d11a9115f91..7502969c967f86 100644
--- a/test/parallel/test-tcp-wrap-listen.js
+++ b/test/parallel/test-tcp-wrap-listen.js
@@ -40,7 +40,7 @@ server.onconnection = (err, client) => {
assert.strictEqual(returnCode, 0);
client.pendingWrites.push(req);
- console.log('client.writeQueueSize: ' + client.writeQueueSize);
+ console.log(`client.writeQueueSize: ${client.writeQueueSize}`);
// 11 bytes should flush
assert.strictEqual(0, client.writeQueueSize);
@@ -57,7 +57,7 @@ server.onconnection = (err, client) => {
assert.strictEqual(client, client_);
assert.strictEqual(req, req_);
- console.log('client.writeQueueSize: ' + client.writeQueueSize);
+ console.log(`client.writeQueueSize: ${client.writeQueueSize}`);
assert.strictEqual(0, client.writeQueueSize);
maybeCloseClient();
diff --git a/test/parallel/test-timers-ordering.js b/test/parallel/test-timers-ordering.js
index 853f80a66a2384..4077ca7e3f3083 100644
--- a/test/parallel/test-timers-ordering.js
+++ b/test/parallel/test-timers-ordering.js
@@ -8,22 +8,21 @@ const N = 30;
let last_i = 0;
let last_ts = 0;
-const f = function(i) {
+function f(i) {
if (i <= N) {
// check order
- assert.strictEqual(i, last_i + 1, 'order is broken: ' + i + ' != ' +
- last_i + ' + 1');
+ assert.strictEqual(i, last_i + 1, `order is broken: ${i} != ${last_i} + 1`);
last_i = i;
// check that this iteration is fired at least 1ms later than the previous
const now = Timer.now();
console.log(i, now);
assert(now >= last_ts + 1,
- 'current ts ' + now + ' < prev ts ' + last_ts + ' + 1');
+ `current ts ${now} < prev ts ${last_ts} + 1`);
last_ts = now;
// schedule next iteration
setTimeout(f, 1, i + 1);
}
-};
+}
f(1);
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-timers-unrefed-in-callback.js b/test/parallel/test-timers-unrefed-in-callback.js
index c6fcb22789955a..50e6881bd3f60b 100644
--- a/test/parallel/test-timers-unrefed-in-callback.js
+++ b/test/parallel/test-timers-unrefed-in-callback.js
@@ -2,8 +2,7 @@
// Checks that setInterval timers keep running even when they're
// unrefed within their callback.
-require('../common');
-const assert = require('assert');
+const common = require('../common');
const net = require('net');
let counter1 = 0;
@@ -28,7 +27,7 @@ function Test1() {
// server only for maintaining event loop
const server = net.createServer().listen(0);
- const timer1 = setInterval(() => {
+ const timer1 = setInterval(common.mustCall(() => {
timer1.unref();
if (counter1++ === 3) {
clearInterval(timer1);
@@ -36,7 +35,7 @@ function Test1() {
Test2();
});
}
- }, 1);
+ }, 4), 1);
}
@@ -54,8 +53,4 @@ function Test2() {
}, 1);
}
-process.on('exit', () => {
- assert.strictEqual(counter1, 4);
-});
-
Test1();
diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js
index 483d256564accd..cba0cb0cf98ebc 100644
--- a/test/parallel/test-tls-0-dns-altname.js
+++ b/test/parallel/test-tls-0-dns-altname.js
@@ -13,8 +13,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/0-dns/0-dns-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/0-dns/0-dns-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/0-dns/0-dns-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/0-dns/0-dns-cert.pem`)
}, function(c) {
c.once('data', function() {
c.destroy();
diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js
index 699b1acfc453c4..5268f520f13958 100644
--- a/test/parallel/test-tls-alert-handling.js
+++ b/test/parallel/test-tls-alert-handling.js
@@ -16,7 +16,7 @@ const net = require('net');
const fs = require('fs');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js
index a8c6016f6218b7..4b9fba55a27efc 100644
--- a/test/parallel/test-tls-alert.js
+++ b/test/parallel/test-tls-alert.js
@@ -19,7 +19,7 @@ const spawn = require('child_process').spawn;
let success = false;
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js
index 9199d946791084..a397550d96863a 100644
--- a/test/parallel/test-tls-alpn-server-client.js
+++ b/test/parallel/test-tls-alpn-server-client.js
@@ -7,8 +7,8 @@ if (!common.hasCrypto) {
}
if (!process.features.tls_alpn || !process.features.tls_npn) {
- common.skip('Skipping because node compiled without NPN or ALPN' +
- ' feature of OpenSSL.');
+ common.skip(
+ 'Skipping because node compiled without NPN or ALPN feature of OpenSSL.');
return;
}
@@ -17,7 +17,7 @@ const fs = require('fs');
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js
index edf47f7059b406..d6c20eabb67579 100644
--- a/test/parallel/test-tls-basic-validations.js
+++ b/test/parallel/test-tls-basic-validations.js
@@ -28,7 +28,7 @@ assert.throws(() => tls.createServer({sessionTimeout: 'abcd'}),
assert.throws(() => tls.createServer({ticketKeys: 'abcd'}),
/TypeError: Ticket keys must be a buffer/);
-assert.throws(() => tls.createServer({ticketKeys: new Buffer(0)}),
+assert.throws(() => tls.createServer({ticketKeys: Buffer.alloc(0)}),
/TypeError: Ticket keys length must be 48 bytes/);
assert.throws(() => tls.createSecurePair({}),
diff --git a/test/parallel/test-tls-ca-concat.js b/test/parallel/test-tls-ca-concat.js
index 65c837bed9dc37..8fa83a4628d9cc 100644
--- a/test/parallel/test-tls-ca-concat.js
+++ b/test/parallel/test-tls-ca-concat.js
@@ -12,7 +12,7 @@ const {
connect({
client: {
checkServerIdentity: (servername, cert) => { },
- ca: keys.agent1.cert + '\n' + keys.agent6.ca,
+ ca: `${keys.agent1.cert}\n${keys.agent6.ca}`,
},
server: {
cert: keys.agent6.cert,
diff --git a/test/parallel/test-tls-client-destroy-soon.js b/test/parallel/test-tls-client-destroy-soon.js
index 016fcfa4da6a95..15b7ade2932528 100644
--- a/test/parallel/test-tls-client-destroy-soon.js
+++ b/test/parallel/test-tls-client-destroy-soon.js
@@ -15,8 +15,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const big = Buffer.alloc(2 * 1024 * 1024, 'Y');
diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js
index 0fd0912d3d9cbc..00defd5ae5a197 100644
--- a/test/parallel/test-tls-client-getephemeralkeyinfo.js
+++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js
@@ -9,8 +9,8 @@ if (!common.hasCrypto) {
const tls = require('tls');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let ntests = 0;
let nsuccess = 0;
@@ -18,7 +18,7 @@ let nsuccess = 0;
function loadDHParam(n) {
let path = common.fixturesDir;
if (n !== 'error') path += '/keys';
- return fs.readFileSync(path + '/dh' + n + '.pem');
+ return fs.readFileSync(`${path}/dh${n}.pem`);
}
const cipherlist = {
diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js
index a2b480f51e1326..f68134d76025d2 100644
--- a/test/parallel/test-tls-client-mindhsize.js
+++ b/test/parallel/test-tls-client-mindhsize.js
@@ -9,8 +9,8 @@ if (!common.hasCrypto) {
const tls = require('tls');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let nsuccess = 0;
let nerror = 0;
@@ -18,7 +18,7 @@ let nerror = 0;
function loadDHParam(n) {
let path = common.fixturesDir;
if (n !== 'error') path += '/keys';
- return fs.readFileSync(path + '/dh' + n + '.pem');
+ return fs.readFileSync(`${path}/dh${n}.pem`);
}
function test(size, err, next) {
@@ -53,8 +53,8 @@ function test(size, err, next) {
if (err) {
client.on('error', function(e) {
nerror++;
- assert.strictEqual(e.message, 'DH parameter size 1024 is less' +
- ' than 2048');
+ assert.strictEqual(e.message,
+ 'DH parameter size 1024 is less than 2048');
server.close();
});
}
@@ -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-client-resume.js b/test/parallel/test-tls-client-resume.js
index 96109d7656dd19..111c8ce34d7d25 100644
--- a/test/parallel/test-tls-client-resume.js
+++ b/test/parallel/test-tls-client-resume.js
@@ -15,8 +15,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
// create server
diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js
index 33d6c95fde50d3..643126488da869 100644
--- a/test/parallel/test-tls-client-verify.js
+++ b/test/parallel/test-tls-client-verify.js
@@ -44,7 +44,7 @@ const testCases =
];
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
@@ -84,7 +84,7 @@ function testServers(index, servers, clientOptions, cb) {
const authorized = client.authorized ||
hosterr.test(client.authorizationError);
- console.error('expected: ' + ok + ' authed: ' + authorized);
+ console.error(`expected: ${ok} authed: ${authorized}`);
assert.strictEqual(ok, authorized);
server.close();
diff --git a/test/parallel/test-tls-close-error.js b/test/parallel/test-tls-close-error.js
index 6172be813e97ce..60290989f8e2c7 100644
--- a/test/parallel/test-tls-close-error.js
+++ b/test/parallel/test-tls-close-error.js
@@ -12,8 +12,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
}).listen(0, common.mustCall(function() {
const c = tls.connect(this.address().port, function() {
diff --git a/test/parallel/test-tls-close-notify.js b/test/parallel/test-tls-close-notify.js
index 5d5bc1007749a7..2a6776b0b18710 100644
--- a/test/parallel/test-tls-close-notify.js
+++ b/test/parallel/test-tls-close-notify.js
@@ -10,8 +10,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
// Send close-notify without shutting down TCP socket
if (c._handle.shutdownSSL() !== 1)
diff --git a/test/parallel/test-tls-cnnic-whitelist.js b/test/parallel/test-tls-cnnic-whitelist.js
index 398fcddf16b43b..a33e631ddf7437 100644
--- a/test/parallel/test-tls-cnnic-whitelist.js
+++ b/test/parallel/test-tls-cnnic-whitelist.js
@@ -13,7 +13,7 @@ const fs = require('fs');
const path = require('path');
function filenamePEM(n) {
- return path.join(common.fixturesDir, 'keys', n + '.pem');
+ return path.join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-connect-given-socket.js b/test/parallel/test-tls-connect-given-socket.js
index aa9174b8dad2f3..2fa12aedc4979b 100644
--- a/test/parallel/test-tls-connect-given-socket.js
+++ b/test/parallel/test-tls-connect-given-socket.js
@@ -11,26 +11,20 @@ const tls = require('tls');
const net = require('net');
const fs = require('fs');
const path = require('path');
-
-let serverConnected = 0;
-let clientConnected = 0;
-
const options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))
};
-const server = tls.createServer(options, (socket) => {
- serverConnected++;
+const server = tls.createServer(options, common.mustCall((socket) => {
socket.end('Hello');
-}).listen(0, () => {
+}, 2)).listen(0, common.mustCall(() => {
let waiting = 2;
- function establish(socket) {
+ function establish(socket, calls) {
const client = tls.connect({
rejectUnauthorized: false,
socket: socket
- }, () => {
- clientConnected++;
+ }, common.mustCall(() => {
let data = '';
client.on('data', common.mustCall((chunk) => {
data += chunk.toString();
@@ -40,7 +34,7 @@ const server = tls.createServer(options, (socket) => {
if (--waiting === 0)
server.close();
}));
- });
+ }, calls));
assert(client.readable);
assert(client.writable);
@@ -51,14 +45,14 @@ const server = tls.createServer(options, (socket) => {
// Immediate death socket
const immediateDeath = net.connect(port);
- establish(immediateDeath).destroy();
+ establish(immediateDeath, 0).destroy();
// Outliving
const outlivingTCP = net.connect(port, common.mustCall(() => {
outlivingTLS.destroy();
next();
}));
- const outlivingTLS = establish(outlivingTCP);
+ const outlivingTLS = establish(outlivingTCP, 0);
function next() {
// Already connected socket
@@ -70,9 +64,4 @@ const server = tls.createServer(options, (socket) => {
const connecting = net.connect(port);
establish(connecting);
}
-});
-
-process.on('exit', () => {
- assert.strictEqual(serverConnected, 2);
- assert.strictEqual(clientConnected, 2);
-});
+}));
diff --git a/test/parallel/test-tls-connect-pipe.js b/test/parallel/test-tls-connect-pipe.js
index de60ae084624cf..55295eb9997410 100644
--- a/test/parallel/test-tls-connect-pipe.js
+++ b/test/parallel/test-tls-connect-pipe.js
@@ -10,8 +10,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
common.refreshTmpDir();
diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js
index a6bcfcab519fdf..f169773c77a26e 100644
--- a/test/parallel/test-tls-connect-simple.js
+++ b/test/parallel/test-tls-connect-simple.js
@@ -12,8 +12,8 @@ const fs = require('fs');
let serverConnected = 0;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.Server(options, common.mustCall(function(socket) {
diff --git a/test/parallel/test-tls-connect-stream-writes.js b/test/parallel/test-tls-connect-stream-writes.js
index 2db130bc4b749e..5266d6c93d1ccb 100644
--- a/test/parallel/test-tls-connect-stream-writes.js
+++ b/test/parallel/test-tls-connect-stream-writes.js
@@ -7,9 +7,9 @@ const stream = require('stream');
const net = require('net');
const cert_dir = common.fixturesDir;
-const options = { key: fs.readFileSync(cert_dir + '/test_key.pem'),
- cert: fs.readFileSync(cert_dir + '/test_cert.pem'),
- ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ],
+const options = { key: fs.readFileSync(`${cert_dir}/test_key.pem`),
+ cert: fs.readFileSync(`${cert_dir}/test_cert.pem`),
+ ca: [ fs.readFileSync(`${cert_dir}/test_ca.pem`) ],
ciphers: 'AES256-GCM-SHA384' };
const content = 'hello world';
const recv_bufs = [];
diff --git a/test/parallel/test-tls-delayed-attach-error.js b/test/parallel/test-tls-delayed-attach-error.js
index 47be3f201b463e..c7b6bf33127a5e 100644
--- a/test/parallel/test-tls-delayed-attach-error.js
+++ b/test/parallel/test-tls-delayed-attach-error.js
@@ -12,8 +12,8 @@ const net = require('net');
const bonkers = Buffer.alloc(1024, 42);
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = net.createServer(common.mustCall(function(c) {
diff --git a/test/parallel/test-tls-delayed-attach.js b/test/parallel/test-tls-delayed-attach.js
index 9d2aca6a7d6c6f..655da22ac836fc 100644
--- a/test/parallel/test-tls-delayed-attach.js
+++ b/test/parallel/test-tls-delayed-attach.js
@@ -15,8 +15,8 @@ const sent = 'hello world';
let received = '';
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = net.createServer(function(c) {
diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js
index 80a2d78501c308..3d9a7ef5277676 100644
--- a/test/parallel/test-tls-dhe.js
+++ b/test/parallel/test-tls-dhe.js
@@ -16,8 +16,8 @@ const tls = require('tls');
const spawn = require('child_process').spawn;
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let nsuccess = 0;
let ntests = 0;
const ciphers = 'DHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
@@ -26,7 +26,7 @@ const ciphers = 'DHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
function loadDHParam(n) {
let path = common.fixturesDir;
if (n !== 'error') path += '/keys';
- return fs.readFileSync(path + '/dh' + n + '.pem');
+ return fs.readFileSync(`${path}/dh${n}.pem`);
}
function test(keylen, expectedCipher, cb) {
@@ -63,7 +63,7 @@ function test(keylen, expectedCipher, cb) {
client.stdout.on('end', function() {
// DHE key length can be checked -brief option in s_client but it
// is only supported in openssl 1.0.2 so we cannot check it.
- const reg = new RegExp('Cipher : ' + expectedCipher);
+ const reg = new RegExp(`Cipher : ${expectedCipher}`);
if (reg.test(out)) {
nsuccess++;
server.close();
diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js
index eec22c3cd34c8b..b53b98273c91dd 100644
--- a/test/parallel/test-tls-ecdh-disable.js
+++ b/test/parallel/test-tls-ecdh-disable.js
@@ -18,8 +18,8 @@ const exec = require('child_process').exec;
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: 'ECDHE-RSA-RC4-SHA',
ecdhCurve: false
};
@@ -27,8 +27,8 @@ const options = {
const server = tls.createServer(options, common.mustNotCall());
server.listen(0, '127.0.0.1', common.mustCall(function() {
- let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
- ` -connect 127.0.0.1:${this.address().port}`;
+ let cmd = `"${common.opensslCli}" s_client -cipher ${
+ options.ciphers} -connect 127.0.0.1:${this.address().port}`;
// for the performance and stability issue in s_client on Windows
if (common.isWindows)
diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js
index 56348d5d8e557e..9383f111f8da49 100644
--- a/test/parallel/test-tls-ecdh.js
+++ b/test/parallel/test-tls-ecdh.js
@@ -18,8 +18,8 @@ const exec = require('child_process').exec;
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: '-ALL:ECDHE-RSA-AES128-SHA256',
ecdhCurve: 'prime256v1'
};
@@ -31,8 +31,8 @@ const server = tls.createServer(options, common.mustCall(function(conn) {
}));
server.listen(0, '127.0.0.1', common.mustCall(function() {
- let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
- ` -connect 127.0.0.1:${this.address().port}`;
+ let cmd = `"${common.opensslCli}" s_client -cipher ${
+ options.ciphers} -connect 127.0.0.1:${this.address().port}`;
// for the performance and stability issue in s_client on Windows
if (common.isWindows)
diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js
index 9b42bbbbd5558e..57e4c1cfaf3af6 100644
--- a/test/parallel/test-tls-env-bad-extra-ca.js
+++ b/test/parallel/test-tls-env-bad-extra-ca.js
@@ -19,7 +19,7 @@ if (process.env.CHILD) {
const env = {
CHILD: 'yes',
- NODE_EXTRA_CA_CERTS: common.fixturesDir + '/no-such-file-exists',
+ NODE_EXTRA_CA_CERTS: `${common.fixturesDir}/no-such-file-exists`,
};
const opts = {
@@ -33,10 +33,8 @@ fork(__filename, opts)
assert.strictEqual(status, 0, 'client did not succeed in connecting');
}))
.on('close', common.mustCall(function() {
- assert(stderr.match(new RegExp(
- '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-env-extra-ca.js b/test/parallel/test-tls-env-extra-ca.js
index 89f1b3a6c040d1..8c561d921cb802 100644
--- a/test/parallel/test-tls-env-extra-ca.js
+++ b/test/parallel/test-tls-env-extra-ca.js
@@ -25,8 +25,8 @@ if (process.env.CHILD) {
}
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
};
const server = tls.createServer(options, function(s) {
@@ -36,7 +36,7 @@ const server = tls.createServer(options, function(s) {
const env = {
CHILD: 'yes',
PORT: this.address().port,
- NODE_EXTRA_CA_CERTS: common.fixturesDir + '/keys/ca1-cert.pem',
+ NODE_EXTRA_CA_CERTS: `${common.fixturesDir}/keys/ca1-cert.pem`,
};
fork(__filename, {env: env}).on('exit', common.mustCall(function(status) {
diff --git a/test/parallel/test-tls-fast-writing.js b/test/parallel/test-tls-fast-writing.js
index b2d6fe6eee88a3..5b11375809aca8 100644
--- a/test/parallel/test-tls-fast-writing.js
+++ b/test/parallel/test-tls-fast-writing.js
@@ -11,9 +11,9 @@ const tls = require('tls');
const fs = require('fs');
const dir = common.fixturesDir;
-const options = { key: fs.readFileSync(dir + '/test_key.pem'),
- cert: fs.readFileSync(dir + '/test_cert.pem'),
- ca: [ fs.readFileSync(dir + '/test_ca.pem') ] };
+const options = { key: fs.readFileSync(`${dir}/test_key.pem`),
+ cert: fs.readFileSync(`${dir}/test_cert.pem`),
+ ca: [ fs.readFileSync(`${dir}/test_ca.pem`) ] };
const server = tls.createServer(options, onconnection);
let gotChunk = false;
diff --git a/test/parallel/test-tls-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js
index 3f3bfe9133fcd6..62dfc81eccfe4c 100644
--- a/test/parallel/test-tls-friendly-error-message.js
+++ b/test/parallel/test-tls-friendly-error-message.js
@@ -10,8 +10,8 @@ const tls = require('tls');
const fs = require('fs');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
tls.createServer({ key: key, cert: cert }, common.mustCall(function(conn) {
conn.end();
diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js
index b5205d48778f5f..52f898ef145da1 100644
--- a/test/parallel/test-tls-getcipher.js
+++ b/test/parallel/test-tls-getcipher.js
@@ -12,8 +12,8 @@ const fs = require('fs');
const cipher_list = ['AES128-SHA256', 'AES256-SHA256'];
const cipher_version_pattern = /TLS|SSL/;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: cipher_list.join(':'),
honorCipherOrder: true
};
diff --git a/test/parallel/test-tls-getprotocol.js b/test/parallel/test-tls-getprotocol.js
index b8a2c48f89827d..393b8fb3fe028a 100644
--- a/test/parallel/test-tls-getprotocol.js
+++ b/test/parallel/test-tls-getprotocol.js
@@ -17,8 +17,8 @@ const clientConfigs = [
];
const serverConfig = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const server = tls.createServer(serverConfig, common.mustCall(function() {
diff --git a/test/parallel/test-tls-handshake-error.js b/test/parallel/test-tls-handshake-error.js
index 4909fa45e160fb..e3cbb39be01a57 100644
--- a/test/parallel/test-tls-handshake-error.js
+++ b/test/parallel/test-tls-handshake-error.js
@@ -12,8 +12,8 @@ const tls = require('tls');
const fs = require('fs');
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
rejectUnauthorized: true
}, function(c) {
}).listen(0, common.mustCall(function() {
diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js
index f9c280f5e57a34..295cfaba25f4c7 100644
--- a/test/parallel/test-tls-hello-parser-failure.js
+++ b/test/parallel/test-tls-hello-parser-failure.js
@@ -14,8 +14,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`)
};
const bonkers = Buffer.alloc(1024 * 1024, 42);
diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js
index fdfc303146c1fa..a6d51d5dfeea6d 100644
--- a/test/parallel/test-tls-honorcipherorder.js
+++ b/test/parallel/test-tls-honorcipherorder.js
@@ -23,8 +23,8 @@ process.on('exit', function() {
function test(honorCipherOrder, clientCipher, expectedCipher, cb) {
const soptions = {
secureProtocol: SSL_Method,
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: 'AES256-SHA256:AES128-GCM-SHA256:AES128-SHA256:' +
'ECDHE-RSA-AES128-GCM-SHA256',
honorCipherOrder: !!honorCipherOrder
diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js
index 9cccee82506005..60d778b77de268 100644
--- a/test/parallel/test-tls-interleave.js
+++ b/test/parallel/test-tls-interleave.js
@@ -12,9 +12,9 @@ const tls = require('tls');
const fs = require('fs');
const dir = common.fixturesDir;
-const options = { key: fs.readFileSync(dir + '/test_key.pem'),
- cert: fs.readFileSync(dir + '/test_cert.pem'),
- ca: [ fs.readFileSync(dir + '/test_ca.pem') ] };
+const options = { key: fs.readFileSync(`${dir}/test_key.pem`),
+ cert: fs.readFileSync(`${dir}/test_cert.pem`),
+ ca: [ fs.readFileSync(`${dir}/test_ca.pem`) ] };
const writes = [
'some server data',
diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js
index bd3ad43fe653e5..08053e026249e6 100644
--- a/test/parallel/test-tls-invoke-queued.js
+++ b/test/parallel/test-tls-invoke-queued.js
@@ -14,8 +14,8 @@ const fs = require('fs');
let received = '';
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
c._write('hello ', null, function() {
c._write('world!', null, function() {
diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js
index 5945a1fc0318cd..c97cbfb9cb148e 100644
--- a/test/parallel/test-tls-js-stream.js
+++ b/test/parallel/test-tls-js-stream.js
@@ -18,8 +18,8 @@ const connected = {
};
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
console.log('new client');
connected.server++;
diff --git a/test/parallel/test-tls-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js
index 1ecc83da2d77d1..ff4d0b3ae39a5d 100644
--- a/test/parallel/test-tls-junk-closes-server.js
+++ b/test/parallel/test-tls-junk-closes-server.js
@@ -11,8 +11,8 @@ const fs = require('fs');
const net = require('net');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const server = tls.createServer(options, common.mustNotCall());
diff --git a/test/parallel/test-tls-key-mismatch.js b/test/parallel/test-tls-key-mismatch.js
index 93c7e70d8c61f7..4c755afa935534 100644
--- a/test/parallel/test-tls-key-mismatch.js
+++ b/test/parallel/test-tls-key-mismatch.js
@@ -8,12 +8,12 @@ if (!common.hasCrypto) {
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
-const errorMessageRegex = new RegExp('^Error: error:0B080074:x509 ' +
- 'certificate routines:X509_check_private_key:key values mismatch$');
+const errorMessageRegex =
+ /^Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch$/;
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
assert.throws(function() {
diff --git a/test/parallel/test-tls-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js
index 4b81be35e34522..6d7d9009e9a72e 100644
--- a/test/parallel/test-tls-max-send-fragment.js
+++ b/test/parallel/test-tls-max-send-fragment.js
@@ -15,8 +15,8 @@ let received = 0;
const maxChunk = 768;
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
// Lower and upper limits
assert(!c.setMaxSendFragment(511));
diff --git a/test/parallel/test-tls-multi-key.js b/test/parallel/test-tls-multi-key.js
index e3d5d661a799a7..d78e617977d72d 100644
--- a/test/parallel/test-tls-multi-key.js
+++ b/test/parallel/test-tls-multi-key.js
@@ -11,12 +11,12 @@ const fs = require('fs');
const options = {
key: [
- fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
+ fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
],
cert: [
- fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
- fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
+ fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
]
};
diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js
index 3c7cf4462fcd07..001f6443c1b026 100644
--- a/test/parallel/test-tls-no-cert-required.js
+++ b/test/parallel/test-tls-no-cert-required.js
@@ -20,7 +20,8 @@ tls.createServer(assert.fail)
tls.createServer({})
.listen(0, common.mustCall(close));
-assert.throws(() => tls.createServer('this is not valid'), TypeError);
+assert.throws(() => tls.createServer('this is not valid'),
+ /^TypeError: options must be an object$/);
tls.createServer()
.listen(0, common.mustCall(close));
diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js
index ed5c941b2d33ba..8f05fcd514d0c5 100644
--- a/test/parallel/test-tls-no-rsa-key.js
+++ b/test/parallel/test-tls-no-rsa-key.js
@@ -11,8 +11,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
};
const server = tls.createServer(options, function(conn) {
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-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js
index e7ee788a35ca17..2c2c51eb9be5fd 100644
--- a/test/parallel/test-tls-no-sslv3.js
+++ b/test/parallel/test-tls-no-sslv3.js
@@ -16,14 +16,14 @@ if (common.opensslCli === false) {
return;
}
-const cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem');
-const key = fs.readFileSync(common.fixturesDir + '/test_key.pem');
+const cert = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`);
+const key = fs.readFileSync(`${common.fixturesDir}/test_key.pem`);
const server = tls.createServer({ cert: cert, key: key }, common.mustNotCall());
const errors = [];
let stderr = '';
server.listen(0, '127.0.0.1', function() {
- const address = this.address().address + ':' + this.address().port;
+ const address = `${this.address().address}:${this.address().port}`;
const args = ['s_client',
'-ssl3',
'-connect', address];
diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js
index 2369673073c6d7..cdaeb7cf4ccb33 100644
--- a/test/parallel/test-tls-npn-server-client.js
+++ b/test/parallel/test-tls-npn-server-client.js
@@ -1,7 +1,6 @@
'use strict';
if (!process.features.tls_npn) {
- common.skip('Skipping because node compiled without NPN feature of' +
- ' OpenSSL.');
+ common.skip('Skipping because node compiled without NPN feature of OpenSSL.');
return;
}
@@ -17,7 +16,7 @@ const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-ocsp-callback.js b/test/parallel/test-tls-ocsp-callback.js
index c008613c2ccf9f..97dea67002909c 100644
--- a/test/parallel/test-tls-ocsp-callback.js
+++ b/test/parallel/test-tls-ocsp-callback.js
@@ -2,8 +2,7 @@
const common = require('../common');
if (!process.features.tls_ocsp) {
- common.skip('node compiled without OpenSSL or ' +
- 'with old OpenSSL version.');
+ common.skip('node compiled without OpenSSL or with old OpenSSL version.');
return;
}
if (!common.opensslCli) {
diff --git a/test/parallel/test-tls-on-empty-socket.js b/test/parallel/test-tls-on-empty-socket.js
index 84e27c5dd3067e..38537fd640c71a 100644
--- a/test/parallel/test-tls-on-empty-socket.js
+++ b/test/parallel/test-tls-on-empty-socket.js
@@ -14,8 +14,8 @@ const net = require('net');
let out = '';
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
}, function(c) {
c.end('hello');
}).listen(0, function() {
diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js
index a37913907b5b19..741d351f47e753 100644
--- a/test/parallel/test-tls-over-http-tunnel.js
+++ b/test/parallel/test-tls-over-http-tunnel.js
@@ -14,8 +14,8 @@ const http = require('http');
let gotRequest = false;
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
const options = {
key: key,
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-pause.js b/test/parallel/test-tls-pause.js
index c5b96b96dd675f..239720f1e9dbb3 100644
--- a/test/parallel/test-tls-pause.js
+++ b/test/parallel/test-tls-pause.js
@@ -48,7 +48,7 @@ server.listen(0, function() {
return process.nextTick(send);
}
sent += bufSize;
- console.error('sent: ' + sent);
+ console.error(`sent: ${sent}`);
resumed = true;
client.resume();
console.error('resumed', client);
@@ -61,7 +61,7 @@ server.listen(0, function() {
console.error('received', received);
console.error('sent', sent);
if (received >= sent) {
- console.error('received: ' + received);
+ console.error(`received: ${received}`);
client.end();
server.close();
}
diff --git a/test/parallel/test-tls-regr-gh-5108.js b/test/parallel/test-tls-regr-gh-5108.js
index 6371bb52136185..6f4392007bc856 100644
--- a/test/parallel/test-tls-regr-gh-5108.js
+++ b/test/parallel/test-tls-regr-gh-5108.js
@@ -11,8 +11,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
diff --git a/test/parallel/test-tls-request-timeout.js b/test/parallel/test-tls-request-timeout.js
index 4873a3c696458f..ab30bf94ee0e96 100644
--- a/test/parallel/test-tls-request-timeout.js
+++ b/test/parallel/test-tls-request-timeout.js
@@ -11,8 +11,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.Server(options, common.mustCall(function(socket) {
diff --git a/test/parallel/test-tls-retain-handle-no-abort.js b/test/parallel/test-tls-retain-handle-no-abort.js
index 43b3709fd5f85b..a3a2aebcd6ab2c 100644
--- a/test/parallel/test-tls-retain-handle-no-abort.js
+++ b/test/parallel/test-tls-retain-handle-no-abort.js
@@ -14,8 +14,8 @@ const util = require('util');
const sent = 'hello world';
const serverOptions = {
isServer: true,
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
let ssl = null;
diff --git a/test/parallel/test-tls-securepair-fiftharg.js b/test/parallel/test-tls-securepair-fiftharg.js
index 06b29b8736826d..97b563ae0383d4 100644
--- a/test/parallel/test-tls-securepair-fiftharg.js
+++ b/test/parallel/test-tls-securepair-fiftharg.js
@@ -6,8 +6,8 @@ const fs = require('fs');
const tls = require('tls');
const sslcontext = tls.createSecureContext({
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
});
let catchedServername;
@@ -18,7 +18,7 @@ const pair = tls.createSecurePair(sslcontext, true, false, false, {
});
// captured traffic from browser's request to https://www.google.com
-const sslHello = fs.readFileSync(common.fixturesDir + '/google_ssl_hello.bin');
+const sslHello = fs.readFileSync(`${common.fixturesDir}/google_ssl_hello.bin`);
pair.encrypted.write(sslHello);
diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js
index 76d2f88ac6b8d4..8f6efbb677a500 100644
--- a/test/parallel/test-tls-securepair-server.js
+++ b/test/parallel/test-tls-securepair-server.js
@@ -23,11 +23,11 @@ const key = fs.readFileSync(join(common.fixturesDir, 'agent.key')).toString();
const cert = fs.readFileSync(join(common.fixturesDir, 'agent.crt')).toString();
function log(a) {
- console.error('***server*** ' + a);
+ console.error(`***server*** ${a}`);
}
const server = net.createServer(common.mustCall(function(socket) {
- log('connection fd=' + socket.fd);
+ log(`connection fd=${socket.fd}`);
const sslcontext = tls.createSecureContext({key: key, cert: cert});
sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
@@ -49,7 +49,7 @@ const server = net.createServer(common.mustCall(function(socket) {
});
pair.cleartext.on('data', function(data) {
- log('read bytes ' + data.length);
+ log(`read bytes ${data.length}`);
pair.cleartext.write(data);
});
diff --git a/test/parallel/test-tls-server-connection-server.js b/test/parallel/test-tls-server-connection-server.js
index e33c80be07dd8f..1c54eb635ad449 100644
--- a/test/parallel/test-tls-server-connection-server.js
+++ b/test/parallel/test-tls-server-connection-server.js
@@ -11,8 +11,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.createServer(options, function(s) {
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-server-verify.js b/test/parallel/test-tls-server-verify.js
index 61330e2ba2e543..eba57d65de295e 100644
--- a/test/parallel/test-tls-server-verify.js
+++ b/test/parallel/test-tls-server-verify.js
@@ -113,7 +113,7 @@ const spawn = require('child_process').spawn;
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
@@ -133,13 +133,13 @@ function runClient(prefix, port, options, cb) {
// - Certificate, but not signed by CA.
// - Certificate signed by CA.
- const args = ['s_client', '-connect', '127.0.0.1:' + port];
+ const args = ['s_client', '-connect', `127.0.0.1:${port}`];
// for the performance issue in s_client on Windows
if (common.isWindows)
args.push('-no_rand_screen');
- console.log(prefix + ' connecting with', options.name);
+ console.log(`${prefix} connecting with`, options.name);
switch (options.name) {
case 'agent1':
@@ -180,7 +180,7 @@ function runClient(prefix, port, options, cb) {
break;
default:
- throw new Error(prefix + 'Unknown agent name');
+ throw new Error(`${prefix}Unknown agent name`);
}
// To test use: openssl s_client -connect localhost:8000
@@ -197,7 +197,7 @@ function runClient(prefix, port, options, cb) {
out += d;
if (!goodbye && /_unauthed/g.test(out)) {
- console.error(prefix + ' * unauthed');
+ console.error(`${prefix} * unauthed`);
goodbye = true;
client.kill();
authed = false;
@@ -205,7 +205,7 @@ function runClient(prefix, port, options, cb) {
}
if (!goodbye && /_authed/g.test(out)) {
- console.error(prefix + ' * authed');
+ console.error(`${prefix} * authed`);
goodbye = true;
client.kill();
authed = true;
@@ -216,17 +216,21 @@ function runClient(prefix, port, options, cb) {
//client.stdout.pipe(process.stdout);
client.on('exit', function(code) {
- //assert.strictEqual(0, code, prefix + options.name +
- // ": s_client exited with error code " + code);
+ //assert.strictEqual(
+ // 0, code,
+ // `${prefix}${options.name}: s_client exited with error code ${code}`);
if (options.shouldReject) {
- assert.strictEqual(true, rejected, prefix + options.name +
- ' NOT rejected, but should have been');
+ assert.strictEqual(
+ true, rejected,
+ `${prefix}${options.name} NOT rejected, but should have been`);
} else {
- assert.strictEqual(false, rejected, prefix + options.name +
- ' rejected, but should NOT have been');
- assert.strictEqual(options.shouldAuth, authed, prefix +
- options.name + ' authed is ' + authed +
- ' but should have been ' + options.shouldAuth);
+ assert.strictEqual(
+ false, rejected,
+ `${prefix}${options.name} rejected, but should NOT have been`);
+ assert.strictEqual(
+ options.shouldAuth, authed,
+ `${prefix}${options.name} authed is ${authed} but should have been ${
+ options.shouldAuth}`);
}
cb();
@@ -237,11 +241,11 @@ function runClient(prefix, port, options, cb) {
// Run the tests
let successfulTests = 0;
function runTest(port, testIndex) {
- const prefix = testIndex + ' ';
+ const prefix = `${testIndex} `;
const tcase = testCases[testIndex];
if (!tcase) return;
- console.error(prefix + "Running '%s'", tcase.title);
+ console.error(`${prefix}Running '%s'`, tcase.title);
const cas = tcase.CAs.map(loadPEM);
@@ -276,7 +280,7 @@ function runTest(port, testIndex) {
if (tcase.renegotiate && !renegotiated) {
renegotiated = true;
setTimeout(function() {
- console.error(prefix + '- connected, renegotiating');
+ console.error(`${prefix}- connected, renegotiating`);
c.write('\n_renegotiating\n');
return c.renegotiate({
requestCert: true,
@@ -291,11 +295,11 @@ function runTest(port, testIndex) {
}
if (c.authorized) {
- console.error(prefix + '- authed connection: ' +
- c.getPeerCertificate().subject.CN);
+ console.error(`${prefix}- authed connection: ${
+ c.getPeerCertificate().subject.CN}`);
c.write('\n_authed\n');
} else {
- console.error(prefix + '- unauthed connection: %s', c.authorizationError);
+ console.error(`${prefix}- unauthed connection: %s`, c.authorizationError);
c.write('\n_unauthed\n');
}
});
@@ -303,7 +307,7 @@ function runTest(port, testIndex) {
function runNextClient(clientIndex) {
const options = tcase.clients[clientIndex];
if (options) {
- runClient(prefix + clientIndex + ' ', port, options, function() {
+ runClient(`${prefix}${clientIndex} `, port, options, function() {
runNextClient(clientIndex + 1);
});
} else {
@@ -316,14 +320,14 @@ function runTest(port, testIndex) {
server.listen(port, function() {
port = server.address().port;
if (tcase.debug) {
- console.error(prefix + 'TLS server running on port ' + port);
+ console.error(`${prefix}TLS server running on port ${port}`);
} else {
if (tcase.renegotiate) {
runNextClient(0);
} else {
let clientsCompleted = 0;
for (let i = 0; i < tcase.clients.length; i++) {
- runClient(prefix + i + ' ', port, tcase.clients[i], function() {
+ runClient(`${prefix}${i} `, port, tcase.clients[i], function() {
clientsCompleted++;
if (clientsCompleted === tcase.clients.length) {
server.close();
diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js
index 83dcc1ff741922..e10bafca2aced3 100644
--- a/test/parallel/test-tls-set-ciphers.js
+++ b/test/parallel/test-tls-set-ciphers.js
@@ -17,8 +17,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`),
ciphers: 'DES-CBC3-SHA'
};
@@ -34,8 +34,8 @@ const server = tls.createServer(options, common.mustCall(function(conn) {
}));
server.listen(0, '127.0.0.1', function() {
- let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
- ` -connect 127.0.0.1:${this.address().port}`;
+ let cmd = `"${common.opensslCli}" s_client -cipher ${
+ options.ciphers} -connect 127.0.0.1:${this.address().port}`;
// for the performance and stability issue in s_client on Windows
if (common.isWindows)
diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js
index 5eb58132bc2b64..3ef06d4747a129 100644
--- a/test/parallel/test-tls-set-encoding.js
+++ b/test/parallel/test-tls-set-encoding.js
@@ -12,8 +12,8 @@ const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
// Contains a UTF8 only character
diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js
index f1613d2e9fbdce..632419701004a6 100644
--- a/test/parallel/test-tls-sni-option.js
+++ b/test/parallel/test-tls-sni-option.js
@@ -1,7 +1,6 @@
'use strict';
if (!process.features.tls_sni) {
- common.skip('node compiled without OpenSSL or ' +
- 'with old OpenSSL version.');
+ common.skip('node compiled without OpenSSL or with old OpenSSL version.');
return;
}
@@ -16,7 +15,7 @@ if (!common.hasCrypto) {
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js
index dad4ef20619cc7..a8c52ef5668184 100644
--- a/test/parallel/test-tls-sni-server-client.js
+++ b/test/parallel/test-tls-sni-server-client.js
@@ -1,7 +1,6 @@
'use strict';
if (!process.features.tls_sni) {
- common.skip('node compiled without OpenSSL or ' +
- 'with old OpenSSL version.');
+ common.skip('node compiled without OpenSSL or with old OpenSSL version.');
return;
}
@@ -16,7 +15,7 @@ if (!common.hasCrypto) {
const tls = require('tls');
function filenamePEM(n) {
- return require('path').join(common.fixturesDir, 'keys', n + '.pem');
+ return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-socket-close.js b/test/parallel/test-tls-socket-close.js
index 617062a4f2d5bf..25282ada9ed31a 100644
--- a/test/parallel/test-tls-socket-close.js
+++ b/test/parallel/test-tls-socket-close.js
@@ -10,8 +10,8 @@ const tls = require('tls');
const fs = require('fs');
const net = require('net');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`);
let tlsSocket;
// tls server
@@ -32,12 +32,17 @@ const netServer = net.createServer((socket) => {
netSocket = socket;
}).listen(0, common.mustCall(function() {
- // connect client
- tls.connect({
+ connectClient(netServer);
+}));
+
+function connectClient(server) {
+ const tlsConnection = tls.connect({
host: 'localhost',
- port: this.address().port,
+ port: server.address().port,
rejectUnauthorized: false
- }).write('foo', 'utf8', common.mustCall(() => {
+ });
+
+ tlsConnection.write('foo', 'utf8', common.mustCall(() => {
assert(netSocket);
netSocket.setTimeout(1, common.mustCall(() => {
assert(tlsSocket);
@@ -55,4 +60,10 @@ const netServer = net.createServer((socket) => {
}, 1);
}));
}));
-}));
+ tlsConnection.on('error', (e) => {
+ // Tolerate the occasional ECONNRESET.
+ // Ref: https://github.com/nodejs/node/issues/13184
+ if (e.code !== 'ECONNRESET')
+ throw e;
+ });
+}
diff --git a/test/parallel/test-tls-socket-destroy.js b/test/parallel/test-tls-socket-destroy.js
index 27651f8ec7206a..0a72ac6232e865 100644
--- a/test/parallel/test-tls-socket-destroy.js
+++ b/test/parallel/test-tls-socket-destroy.js
@@ -11,8 +11,8 @@ const fs = require('fs');
const net = require('net');
const tls = require('tls');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
const secureContext = tls.createSecureContext({ key, cert });
const server = net.createServer(common.mustCall((conn) => {
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-tls-startcom-wosign-whitelist.js b/test/parallel/test-tls-startcom-wosign-whitelist.js
index fd20e0d8e9745c..21dbb55c156e8e 100644
--- a/test/parallel/test-tls-startcom-wosign-whitelist.js
+++ b/test/parallel/test-tls-startcom-wosign-whitelist.js
@@ -13,7 +13,7 @@ const path = require('path');
let finished = 0;
function filenamePEM(n) {
- return path.join(common.fixturesDir, 'keys', n + '.pem');
+ return path.join(common.fixturesDir, 'keys', `${n}.pem`);
}
function loadPEM(n) {
diff --git a/test/parallel/test-tls-starttls-server.js b/test/parallel/test-tls-starttls-server.js
index ca6a00b25ddc03..d588fee34d5feb 100644
--- a/test/parallel/test-tls-starttls-server.js
+++ b/test/parallel/test-tls-starttls-server.js
@@ -15,8 +15,8 @@ const fs = require('fs');
const net = require('net');
const tls = require('tls');
-const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
-const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
+const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`);
+const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`);
const server = net.createServer(common.mustCall((s) => {
const tlsSocket = new tls.TLSSocket(s, {
diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js
index fa630f4ec251bd..4c534ca2481e74 100644
--- a/test/parallel/test-tls-ticket-cluster.js
+++ b/test/parallel/test-tls-ticket-cluster.js
@@ -20,10 +20,11 @@ if (cluster.isMaster) {
let reqCount = 0;
let lastSession = null;
let shootOnce = false;
+ let workerPort = null;
function shoot() {
- console.error('[master] connecting');
- const c = tls.connect(common.PORT, {
+ console.error('[master] connecting', workerPort);
+ const c = tls.connect(workerPort, {
session: lastSession,
rejectUnauthorized: false
}, function() {
@@ -42,11 +43,12 @@ if (cluster.isMaster) {
function fork() {
const worker = cluster.fork();
- worker.on('message', function(msg) {
+ worker.on('message', function({ msg, port }) {
console.error('[master] got %j', msg);
if (msg === 'reused') {
++reusedCount;
} else if (msg === 'listening' && !shootOnce) {
+ workerPort = port || workerPort;
shootOnce = true;
shoot();
}
@@ -78,15 +80,19 @@ const options = {
const server = tls.createServer(options, function(c) {
if (c.isSessionReused()) {
- process.send('reused');
+ process.send({ msg: 'reused' });
} else {
- process.send('not-reused');
+ process.send({ msg: 'not-reused' });
}
c.end();
});
-server.listen(common.PORT, function() {
- process.send('listening');
+server.listen(0, function() {
+ const { port } = server.address();
+ process.send({
+ msg: 'listening',
+ port,
+ });
});
process.on('message', function listener(msg) {
diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js
index 0fa0c057f3e573..116cdc0c2c4f0c 100644
--- a/test/parallel/test-tls-ticket.js
+++ b/test/parallel/test-tls-ticket.js
@@ -24,8 +24,8 @@ function createServer() {
let previousKey = null;
const server = tls.createServer({
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
ticketKeys: keys
}, function(c) {
serverLog.push(id);
diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js
index 1613e9fc4e06d6..b4dceb60711ab4 100644
--- a/test/parallel/test-tls-timeout-server-2.js
+++ b/test/parallel/test-tls-timeout-server-2.js
@@ -11,8 +11,8 @@ const tls = require('tls');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.createServer(options, common.mustCall(function(cleartext) {
diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js
index 5720317dd0a10f..6424b5bc13ca01 100644
--- a/test/parallel/test-tls-timeout-server.js
+++ b/test/parallel/test-tls-timeout-server.js
@@ -11,8 +11,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
handshakeTimeout: 50
};
diff --git a/test/parallel/test-tls-two-cas-one-string.js b/test/parallel/test-tls-two-cas-one-string.js
index 406acec7c5dedf..10d626ba6e10b6 100644
--- a/test/parallel/test-tls-two-cas-one-string.js
+++ b/test/parallel/test-tls-two-cas-one-string.js
@@ -30,5 +30,5 @@ function test(ca, next) {
}
const array = [ca1, ca2];
-const string = ca1 + '\n' + ca2;
+const string = `${ca1}\n${ca2}`;
test(array, () => test(string, () => {}));
diff --git a/test/parallel/test-tls-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js
index d66e1f2d680f77..64fbcc7fc7f270 100644
--- a/test/parallel/test-tls-wrap-timeout.js
+++ b/test/parallel/test-tls-wrap-timeout.js
@@ -12,8 +12,8 @@ const net = require('net');
const fs = require('fs');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
const server = tls.createServer(options, common.mustCall((c) => {
diff --git a/test/parallel/test-util-inherits.js b/test/parallel/test-util-inherits.js
index 4ddf9ad35dd2d6..13094ef695081b 100644
--- a/test/parallel/test-util-inherits.js
+++ b/test/parallel/test-util-inherits.js
@@ -4,8 +4,7 @@ require('../common');
const assert = require('assert');
const inherits = require('util').inherits;
const errCheck =
- new RegExp('^TypeError: The super constructor to "inherits" must not be ' +
- 'null or undefined$');
+ /^TypeError: The super constructor to "inherits" must not be null or undefined$/;
// super constructor
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index 18f734d24df64f..e3a65c895ab6d1 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -252,9 +252,11 @@ Object.defineProperty(
assert.strictEqual(util.inspect(value), '[ 1, 2, 3, growingLength: [Getter] ]');
// Function with properties
-value = function() {};
-value.aprop = 42;
-assert.strictEqual(util.inspect(value), '{ [Function: value] aprop: 42 }');
+{
+ const value = () => {};
+ value.aprop = 42;
+ assert.strictEqual(util.inspect(value), '{ [Function: value] aprop: 42 }');
+}
// Anonymous function with properties
value = (() => function() {})();
@@ -441,8 +443,7 @@ function test_color_style(style, input, implicit) {
const without_color = util.inspect(input, false, 0, false);
const with_color = util.inspect(input, false, 0, true);
- const expect = '\u001b[' + color[0] + 'm' + without_color +
- '\u001b[' + color[1] + 'm';
+ const expect = `\u001b[${color[0]}m${without_color}\u001b[${color[1]}m`;
assert.strictEqual(
with_color,
expect,
@@ -595,9 +596,7 @@ assert.doesNotThrow(function() {
// util.inspect with "colors" option should produce as many lines as without it
function test_lines(input) {
- const count_lines = function(str) {
- return (str.match(/\n/g) || []).length;
- };
+ const count_lines = (str) => (str.match(/\n/g) || []).length;
const without_color = util.inspect(input);
const with_color = util.inspect(input, {colors: true});
@@ -747,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-vm-cached-data.js b/test/parallel/test-vm-cached-data.js
index 8dc1fa25756201..c4fa55cb0b2a6d 100644
--- a/test/parallel/test-vm-cached-data.js
+++ b/test/parallel/test-vm-cached-data.js
@@ -32,7 +32,7 @@ function produce(source, count) {
console.log(data);
`, source]);
- assert.strictEqual(out.status, 0, out.stderr + '');
+ assert.strictEqual(out.status, 0, String(out.stderr));
return Buffer.from(out.stdout.toString(), 'base64');
}
diff --git a/test/parallel/test-vm-create-context-accessors.js b/test/parallel/test-vm-create-context-accessors.js
index 27d7e6d7fc0274..1b5dd62543c791 100644
--- a/test/parallel/test-vm-create-context-accessors.js
+++ b/test/parallel/test-vm-create-context-accessors.js
@@ -17,7 +17,7 @@ Object.defineProperty(ctx, 'setter', {
val = _val;
},
get: function() {
- return 'ok=' + val;
+ return `ok=${val}`;
}
});
diff --git a/test/parallel/test-vm-debug-context.js b/test/parallel/test-vm-debug-context.js
index 2a248fe25ceb71..313b9f4bcae6ab 100644
--- a/test/parallel/test-vm-debug-context.js
+++ b/test/parallel/test-vm-debug-context.js
@@ -56,7 +56,7 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
// Can set listeners and breakpoints on a single line file
{
const Debug = vm.runInDebugContext('Debug');
- const fn = require(common.fixturesDir + '/exports-function-with-param');
+ const fn = require(`${common.fixturesDir}/exports-function-with-param`);
let called = false;
Debug.setListener(function(event, state, data) {
@@ -73,7 +73,7 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
// See https://github.com/nodejs/node/issues/1190, fatal errors should not
// crash the process.
-const script = common.fixturesDir + '/vm-run-in-debug-context.js';
+const script = `${common.fixturesDir}/vm-run-in-debug-context.js`;
let proc = spawn(process.execPath, [script]);
const data = [];
proc.stdout.on('data', common.mustNotCall());
diff --git a/test/parallel/test-vm-is-context.js b/test/parallel/test-vm-is-context.js
index e58b896fccaa43..e8b220ed6c3d68 100644
--- a/test/parallel/test-vm-is-context.js
+++ b/test/parallel/test-vm-is-context.js
@@ -5,7 +5,7 @@ const vm = require('vm');
assert.throws(function() {
vm.isContext('string is not supported');
-}, TypeError);
+}, /^TypeError: sandbox must be an object$/);
assert.strictEqual(vm.isContext({}), false);
assert.strictEqual(vm.isContext([]), false);
diff --git a/test/parallel/test-vm-new-script-new-context.js b/test/parallel/test-vm-new-script-new-context.js
index 693a041138602f..56df3738c11a8e 100644
--- a/test/parallel/test-vm-new-script-new-context.js
+++ b/test/parallel/test-vm-new-script-new-context.js
@@ -17,14 +17,14 @@ console.error('thrown error');
script = new Script('throw new Error(\'test\');');
assert.throws(function() {
script.runInNewContext();
-}, /test/);
+}, /^Error: test$/);
console.error('undefined reference');
script = new Script('foo.bar = 5;');
assert.throws(function() {
script.runInNewContext();
-}, /not defined/);
+}, /^ReferenceError: foo is not defined$/);
global.hello = 5;
@@ -61,9 +61,9 @@ assert.strictEqual(f.a, 2);
assert.throws(function() {
script.runInNewContext();
-}, /f is not defined/);
+}, /^ReferenceError: f is not defined$/);
console.error('invalid this');
assert.throws(function() {
script.runInNewContext.call('\'hello\';');
-}, TypeError);
+}, /^TypeError: this\.runInContext is not a function$/);
diff --git a/test/parallel/test-vm-new-script-this-context.js b/test/parallel/test-vm-new-script-this-context.js
index 3df5dc1b5020d5..62aecfed28af4f 100644
--- a/test/parallel/test-vm-new-script-this-context.js
+++ b/test/parallel/test-vm-new-script-this-context.js
@@ -14,7 +14,7 @@ console.error('thrown error');
script = new Script('throw new Error(\'test\');');
assert.throws(function() {
script.runInThisContext(script);
-});
+}, /^Error: test$/);
global.hello = 5;
script = new Script('hello = 2');
diff --git a/test/parallel/test-vm-syntax-error-stderr.js b/test/parallel/test-vm-syntax-error-stderr.js
index 43ed8d882804ca..9cba2178e3a0a3 100644
--- a/test/parallel/test-vm-syntax-error-stderr.js
+++ b/test/parallel/test-vm-syntax-error-stderr.js
@@ -13,7 +13,7 @@ const p = child_process.spawn(process.execPath, [
]);
p.stdout.on('data', function(data) {
- common.fail('Unexpected stdout data: ' + data);
+ common.fail(`Unexpected stdout data: ${data}`);
});
let output = '';
diff --git a/test/parallel/test-vm-timeout.js b/test/parallel/test-vm-timeout.js
index 6ed73f8b4ffd78..73f68176473c8c 100644
--- a/test/parallel/test-vm-timeout.js
+++ b/test/parallel/test-vm-timeout.js
@@ -11,12 +11,12 @@ assert.throws(function() {
// Test 2: Timeout must be >= 0ms
assert.throws(function() {
vm.runInThisContext('', { timeout: -1 });
-}, RangeError);
+}, /^RangeError: timeout must be a positive number$/);
// Test 3: Timeout of 0ms
assert.throws(function() {
vm.runInThisContext('', { timeout: 0 });
-}, RangeError);
+}, /^RangeError: timeout must be a positive number$/);
// Test 4: Timeout of 1000ms, script finishes first
vm.runInThisContext('', { timeout: 1000 });
diff --git a/test/parallel/test-windows-abort-exitcode.js b/test/parallel/test-windows-abort-exitcode.js
new file mode 100644
index 00000000000000..c5c5fa6f3a5e78
--- /dev/null
+++ b/test/parallel/test-windows-abort-exitcode.js
@@ -0,0 +1,23 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+
+// This test makes sure that an aborted node process
+// exits with code 3 on Windows.
+// Spawn a child, force an abort, and then check the
+// exit code in the parent.
+
+const spawn = require('child_process').spawn;
+if (!common.isWindows) {
+ common.skip('test is windows specific');
+ return;
+}
+if (process.argv[2] === 'child') {
+ process.abort();
+} else {
+ const child = spawn(process.execPath, [__filename, 'child']);
+ child.on('exit', common.mustCall((code, signal) => {
+ assert.strictEqual(code, 3);
+ assert.strictEqual(signal, null);
+ }));
+}
diff --git a/test/parallel/test-zlib-convenience-methods.js b/test/parallel/test-zlib-convenience-methods.js
index 9b9419c7bfaf47..ecb556e83767f9 100644
--- a/test/parallel/test-zlib-convenience-methods.js
+++ b/test/parallel/test-zlib-convenience-methods.js
@@ -23,8 +23,8 @@ const opts = {
zlib[method[0]](expect, opts, function(err, result) {
zlib[method[1]](result, opts, function(err, result) {
assert.strictEqual(result.toString(), expect,
- 'Should get original string after ' +
- method[0] + '/' + method[1] + ' with options.');
+ `Should get original string after ${
+ method[0]}/${method[1]} with options.`);
hadRun++;
});
});
@@ -32,24 +32,24 @@ const opts = {
zlib[method[0]](expect, function(err, result) {
zlib[method[1]](result, function(err, result) {
assert.strictEqual(result.toString(), expect,
- 'Should get original string after ' +
- method[0] + '/' + method[1] + ' without options.');
+ `Should get original string after ${
+ method[0]}/${method[1]} without options.`);
hadRun++;
});
});
- let result = zlib[method[0] + 'Sync'](expect, opts);
- result = zlib[method[1] + 'Sync'](result, opts);
+ let result = zlib[`${method[0]}Sync`](expect, opts);
+ result = zlib[`${method[1]}Sync`](result, opts);
assert.strictEqual(result.toString(), expect,
- 'Should get original string after ' +
- method[0] + '/' + method[1] + ' with options.');
+ `Should get original string after ${
+ method[0]}/${method[1]} with options.`);
hadRun++;
- result = zlib[method[0] + 'Sync'](expect);
- result = zlib[method[1] + 'Sync'](result);
+ result = zlib[`${method[0]}Sync`](expect);
+ result = zlib[`${method[1]}Sync`](result);
assert.strictEqual(result.toString(), expect,
- 'Should get original string after ' +
- method[0] + '/' + method[1] + ' without options.');
+ `Should get original string after ${
+ method[0]}/${method[1]} without options.`);
hadRun++;
});
diff --git a/test/parallel/test-zlib-failed-init.js b/test/parallel/test-zlib-failed-init.js
new file mode 100644
index 00000000000000..afc2c82ddfca8e
--- /dev/null
+++ b/test/parallel/test-zlib-failed-init.js
@@ -0,0 +1,13 @@
+'use strict';
+
+require('../common');
+
+const assert = require('assert');
+const zlib = require('zlib');
+
+// For raw deflate encoding, requests for 256-byte windows are rejected as
+// invalid by zlib.
+// (http://zlib.net/manual.html#Advanced)
+assert.throws(() => {
+ zlib.createDeflateRaw({ windowBits: 8 });
+}, /^Error: Init error$/);
diff --git a/test/parallel/test-zlib-flush-drain.js b/test/parallel/test-zlib-flush-drain.js
index d446f048b06586..756f33f25f6c92 100644
--- a/test/parallel/test-zlib-flush-drain.js
+++ b/test/parallel/test-zlib-flush-drain.js
@@ -37,12 +37,14 @@ deflater.on('drain', function() {
});
process.once('exit', function() {
- assert.strictEqual(beforeFlush, true, 'before calling flush, writable ' +
- 'stream should need to drain');
- assert.strictEqual(afterFlush, false, 'after calling flush, writable ' +
- 'stream should not need to drain');
- assert.strictEqual(drainCount, 1,
- 'the deflater should have emitted a single drain event');
- assert.strictEqual(flushCount, 2,
- 'flush should be called twice');
+ assert.strictEqual(
+ beforeFlush, true,
+ 'before calling flush, writable stream should need to drain');
+ assert.strictEqual(
+ afterFlush, false,
+ 'after calling flush, writable stream should not need to drain');
+ assert.strictEqual(
+ drainCount, 1, 'the deflater should have emitted a single drain event');
+ assert.strictEqual(
+ flushCount, 2, 'flush should be called twice');
});
diff --git a/test/parallel/test-zlib-from-gzip-with-trailing-garbage.js b/test/parallel/test-zlib-from-gzip-with-trailing-garbage.js
index 872c2581c53b90..0cc4953d41c514 100644
--- a/test/parallel/test-zlib-from-gzip-with-trailing-garbage.js
+++ b/test/parallel/test-zlib-from-gzip-with-trailing-garbage.js
@@ -9,7 +9,7 @@ const zlib = require('zlib');
let data = Buffer.concat([
zlib.gzipSync('abc'),
zlib.gzipSync('def'),
- Buffer(10).fill(0)
+ Buffer.alloc(10)
]);
assert.strictEqual(zlib.gunzipSync(data).toString(), 'abcdef');
@@ -28,8 +28,8 @@ zlib.gunzip(data, common.mustCall((err, result) => {
data = Buffer.concat([
zlib.gzipSync('abc'),
zlib.gzipSync('def'),
- Buffer([0x1f, 0x8b, 0xff, 0xff]),
- Buffer(10).fill(0)
+ Buffer.from([0x1f, 0x8b, 0xff, 0xff]),
+ Buffer.alloc(10)
]);
assert.throws(
@@ -49,7 +49,7 @@ zlib.gunzip(data, common.mustCall((err, result) => {
data = Buffer.concat([
zlib.gzipSync('abc'),
zlib.gzipSync('def'),
- Buffer([0x1f, 0x8b, 0xff, 0xff])
+ Buffer.from([0x1f, 0x8b, 0xff, 0xff])
]);
assert.throws(
diff --git a/test/parallel/test-zlib-from-gzip.js b/test/parallel/test-zlib-from-gzip.js
index ac01fc03d11c6f..7bd377eb8698fd 100644
--- a/test/parallel/test-zlib-from-gzip.js
+++ b/test/parallel/test-zlib-from-gzip.js
@@ -25,6 +25,6 @@ out.on('close', function() {
const actual = fs.readFileSync(outputFile);
assert.strictEqual(actual.length, expect.length, 'length should match');
for (let i = 0, l = actual.length; i < l; i++) {
- assert.strictEqual(actual[i], expect[i], 'byte[' + i + ']');
+ assert.strictEqual(actual[i], expect[i], `byte[${i}]`);
}
});
diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js
index 7b0e1fcaae8ce6..6e87ab8b4f8227 100644
--- a/test/parallel/test-zlib-invalid-input.js
+++ b/test/parallel/test-zlib-invalid-input.js
@@ -26,14 +26,14 @@ const unzips = [ zlib.Unzip(),
zlib.InflateRaw() ];
const hadError = [];
unzips.forEach(function(uz, i) {
- console.error('Error for ' + uz.constructor.name);
+ console.error(`Error for ${uz.constructor.name}`);
uz.on('error', function(er) {
console.error('Error event', er);
hadError[i] = true;
});
uz.on('end', function(er) {
- throw new Error('end event should not be emitted ' + uz.constructor.name);
+ throw new Error(`end event should not be emitted ${uz.constructor.name}`);
});
// this will trigger error event
diff --git a/test/parallel/test-zlib-sync-no-event.js b/test/parallel/test-zlib-sync-no-event.js
index ce9b43a902ecb7..33c0018b6f9108 100644
--- a/test/parallel/test-zlib-sync-no-event.js
+++ b/test/parallel/test-zlib-sync-no-event.js
@@ -10,7 +10,7 @@ const message = 'Come on, Fhqwhgads.';
const zipper = new zlib.Gzip();
zipper.on('close', shouldNotBeCalled);
-const buffer = new Buffer(message);
+const buffer = Buffer.from(message);
const zipped = zipper._processChunk(buffer, zlib.Z_FINISH);
const unzipper = new zlib.Gunzip();
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/parallel/test-zlib.js b/test/parallel/test-zlib.js
index fdd5d0a9400f25..d2e290298fec5d 100644
--- a/test/parallel/test-zlib.js
+++ b/test/parallel/test-zlib.js
@@ -163,10 +163,8 @@ Object.keys(tests).forEach(function(file) {
// verify that the same exact buffer comes out the other end.
buf.on('data', function(c) {
- const msg = file + ' ' +
- chunkSize + ' ' +
- JSON.stringify(opts) + ' ' +
- Def.name + ' -> ' + Inf.name;
+ const msg = `${file} ${chunkSize} ${
+ JSON.stringify(opts)} ${Def.name} -> ${Inf.name}`;
let ok = true;
const testNum = ++done;
let i;
@@ -178,17 +176,17 @@ Object.keys(tests).forEach(function(file) {
}
}
if (ok) {
- console.log('ok ' + (testNum) + ' ' + msg);
+ console.log(`ok ${testNum} ${msg}`);
} else {
- console.log('not ok ' + (testNum) + ' ' + msg);
+ console.log(`not ok ${testNum} msg`);
console.log(' ...');
- console.log(' testfile: ' + file);
- console.log(' type: ' + Def.name + ' -> ' + Inf.name);
- console.log(' position: ' + i);
- console.log(' options: ' + JSON.stringify(opts));
- console.log(' expect: ' + test[i]);
- console.log(' actual: ' + c[i]);
- console.log(' chunkSize: ' + chunkSize);
+ console.log(` testfile: ${file}`);
+ console.log(` type: ${Def.name} -> ${Inf.name}`);
+ console.log(` position: ${i}`);
+ console.log(` options: ${JSON.stringify(opts)}`);
+ console.log(` expect: ${test[i]}`);
+ console.log(` actual: ${c[i]}`);
+ console.log(` chunkSize: ${chunkSize}`);
console.log(' ---');
}
});
@@ -206,7 +204,7 @@ Object.keys(tests).forEach(function(file) {
});
process.on('exit', function(code) {
- console.log('1..' + done);
- assert.strictEqual(done, total, (total - done) + ' tests left unfinished');
+ console.log(`1..${done}`);
+ assert.strictEqual(done, total, `${total - done} tests left unfinished`);
assert.strictEqual(failures, 0, 'some test failures');
});
diff --git a/test/pseudo-tty/no_dropped_stdio.js b/test/pseudo-tty/no_dropped_stdio.js
index b24d234a38b2b7..9efb6f2192edae 100644
--- a/test/pseudo-tty/no_dropped_stdio.js
+++ b/test/pseudo-tty/no_dropped_stdio.js
@@ -6,10 +6,10 @@ require('../common');
// 1000 bytes wrapped at 50 columns
// \n turns into a double-byte character
// (48 + {2}) * 20 = 1000
-let out = ('o'.repeat(48) + '\n').repeat(20);
+let out = `${'o'.repeat(48)}\n`.repeat(20);
// Add the remaining 24 bytes and terminate with an 'O'.
// This results in 1025 bytes, just enough to overflow the 1kb OS X TTY buffer.
-out += 'o'.repeat(24) + 'O';
+out += `${'o'.repeat(24)}O`;
process.stdout.write(out);
process.exit(0);
diff --git a/test/pseudo-tty/no_interleaved_stdio.js b/test/pseudo-tty/no_interleaved_stdio.js
index ff3ed8594a0baa..3dc7992d6884f9 100644
--- a/test/pseudo-tty/no_interleaved_stdio.js
+++ b/test/pseudo-tty/no_interleaved_stdio.js
@@ -6,10 +6,10 @@ require('../common');
// 1000 bytes wrapped at 50 columns
// \n turns into a double-byte character
// (48 + {2}) * 20 = 1000
-let out = ('o'.repeat(48) + '\n').repeat(20);
+let out = `${'o'.repeat(48)}\n`.repeat(20);
// Add the remaining 24 bytes and terminate with an 'O'.
// This results in 1025 bytes, just enough to overflow the 1kb OS X TTY buffer.
-out += 'o'.repeat(24) + 'O';
+out += `${'o'.repeat(24)}O`;
const err = '__This is some stderr__';
diff --git a/test/pseudo-tty/test-tty-stdout-end.js b/test/pseudo-tty/test-tty-stdout-end.js
index 86a42c4035b7ae..9319e1bee96493 100644
--- a/test/pseudo-tty/test-tty-stdout-end.js
+++ b/test/pseudo-tty/test-tty-stdout-end.js
@@ -2,11 +2,11 @@
require('../common');
const assert = require('assert');
-const shouldThrow = function() {
+const shouldThrow = () => {
process.stdout.end();
};
-const validateError = function(e) {
+const validateError = (e) => {
return e instanceof Error &&
e.message === 'process.stdout cannot be closed.';
};
diff --git a/test/pummel/test-abort-fatal-error.js b/test/pummel/test-abort-fatal-error.js
index d1a8d3daa65e4c..c82e46f139382e 100644
--- a/test/pummel/test-abort-fatal-error.js
+++ b/test/pummel/test-abort-fatal-error.js
@@ -9,7 +9,7 @@ if (common.isWindows) {
const exec = require('child_process').exec;
-let cmdline = 'ulimit -c 0; ' + process.execPath;
+let cmdline = `ulimit -c 0; ${process.execPath}`;
cmdline += ' --max-old-space-size=4 --max-semi-space-size=1';
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
diff --git a/test/pummel/test-child-process-spawn-loop.js b/test/pummel/test-child-process-spawn-loop.js
index 41d9ff1e49c17b..ccc179a2fb5e49 100644
--- a/test/pummel/test-child-process-spawn-loop.js
+++ b/test/pummel/test-child-process-spawn-loop.js
@@ -9,7 +9,7 @@ const N = 40;
let finished = false;
function doSpawn(i) {
- const child = spawn('python', ['-c', 'print ' + SIZE + ' * "C"']);
+ const child = spawn('python', ['-c', `print ${SIZE} * "C"`]);
let count = 0;
child.stdout.setEncoding('ascii');
@@ -18,7 +18,7 @@ function doSpawn(i) {
});
child.stderr.on('data', (chunk) => {
- console.log('stderr: ' + chunk);
+ console.log(`stderr: ${chunk}`);
});
child.on('close', () => {
diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js
index 6c8423c2c9c83b..ad58aaf7615081 100644
--- a/test/pummel/test-dtrace-jsstack.js
+++ b/test/pummel/test-dtrace-jsstack.js
@@ -13,18 +13,18 @@ if (!common.isSunOS) {
*/
const frames = [ 'stalloogle', 'bagnoogle', 'doogle' ];
-const stalloogle = function(str) {
+const stalloogle = (str) => {
global.expected = str;
os.loadavg();
};
-const bagnoogle = function(arg0, arg1) {
- stalloogle(arg0 + ' is ' + arg1 + ' except that it is read-only');
+const bagnoogle = (arg0, arg1) => {
+ stalloogle(`${arg0} is ${arg1} except that it is read-only`);
};
let done = false;
-const doogle = function() {
+const doogle = () => {
if (!done)
setTimeout(doogle, 10);
@@ -38,13 +38,13 @@ const spawn = require('child_process').spawn;
* when we call getloadavg() -- with the implicit assumption that our
* deepest function is the only caller of os.loadavg().
*/
-const dtrace = spawn('dtrace', [ '-qwn', 'syscall::getloadavg:entry/pid == ' +
- process.pid + '/{ustack(100, 8192); exit(0); }' ]);
+const dtrace = spawn('dtrace', [ '-qwn', `syscall::getloadavg:entry/pid == ${
+ process.pid}/{ustack(100, 8192); exit(0); }` ]);
let output = '';
dtrace.stderr.on('data', function(data) {
- console.log('dtrace: ' + data);
+ console.log(`dtrace: ${data}`);
});
dtrace.stdout.on('data', function(data) {
@@ -53,7 +53,7 @@ dtrace.stdout.on('data', function(data) {
dtrace.on('exit', function(code) {
if (code !== 0) {
- console.error('dtrace exited with code ' + code);
+ console.error(`dtrace exited with code ${code}`);
process.exit(code);
}
@@ -71,12 +71,12 @@ dtrace.on('exit', function(code) {
const frame = line.substr(line.indexOf(sentinel) + sentinel.length);
const top = frames.shift();
- assert.strictEqual(frame.indexOf(top), 0, 'unexpected frame where ' +
- top + ' was expected');
+ assert.strictEqual(frame.indexOf(top), 0,
+ `unexpected frame where ${top} was expected`);
}
assert.strictEqual(frames.length, 0,
- 'did not find expected frame ' + frames[0]);
+ `did not find expected frame ${frames[0]}`);
process.exit(0);
});
diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js
index 131b214fc53f42..ebc32ce2689042 100644
--- a/test/pummel/test-exec.js
+++ b/test/pummel/test-exec.js
@@ -19,13 +19,13 @@ let error_count = 0;
exec(
- '"' + process.execPath + '" -p -e process.versions',
+ `"${process.execPath}" -p -e process.versions`,
function(err, stdout, stderr) {
if (err) {
error_count++;
- console.log('error!: ' + err.code);
- console.log('stdout: ' + JSON.stringify(stdout));
- console.log('stderr: ' + JSON.stringify(stderr));
+ console.log(`error!: ${err.code}`);
+ console.log(`stdout: ${JSON.stringify(stdout)}`);
+ console.log(`stderr: ${JSON.stringify(stderr)}`);
assert.strictEqual(false, err.killed);
} else {
success_count++;
@@ -43,9 +43,9 @@ exec('thisisnotavalidcommand', function(err, stdout, stderr) {
assert.notStrictEqual(err.code, 0);
assert.strictEqual(false, err.killed);
assert.strictEqual(null, err.signal);
- console.log('error code: ' + err.code);
- console.log('stdout: ' + JSON.stringify(stdout));
- console.log('stderr: ' + JSON.stringify(stderr));
+ console.log(`error code: ${err.code}`);
+ console.log(`stdout: ${JSON.stringify(stdout)}`);
+ console.log(`stderr: ${JSON.stringify(stderr)}`);
} else {
success_count++;
console.dir(stdout);
diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js
index 3fda41040486df..bbccd52d843fdd 100644
--- a/test/pummel/test-fs-watch-file.js
+++ b/test/pummel/test-fs-watch-file.js
@@ -123,7 +123,7 @@ assert.doesNotThrow(
function a() {
++watchSeenFour;
assert.strictEqual(1, watchSeenFour);
- fs.unwatchFile('.' + path.sep + filenameFour, a);
+ fs.unwatchFile(`.${path.sep}${filenameFour}`, a);
}
fs.watchFile(filenameFour, a);
}
diff --git a/test/pummel/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js
index 98d21c5cba7bc5..ae29a11fa83d49 100644
--- a/test/pummel/test-http-client-reconnect-bug.js
+++ b/test/pummel/test-http-client-reconnect-bug.js
@@ -16,7 +16,7 @@ server.on('listening', common.mustCall(function() {
const request = client.request('GET', '/', {'host': 'localhost'});
request.end();
request.on('response', function(response) {
- console.log('STATUS: ' + response.statusCode);
+ console.log(`STATUS: ${response.statusCode}`);
});
}));
diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js
index 6113ee54ce904b..d84989238dee3a 100644
--- a/test/pummel/test-https-ci-reneg-attack.js
+++ b/test/pummel/test-https-ci-reneg-attack.js
@@ -32,8 +32,8 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16];
function test(next) {
const options = {
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
};
let seenError = false;
@@ -41,7 +41,7 @@ function test(next) {
const server = https.createServer(options, function(req, res) {
const conn = req.connection;
conn.on('error', function(err) {
- console.error('Caught exception: ' + err);
+ console.error(`Caught exception: ${err}`);
assert(/TLS session renegotiation attack/.test(err));
conn.destroy();
seenError = true;
@@ -50,7 +50,7 @@ function test(next) {
});
server.listen(common.PORT, function() {
- const args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' ');
+ const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' ');
const child = spawn(common.opensslCli, args);
//child.stdout.pipe(process.stdout);
@@ -65,9 +65,9 @@ function test(next) {
child.stderr.on('data', function(data) {
if (seenError) return;
- handshakes += (('' + data).match(/verify return:1/g) || []).length;
+ handshakes += ((String(data)).match(/verify return:1/g) || []).length;
if (handshakes === 2) spam();
- renegs += (('' + data).match(/RENEGOTIATING/g) || []).length;
+ renegs += ((String(data)).match(/RENEGOTIATING/g) || []).length;
});
child.on('exit', function() {
diff --git a/test/pummel/test-https-large-response.js b/test/pummel/test-https-large-response.js
index 39256aa6304b74..f098e86dafa0af 100644
--- a/test/pummel/test-https-large-response.js
+++ b/test/pummel/test-https-large-response.js
@@ -11,8 +11,8 @@ if (!common.hasCrypto) {
const https = require('https');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
process.stdout.write('build body...');
diff --git a/test/pummel/test-net-pause.js b/test/pummel/test-net-pause.js
index 6a701d56869afb..52be6801fa3e92 100644
--- a/test/pummel/test-net-pause.js
+++ b/test/pummel/test-net-pause.js
@@ -30,21 +30,21 @@ server.on('listening', function() {
setTimeout(function() {
chars_recved = recv.length;
- console.log('pause at: ' + chars_recved);
+ console.log(`pause at: ${chars_recved}`);
assert.strictEqual(true, chars_recved > 1);
client.pause();
setTimeout(function() {
- console.log('resume at: ' + chars_recved);
+ console.log(`resume at: ${chars_recved}`);
assert.strictEqual(chars_recved, recv.length);
client.resume();
setTimeout(function() {
chars_recved = recv.length;
- console.log('pause at: ' + chars_recved);
+ console.log(`pause at: ${chars_recved}`);
client.pause();
setTimeout(function() {
- console.log('resume at: ' + chars_recved);
+ console.log(`resume at: ${chars_recved}`);
assert.strictEqual(chars_recved, recv.length);
client.resume();
diff --git a/test/pummel/test-net-pingpong.js b/test/pummel/test-net-pingpong.js
index 5e0950285739a1..35a836b4c8a9ca 100644
--- a/test/pummel/test-net-pingpong.js
+++ b/test/pummel/test-net-pingpong.js
@@ -19,7 +19,7 @@ function pingPongTest(port, host, on_complete) {
} else if (host == null || host === 'localhost') {
assert(address === '127.0.0.1' || address === '::ffff:127.0.0.1');
} else {
- console.log('host = ' + host + ', remoteAddress = ' + address);
+ console.log(`host = ${host}, remoteAddress = ${address}`);
assert.strictEqual(address, '::1');
}
@@ -28,10 +28,10 @@ function pingPongTest(port, host, on_complete) {
socket.timeout = 0;
socket.on('data', function(data) {
- console.log('server got: ' + JSON.stringify(data));
+ 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');
}
});
@@ -59,7 +59,7 @@ function pingPongTest(port, host, on_complete) {
});
client.on('data', function(data) {
- console.log('client got: ' + data);
+ console.log(`client got: ${data}`);
assert.strictEqual('PONG', data);
count += 1;
diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js
index c222d0bb17ccfa..a02cc713984092 100644
--- a/test/pummel/test-net-throttle.js
+++ b/test/pummel/test-net-throttle.js
@@ -11,13 +11,13 @@ let npauses = 0;
console.log('build big string');
const body = 'C'.repeat(N);
-console.log('start server on port ' + common.PORT);
+console.log(`start server on port ${common.PORT}`);
const server = net.createServer(function(connection) {
connection.write(body.slice(0, part_N));
connection.write(body.slice(part_N, 2 * part_N));
assert.strictEqual(false, connection.write(body.slice(2 * part_N, N)));
- console.log('bufferSize: ' + connection.bufferSize, 'expecting', N);
+ console.log(`bufferSize: ${connection.bufferSize}`, 'expecting', N);
assert.ok(0 <= connection.bufferSize &&
connection._writableState.length <= N);
connection.end();
@@ -29,7 +29,7 @@ server.listen(common.PORT, function() {
client.setEncoding('ascii');
client.on('data', function(d) {
chars_recved += d.length;
- console.log('got ' + chars_recved);
+ console.log(`got ${chars_recved}`);
if (!paused) {
client.pause();
npauses += 1;
diff --git a/test/pummel/test-net-timeout.js b/test/pummel/test-net-timeout.js
index faec443a007f20..ea648a5f13b91e 100644
--- a/test/pummel/test-net-timeout.js
+++ b/test/pummel/test-net-timeout.js
@@ -19,8 +19,8 @@ const echo_server = net.createServer(function(socket) {
});
socket.on('error', function(e) {
- throw new Error('Server side socket should not get error. ' +
- 'We disconnect willingly.');
+ throw new Error(
+ 'Server side socket should not get error. We disconnect willingly.');
});
socket.on('data', function(d) {
@@ -34,7 +34,7 @@ const echo_server = net.createServer(function(socket) {
});
echo_server.listen(common.PORT, function() {
- console.log('server listening at ' + common.PORT);
+ console.log(`server listening at ${common.PORT}`);
const client = net.createConnection(common.PORT);
client.setEncoding('UTF8');
@@ -53,7 +53,7 @@ echo_server.listen(common.PORT, function() {
}, 500);
if (exchanges === 5) {
- console.log('wait for timeout - should come in ' + timeout + ' ms');
+ console.log(`wait for timeout - should come in ${timeout} ms`);
starttime = new Date();
console.dir(starttime);
}
@@ -80,7 +80,7 @@ process.on('exit', function() {
assert.ok(timeouttime != null);
const diff = timeouttime - starttime;
- console.log('diff = ' + diff);
+ console.log(`diff = ${diff}`);
assert.ok(timeout < diff);
diff --git a/test/pummel/test-net-timeout2.js b/test/pummel/test-net-timeout2.js
index 113e32523792f2..b049d7b2eb8f4f 100644
--- a/test/pummel/test-net-timeout2.js
+++ b/test/pummel/test-net-timeout2.js
@@ -21,7 +21,7 @@ const server = net.createServer(function(socket) {
}
if (socket.writable) {
- socket.write(Date.now() + '\n');
+ socket.write(`${Date.now()}\n`);
}
}, 1000);
});
diff --git a/test/pummel/test-net-write-callbacks.js b/test/pummel/test-net-write-callbacks.js
index b29ae6ef808292..9bc4bc63c41a4e 100644
--- a/test/pummel/test-net-write-callbacks.js
+++ b/test/pummel/test-net-write-callbacks.js
@@ -23,11 +23,11 @@ function makeCallback(c) {
let called = false;
return function() {
if (called)
- throw new Error('called callback #' + c + ' more than once');
+ throw new Error(`called callback #${c} more than once`);
called = true;
if (c < lastCalled)
- throw new Error('callbacks out of order. last=' + lastCalled +
- ' current=' + c);
+ throw new Error(
+ `callbacks out of order. last=${lastCalled} current=${c}`);
lastCalled = c;
cbcount++;
};
diff --git a/test/pummel/test-regress-GH-814_2.js b/test/pummel/test-regress-GH-814_2.js
index ba7d45124bf9fa..da315e3fc2b007 100644
--- a/test/pummel/test-regress-GH-814_2.js
+++ b/test/pummel/test-regress-GH-814_2.js
@@ -6,7 +6,7 @@ const common = require('../common');
const fs = require('fs');
const testFileName = require('path').join(common.tmpDir, 'GH-814_test.txt');
const testFD = fs.openSync(testFileName, 'w');
-console.error(testFileName + '\n');
+console.error(`${testFileName}\n`);
const tailProc = require('child_process').spawn('tail', ['-f', testFileName]);
diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js
index 3ec44dfa12bb5b..9258d9032bdc9d 100644
--- a/test/pummel/test-regress-GH-892.js
+++ b/test/pummel/test-regress-GH-892.js
@@ -60,8 +60,8 @@ function makeRequest() {
const serverOptions = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
let uploadCount = 0;
diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js
index 600b7ce35b0913..481441ae37816f 100644
--- a/test/pummel/test-timers.js
+++ b/test/pummel/test-timers.js
@@ -17,7 +17,7 @@ setTimeout(common.mustCall(function() {
const diff = endtime - starttime;
assert.ok(diff > 0);
- console.error('diff: ' + diff);
+ console.error(`diff: ${diff}`);
assert.strictEqual(true, 1000 - WINDOW < diff && diff < 1000 + WINDOW);
}), 1000);
@@ -32,7 +32,7 @@ setInterval(function() {
const diff = endtime - starttime;
assert.ok(diff > 0);
- console.error('diff: ' + diff);
+ console.error(`diff: ${diff}`);
const t = interval_count * 1000;
diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js
index 9c2d3da5c3f6b1..5d2815aa96fad5 100644
--- a/test/pummel/test-tls-ci-reneg-attack.js
+++ b/test/pummel/test-tls-ci-reneg-attack.js
@@ -31,15 +31,15 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16];
function test(next) {
const options = {
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
};
let seenError = false;
const server = tls.createServer(options, function(conn) {
conn.on('error', function(err) {
- console.error('Caught exception: ' + err);
+ console.error(`Caught exception: ${err}`);
assert(/TLS session renegotiation attack/.test(err));
conn.destroy();
seenError = true;
@@ -48,7 +48,7 @@ function test(next) {
});
server.listen(common.PORT, function() {
- const args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' ');
+ const args = (`s_client -connect 127.0.0.1:${common.PORT}`).split(' ');
const child = spawn(common.opensslCli, args);
//child.stdout.pipe(process.stdout);
@@ -63,9 +63,9 @@ function test(next) {
child.stderr.on('data', function(data) {
if (seenError) return;
- handshakes += (('' + data).match(/verify return:1/g) || []).length;
+ handshakes += ((String(data)).match(/verify return:1/g) || []).length;
if (handshakes === 2) spam();
- renegs += (('' + data).match(/RENEGOTIATING/g) || []).length;
+ renegs += ((String(data)).match(/RENEGOTIATING/g) || []).length;
});
child.on('exit', function() {
diff --git a/test/pummel/test-tls-connect-memleak.js b/test/pummel/test-tls-connect-memleak.js
index b1d1f05190c39d..c1637776116573 100644
--- a/test/pummel/test-tls-connect-memleak.js
+++ b/test/pummel/test-tls-connect-memleak.js
@@ -19,8 +19,8 @@ assert.strictEqual(
);
tls.createServer({
- cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
- key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
+ cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
+ key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
}).listen(common.PORT);
{
diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js
index cd9299cb790958..0b2e45302b5cc2 100644
--- a/test/pummel/test-tls-securepair-client.js
+++ b/test/pummel/test-tls-securepair-client.js
@@ -145,15 +145,15 @@ function test(keyfn, certfn, check, next) {
});
pair.encrypted.on('error', function(err) {
- console.log('encrypted error: ' + err);
+ console.log(`encrypted error: ${err}`);
});
s.on('error', function(err) {
- console.log('socket error: ' + err);
+ console.log(`socket error: ${err}`);
});
pair.on('error', function(err) {
- console.log('secure error: ' + err);
+ console.log(`secure error: ${err}`);
});
}
diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js
index 0569dd47cfd4da..4d1065a790df8b 100644
--- a/test/pummel/test-tls-server-large-request.js
+++ b/test/pummel/test-tls-server-large-request.js
@@ -15,8 +15,8 @@ const util = require('util');
const request = Buffer.from(new Array(1024 * 256).join('ABCD')); // 1mb
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
function Mediator() {
diff --git a/test/pummel/test-tls-session-timeout.js b/test/pummel/test-tls-session-timeout.js
index c194188b3682a9..c202586a107ab7 100644
--- a/test/pummel/test-tls-session-timeout.js
+++ b/test/pummel/test-tls-session-timeout.js
@@ -57,10 +57,10 @@ function doTest() {
// Expects a callback -- cb(connectionType : enum ['New'|'Reused'])
- const Client = function(cb) {
+ function Client(cb) {
const flags = [
's_client',
- '-connect', 'localhost:' + common.PORT,
+ '-connect', `localhost:${common.PORT}`,
'-sess_in', sessionFileName,
'-sess_out', sessionFileName
];
@@ -74,7 +74,7 @@ function doTest() {
});
client.on('exit', function(code) {
let connectionType;
- const grepConnectionType = function(line) {
+ const grepConnectionType = (line) => {
const matches = line.match(/(New|Reused), /);
if (matches) {
connectionType = matches[1];
@@ -87,7 +87,7 @@ function doTest() {
}
cb(connectionType);
});
- };
+ }
const server = tls.createServer(options, function(cleartext) {
cleartext.on('error', function(er) {
diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js
index 1df8e5c157046f..a4784f8eab0426 100644
--- a/test/pummel/test-tls-throttle.js
+++ b/test/pummel/test-tls-throttle.js
@@ -17,8 +17,8 @@ const body = 'hello world\n'.repeat(1024 * 1024);
process.stdout.write('done\n');
const options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
};
const server = tls.Server(options, common.mustCall(function(socket) {
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);
diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js
index 20a35b98b36c6f..61e3bf60f75b13 100644
--- a/test/sequential/test-child-process-execsync.js
+++ b/test/sequential/test-child-process-execsync.js
@@ -45,7 +45,7 @@ assert.throws(function() {
}, /Command failed: iamabadcommand/);
const msg = 'foobar';
-const msgBuf = Buffer.from(msg + '\n');
+const msgBuf = Buffer.from(`${msg}\n`);
// console.log ends every line with just '\n', even on Windows.
@@ -58,7 +58,7 @@ assert.deepStrictEqual(ret, msgBuf, 'execSync result buffer should match');
ret = execSync(cmd, { encoding: 'utf8' });
-assert.strictEqual(ret, msg + '\n', 'execSync encoding result should match');
+assert.strictEqual(ret, `${msg}\n`, 'execSync encoding result should match');
const args = [
'-e',
@@ -70,7 +70,7 @@ assert.deepStrictEqual(ret, msgBuf);
ret = execFileSync(process.execPath, args, { encoding: 'utf8' });
-assert.strictEqual(ret, msg + '\n',
+assert.strictEqual(ret, `${msg}\n`,
'execFileSync encoding result should match');
// Verify that the cwd option works - GH #7824
diff --git a/test/parallel/test-debug-brk-no-arg.js b/test/sequential/test-debug-brk-no-arg.js
similarity index 100%
rename from test/parallel/test-debug-brk-no-arg.js
rename to test/sequential/test-debug-brk-no-arg.js
diff --git a/test/parallel/test-debug-brk.js b/test/sequential/test-debug-brk.js
similarity index 100%
rename from test/parallel/test-debug-brk.js
rename to test/sequential/test-debug-brk.js
diff --git a/test/parallel/test-debug-no-context.js b/test/sequential/test-debug-no-context.js
similarity index 100%
rename from test/parallel/test-debug-no-context.js
rename to test/sequential/test-debug-no-context.js
diff --git a/test/parallel/test-debug-port-cluster.js b/test/sequential/test-debug-port-cluster.js
similarity index 100%
rename from test/parallel/test-debug-port-cluster.js
rename to test/sequential/test-debug-port-cluster.js
diff --git a/test/parallel/test-debug-port-from-cmdline.js b/test/sequential/test-debug-port-from-cmdline.js
similarity index 100%
rename from test/parallel/test-debug-port-from-cmdline.js
rename to test/sequential/test-debug-port-from-cmdline.js
diff --git a/test/parallel/test-debug-port-numbers.js b/test/sequential/test-debug-port-numbers.js
similarity index 100%
rename from test/parallel/test-debug-port-numbers.js
rename to test/sequential/test-debug-port-numbers.js
diff --git a/test/parallel/test-debug-signal-cluster.js b/test/sequential/test-debug-signal-cluster.js
similarity index 100%
rename from test/parallel/test-debug-signal-cluster.js
rename to test/sequential/test-debug-signal-cluster.js
diff --git a/test/parallel/test-debugger-util-regression.js b/test/sequential/test-debugger-util-regression.js
similarity index 100%
rename from test/parallel/test-debugger-util-regression.js
rename to test/sequential/test-debugger-util-regression.js
diff --git a/test/sequential/test-deprecation-flags.js b/test/sequential/test-deprecation-flags.js
index 3bd2e99033beb1..39acb0b09a1b5b 100644
--- a/test/sequential/test-deprecation-flags.js
+++ b/test/sequential/test-deprecation-flags.js
@@ -2,17 +2,17 @@
const common = require('../common');
const assert = require('assert');
const execFile = require('child_process').execFile;
-const depmod = require.resolve(common.fixturesDir + '/deprecated.js');
+const depmod = require.resolve(`${common.fixturesDir}/deprecated.js`);
const node = process.execPath;
const depUserlandFunction =
- require.resolve(common.fixturesDir + '/deprecated-userland-function.js');
+ require.resolve(`${common.fixturesDir}/deprecated-userland-function.js`);
const depUserlandClass =
- require.resolve(common.fixturesDir + '/deprecated-userland-class.js');
+ require.resolve(`${common.fixturesDir}/deprecated-userland-class.js`);
const depUserlandSubClass =
- require.resolve(common.fixturesDir + '/deprecated-userland-subclass.js');
+ require.resolve(`${common.fixturesDir}/deprecated-userland-subclass.js`);
const normal = [depmod];
const noDep = ['--no-deprecation', depmod];
diff --git a/test/parallel/test-dgram-bind-shared-ports.js b/test/sequential/test-dgram-bind-shared-ports.js
similarity index 93%
rename from test/parallel/test-dgram-bind-shared-ports.js
rename to test/sequential/test-dgram-bind-shared-ports.js
index 474c352c55b5a0..df294ef03e0e57 100644
--- a/test/parallel/test-dgram-bind-shared-ports.js
+++ b/test/sequential/test-dgram-bind-shared-ports.js
@@ -35,12 +35,12 @@ if (cluster.isMaster) {
socket1.on('error', (err) => {
// no errors expected
- process.send('socket1:' + err.code);
+ process.send(`socket1:${err.code}`);
});
socket2.on('error', (err) => {
// an error is expected on the second worker
- process.send('socket2:' + err.code);
+ process.send(`socket2:${err.code}`);
});
socket1.bind({
diff --git a/test/sequential/test-dgram-pingpong.js b/test/sequential/test-dgram-pingpong.js
index 5760024c0c5c70..c97b7872dedf2c 100644
--- a/test/sequential/test-dgram-pingpong.js
+++ b/test/sequential/test-dgram-pingpong.js
@@ -15,7 +15,7 @@ function pingPongTest(port, host) {
});
server.on('listening', function() {
- console.log('server listening on ' + port);
+ console.log(`server listening on ${port}`);
const client = dgram.createSocket('udp4');
@@ -30,7 +30,7 @@ function pingPongTest(port, host) {
throw e;
});
- console.log('Client sending to ' + port);
+ console.log(`Client sending to ${port}`);
function clientSend() {
client.send('PING', 0, 4, port, 'localhost');
diff --git a/test/sequential/test-domain-abort-on-uncaught.js b/test/sequential/test-domain-abort-on-uncaught.js
index b3fd99616ef98e..dfac371afcddff 100644
--- a/test/sequential/test-domain-abort-on-uncaught.js
+++ b/test/sequential/test-domain-abort-on-uncaught.js
@@ -239,15 +239,16 @@ if (process.argv[2] === 'child') {
testCmd += 'ulimit -c 0 && ';
}
- testCmd += `${process.argv[0]} --abort-on-uncaught-exception ` +
- `${process.argv[1]} child ${testIndex}`;
+ testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception ` +
+ `"${process.argv[1]}" child ${testIndex}`;
const child = child_process.exec(testCmd);
child.on('exit', function onExit(code, signal) {
- assert.strictEqual(code, 0, 'Test at index ' + testIndex +
- ' should have exited with exit code 0 but instead exited with code ' +
- code + ' and signal ' + signal);
+ assert.strictEqual(
+ code, 0, `Test at index ${testIndex
+ } should have exited with exit code 0 but instead exited with code ${
+ code} and signal ${signal}`);
});
});
}
diff --git a/test/sequential/test-https-set-timeout-server.js b/test/sequential/test-https-set-timeout-server.js
index 9087588b55d803..6c7afa5df9b304 100644
--- a/test/sequential/test-https-set-timeout-server.js
+++ b/test/sequential/test-https-set-timeout-server.js
@@ -14,8 +14,8 @@ const fs = require('fs');
const tests = [];
const serverOptions = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+ key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
+ cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
};
function test(fn) {
diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js
index 5a4332b471c5ee..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.
@@ -73,7 +75,7 @@ assert.throws(
function() {
require('../fixtures/packages/invalid');
},
- /^SyntaxError: Error parsing \S+: Unexpected token , in JSON at position 1$/
+ /^SyntaxError: Error parsing .+: Unexpected token , in JSON at position 1$/
);
assert.strictEqual(require('../fixtures/packages/main').ok, 'ok',
@@ -152,24 +154,24 @@ const msg = 'Load order incorrect.';
require.extensions['.reg'] = require.extensions['.js'];
require.extensions['.reg2'] = require.extensions['.js'];
-assert.strictEqual(require(loadOrder + 'file1').file1, 'file1', msg);
-assert.strictEqual(require(loadOrder + 'file2').file2, 'file2.js', msg);
+assert.strictEqual(require(`${loadOrder}file1`).file1, 'file1', msg);
+assert.strictEqual(require(`${loadOrder}file2`).file2, 'file2.js', msg);
try {
- require(loadOrder + 'file3');
+ 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);
-assert.strictEqual(require(loadOrder + 'file6').file6, 'file6/index.js', msg);
+assert.strictEqual(require(`${loadOrder}file4`).file4, 'file4.reg', msg);
+assert.strictEqual(require(`${loadOrder}file5`).file5, 'file5.reg2', msg);
+assert.strictEqual(require(`${loadOrder}file6`).file6, 'file6/index.js', msg);
try {
- require(loadOrder + 'file7');
+ 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);
+assert.strictEqual(require(`${loadOrder}file8`).file8, 'file8/index.reg', msg);
+assert.strictEqual(require(`${loadOrder}file9`).file9, 'file9/index.reg2', msg);
// make sure that module.require() is the same as
@@ -194,13 +196,13 @@ 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;
}, {});
assert.deepStrictEqual(children, {
- 'common.js': {},
+ 'common/index.js': {},
'fixtures/not-main-module.js': {},
'fixtures/a.js': {
'fixtures/b/c.js': {
diff --git a/test/sequential/test-net-GH-5504.js b/test/sequential/test-net-GH-5504.js
index a7f64c2e73da10..bd0943f9e01566 100644
--- a/test/sequential/test-net-GH-5504.js
+++ b/test/sequential/test-net-GH-5504.js
@@ -71,7 +71,7 @@ function parent() {
inp.on('data', function(c) {
c = c.trim();
if (!c) return;
- out.write(w + c.split('\n').join('\n' + w) + '\n');
+ out.write(`${w}${c.split('\n').join(`\n${w}`)}\n`);
});
}
}
diff --git a/test/parallel/test-net-better-error-messages-port.js b/test/sequential/test-net-better-error-messages-port.js
similarity index 100%
rename from test/parallel/test-net-better-error-messages-port.js
rename to test/sequential/test-net-better-error-messages-port.js
diff --git a/test/sequential/test-net-connect-local-error.js b/test/sequential/test-net-connect-local-error.js
new file mode 100644
index 00000000000000..205ff872cd8090
--- /dev/null
+++ b/test/sequential/test-net-connect-local-error.js
@@ -0,0 +1,25 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const net = require('net');
+
+// EADDRINUSE is expected to occur on FreeBSD
+// Ref: https://github.com/nodejs/node/issues/13055
+const expectedErrorCodes = ['ECONNREFUSED', 'EADDRINUSE'];
+const client = net.connect({
+ port: common.PORT,
+ localPort: common.PORT + 1,
+ localAddress: common.localhostIPv4
+});
+
+client.on('error', common.mustCall(function onError(err) {
+ assert.ok(expectedErrorCodes.includes(err.code));
+ assert.strictEqual(err.syscall, 'connect');
+ assert.strictEqual(err.localPort, common.PORT + 1);
+ assert.strictEqual(err.localAddress, common.localhostIPv4);
+ assert.strictEqual(
+ err.message,
+ `connect ${err.code} ${err.address}:${err.port} ` +
+ `- Local (${err.localAddress}:${err.localPort})`
+ );
+}));
diff --git a/test/sequential/test-net-listen-shared-ports.js b/test/sequential/test-net-listen-shared-ports.js
new file mode 100644
index 00000000000000..001822a475a0da
--- /dev/null
+++ b/test/sequential/test-net-listen-shared-ports.js
@@ -0,0 +1,46 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const cluster = require('cluster');
+const net = require('net');
+
+if (cluster.isMaster) {
+ const worker1 = cluster.fork();
+
+ worker1.on('message', common.mustCall(function(msg) {
+ assert.strictEqual(msg, 'success');
+ const worker2 = cluster.fork();
+
+ worker2.on('message', common.mustCall(function(msg) {
+ assert.strictEqual(msg, 'server2:EADDRINUSE');
+ worker1.kill();
+ worker2.kill();
+ }));
+ }));
+} else {
+ const server1 = net.createServer(common.mustNotCall());
+ const server2 = net.createServer(common.mustNotCall());
+
+ server1.on('error', function(err) {
+ // no errors expected
+ process.send(`server1:${err.code}`);
+ });
+
+ server2.on('error', function(err) {
+ // an error is expected on the second worker
+ process.send(`server2:${err.code}`);
+ });
+
+ server1.listen({
+ host: 'localhost',
+ port: common.PORT,
+ exclusive: false
+ }, common.mustCall(function() {
+ server2.listen({port: common.PORT + 1, exclusive: true},
+ common.mustCall(function() {
+ // the first worker should succeed
+ process.send('success');
+ })
+ );
+ }));
+}
diff --git a/test/parallel/test-net-reconnect-error.js b/test/sequential/test-net-reconnect-error.js
similarity index 75%
rename from test/parallel/test-net-reconnect-error.js
rename to test/sequential/test-net-reconnect-error.js
index 4e1e3d14984e80..2f5b884df41d05 100644
--- a/test/parallel/test-net-reconnect-error.js
+++ b/test/sequential/test-net-reconnect-error.js
@@ -6,7 +6,6 @@ const N = 20;
let client_error_count = 0;
let disconnect_count = 0;
-// Hopefully nothing is running on common.PORT
const c = net.createConnection(common.PORT);
c.on('connect', function() {
@@ -14,17 +13,15 @@ c.on('connect', function() {
assert.ok(false);
});
-c.on('error', function(e) {
- console.error('CLIENT error: ' + e.code);
+c.on('error', common.mustCall((e) => {
client_error_count++;
assert.strictEqual('ECONNREFUSED', e.code);
-});
+}, N + 1));
-c.on('close', function() {
- console.log('CLIENT disconnect');
+c.on('close', common.mustCall(() => {
if (disconnect_count++ < N)
c.connect(common.PORT); // reconnect
-});
+}, N + 1));
process.on('exit', function() {
assert.strictEqual(N + 1, disconnect_count);
diff --git a/test/sequential/test-process-warnings.js b/test/sequential/test-process-warnings.js
index d4894f8bffeb36..558601c539972b 100644
--- a/test/sequential/test-process-warnings.js
+++ b/test/sequential/test-process-warnings.js
@@ -3,31 +3,33 @@
const common = require('../common');
const assert = require('assert');
const execFile = require('child_process').execFile;
-const warnmod = require.resolve(common.fixturesDir + '/warnings.js');
+const warnmod = require.resolve(`${common.fixturesDir}/warnings.js`);
const node = process.execPath;
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-1697.js b/test/sequential/test-regress-GH-1697.js
index d99acf9e468bb3..273aea7cb3c3ab 100644
--- a/test/sequential/test-regress-GH-1697.js
+++ b/test/sequential/test-regress-GH-1697.js
@@ -8,7 +8,7 @@ if (process.argv[2] === 'server') {
const server = net.createServer(function(conn) {
conn.on('data', function(data) {
- console.log('server received ' + data.length + ' bytes');
+ console.log(`server received ${data.length} bytes`);
});
conn.on('close', function() {
diff --git a/test/sequential/test-regress-GH-4015.js b/test/sequential/test-regress-GH-4015.js
index 249817de1d2068..744afd7774aadb 100644
--- a/test/sequential/test-regress-GH-4015.js
+++ b/test/sequential/test-regress-GH-4015.js
@@ -3,8 +3,8 @@ const common = require('../common');
const assert = require('assert');
const exec = require('child_process').exec;
-const cmd = '"' + process.execPath + '" ' +
- '"' + common.fixturesDir + '/test-regress-GH-4015.js"';
+const cmd =
+ `"${process.execPath}" "${common.fixturesDir}/test-regress-GH-4015.js"`;
exec(cmd, function(err, stdout, stderr) {
assert(/RangeError: Maximum call stack size exceeded/.test(stderr));
diff --git a/test/sequential/test-regress-GH-784.js b/test/sequential/test-regress-GH-784.js
index 0bfa407ec10dc3..f567b9bc5272bf 100644
--- a/test/sequential/test-regress-GH-784.js
+++ b/test/sequential/test-regress-GH-784.js
@@ -48,29 +48,31 @@ const responses = [];
function afterPing(result) {
responses.push(result);
- console.error('afterPing. responses.length = ' + responses.length);
+ 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;
@@ -109,7 +111,7 @@ function ping() {
let hadError = false;
req.on('error', function(error) {
- console.log('Error making ping req: ' + error);
+ console.log(`Error making ping req: ${error}`);
hadError = true;
assert.ok(!gotEnd);
afterPing(error.message);
diff --git a/test/sequential/test-regress-GH-877.js b/test/sequential/test-regress-GH-877.js
index 1a0d7a48e5758c..7cba74cb53ec9a 100644
--- a/test/sequential/test-regress-GH-877.js
+++ b/test/sequential/test-regress-GH-877.js
@@ -33,9 +33,10 @@ server.listen(common.PORT, '127.0.0.1', function() {
assert.strictEqual(req.agent, agent);
- console.log('Socket: ' + agent.sockets[addrString].length + '/' +
- agent.maxSockets + ' queued: ' + (agent.requests[addrString] ?
- agent.requests[addrString].length : 0));
+ console.log(
+ `Socket: ${agent.sockets[addrString].length}/${
+ agent.maxSockets} queued: ${
+ agent.requests[addrString] ? agent.requests[addrString].length : 0}`);
const agentRequests = agent.requests[addrString] ?
agent.requests[addrString].length : 0;
diff --git a/test/sequential/test-repl-timeout-throw.js b/test/sequential/test-repl-timeout-throw.js
index fbe593230cf1ba..d9cf0b6b50c9f0 100644
--- a/test/sequential/test-repl-timeout-throw.js
+++ b/test/sequential/test-repl-timeout-throw.js
@@ -31,7 +31,7 @@ child.stdout.once('data', function() {
setTimeout(fsTest, 50);
function fsTest() {
const f = JSON.stringify(__filename);
- child.stdin.write('fs.readFile(' + f + ', thrower);\n');
+ child.stdin.write(`fs.readFile(${f}, thrower);\n`);
setTimeout(eeTest, 50);
}
diff --git a/test/sequential/test-require-cache-without-stat.js b/test/sequential/test-require-cache-without-stat.js
index d90bbd2b7bb71f..c22fb2afdf003c 100644
--- a/test/sequential/test-require-cache-without-stat.js
+++ b/test/sequential/test-require-cache-without-stat.js
@@ -25,7 +25,7 @@ fs.stat = function() {
};
// Load the module 'a' and 'http' once. It should become cached.
-require(common.fixturesDir + '/a');
+require(`${common.fixturesDir}/a`);
require('../fixtures/a.js');
require('./../fixtures/a.js');
require('http');
@@ -36,7 +36,7 @@ const counterBefore = counter;
// Now load the module a bunch of times with equivalent paths.
// stat should not be called.
for (let i = 0; i < 100; i++) {
- require(common.fixturesDir + '/a');
+ require(`${common.fixturesDir}/a`);
require('../fixtures/a.js');
require('./../fixtures/a.js');
}
diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js
index 9f453f656f7cb9..cfe77f1b4275e2 100644
--- a/test/sequential/test-stream2-stderr-sync.js
+++ b/test/sequential/test-stream2-stderr-sync.js
@@ -8,7 +8,7 @@ function parent() {
const assert = require('assert');
let i = 0;
children.forEach(function(_, c) {
- const child = spawn(process.execPath, [__filename, '' + c]);
+ const child = spawn(process.execPath, [__filename, String(c)]);
let err = '';
child.stderr.on('data', function(c) {
@@ -16,10 +16,10 @@ function parent() {
});
child.on('close', function() {
- assert.strictEqual(err, 'child ' + c + '\nfoo\nbar\nbaz\n');
+ assert.strictEqual(err, `child ${c}\nfoo\nbar\nbaz\n`);
console.log('ok %d child #%d', ++i, c);
if (i === children.length)
- console.log('1..' + i);
+ console.log(`1..${i}`);
});
});
}
diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py
index 367346f6e1509d..4e6fb4e660d9d0 100644
--- a/test/testpy/__init__.py
+++ b/test/testpy/__init__.py
@@ -43,7 +43,6 @@ def __init__(self, path, file, arch, mode, context, config, additional=None):
self.config = config
self.arch = arch
self.mode = mode
- self.tmpdir = join(dirname(self.config.root), 'tmp')
if additional is not None:
self.additional_flags = additional
else:
@@ -61,7 +60,7 @@ def GetCommand(self):
source = open(self.file).read()
flags_match = FLAGS_PATTERN.search(source)
if flags_match:
- # PORT should match the definition in test/common.js.
+ # PORT should match the definition in test/common/index.js.
env = { 'PORT': int(os.getenv('NODE_COMMON_PORT', '12346')) }
env['PORT'] += self.thread_id * 100
result += flags_match.group(1).strip().format(**env).split()
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}]
diff --git a/tools/certdata.txt b/tools/certdata.txt
index 8effa748d2eb05..020db76b18139b 100644
--- a/tools/certdata.txt
+++ b/tools/certdata.txt
@@ -69,129 +69,6 @@ CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "Mozilla Builtin Roots"
-#
-# Certificate "Equifax Secure CA"
-#
-# Issuer: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
-# Serial Number: 903804111 (0x35def4cf)
-# Subject: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
-# Not Valid Before: Sat Aug 22 16:41:51 1998
-# Not Valid After : Wed Aug 22 16:41:51 2018
-# Fingerprint (MD5): 67:CB:9D:C0:13:24:8A:82:9B:B2:17:1E:D1:1B:EC:D4
-# Fingerprint (SHA1): D2:32:09:AD:23:D3:14:23:21:74:E4:0D:7F:9D:62:13:97:86:63:3A
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Equifax Secure CA"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\020\060\016\006\003\125\004\012\023\007\105\161\165\151\146\141
-\170\061\055\060\053\006\003\125\004\013\023\044\105\161\165\151
-\146\141\170\040\123\145\143\165\162\145\040\103\145\162\164\151
-\146\151\143\141\164\145\040\101\165\164\150\157\162\151\164\171
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\020\060\016\006\003\125\004\012\023\007\105\161\165\151\146\141
-\170\061\055\060\053\006\003\125\004\013\023\044\105\161\165\151
-\146\141\170\040\123\145\143\165\162\145\040\103\145\162\164\151
-\146\151\143\141\164\145\040\101\165\164\150\157\162\151\164\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\004\065\336\364\317
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\003\040\060\202\002\211\240\003\002\001\002\002\004\065
-\336\364\317\060\015\006\011\052\206\110\206\367\015\001\001\005
-\005\000\060\116\061\013\060\011\006\003\125\004\006\023\002\125
-\123\061\020\060\016\006\003\125\004\012\023\007\105\161\165\151
-\146\141\170\061\055\060\053\006\003\125\004\013\023\044\105\161
-\165\151\146\141\170\040\123\145\143\165\162\145\040\103\145\162
-\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151
-\164\171\060\036\027\015\071\070\060\070\062\062\061\066\064\061
-\065\061\132\027\015\061\070\060\070\062\062\061\066\064\061\065
-\061\132\060\116\061\013\060\011\006\003\125\004\006\023\002\125
-\123\061\020\060\016\006\003\125\004\012\023\007\105\161\165\151
-\146\141\170\061\055\060\053\006\003\125\004\013\023\044\105\161
-\165\151\146\141\170\040\123\145\143\165\162\145\040\103\145\162
-\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162\151
-\164\171\060\201\237\060\015\006\011\052\206\110\206\367\015\001
-\001\001\005\000\003\201\215\000\060\201\211\002\201\201\000\301
-\135\261\130\147\010\142\356\240\232\055\037\010\155\221\024\150
-\230\012\036\376\332\004\157\023\204\142\041\303\321\174\316\237
-\005\340\270\001\360\116\064\354\342\212\225\004\144\254\361\153
-\123\137\005\263\313\147\200\277\102\002\216\376\335\001\011\354
-\341\000\024\117\374\373\360\014\335\103\272\133\053\341\037\200
-\160\231\025\127\223\026\361\017\227\152\267\302\150\043\034\314
-\115\131\060\254\121\036\073\257\053\326\356\143\105\173\305\331
-\137\120\322\343\120\017\072\210\347\277\024\375\340\307\271\002
-\003\001\000\001\243\202\001\011\060\202\001\005\060\160\006\003
-\125\035\037\004\151\060\147\060\145\240\143\240\141\244\137\060
-\135\061\013\060\011\006\003\125\004\006\023\002\125\123\061\020
-\060\016\006\003\125\004\012\023\007\105\161\165\151\146\141\170
-\061\055\060\053\006\003\125\004\013\023\044\105\161\165\151\146
-\141\170\040\123\145\143\165\162\145\040\103\145\162\164\151\146
-\151\143\141\164\145\040\101\165\164\150\157\162\151\164\171\061
-\015\060\013\006\003\125\004\003\023\004\103\122\114\061\060\032
-\006\003\125\035\020\004\023\060\021\201\017\062\060\061\070\060
-\070\062\062\061\066\064\061\065\061\132\060\013\006\003\125\035
-\017\004\004\003\002\001\006\060\037\006\003\125\035\043\004\030
-\060\026\200\024\110\346\150\371\053\322\262\225\327\107\330\043
-\040\020\117\063\230\220\237\324\060\035\006\003\125\035\016\004
-\026\004\024\110\346\150\371\053\322\262\225\327\107\330\043\040
-\020\117\063\230\220\237\324\060\014\006\003\125\035\023\004\005
-\060\003\001\001\377\060\032\006\011\052\206\110\206\366\175\007
-\101\000\004\015\060\013\033\005\126\063\056\060\143\003\002\006
-\300\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000
-\003\201\201\000\130\316\051\352\374\367\336\265\316\002\271\027
-\265\205\321\271\343\340\225\314\045\061\015\000\246\222\156\177
-\266\222\143\236\120\225\321\232\157\344\021\336\143\205\156\230
-\356\250\377\132\310\323\125\262\146\161\127\336\300\041\353\075
-\052\247\043\111\001\004\206\102\173\374\356\177\242\026\122\265
-\147\147\323\100\333\073\046\130\262\050\167\075\256\024\167\141
-\326\372\052\146\047\240\015\372\247\163\134\352\160\361\224\041
-\145\104\137\372\374\357\051\150\251\242\207\171\357\171\357\117
-\254\007\167\070
-END
-
-# Trust for Certificate "Equifax Secure CA"
-# Issuer: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
-# Serial Number: 903804111 (0x35def4cf)
-# Subject: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
-# Not Valid Before: Sat Aug 22 16:41:51 1998
-# Not Valid After : Wed Aug 22 16:41:51 2018
-# Fingerprint (MD5): 67:CB:9D:C0:13:24:8A:82:9B:B2:17:1E:D1:1B:EC:D4
-# Fingerprint (SHA1): D2:32:09:AD:23:D3:14:23:21:74:E4:0D:7F:9D:62:13:97:86:63:3A
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Equifax Secure CA"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\322\062\011\255\043\323\024\043\041\164\344\015\177\235\142\023
-\227\206\143\072
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\147\313\235\300\023\044\212\202\233\262\027\036\321\033\354\324
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\020\060\016\006\003\125\004\012\023\007\105\161\165\151\146\141
-\170\061\055\060\053\006\003\125\004\013\023\044\105\161\165\151
-\146\141\170\040\123\145\143\165\162\145\040\103\145\162\164\151
-\146\151\143\141\164\145\040\101\165\164\150\157\162\151\164\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\004\065\336\364\317
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
# Distrust "Distrust a pb.com certificate that does not comply with the baseline requirements."
# Issuer: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
# Serial Number: 1407252 (0x157914)
@@ -220,269 +97,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "Verisign Class 3 Public Primary Certification Authority"
-#
-# Issuer: OU=Class 3 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Serial Number:70:ba:e4:1d:10:d9:29:34:b6:38:ca:7b:03:cc:ba:bf
-# Subject: OU=Class 3 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Not Valid Before: Mon Jan 29 00:00:00 1996
-# Not Valid After : Tue Aug 01 23:59:59 2028
-# Fingerprint (MD5): 10:FC:63:5D:F6:26:3E:0D:F3:25:BE:5F:79:CD:67:67
-# Fingerprint (SHA1): 74:2C:31:92:E6:07:E4:24:EB:45:49:54:2B:E1:BB:C5:3E:61:74:E2
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Verisign Class 3 Public Primary Certification Authority"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151
-\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004
-\013\023\056\103\154\141\163\163\040\063\040\120\165\142\154\151
-\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146
-\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
-\171
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151
-\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004
-\013\023\056\103\154\141\163\163\040\063\040\120\165\142\154\151
-\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146
-\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
-\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\160\272\344\035\020\331\051\064\266\070\312\173\003\314
-\272\277
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\002\074\060\202\001\245\002\020\160\272\344\035\020\331
-\051\064\266\070\312\173\003\314\272\277\060\015\006\011\052\206
-\110\206\367\015\001\001\002\005\000\060\137\061\013\060\011\006
-\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125\004
-\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156\143
-\056\061\067\060\065\006\003\125\004\013\023\056\103\154\141\163
-\163\040\063\040\120\165\142\154\151\143\040\120\162\151\155\141
-\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\060\036\027\015\071\066
-\060\061\062\071\060\060\060\060\060\060\132\027\015\062\070\060
-\070\060\061\062\063\065\071\065\071\132\060\137\061\013\060\011
-\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125
-\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156
-\143\056\061\067\060\065\006\003\125\004\013\023\056\103\154\141
-\163\163\040\063\040\120\165\142\154\151\143\040\120\162\151\155
-\141\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157
-\156\040\101\165\164\150\157\162\151\164\171\060\201\237\060\015
-\006\011\052\206\110\206\367\015\001\001\001\005\000\003\201\215
-\000\060\201\211\002\201\201\000\311\134\131\236\362\033\212\001
-\024\264\020\337\004\100\333\343\127\257\152\105\100\217\204\014
-\013\321\063\331\331\021\317\356\002\130\037\045\367\052\250\104
-\005\252\354\003\037\170\177\236\223\271\232\000\252\043\175\326
-\254\205\242\143\105\307\162\047\314\364\114\306\165\161\322\071
-\357\117\102\360\165\337\012\220\306\216\040\157\230\017\370\254
-\043\137\160\051\066\244\311\206\347\261\232\040\313\123\245\205
-\347\075\276\175\232\376\044\105\063\334\166\025\355\017\242\161
-\144\114\145\056\201\150\105\247\002\003\001\000\001\060\015\006
-\011\052\206\110\206\367\015\001\001\002\005\000\003\201\201\000
-\273\114\022\053\317\054\046\000\117\024\023\335\246\373\374\012
-\021\204\214\363\050\034\147\222\057\174\266\305\372\337\360\350
-\225\274\035\217\154\054\250\121\314\163\330\244\300\123\360\116
-\326\046\300\166\001\127\201\222\136\041\361\321\261\377\347\320
-\041\130\315\151\027\343\104\034\234\031\104\071\211\134\334\234
-\000\017\126\215\002\231\355\242\220\105\114\344\273\020\244\075
-\360\062\003\016\361\316\370\350\311\121\214\346\142\237\346\237
-\300\175\267\162\234\311\066\072\153\237\116\250\377\144\015\144
-END
-
-# Trust for Certificate "Verisign Class 3 Public Primary Certification Authority"
-# Issuer: OU=Class 3 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Serial Number:70:ba:e4:1d:10:d9:29:34:b6:38:ca:7b:03:cc:ba:bf
-# Subject: OU=Class 3 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Not Valid Before: Mon Jan 29 00:00:00 1996
-# Not Valid After : Tue Aug 01 23:59:59 2028
-# Fingerprint (MD5): 10:FC:63:5D:F6:26:3E:0D:F3:25:BE:5F:79:CD:67:67
-# Fingerprint (SHA1): 74:2C:31:92:E6:07:E4:24:EB:45:49:54:2B:E1:BB:C5:3E:61:74:E2
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Verisign Class 3 Public Primary Certification Authority"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\164\054\061\222\346\007\344\044\353\105\111\124\053\341\273\305
-\076\141\164\342
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\020\374\143\135\366\046\076\015\363\045\276\137\171\315\147\147
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151
-\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004
-\013\023\056\103\154\141\163\163\040\063\040\120\165\142\154\151
-\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146
-\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
-\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\160\272\344\035\020\331\051\064\266\070\312\173\003\314
-\272\277
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "Verisign Class 2 Public Primary Certification Authority - G2"
-#
-# Issuer: OU=VeriSign Trust Network,OU="(c) 1998 VeriSign, Inc. - For authorized use only",OU=Class 2 Public Primary Certification Authority - G2,O="VeriSign, Inc.",C=US
-# Serial Number:00:b9:2f:60:cc:88:9f:a1:7a:46:09:b8:5b:70:6c:8a:af
-# Subject: OU=VeriSign Trust Network,OU="(c) 1998 VeriSign, Inc. - For authorized use only",OU=Class 2 Public Primary Certification Authority - G2,O="VeriSign, Inc.",C=US
-# Not Valid Before: Mon May 18 00:00:00 1998
-# Not Valid After : Tue Aug 01 23:59:59 2028
-# Fingerprint (MD5): 2D:BB:E5:25:D3:D1:65:82:3A:B7:0E:FA:E6:EB:E2:E1
-# Fingerprint (SHA1): B3:EA:C4:47:76:C9:C8:1C:EA:F2:9D:95:B6:CC:A0:08:1B:67:EC:9D
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Verisign Class 2 Public Primary Certification Authority - G2"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123
-\151\147\156\054\040\111\156\143\056\061\074\060\072\006\003\125
-\004\013\023\063\103\154\141\163\163\040\062\040\120\165\142\154
-\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
-\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
-\164\171\040\055\040\107\062\061\072\060\070\006\003\125\004\013
-\023\061\050\143\051\040\061\071\071\070\040\126\145\162\151\123
-\151\147\156\054\040\111\156\143\056\040\055\040\106\157\162\040
-\141\165\164\150\157\162\151\172\145\144\040\165\163\145\040\157
-\156\154\171\061\037\060\035\006\003\125\004\013\023\026\126\145
-\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145\164
-\167\157\162\153
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123
-\151\147\156\054\040\111\156\143\056\061\074\060\072\006\003\125
-\004\013\023\063\103\154\141\163\163\040\062\040\120\165\142\154
-\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
-\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
-\164\171\040\055\040\107\062\061\072\060\070\006\003\125\004\013
-\023\061\050\143\051\040\061\071\071\070\040\126\145\162\151\123
-\151\147\156\054\040\111\156\143\056\040\055\040\106\157\162\040
-\141\165\164\150\157\162\151\172\145\144\040\165\163\145\040\157
-\156\154\171\061\037\060\035\006\003\125\004\013\023\026\126\145
-\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145\164
-\167\157\162\153
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\021\000\271\057\140\314\210\237\241\172\106\011\270\133\160
-\154\212\257
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\003\003\060\202\002\154\002\021\000\271\057\140\314\210
-\237\241\172\106\011\270\133\160\154\212\257\060\015\006\011\052
-\206\110\206\367\015\001\001\005\005\000\060\201\301\061\013\060
-\011\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003
-\125\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111
-\156\143\056\061\074\060\072\006\003\125\004\013\023\063\103\154
-\141\163\163\040\062\040\120\165\142\154\151\143\040\120\162\151
-\155\141\162\171\040\103\145\162\164\151\146\151\143\141\164\151
-\157\156\040\101\165\164\150\157\162\151\164\171\040\055\040\107
-\062\061\072\060\070\006\003\125\004\013\023\061\050\143\051\040
-\061\071\071\070\040\126\145\162\151\123\151\147\156\054\040\111
-\156\143\056\040\055\040\106\157\162\040\141\165\164\150\157\162
-\151\172\145\144\040\165\163\145\040\157\156\154\171\061\037\060
-\035\006\003\125\004\013\023\026\126\145\162\151\123\151\147\156
-\040\124\162\165\163\164\040\116\145\164\167\157\162\153\060\036
-\027\015\071\070\060\065\061\070\060\060\060\060\060\060\132\027
-\015\062\070\060\070\060\061\062\063\065\071\065\071\132\060\201
-\301\061\013\060\011\006\003\125\004\006\023\002\125\123\061\027
-\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151\147
-\156\054\040\111\156\143\056\061\074\060\072\006\003\125\004\013
-\023\063\103\154\141\163\163\040\062\040\120\165\142\154\151\143
-\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146\151
-\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
-\040\055\040\107\062\061\072\060\070\006\003\125\004\013\023\061
-\050\143\051\040\061\071\071\070\040\126\145\162\151\123\151\147
-\156\054\040\111\156\143\056\040\055\040\106\157\162\040\141\165
-\164\150\157\162\151\172\145\144\040\165\163\145\040\157\156\154
-\171\061\037\060\035\006\003\125\004\013\023\026\126\145\162\151
-\123\151\147\156\040\124\162\165\163\164\040\116\145\164\167\157
-\162\153\060\201\237\060\015\006\011\052\206\110\206\367\015\001
-\001\001\005\000\003\201\215\000\060\201\211\002\201\201\000\247
-\210\001\041\164\054\347\032\003\360\230\341\227\074\017\041\010
-\361\234\333\227\351\232\374\302\004\006\023\276\137\122\310\314
-\036\054\022\126\054\270\001\151\054\314\231\037\255\260\226\256
-\171\004\362\023\071\301\173\230\272\010\054\350\302\204\023\054
-\252\151\351\011\364\307\251\002\244\102\302\043\117\112\330\360
-\016\242\373\061\154\311\346\157\231\047\007\365\346\364\114\170
-\236\155\353\106\206\372\271\206\311\124\362\262\304\257\324\106
-\034\132\311\025\060\377\015\154\365\055\016\155\316\177\167\002
-\003\001\000\001\060\015\006\011\052\206\110\206\367\015\001\001
-\005\005\000\003\201\201\000\162\056\371\177\321\361\161\373\304
-\236\366\305\136\121\212\100\230\270\150\370\233\034\203\330\342
-\235\275\377\355\241\346\146\352\057\011\364\312\327\352\245\053
-\225\366\044\140\206\115\104\056\203\245\304\055\240\323\256\170
-\151\157\162\332\154\256\010\360\143\222\067\346\273\304\060\027
-\255\167\314\111\065\252\317\330\217\321\276\267\030\226\107\163
-\152\124\042\064\144\055\266\026\233\131\133\264\121\131\072\263
-\013\024\364\022\337\147\240\364\255\062\144\136\261\106\162\047
-\214\022\173\305\104\264\256
-END
-
-# Trust for Certificate "Verisign Class 2 Public Primary Certification Authority - G2"
-# Issuer: OU=VeriSign Trust Network,OU="(c) 1998 VeriSign, Inc. - For authorized use only",OU=Class 2 Public Primary Certification Authority - G2,O="VeriSign, Inc.",C=US
-# Serial Number:00:b9:2f:60:cc:88:9f:a1:7a:46:09:b8:5b:70:6c:8a:af
-# Subject: OU=VeriSign Trust Network,OU="(c) 1998 VeriSign, Inc. - For authorized use only",OU=Class 2 Public Primary Certification Authority - G2,O="VeriSign, Inc.",C=US
-# Not Valid Before: Mon May 18 00:00:00 1998
-# Not Valid After : Tue Aug 01 23:59:59 2028
-# Fingerprint (MD5): 2D:BB:E5:25:D3:D1:65:82:3A:B7:0E:FA:E6:EB:E2:E1
-# Fingerprint (SHA1): B3:EA:C4:47:76:C9:C8:1C:EA:F2:9D:95:B6:CC:A0:08:1B:67:EC:9D
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Verisign Class 2 Public Primary Certification Authority - G2"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\263\352\304\107\166\311\310\034\352\362\235\225\266\314\240\010
-\033\147\354\235
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\055\273\345\045\323\321\145\202\072\267\016\372\346\353\342\341
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\301\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123
-\151\147\156\054\040\111\156\143\056\061\074\060\072\006\003\125
-\004\013\023\063\103\154\141\163\163\040\062\040\120\165\142\154
-\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
-\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
-\164\171\040\055\040\107\062\061\072\060\070\006\003\125\004\013
-\023\061\050\143\051\040\061\071\071\070\040\126\145\162\151\123
-\151\147\156\054\040\111\156\143\056\040\055\040\106\157\162\040
-\141\165\164\150\157\162\151\172\145\144\040\165\163\145\040\157
-\156\154\171\061\037\060\035\006\003\125\004\013\023\026\126\145
-\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145\164
-\167\157\162\153
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\021\000\271\057\140\314\210\237\241\172\106\011\270\133\160
-\154\212\257
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "GlobalSign Root CA"
#
@@ -577,6 +191,7 @@ CKA_VALUE MULTILINE_OCTAL
\034\305\037\244\200\157\025\040\311\336\014\210\012\035\326\146
\125\342\374\110\311\051\046\151\340
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GlobalSign Root CA"
# Issuer: CN=GlobalSign Root CA,OU=Root CA,O=GlobalSign nv-sa,C=BE
@@ -710,6 +325,7 @@ CKA_VALUE MULTILINE_OCTAL
\035\111\367\252\336\225\317\040\170\302\140\022\333\045\100\214
\152\374\176\102\070\100\144\022\367\236\201\341\223\056
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GlobalSign Root CA - R2"
# Issuer: CN=GlobalSign,O=GlobalSign,OU=GlobalSign Root CA - R2
@@ -865,6 +481,7 @@ CKA_VALUE MULTILINE_OCTAL
\363\334\017\337\012\207\304\357\206\005\325\070\024\140\231\243
\113\336\006\226\161\054\362\333\266\037\244\357\077\356
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Verisign Class 1 Public Primary Certification Authority - G3"
# Issuer: CN=VeriSign Class 1 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
@@ -1029,6 +646,7 @@ CKA_VALUE MULTILINE_OCTAL
\377\343\030\174\211\213\063\135\254\063\327\247\371\332\072\125
\311\130\020\371\252\357\132\266\317\113\113\337\052
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Verisign Class 2 Public Primary Certification Authority - G3"
# Issuer: CN=VeriSign Class 2 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
@@ -1193,6 +811,7 @@ CKA_VALUE MULTILINE_OCTAL
\200\332\267\155\027\217\235\036\201\144\341\376\305\105\272\255
\153\271\012\172\116\117\113\204\356\113\361\175\335\021
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Verisign Class 3 Public Primary Certification Authority - G3"
# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G3,OU="(c) 1999 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
@@ -1467,6 +1086,7 @@ CKA_VALUE MULTILINE_OCTAL
\334\200\220\215\263\147\233\157\110\010\025\126\317\277\361\053
\174\136\232\166\351\131\220\305\174\203\065\021\145\121
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Entrust.net Premium 2048 Secure Server CA"
# Issuer: CN=Entrust.net Certification Authority (2048),OU=(c) 1999 Entrust.net Limited,OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),O=Entrust.net
@@ -1604,6 +1224,7 @@ CKA_VALUE MULTILINE_OCTAL
\107\322\070\056\320\376\201\334\062\152\036\265\356\074\325\374
\347\201\035\031\303\044\102\352\143\071\251
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Baltimore CyberTrust Root"
# Issuer: CN=Baltimore CyberTrust Root,OU=CyberTrust,O=Baltimore,C=IE
@@ -1642,272 +1263,39 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
-# Certificate "Equifax Secure Global eBusiness CA"
+# Certificate "AddTrust Low-Value Services Root"
#
-# Issuer: CN=Equifax Secure Global eBusiness CA-1,O=Equifax Secure Inc.,C=US
+# Issuer: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE
# Serial Number: 1 (0x1)
-# Subject: CN=Equifax Secure Global eBusiness CA-1,O=Equifax Secure Inc.,C=US
-# Not Valid Before: Mon Jun 21 04:00:00 1999
-# Not Valid After : Sun Jun 21 04:00:00 2020
-# Fingerprint (MD5): 8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC
-# Fingerprint (SHA1): 7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45
+# Subject: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE
+# Not Valid Before: Tue May 30 10:38:31 2000
+# Not Valid After : Sat May 30 10:38:31 2020
+# Fingerprint (MD5): 1E:42:95:02:33:92:6B:B9:5F:C0:7F:DA:D6:B2:4B:FC
+# Fingerprint (SHA1): CC:AB:0E:A0:4C:23:01:D6:69:7B:DD:37:9F:CD:12:EB:24:E3:94:9D
CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Equifax Secure Global eBusiness CA"
+CKA_LABEL UTF8 "AddTrust Low-Value Services Root"
CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
CKA_SUBJECT MULTILINE_OCTAL
-\060\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
-\170\040\123\145\143\165\162\145\040\111\156\143\056\061\055\060
-\053\006\003\125\004\003\023\044\105\161\165\151\146\141\170\040
-\123\145\143\165\162\145\040\107\154\157\142\141\154\040\145\102
-\165\163\151\156\145\163\163\040\103\101\055\061
+\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061
+\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165
+\163\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024
+\101\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164
+\167\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101
+\144\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040
+\103\101\040\122\157\157\164
END
CKA_ID UTF8 "0"
CKA_ISSUER MULTILINE_OCTAL
-\060\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
-\170\040\123\145\143\165\162\145\040\111\156\143\056\061\055\060
-\053\006\003\125\004\003\023\044\105\161\165\151\146\141\170\040
-\123\145\143\165\162\145\040\107\154\157\142\141\154\040\145\102
-\165\163\151\156\145\163\163\040\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\001
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\002\220\060\202\001\371\240\003\002\001\002\002\001\001
-\060\015\006\011\052\206\110\206\367\015\001\001\004\005\000\060
-\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061\034
-\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141\170
-\040\123\145\143\165\162\145\040\111\156\143\056\061\055\060\053
-\006\003\125\004\003\023\044\105\161\165\151\146\141\170\040\123
-\145\143\165\162\145\040\107\154\157\142\141\154\040\145\102\165
-\163\151\156\145\163\163\040\103\101\055\061\060\036\027\015\071
-\071\060\066\062\061\060\064\060\060\060\060\132\027\015\062\060
-\060\066\062\061\060\064\060\060\060\060\132\060\132\061\013\060
-\011\006\003\125\004\006\023\002\125\123\061\034\060\032\006\003
-\125\004\012\023\023\105\161\165\151\146\141\170\040\123\145\143
-\165\162\145\040\111\156\143\056\061\055\060\053\006\003\125\004
-\003\023\044\105\161\165\151\146\141\170\040\123\145\143\165\162
-\145\040\107\154\157\142\141\154\040\145\102\165\163\151\156\145
-\163\163\040\103\101\055\061\060\201\237\060\015\006\011\052\206
-\110\206\367\015\001\001\001\005\000\003\201\215\000\060\201\211
-\002\201\201\000\272\347\027\220\002\145\261\064\125\074\111\302
-\121\325\337\247\321\067\217\321\347\201\163\101\122\140\233\235
-\241\027\046\170\255\307\261\350\046\224\062\265\336\063\215\072
-\057\333\362\232\172\132\163\230\243\134\351\373\212\163\033\134
-\347\303\277\200\154\315\251\364\326\053\300\367\371\231\252\143
-\242\261\107\002\017\324\344\121\072\022\074\154\212\132\124\204
-\160\333\301\305\220\317\162\105\313\250\131\300\315\063\235\077
-\243\226\353\205\063\041\034\076\036\076\140\156\166\234\147\205
-\305\310\303\141\002\003\001\000\001\243\146\060\144\060\021\006
-\011\140\206\110\001\206\370\102\001\001\004\004\003\002\000\007
-\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001
-\377\060\037\006\003\125\035\043\004\030\060\026\200\024\276\250
-\240\164\162\120\153\104\267\311\043\330\373\250\377\263\127\153
-\150\154\060\035\006\003\125\035\016\004\026\004\024\276\250\240
-\164\162\120\153\104\267\311\043\330\373\250\377\263\127\153\150
-\154\060\015\006\011\052\206\110\206\367\015\001\001\004\005\000
-\003\201\201\000\060\342\001\121\252\307\352\137\332\271\320\145
-\017\060\326\076\332\015\024\111\156\221\223\047\024\061\357\304
-\367\055\105\370\354\307\277\242\101\015\043\264\222\371\031\000
-\147\275\001\257\315\340\161\374\132\317\144\304\340\226\230\320
-\243\100\342\001\212\357\047\007\361\145\001\212\104\055\006\145
-\165\122\300\206\020\040\041\137\154\153\017\154\256\011\034\257
-\362\242\030\064\304\165\244\163\034\361\215\334\357\255\371\263
-\166\264\222\277\334\225\020\036\276\313\310\073\132\204\140\031
-\126\224\251\125
-END
-
-# Trust for Certificate "Equifax Secure Global eBusiness CA"
-# Issuer: CN=Equifax Secure Global eBusiness CA-1,O=Equifax Secure Inc.,C=US
-# Serial Number: 1 (0x1)
-# Subject: CN=Equifax Secure Global eBusiness CA-1,O=Equifax Secure Inc.,C=US
-# Not Valid Before: Mon Jun 21 04:00:00 1999
-# Not Valid After : Sun Jun 21 04:00:00 2020
-# Fingerprint (MD5): 8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC
-# Fingerprint (SHA1): 7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Equifax Secure Global eBusiness CA"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\176\170\112\020\034\202\145\314\055\341\361\155\107\264\100\312
-\331\012\031\105
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\217\135\167\006\047\304\230\074\133\223\170\347\327\175\233\314
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
-\170\040\123\145\143\165\162\145\040\111\156\143\056\061\055\060
-\053\006\003\125\004\003\023\044\105\161\165\151\146\141\170\040
-\123\145\143\165\162\145\040\107\154\157\142\141\154\040\145\102
-\165\163\151\156\145\163\163\040\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\001
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "Equifax Secure eBusiness CA 1"
-#
-# Issuer: CN=Equifax Secure eBusiness CA-1,O=Equifax Secure Inc.,C=US
-# Serial Number: 4 (0x4)
-# Subject: CN=Equifax Secure eBusiness CA-1,O=Equifax Secure Inc.,C=US
-# Not Valid Before: Mon Jun 21 04:00:00 1999
-# Not Valid After : Sun Jun 21 04:00:00 2020
-# Fingerprint (MD5): 64:9C:EF:2E:44:FC:C6:8F:52:07:D0:51:73:8F:CB:3D
-# Fingerprint (SHA1): DA:40:18:8B:91:89:A3:ED:EE:AE:DA:97:FE:2F:9D:F5:B7:D1:8A:41
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Equifax Secure eBusiness CA 1"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\123\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
-\170\040\123\145\143\165\162\145\040\111\156\143\056\061\046\060
-\044\006\003\125\004\003\023\035\105\161\165\151\146\141\170\040
-\123\145\143\165\162\145\040\145\102\165\163\151\156\145\163\163
-\040\103\101\055\061
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\123\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
-\170\040\123\145\143\165\162\145\040\111\156\143\056\061\046\060
-\044\006\003\125\004\003\023\035\105\161\165\151\146\141\170\040
-\123\145\143\165\162\145\040\145\102\165\163\151\156\145\163\163
-\040\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\004
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\002\202\060\202\001\353\240\003\002\001\002\002\001\004
-\060\015\006\011\052\206\110\206\367\015\001\001\004\005\000\060
-\123\061\013\060\011\006\003\125\004\006\023\002\125\123\061\034
-\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141\170
-\040\123\145\143\165\162\145\040\111\156\143\056\061\046\060\044
-\006\003\125\004\003\023\035\105\161\165\151\146\141\170\040\123
-\145\143\165\162\145\040\145\102\165\163\151\156\145\163\163\040
-\103\101\055\061\060\036\027\015\071\071\060\066\062\061\060\064
-\060\060\060\060\132\027\015\062\060\060\066\062\061\060\064\060
-\060\060\060\132\060\123\061\013\060\011\006\003\125\004\006\023
-\002\125\123\061\034\060\032\006\003\125\004\012\023\023\105\161
-\165\151\146\141\170\040\123\145\143\165\162\145\040\111\156\143
-\056\061\046\060\044\006\003\125\004\003\023\035\105\161\165\151
-\146\141\170\040\123\145\143\165\162\145\040\145\102\165\163\151
-\156\145\163\163\040\103\101\055\061\060\201\237\060\015\006\011
-\052\206\110\206\367\015\001\001\001\005\000\003\201\215\000\060
-\201\211\002\201\201\000\316\057\031\274\027\267\167\336\223\251
-\137\132\015\027\117\064\032\014\230\364\042\331\131\324\304\150
-\106\360\264\065\305\205\003\040\306\257\105\245\041\121\105\101
-\353\026\130\066\062\157\342\120\142\144\371\375\121\234\252\044
-\331\364\235\203\052\207\012\041\323\022\070\064\154\215\000\156
-\132\240\331\102\356\032\041\225\371\122\114\125\132\305\017\070
-\117\106\372\155\370\056\065\326\035\174\353\342\360\260\165\200
-\310\251\023\254\276\210\357\072\156\253\137\052\070\142\002\260
-\022\173\376\217\246\003\002\003\001\000\001\243\146\060\144\060
-\021\006\011\140\206\110\001\206\370\102\001\001\004\004\003\002
-\000\007\060\017\006\003\125\035\023\001\001\377\004\005\060\003
-\001\001\377\060\037\006\003\125\035\043\004\030\060\026\200\024
-\112\170\062\122\021\333\131\026\066\136\337\301\024\066\100\152
-\107\174\114\241\060\035\006\003\125\035\016\004\026\004\024\112
-\170\062\122\021\333\131\026\066\136\337\301\024\066\100\152\107
-\174\114\241\060\015\006\011\052\206\110\206\367\015\001\001\004
-\005\000\003\201\201\000\165\133\250\233\003\021\346\351\126\114
-\315\371\251\114\300\015\232\363\314\145\151\346\045\166\314\131
-\267\326\124\303\035\315\231\254\031\335\264\205\325\340\075\374
-\142\040\247\204\113\130\145\361\342\371\225\041\077\365\324\176
-\130\036\107\207\124\076\130\241\265\265\370\052\357\161\347\274
-\303\366\261\111\106\342\327\240\153\345\126\172\232\047\230\174
-\106\142\024\347\311\374\156\003\022\171\200\070\035\110\202\215
-\374\027\376\052\226\053\265\142\246\246\075\275\177\222\131\315
-\132\052\202\262\067\171
-END
-
-# Trust for Certificate "Equifax Secure eBusiness CA 1"
-# Issuer: CN=Equifax Secure eBusiness CA-1,O=Equifax Secure Inc.,C=US
-# Serial Number: 4 (0x4)
-# Subject: CN=Equifax Secure eBusiness CA-1,O=Equifax Secure Inc.,C=US
-# Not Valid Before: Mon Jun 21 04:00:00 1999
-# Not Valid After : Sun Jun 21 04:00:00 2020
-# Fingerprint (MD5): 64:9C:EF:2E:44:FC:C6:8F:52:07:D0:51:73:8F:CB:3D
-# Fingerprint (SHA1): DA:40:18:8B:91:89:A3:ED:EE:AE:DA:97:FE:2F:9D:F5:B7:D1:8A:41
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Equifax Secure eBusiness CA 1"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\332\100\030\213\221\211\243\355\356\256\332\227\376\057\235\365
-\267\321\212\101
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\144\234\357\056\104\374\306\217\122\007\320\121\163\217\313\075
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\123\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
-\170\040\123\145\143\165\162\145\040\111\156\143\056\061\046\060
-\044\006\003\125\004\003\023\035\105\161\165\151\146\141\170\040
-\123\145\143\165\162\145\040\145\102\165\163\151\156\145\163\163
-\040\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\004
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "AddTrust Low-Value Services Root"
-#
-# Issuer: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE
-# Serial Number: 1 (0x1)
-# Subject: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE
-# Not Valid Before: Tue May 30 10:38:31 2000
-# Not Valid After : Sat May 30 10:38:31 2020
-# Fingerprint (MD5): 1E:42:95:02:33:92:6B:B9:5F:C0:7F:DA:D6:B2:4B:FC
-# Fingerprint (SHA1): CC:AB:0E:A0:4C:23:01:D6:69:7B:DD:37:9F:CD:12:EB:24:E3:94:9D
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "AddTrust Low-Value Services Root"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061
-\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165
-\163\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024
-\101\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164
-\167\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101
-\144\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040
-\103\101\040\122\157\157\164
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061
-\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165
-\163\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024
-\101\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164
-\167\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101
-\144\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040
-\103\101\040\122\157\157\164
+\060\145\061\013\060\011\006\003\125\004\006\023\002\123\105\061
+\024\060\022\006\003\125\004\012\023\013\101\144\144\124\162\165
+\163\164\040\101\102\061\035\060\033\006\003\125\004\013\023\024
+\101\144\144\124\162\165\163\164\040\124\124\120\040\116\145\164
+\167\157\162\153\061\041\060\037\006\003\125\004\003\023\030\101
+\144\144\124\162\165\163\164\040\103\154\141\163\163\040\061\040
+\103\101\040\122\157\157\164
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
\002\001\001
@@ -1980,6 +1368,7 @@ CKA_VALUE MULTILINE_OCTAL
\213\343\161\314\036\033\040\104\010\300\172\266\100\375\304\344
\065\341\035\026\034\320\274\053\216\326\161\331
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AddTrust Low-Value Services Root"
# Issuer: CN=AddTrust Class 1 CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE
@@ -2128,6 +1517,7 @@ CKA_VALUE MULTILINE_OCTAL
\232\171\017\040\012\056\325\236\143\046\036\125\222\224\330\202
\027\132\173\320\274\307\217\116\206\004
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AddTrust External Root"
# Issuer: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE
@@ -2273,6 +1663,7 @@ CKA_VALUE MULTILINE_OCTAL
\137\107\022\347\316\137\135\372\330\252\261\063\055\331\166\362
\116\072\063\014\053\263\055\220\006
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AddTrust Public Services Root"
# Issuer: CN=AddTrust Public CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE
@@ -2418,6 +1809,7 @@ CKA_VALUE MULTILINE_OCTAL
\074\047\067\177\203\256\236\167\317\360\060\261\377\113\231\350
\306\241
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AddTrust Qualified Certificates Root"
# Issuer: CN=AddTrust Qualified CA Root,OU=AddTrust TTP Network,O=AddTrust AB,C=SE
@@ -2580,6 +1972,7 @@ CKA_VALUE MULTILINE_OCTAL
\322\367\127\160\066\263\277\374\050\257\161\045\205\133\023\376
\036\177\132\264\074
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Entrust Root Certification Authority"
# Issuer: CN=Entrust Root Certification Authority,OU="(c) 2006 Entrust, Inc.",OU=www.entrust.net/CPS is incorporated by reference,O="Entrust, Inc.",C=US
@@ -2623,132 +2016,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "RSA Security 2048 v3"
-#
-# Issuer: OU=RSA Security 2048 V3,O=RSA Security Inc
-# Serial Number:0a:01:01:01:00:00:02:7c:00:00:00:0a:00:00:00:02
-# Subject: OU=RSA Security 2048 V3,O=RSA Security Inc
-# Not Valid Before: Thu Feb 22 20:39:23 2001
-# Not Valid After : Sun Feb 22 20:39:23 2026
-# Fingerprint (MD5): 77:0D:19:B1:21:FD:00:42:9C:3E:0C:A5:DD:0B:02:8E
-# Fingerprint (SHA1): 25:01:90:19:CF:FB:D9:99:1C:B7:68:25:74:8D:94:5F:30:93:95:42
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "RSA Security 2048 v3"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\072\061\031\060\027\006\003\125\004\012\023\020\122\123\101
-\040\123\145\143\165\162\151\164\171\040\111\156\143\061\035\060
-\033\006\003\125\004\013\023\024\122\123\101\040\123\145\143\165
-\162\151\164\171\040\062\060\064\070\040\126\063
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\072\061\031\060\027\006\003\125\004\012\023\020\122\123\101
-\040\123\145\143\165\162\151\164\171\040\111\156\143\061\035\060
-\033\006\003\125\004\013\023\024\122\123\101\040\123\145\143\165
-\162\151\164\171\040\062\060\064\070\040\126\063
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\012\001\001\001\000\000\002\174\000\000\000\012\000\000
-\000\002
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\003\141\060\202\002\111\240\003\002\001\002\002\020\012
-\001\001\001\000\000\002\174\000\000\000\012\000\000\000\002\060
-\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\072
-\061\031\060\027\006\003\125\004\012\023\020\122\123\101\040\123
-\145\143\165\162\151\164\171\040\111\156\143\061\035\060\033\006
-\003\125\004\013\023\024\122\123\101\040\123\145\143\165\162\151
-\164\171\040\062\060\064\070\040\126\063\060\036\027\015\060\061
-\060\062\062\062\062\060\063\071\062\063\132\027\015\062\066\060
-\062\062\062\062\060\063\071\062\063\132\060\072\061\031\060\027
-\006\003\125\004\012\023\020\122\123\101\040\123\145\143\165\162
-\151\164\171\040\111\156\143\061\035\060\033\006\003\125\004\013
-\023\024\122\123\101\040\123\145\143\165\162\151\164\171\040\062
-\060\064\070\040\126\063\060\202\001\042\060\015\006\011\052\206
-\110\206\367\015\001\001\001\005\000\003\202\001\017\000\060\202
-\001\012\002\202\001\001\000\267\217\125\161\322\200\335\173\151
-\171\247\360\030\120\062\074\142\147\366\012\225\007\335\346\033
-\363\236\331\322\101\124\153\255\237\174\276\031\315\373\106\253
-\101\150\036\030\352\125\310\057\221\170\211\050\373\047\051\140
-\377\337\217\214\073\311\111\233\265\244\224\316\001\352\076\265
-\143\173\177\046\375\031\335\300\041\275\204\321\055\117\106\303
-\116\334\330\067\071\073\050\257\313\235\032\352\053\257\041\245
-\301\043\042\270\270\033\132\023\207\127\203\321\360\040\347\350
-\117\043\102\260\000\245\175\211\351\351\141\163\224\230\161\046
-\274\055\152\340\367\115\360\361\266\052\070\061\201\015\051\341
-\000\301\121\017\114\122\370\004\132\252\175\162\323\270\207\052
-\273\143\020\003\052\263\241\117\015\132\136\106\267\075\016\365
-\164\354\231\237\371\075\044\201\210\246\335\140\124\350\225\066
-\075\306\011\223\232\243\022\200\000\125\231\031\107\275\320\245
-\174\303\272\373\037\367\365\017\370\254\271\265\364\067\230\023
-\030\336\205\133\267\014\202\073\207\157\225\071\130\060\332\156
-\001\150\027\042\314\300\013\002\003\001\000\001\243\143\060\141
-\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001
-\377\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001
-\006\060\037\006\003\125\035\043\004\030\060\026\200\024\007\303
-\121\060\244\252\351\105\256\065\044\372\377\044\054\063\320\261
-\235\214\060\035\006\003\125\035\016\004\026\004\024\007\303\121
-\060\244\252\351\105\256\065\044\372\377\044\054\063\320\261\235
-\214\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000
-\003\202\001\001\000\137\076\206\166\156\270\065\074\116\066\034
-\036\171\230\277\375\325\022\021\171\122\016\356\061\211\274\335
-\177\371\321\306\025\041\350\212\001\124\015\072\373\124\271\326
-\143\324\261\252\226\115\242\102\115\324\123\037\213\020\336\177
-\145\276\140\023\047\161\210\244\163\343\204\143\321\244\125\341
-\120\223\346\033\016\171\320\147\274\106\310\277\077\027\015\225
-\346\306\220\151\336\347\264\057\336\225\175\320\022\077\075\076
-\177\115\077\024\150\365\021\120\325\301\364\220\245\010\035\061
-\140\377\140\214\043\124\012\257\376\241\156\305\321\172\052\150
-\170\317\036\202\012\040\264\037\255\345\205\262\152\150\165\116
-\255\045\067\224\205\276\275\241\324\352\267\014\113\074\235\350
-\022\000\360\137\254\015\341\254\160\143\163\367\177\171\237\062
-\045\102\164\005\200\050\277\275\301\044\226\130\025\261\027\041
-\351\211\113\333\007\210\147\364\025\255\160\076\057\115\205\073
-\302\267\333\376\230\150\043\211\341\164\017\336\364\305\204\143
-\051\033\314\313\007\311\000\244\251\327\302\042\117\147\327\167
-\354\040\005\141\336
-END
-
-# Trust for Certificate "RSA Security 2048 v3"
-# Issuer: OU=RSA Security 2048 V3,O=RSA Security Inc
-# Serial Number:0a:01:01:01:00:00:02:7c:00:00:00:0a:00:00:00:02
-# Subject: OU=RSA Security 2048 V3,O=RSA Security Inc
-# Not Valid Before: Thu Feb 22 20:39:23 2001
-# Not Valid After : Sun Feb 22 20:39:23 2026
-# Fingerprint (MD5): 77:0D:19:B1:21:FD:00:42:9C:3E:0C:A5:DD:0B:02:8E
-# Fingerprint (SHA1): 25:01:90:19:CF:FB:D9:99:1C:B7:68:25:74:8D:94:5F:30:93:95:42
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "RSA Security 2048 v3"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\045\001\220\031\317\373\331\231\034\267\150\045\164\215\224\137
-\060\223\225\102
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\167\015\031\261\041\375\000\102\234\076\014\245\335\013\002\216
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\072\061\031\060\027\006\003\125\004\012\023\020\122\123\101
-\040\123\145\143\165\162\151\164\171\040\111\156\143\061\035\060
-\033\006\003\125\004\013\023\024\122\123\101\040\123\145\143\165
-\162\151\164\171\040\062\060\064\070\040\126\063
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\012\001\001\001\000\000\002\174\000\000\000\012\000\000
-\000\002
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "GeoTrust Global CA"
#
@@ -2839,6 +2106,7 @@ CKA_VALUE MULTILINE_OCTAL
\331\027\264\321\343\121\053\136\165\350\325\320\334\117\064\355
\302\005\146\200\241\313\346\063
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GeoTrust Global CA"
# Issuer: CN=GeoTrust Global CA,O=GeoTrust Inc.,C=US
@@ -2966,6 +2234,7 @@ CKA_VALUE MULTILINE_OCTAL
\107\112\126\230\321\132\205\037\214\365\042\277\253\316\203\363
\342\042\051\256\175\203\100\250\272\154
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GeoTrust Global CA 2"
# Issuer: CN=GeoTrust Global CA 2,O=GeoTrust Inc.,C=US
@@ -3125,6 +2394,7 @@ CKA_VALUE MULTILINE_OCTAL
\247\110\301\134\220\017\313\310\077\372\346\062\341\215\033\157
\244\346\216\330\371\051\110\212\316\163\376\054
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GeoTrust Universal CA"
# Issuer: CN=GeoTrust Universal CA,O=GeoTrust Inc.,C=US
@@ -3284,6 +2554,7 @@ CKA_VALUE MULTILINE_OCTAL
\370\351\242\054\114\246\321\046\137\176\257\132\114\332\037\246
\362\034\054\176\256\002\026\322\126\320\057\127\123\107\350\222
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GeoTrust Universal CA 2"
# Issuer: CN=GeoTrust Universal CA 2,O=GeoTrust Inc.,C=US
@@ -3420,6 +2691,7 @@ CKA_VALUE MULTILINE_OCTAL
\337\337\063\234\317\343\255\256\216\324\216\346\117\121\257\026
\222\340\134\366\007\017
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Visa eCommerce Root"
# Issuer: CN=Visa eCommerce Root,OU=Visa International Service Association,O=VISA,C=US
@@ -3542,6 +2814,7 @@ CKA_VALUE MULTILINE_OCTAL
\355\200\316\211\100\110\152\016\065\312\051\146\025\041\224\054
\350\140\052\233\205\112\100\363\153\212\044\354\006\026\054\163
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Certum Root CA"
# Issuer: CN=Certum CA,O=Unizeto Sp. z o.o.,C=PL
@@ -3687,6 +2960,7 @@ CKA_VALUE MULTILINE_OCTAL
\262\143\342\365\142\054\202\324\152\000\101\120\361\071\203\237
\225\351\066\226\230\156
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Comodo AAA Services root"
# Issuer: CN=AAA Certificate Services,O=Comodo CA Limited,L=Salford,ST=Greater Manchester,C=GB
@@ -3837,6 +3111,7 @@ CKA_VALUE MULTILINE_OCTAL
\241\137\015\274\161\274\016\254\013\035\107\105\035\301\354\174
\354\375\051
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Comodo Secure Services root"
# Issuer: CN=Secure Certificate Services,O=Comodo CA Limited,L=Salford,ST=Greater Manchester,C=GB
@@ -3989,6 +3264,7 @@ CKA_VALUE MULTILINE_OCTAL
\005\107\165\152\132\041\263\243\030\317\116\367\056\127\267\230
\160\136\310\304\170\260\142
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Comodo Trusted Services root"
# Issuer: CN=Trusted Certificate Services,O=Comodo CA Limited,L=Salford,ST=Greater Manchester,C=GB
@@ -4167,6 +3443,7 @@ CKA_VALUE MULTILINE_OCTAL
\207\051\317\362\211\115\324\354\305\342\346\172\320\066\043\212
\112\164\066\371
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "QuoVadis Root CA"
# Issuer: CN=QuoVadis Root Certification Authority,OU=Root Certification Authority,O=QuoVadis Limited,C=BM
@@ -4335,6 +3612,7 @@ CKA_VALUE MULTILINE_OCTAL
\361\343\261\357\337\221\217\124\052\013\045\301\046\031\304\122
\020\005\145\325\202\020\352\302\061\315\056
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "QuoVadis Root CA 2"
# Issuer: CN=QuoVadis Root CA 2,O=QuoVadis Limited,C=BM
@@ -4514,6 +3792,7 @@ CKA_VALUE MULTILINE_OCTAL
\341\045\141\063\262\131\033\342\156\327\067\127\266\015\251\022
\332
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "QuoVadis Root CA 3"
# Issuer: CN=QuoVadis Root CA 3,O=QuoVadis Limited,C=BM
@@ -4642,6 +3921,7 @@ CKA_VALUE MULTILINE_OCTAL
\214\154\041\314\164\102\355\123\377\063\213\217\017\127\001\026
\057\317\246\356\311\160\042\024\275\375\276\154\013\003
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Security Communication Root CA"
# Issuer: OU=Security Communication RootCA1,O=SECOM Trust.net,C=JP
@@ -4679,126 +3959,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "Sonera Class 1 Root CA"
-#
-# Issuer: CN=Sonera Class1 CA,O=Sonera,C=FI
-# Serial Number: 36 (0x24)
-# Subject: CN=Sonera Class1 CA,O=Sonera,C=FI
-# Not Valid Before: Fri Apr 06 10:49:13 2001
-# Not Valid After : Tue Apr 06 10:49:13 2021
-# Fingerprint (MD5): 33:B7:84:F5:5F:27:D7:68:27:DE:14:DE:12:2A:ED:6F
-# Fingerprint (SHA1): 07:47:22:01:99:CE:74:B9:7C:B0:3D:79:B2:64:A2:C8:55:E9:33:FF
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Sonera Class 1 Root CA"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\071\061\013\060\011\006\003\125\004\006\023\002\106\111\061
-\017\060\015\006\003\125\004\012\023\006\123\157\156\145\162\141
-\061\031\060\027\006\003\125\004\003\023\020\123\157\156\145\162
-\141\040\103\154\141\163\163\061\040\103\101
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\071\061\013\060\011\006\003\125\004\006\023\002\106\111\061
-\017\060\015\006\003\125\004\012\023\006\123\157\156\145\162\141
-\061\031\060\027\006\003\125\004\003\023\020\123\157\156\145\162
-\141\040\103\154\141\163\163\061\040\103\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\044
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\003\040\060\202\002\010\240\003\002\001\002\002\001\044
-\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
-\071\061\013\060\011\006\003\125\004\006\023\002\106\111\061\017
-\060\015\006\003\125\004\012\023\006\123\157\156\145\162\141\061
-\031\060\027\006\003\125\004\003\023\020\123\157\156\145\162\141
-\040\103\154\141\163\163\061\040\103\101\060\036\027\015\060\061
-\060\064\060\066\061\060\064\071\061\063\132\027\015\062\061\060
-\064\060\066\061\060\064\071\061\063\132\060\071\061\013\060\011
-\006\003\125\004\006\023\002\106\111\061\017\060\015\006\003\125
-\004\012\023\006\123\157\156\145\162\141\061\031\060\027\006\003
-\125\004\003\023\020\123\157\156\145\162\141\040\103\154\141\163
-\163\061\040\103\101\060\202\001\042\060\015\006\011\052\206\110
-\206\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001
-\012\002\202\001\001\000\265\211\037\053\117\147\012\171\377\305
-\036\370\177\074\355\321\176\332\260\315\155\057\066\254\064\306
-\333\331\144\027\010\143\060\063\042\212\114\356\216\273\017\015
-\102\125\311\235\056\245\357\367\247\214\303\253\271\227\313\216
-\357\077\025\147\250\202\162\143\123\017\101\214\175\020\225\044
-\241\132\245\006\372\222\127\235\372\245\001\362\165\351\037\274
-\126\046\122\116\170\031\145\130\125\003\130\300\024\256\214\174
-\125\137\160\133\167\043\006\066\227\363\044\265\232\106\225\344
-\337\015\013\005\105\345\321\362\035\202\273\306\023\340\376\252
-\172\375\151\060\224\363\322\105\205\374\362\062\133\062\336\350
-\154\135\037\313\244\042\164\260\200\216\135\224\367\006\000\113
-\251\324\136\056\065\120\011\363\200\227\364\014\027\256\071\330
-\137\315\063\301\034\312\211\302\042\367\105\022\355\136\022\223
-\235\143\253\202\056\271\353\102\101\104\313\112\032\000\202\015
-\236\371\213\127\076\114\307\027\355\054\213\162\063\137\162\172
-\070\126\325\346\331\256\005\032\035\165\105\261\313\245\045\034
-\022\127\066\375\042\067\002\003\001\000\001\243\063\060\061\060
-\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377
-\060\021\006\003\125\035\016\004\012\004\010\107\342\014\213\366
-\123\210\122\060\013\006\003\125\035\017\004\004\003\002\001\006
-\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\003
-\202\001\001\000\213\032\262\311\135\141\264\341\271\053\271\123
-\321\262\205\235\167\216\026\356\021\075\333\302\143\331\133\227
-\145\373\022\147\330\052\134\266\253\345\136\303\267\026\057\310
-\350\253\035\212\375\253\032\174\325\137\143\317\334\260\335\167
-\271\250\346\322\042\070\207\007\024\331\377\276\126\265\375\007
-\016\074\125\312\026\314\247\246\167\067\373\333\134\037\116\131
-\006\207\243\003\103\365\026\253\267\204\275\116\357\237\061\067
-\360\106\361\100\266\321\014\245\144\370\143\136\041\333\125\116
-\117\061\166\234\020\141\216\266\123\072\243\021\276\257\155\174
-\036\275\256\055\342\014\151\307\205\123\150\242\141\272\305\076
-\264\171\124\170\236\012\307\002\276\142\321\021\202\113\145\057
-\221\132\302\250\207\261\126\150\224\171\371\045\367\301\325\256
-\032\270\273\075\217\251\212\070\025\367\163\320\132\140\321\200
-\260\360\334\325\120\315\116\356\222\110\151\355\262\043\036\060
-\314\310\224\310\266\365\073\206\177\077\246\056\237\366\076\054
-\265\222\226\076\337\054\223\212\377\201\214\017\017\131\041\031
-\127\275\125\232
-END
-
-# Trust for Certificate "Sonera Class 1 Root CA"
-# Issuer: CN=Sonera Class1 CA,O=Sonera,C=FI
-# Serial Number: 36 (0x24)
-# Subject: CN=Sonera Class1 CA,O=Sonera,C=FI
-# Not Valid Before: Fri Apr 06 10:49:13 2001
-# Not Valid After : Tue Apr 06 10:49:13 2021
-# Fingerprint (MD5): 33:B7:84:F5:5F:27:D7:68:27:DE:14:DE:12:2A:ED:6F
-# Fingerprint (SHA1): 07:47:22:01:99:CE:74:B9:7C:B0:3D:79:B2:64:A2:C8:55:E9:33:FF
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Sonera Class 1 Root CA"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\007\107\042\001\231\316\164\271\174\260\075\171\262\144\242\310
-\125\351\063\377
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\063\267\204\365\137\047\327\150\047\336\024\336\022\052\355\157
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\071\061\013\060\011\006\003\125\004\006\023\002\106\111\061
-\017\060\015\006\003\125\004\012\023\006\123\157\156\145\162\141
-\061\031\060\027\006\003\125\004\003\023\020\123\157\156\145\162
-\141\040\103\154\141\163\163\061\040\103\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\044
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "Sonera Class 2 Root CA"
#
@@ -4884,6 +4044,7 @@ CKA_VALUE MULTILINE_OCTAL
\072\216\013\252\062\156\333\374\117\045\237\331\062\307\226\132
\160\254\337\114
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Sonera Class 2 Root CA"
# Issuer: CN=Sonera Class2 CA,O=Sonera,C=FI
@@ -5045,6 +4206,7 @@ CKA_VALUE MULTILINE_OCTAL
\370\320\216\362\363\306\256\050\133\247\360\363\066\027\374\303
\005\323\312\003\112\124
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "UTN USERFirst Email Root CA"
# Issuer: CN=UTN-USERFirst-Client Authentication and Email,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
@@ -5208,6 +4370,7 @@ CKA_VALUE MULTILINE_OCTAL
\152\236\121\015\052\121\236\201\371\324\073\136\160\022\177\020
\062\234\036\273\235\370\146\250
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "UTN USERFirst Hardware Root CA"
# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
@@ -5368,6 +4531,7 @@ CKA_VALUE MULTILINE_OCTAL
\122\037\224\337\027\224\163\303\263\301\301\161\005\040\000\170
\275\023\122\035\250\076\315\000\037\310
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "UTN USERFirst Object Root CA"
# Issuer: CN=UTN-USERFirst-Object,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
@@ -5531,6 +4695,7 @@ CKA_VALUE MULTILINE_OCTAL
\264\145\232\041\220\340\252\320\230\274\070\265\163\074\213\370
\334
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Camerfirma Chambers of Commerce Root"
# Issuer: CN=Chambers of Commerce Root,OU=http://www.chambersign.org,O=AC Camerfirma SA CIF A82743287,C=EU
@@ -5690,6 +4855,7 @@ CKA_VALUE MULTILINE_OCTAL
\001\212\005\132\223\276\241\301\377\370\347\016\147\244\107\111
\166\135\165\220\032\365\046\217\360
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Camerfirma Global Chambersign Root"
# Issuer: CN=Global Chambersign Root,OU=http://www.chambersign.org,O=AC Camerfirma SA CIF A82743287,C=EU
@@ -5842,6 +5008,7 @@ CKA_VALUE MULTILINE_OCTAL
\073\356\304\114\364\354\047\174\102\302\164\174\202\212\011\311
\264\003\045\274
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "XRamp Global CA Root"
# Issuer: CN=XRamp Global Certification Authority,O=XRamp Security Services Inc,OU=www.xrampsecurity.com,C=US
@@ -5988,6 +5155,7 @@ CKA_VALUE MULTILINE_OCTAL
\105\346\015\237\050\234\261\271\052\132\127\255\067\017\257\035
\177\333\275\237
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Go Daddy Class 2 CA"
# Issuer: OU=Go Daddy Class 2 Certification Authority,O="The Go Daddy Group, Inc.",C=US
@@ -6132,6 +5300,7 @@ CKA_VALUE MULTILINE_OCTAL
\370\267\100\021\106\232\037\171\016\142\277\017\227\354\340\057
\037\027\224
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Starfield Class 2 CA"
# Issuer: OU=Starfield Class 2 Certification Authority,O="Starfield Technologies, Inc.",C=US
@@ -6337,6 +5506,7 @@ CKA_VALUE MULTILINE_OCTAL
\064\353\005\377\232\042\256\233\175\077\361\145\121\012\246\060
\152\263\364\210\034\200\015\374\162\212\350\203\136
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "StartCom Certification Authority"
# Issuer: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
@@ -6501,6 +5671,7 @@ CKA_VALUE MULTILINE_OCTAL
\020\002\356\047\214\204\377\254\105\015\023\134\203\062\340\045
\245\206\054\174\364\022
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Taiwan GRCA"
# Issuer: O=Government Root Certification Authority,C=TW
@@ -6673,6 +5844,7 @@ CKA_VALUE MULTILINE_OCTAL
\201\310\213\237\071\124\003\045\323\026\065\216\204\320\137\372
\060\032\365\232\154\364\016\123\371\072\133\321\034
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Swisscom Root CA 1"
# Issuer: CN=Swisscom Root CA 1,OU=Digital Certificate Services,O=Swisscom,C=ch
@@ -6813,6 +5985,7 @@ CKA_VALUE MULTILINE_OCTAL
\020\161\235\255\342\303\371\303\231\121\267\053\007\010\316\056
\346\120\262\247\372\012\105\057\242\360\362
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "DigiCert Assured ID Root CA"
# Issuer: CN=DigiCert Assured ID Root CA,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -6953,6 +6126,7 @@ CKA_VALUE MULTILINE_OCTAL
\001\022\255\310\210\306\230\064\137\215\012\074\306\351\325\225
\225\155\336
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "DigiCert Global Root CA"
# Issuer: CN=DigiCert Global Root CA,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -7094,6 +6268,7 @@ CKA_VALUE MULTILINE_OCTAL
\315\354\107\252\045\047\147\240\067\363\000\202\175\124\327\251
\370\351\056\023\243\167\350\037\112
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "DigiCert High Assurance EV Root CA"
# Issuer: CN=DigiCert High Assurance EV Root CA,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -7226,6 +6401,7 @@ CKA_VALUE MULTILINE_OCTAL
\010\346\236\005\115\107\030\325\026\351\261\326\266\020\325\273
\227\277\242\216\264\124
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Certplus Class 2 Primary CA"
# Issuer: CN=Class 2 Primary CA,O=Certplus,C=FR
@@ -7352,6 +6528,7 @@ CKA_VALUE MULTILINE_OCTAL
\071\277\025\145\034\310\366\167\226\152\012\215\167\013\330\221
\013\004\216\007\333\051\266\012\356\235\202\065\065\020
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "DST Root CA X3"
# Issuer: CN=DST Root CA X3,O=Digital Signature Trust Co.
@@ -7493,6 +6670,7 @@ CKA_VALUE MULTILINE_OCTAL
\367\016\013\114\234\150\170\173\161\061\307\353\036\340\147\101
\363\267\240\247\315\345\172\063\066\152\372\232\053
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "DST ACES CA X6"
# Issuer: CN=DST ACES CA X6,OU=DST ACES,O=Digital Signature Trust,C=US
@@ -7660,6 +6838,7 @@ CKA_VALUE MULTILINE_OCTAL
\060\245\311\215\330\253\061\201\037\337\302\146\067\323\223\251
\205\206\171\145\322
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "SwissSign Platinum CA - G2"
# Issuer: CN=SwissSign Platinum CA - G2,O=SwissSign AG,C=CH
@@ -7824,6 +7003,7 @@ CKA_VALUE MULTILINE_OCTAL
\101\317\001\261\351\270\311\146\364\333\046\363\072\244\164\362
\111\044\133\311\260\320\127\301\372\076\172\341\227\311
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "SwissSign Gold CA - G2"
# Issuer: CN=SwissSign Gold CA - G2,O=SwissSign AG,C=CH
@@ -7989,6 +7169,7 @@ CKA_VALUE MULTILINE_OCTAL
\036\354\344\012\273\052\114\353\011\140\071\316\312\142\330\056
\156
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "SwissSign Silver CA - G2"
# Issuer: CN=SwissSign Silver CA - G2,O=SwissSign AG,C=CH
@@ -8120,6 +7301,7 @@ CKA_VALUE MULTILINE_OCTAL
\001\076\200\360\102\240\225\007\136\155\315\314\113\244\105\215
\253\022\350\263\336\132\345\240\174\350\017\042\035\132\351\131
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GeoTrust Primary Certification Authority"
# Issuer: CN=GeoTrust Primary Certification Authority,O=GeoTrust Inc.,C=US
@@ -8274,6 +7456,7 @@ CKA_VALUE MULTILINE_OCTAL
\302\047\060\356\247\020\135\067\217\134\071\053\344\004\360\173
\215\126\214\150
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "thawte Primary Root CA"
# Issuer: CN=thawte Primary Root CA,OU="(c) 2006 thawte, Inc. - For authorized use only",OU=Certification Services Division,O="thawte, Inc.",C=US
@@ -8448,6 +7631,7 @@ CKA_VALUE MULTILINE_OCTAL
\030\077\150\134\362\102\112\205\070\124\203\137\321\350\054\362
\254\021\326\250\355\143\152
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "VeriSign Class 3 Public Primary Certification Authority - G5"
# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G5,OU="(c) 2006 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
@@ -8590,6 +7774,7 @@ CKA_VALUE MULTILINE_OCTAL
\143\032\157\004\326\370\306\114\243\232\261\067\264\215\345\050
\113\035\236\054\302\270\150\274\355\002\356\061
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "SecureTrust CA"
# Issuer: CN=SecureTrust CA,O=SecureTrust Corporation,C=US
@@ -8724,6 +7909,7 @@ CKA_VALUE MULTILINE_OCTAL
\032\257\014\015\125\144\064\110\270\222\271\361\264\120\051\362
\117\043\037\332\154\254\037\104\341\335\043\170\121\133\307\026
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Secure Global CA"
# Issuer: CN=Secure Global CA,O=SecureTrust Corporation,C=US
@@ -8873,6 +8059,7 @@ CKA_VALUE MULTILINE_OCTAL
\050\276\060\105\061\036\307\170\276\130\141\070\254\073\342\001
\145
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "COMODO Certification Authority"
# Issuer: CN=COMODO Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB
@@ -9018,6 +8205,7 @@ CKA_VALUE MULTILINE_OCTAL
\224\265\324\314\271\275\152\065\126\041\336\330\303\353\373\313
\244\140\114\260\125\240\240\173\127\262
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Network Solutions Certificate Authority"
# Issuer: CN=Network Solutions Certificate Authority,O=Network Solutions L.L.C.,C=US
@@ -9057,167 +8245,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "WellsSecure Public Root Certificate Authority"
-#
-# Issuer: CN=WellsSecure Public Root Certificate Authority,OU=Wells Fargo Bank NA,O=Wells Fargo WellsSecure,C=US
-# Serial Number: 1 (0x1)
-# Subject: CN=WellsSecure Public Root Certificate Authority,OU=Wells Fargo Bank NA,O=Wells Fargo WellsSecure,C=US
-# Not Valid Before: Thu Dec 13 17:07:54 2007
-# Not Valid After : Wed Dec 14 00:07:54 2022
-# Fingerprint (MD5): 15:AC:A5:C2:92:2D:79:BC:E8:7F:CB:67:ED:02:CF:36
-# Fingerprint (SHA1): E7:B4:F6:9D:61:EC:90:69:DB:7E:90:A7:40:1A:3C:F4:7D:4F:E8:EE
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "WellsSecure Public Root Certificate Authority"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\205\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\040\060\036\006\003\125\004\012\014\027\127\145\154\154\163
-\040\106\141\162\147\157\040\127\145\154\154\163\123\145\143\165
-\162\145\061\034\060\032\006\003\125\004\013\014\023\127\145\154
-\154\163\040\106\141\162\147\157\040\102\141\156\153\040\116\101
-\061\066\060\064\006\003\125\004\003\014\055\127\145\154\154\163
-\123\145\143\165\162\145\040\120\165\142\154\151\143\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\145\040\101
-\165\164\150\157\162\151\164\171
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\205\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\040\060\036\006\003\125\004\012\014\027\127\145\154\154\163
-\040\106\141\162\147\157\040\127\145\154\154\163\123\145\143\165
-\162\145\061\034\060\032\006\003\125\004\013\014\023\127\145\154
-\154\163\040\106\141\162\147\157\040\102\141\156\153\040\116\101
-\061\066\060\064\006\003\125\004\003\014\055\127\145\154\154\163
-\123\145\143\165\162\145\040\120\165\142\154\151\143\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\145\040\101
-\165\164\150\157\162\151\164\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\001
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\004\275\060\202\003\245\240\003\002\001\002\002\001\001
-\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
-\201\205\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\040\060\036\006\003\125\004\012\014\027\127\145\154\154\163\040
-\106\141\162\147\157\040\127\145\154\154\163\123\145\143\165\162
-\145\061\034\060\032\006\003\125\004\013\014\023\127\145\154\154
-\163\040\106\141\162\147\157\040\102\141\156\153\040\116\101\061
-\066\060\064\006\003\125\004\003\014\055\127\145\154\154\163\123
-\145\143\165\162\145\040\120\165\142\154\151\143\040\122\157\157
-\164\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165
-\164\150\157\162\151\164\171\060\036\027\015\060\067\061\062\061
-\063\061\067\060\067\065\064\132\027\015\062\062\061\062\061\064
-\060\060\060\067\065\064\132\060\201\205\061\013\060\011\006\003
-\125\004\006\023\002\125\123\061\040\060\036\006\003\125\004\012
-\014\027\127\145\154\154\163\040\106\141\162\147\157\040\127\145
-\154\154\163\123\145\143\165\162\145\061\034\060\032\006\003\125
-\004\013\014\023\127\145\154\154\163\040\106\141\162\147\157\040
-\102\141\156\153\040\116\101\061\066\060\064\006\003\125\004\003
-\014\055\127\145\154\154\163\123\145\143\165\162\145\040\120\165
-\142\154\151\143\040\122\157\157\164\040\103\145\162\164\151\146
-\151\143\141\164\145\040\101\165\164\150\157\162\151\164\171\060
-\202\001\042\060\015\006\011\052\206\110\206\367\015\001\001\001
-\005\000\003\202\001\017\000\060\202\001\012\002\202\001\001\000
-\356\157\264\275\171\342\217\010\041\236\070\004\101\045\357\253
-\133\034\123\222\254\155\236\335\302\304\056\105\224\003\065\210
-\147\164\127\343\337\214\270\247\166\217\073\367\250\304\333\051
-\143\016\221\150\066\212\227\216\212\161\150\011\007\344\350\324
-\016\117\370\326\053\114\244\026\371\357\103\230\217\263\236\122
-\337\155\221\071\217\070\275\167\213\103\143\353\267\223\374\060
-\114\034\001\223\266\023\373\367\241\037\277\045\341\164\067\054
-\036\244\136\074\150\370\113\277\015\271\036\056\066\350\251\344
-\247\370\017\313\202\165\174\065\055\042\326\302\277\013\363\264
-\374\154\225\141\036\127\327\004\201\062\203\122\171\346\203\143
-\317\267\313\143\213\021\342\275\136\353\366\215\355\225\162\050
-\264\254\022\142\351\112\063\346\203\062\256\005\165\225\275\204
-\225\333\052\134\233\216\056\014\270\201\053\101\346\070\126\237
-\111\233\154\166\372\212\135\367\001\171\201\174\301\203\100\005
-\376\161\375\014\077\314\116\140\011\016\145\107\020\057\001\300
-\005\077\217\370\263\101\357\132\102\176\131\357\322\227\014\145
-\002\003\001\000\001\243\202\001\064\060\202\001\060\060\017\006
-\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060\071
-\006\003\125\035\037\004\062\060\060\060\056\240\054\240\052\206
-\050\150\164\164\160\072\057\057\143\162\154\056\160\153\151\056
-\167\145\154\154\163\146\141\162\147\157\056\143\157\155\057\167
-\163\160\162\143\141\056\143\162\154\060\016\006\003\125\035\017
-\001\001\377\004\004\003\002\001\306\060\035\006\003\125\035\016
-\004\026\004\024\046\225\031\020\331\350\241\227\221\377\334\031
-\331\265\004\076\322\163\012\152\060\201\262\006\003\125\035\043
-\004\201\252\060\201\247\200\024\046\225\031\020\331\350\241\227
-\221\377\334\031\331\265\004\076\322\163\012\152\241\201\213\244
-\201\210\060\201\205\061\013\060\011\006\003\125\004\006\023\002
-\125\123\061\040\060\036\006\003\125\004\012\014\027\127\145\154
-\154\163\040\106\141\162\147\157\040\127\145\154\154\163\123\145
-\143\165\162\145\061\034\060\032\006\003\125\004\013\014\023\127
-\145\154\154\163\040\106\141\162\147\157\040\102\141\156\153\040
-\116\101\061\066\060\064\006\003\125\004\003\014\055\127\145\154
-\154\163\123\145\143\165\162\145\040\120\165\142\154\151\143\040
-\122\157\157\164\040\103\145\162\164\151\146\151\143\141\164\145
-\040\101\165\164\150\157\162\151\164\171\202\001\001\060\015\006
-\011\052\206\110\206\367\015\001\001\005\005\000\003\202\001\001
-\000\271\025\261\104\221\314\043\310\053\115\167\343\370\232\173
-\047\015\315\162\273\231\000\312\174\146\031\120\306\325\230\355
-\253\277\003\132\345\115\345\036\310\117\161\227\206\325\343\035
-\375\220\311\074\165\167\127\172\175\370\336\364\324\325\367\225
-\346\164\156\035\074\256\174\235\333\002\003\005\054\161\113\045
-\076\007\343\136\232\365\146\027\051\210\032\070\237\317\252\101
-\003\204\227\153\223\070\172\312\060\104\033\044\104\063\320\344
-\321\334\050\070\364\023\103\065\065\051\143\250\174\242\265\255
-\070\244\355\255\375\306\232\037\377\227\163\376\373\263\065\247
-\223\206\306\166\221\000\346\254\121\026\304\047\062\134\333\163
-\332\245\223\127\216\076\155\065\046\010\131\325\347\104\327\166
-\040\143\347\254\023\147\303\155\261\160\106\174\325\226\021\075
-\211\157\135\250\241\353\215\012\332\303\035\063\154\243\352\147
-\031\232\231\177\113\075\203\121\052\035\312\057\206\014\242\176
-\020\055\053\324\026\225\013\007\252\056\024\222\111\267\051\157
-\330\155\061\175\365\374\241\020\007\207\316\057\131\334\076\130
-\333
-END
-
-# Trust for Certificate "WellsSecure Public Root Certificate Authority"
-# Issuer: CN=WellsSecure Public Root Certificate Authority,OU=Wells Fargo Bank NA,O=Wells Fargo WellsSecure,C=US
-# Serial Number: 1 (0x1)
-# Subject: CN=WellsSecure Public Root Certificate Authority,OU=Wells Fargo Bank NA,O=Wells Fargo WellsSecure,C=US
-# Not Valid Before: Thu Dec 13 17:07:54 2007
-# Not Valid After : Wed Dec 14 00:07:54 2022
-# Fingerprint (MD5): 15:AC:A5:C2:92:2D:79:BC:E8:7F:CB:67:ED:02:CF:36
-# Fingerprint (SHA1): E7:B4:F6:9D:61:EC:90:69:DB:7E:90:A7:40:1A:3C:F4:7D:4F:E8:EE
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "WellsSecure Public Root Certificate Authority"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\347\264\366\235\141\354\220\151\333\176\220\247\100\032\074\364
-\175\117\350\356
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\025\254\245\302\222\055\171\274\350\177\313\147\355\002\317\066
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\205\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\040\060\036\006\003\125\004\012\014\027\127\145\154\154\163
-\040\106\141\162\147\157\040\127\145\154\154\163\123\145\143\165
-\162\145\061\034\060\032\006\003\125\004\013\014\023\127\145\154
-\154\163\040\106\141\162\147\157\040\102\141\156\153\040\116\101
-\061\066\060\064\006\003\125\004\003\014\055\127\145\154\154\163
-\123\145\143\165\162\145\040\120\165\142\154\151\143\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\145\040\101
-\165\164\150\157\162\151\164\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\001
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "COMODO ECC Certification Authority"
#
@@ -9304,6 +8331,7 @@ CKA_VALUE MULTILINE_OCTAL
\030\067\200\123\376\335\040\340\065\232\066\321\307\001\271\346
\334\335\363\377\035\054\072\026\127\331\222\071\326
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "COMODO ECC Certification Authority"
# Issuer: CN=COMODO ECC Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB
@@ -9486,155 +8514,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "IGC/A"
-#
-# Issuer: E=igca@sgdn.pm.gouv.fr,CN=IGC/A,OU=DCSSI,O=PM/SGDN,L=Paris,ST=France,C=FR
-# Serial Number:39:11:45:10:94
-# Subject: E=igca@sgdn.pm.gouv.fr,CN=IGC/A,OU=DCSSI,O=PM/SGDN,L=Paris,ST=France,C=FR
-# Not Valid Before: Fri Dec 13 14:29:23 2002
-# Not Valid After : Sat Oct 17 14:29:22 2020
-# Fingerprint (MD5): 0C:7F:DD:6A:F4:2A:B9:C8:9B:BD:20:7E:A9:DB:5C:37
-# Fingerprint (SHA1): 60:D6:89:74:B5:C2:65:9E:8A:0F:C1:88:7C:88:D2:46:69:1B:18:2C
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "IGC/A"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\205\061\013\060\011\006\003\125\004\006\023\002\106\122
-\061\017\060\015\006\003\125\004\010\023\006\106\162\141\156\143
-\145\061\016\060\014\006\003\125\004\007\023\005\120\141\162\151
-\163\061\020\060\016\006\003\125\004\012\023\007\120\115\057\123
-\107\104\116\061\016\060\014\006\003\125\004\013\023\005\104\103
-\123\123\111\061\016\060\014\006\003\125\004\003\023\005\111\107
-\103\057\101\061\043\060\041\006\011\052\206\110\206\367\015\001
-\011\001\026\024\151\147\143\141\100\163\147\144\156\056\160\155
-\056\147\157\165\166\056\146\162
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\205\061\013\060\011\006\003\125\004\006\023\002\106\122
-\061\017\060\015\006\003\125\004\010\023\006\106\162\141\156\143
-\145\061\016\060\014\006\003\125\004\007\023\005\120\141\162\151
-\163\061\020\060\016\006\003\125\004\012\023\007\120\115\057\123
-\107\104\116\061\016\060\014\006\003\125\004\013\023\005\104\103
-\123\123\111\061\016\060\014\006\003\125\004\003\023\005\111\107
-\103\057\101\061\043\060\041\006\011\052\206\110\206\367\015\001
-\011\001\026\024\151\147\143\141\100\163\147\144\156\056\160\155
-\056\147\157\165\166\056\146\162
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\005\071\021\105\020\224
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\004\002\060\202\002\352\240\003\002\001\002\002\005\071
-\021\105\020\224\060\015\006\011\052\206\110\206\367\015\001\001
-\005\005\000\060\201\205\061\013\060\011\006\003\125\004\006\023
-\002\106\122\061\017\060\015\006\003\125\004\010\023\006\106\162
-\141\156\143\145\061\016\060\014\006\003\125\004\007\023\005\120
-\141\162\151\163\061\020\060\016\006\003\125\004\012\023\007\120
-\115\057\123\107\104\116\061\016\060\014\006\003\125\004\013\023
-\005\104\103\123\123\111\061\016\060\014\006\003\125\004\003\023
-\005\111\107\103\057\101\061\043\060\041\006\011\052\206\110\206
-\367\015\001\011\001\026\024\151\147\143\141\100\163\147\144\156
-\056\160\155\056\147\157\165\166\056\146\162\060\036\027\015\060
-\062\061\062\061\063\061\064\062\071\062\063\132\027\015\062\060
-\061\060\061\067\061\064\062\071\062\062\132\060\201\205\061\013
-\060\011\006\003\125\004\006\023\002\106\122\061\017\060\015\006
-\003\125\004\010\023\006\106\162\141\156\143\145\061\016\060\014
-\006\003\125\004\007\023\005\120\141\162\151\163\061\020\060\016
-\006\003\125\004\012\023\007\120\115\057\123\107\104\116\061\016
-\060\014\006\003\125\004\013\023\005\104\103\123\123\111\061\016
-\060\014\006\003\125\004\003\023\005\111\107\103\057\101\061\043
-\060\041\006\011\052\206\110\206\367\015\001\011\001\026\024\151
-\147\143\141\100\163\147\144\156\056\160\155\056\147\157\165\166
-\056\146\162\060\202\001\042\060\015\006\011\052\206\110\206\367
-\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002
-\202\001\001\000\262\037\321\320\142\305\063\073\300\004\206\210
-\263\334\370\210\367\375\337\103\337\172\215\232\111\134\366\116
-\252\314\034\271\241\353\047\211\362\106\351\073\112\161\325\035
-\216\055\317\346\255\253\143\120\307\124\013\156\022\311\220\066
-\306\330\057\332\221\252\150\305\162\376\027\012\262\027\176\171
-\265\062\210\160\312\160\300\226\112\216\344\125\315\035\047\224
-\277\316\162\052\354\134\371\163\040\376\275\367\056\211\147\270
-\273\107\163\022\367\321\065\151\072\362\012\271\256\377\106\102
-\106\242\277\241\205\032\371\277\344\377\111\205\367\243\160\206
-\062\034\135\237\140\367\251\255\245\377\317\321\064\371\175\133
-\027\306\334\326\016\050\153\302\335\361\365\063\150\235\116\374
-\207\174\066\022\326\243\200\350\103\015\125\141\224\352\144\067
-\107\352\167\312\320\262\130\005\303\135\176\261\250\106\220\061
-\126\316\160\052\226\262\060\270\167\346\171\300\275\051\073\375
-\224\167\114\275\040\315\101\045\340\056\307\033\273\356\244\004
-\101\322\135\255\022\152\212\233\107\373\311\335\106\100\341\235
-\074\063\320\265\002\003\001\000\001\243\167\060\165\060\017\006
-\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060\013
-\006\003\125\035\017\004\004\003\002\001\106\060\025\006\003\125
-\035\040\004\016\060\014\060\012\006\010\052\201\172\001\171\001
-\001\001\060\035\006\003\125\035\016\004\026\004\024\243\005\057
-\030\140\120\302\211\012\335\053\041\117\377\216\116\250\060\061
-\066\060\037\006\003\125\035\043\004\030\060\026\200\024\243\005
-\057\030\140\120\302\211\012\335\053\041\117\377\216\116\250\060
-\061\066\060\015\006\011\052\206\110\206\367\015\001\001\005\005
-\000\003\202\001\001\000\005\334\046\330\372\167\025\104\150\374
-\057\146\072\164\340\135\344\051\377\006\007\023\204\112\253\317
-\155\240\037\121\224\370\111\313\164\066\024\274\025\335\333\211
-\057\335\217\240\135\174\365\022\353\237\236\070\244\107\314\263
-\226\331\276\234\045\253\003\176\063\017\225\201\015\375\026\340
-\210\276\067\360\154\135\320\061\233\062\053\135\027\145\223\230
-\140\274\156\217\261\250\074\036\331\034\363\251\046\102\371\144
-\035\302\347\222\366\364\036\132\252\031\122\135\257\350\242\367
-\140\240\366\215\360\211\365\156\340\012\005\001\225\311\213\040
-\012\272\132\374\232\054\074\275\303\267\311\135\170\045\005\077
-\126\024\233\014\332\373\072\110\376\227\151\136\312\020\206\367
-\116\226\004\010\115\354\260\276\135\334\073\216\117\301\375\232
-\066\064\232\114\124\176\027\003\110\225\010\021\034\007\157\205
-\010\176\135\115\304\235\333\373\256\316\262\321\263\270\203\154
-\035\262\263\171\361\330\160\231\176\360\023\002\316\136\335\121
-\323\337\066\201\241\033\170\057\161\263\361\131\114\106\030\050
-\253\205\322\140\126\132
-END
-
-# Trust for Certificate "IGC/A"
-# Issuer: E=igca@sgdn.pm.gouv.fr,CN=IGC/A,OU=DCSSI,O=PM/SGDN,L=Paris,ST=France,C=FR
-# Serial Number:39:11:45:10:94
-# Subject: E=igca@sgdn.pm.gouv.fr,CN=IGC/A,OU=DCSSI,O=PM/SGDN,L=Paris,ST=France,C=FR
-# Not Valid Before: Fri Dec 13 14:29:23 2002
-# Not Valid After : Sat Oct 17 14:29:22 2020
-# Fingerprint (MD5): 0C:7F:DD:6A:F4:2A:B9:C8:9B:BD:20:7E:A9:DB:5C:37
-# Fingerprint (SHA1): 60:D6:89:74:B5:C2:65:9E:8A:0F:C1:88:7C:88:D2:46:69:1B:18:2C
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "IGC/A"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\140\326\211\164\265\302\145\236\212\017\301\210\174\210\322\106
-\151\033\030\054
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\014\177\335\152\364\052\271\310\233\275\040\176\251\333\134\067
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\205\061\013\060\011\006\003\125\004\006\023\002\106\122
-\061\017\060\015\006\003\125\004\010\023\006\106\162\141\156\143
-\145\061\016\060\014\006\003\125\004\007\023\005\120\141\162\151
-\163\061\020\060\016\006\003\125\004\012\023\007\120\115\057\123
-\107\104\116\061\016\060\014\006\003\125\004\013\023\005\104\103
-\123\123\111\061\016\060\014\006\003\125\004\003\023\005\111\107
-\103\057\101\061\043\060\041\006\011\052\206\110\206\367\015\001
-\011\001\026\024\151\147\143\141\100\163\147\144\156\056\160\155
-\056\147\157\165\166\056\146\162
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\005\071\021\105\020\224
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
# Distrust "Distrusted AC DG Tresor SSL"
# Issuer: CN=AC DGTPE Signature Authentification,O=DGTPE,C=FR
# Serial Number: 204199 (0x31da7)
@@ -9760,6 +8639,7 @@ CKA_VALUE MULTILINE_OCTAL
\310\074\255\010\311\260\230\100\243\052\347\210\203\355\167\217
\164
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Security Communication EV RootCA1"
# Issuer: OU=Security Communication EV RootCA1,O="SECOM Trust Systems CO.,LTD.",C=JP
@@ -9907,6 +8787,7 @@ CKA_VALUE MULTILINE_OCTAL
\130\123\265\234\273\157\237\134\305\030\354\335\057\341\230\311
\374\276\337\012\015
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "OISTE WISeKey Global Root GA CA"
# Issuer: CN=OISTE WISeKey Global Root GA CA,OU=OISTE Foundation Endorsed,OU=Copyright (c) 2005,O=WISeKey,C=CH
@@ -9949,409 +8830,36 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
-# Certificate "S-TRUST Authentication and Encryption Root CA 2005 PN"
+# Certificate "Certigna"
#
-# Issuer: CN=S-TRUST Authentication and Encryption Root CA 2005:PN,O=Deutscher Sparkassen Verlag GmbH,L=Stuttgart,ST=Baden-Wuerttemberg (BW),C=DE
-# Serial Number:37:19:18:e6:53:54:7c:1a:b5:b8:cb:59:5a:db:35:b7
-# Subject: CN=S-TRUST Authentication and Encryption Root CA 2005:PN,O=Deutscher Sparkassen Verlag GmbH,L=Stuttgart,ST=Baden-Wuerttemberg (BW),C=DE
-# Not Valid Before: Wed Jun 22 00:00:00 2005
-# Not Valid After : Fri Jun 21 23:59:59 2030
-# Fingerprint (MD5): 04:4B:FD:C9:6C:DA:2A:32:85:7C:59:84:61:46:8A:64
-# Fingerprint (SHA1): BE:B5:A9:95:74:6B:9E:DF:73:8B:56:E6:DF:43:7A:77:BE:10:6B:81
+# Issuer: CN=Certigna,O=Dhimyotis,C=FR
+# Serial Number:00:fe:dc:e3:01:0f:c9:48:ff
+# Subject: CN=Certigna,O=Dhimyotis,C=FR
+# Not Valid Before: Fri Jun 29 15:13:05 2007
+# Not Valid After : Tue Jun 29 15:13:05 2027
+# Fingerprint (MD5): AB:57:A6:5B:7D:42:82:19:B5:D8:58:26:28:5E:FD:FF
+# Fingerprint (SHA1): B1:2E:13:63:45:86:A4:6F:1A:B2:60:68:37:58:2D:C4:AC:FD:94:97
CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "S-TRUST Authentication and Encryption Root CA 2005 PN"
+CKA_LABEL UTF8 "Certigna"
CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
CKA_SUBJECT MULTILINE_OCTAL
-\060\201\256\061\013\060\011\006\003\125\004\006\023\002\104\105
-\061\040\060\036\006\003\125\004\010\023\027\102\141\144\145\156
-\055\127\165\145\162\164\164\145\155\142\145\162\147\040\050\102
-\127\051\061\022\060\020\006\003\125\004\007\023\011\123\164\165
-\164\164\147\141\162\164\061\051\060\047\006\003\125\004\012\023
-\040\104\145\165\164\163\143\150\145\162\040\123\160\141\162\153
-\141\163\163\145\156\040\126\145\162\154\141\147\040\107\155\142
-\110\061\076\060\074\006\003\125\004\003\023\065\123\055\124\122
-\125\123\124\040\101\165\164\150\145\156\164\151\143\141\164\151
-\157\156\040\141\156\144\040\105\156\143\162\171\160\164\151\157
-\156\040\122\157\157\164\040\103\101\040\062\060\060\065\072\120
-\116
+\060\064\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\104\150\151\155\171\157
+\164\151\163\061\021\060\017\006\003\125\004\003\014\010\103\145
+\162\164\151\147\156\141
END
CKA_ID UTF8 "0"
CKA_ISSUER MULTILINE_OCTAL
-\060\201\256\061\013\060\011\006\003\125\004\006\023\002\104\105
-\061\040\060\036\006\003\125\004\010\023\027\102\141\144\145\156
-\055\127\165\145\162\164\164\145\155\142\145\162\147\040\050\102
-\127\051\061\022\060\020\006\003\125\004\007\023\011\123\164\165
-\164\164\147\141\162\164\061\051\060\047\006\003\125\004\012\023
-\040\104\145\165\164\163\143\150\145\162\040\123\160\141\162\153
-\141\163\163\145\156\040\126\145\162\154\141\147\040\107\155\142
-\110\061\076\060\074\006\003\125\004\003\023\065\123\055\124\122
-\125\123\124\040\101\165\164\150\145\156\164\151\143\141\164\151
-\157\156\040\141\156\144\040\105\156\143\162\171\160\164\151\157
-\156\040\122\157\157\164\040\103\101\040\062\060\060\065\072\120
-\116
+\060\064\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\104\150\151\155\171\157
+\164\151\163\061\021\060\017\006\003\125\004\003\014\010\103\145
+\162\164\151\147\156\141
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\067\031\030\346\123\124\174\032\265\270\313\131\132\333
-\065\267
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\004\173\060\202\003\143\240\003\002\001\002\002\020\067
-\031\030\346\123\124\174\032\265\270\313\131\132\333\065\267\060
-\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\201
-\256\061\013\060\011\006\003\125\004\006\023\002\104\105\061\040
-\060\036\006\003\125\004\010\023\027\102\141\144\145\156\055\127
-\165\145\162\164\164\145\155\142\145\162\147\040\050\102\127\051
-\061\022\060\020\006\003\125\004\007\023\011\123\164\165\164\164
-\147\141\162\164\061\051\060\047\006\003\125\004\012\023\040\104
-\145\165\164\163\143\150\145\162\040\123\160\141\162\153\141\163
-\163\145\156\040\126\145\162\154\141\147\040\107\155\142\110\061
-\076\060\074\006\003\125\004\003\023\065\123\055\124\122\125\123
-\124\040\101\165\164\150\145\156\164\151\143\141\164\151\157\156
-\040\141\156\144\040\105\156\143\162\171\160\164\151\157\156\040
-\122\157\157\164\040\103\101\040\062\060\060\065\072\120\116\060
-\036\027\015\060\065\060\066\062\062\060\060\060\060\060\060\132
-\027\015\063\060\060\066\062\061\062\063\065\071\065\071\132\060
-\201\256\061\013\060\011\006\003\125\004\006\023\002\104\105\061
-\040\060\036\006\003\125\004\010\023\027\102\141\144\145\156\055
-\127\165\145\162\164\164\145\155\142\145\162\147\040\050\102\127
-\051\061\022\060\020\006\003\125\004\007\023\011\123\164\165\164
-\164\147\141\162\164\061\051\060\047\006\003\125\004\012\023\040
-\104\145\165\164\163\143\150\145\162\040\123\160\141\162\153\141
-\163\163\145\156\040\126\145\162\154\141\147\040\107\155\142\110
-\061\076\060\074\006\003\125\004\003\023\065\123\055\124\122\125
-\123\124\040\101\165\164\150\145\156\164\151\143\141\164\151\157
-\156\040\141\156\144\040\105\156\143\162\171\160\164\151\157\156
-\040\122\157\157\164\040\103\101\040\062\060\060\065\072\120\116
-\060\202\001\042\060\015\006\011\052\206\110\206\367\015\001\001
-\001\005\000\003\202\001\017\000\060\202\001\012\002\202\001\001
-\000\331\265\112\301\323\063\352\323\106\263\321\342\114\322\365
-\266\203\320\157\325\030\351\223\257\047\216\023\315\265\045\066
-\120\064\022\144\051\241\125\341\072\140\223\236\050\311\343\363
-\233\341\004\260\043\277\225\212\216\133\033\101\177\132\303\350
-\115\114\325\044\026\076\207\110\324\047\256\346\367\123\035\273
-\014\000\357\076\141\161\255\277\072\172\130\037\224\075\134\201
-\325\325\157\337\270\233\322\365\345\313\203\162\222\302\123\262
-\202\002\353\255\255\137\026\055\222\123\166\361\211\266\054\365
-\301\057\340\247\112\157\240\060\152\062\353\232\164\003\150\170
-\023\235\312\057\233\013\035\276\317\165\015\046\227\233\307\365
-\136\012\237\170\337\263\274\354\232\272\357\125\217\033\232\246
-\007\143\051\027\131\142\011\052\171\007\167\245\340\321\027\151
-\351\133\335\366\220\253\342\230\012\000\321\045\155\236\327\205
-\207\057\222\361\321\166\203\117\013\072\131\067\050\057\063\247
-\027\120\326\040\013\012\364\046\371\237\070\347\055\244\270\233
-\211\215\255\255\311\152\175\211\027\273\366\177\200\203\172\346
-\355\002\003\001\000\001\243\201\222\060\201\217\060\022\006\003
-\125\035\023\001\001\377\004\010\060\006\001\001\377\002\001\000
-\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001\006
-\060\051\006\003\125\035\021\004\042\060\040\244\036\060\034\061
-\032\060\030\006\003\125\004\003\023\021\123\124\122\157\156\154
-\151\156\145\061\055\062\060\064\070\055\065\060\035\006\003\125
-\035\016\004\026\004\024\017\312\036\134\171\340\242\363\051\266
-\322\205\263\013\112\265\145\354\153\122\060\037\006\003\125\035
-\043\004\030\060\026\200\024\017\312\036\134\171\340\242\363\051
-\266\322\205\263\013\112\265\145\354\153\122\060\015\006\011\052
-\206\110\206\367\015\001\001\005\005\000\003\202\001\001\000\257
-\001\360\355\031\074\050\350\115\134\273\245\143\034\210\063\003
-\247\000\207\244\037\040\253\326\034\343\006\037\227\176\124\275
-\267\321\262\311\325\332\200\354\027\327\212\365\173\302\000\366
-\351\021\157\204\240\132\045\061\342\211\371\244\000\077\061\150
-\056\325\075\350\156\346\325\035\074\077\262\275\237\167\353\235
-\323\214\272\300\327\266\115\354\123\234\017\004\156\352\065\147
-\127\343\012\145\173\220\072\341\117\076\303\000\222\172\273\005
-\211\163\214\313\246\115\300\373\366\002\326\260\007\243\003\302
-\047\100\237\014\344\205\202\055\257\232\102\035\320\307\215\370
-\100\356\235\006\127\034\331\242\330\200\024\376\341\143\055\062
-\207\325\224\122\226\072\106\306\161\226\075\367\230\016\262\221
-\252\217\332\364\116\044\000\071\125\350\255\027\271\323\064\053
-\112\251\100\314\027\052\125\145\101\164\102\176\365\300\257\310
-\223\255\362\030\133\075\211\014\333\107\071\044\370\340\114\362
-\037\260\075\012\312\005\116\211\041\032\343\052\231\254\374\177
-\241\361\017\033\037\075\236\004\203\335\226\331\035\072\224
-END
-
-# Trust for Certificate "S-TRUST Authentication and Encryption Root CA 2005 PN"
-# Issuer: CN=S-TRUST Authentication and Encryption Root CA 2005:PN,O=Deutscher Sparkassen Verlag GmbH,L=Stuttgart,ST=Baden-Wuerttemberg (BW),C=DE
-# Serial Number:37:19:18:e6:53:54:7c:1a:b5:b8:cb:59:5a:db:35:b7
-# Subject: CN=S-TRUST Authentication and Encryption Root CA 2005:PN,O=Deutscher Sparkassen Verlag GmbH,L=Stuttgart,ST=Baden-Wuerttemberg (BW),C=DE
-# Not Valid Before: Wed Jun 22 00:00:00 2005
-# Not Valid After : Fri Jun 21 23:59:59 2030
-# Fingerprint (MD5): 04:4B:FD:C9:6C:DA:2A:32:85:7C:59:84:61:46:8A:64
-# Fingerprint (SHA1): BE:B5:A9:95:74:6B:9E:DF:73:8B:56:E6:DF:43:7A:77:BE:10:6B:81
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "S-TRUST Authentication and Encryption Root CA 2005 PN"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\276\265\251\225\164\153\236\337\163\213\126\346\337\103\172\167
-\276\020\153\201
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\004\113\375\311\154\332\052\062\205\174\131\204\141\106\212\144
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\256\061\013\060\011\006\003\125\004\006\023\002\104\105
-\061\040\060\036\006\003\125\004\010\023\027\102\141\144\145\156
-\055\127\165\145\162\164\164\145\155\142\145\162\147\040\050\102
-\127\051\061\022\060\020\006\003\125\004\007\023\011\123\164\165
-\164\164\147\141\162\164\061\051\060\047\006\003\125\004\012\023
-\040\104\145\165\164\163\143\150\145\162\040\123\160\141\162\153
-\141\163\163\145\156\040\126\145\162\154\141\147\040\107\155\142
-\110\061\076\060\074\006\003\125\004\003\023\065\123\055\124\122
-\125\123\124\040\101\165\164\150\145\156\164\151\143\141\164\151
-\157\156\040\141\156\144\040\105\156\143\162\171\160\164\151\157
-\156\040\122\157\157\164\040\103\101\040\062\060\060\065\072\120
-\116
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\067\031\030\346\123\124\174\032\265\270\313\131\132\333
-\065\267
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "Microsec e-Szigno Root CA"
-#
-# Issuer: CN=Microsec e-Szigno Root CA,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU
-# Serial Number:00:cc:b8:e7:bf:4e:29:1a:fd:a2:dc:66:a5:1c:2c:0f:11
-# Subject: CN=Microsec e-Szigno Root CA,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU
-# Not Valid Before: Wed Apr 06 12:28:44 2005
-# Not Valid After : Thu Apr 06 12:28:44 2017
-# Fingerprint (MD5): F0:96:B6:2F:C5:10:D5:67:8E:83:25:32:E8:5E:2E:E5
-# Fingerprint (SHA1): 23:88:C9:D3:71:CC:9E:96:3D:FF:7D:3C:A7:CE:FC:D6:25:EC:19:0D
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Microsec e-Szigno Root CA"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\162\061\013\060\011\006\003\125\004\006\023\002\110\125\061
-\021\060\017\006\003\125\004\007\023\010\102\165\144\141\160\145
-\163\164\061\026\060\024\006\003\125\004\012\023\015\115\151\143
-\162\157\163\145\143\040\114\164\144\056\061\024\060\022\006\003
-\125\004\013\023\013\145\055\123\172\151\147\156\157\040\103\101
-\061\042\060\040\006\003\125\004\003\023\031\115\151\143\162\157
-\163\145\143\040\145\055\123\172\151\147\156\157\040\122\157\157
-\164\040\103\101
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\162\061\013\060\011\006\003\125\004\006\023\002\110\125\061
-\021\060\017\006\003\125\004\007\023\010\102\165\144\141\160\145
-\163\164\061\026\060\024\006\003\125\004\012\023\015\115\151\143
-\162\157\163\145\143\040\114\164\144\056\061\024\060\022\006\003
-\125\004\013\023\013\145\055\123\172\151\147\156\157\040\103\101
-\061\042\060\040\006\003\125\004\003\023\031\115\151\143\162\157
-\163\145\143\040\145\055\123\172\151\147\156\157\040\122\157\157
-\164\040\103\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\021\000\314\270\347\277\116\051\032\375\242\334\146\245\034
-\054\017\021
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\007\250\060\202\006\220\240\003\002\001\002\002\021\000
-\314\270\347\277\116\051\032\375\242\334\146\245\034\054\017\021
-\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
-\162\061\013\060\011\006\003\125\004\006\023\002\110\125\061\021
-\060\017\006\003\125\004\007\023\010\102\165\144\141\160\145\163
-\164\061\026\060\024\006\003\125\004\012\023\015\115\151\143\162
-\157\163\145\143\040\114\164\144\056\061\024\060\022\006\003\125
-\004\013\023\013\145\055\123\172\151\147\156\157\040\103\101\061
-\042\060\040\006\003\125\004\003\023\031\115\151\143\162\157\163
-\145\143\040\145\055\123\172\151\147\156\157\040\122\157\157\164
-\040\103\101\060\036\027\015\060\065\060\064\060\066\061\062\062
-\070\064\064\132\027\015\061\067\060\064\060\066\061\062\062\070
-\064\064\132\060\162\061\013\060\011\006\003\125\004\006\023\002
-\110\125\061\021\060\017\006\003\125\004\007\023\010\102\165\144
-\141\160\145\163\164\061\026\060\024\006\003\125\004\012\023\015
-\115\151\143\162\157\163\145\143\040\114\164\144\056\061\024\060
-\022\006\003\125\004\013\023\013\145\055\123\172\151\147\156\157
-\040\103\101\061\042\060\040\006\003\125\004\003\023\031\115\151
-\143\162\157\163\145\143\040\145\055\123\172\151\147\156\157\040
-\122\157\157\164\040\103\101\060\202\001\042\060\015\006\011\052
-\206\110\206\367\015\001\001\001\005\000\003\202\001\017\000\060
-\202\001\012\002\202\001\001\000\355\310\000\325\201\173\315\070
-\000\107\314\333\204\301\041\151\054\164\220\014\041\331\123\207
-\355\076\103\104\123\257\253\370\200\233\074\170\215\324\215\256
-\270\357\323\021\334\201\346\317\073\226\214\326\157\025\306\167
-\176\241\057\340\137\222\266\047\327\166\232\035\103\074\352\331
-\354\057\356\071\363\152\147\113\213\202\317\042\370\145\125\376
-\054\313\057\175\110\172\075\165\371\252\240\047\273\170\302\006
-\312\121\302\176\146\113\257\315\242\247\115\002\202\077\202\254
-\205\306\341\017\220\107\231\224\012\161\162\223\052\311\246\300
-\276\074\126\114\163\222\047\361\153\265\365\375\374\060\005\140
-\222\306\353\226\176\001\221\302\151\261\036\035\173\123\105\270
-\334\101\037\311\213\161\326\124\024\343\213\124\170\077\276\364
-\142\073\133\365\243\354\325\222\164\342\164\060\357\001\333\341
-\324\253\231\233\052\153\370\275\246\034\206\043\102\137\354\111
-\336\232\213\133\364\162\072\100\305\111\076\245\276\216\252\161
-\353\154\372\365\032\344\152\375\173\175\125\100\357\130\156\346
-\331\325\274\044\253\301\357\267\002\003\001\000\001\243\202\004
-\067\060\202\004\063\060\147\006\010\053\006\001\005\005\007\001
-\001\004\133\060\131\060\050\006\010\053\006\001\005\005\007\060
-\001\206\034\150\164\164\160\163\072\057\057\162\143\141\056\145
-\055\163\172\151\147\156\157\056\150\165\057\157\143\163\160\060
-\055\006\010\053\006\001\005\005\007\060\002\206\041\150\164\164
-\160\072\057\057\167\167\167\056\145\055\163\172\151\147\156\157
-\056\150\165\057\122\157\157\164\103\101\056\143\162\164\060\017
-\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060
-\202\001\163\006\003\125\035\040\004\202\001\152\060\202\001\146
-\060\202\001\142\006\014\053\006\001\004\001\201\250\030\002\001
-\001\001\060\202\001\120\060\050\006\010\053\006\001\005\005\007
-\002\001\026\034\150\164\164\160\072\057\057\167\167\167\056\145
-\055\163\172\151\147\156\157\056\150\165\057\123\132\123\132\057
-\060\202\001\042\006\010\053\006\001\005\005\007\002\002\060\202
-\001\024\036\202\001\020\000\101\000\040\000\164\000\141\000\156
-\000\372\000\163\000\355\000\164\000\166\000\341\000\156\000\171
-\000\040\000\351\000\162\000\164\000\145\000\154\000\155\000\145
-\000\172\000\351\000\163\000\351\000\150\000\145\000\172\000\040
-\000\351\000\163\000\040\000\145\000\154\000\146\000\157\000\147
-\000\141\000\144\000\341\000\163\000\341\000\150\000\157\000\172
-\000\040\000\141\000\040\000\123\000\172\000\157\000\154\000\147
-\000\341\000\154\000\164\000\141\000\164\000\363\000\040\000\123
-\000\172\000\157\000\154\000\147\000\341\000\154\000\164\000\141
-\000\164\000\341\000\163\000\151\000\040\000\123\000\172\000\141
-\000\142\000\341\000\154\000\171\000\172\000\141\000\164\000\141
-\000\040\000\163\000\172\000\145\000\162\000\151\000\156\000\164
-\000\040\000\153\000\145\000\154\000\154\000\040\000\145\000\154
-\000\152\000\341\000\162\000\156\000\151\000\072\000\040\000\150
-\000\164\000\164\000\160\000\072\000\057\000\057\000\167\000\167
-\000\167\000\056\000\145\000\055\000\163\000\172\000\151\000\147
-\000\156\000\157\000\056\000\150\000\165\000\057\000\123\000\132
-\000\123\000\132\000\057\060\201\310\006\003\125\035\037\004\201
-\300\060\201\275\060\201\272\240\201\267\240\201\264\206\041\150
-\164\164\160\072\057\057\167\167\167\056\145\055\163\172\151\147
-\156\157\056\150\165\057\122\157\157\164\103\101\056\143\162\154
-\206\201\216\154\144\141\160\072\057\057\154\144\141\160\056\145
-\055\163\172\151\147\156\157\056\150\165\057\103\116\075\115\151
-\143\162\157\163\145\143\045\062\060\145\055\123\172\151\147\156
-\157\045\062\060\122\157\157\164\045\062\060\103\101\054\117\125
-\075\145\055\123\172\151\147\156\157\045\062\060\103\101\054\117
-\075\115\151\143\162\157\163\145\143\045\062\060\114\164\144\056
-\054\114\075\102\165\144\141\160\145\163\164\054\103\075\110\125
-\077\143\145\162\164\151\146\151\143\141\164\145\122\145\166\157
-\143\141\164\151\157\156\114\151\163\164\073\142\151\156\141\162
-\171\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001
-\006\060\201\226\006\003\125\035\021\004\201\216\060\201\213\201
-\020\151\156\146\157\100\145\055\163\172\151\147\156\157\056\150
-\165\244\167\060\165\061\043\060\041\006\003\125\004\003\014\032
-\115\151\143\162\157\163\145\143\040\145\055\123\172\151\147\156
-\303\263\040\122\157\157\164\040\103\101\061\026\060\024\006\003
-\125\004\013\014\015\145\055\123\172\151\147\156\303\263\040\110
-\123\132\061\026\060\024\006\003\125\004\012\023\015\115\151\143
-\162\157\163\145\143\040\113\146\164\056\061\021\060\017\006\003
-\125\004\007\023\010\102\165\144\141\160\145\163\164\061\013\060
-\011\006\003\125\004\006\023\002\110\125\060\201\254\006\003\125
-\035\043\004\201\244\060\201\241\200\024\307\240\111\165\026\141
-\204\333\061\113\204\322\361\067\100\220\357\116\334\367\241\166
-\244\164\060\162\061\013\060\011\006\003\125\004\006\023\002\110
-\125\061\021\060\017\006\003\125\004\007\023\010\102\165\144\141
-\160\145\163\164\061\026\060\024\006\003\125\004\012\023\015\115
-\151\143\162\157\163\145\143\040\114\164\144\056\061\024\060\022
-\006\003\125\004\013\023\013\145\055\123\172\151\147\156\157\040
-\103\101\061\042\060\040\006\003\125\004\003\023\031\115\151\143
-\162\157\163\145\143\040\145\055\123\172\151\147\156\157\040\122
-\157\157\164\040\103\101\202\021\000\314\270\347\277\116\051\032
-\375\242\334\146\245\034\054\017\021\060\035\006\003\125\035\016
-\004\026\004\024\307\240\111\165\026\141\204\333\061\113\204\322
-\361\067\100\220\357\116\334\367\060\015\006\011\052\206\110\206
-\367\015\001\001\005\005\000\003\202\001\001\000\323\023\234\146
-\143\131\056\312\134\160\014\374\203\274\125\261\364\216\007\154
-\146\047\316\301\073\040\251\034\273\106\124\160\356\132\314\240
-\167\352\150\104\047\353\362\051\335\167\251\325\373\343\324\247
-\004\304\225\270\013\341\104\150\140\007\103\060\061\102\141\345
-\356\331\345\044\325\033\337\341\112\033\252\237\307\137\370\172
-\021\352\023\223\000\312\212\130\261\356\355\016\115\264\327\250
-\066\046\174\340\072\301\325\127\202\361\165\266\375\211\137\332
-\363\250\070\237\065\006\010\316\042\225\276\315\325\374\276\133
-\336\171\153\334\172\251\145\146\276\261\045\132\137\355\176\323
-\254\106\155\114\364\062\207\264\040\004\340\154\170\260\167\321
-\205\106\113\246\022\267\165\350\112\311\126\154\327\222\253\235
-\365\111\070\322\117\123\343\125\220\021\333\230\226\306\111\362
-\076\364\237\033\340\367\210\334\045\142\231\104\330\163\277\077
-\060\363\014\067\076\324\302\050\200\163\261\001\267\235\132\226
-\024\001\113\251\021\235\051\152\056\320\135\201\300\317\262\040
-\103\307\003\340\067\116\135\012\334\131\040\045
-END
-
-# Trust for Certificate "Microsec e-Szigno Root CA"
-# Issuer: CN=Microsec e-Szigno Root CA,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU
-# Serial Number:00:cc:b8:e7:bf:4e:29:1a:fd:a2:dc:66:a5:1c:2c:0f:11
-# Subject: CN=Microsec e-Szigno Root CA,OU=e-Szigno CA,O=Microsec Ltd.,L=Budapest,C=HU
-# Not Valid Before: Wed Apr 06 12:28:44 2005
-# Not Valid After : Thu Apr 06 12:28:44 2017
-# Fingerprint (MD5): F0:96:B6:2F:C5:10:D5:67:8E:83:25:32:E8:5E:2E:E5
-# Fingerprint (SHA1): 23:88:C9:D3:71:CC:9E:96:3D:FF:7D:3C:A7:CE:FC:D6:25:EC:19:0D
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Microsec e-Szigno Root CA"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\043\210\311\323\161\314\236\226\075\377\175\074\247\316\374\326
-\045\354\031\015
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\360\226\266\057\305\020\325\147\216\203\045\062\350\136\056\345
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\162\061\013\060\011\006\003\125\004\006\023\002\110\125\061
-\021\060\017\006\003\125\004\007\023\010\102\165\144\141\160\145
-\163\164\061\026\060\024\006\003\125\004\012\023\015\115\151\143
-\162\157\163\145\143\040\114\164\144\056\061\024\060\022\006\003
-\125\004\013\023\013\145\055\123\172\151\147\156\157\040\103\101
-\061\042\060\040\006\003\125\004\003\023\031\115\151\143\162\157
-\163\145\143\040\145\055\123\172\151\147\156\157\040\122\157\157
-\164\040\103\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\021\000\314\270\347\277\116\051\032\375\242\334\146\245\034
-\054\017\021
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "Certigna"
-#
-# Issuer: CN=Certigna,O=Dhimyotis,C=FR
-# Serial Number:00:fe:dc:e3:01:0f:c9:48:ff
-# Subject: CN=Certigna,O=Dhimyotis,C=FR
-# Not Valid Before: Fri Jun 29 15:13:05 2007
-# Not Valid After : Tue Jun 29 15:13:05 2027
-# Fingerprint (MD5): AB:57:A6:5B:7D:42:82:19:B5:D8:58:26:28:5E:FD:FF
-# Fingerprint (SHA1): B1:2E:13:63:45:86:A4:6F:1A:B2:60:68:37:58:2D:C4:AC:FD:94:97
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Certigna"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\064\061\013\060\011\006\003\125\004\006\023\002\106\122\061
-\022\060\020\006\003\125\004\012\014\011\104\150\151\155\171\157
-\164\151\163\061\021\060\017\006\003\125\004\003\014\010\103\145
-\162\164\151\147\156\141
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\064\061\013\060\011\006\003\125\004\006\023\002\106\122\061
-\022\060\020\006\003\125\004\012\014\011\104\150\151\155\171\157
-\164\151\163\061\021\060\017\006\003\125\004\003\014\010\103\145
-\162\164\151\147\156\141
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\011\000\376\334\343\001\017\311\110\377
+\002\011\000\376\334\343\001\017\311\110\377
END
CKA_VALUE MULTILINE_OCTAL
\060\202\003\250\060\202\002\220\240\003\002\001\002\002\011\000
@@ -10414,6 +8922,7 @@ CKA_VALUE MULTILINE_OCTAL
\133\041\374\021\221\064\276\101\357\173\235\227\165\377\227\225
\300\226\130\057\352\273\106\327\273\344\331\056
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Certigna"
# Issuer: CN=Certigna,O=Dhimyotis,C=FR
@@ -10595,6 +9104,7 @@ CKA_VALUE MULTILINE_OCTAL
\053\257\134\331\355\107\167\140\016\073\017\036\322\300\334\144
\005\211\374\170\326\134\054\046\103\251
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AC Raiz Certicamara S.A."
# Issuer: CN=AC Ra..z Certic..mara S.A.,O=Sociedad Cameral de Certificaci..n Digital - Certic..mara S.A.,C=CO
@@ -10752,6 +9262,7 @@ CKA_VALUE MULTILINE_OCTAL
\346\222\303\201\301\063\273\210\036\241\347\342\264\275\061\154
\016\121\075\157\373\226\126\200\342\066\027\321\334\344
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "TC TrustCenter Class 3 CA II"
# Issuer: CN=TC TrustCenter Class 3 CA II,OU=TC TrustCenter Class 3 CA,O=TC TrustCenter GmbH,C=DE
@@ -10892,6 +9403,7 @@ CKA_VALUE MULTILINE_OCTAL
\012\155\272\071\143\050\206\222\363\030\204\330\373\321\317\005
\126\144\127
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Deutsche Telekom Root CA 2"
# Issuer: CN=Deutsche Telekom Root CA 2,OU=T-TeleSec Trust Center,O=Deutsche Telekom AG,C=DE
@@ -11024,6 +9536,7 @@ CKA_VALUE MULTILINE_OCTAL
\214\160\250\337\145\062\364\244\100\214\241\302\104\003\016\224
\000\147\240\161\000\202\110
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "ComSign CA"
# Issuer: C=IL,O=ComSign,CN=ComSign CA
@@ -11154,6 +9667,7 @@ CKA_VALUE MULTILINE_OCTAL
\072\064\127\120\072\157\201\136\006\306\365\076\174\116\216\053
\316\145\006\056\135\322\052\123\164\136\323\156\047\236\217
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "ComSign Secured CA"
# Issuer: C=IL,O=ComSign,CN=ComSign Secured CA
@@ -11283,6 +9797,7 @@ CKA_VALUE MULTILINE_OCTAL
\130\275\126\061\022\116\021\310\041\340\263\021\221\145\333\264
\246\210\070\316\125
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Cybertrust Global Root"
# Issuer: CN=Cybertrust Global Root,O="Cybertrust, Inc"
@@ -11449,6 +9964,7 @@ CKA_VALUE MULTILINE_OCTAL
\204\324\076\040\205\367\112\075\053\234\375\052\012\011\115\352
\201\370\021\234
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "ePKI Root Certification Authority"
# Issuer: OU=ePKI Root Certification Authority,O="Chunghwa Telecom Co., Ltd.",C=TW
@@ -11633,6 +10149,7 @@ CKA_VALUE MULTILINE_OCTAL
\202\176\044\014\235\375\201\067\343\045\250\355\066\116\225\054
\311\234\220\332\354\251\102\074\255\266\002
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "TUBITAK UEKAE Kok Sertifika Hizmet Saglayicisi - Surum 3"
# Issuer: CN=T..B..TAK UEKAE K..k Sertifika Hizmet Sa..lay..c..s.. - S..r..m ...,OU=Kamu Sertifikasyon Merkezi,OU=Ulusal Elektronik ve Kriptoloji Ara..t..rma Enstit..s.. - UEKAE,O=T..rkiye Bilimsel ve Teknolojik Ara..t..rma Kurumu - T..B..TAK,L=Gebze - Kocaeli,C=TR
@@ -11683,311 +10200,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "Buypass Class 2 CA 1"
-#
-# Issuer: CN=Buypass Class 2 CA 1,O=Buypass AS-983163327,C=NO
-# Serial Number: 1 (0x1)
-# Subject: CN=Buypass Class 2 CA 1,O=Buypass AS-983163327,C=NO
-# Not Valid Before: Fri Oct 13 10:25:09 2006
-# Not Valid After : Thu Oct 13 10:25:09 2016
-# Fingerprint (MD5): B8:08:9A:F0:03:CC:1B:0D:C8:6C:0B:76:A1:75:64:23
-# Fingerprint (SHA1): A0:A1:AB:90:C9:FC:84:7B:3B:12:61:E8:97:7D:5F:D3:22:61:D3:CC
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Buypass Class 2 CA 1"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\113\061\013\060\011\006\003\125\004\006\023\002\116\117\061
-\035\060\033\006\003\125\004\012\014\024\102\165\171\160\141\163
-\163\040\101\123\055\071\070\063\061\066\063\063\062\067\061\035
-\060\033\006\003\125\004\003\014\024\102\165\171\160\141\163\163
-\040\103\154\141\163\163\040\062\040\103\101\040\061
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\113\061\013\060\011\006\003\125\004\006\023\002\116\117\061
-\035\060\033\006\003\125\004\012\014\024\102\165\171\160\141\163
-\163\040\101\123\055\071\070\063\061\066\063\063\062\067\061\035
-\060\033\006\003\125\004\003\014\024\102\165\171\160\141\163\163
-\040\103\154\141\163\163\040\062\040\103\101\040\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\001
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\003\123\060\202\002\073\240\003\002\001\002\002\001\001
-\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
-\113\061\013\060\011\006\003\125\004\006\023\002\116\117\061\035
-\060\033\006\003\125\004\012\014\024\102\165\171\160\141\163\163
-\040\101\123\055\071\070\063\061\066\063\063\062\067\061\035\060
-\033\006\003\125\004\003\014\024\102\165\171\160\141\163\163\040
-\103\154\141\163\163\040\062\040\103\101\040\061\060\036\027\015
-\060\066\061\060\061\063\061\060\062\065\060\071\132\027\015\061
-\066\061\060\061\063\061\060\062\065\060\071\132\060\113\061\013
-\060\011\006\003\125\004\006\023\002\116\117\061\035\060\033\006
-\003\125\004\012\014\024\102\165\171\160\141\163\163\040\101\123
-\055\071\070\063\061\066\063\063\062\067\061\035\060\033\006\003
-\125\004\003\014\024\102\165\171\160\141\163\163\040\103\154\141
-\163\163\040\062\040\103\101\040\061\060\202\001\042\060\015\006
-\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001\017
-\000\060\202\001\012\002\202\001\001\000\213\074\007\105\330\366
-\337\346\307\312\272\215\103\305\107\215\260\132\301\070\333\222
-\204\034\257\023\324\017\157\066\106\040\304\056\314\161\160\064
-\242\064\323\067\056\330\335\072\167\057\300\353\051\350\134\322
-\265\251\221\064\207\042\131\376\314\333\347\231\257\226\301\250
-\307\100\335\245\025\214\156\310\174\227\003\313\346\040\362\327
-\227\137\061\241\057\067\322\276\356\276\251\255\250\114\236\041
-\146\103\073\250\274\363\011\243\070\325\131\044\301\302\107\166
-\261\210\134\202\073\273\053\246\004\327\214\007\217\315\325\101
-\035\360\256\270\051\054\224\122\140\064\224\073\332\340\070\321
-\235\063\076\025\364\223\062\305\000\332\265\051\146\016\072\170
-\017\041\122\137\002\345\222\173\045\323\222\036\057\025\235\201
-\344\235\216\350\357\211\316\024\114\124\035\034\201\022\115\160
-\250\276\020\005\027\176\037\321\270\127\125\355\315\273\122\302
-\260\036\170\302\115\066\150\313\126\046\301\122\301\275\166\367
-\130\325\162\176\037\104\166\273\000\211\035\026\235\121\065\357
-\115\302\126\357\153\340\214\073\015\351\002\003\001\000\001\243
-\102\060\100\060\017\006\003\125\035\023\001\001\377\004\005\060
-\003\001\001\377\060\035\006\003\125\035\016\004\026\004\024\077
-\215\232\131\213\374\173\173\234\243\257\070\260\071\355\220\161
-\200\326\310\060\016\006\003\125\035\017\001\001\377\004\004\003
-\002\001\006\060\015\006\011\052\206\110\206\367\015\001\001\005
-\005\000\003\202\001\001\000\025\032\176\023\212\271\350\007\243
-\113\047\062\262\100\221\362\041\321\144\205\276\143\152\322\317
-\201\302\025\325\172\176\014\051\254\067\036\034\174\166\122\225
-\332\265\177\043\241\051\167\145\311\062\235\250\056\126\253\140
-\166\316\026\264\215\177\170\300\325\231\121\203\177\136\331\276
-\014\250\120\355\042\307\255\005\114\166\373\355\356\036\107\144
-\366\367\047\175\134\050\017\105\305\134\142\136\246\232\221\221
-\267\123\027\056\334\255\140\235\226\144\071\275\147\150\262\256
-\005\313\115\347\137\037\127\206\325\040\234\050\373\157\023\070
-\365\366\021\222\366\175\231\136\037\014\350\253\104\044\051\162
-\100\075\066\122\257\214\130\220\163\301\354\141\054\171\241\354
-\207\265\077\332\115\331\041\000\060\336\220\332\016\323\032\110
-\251\076\205\013\024\213\214\274\101\236\152\367\016\160\300\065
-\367\071\242\135\146\320\173\131\237\250\107\022\232\047\043\244
-\055\216\047\203\222\040\241\327\025\177\361\056\030\356\364\110
-\177\057\177\361\241\030\265\241\013\224\240\142\040\062\234\035
-\366\324\357\277\114\210\150
-END
-
-# Trust for Certificate "Buypass Class 2 CA 1"
-# Issuer: CN=Buypass Class 2 CA 1,O=Buypass AS-983163327,C=NO
-# Serial Number: 1 (0x1)
-# Subject: CN=Buypass Class 2 CA 1,O=Buypass AS-983163327,C=NO
-# Not Valid Before: Fri Oct 13 10:25:09 2006
-# Not Valid After : Thu Oct 13 10:25:09 2016
-# Fingerprint (MD5): B8:08:9A:F0:03:CC:1B:0D:C8:6C:0B:76:A1:75:64:23
-# Fingerprint (SHA1): A0:A1:AB:90:C9:FC:84:7B:3B:12:61:E8:97:7D:5F:D3:22:61:D3:CC
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Buypass Class 2 CA 1"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\240\241\253\220\311\374\204\173\073\022\141\350\227\175\137\323
-\042\141\323\314
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\270\010\232\360\003\314\033\015\310\154\013\166\241\165\144\043
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\113\061\013\060\011\006\003\125\004\006\023\002\116\117\061
-\035\060\033\006\003\125\004\012\014\024\102\165\171\160\141\163
-\163\040\101\123\055\071\070\063\061\066\063\063\062\067\061\035
-\060\033\006\003\125\004\003\014\024\102\165\171\160\141\163\163
-\040\103\154\141\163\163\040\062\040\103\101\040\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\001
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "EBG Elektronik Sertifika Hizmet Saglayicisi"
-#
-# Issuer: C=TR,O=EBG Bili..im Teknolojileri ve Hizmetleri A....,CN=EBG Elektronik Sertifika Hizmet Sa..lay..c..s..
-# Serial Number:4c:af:73:42:1c:8e:74:02
-# Subject: C=TR,O=EBG Bili..im Teknolojileri ve Hizmetleri A....,CN=EBG Elektronik Sertifika Hizmet Sa..lay..c..s..
-# Not Valid Before: Thu Aug 17 00:21:09 2006
-# Not Valid After : Sun Aug 14 00:31:09 2016
-# Fingerprint (MD5): 2C:20:26:9D:CB:1A:4A:00:85:B5:B7:5A:AE:C2:01:37
-# Fingerprint (SHA1): 8C:96:BA:EB:DD:2B:07:07:48:EE:30:32:66:A0:F3:98:6E:7C:AE:58
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\200\061\070\060\066\006\003\125\004\003\014\057\105\102
-\107\040\105\154\145\153\164\162\157\156\151\153\040\123\145\162
-\164\151\146\151\153\141\040\110\151\172\155\145\164\040\123\141
-\304\237\154\141\171\304\261\143\304\261\163\304\261\061\067\060
-\065\006\003\125\004\012\014\056\105\102\107\040\102\151\154\151
-\305\237\151\155\040\124\145\153\156\157\154\157\152\151\154\145
-\162\151\040\166\145\040\110\151\172\155\145\164\154\145\162\151
-\040\101\056\305\236\056\061\013\060\011\006\003\125\004\006\023
-\002\124\122
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\200\061\070\060\066\006\003\125\004\003\014\057\105\102
-\107\040\105\154\145\153\164\162\157\156\151\153\040\123\145\162
-\164\151\146\151\153\141\040\110\151\172\155\145\164\040\123\141
-\304\237\154\141\171\304\261\143\304\261\163\304\261\061\067\060
-\065\006\003\125\004\012\014\056\105\102\107\040\102\151\154\151
-\305\237\151\155\040\124\145\153\156\157\154\157\152\151\154\145
-\162\151\040\166\145\040\110\151\172\155\145\164\154\145\162\151
-\040\101\056\305\236\056\061\013\060\011\006\003\125\004\006\023
-\002\124\122
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\114\257\163\102\034\216\164\002
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\005\347\060\202\003\317\240\003\002\001\002\002\010\114
-\257\163\102\034\216\164\002\060\015\006\011\052\206\110\206\367
-\015\001\001\005\005\000\060\201\200\061\070\060\066\006\003\125
-\004\003\014\057\105\102\107\040\105\154\145\153\164\162\157\156
-\151\153\040\123\145\162\164\151\146\151\153\141\040\110\151\172
-\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304\261
-\163\304\261\061\067\060\065\006\003\125\004\012\014\056\105\102
-\107\040\102\151\154\151\305\237\151\155\040\124\145\153\156\157
-\154\157\152\151\154\145\162\151\040\166\145\040\110\151\172\155
-\145\164\154\145\162\151\040\101\056\305\236\056\061\013\060\011
-\006\003\125\004\006\023\002\124\122\060\036\027\015\060\066\060
-\070\061\067\060\060\062\061\060\071\132\027\015\061\066\060\070
-\061\064\060\060\063\061\060\071\132\060\201\200\061\070\060\066
-\006\003\125\004\003\014\057\105\102\107\040\105\154\145\153\164
-\162\157\156\151\153\040\123\145\162\164\151\146\151\153\141\040
-\110\151\172\155\145\164\040\123\141\304\237\154\141\171\304\261
-\143\304\261\163\304\261\061\067\060\065\006\003\125\004\012\014
-\056\105\102\107\040\102\151\154\151\305\237\151\155\040\124\145
-\153\156\157\154\157\152\151\154\145\162\151\040\166\145\040\110
-\151\172\155\145\164\154\145\162\151\040\101\056\305\236\056\061
-\013\060\011\006\003\125\004\006\023\002\124\122\060\202\002\042
-\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003
-\202\002\017\000\060\202\002\012\002\202\002\001\000\356\240\204
-\141\320\072\152\146\020\062\330\061\070\177\247\247\345\375\241
-\341\373\227\167\270\161\226\350\023\226\106\203\117\266\362\137
-\162\126\156\023\140\245\001\221\342\133\305\315\127\037\167\143
-\121\377\057\075\333\271\077\252\251\065\347\171\320\365\320\044
-\266\041\352\353\043\224\376\051\277\373\211\221\014\144\232\005
-\112\053\314\014\356\361\075\233\202\151\244\114\370\232\157\347
-\042\332\020\272\137\222\374\030\047\012\250\252\104\372\056\054
-\264\373\106\232\010\003\203\162\253\210\344\152\162\311\345\145
-\037\156\052\017\235\263\350\073\344\014\156\172\332\127\375\327
-\353\171\213\136\040\006\323\166\013\154\002\225\243\226\344\313
-\166\121\321\050\235\241\032\374\104\242\115\314\172\166\250\015
-\075\277\027\117\042\210\120\375\256\266\354\220\120\112\133\237
-\225\101\252\312\017\262\112\376\200\231\116\243\106\025\253\370
-\163\102\152\302\146\166\261\012\046\025\335\223\222\354\333\251
-\137\124\042\122\221\160\135\023\352\110\354\156\003\154\331\335
-\154\374\353\015\003\377\246\203\022\233\361\251\223\017\305\046
-\114\061\262\143\231\141\162\347\052\144\231\322\270\351\165\342
-\174\251\251\232\032\252\303\126\333\020\232\074\203\122\266\173
-\226\267\254\207\167\250\271\362\147\013\224\103\263\257\076\163
-\372\102\066\261\045\305\012\061\046\067\126\147\272\243\013\175
-\326\367\211\315\147\241\267\072\036\146\117\366\240\125\024\045
-\114\054\063\015\246\101\214\275\004\061\152\020\162\012\235\016
-\056\166\275\136\363\121\211\213\250\077\125\163\277\333\072\306
-\044\005\226\222\110\252\113\215\052\003\345\127\221\020\364\152
-\050\025\156\107\167\204\134\121\164\237\031\351\346\036\143\026
-\071\343\021\025\343\130\032\104\275\313\304\154\146\327\204\006
-\337\060\364\067\242\103\042\171\322\020\154\337\273\346\023\021
-\374\235\204\012\023\173\360\073\320\374\243\012\327\211\352\226
-\176\215\110\205\036\144\137\333\124\242\254\325\172\002\171\153
-\322\212\360\147\332\145\162\015\024\160\344\351\216\170\217\062
-\164\174\127\362\326\326\364\066\211\033\370\051\154\213\271\366
-\227\321\244\056\252\276\013\031\302\105\351\160\135\002\003\000
-\235\331\243\143\060\141\060\017\006\003\125\035\023\001\001\377
-\004\005\060\003\001\001\377\060\016\006\003\125\035\017\001\001
-\377\004\004\003\002\001\006\060\035\006\003\125\035\016\004\026
-\004\024\347\316\306\117\374\026\147\226\372\112\243\007\301\004
-\247\313\152\336\332\107\060\037\006\003\125\035\043\004\030\060
-\026\200\024\347\316\306\117\374\026\147\226\372\112\243\007\301
-\004\247\313\152\336\332\107\060\015\006\011\052\206\110\206\367
-\015\001\001\005\005\000\003\202\002\001\000\233\230\232\135\276
-\363\050\043\166\306\154\367\177\346\100\236\300\066\334\225\015
-\035\255\025\305\066\330\325\071\357\362\036\042\136\263\202\264
-\135\273\114\032\312\222\015\337\107\044\036\263\044\332\221\210
-\351\203\160\335\223\327\351\272\263\337\026\132\076\336\340\310
-\373\323\375\154\051\370\025\106\240\150\046\314\223\122\256\202
-\001\223\220\312\167\312\115\111\357\342\132\331\052\275\060\316
-\114\262\201\266\060\316\131\117\332\131\035\152\172\244\105\260
-\202\046\201\206\166\365\365\020\000\270\356\263\011\350\117\207
-\002\007\256\044\134\360\137\254\012\060\314\212\100\240\163\004
-\301\373\211\044\366\232\034\134\267\074\012\147\066\005\010\061
-\263\257\330\001\150\052\340\170\217\164\336\270\121\244\214\154
-\040\075\242\373\263\324\011\375\173\302\200\252\223\154\051\230
-\041\250\273\026\363\251\022\137\164\265\207\230\362\225\046\337
-\064\357\212\123\221\210\135\032\224\243\077\174\042\370\327\210
-\272\246\214\226\250\075\122\064\142\237\000\036\124\125\102\147
-\306\115\106\217\273\024\105\075\012\226\026\216\020\241\227\231
-\325\323\060\205\314\336\264\162\267\274\212\074\030\051\150\375
-\334\161\007\356\044\071\152\372\355\245\254\070\057\371\036\020
-\016\006\161\032\020\114\376\165\176\377\036\127\071\102\312\327
-\341\025\241\126\125\131\033\321\243\257\021\330\116\303\245\053
-\357\220\277\300\354\202\023\133\215\326\162\054\223\116\217\152
-\051\337\205\074\323\015\340\242\030\022\314\125\057\107\267\247
-\233\002\376\101\366\210\114\155\332\251\001\107\203\144\047\142
-\020\202\326\022\173\136\003\037\064\251\311\221\376\257\135\155
-\206\047\267\043\252\165\030\312\040\347\260\017\327\211\016\246
-\147\042\143\364\203\101\053\006\113\273\130\325\321\327\267\271
-\020\143\330\211\112\264\252\335\026\143\365\156\276\140\241\370
-\355\350\326\220\117\032\306\305\240\051\323\247\041\250\365\132
-\074\367\307\111\242\041\232\112\225\122\040\226\162\232\146\313
-\367\322\206\103\174\042\276\226\371\275\001\250\107\335\345\073
-\100\371\165\053\233\053\106\144\206\215\036\364\217\373\007\167
-\320\352\111\242\034\215\122\024\246\012\223
-END
-
-# Trust for Certificate "EBG Elektronik Sertifika Hizmet Saglayicisi"
-# Issuer: C=TR,O=EBG Bili..im Teknolojileri ve Hizmetleri A....,CN=EBG Elektronik Sertifika Hizmet Sa..lay..c..s..
-# Serial Number:4c:af:73:42:1c:8e:74:02
-# Subject: C=TR,O=EBG Bili..im Teknolojileri ve Hizmetleri A....,CN=EBG Elektronik Sertifika Hizmet Sa..lay..c..s..
-# Not Valid Before: Thu Aug 17 00:21:09 2006
-# Not Valid After : Sun Aug 14 00:31:09 2016
-# Fingerprint (MD5): 2C:20:26:9D:CB:1A:4A:00:85:B5:B7:5A:AE:C2:01:37
-# Fingerprint (SHA1): 8C:96:BA:EB:DD:2B:07:07:48:EE:30:32:66:A0:F3:98:6E:7C:AE:58
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\214\226\272\353\335\053\007\007\110\356\060\062\146\240\363\230
-\156\174\256\130
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\054\040\046\235\313\032\112\000\205\265\267\132\256\302\001\067
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\200\061\070\060\066\006\003\125\004\003\014\057\105\102
-\107\040\105\154\145\153\164\162\157\156\151\153\040\123\145\162
-\164\151\146\151\153\141\040\110\151\172\155\145\164\040\123\141
-\304\237\154\141\171\304\261\143\304\261\163\304\261\061\067\060
-\065\006\003\125\004\012\014\056\105\102\107\040\102\151\154\151
-\305\237\151\155\040\124\145\153\156\157\154\157\152\151\154\145
-\162\151\040\166\145\040\110\151\172\155\145\164\154\145\162\151
-\040\101\056\305\236\056\061\013\060\011\006\003\125\004\006\023
-\002\124\122
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\114\257\163\102\034\216\164\002
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "certSIGN ROOT CA"
#
@@ -12074,6 +10286,7 @@ CKA_VALUE MULTILINE_OCTAL
\025\147\336\236\166\020\142\040\276\125\151\225\103\000\071\115
\366\356\260\132\116\111\104\124\130\137\102\203
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "certSIGN ROOT CA"
# Issuer: OU=certSIGN ROOT CA,O=certSIGN,C=RO
@@ -12197,6 +10410,7 @@ CKA_VALUE MULTILINE_OCTAL
\056\042\224\011\310\134\352\074\201\135\026\052\003\227\026\125
\011\333\212\101\202\236\146\233\021
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "CNNIC ROOT"
# Issuer: CN=CNNIC ROOT,O=CNNIC,C=CN
@@ -12232,137 +10446,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "ApplicationCA - Japanese Government"
-#
-# Issuer: OU=ApplicationCA,O=Japanese Government,C=JP
-# Serial Number: 49 (0x31)
-# Subject: OU=ApplicationCA,O=Japanese Government,C=JP
-# Not Valid Before: Wed Dec 12 15:00:00 2007
-# Not Valid After : Tue Dec 12 15:00:00 2017
-# Fingerprint (MD5): 7E:23:4E:5B:A7:A5:B4:25:E9:00:07:74:11:62:AE:D6
-# Fingerprint (SHA1): 7F:8A:B0:CF:D0:51:87:6A:66:F3:36:0F:47:C8:8D:8C:D3:35:FC:74
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "ApplicationCA - Japanese Government"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\103\061\013\060\011\006\003\125\004\006\023\002\112\120\061
-\034\060\032\006\003\125\004\012\023\023\112\141\160\141\156\145
-\163\145\040\107\157\166\145\162\156\155\145\156\164\061\026\060
-\024\006\003\125\004\013\023\015\101\160\160\154\151\143\141\164
-\151\157\156\103\101
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\103\061\013\060\011\006\003\125\004\006\023\002\112\120\061
-\034\060\032\006\003\125\004\012\023\023\112\141\160\141\156\145
-\163\145\040\107\157\166\145\162\156\155\145\156\164\061\026\060
-\024\006\003\125\004\013\023\015\101\160\160\154\151\143\141\164
-\151\157\156\103\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\061
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\003\240\060\202\002\210\240\003\002\001\002\002\001\061
-\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
-\103\061\013\060\011\006\003\125\004\006\023\002\112\120\061\034
-\060\032\006\003\125\004\012\023\023\112\141\160\141\156\145\163
-\145\040\107\157\166\145\162\156\155\145\156\164\061\026\060\024
-\006\003\125\004\013\023\015\101\160\160\154\151\143\141\164\151
-\157\156\103\101\060\036\027\015\060\067\061\062\061\062\061\065
-\060\060\060\060\132\027\015\061\067\061\062\061\062\061\065\060
-\060\060\060\132\060\103\061\013\060\011\006\003\125\004\006\023
-\002\112\120\061\034\060\032\006\003\125\004\012\023\023\112\141
-\160\141\156\145\163\145\040\107\157\166\145\162\156\155\145\156
-\164\061\026\060\024\006\003\125\004\013\023\015\101\160\160\154
-\151\143\141\164\151\157\156\103\101\060\202\001\042\060\015\006
-\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001\017
-\000\060\202\001\012\002\202\001\001\000\247\155\340\164\116\207
-\217\245\006\336\150\242\333\206\231\113\144\015\161\360\012\005
-\233\216\252\341\314\056\322\152\073\301\172\264\227\141\215\212
-\276\306\232\234\006\264\206\121\344\067\016\164\170\176\137\212
-\177\224\244\327\107\010\375\120\132\126\344\150\254\050\163\240
-\173\351\177\030\222\100\117\055\235\365\256\104\110\163\066\006
-\236\144\054\073\064\043\333\134\046\344\161\171\217\324\156\171
-\042\271\223\301\312\315\301\126\355\210\152\327\240\071\041\004
-\127\054\242\365\274\107\101\117\136\064\042\225\265\037\051\155
-\136\112\363\115\162\276\101\126\040\207\374\351\120\107\327\060
-\024\356\134\214\125\272\131\215\207\374\043\336\223\320\004\214
-\375\357\155\275\320\172\311\245\072\152\162\063\306\112\015\005
-\027\052\055\173\261\247\330\326\360\276\364\077\352\016\050\155
-\101\141\043\166\170\303\270\145\244\363\132\256\314\302\252\331
-\347\130\336\266\176\235\205\156\237\052\012\157\237\003\051\060
-\227\050\035\274\267\317\124\051\116\121\061\371\047\266\050\046
-\376\242\143\346\101\026\360\063\230\107\002\003\001\000\001\243
-\201\236\060\201\233\060\035\006\003\125\035\016\004\026\004\024
-\124\132\313\046\077\161\314\224\106\015\226\123\352\153\110\320
-\223\376\102\165\060\016\006\003\125\035\017\001\001\377\004\004
-\003\002\001\006\060\131\006\003\125\035\021\004\122\060\120\244
-\116\060\114\061\013\060\011\006\003\125\004\006\023\002\112\120
-\061\030\060\026\006\003\125\004\012\014\017\346\227\245\346\234
-\254\345\233\275\346\224\277\345\272\234\061\043\060\041\006\003
-\125\004\013\014\032\343\202\242\343\203\227\343\203\252\343\202
-\261\343\203\274\343\202\267\343\203\247\343\203\263\103\101\060
-\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377
-\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\003
-\202\001\001\000\071\152\104\166\167\070\072\354\243\147\106\017
-\371\213\006\250\373\152\220\061\316\176\354\332\321\211\174\172
-\353\056\014\275\231\062\347\260\044\326\303\377\365\262\210\011
-\207\054\343\124\341\243\246\262\010\013\300\205\250\310\322\234
-\161\366\035\237\140\374\070\063\023\341\236\334\013\137\332\026
-\120\051\173\057\160\221\017\231\272\064\064\215\225\164\305\176
-\170\251\146\135\275\312\041\167\102\020\254\146\046\075\336\221
-\253\375\025\360\157\355\154\137\020\370\363\026\366\003\212\217
-\247\022\021\014\313\375\077\171\301\234\375\142\356\243\317\124
-\014\321\053\137\027\076\343\076\277\300\053\076\011\233\376\210
-\246\176\264\222\027\374\043\224\201\275\156\247\305\214\302\353
-\021\105\333\370\101\311\226\166\352\160\137\171\022\153\344\243
-\007\132\005\357\047\111\317\041\237\212\114\011\160\146\251\046
-\301\053\021\116\063\322\016\374\326\154\322\016\062\144\150\377
-\255\005\170\137\003\035\250\343\220\254\044\340\017\100\247\113
-\256\213\050\267\202\312\030\007\346\267\133\164\351\040\031\177
-\262\033\211\124
-END
-
-# Trust for Certificate "ApplicationCA - Japanese Government"
-# Issuer: OU=ApplicationCA,O=Japanese Government,C=JP
-# Serial Number: 49 (0x31)
-# Subject: OU=ApplicationCA,O=Japanese Government,C=JP
-# Not Valid Before: Wed Dec 12 15:00:00 2007
-# Not Valid After : Tue Dec 12 15:00:00 2017
-# Fingerprint (MD5): 7E:23:4E:5B:A7:A5:B4:25:E9:00:07:74:11:62:AE:D6
-# Fingerprint (SHA1): 7F:8A:B0:CF:D0:51:87:6A:66:F3:36:0F:47:C8:8D:8C:D3:35:FC:74
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "ApplicationCA - Japanese Government"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\177\212\260\317\320\121\207\152\146\363\066\017\107\310\215\214
-\323\065\374\164
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\176\043\116\133\247\245\264\045\351\000\007\164\021\142\256\326
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\103\061\013\060\011\006\003\125\004\006\023\002\112\120\061
-\034\060\032\006\003\125\004\012\023\023\112\141\160\141\156\145
-\163\145\040\107\157\166\145\162\156\155\145\156\164\061\026\060
-\024\006\003\125\004\013\023\015\101\160\160\154\151\143\141\164
-\151\157\156\103\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\001\061
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "GeoTrust Primary Certification Authority - G3"
#
@@ -12475,6 +10558,7 @@ CKA_VALUE MULTILINE_OCTAL
\262\231\042\341\301\053\307\234\370\363\137\250\202\022\353\031
\021\055
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GeoTrust Primary Certification Authority - G3"
# Issuer: CN=GeoTrust Primary Certification Authority - G3,OU=(c) 2008 GeoTrust Inc. - For authorized use only,O=GeoTrust Inc.,C=US
@@ -12603,6 +10687,7 @@ CKA_VALUE MULTILINE_OCTAL
\135\235\312\256\275\023\051\104\015\047\133\250\347\150\234\022
\367\130\077\056\162\002\127\243\217\241\024\056
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "thawte Primary Root CA - G2"
# Issuer: CN=thawte Primary Root CA - G2,OU="(c) 2007 thawte, Inc. - For authorized use only",O="thawte, Inc.",C=US
@@ -12762,6 +10847,7 @@ CKA_VALUE MULTILINE_OCTAL
\034\302\171\334\166\051\257\316\305\054\144\004\136\210\066\156
\061\324\100\032\142\064\066\077\065\001\256\254\143\240
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "thawte Primary Root CA - G3"
# Issuer: CN=thawte Primary Root CA - G3,OU="(c) 2008 thawte, Inc. - For authorized use only",OU=Certification Services Division,O="thawte, Inc.",C=US
@@ -12897,6 +10983,7 @@ CKA_VALUE MULTILINE_OCTAL
\254\076\250\201\022\320\313\272\320\222\013\266\236\226\252\004
\017\212
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GeoTrust Primary Certification Authority - G2"
# Issuer: CN=GeoTrust Primary Certification Authority - G2,OU=(c) 2007 GeoTrust Inc. - For authorized use only,O=GeoTrust Inc.,C=US
@@ -13066,6 +11153,7 @@ CKA_VALUE MULTILINE_OCTAL
\377\303\125\210\203\113\357\005\222\006\161\362\270\230\223\267
\354\315\202\141\361\070\346\117\227\230\052\132\215
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "VeriSign Universal Root Certification Authority"
# Issuer: CN=VeriSign Universal Root Certification Authority,OU="(c) 2008 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
@@ -13220,6 +11308,7 @@ CKA_VALUE MULTILINE_OCTAL
\051\337\033\052\141\173\161\321\336\363\300\345\015\072\112\252
\055\247\330\206\052\335\056\020
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "VeriSign Class 3 Public Primary Certification Authority - G4"
# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G4,OU="(c) 2007 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
@@ -13379,6 +11468,7 @@ CKA_VALUE MULTILINE_OCTAL
\264\056\165\225\200\121\152\113\060\246\260\142\241\223\361\233
\330\316\304\143\165\077\131\107\261
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "NetLock Arany (Class Gold) Főtanúsítvány"
# Issuer: CN=NetLock Arany (Class Gold) F..tan..s..tv..ny,OU=Tan..s..tv..nykiad..k (Certification Services),O=NetLock Kft.,L=Budapest,C=HU
@@ -13552,6 +11642,7 @@ CKA_VALUE MULTILINE_OCTAL
\203\213\235\036\322\122\244\314\035\157\260\230\155\224\061\265
\370\161\012\334\271\374\175\062\140\346\353\257\212\001
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Staat der Nederlanden Root CA - G2"
# Issuer: CN=Staat der Nederlanden Root CA - G2,O=Staat der Nederlanden,C=NL
@@ -13589,160 +11680,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "Juur-SK"
-#
-# Issuer: CN=Juur-SK,O=AS Sertifitseerimiskeskus,C=EE,E=pki@sk.ee
-# Serial Number: 999181308 (0x3b8e4bfc)
-# Subject: CN=Juur-SK,O=AS Sertifitseerimiskeskus,C=EE,E=pki@sk.ee
-# Not Valid Before: Thu Aug 30 14:23:01 2001
-# Not Valid After : Fri Aug 26 14:23:01 2016
-# Fingerprint (MD5): AA:8E:5D:D9:F8:DB:0A:58:B7:8D:26:87:6C:82:35:55
-# Fingerprint (SHA1): 40:9D:4B:D9:17:B5:5C:27:B6:9B:64:CB:98:22:44:0D:CD:09:B8:89
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Juur-SK"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\135\061\030\060\026\006\011\052\206\110\206\367\015\001\011
-\001\026\011\160\153\151\100\163\153\056\145\145\061\013\060\011
-\006\003\125\004\006\023\002\105\105\061\042\060\040\006\003\125
-\004\012\023\031\101\123\040\123\145\162\164\151\146\151\164\163
-\145\145\162\151\155\151\163\153\145\163\153\165\163\061\020\060
-\016\006\003\125\004\003\023\007\112\165\165\162\055\123\113
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\135\061\030\060\026\006\011\052\206\110\206\367\015\001\011
-\001\026\011\160\153\151\100\163\153\056\145\145\061\013\060\011
-\006\003\125\004\006\023\002\105\105\061\042\060\040\006\003\125
-\004\012\023\031\101\123\040\123\145\162\164\151\146\151\164\163
-\145\145\162\151\155\151\163\153\145\163\153\165\163\061\020\060
-\016\006\003\125\004\003\023\007\112\165\165\162\055\123\113
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\004\073\216\113\374
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\004\346\060\202\003\316\240\003\002\001\002\002\004\073
-\216\113\374\060\015\006\011\052\206\110\206\367\015\001\001\005
-\005\000\060\135\061\030\060\026\006\011\052\206\110\206\367\015
-\001\011\001\026\011\160\153\151\100\163\153\056\145\145\061\013
-\060\011\006\003\125\004\006\023\002\105\105\061\042\060\040\006
-\003\125\004\012\023\031\101\123\040\123\145\162\164\151\146\151
-\164\163\145\145\162\151\155\151\163\153\145\163\153\165\163\061
-\020\060\016\006\003\125\004\003\023\007\112\165\165\162\055\123
-\113\060\036\027\015\060\061\060\070\063\060\061\064\062\063\060
-\061\132\027\015\061\066\060\070\062\066\061\064\062\063\060\061
-\132\060\135\061\030\060\026\006\011\052\206\110\206\367\015\001
-\011\001\026\011\160\153\151\100\163\153\056\145\145\061\013\060
-\011\006\003\125\004\006\023\002\105\105\061\042\060\040\006\003
-\125\004\012\023\031\101\123\040\123\145\162\164\151\146\151\164
-\163\145\145\162\151\155\151\163\153\145\163\153\165\163\061\020
-\060\016\006\003\125\004\003\023\007\112\165\165\162\055\123\113
-\060\202\001\042\060\015\006\011\052\206\110\206\367\015\001\001
-\001\005\000\003\202\001\017\000\060\202\001\012\002\202\001\001
-\000\201\161\066\076\063\007\326\343\060\215\023\176\167\062\106
-\313\317\031\262\140\061\106\227\206\364\230\106\244\302\145\105
-\317\323\100\174\343\132\042\250\020\170\063\314\210\261\323\201
-\112\366\142\027\173\137\115\012\056\320\317\213\043\356\117\002
-\116\273\353\016\312\275\030\143\350\200\034\215\341\034\215\075
-\340\377\133\137\352\144\345\227\350\077\231\177\014\012\011\063
-\000\032\123\247\041\341\070\113\326\203\033\255\257\144\302\371
-\034\172\214\146\110\115\146\037\030\012\342\076\273\037\007\145
-\223\205\271\032\260\271\304\373\015\021\366\365\326\371\033\307
-\054\053\267\030\121\376\340\173\366\250\110\257\154\073\117\057
-\357\370\321\107\036\046\127\360\121\035\063\226\377\357\131\075
-\332\115\321\025\064\307\352\077\026\110\173\221\034\200\103\017
-\075\270\005\076\321\263\225\315\330\312\017\302\103\147\333\267
-\223\340\042\202\056\276\365\150\050\203\271\301\073\151\173\040
-\332\116\234\155\341\272\315\217\172\154\260\011\042\327\213\013
-\333\034\325\132\046\133\015\300\352\345\140\320\237\376\065\337
-\077\002\003\001\000\001\243\202\001\254\060\202\001\250\060\017
-\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060
-\202\001\026\006\003\125\035\040\004\202\001\015\060\202\001\011
-\060\202\001\005\006\012\053\006\001\004\001\316\037\001\001\001
-\060\201\366\060\201\320\006\010\053\006\001\005\005\007\002\002
-\060\201\303\036\201\300\000\123\000\145\000\145\000\040\000\163
-\000\145\000\162\000\164\000\151\000\146\000\151\000\153\000\141
-\000\141\000\164\000\040\000\157\000\156\000\040\000\166\000\344
-\000\154\000\152\000\141\000\163\000\164\000\141\000\164\000\165
-\000\144\000\040\000\101\000\123\000\055\000\151\000\163\000\040
-\000\123\000\145\000\162\000\164\000\151\000\146\000\151\000\164
-\000\163\000\145\000\145\000\162\000\151\000\155\000\151\000\163
-\000\153\000\145\000\163\000\153\000\165\000\163\000\040\000\141
-\000\154\000\141\000\155\000\055\000\123\000\113\000\040\000\163
-\000\145\000\162\000\164\000\151\000\146\000\151\000\153\000\141
-\000\141\000\164\000\151\000\144\000\145\000\040\000\153\000\151
-\000\156\000\156\000\151\000\164\000\141\000\155\000\151\000\163
-\000\145\000\153\000\163\060\041\006\010\053\006\001\005\005\007
-\002\001\026\025\150\164\164\160\072\057\057\167\167\167\056\163
-\153\056\145\145\057\143\160\163\057\060\053\006\003\125\035\037
-\004\044\060\042\060\040\240\036\240\034\206\032\150\164\164\160
-\072\057\057\167\167\167\056\163\153\056\145\145\057\152\165\165
-\162\057\143\162\154\057\060\035\006\003\125\035\016\004\026\004
-\024\004\252\172\107\243\344\211\257\032\317\012\100\247\030\077
-\157\357\351\175\276\060\037\006\003\125\035\043\004\030\060\026
-\200\024\004\252\172\107\243\344\211\257\032\317\012\100\247\030
-\077\157\357\351\175\276\060\016\006\003\125\035\017\001\001\377
-\004\004\003\002\001\346\060\015\006\011\052\206\110\206\367\015
-\001\001\005\005\000\003\202\001\001\000\173\301\030\224\123\242
-\011\363\376\046\147\232\120\344\303\005\057\053\065\170\221\114
-\174\250\021\021\171\114\111\131\254\310\367\205\145\134\106\273
-\073\020\240\002\257\315\117\265\314\066\052\354\135\376\357\240
-\221\311\266\223\157\174\200\124\354\307\010\160\015\216\373\202
-\354\052\140\170\151\066\066\321\305\234\213\151\265\100\310\224
-\145\167\362\127\041\146\073\316\205\100\266\063\143\032\277\171
-\036\374\134\035\323\035\223\033\213\014\135\205\275\231\060\062
-\030\011\221\122\351\174\241\272\377\144\222\232\354\376\065\356
-\214\057\256\374\040\206\354\112\336\033\170\062\067\246\201\322
-\235\257\132\022\026\312\231\133\374\157\155\016\305\240\036\206
-\311\221\320\134\230\202\137\143\014\212\132\253\330\225\246\314
-\313\212\326\277\144\113\216\312\212\262\260\351\041\062\236\252
-\250\205\230\064\201\071\041\073\250\072\122\062\075\366\153\067
-\206\006\132\025\230\334\360\021\146\376\064\040\267\003\364\101
-\020\175\071\204\171\226\162\143\266\226\002\345\153\271\255\031
-\115\273\306\104\333\066\313\052\234\216
-END
-
-# Trust for Certificate "Juur-SK"
-# Issuer: CN=Juur-SK,O=AS Sertifitseerimiskeskus,C=EE,E=pki@sk.ee
-# Serial Number: 999181308 (0x3b8e4bfc)
-# Subject: CN=Juur-SK,O=AS Sertifitseerimiskeskus,C=EE,E=pki@sk.ee
-# Not Valid Before: Thu Aug 30 14:23:01 2001
-# Not Valid After : Fri Aug 26 14:23:01 2016
-# Fingerprint (MD5): AA:8E:5D:D9:F8:DB:0A:58:B7:8D:26:87:6C:82:35:55
-# Fingerprint (SHA1): 40:9D:4B:D9:17:B5:5C:27:B6:9B:64:CB:98:22:44:0D:CD:09:B8:89
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Juur-SK"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\100\235\113\331\027\265\134\047\266\233\144\313\230\042\104\015
-\315\011\270\211
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\252\216\135\331\370\333\012\130\267\215\046\207\154\202\065\125
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\135\061\030\060\026\006\011\052\206\110\206\367\015\001\011
-\001\026\011\160\153\151\100\163\153\056\145\145\061\013\060\011
-\006\003\125\004\006\023\002\105\105\061\042\060\040\006\003\125
-\004\012\023\031\101\123\040\123\145\162\164\151\146\151\164\163
-\145\145\162\151\155\151\163\153\145\163\153\165\163\061\020\060
-\016\006\003\125\004\003\023\007\112\165\165\162\055\123\113
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\004\073\216\113\374
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "Hongkong Post Root CA 1"
#
@@ -13831,6 +11768,7 @@ CKA_VALUE MULTILINE_OCTAL
\237\123\330\103\016\135\326\143\202\161\035\200\164\312\366\342
\002\153\331\132
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Hongkong Post Root CA 1"
# Issuer: CN=Hongkong Post Root CA 1,O=Hongkong Post,C=HK
@@ -13961,6 +11899,7 @@ CKA_VALUE MULTILINE_OCTAL
\101\047\111\100\356\336\346\043\104\071\334\241\042\326\272\003
\362
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "SecureSign RootCA11"
# Issuer: CN=SecureSign RootCA11,O="Japan Certification Services, Inc.",C=JP
@@ -14126,6 +12065,7 @@ CKA_VALUE MULTILINE_OCTAL
\147\116\151\206\103\223\070\373\266\333\117\203\221\324\140\176
\113\076\053\070\007\125\230\136\244
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "ACEDICOM Root"
# Issuer: C=ES,O=EDICOM,OU=PKI,CN=ACEDICOM Root
@@ -14164,159 +12104,43 @@ CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
-# Certificate "Verisign Class 1 Public Primary Certification Authority"
+# Certificate "Microsec e-Szigno Root CA 2009"
#
-# Issuer: OU=Class 1 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Serial Number:3f:69:1e:81:9c:f0:9a:4a:f3:73:ff:b9:48:a2:e4:dd
-# Subject: OU=Class 1 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Not Valid Before: Mon Jan 29 00:00:00 1996
-# Not Valid After : Wed Aug 02 23:59:59 2028
-# Fingerprint (MD5): 86:AC:DE:2B:C5:6D:C3:D9:8C:28:88:D3:8D:16:13:1E
-# Fingerprint (SHA1): CE:6A:64:A3:09:E4:2F:BB:D9:85:1C:45:3E:64:09:EA:E8:7D:60:F1
+# Issuer: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU
+# Serial Number:00:c2:7e:43:04:4e:47:3f:19
+# Subject: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU
+# Not Valid Before: Tue Jun 16 11:30:18 2009
+# Not Valid After : Sun Dec 30 11:30:18 2029
+# Fingerprint (MD5): F8:49:F4:03:BC:44:2D:83:BE:48:69:7D:29:64:FC:B1
+# Fingerprint (SHA1): 89:DF:74:FE:5C:F4:0F:4A:80:F9:E3:37:7D:54:DA:91:E1:01:31:8E
CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Verisign Class 1 Public Primary Certification Authority"
+CKA_LABEL UTF8 "Microsec e-Szigno Root CA 2009"
CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
CKA_SUBJECT MULTILINE_OCTAL
-\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151
-\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004
-\013\023\056\103\154\141\163\163\040\061\040\120\165\142\154\151
-\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146
-\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
-\171
+\060\201\202\061\013\060\011\006\003\125\004\006\023\002\110\125
+\061\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160
+\145\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151
+\143\162\157\163\145\143\040\114\164\144\056\061\047\060\045\006
+\003\125\004\003\014\036\115\151\143\162\157\163\145\143\040\145
+\055\123\172\151\147\156\157\040\122\157\157\164\040\103\101\040
+\062\060\060\071\061\037\060\035\006\011\052\206\110\206\367\015
+\001\011\001\026\020\151\156\146\157\100\145\055\163\172\151\147
+\156\157\056\150\165
END
CKA_ID UTF8 "0"
CKA_ISSUER MULTILINE_OCTAL
-\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151
-\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004
-\013\023\056\103\154\141\163\163\040\061\040\120\165\142\154\151
-\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146
-\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
-\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\077\151\036\201\234\360\232\112\363\163\377\271\110\242
-\344\335
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\002\074\060\202\001\245\002\020\077\151\036\201\234\360
-\232\112\363\163\377\271\110\242\344\335\060\015\006\011\052\206
-\110\206\367\015\001\001\005\005\000\060\137\061\013\060\011\006
-\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125\004
-\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156\143
-\056\061\067\060\065\006\003\125\004\013\023\056\103\154\141\163
-\163\040\061\040\120\165\142\154\151\143\040\120\162\151\155\141
-\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\060\036\027\015\071\066
-\060\061\062\071\060\060\060\060\060\060\132\027\015\062\070\060
-\070\060\062\062\063\065\071\065\071\132\060\137\061\013\060\011
-\006\003\125\004\006\023\002\125\123\061\027\060\025\006\003\125
-\004\012\023\016\126\145\162\151\123\151\147\156\054\040\111\156
-\143\056\061\067\060\065\006\003\125\004\013\023\056\103\154\141
-\163\163\040\061\040\120\165\142\154\151\143\040\120\162\151\155
-\141\162\171\040\103\145\162\164\151\146\151\143\141\164\151\157
-\156\040\101\165\164\150\157\162\151\164\171\060\201\237\060\015
-\006\011\052\206\110\206\367\015\001\001\001\005\000\003\201\215
-\000\060\201\211\002\201\201\000\345\031\277\155\243\126\141\055
-\231\110\161\366\147\336\271\215\353\267\236\206\200\012\221\016
-\372\070\045\257\106\210\202\345\163\250\240\233\044\135\015\037
-\314\145\156\014\260\320\126\204\030\207\232\006\233\020\241\163
-\337\264\130\071\153\156\301\366\025\325\250\250\077\252\022\006
-\215\061\254\177\260\064\327\217\064\147\210\011\315\024\021\342
-\116\105\126\151\037\170\002\200\332\334\107\221\051\273\066\311
-\143\134\305\340\327\055\207\173\241\267\062\260\173\060\272\052
-\057\061\252\356\243\147\332\333\002\003\001\000\001\060\015\006
-\011\052\206\110\206\367\015\001\001\005\005\000\003\201\201\000
-\130\025\051\071\074\167\243\332\134\045\003\174\140\372\356\011
-\231\074\047\020\160\310\014\011\346\263\207\317\012\342\030\226
-\065\142\314\277\233\047\171\211\137\311\304\011\364\316\265\035
-\337\052\275\345\333\206\234\150\045\345\060\174\266\211\025\376
-\147\321\255\341\120\254\074\174\142\113\217\272\204\327\022\025
-\033\037\312\135\017\301\122\224\052\021\231\332\173\317\014\066
-\023\325\065\334\020\031\131\352\224\301\000\277\165\217\331\372
-\375\166\004\333\142\273\220\152\003\331\106\065\331\370\174\133
-END
-
-# Trust for Certificate "Verisign Class 1 Public Primary Certification Authority"
-# Issuer: OU=Class 1 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Serial Number:3f:69:1e:81:9c:f0:9a:4a:f3:73:ff:b9:48:a2:e4:dd
-# Subject: OU=Class 1 Public Primary Certification Authority,O="VeriSign, Inc.",C=US
-# Not Valid Before: Mon Jan 29 00:00:00 1996
-# Not Valid After : Wed Aug 02 23:59:59 2028
-# Fingerprint (MD5): 86:AC:DE:2B:C5:6D:C3:D9:8C:28:88:D3:8D:16:13:1E
-# Fingerprint (SHA1): CE:6A:64:A3:09:E4:2F:BB:D9:85:1C:45:3E:64:09:EA:E8:7D:60:F1
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Verisign Class 1 Public Primary Certification Authority"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\316\152\144\243\011\344\057\273\331\205\034\105\076\144\011\352
-\350\175\140\361
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\206\254\336\053\305\155\303\331\214\050\210\323\215\026\023\036
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\137\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151
-\147\156\054\040\111\156\143\056\061\067\060\065\006\003\125\004
-\013\023\056\103\154\141\163\163\040\061\040\120\165\142\154\151
-\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146
-\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
-\171
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\020\077\151\036\201\234\360\232\112\363\163\377\271\110\242
-\344\335
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "Microsec e-Szigno Root CA 2009"
-#
-# Issuer: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU
-# Serial Number:00:c2:7e:43:04:4e:47:3f:19
-# Subject: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU
-# Not Valid Before: Tue Jun 16 11:30:18 2009
-# Not Valid After : Sun Dec 30 11:30:18 2029
-# Fingerprint (MD5): F8:49:F4:03:BC:44:2D:83:BE:48:69:7D:29:64:FC:B1
-# Fingerprint (SHA1): 89:DF:74:FE:5C:F4:0F:4A:80:F9:E3:37:7D:54:DA:91:E1:01:31:8E
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Microsec e-Szigno Root CA 2009"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\202\061\013\060\011\006\003\125\004\006\023\002\110\125
-\061\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160
-\145\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151
-\143\162\157\163\145\143\040\114\164\144\056\061\047\060\045\006
-\003\125\004\003\014\036\115\151\143\162\157\163\145\143\040\145
-\055\123\172\151\147\156\157\040\122\157\157\164\040\103\101\040
-\062\060\060\071\061\037\060\035\006\011\052\206\110\206\367\015
-\001\011\001\026\020\151\156\146\157\100\145\055\163\172\151\147
-\156\157\056\150\165
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\202\061\013\060\011\006\003\125\004\006\023\002\110\125
-\061\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160
-\145\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151
-\143\162\157\163\145\143\040\114\164\144\056\061\047\060\045\006
-\003\125\004\003\014\036\115\151\143\162\157\163\145\143\040\145
-\055\123\172\151\147\156\157\040\122\157\157\164\040\103\101\040
-\062\060\060\071\061\037\060\035\006\011\052\206\110\206\367\015
-\001\011\001\026\020\151\156\146\157\100\145\055\163\172\151\147
-\156\157\056\150\165
+\060\201\202\061\013\060\011\006\003\125\004\006\023\002\110\125
+\061\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160
+\145\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151
+\143\162\157\163\145\143\040\114\164\144\056\061\047\060\045\006
+\003\125\004\003\014\036\115\151\143\162\157\163\145\143\040\145
+\055\123\172\151\147\156\157\040\122\157\157\164\040\103\101\040
+\062\060\060\071\061\037\060\035\006\011\052\206\110\206\367\015
+\001\011\001\026\020\151\156\146\157\100\145\055\163\172\151\147
+\156\157\056\150\165
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
\002\011\000\302\176\103\004\116\107\077\031
@@ -14388,6 +12212,7 @@ CKA_VALUE MULTILINE_OCTAL
\034\303\165\106\256\065\005\246\366\134\075\041\356\126\360\311
\202\042\055\172\124\253\160\303\175\042\145\202\160\226
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Microsec e-Szigno Root CA 2009"
# Issuer: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU
@@ -14519,6 +12344,7 @@ CKA_VALUE MULTILINE_OCTAL
\316\323\142\120\145\036\353\222\227\203\061\331\263\265\312\107
\130\077\137
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "GlobalSign Root CA - R3"
# Issuer: CN=GlobalSign,O=GlobalSign,OU=GlobalSign Root CA - R3
@@ -14691,6 +12517,7 @@ CKA_VALUE MULTILINE_OCTAL
\214\263\042\350\113\174\125\306\235\372\243\024\273\145\205\156
\156\117\022\176\012\074\235\225
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Autoridad de Certificacion Firmaprofesional CIF A62634068"
# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068,C=ES
@@ -14859,6 +12686,7 @@ CKA_VALUE MULTILINE_OCTAL
\377\356\336\200\330\055\321\070\325\136\055\013\230\175\076\154
\333\374\046\210\307
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Izenpe.com"
# Issuer: CN=Izenpe.com,O=IZENPE S.A.,C=ES
@@ -15063,6 +12891,7 @@ CKA_VALUE MULTILINE_OCTAL
\006\274\046\020\155\067\235\354\335\170\214\174\200\305\360\331
\167\110\320
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Chambers of Commerce Root - 2008"
# Issuer: CN=Chambers of Commerce Root - 2008,O=AC Camerfirma S.A.,serialNumber=A82743287,L=Madrid (see current address at www.camerfirma.com/address),C=EU
@@ -15271,6 +13100,7 @@ CKA_VALUE MULTILINE_OCTAL
\043\167\330\106\113\171\155\366\214\355\072\177\140\021\170\364
\351\233\256\325\124\300\164\200\321\013\102\237\301
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Global Chambersign Root - 2008"
# Issuer: CN=Global Chambersign Root - 2008,O=AC Camerfirma S.A.,serialNumber=A82743287,L=Madrid (see current address at www.camerfirma.com/address),C=EU
@@ -17137,6 +14967,7 @@ CKA_VALUE MULTILINE_OCTAL
\026\262\103\011\014\115\366\247\153\264\231\204\145\312\172\210
\342\342\104\276\134\367\352\034\365
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Go Daddy Root Certificate Authority - G2"
# Issuer: CN=Go Daddy Root Certificate Authority - G2,O="GoDaddy.com, Inc.",L=Scottsdale,ST=Arizona,C=US
@@ -17286,6 +15117,7 @@ CKA_VALUE MULTILINE_OCTAL
\241\365\146\005\056\177\071\025\251\052\373\120\213\216\205\151
\364
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Starfield Root Certificate Authority - G2"
# Issuer: CN=Starfield Root Certificate Authority - G2,O="Starfield Technologies, Inc.",L=Scottsdale,ST=Arizona,C=US
@@ -17437,6 +15269,7 @@ CKA_VALUE MULTILINE_OCTAL
\157\002\213\147\015\115\046\127\161\332\040\374\301\112\120\215
\261\050\272
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Starfield Services Root Certificate Authority - G2"
# Issuer: CN=Starfield Services Root Certificate Authority - G2,O="Starfield Technologies, Inc.",L=Scottsdale,ST=Arizona,C=US
@@ -17567,6 +15400,7 @@ CKA_VALUE MULTILINE_OCTAL
\236\132\116\145\265\224\256\033\337\051\260\026\361\277\000\236
\007\072\027\144\265\004\265\043\041\231\012\225\073\227\174\357
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AffirmTrust Commercial"
# Issuer: CN=AffirmTrust Commercial,O=AffirmTrust,C=US
@@ -17692,6 +15526,7 @@ CKA_VALUE MULTILINE_OCTAL
\307\167\257\144\250\223\337\366\151\203\202\140\362\111\102\064
\355\132\000\124\205\034\026\066\222\014\134\372\246\255\277\333
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AffirmTrust Networking"
# Issuer: CN=AffirmTrust Networking,O=AffirmTrust,C=US
@@ -17849,6 +15684,7 @@ CKA_VALUE MULTILINE_OCTAL
\200\064\375\277\357\006\243\335\130\305\205\075\076\217\376\236
\051\340\266\270\011\150\031\034\030\103
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AffirmTrust Premium"
# Issuer: CN=AffirmTrust Premium,O=AffirmTrust,C=US
@@ -17954,6 +15790,7 @@ CKA_VALUE MULTILINE_OCTAL
\157\256\144\372\130\345\213\036\343\143\276\265\201\315\157\002
\214\171
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "AffirmTrust Premium ECC"
# Issuer: CN=AffirmTrust Premium ECC,O=AffirmTrust,C=US
@@ -18092,6 +15929,7 @@ CKA_VALUE MULTILINE_OCTAL
\013\047\002\065\051\261\100\225\347\371\350\234\125\210\031\106
\326\267\064\365\176\316\071\232\331\070\361\121\367\117\054
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Certum Trusted Network CA"
# Issuer: CN=Certum Trusted Network CA,OU=Certum Certification Authority,O=Unizeto Technologies S.A.,C=PL
@@ -18261,6 +16099,7 @@ CKA_VALUE MULTILINE_OCTAL
\331\027\026\026\012\053\206\337\217\001\031\032\345\273\202\143
\377\276\013\166\026\136\067\067\346\330\164\227\242\231\105\171
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Certinomis - Autorité Racine"
# Issuer: CN=Certinomis - Autorit.. Racine,OU=0002 433998903,O=Certinomis,C=FR
@@ -18299,189 +16138,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "Root CA Generalitat Valenciana"
-#
-# Issuer: CN=Root CA Generalitat Valenciana,OU=PKIGVA,O=Generalitat Valenciana,C=ES
-# Serial Number: 994436456 (0x3b45e568)
-# Subject: CN=Root CA Generalitat Valenciana,OU=PKIGVA,O=Generalitat Valenciana,C=ES
-# Not Valid Before: Fri Jul 06 16:22:47 2001
-# Not Valid After : Thu Jul 01 15:22:47 2021
-# Fingerprint (MD5): 2C:8C:17:5E:B1:54:AB:93:17:B5:36:5A:DB:D1:C6:F2
-# Fingerprint (SHA1): A0:73:E5:C5:BD:43:61:0D:86:4C:21:13:0A:85:58:57:CC:9C:EA:46
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Root CA Generalitat Valenciana"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\150\061\013\060\011\006\003\125\004\006\023\002\105\123\061
-\037\060\035\006\003\125\004\012\023\026\107\145\156\145\162\141
-\154\151\164\141\164\040\126\141\154\145\156\143\151\141\156\141
-\061\017\060\015\006\003\125\004\013\023\006\120\113\111\107\126
-\101\061\047\060\045\006\003\125\004\003\023\036\122\157\157\164
-\040\103\101\040\107\145\156\145\162\141\154\151\164\141\164\040
-\126\141\154\145\156\143\151\141\156\141
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\150\061\013\060\011\006\003\125\004\006\023\002\105\123\061
-\037\060\035\006\003\125\004\012\023\026\107\145\156\145\162\141
-\154\151\164\141\164\040\126\141\154\145\156\143\151\141\156\141
-\061\017\060\015\006\003\125\004\013\023\006\120\113\111\107\126
-\101\061\047\060\045\006\003\125\004\003\023\036\122\157\157\164
-\040\103\101\040\107\145\156\145\162\141\154\151\164\141\164\040
-\126\141\154\145\156\143\151\141\156\141
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\004\073\105\345\150
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\006\213\060\202\005\163\240\003\002\001\002\002\004\073
-\105\345\150\060\015\006\011\052\206\110\206\367\015\001\001\005
-\005\000\060\150\061\013\060\011\006\003\125\004\006\023\002\105
-\123\061\037\060\035\006\003\125\004\012\023\026\107\145\156\145
-\162\141\154\151\164\141\164\040\126\141\154\145\156\143\151\141
-\156\141\061\017\060\015\006\003\125\004\013\023\006\120\113\111
-\107\126\101\061\047\060\045\006\003\125\004\003\023\036\122\157
-\157\164\040\103\101\040\107\145\156\145\162\141\154\151\164\141
-\164\040\126\141\154\145\156\143\151\141\156\141\060\036\027\015
-\060\061\060\067\060\066\061\066\062\062\064\067\132\027\015\062
-\061\060\067\060\061\061\065\062\062\064\067\132\060\150\061\013
-\060\011\006\003\125\004\006\023\002\105\123\061\037\060\035\006
-\003\125\004\012\023\026\107\145\156\145\162\141\154\151\164\141
-\164\040\126\141\154\145\156\143\151\141\156\141\061\017\060\015
-\006\003\125\004\013\023\006\120\113\111\107\126\101\061\047\060
-\045\006\003\125\004\003\023\036\122\157\157\164\040\103\101\040
-\107\145\156\145\162\141\154\151\164\141\164\040\126\141\154\145
-\156\143\151\141\156\141\060\202\001\042\060\015\006\011\052\206
-\110\206\367\015\001\001\001\005\000\003\202\001\017\000\060\202
-\001\012\002\202\001\001\000\306\052\253\127\021\067\057\042\212
-\312\003\164\035\312\355\055\242\013\274\063\122\100\046\107\276
-\132\151\246\073\162\066\027\114\350\337\270\273\057\166\341\100
-\106\164\145\002\220\122\010\264\377\250\214\301\340\307\211\126
-\020\071\063\357\150\264\137\137\332\155\043\241\211\136\042\243
-\112\006\360\047\360\127\271\370\351\116\062\167\012\077\101\144
-\363\353\145\356\166\376\124\252\175\035\040\256\363\327\164\302
-\012\137\365\010\050\122\010\314\125\135\322\017\333\232\201\245
-\273\241\263\301\224\315\124\340\062\165\061\221\032\142\262\336
-\165\342\317\117\211\331\221\220\017\101\033\264\132\112\167\275
-\147\203\340\223\347\136\247\014\347\201\323\364\122\254\123\262
-\003\307\104\046\373\171\345\313\064\140\120\020\173\033\333\153
-\327\107\253\137\174\150\312\156\235\101\003\020\356\153\231\173
-\136\045\250\302\253\344\300\363\134\234\343\276\316\061\114\144
-\036\136\200\242\365\203\176\014\326\312\214\125\216\276\340\276
-\111\007\017\243\044\101\172\130\035\204\352\130\022\310\341\267
-\355\357\223\336\224\010\061\002\003\001\000\001\243\202\003\073
-\060\202\003\067\060\062\006\010\053\006\001\005\005\007\001\001
-\004\046\060\044\060\042\006\010\053\006\001\005\005\007\060\001
-\206\026\150\164\164\160\072\057\057\157\143\163\160\056\160\153
-\151\056\147\166\141\056\145\163\060\022\006\003\125\035\023\001
-\001\377\004\010\060\006\001\001\377\002\001\002\060\202\002\064
-\006\003\125\035\040\004\202\002\053\060\202\002\047\060\202\002
-\043\006\012\053\006\001\004\001\277\125\002\001\000\060\202\002
-\023\060\202\001\350\006\010\053\006\001\005\005\007\002\002\060
-\202\001\332\036\202\001\326\000\101\000\165\000\164\000\157\000
-\162\000\151\000\144\000\141\000\144\000\040\000\144\000\145\000
-\040\000\103\000\145\000\162\000\164\000\151\000\146\000\151\000
-\143\000\141\000\143\000\151\000\363\000\156\000\040\000\122\000
-\141\000\355\000\172\000\040\000\144\000\145\000\040\000\154\000
-\141\000\040\000\107\000\145\000\156\000\145\000\162\000\141\000
-\154\000\151\000\164\000\141\000\164\000\040\000\126\000\141\000
-\154\000\145\000\156\000\143\000\151\000\141\000\156\000\141\000
-\056\000\015\000\012\000\114\000\141\000\040\000\104\000\145\000
-\143\000\154\000\141\000\162\000\141\000\143\000\151\000\363\000
-\156\000\040\000\144\000\145\000\040\000\120\000\162\000\341\000
-\143\000\164\000\151\000\143\000\141\000\163\000\040\000\144\000
-\145\000\040\000\103\000\145\000\162\000\164\000\151\000\146\000
-\151\000\143\000\141\000\143\000\151\000\363\000\156\000\040\000
-\161\000\165\000\145\000\040\000\162\000\151\000\147\000\145\000
-\040\000\145\000\154\000\040\000\146\000\165\000\156\000\143\000
-\151\000\157\000\156\000\141\000\155\000\151\000\145\000\156\000
-\164\000\157\000\040\000\144\000\145\000\040\000\154\000\141\000
-\040\000\160\000\162\000\145\000\163\000\145\000\156\000\164\000
-\145\000\040\000\101\000\165\000\164\000\157\000\162\000\151\000
-\144\000\141\000\144\000\040\000\144\000\145\000\040\000\103\000
-\145\000\162\000\164\000\151\000\146\000\151\000\143\000\141\000
-\143\000\151\000\363\000\156\000\040\000\163\000\145\000\040\000
-\145\000\156\000\143\000\165\000\145\000\156\000\164\000\162\000
-\141\000\040\000\145\000\156\000\040\000\154\000\141\000\040\000
-\144\000\151\000\162\000\145\000\143\000\143\000\151\000\363\000
-\156\000\040\000\167\000\145\000\142\000\040\000\150\000\164\000
-\164\000\160\000\072\000\057\000\057\000\167\000\167\000\167\000
-\056\000\160\000\153\000\151\000\056\000\147\000\166\000\141\000
-\056\000\145\000\163\000\057\000\143\000\160\000\163\060\045\006
-\010\053\006\001\005\005\007\002\001\026\031\150\164\164\160\072
-\057\057\167\167\167\056\160\153\151\056\147\166\141\056\145\163
-\057\143\160\163\060\035\006\003\125\035\016\004\026\004\024\173
-\065\323\100\322\034\170\031\146\357\164\020\050\334\076\117\262
-\170\004\374\060\201\225\006\003\125\035\043\004\201\215\060\201
-\212\200\024\173\065\323\100\322\034\170\031\146\357\164\020\050
-\334\076\117\262\170\004\374\241\154\244\152\060\150\061\013\060
-\011\006\003\125\004\006\023\002\105\123\061\037\060\035\006\003
-\125\004\012\023\026\107\145\156\145\162\141\154\151\164\141\164
-\040\126\141\154\145\156\143\151\141\156\141\061\017\060\015\006
-\003\125\004\013\023\006\120\113\111\107\126\101\061\047\060\045
-\006\003\125\004\003\023\036\122\157\157\164\040\103\101\040\107
-\145\156\145\162\141\154\151\164\141\164\040\126\141\154\145\156
-\143\151\141\156\141\202\004\073\105\345\150\060\015\006\011\052
-\206\110\206\367\015\001\001\005\005\000\003\202\001\001\000\044
-\141\116\365\265\310\102\002\052\263\134\165\255\305\155\312\347
-\224\077\245\150\225\210\301\124\300\020\151\242\022\057\030\077
-\045\120\250\174\112\352\306\011\331\364\165\306\100\332\257\120
-\235\075\245\026\273\155\061\306\307\163\012\110\376\040\162\355
-\157\314\350\203\141\026\106\220\001\225\113\175\216\232\122\011
-\057\366\157\034\344\241\161\317\214\052\132\027\163\203\107\115
-\017\066\373\004\115\111\121\342\024\311\144\141\373\324\024\340
-\364\236\267\064\217\012\046\275\227\134\364\171\072\112\060\031
-\314\255\117\240\230\212\264\061\227\052\342\163\155\176\170\270
-\370\210\211\117\261\042\221\144\113\365\120\336\003\333\345\305
-\166\347\023\146\165\176\145\373\001\237\223\207\210\235\371\106
-\127\174\115\140\257\230\163\023\043\244\040\221\201\372\320\141
-\146\270\175\321\257\326\157\036\154\075\351\021\375\251\371\202
-\042\206\231\063\161\132\352\031\127\075\221\315\251\300\243\156
-\007\023\246\311\355\370\150\243\236\303\132\162\011\207\050\321
-\304\163\304\163\030\137\120\165\026\061\237\267\350\174\303
-END
-
-# Trust for Certificate "Root CA Generalitat Valenciana"
-# Issuer: CN=Root CA Generalitat Valenciana,OU=PKIGVA,O=Generalitat Valenciana,C=ES
-# Serial Number: 994436456 (0x3b45e568)
-# Subject: CN=Root CA Generalitat Valenciana,OU=PKIGVA,O=Generalitat Valenciana,C=ES
-# Not Valid Before: Fri Jul 06 16:22:47 2001
-# Not Valid After : Thu Jul 01 15:22:47 2021
-# Fingerprint (MD5): 2C:8C:17:5E:B1:54:AB:93:17:B5:36:5A:DB:D1:C6:F2
-# Fingerprint (SHA1): A0:73:E5:C5:BD:43:61:0D:86:4C:21:13:0A:85:58:57:CC:9C:EA:46
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "Root CA Generalitat Valenciana"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\240\163\345\305\275\103\141\015\206\114\041\023\012\205\130\127
-\314\234\352\106
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\054\214\027\136\261\124\253\223\027\265\066\132\333\321\306\362
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\150\061\013\060\011\006\003\125\004\006\023\002\105\123\061
-\037\060\035\006\003\125\004\012\023\026\107\145\156\145\162\141
-\154\151\164\141\164\040\126\141\154\145\156\143\151\141\156\141
-\061\017\060\015\006\003\125\004\013\023\006\120\113\111\107\126
-\101\061\047\060\045\006\003\125\004\003\023\036\122\157\157\164
-\040\103\101\040\107\145\156\145\162\141\154\151\164\141\164\040
-\126\141\154\145\156\143\151\141\156\141
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\004\073\105\345\150
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "TWCA Root Certification Authority"
#
@@ -18578,6 +16234,7 @@ CKA_VALUE MULTILINE_OCTAL
\142\047\254\145\042\327\323\074\306\345\216\262\123\314\111\316
\274\060\376\173\016\063\220\373\355\322\024\221\037\007\257
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "TWCA Root Certification Authority"
# Issuer: CN=TWCA Root Certification Authority,OU=Root CA,O=TAIWAN-CA,C=TW
@@ -19968,6 +17625,7 @@ CKA_VALUE MULTILINE_OCTAL
\112\071\321\005\111\013\247\266\067\201\245\135\214\252\063\136
\201\050\174\247\175\047\353\000\256\215\067
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Security Communication RootCA2"
# Issuer: OU=Security Communication RootCA2,O="SECOM Trust Systems CO.,LTD.",C=JP
@@ -20150,6 +17808,7 @@ CKA_VALUE MULTILINE_OCTAL
\234\235\245\140\225\072\122\177\365\321\253\010\156\363\356\133
\371\210\075\176\270\157\156\003\344\102
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "EC-ACC"
# Issuer: CN=EC-ACC,OU=Jerarquia Entitats de Certificacio Catalanes,OU=Vegeu https://www.catcert.net/verarrel (c)03,OU=Serveis Publics de Certificacio,O=Agencia Catalana de Certificacio (NIF Q-0801176-I),C=ES
@@ -20312,6 +17971,7 @@ CKA_VALUE MULTILINE_OCTAL
\227\265\235\232\231\115\260\074\370\112\000\233\144\335\237\071
\113\321\047\327\270
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for Certificate "Hellenic Academic and Research Institutions RootCA 2011"
# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2011,O=Hellenic Academic and Research Institutions Cert. Authority,C=GR
@@ -20547,6 +18207,7 @@ CKA_VALUE MULTILINE_OCTAL
\056\163\352\146\050\170\315\035\024\277\240\217\057\056\270\056
\216\362\024\212\314\351\265\174\373\154\235\014\245\341\226
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Actalis Authentication Root CA"
# Issuer: CN=Actalis Authentication Root CA,O=Actalis S.p.A./03358520967,L=Milan,C=IT
@@ -20677,6 +18338,7 @@ CKA_VALUE MULTILINE_OCTAL
\373\072\162\035\315\366\045\210\036\227\314\041\234\051\001\015
\145\353\127\331\363\127\226\273\110\315\201
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Trustis FPS Root CA"
# Issuer: OU=Trustis FPS Root CA,O=Trustis Limited,C=GB
@@ -20877,6 +18539,7 @@ CKA_VALUE MULTILINE_OCTAL
\266\323\173\002\366\343\270\324\011\156\153\236\165\204\071\346
\177\045\245\362\110\000\300\244\001\332\077
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "StartCom Certification Authority"
# Issuer: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
@@ -21041,6 +18704,7 @@ CKA_VALUE MULTILINE_OCTAL
\301\332\070\133\343\251\352\346\241\272\171\357\163\330\266\123
\127\055\366\320\341\327\110
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "StartCom Certification Authority G2"
# Issuer: CN=StartCom Certification Authority G2,O=StartCom Ltd.,C=IL
@@ -21200,6 +18864,7 @@ CKA_VALUE MULTILINE_OCTAL
\143\135\132\130\342\057\343\035\344\251\326\320\012\320\236\277
\327\201\011\361\311\307\046\015\254\230\026\126\240
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Buypass Class 2 Root CA"
# Issuer: CN=Buypass Class 2 Root CA,O=Buypass AS-983163327,C=NO
@@ -21358,6 +19023,7 @@ CKA_VALUE MULTILINE_OCTAL
\343\370\073\273\334\115\327\144\362\121\276\346\252\253\132\351
\061\356\006\274\163\277\023\142\012\237\307\271\227
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Buypass Class 3 Root CA"
# Issuer: CN=Buypass Class 3 Root CA,O=Buypass AS-983163327,C=NO
@@ -21499,6 +19165,7 @@ CKA_VALUE MULTILINE_OCTAL
\321\106\232\073\074\170\270\157\241\320\015\144\242\170\036\051
\116\223\303\244\124\024\133
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "T-TeleSec GlobalRoot Class 3"
# Issuer: CN=T-TeleSec GlobalRoot Class 3,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE
@@ -21647,6 +19314,7 @@ CKA_VALUE MULTILINE_OCTAL
\031\120\211\140\314\351\044\225\017\302\313\035\362\157\166\220
\307\314\165\301\226\305\235
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "EE Certification Centre Root CA"
# Issuer: E=pki@sk.ee,CN=EE Certification Centre Root CA,O=AS Sertifitseerimiskeskus,C=EE
@@ -21876,6 +19544,7 @@ CKA_VALUE MULTILINE_OCTAL
\062\015\135\010\125\164\377\214\230\320\012\246\204\152\321\071
\175
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "TURKTRUST Certificate Services Provider Root 2007"
# Issuer: O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A...,L=Ankara,C=TR,CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s..
@@ -22024,6 +19693,7 @@ CKA_VALUE MULTILINE_OCTAL
\046\210\160\327\352\221\315\076\271\312\300\220\156\132\306\136
\164\145\327\134\376\243\342
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "D-TRUST Root Class 3 CA 2 2009"
# Issuer: CN=D-TRUST Root Class 3 CA 2 2009,O=D-Trust GmbH,C=DE
@@ -22167,6 +19837,7 @@ CKA_VALUE MULTILINE_OCTAL
\075\323\056\243\025\274\250\346\046\345\157\303\334\270\003\041
\352\237\026\361\054\124\265
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "D-TRUST Root Class 3 CA 2 EV 2009"
# Issuer: CN=D-TRUST Root Class 3 CA 2 EV 2009,O=D-Trust GmbH,C=DE
@@ -22416,6 +20087,7 @@ CKA_VALUE MULTILINE_OCTAL
\316\035\222\233\321\151\263\377\277\361\222\012\141\065\077\335
\376\206\364\274\340\032\161\263\142\246
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "PSCProcert"
# Issuer: E=acraiz@suscerte.gob.ve,OU=Superintendencia de Servicios de Certificacion Electronica,O=Sistema Nacional de Certificacion Electronica,ST=Distrito Capital,L=Caracas,C=VE,CN=Autoridad de Certificacion Raiz del Estado Venezolano
@@ -22574,6 +20246,7 @@ CKA_VALUE MULTILINE_OCTAL
\126\254\366\267\355\057\233\041\051\307\070\266\225\304\004\362
\303\055\375\024\052\220\231\271\007\314\237
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "China Internet Network Information Center EV Certificates Root"
# Issuer: CN=China Internet Network Information Center EV Certificates Root,O=China Internet Network Information Center,C=CN
@@ -22749,6 +20422,7 @@ CKA_VALUE MULTILINE_OCTAL
\311\051\041\123\234\046\105\252\023\027\344\347\315\170\342\071
\301\053\022\236\246\236\033\305\346\016\331\061\331
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Swisscom Root CA 2"
# Issuer: CN=Swisscom Root CA 2,OU=Digital Certificate Services,O=Swisscom,C=ch
@@ -22924,6 +20598,7 @@ CKA_VALUE MULTILINE_OCTAL
\043\355\244\263\035\026\162\103\113\040\341\131\176\302\350\255
\046\277\242\367
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Swisscom Root EV CA 2"
# Issuer: CN=Swisscom Root EV CA 2,OU=Digital Certificate Services,O=Swisscom,C=ch
@@ -23088,6 +20763,7 @@ CKA_VALUE MULTILINE_OCTAL
\016\353\264\261\274\267\114\311\153\277\241\363\331\364\355\342
\360\343\355\144\236\075\057\226\122\117\200\123\213
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "CA Disig Root R1"
# Issuer: CN=CA Disig Root R1,O=Disig a.s.,L=Bratislava,C=SK
@@ -23250,6 +20926,7 @@ CKA_VALUE MULTILINE_OCTAL
\044\304\123\031\351\036\051\025\357\346\155\260\177\055\147\375
\363\154\033\165\106\243\345\112\027\351\244\327\013
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "CA Disig Root R2"
# Issuer: CN=CA Disig Root R2,O=Disig a.s.,L=Bratislava,C=SK
@@ -23449,6 +21126,7 @@ CKA_VALUE MULTILINE_OCTAL
\302\130\200\033\240\227\241\374\131\215\351\021\366\321\017\113
\125\064\106\052\213\206\073
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "ACCVRAIZ1"
# Issuer: C=ES,O=ACCV,OU=PKIACCV,CN=ACCVRAIZ1
@@ -23608,6 +21286,7 @@ CKA_VALUE MULTILINE_OCTAL
\311\014\277\317\022\216\027\055\043\150\224\347\253\376\251\262
\053\006\320\004\315
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "TWCA Global Root CA"
# Issuer: CN=TWCA Global Root CA,OU=Root CA,O=TAIWAN-CA,C=TW
@@ -23764,6 +21443,7 @@ CKA_VALUE MULTILINE_OCTAL
\141\124\310\034\272\312\301\312\341\271\040\114\217\072\223\211
\245\240\314\277\323\366\165\244\165\226\155\126
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "TeliaSonera Root CA v1"
# Issuer: CN=TeliaSonera Root CA v1,O=TeliaSonera
@@ -23951,6 +21631,7 @@ CKA_VALUE MULTILINE_OCTAL
\064\277\376\043\227\067\322\071\372\075\015\006\013\264\333\073
\243\253\157\134\035\266\176\350\263\202\064\355\006\134\044
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "E-Tugra Certification Authority"
# Issuer: CN=E-Tugra Certification Authority,OU=E-Tugra Sertifikasyon Merkezi,O=E-Tu..ra EBG Bili..im Teknolojileri ve Hizmetleri A....,L=Ankara,C=TR
@@ -24099,6 +21780,7 @@ CKA_VALUE MULTILINE_OCTAL
\332\320\031\056\252\074\361\373\063\200\166\344\315\255\031\117
\005\047\216\023\241\156\302
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "T-TeleSec GlobalRoot Class 2"
# Issuer: CN=T-TeleSec GlobalRoot Class 2,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE
@@ -24229,6 +21911,7 @@ CKA_VALUE MULTILINE_OCTAL
\052\267\030\076\247\031\331\013\175\261\067\101\102\260\272\140
\035\362\376\011\021\260\360\207\173\247\235
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Atos TrustedRoot 2011"
# Issuer: C=DE,O=Atos,CN=Atos TrustedRoot 2011
@@ -24388,6 +22071,7 @@ CKA_VALUE MULTILINE_OCTAL
\172\340\113\266\144\226\143\225\204\302\112\315\034\056\044\207
\063\140\345\303
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "QuoVadis Root CA 1 G3"
# Issuer: CN=QuoVadis Root CA 1 G3,O=QuoVadis Limited,C=BM
@@ -24549,6 +22233,7 @@ CKA_VALUE MULTILINE_OCTAL
\261\154\064\311\035\354\110\053\073\170\355\146\304\216\171\151
\203\336\177\214
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "QuoVadis Root CA 2 G3"
# Issuer: CN=QuoVadis Root CA 2 G3,O=QuoVadis Limited,C=BM
@@ -24710,6 +22395,7 @@ CKA_VALUE MULTILINE_OCTAL
\177\175\256\200\365\007\114\266\076\234\161\124\231\004\113\375
\130\371\230\364
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "QuoVadis Root CA 3 G3"
# Issuer: CN=QuoVadis Root CA 3 G3,O=QuoVadis Limited,C=BM
@@ -24846,6 +22532,7 @@ CKA_VALUE MULTILINE_OCTAL
\314\303\177\252\004\047\273\323\167\270\142\333\027\174\234\050
\042\023\163\154\317\046\365\212\051\347
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "DigiCert Assured ID Root G2"
# Issuer: CN=DigiCert Assured ID Root G2,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -24963,6 +22650,7 @@ CKA_VALUE MULTILINE_OCTAL
\136\221\023\247\335\244\156\222\314\062\326\365\041\146\307\057
\352\226\143\152\145\105\222\225\001\264
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "DigiCert Assured ID Root G3"
# Issuer: CN=DigiCert Assured ID Root G3,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -25101,6 +22789,7 @@ CKA_VALUE MULTILINE_OCTAL
\166\356\074\215\304\135\126\133\242\331\146\156\263\065\067\345
\062\266
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "DigiCert Global Root G2"
# Issuer: CN=DigiCert Global Root G2,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -25218,6 +22907,7 @@ CKA_VALUE MULTILINE_OCTAL
\053\250\232\251\212\305\321\000\275\370\124\342\232\345\133\174
\263\047\027
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "DigiCert Global Root G3"
# Issuer: CN=DigiCert Global Root G3,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -25388,6 +23078,7 @@ CKA_VALUE MULTILINE_OCTAL
\336\214\201\041\255\007\020\107\021\255\207\075\007\321\165\274
\317\363\146\176
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "DigiCert Trusted Root G4"
# Issuer: CN=DigiCert Trusted Root G4,OU=www.digicert.com,O=DigiCert Inc,C=US
@@ -25554,6 +23245,7 @@ CKA_VALUE MULTILINE_OCTAL
\376\314\040\164\243\055\251\056\153\313\300\202\021\041\265\223
\171\356\104\206\276\327\036\344\036\373
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "WoSign"
# Issuer: CN=Certification Authority of WoSign,O=WoSign CA Limited,C=CN
@@ -25715,6 +23407,7 @@ CKA_VALUE MULTILINE_OCTAL
\330\253\361\002\142\301\261\176\125\141\317\023\327\046\260\327
\234\313\051\213\070\112\013\016\220\215\272\241
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "WoSign China"
# Issuer: CN=CA ...............,O=WoSign CA Limited,C=CN
@@ -25891,6 +23584,7 @@ CKA_VALUE MULTILINE_OCTAL
\265\024\151\146\016\202\347\315\316\310\055\246\121\177\041\301
\065\123\205\006\112\135\237\255\273\033\137\164
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "COMODO RSA Certification Authority"
# Issuer: CN=COMODO RSA Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB
@@ -26072,6 +23766,7 @@ CKA_VALUE MULTILINE_OCTAL
\216\074\103\152\035\247\030\336\175\075\026\361\142\371\312\220
\250\375
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "USERTrust RSA Certification Authority"
# Issuer: CN=USERTrust RSA Certification Authority,O=The USERTRUST Network,L=Jersey City,ST=New Jersey,C=US
@@ -26200,6 +23895,7 @@ CKA_VALUE MULTILINE_OCTAL
\242\106\201\210\152\072\106\321\251\233\115\311\141\332\321\135
\127\152\030
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "USERTrust ECC Certification Authority"
# Issuer: CN=USERTrust ECC Certification Authority,O=The USERTRUST Network,L=Jersey City,ST=New Jersey,C=US
@@ -26311,6 +24007,7 @@ CKA_VALUE MULTILINE_OCTAL
\322\267\156\033\002\000\027\252\147\246\025\221\336\372\224\354
\173\013\370\237\204
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "GlobalSign ECC Root CA - R4"
# Issuer: CN=GlobalSign,O=GlobalSign,OU=GlobalSign ECC Root CA - R4
@@ -26423,6 +24120,7 @@ CKA_VALUE MULTILINE_OCTAL
\307\014\274\247\141\151\361\367\073\341\052\313\371\053\363\146
\220\067
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "GlobalSign ECC Root CA - R5"
# Issuer: CN=GlobalSign,O=GlobalSign,OU=GlobalSign ECC Root CA - R5
@@ -26597,6 +24295,7 @@ CKA_VALUE MULTILINE_OCTAL
\013\344\271\257\221\373\120\114\014\272\300\044\047\321\025\333
\145\110\041\012\057\327\334\176\240\314\145\176\171
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "VeriSign-C3SSA-G2-temporary-intermediate-after-1024bit-removal"
# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G5,OU="(c) 2006 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
@@ -26768,6 +24467,7 @@ CKA_VALUE MULTILINE_OCTAL
\254\035\152\335\071\151\344\341\171\170\276\316\005\277\241\014
\367\200\173\041\147\047\060\131
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Staat der Nederlanden Root CA - G3"
# Issuer: CN=Staat der Nederlanden Root CA - G3,O=Staat der Nederlanden,C=NL
@@ -26931,6 +24631,7 @@ CKA_VALUE MULTILINE_OCTAL
\220\003\244\352\044\207\077\331\275\331\351\362\137\120\111\034
\356\354\327\056
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Staat der Nederlanden EV Root CA"
# Issuer: CN=Staat der Nederlanden EV Root CA,O=Staat der Nederlanden,C=NL
@@ -27092,6 +24793,7 @@ CKA_VALUE MULTILINE_OCTAL
\037\220\032\325\112\234\356\321\160\154\314\356\364\127\370\030
\272\204\156\207
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "IdenTrust Commercial Root CA 1"
# Issuer: CN=IdenTrust Commercial Root CA 1,O=IdenTrust,C=US
@@ -27253,6 +24955,7 @@ CKA_VALUE MULTILINE_OCTAL
\113\034\144\347\374\346\153\220\335\151\175\151\375\000\126\245
\267\254\266\255\267\312\076\001\357\234
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "IdenTrust Public Sector Root CA 1"
# Issuer: CN=IdenTrust Public Sector Root CA 1,O=IdenTrust,C=US
@@ -27397,6 +25100,7 @@ CKA_VALUE MULTILINE_OCTAL
\052\062\215\241\342\072\321\020\040\042\071\175\064\105\157\161
\073\303\035\374\377\262\117\250\342\366\060\036
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "S-TRUST Universal Root CA"
# Issuer: CN=S-TRUST Universal Root CA,OU=S-TRUST Certification Services,O=Deutscher Sparkassen Verlag GmbH,C=DE
@@ -27559,6 +25263,7 @@ CKA_VALUE MULTILINE_OCTAL
\261\211\241\177\164\203\232\111\327\334\116\173\212\110\157\213
\105\366
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Entrust Root Certification Authority - G2"
# Issuer: CN=Entrust Root Certification Authority - G2,OU="(c) 2009 Entrust, Inc. - for authorized use only",OU=See www.entrust.net/legal-terms,O="Entrust, Inc.",C=US
@@ -27703,6 +25408,7 @@ CKA_VALUE MULTILINE_OCTAL
\216\046\010\350\174\222\150\155\163\330\157\046\254\041\002\270
\231\267\046\101\133\045\140\256\320\110\032\356\006
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Entrust Root Certification Authority - EC1"
# Issuer: CN=Entrust Root Certification Authority - EC1,OU="(c) 2012 Entrust, Inc. - for authorized use only",OU=See www.entrust.net/legal-terms,O="Entrust, Inc.",C=US
@@ -27875,6 +25581,7 @@ CKA_VALUE MULTILINE_OCTAL
\226\017\112\065\347\116\102\300\165\315\007\317\346\054\353\173
\056
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "CFCA EV ROOT"
# Issuer: CN=CFCA EV ROOT,O=China Financial Certification Authority,C=CN
@@ -28172,6 +25879,7 @@ CKA_VALUE MULTILINE_OCTAL
\261\312\161\115\023\027\071\046\305\051\041\053\223\051\152\226
\372\253\101\341\113\266\065\013\300\233\025
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5"
# Issuer: CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s.. H5,O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A....,L=Ankara,C=TR
@@ -28215,166 +25923,6 @@ CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-#
-# Certificate "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6"
-#
-# Issuer: CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s.. H6,O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A....,L=Ankara,C=TR
-# Serial Number:7d:a1:f2:65:ec:8a
-# Subject: CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s.. H6,O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A....,L=Ankara,C=TR
-# Not Valid Before: Wed Dec 18 09:04:10 2013
-# Not Valid After : Sat Dec 16 09:04:10 2023
-# Fingerprint (SHA-256): 8D:E7:86:55:E1:BE:7F:78:47:80:0B:93:F6:94:D2:1D:36:8C:C0:6E:03:3E:7F:AB:04:BB:5E:B9:9D:A6:B7:00
-# Fingerprint (SHA1): 8A:5C:8C:EE:A5:03:E6:05:56:BA:D8:1B:D4:F6:C9:B0:ED:E5:2F:E0
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\261\061\013\060\011\006\003\125\004\006\023\002\124\122
-\061\017\060\015\006\003\125\004\007\014\006\101\156\153\141\162
-\141\061\115\060\113\006\003\125\004\012\014\104\124\303\234\122
-\113\124\122\125\123\124\040\102\151\154\147\151\040\304\260\154
-\145\164\151\305\237\151\155\040\166\145\040\102\151\154\151\305
-\237\151\155\040\107\303\274\166\145\156\154\151\304\237\151\040
-\110\151\172\155\145\164\154\145\162\151\040\101\056\305\236\056
-\061\102\060\100\006\003\125\004\003\014\071\124\303\234\122\113
-\124\122\125\123\124\040\105\154\145\153\164\162\157\156\151\153
-\040\123\145\162\164\151\146\151\153\141\040\110\151\172\155\145
-\164\040\123\141\304\237\154\141\171\304\261\143\304\261\163\304
-\261\040\110\066
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\261\061\013\060\011\006\003\125\004\006\023\002\124\122
-\061\017\060\015\006\003\125\004\007\014\006\101\156\153\141\162
-\141\061\115\060\113\006\003\125\004\012\014\104\124\303\234\122
-\113\124\122\125\123\124\040\102\151\154\147\151\040\304\260\154
-\145\164\151\305\237\151\155\040\166\145\040\102\151\154\151\305
-\237\151\155\040\107\303\274\166\145\156\154\151\304\237\151\040
-\110\151\172\155\145\164\154\145\162\151\040\101\056\305\236\056
-\061\102\060\100\006\003\125\004\003\014\071\124\303\234\122\113
-\124\122\125\123\124\040\105\154\145\153\164\162\157\156\151\153
-\040\123\145\162\164\151\146\151\153\141\040\110\151\172\155\145
-\164\040\123\141\304\237\154\141\171\304\261\143\304\261\163\304
-\261\040\110\066
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\006\175\241\362\145\354\212
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\004\046\060\202\003\016\240\003\002\001\002\002\006\175
-\241\362\145\354\212\060\015\006\011\052\206\110\206\367\015\001
-\001\013\005\000\060\201\261\061\013\060\011\006\003\125\004\006
-\023\002\124\122\061\017\060\015\006\003\125\004\007\014\006\101
-\156\153\141\162\141\061\115\060\113\006\003\125\004\012\014\104
-\124\303\234\122\113\124\122\125\123\124\040\102\151\154\147\151
-\040\304\260\154\145\164\151\305\237\151\155\040\166\145\040\102
-\151\154\151\305\237\151\155\040\107\303\274\166\145\156\154\151
-\304\237\151\040\110\151\172\155\145\164\154\145\162\151\040\101
-\056\305\236\056\061\102\060\100\006\003\125\004\003\014\071\124
-\303\234\122\113\124\122\125\123\124\040\105\154\145\153\164\162
-\157\156\151\153\040\123\145\162\164\151\146\151\153\141\040\110
-\151\172\155\145\164\040\123\141\304\237\154\141\171\304\261\143
-\304\261\163\304\261\040\110\066\060\036\027\015\061\063\061\062
-\061\070\060\071\060\064\061\060\132\027\015\062\063\061\062\061
-\066\060\071\060\064\061\060\132\060\201\261\061\013\060\011\006
-\003\125\004\006\023\002\124\122\061\017\060\015\006\003\125\004
-\007\014\006\101\156\153\141\162\141\061\115\060\113\006\003\125
-\004\012\014\104\124\303\234\122\113\124\122\125\123\124\040\102
-\151\154\147\151\040\304\260\154\145\164\151\305\237\151\155\040
-\166\145\040\102\151\154\151\305\237\151\155\040\107\303\274\166
-\145\156\154\151\304\237\151\040\110\151\172\155\145\164\154\145
-\162\151\040\101\056\305\236\056\061\102\060\100\006\003\125\004
-\003\014\071\124\303\234\122\113\124\122\125\123\124\040\105\154
-\145\153\164\162\157\156\151\153\040\123\145\162\164\151\146\151
-\153\141\040\110\151\172\155\145\164\040\123\141\304\237\154\141
-\171\304\261\143\304\261\163\304\261\040\110\066\060\202\001\042
-\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003
-\202\001\017\000\060\202\001\012\002\202\001\001\000\235\260\150
-\326\350\275\024\226\243\000\012\232\361\364\307\314\221\115\161
-\170\167\271\367\041\046\025\163\121\026\224\011\107\005\342\063
-\365\150\232\065\377\334\113\057\062\307\260\355\342\202\345\157
-\332\332\352\254\306\006\317\045\015\101\201\366\301\070\042\275
-\371\261\245\246\263\001\274\077\120\027\053\366\351\146\125\324
-\063\263\134\370\103\040\170\223\125\026\160\031\062\346\211\327
-\144\353\275\110\120\375\366\320\101\003\302\164\267\375\366\200
-\317\133\305\253\244\326\225\022\233\347\227\023\062\003\351\324
-\253\103\133\026\355\063\042\144\051\266\322\223\255\057\154\330
-\075\266\366\035\016\064\356\322\175\251\125\017\040\364\375\051
-\273\221\133\034\175\306\102\070\155\102\050\155\324\001\373\315
-\210\227\111\176\270\363\203\370\265\230\057\263\047\013\110\136
-\126\347\116\243\063\263\104\326\245\362\030\224\355\034\036\251
-\225\134\142\112\370\015\147\121\251\257\041\325\370\062\235\171
-\272\032\137\345\004\125\115\023\106\377\362\317\164\307\032\143
-\155\303\037\027\022\303\036\020\076\140\010\263\061\002\003\001
-\000\001\243\102\060\100\060\035\006\003\125\035\016\004\026\004
-\024\335\125\027\023\366\254\350\110\041\312\357\265\257\321\000
-\062\355\236\214\265\060\016\006\003\125\035\017\001\001\377\004
-\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377\004
-\005\060\003\001\001\377\060\015\006\011\052\206\110\206\367\015
-\001\001\013\005\000\003\202\001\001\000\157\130\015\227\103\252
-\026\124\076\277\251\337\222\105\077\205\013\273\126\323\014\122
-\314\310\277\166\147\136\346\252\263\247\357\271\254\264\020\024
-\015\164\176\075\155\255\321\175\320\232\251\245\312\030\073\002
-\100\056\052\234\120\024\213\376\127\176\127\134\021\011\113\066
-\105\122\367\075\254\024\375\104\337\213\227\043\324\303\301\356
-\324\123\225\376\054\112\376\015\160\252\273\213\057\055\313\062
-\243\202\362\124\337\330\362\335\327\110\162\356\112\243\051\226
-\303\104\316\156\265\222\207\166\244\273\364\222\154\316\054\024
-\011\146\216\215\255\026\265\307\033\011\141\073\343\040\242\003
-\200\216\255\176\121\000\116\307\226\206\373\103\230\167\175\050
-\307\217\330\052\156\347\204\157\227\101\051\000\026\136\115\342
-\023\352\131\300\143\147\072\104\373\230\374\004\323\060\162\246
-\366\207\011\127\255\166\246\035\143\232\375\327\145\310\170\203
-\053\165\073\245\133\270\015\135\177\276\043\256\126\125\224\130
-\357\037\201\214\052\262\315\346\233\143\236\030\274\345\153\006
-\264\013\230\113\050\136\257\210\130\313
-END
-
-# Trust for "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6"
-# Issuer: CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s.. H6,O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A....,L=Ankara,C=TR
-# Serial Number:7d:a1:f2:65:ec:8a
-# Subject: CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s.. H6,O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A....,L=Ankara,C=TR
-# Not Valid Before: Wed Dec 18 09:04:10 2013
-# Not Valid After : Sat Dec 16 09:04:10 2023
-# Fingerprint (SHA-256): 8D:E7:86:55:E1:BE:7F:78:47:80:0B:93:F6:94:D2:1D:36:8C:C0:6E:03:3E:7F:AB:04:BB:5E:B9:9D:A6:B7:00
-# Fingerprint (SHA1): 8A:5C:8C:EE:A5:03:E6:05:56:BA:D8:1B:D4:F6:C9:B0:ED:E5:2F:E0
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\212\134\214\356\245\003\346\005\126\272\330\033\324\366\311\260
-\355\345\057\340
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\370\305\356\052\153\276\225\215\010\367\045\112\352\161\076\106
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\261\061\013\060\011\006\003\125\004\006\023\002\124\122
-\061\017\060\015\006\003\125\004\007\014\006\101\156\153\141\162
-\141\061\115\060\113\006\003\125\004\012\014\104\124\303\234\122
-\113\124\122\125\123\124\040\102\151\154\147\151\040\304\260\154
-\145\164\151\305\237\151\155\040\166\145\040\102\151\154\151\305
-\237\151\155\040\107\303\274\166\145\156\154\151\304\237\151\040
-\110\151\172\155\145\164\154\145\162\151\040\101\056\305\236\056
-\061\102\060\100\006\003\125\004\003\014\071\124\303\234\122\113
-\124\122\125\123\124\040\105\154\145\153\164\162\157\156\151\153
-\040\123\145\162\164\151\146\151\153\141\040\110\151\172\155\145
-\164\040\123\141\304\237\154\141\171\304\261\143\304\261\163\304
-\261\040\110\066
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\006\175\241\362\145\354\212
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
#
# Certificate "Certinomis - Root CA"
#
@@ -28503,6 +26051,7 @@ CKA_VALUE MULTILINE_OCTAL
\210\025\106\317\355\151\065\377\165\015\106\363\316\161\341\305
\153\206\102\006\271\101
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Certinomis - Root CA"
# Issuer: CN=Certinomis - Root CA,OU=0002 433998903,O=Certinomis,C=FR
@@ -28641,6 +26190,7 @@ CKA_VALUE MULTILINE_OCTAL
\313\216\075\103\151\234\232\130\320\044\073\337\033\100\226\176
\065\255\201\307\116\161\272\210\023
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "OISTE WISeKey Global Root GB CA"
# Issuer: CN=OISTE WISeKey Global Root GB CA,OU=OISTE Foundation Endorsed,O=WISeKey,C=CH
@@ -28775,6 +26325,7 @@ CKA_VALUE MULTILINE_OCTAL
\135\107\267\041\362\215\321\012\231\216\343\156\076\255\160\340
\217\271\312\314\156\201\061\366\173\234\172\171\344\147\161\030
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Certification Authority of WoSign G2"
# Issuer: CN=Certification Authority of WoSign G2,O=WoSign CA Limited,C=CN
@@ -28883,6 +26434,7 @@ CKA_VALUE MULTILINE_OCTAL
\177\336\126\364\220\261\025\021\330\262\042\025\320\057\303\046
\056\153\361\221\262\220\145\364\232\346\220\356\112
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "CA WoSign ECC Root"
# Issuer: CN=CA WoSign ECC Root,O=WoSign CA Limited,C=CN
@@ -29015,6 +26567,7 @@ CKA_VALUE MULTILINE_OCTAL
\056\365\251\013\077\324\135\341\317\204\237\342\031\302\137\212
\326\040\036\343\163\267
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "SZAFIR ROOT CA2"
# Issuer: CN=SZAFIR ROOT CA2,O=Krajowa Izba Rozliczeniowa S.A.,C=PL
@@ -29192,6 +26745,7 @@ CKA_VALUE MULTILINE_OCTAL
\103\150\010\152\137\073\360\166\143\373\314\006\054\246\306\342
\016\265\271\276\044\217
END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
# Trust for "Certum Trusted Network CA 2"
# Issuer: CN=Certum Trusted Network CA 2,OU=Certum Certification Authority,O=Unizeto Technologies S.A.,C=PL
@@ -29232,3 +26786,2892 @@ CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Hellenic Academic and Research Institutions RootCA 2015"
+#
+# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Serial Number: 0 (0x0)
+# Subject: CN=Hellenic Academic and Research Institutions RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Not Valid Before: Tue Jul 07 10:11:21 2015
+# Not Valid After : Sat Jun 30 10:11:21 2040
+# Fingerprint (SHA-256): A0:40:92:9A:02:CE:53:B4:AC:F4:F2:FF:C6:98:1C:E4:49:6F:75:5E:6D:45:FE:0B:2A:69:2B:CD:52:52:3F:36
+# Fingerprint (SHA1): 01:0C:06:95:A6:98:19:14:FF:BF:5F:C6:B0:B6:95:EA:29:E9:12:A6
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Hellenic Academic and Research Institutions RootCA 2015"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\246\061\013\060\011\006\003\125\004\006\023\002\107\122
+\061\017\060\015\006\003\125\004\007\023\006\101\164\150\145\156
+\163\061\104\060\102\006\003\125\004\012\023\073\110\145\154\154
+\145\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156
+\144\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151
+\164\165\164\151\157\156\163\040\103\145\162\164\056\040\101\165
+\164\150\157\162\151\164\171\061\100\060\076\006\003\125\004\003
+\023\067\110\145\154\154\145\156\151\143\040\101\143\141\144\145
+\155\151\143\040\141\156\144\040\122\145\163\145\141\162\143\150
+\040\111\156\163\164\151\164\165\164\151\157\156\163\040\122\157
+\157\164\103\101\040\062\060\061\065
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\246\061\013\060\011\006\003\125\004\006\023\002\107\122
+\061\017\060\015\006\003\125\004\007\023\006\101\164\150\145\156
+\163\061\104\060\102\006\003\125\004\012\023\073\110\145\154\154
+\145\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156
+\144\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151
+\164\165\164\151\157\156\163\040\103\145\162\164\056\040\101\165
+\164\150\157\162\151\164\171\061\100\060\076\006\003\125\004\003
+\023\067\110\145\154\154\145\156\151\143\040\101\143\141\144\145
+\155\151\143\040\141\156\144\040\122\145\163\145\141\162\143\150
+\040\111\156\163\164\151\164\165\164\151\157\156\163\040\122\157
+\157\164\103\101\040\062\060\061\065
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\000
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\006\013\060\202\003\363\240\003\002\001\002\002\001\000
+\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060
+\201\246\061\013\060\011\006\003\125\004\006\023\002\107\122\061
+\017\060\015\006\003\125\004\007\023\006\101\164\150\145\156\163
+\061\104\060\102\006\003\125\004\012\023\073\110\145\154\154\145
+\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156\144
+\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151\164
+\165\164\151\157\156\163\040\103\145\162\164\056\040\101\165\164
+\150\157\162\151\164\171\061\100\060\076\006\003\125\004\003\023
+\067\110\145\154\154\145\156\151\143\040\101\143\141\144\145\155
+\151\143\040\141\156\144\040\122\145\163\145\141\162\143\150\040
+\111\156\163\164\151\164\165\164\151\157\156\163\040\122\157\157
+\164\103\101\040\062\060\061\065\060\036\027\015\061\065\060\067
+\060\067\061\060\061\061\062\061\132\027\015\064\060\060\066\063
+\060\061\060\061\061\062\061\132\060\201\246\061\013\060\011\006
+\003\125\004\006\023\002\107\122\061\017\060\015\006\003\125\004
+\007\023\006\101\164\150\145\156\163\061\104\060\102\006\003\125
+\004\012\023\073\110\145\154\154\145\156\151\143\040\101\143\141
+\144\145\155\151\143\040\141\156\144\040\122\145\163\145\141\162
+\143\150\040\111\156\163\164\151\164\165\164\151\157\156\163\040
+\103\145\162\164\056\040\101\165\164\150\157\162\151\164\171\061
+\100\060\076\006\003\125\004\003\023\067\110\145\154\154\145\156
+\151\143\040\101\143\141\144\145\155\151\143\040\141\156\144\040
+\122\145\163\145\141\162\143\150\040\111\156\163\164\151\164\165
+\164\151\157\156\163\040\122\157\157\164\103\101\040\062\060\061
+\065\060\202\002\042\060\015\006\011\052\206\110\206\367\015\001
+\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202\002
+\001\000\302\370\251\077\033\211\374\074\074\004\135\075\220\066
+\260\221\072\171\074\146\132\357\155\071\001\111\032\264\267\317
+\177\115\043\123\267\220\000\343\023\052\050\246\061\361\221\000
+\343\050\354\256\041\101\316\037\332\375\175\022\133\001\203\017
+\271\260\137\231\341\362\022\203\200\115\006\076\337\254\257\347
+\241\210\153\061\257\360\213\320\030\063\270\333\105\152\064\364
+\002\200\044\050\012\002\025\225\136\166\052\015\231\072\024\133
+\366\313\313\123\274\023\115\001\210\067\224\045\033\102\274\042
+\330\216\243\226\136\072\331\062\333\076\350\360\020\145\355\164
+\341\057\247\174\257\047\064\273\051\175\233\266\317\011\310\345
+\323\012\374\210\145\145\164\012\334\163\034\134\315\100\261\034
+\324\266\204\214\114\120\317\150\216\250\131\256\302\047\116\202
+\242\065\335\024\364\037\377\262\167\325\207\057\252\156\175\044
+\047\347\306\313\046\346\345\376\147\007\143\330\105\015\335\072
+\131\145\071\130\172\222\231\162\075\234\204\136\210\041\270\325
+\364\054\374\331\160\122\117\170\270\275\074\053\213\225\230\365
+\263\321\150\317\040\024\176\114\134\137\347\213\345\365\065\201
+\031\067\327\021\010\267\146\276\323\112\316\203\127\000\072\303
+\201\370\027\313\222\066\135\321\243\330\165\033\341\213\047\352
+\172\110\101\375\105\031\006\255\047\231\116\301\160\107\335\265
+\237\201\123\022\345\261\214\110\135\061\103\027\343\214\306\172
+\143\226\113\051\060\116\204\116\142\031\136\074\316\227\220\245
+\177\001\353\235\340\370\213\211\335\045\230\075\222\266\176\357
+\331\361\121\121\175\055\046\310\151\131\141\340\254\152\270\052
+\066\021\004\172\120\275\062\204\276\057\334\162\325\327\035\026
+\107\344\107\146\040\077\364\226\305\257\216\001\172\245\017\172
+\144\365\015\030\207\331\256\210\325\372\204\301\072\300\151\050
+\055\362\015\150\121\252\343\245\167\306\244\220\016\241\067\213
+\061\043\107\301\011\010\353\156\367\170\233\327\202\374\204\040
+\231\111\031\266\022\106\261\373\105\125\026\251\243\145\254\234
+\007\017\352\153\334\037\056\006\162\354\206\210\022\344\055\333
+\137\005\057\344\360\003\323\046\063\347\200\302\315\102\241\027
+\064\013\002\003\001\000\001\243\102\060\100\060\017\006\003\125
+\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006\003
+\125\035\017\001\001\377\004\004\003\002\001\006\060\035\006\003
+\125\035\016\004\026\004\024\161\025\147\310\310\311\275\165\135
+\162\320\070\030\152\235\363\161\044\124\013\060\015\006\011\052
+\206\110\206\367\015\001\001\013\005\000\003\202\002\001\000\165
+\273\155\124\113\252\020\130\106\064\362\142\327\026\066\135\010
+\136\325\154\310\207\275\264\056\106\362\061\370\174\352\102\265
+\223\026\125\334\241\014\022\240\332\141\176\017\130\130\163\144
+\162\307\350\105\216\334\251\362\046\077\306\171\214\261\123\010
+\063\201\260\126\023\276\346\121\134\330\233\012\117\113\234\126
+\123\002\351\117\366\015\140\352\115\102\125\350\174\033\041\041
+\323\033\072\314\167\362\270\220\361\150\307\371\132\376\372\055
+\364\277\311\365\105\033\316\070\020\052\067\212\171\243\264\343
+\011\154\205\206\223\377\211\226\047\170\201\217\147\343\106\164
+\124\216\331\015\151\342\112\364\115\164\003\377\262\167\355\225
+\147\227\344\261\305\253\277\152\043\350\324\224\342\104\050\142
+\304\113\342\360\330\342\051\153\032\160\176\044\141\223\173\117
+\003\062\045\015\105\044\053\226\264\106\152\277\112\013\367\232
+\217\301\254\032\305\147\363\157\064\322\372\163\143\214\357\026
+\260\250\244\106\052\370\353\022\354\162\264\357\370\053\176\214
+\122\300\213\204\124\371\057\076\343\125\250\334\146\261\331\341
+\137\330\263\214\131\064\131\244\253\117\154\273\037\030\333\165
+\253\330\313\222\315\224\070\141\016\007\006\037\113\106\020\361
+\025\276\215\205\134\073\112\053\201\171\017\264\151\237\111\120
+\227\115\367\016\126\135\300\225\152\302\066\303\033\150\311\365
+\052\334\107\232\276\262\316\305\045\350\372\003\271\332\371\026
+\156\221\204\365\034\050\310\374\046\314\327\034\220\126\247\137
+\157\072\004\274\315\170\211\013\216\017\057\243\252\117\242\033
+\022\075\026\010\100\017\361\106\114\327\252\173\010\301\012\365
+\155\047\336\002\217\312\303\265\053\312\351\353\310\041\123\070
+\245\314\073\330\167\067\060\242\117\331\157\321\362\100\255\101
+\172\027\305\326\112\065\211\267\101\325\174\206\177\125\115\203
+\112\245\163\040\300\072\257\220\361\232\044\216\331\216\161\312
+\173\270\206\332\262\217\231\076\035\023\015\022\021\356\324\253
+\360\351\025\166\002\344\340\337\252\040\036\133\141\205\144\100
+\251\220\227\015\255\123\322\132\035\207\152\000\227\145\142\264
+\276\157\152\247\365\054\102\355\062\255\266\041\236\276\274
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Hellenic Academic and Research Institutions RootCA 2015"
+# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Serial Number: 0 (0x0)
+# Subject: CN=Hellenic Academic and Research Institutions RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Not Valid Before: Tue Jul 07 10:11:21 2015
+# Not Valid After : Sat Jun 30 10:11:21 2040
+# Fingerprint (SHA-256): A0:40:92:9A:02:CE:53:B4:AC:F4:F2:FF:C6:98:1C:E4:49:6F:75:5E:6D:45:FE:0B:2A:69:2B:CD:52:52:3F:36
+# Fingerprint (SHA1): 01:0C:06:95:A6:98:19:14:FF:BF:5F:C6:B0:B6:95:EA:29:E9:12:A6
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Hellenic Academic and Research Institutions RootCA 2015"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\001\014\006\225\246\230\031\024\377\277\137\306\260\266\225\352
+\051\351\022\246
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\312\377\342\333\003\331\313\113\351\017\255\204\375\173\030\316
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\246\061\013\060\011\006\003\125\004\006\023\002\107\122
+\061\017\060\015\006\003\125\004\007\023\006\101\164\150\145\156
+\163\061\104\060\102\006\003\125\004\012\023\073\110\145\154\154
+\145\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156
+\144\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151
+\164\165\164\151\157\156\163\040\103\145\162\164\056\040\101\165
+\164\150\157\162\151\164\171\061\100\060\076\006\003\125\004\003
+\023\067\110\145\154\154\145\156\151\143\040\101\143\141\144\145
+\155\151\143\040\141\156\144\040\122\145\163\145\141\162\143\150
+\040\111\156\163\164\151\164\165\164\151\157\156\163\040\122\157
+\157\164\103\101\040\062\060\061\065
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\000
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Hellenic Academic and Research Institutions ECC RootCA 2015"
+#
+# Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Serial Number: 0 (0x0)
+# Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Not Valid Before: Tue Jul 07 10:37:12 2015
+# Not Valid After : Sat Jun 30 10:37:12 2040
+# Fingerprint (SHA-256): 44:B5:45:AA:8A:25:E6:5A:73:CA:15:DC:27:FC:36:D2:4C:1C:B9:95:3A:06:65:39:B1:15:82:DC:48:7B:48:33
+# Fingerprint (SHA1): 9F:F1:71:8D:92:D5:9A:F3:7D:74:97:B4:BC:6F:84:68:0B:BA:B6:66
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Hellenic Academic and Research Institutions ECC RootCA 2015"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\252\061\013\060\011\006\003\125\004\006\023\002\107\122
+\061\017\060\015\006\003\125\004\007\023\006\101\164\150\145\156
+\163\061\104\060\102\006\003\125\004\012\023\073\110\145\154\154
+\145\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156
+\144\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151
+\164\165\164\151\157\156\163\040\103\145\162\164\056\040\101\165
+\164\150\157\162\151\164\171\061\104\060\102\006\003\125\004\003
+\023\073\110\145\154\154\145\156\151\143\040\101\143\141\144\145
+\155\151\143\040\141\156\144\040\122\145\163\145\141\162\143\150
+\040\111\156\163\164\151\164\165\164\151\157\156\163\040\105\103
+\103\040\122\157\157\164\103\101\040\062\060\061\065
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\252\061\013\060\011\006\003\125\004\006\023\002\107\122
+\061\017\060\015\006\003\125\004\007\023\006\101\164\150\145\156
+\163\061\104\060\102\006\003\125\004\012\023\073\110\145\154\154
+\145\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156
+\144\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151
+\164\165\164\151\157\156\163\040\103\145\162\164\056\040\101\165
+\164\150\157\162\151\164\171\061\104\060\102\006\003\125\004\003
+\023\073\110\145\154\154\145\156\151\143\040\101\143\141\144\145
+\155\151\143\040\141\156\144\040\122\145\163\145\141\162\143\150
+\040\111\156\163\164\151\164\165\164\151\157\156\163\040\105\103
+\103\040\122\157\157\164\103\101\040\062\060\061\065
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\000
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\002\303\060\202\002\112\240\003\002\001\002\002\001\000
+\060\012\006\010\052\206\110\316\075\004\003\002\060\201\252\061
+\013\060\011\006\003\125\004\006\023\002\107\122\061\017\060\015
+\006\003\125\004\007\023\006\101\164\150\145\156\163\061\104\060
+\102\006\003\125\004\012\023\073\110\145\154\154\145\156\151\143
+\040\101\143\141\144\145\155\151\143\040\141\156\144\040\122\145
+\163\145\141\162\143\150\040\111\156\163\164\151\164\165\164\151
+\157\156\163\040\103\145\162\164\056\040\101\165\164\150\157\162
+\151\164\171\061\104\060\102\006\003\125\004\003\023\073\110\145
+\154\154\145\156\151\143\040\101\143\141\144\145\155\151\143\040
+\141\156\144\040\122\145\163\145\141\162\143\150\040\111\156\163
+\164\151\164\165\164\151\157\156\163\040\105\103\103\040\122\157
+\157\164\103\101\040\062\060\061\065\060\036\027\015\061\065\060
+\067\060\067\061\060\063\067\061\062\132\027\015\064\060\060\066
+\063\060\061\060\063\067\061\062\132\060\201\252\061\013\060\011
+\006\003\125\004\006\023\002\107\122\061\017\060\015\006\003\125
+\004\007\023\006\101\164\150\145\156\163\061\104\060\102\006\003
+\125\004\012\023\073\110\145\154\154\145\156\151\143\040\101\143
+\141\144\145\155\151\143\040\141\156\144\040\122\145\163\145\141
+\162\143\150\040\111\156\163\164\151\164\165\164\151\157\156\163
+\040\103\145\162\164\056\040\101\165\164\150\157\162\151\164\171
+\061\104\060\102\006\003\125\004\003\023\073\110\145\154\154\145
+\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156\144
+\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151\164
+\165\164\151\157\156\163\040\105\103\103\040\122\157\157\164\103
+\101\040\062\060\061\065\060\166\060\020\006\007\052\206\110\316
+\075\002\001\006\005\053\201\004\000\042\003\142\000\004\222\240
+\101\350\113\202\204\134\342\370\061\021\231\206\144\116\011\045
+\057\235\101\057\012\256\065\117\164\225\262\121\144\153\215\153
+\346\077\160\225\360\005\104\107\246\162\070\120\166\225\002\132
+\216\256\050\236\371\055\116\231\357\054\110\157\114\045\051\350
+\321\161\133\337\035\301\165\067\264\327\372\173\172\102\234\152
+\012\126\132\174\151\013\252\200\011\044\154\176\301\106\243\102
+\060\100\060\017\006\003\125\035\023\001\001\377\004\005\060\003
+\001\001\377\060\016\006\003\125\035\017\001\001\377\004\004\003
+\002\001\006\060\035\006\003\125\035\016\004\026\004\024\264\042
+\013\202\231\044\001\016\234\273\344\016\375\277\373\227\040\223
+\231\052\060\012\006\010\052\206\110\316\075\004\003\002\003\147
+\000\060\144\002\060\147\316\026\142\070\242\254\142\105\247\251
+\225\044\300\032\047\234\062\073\300\300\325\272\251\347\370\004
+\103\123\205\356\122\041\336\235\365\045\203\076\236\130\113\057
+\327\147\023\016\041\002\060\005\341\165\001\336\150\355\052\037
+\115\114\011\010\015\354\113\255\144\027\050\347\165\316\105\145
+\162\041\027\313\042\101\016\214\023\230\070\232\124\155\233\312
+\342\174\352\002\130\042\221
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Hellenic Academic and Research Institutions ECC RootCA 2015"
+# Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Serial Number: 0 (0x0)
+# Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015,O=Hellenic Academic and Research Institutions Cert. Authority,L=Athens,C=GR
+# Not Valid Before: Tue Jul 07 10:37:12 2015
+# Not Valid After : Sat Jun 30 10:37:12 2040
+# Fingerprint (SHA-256): 44:B5:45:AA:8A:25:E6:5A:73:CA:15:DC:27:FC:36:D2:4C:1C:B9:95:3A:06:65:39:B1:15:82:DC:48:7B:48:33
+# Fingerprint (SHA1): 9F:F1:71:8D:92:D5:9A:F3:7D:74:97:B4:BC:6F:84:68:0B:BA:B6:66
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Hellenic Academic and Research Institutions ECC RootCA 2015"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\237\361\161\215\222\325\232\363\175\164\227\264\274\157\204\150
+\013\272\266\146
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\201\345\264\027\353\302\365\341\113\015\101\173\111\222\376\357
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\252\061\013\060\011\006\003\125\004\006\023\002\107\122
+\061\017\060\015\006\003\125\004\007\023\006\101\164\150\145\156
+\163\061\104\060\102\006\003\125\004\012\023\073\110\145\154\154
+\145\156\151\143\040\101\143\141\144\145\155\151\143\040\141\156
+\144\040\122\145\163\145\141\162\143\150\040\111\156\163\164\151
+\164\165\164\151\157\156\163\040\103\145\162\164\056\040\101\165
+\164\150\157\162\151\164\171\061\104\060\102\006\003\125\004\003
+\023\073\110\145\154\154\145\156\151\143\040\101\143\141\144\145
+\155\151\143\040\141\156\144\040\122\145\163\145\141\162\143\150
+\040\111\156\163\164\151\164\165\164\151\157\156\163\040\105\103
+\103\040\122\157\157\164\103\101\040\062\060\061\065
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\000
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Certplus Root CA G1"
+#
+# Issuer: CN=Certplus Root CA G1,O=Certplus,C=FR
+# Serial Number:11:20:55:83:e4:2d:3e:54:56:85:2d:83:37:b7:2c:dc:46:11
+# Subject: CN=Certplus Root CA G1,O=Certplus,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 15:2A:40:2B:FC:DF:2C:D5:48:05:4D:22:75:B3:9C:7F:CA:3E:C0:97:80:78:B0:F0:EA:76:E5:61:A6:C7:43:3E
+# Fingerprint (SHA1): 22:FD:D0:B7:FD:A2:4E:0D:AC:49:2C:A0:AC:A6:7B:6A:1F:E3:F7:66
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certplus Root CA G1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\061
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\125\203\344\055\076\124\126\205\055\203\067\267
+\054\334\106\021
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\153\060\202\003\123\240\003\002\001\002\002\022\021
+\040\125\203\344\055\076\124\126\205\055\203\067\267\054\334\106
+\021\060\015\006\011\052\206\110\206\367\015\001\001\015\005\000
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\061
+\060\036\027\015\061\064\060\065\062\066\060\060\060\060\060\060
+\132\027\015\063\070\060\061\061\065\060\060\060\060\060\060\132
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\061
+\060\202\002\042\060\015\006\011\052\206\110\206\367\015\001\001
+\001\005\000\003\202\002\017\000\060\202\002\012\002\202\002\001
+\000\332\120\207\266\332\270\251\076\235\144\372\126\063\232\126
+\075\026\345\003\225\262\064\034\232\155\142\005\324\330\217\347
+\211\144\237\272\333\144\213\144\346\171\052\141\315\257\217\132
+\211\221\145\271\130\374\264\003\137\221\077\055\020\025\340\176
+\317\274\374\177\103\147\250\255\136\066\043\330\230\263\115\363
+\103\236\071\174\052\374\354\210\325\210\356\160\275\205\026\055
+\352\113\211\074\243\161\102\376\034\375\323\034\055\020\270\206
+\124\352\103\270\333\306\207\332\250\256\200\045\317\172\046\035
+\252\221\260\110\157\256\265\336\236\330\327\372\000\375\306\217
+\320\121\273\142\175\244\261\214\262\377\040\021\272\065\143\005
+\206\107\140\103\063\220\366\107\242\003\117\226\115\235\117\301
+\352\352\234\242\376\064\056\336\267\312\033\166\244\267\255\237
+\351\250\324\170\077\170\376\362\070\011\066\035\322\026\002\310
+\354\052\150\257\365\216\224\357\055\023\172\036\102\112\035\025
+\061\256\014\004\127\374\141\163\363\061\126\206\061\200\240\304
+\021\156\060\166\343\224\360\137\004\304\254\207\162\211\230\305
+\235\314\127\010\232\364\014\374\175\172\005\072\372\107\200\071
+\266\317\204\023\167\157\047\352\377\226\147\027\010\155\351\015
+\326\043\120\060\260\025\164\023\076\345\057\377\016\315\304\013
+\112\135\360\330\000\063\111\146\353\241\030\174\131\056\075\050
+\271\141\161\313\265\245\272\270\352\334\342\160\157\010\152\334
+\207\147\064\357\337\060\162\335\363\311\077\043\377\065\341\276
+\041\051\040\060\201\344\031\245\040\351\045\312\163\061\164\051
+\276\342\102\325\363\262\046\146\307\150\375\031\263\347\040\223
+\231\350\135\340\136\207\347\106\350\045\234\012\051\044\324\315
+\130\206\122\100\044\262\173\017\230\022\040\044\366\220\154\107
+\310\015\273\030\040\056\331\375\374\213\362\051\352\207\164\225
+\340\102\120\170\204\004\101\141\260\364\041\043\217\055\313\050
+\041\362\152\154\364\032\246\305\024\264\067\145\117\225\375\200
+\310\370\162\345\045\153\304\140\261\173\155\216\112\212\163\316
+\131\373\160\172\163\006\023\331\323\164\067\044\101\012\021\157
+\227\334\347\344\176\241\275\025\362\272\207\017\075\150\212\026
+\007\002\003\001\000\001\243\143\060\141\060\016\006\003\125\035
+\017\001\001\377\004\004\003\002\001\006\060\017\006\003\125\035
+\023\001\001\377\004\005\060\003\001\001\377\060\035\006\003\125
+\035\016\004\026\004\024\250\301\300\233\221\250\103\025\174\135
+\006\047\264\052\121\330\227\013\201\261\060\037\006\003\125\035
+\043\004\030\060\026\200\024\250\301\300\233\221\250\103\025\174
+\135\006\047\264\052\121\330\227\013\201\261\060\015\006\011\052
+\206\110\206\367\015\001\001\015\005\000\003\202\002\001\000\234
+\126\157\001\176\321\275\114\365\212\306\360\046\037\344\340\070
+\030\314\062\303\051\073\235\101\051\064\141\306\327\360\000\241
+\353\244\162\217\224\027\274\023\054\165\264\127\356\012\174\011
+\172\334\325\312\241\320\064\023\370\167\253\237\345\376\330\036
+\164\212\205\007\217\177\314\171\172\312\226\315\315\375\117\373
+\375\043\015\220\365\364\136\323\306\141\175\236\021\340\002\356
+\011\004\331\007\335\246\212\267\014\203\044\273\203\120\222\376
+\140\165\021\076\330\235\260\212\172\265\340\235\233\313\220\122
+\113\260\223\052\324\076\026\063\345\236\306\145\025\076\144\073
+\004\077\333\014\217\137\134\035\151\037\257\363\351\041\214\363
+\357\227\366\232\267\031\266\204\164\234\243\124\265\160\116\143
+\330\127\135\123\041\233\100\222\103\372\326\167\125\063\117\144
+\325\373\320\054\152\216\155\045\246\357\205\350\002\304\123\076
+\271\236\207\274\314\065\032\336\241\351\212\143\207\145\036\021
+\052\333\143\167\227\024\276\232\024\231\021\262\300\356\260\117
+\370\024\041\062\103\117\237\253\242\313\250\017\252\073\006\125
+\306\022\051\127\010\324\067\327\207\047\255\111\131\247\221\253
+\104\172\136\215\160\333\227\316\110\120\261\163\223\366\360\203
+\140\371\315\361\341\061\375\133\174\161\041\143\024\024\252\257
+\305\336\223\176\150\261\354\042\242\252\220\165\236\265\103\162
+\352\144\243\204\113\375\014\250\046\153\161\227\356\126\143\146
+\350\102\124\371\307\035\337\320\217\133\337\310\060\157\210\376
+\015\304\063\034\123\250\243\375\110\020\362\344\012\116\341\025
+\127\374\156\144\060\302\125\021\334\352\251\315\112\124\254\051
+\143\104\317\112\100\240\326\150\131\033\063\371\357\072\213\333
+\040\222\334\102\204\277\001\253\207\300\325\040\202\333\306\271
+\203\205\102\134\017\103\073\152\111\065\325\230\364\025\277\372
+\141\201\014\011\040\030\322\320\027\014\313\110\000\120\351\166
+\202\214\144\327\072\240\007\125\314\036\061\300\357\072\264\145
+\373\343\277\102\153\236\017\250\275\153\230\334\330\333\313\213
+\244\335\327\131\364\156\335\376\252\303\221\320\056\102\007\300
+\014\115\123\315\044\261\114\133\036\121\364\337\351\222\372
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Certplus Root CA G1"
+# Issuer: CN=Certplus Root CA G1,O=Certplus,C=FR
+# Serial Number:11:20:55:83:e4:2d:3e:54:56:85:2d:83:37:b7:2c:dc:46:11
+# Subject: CN=Certplus Root CA G1,O=Certplus,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 15:2A:40:2B:FC:DF:2C:D5:48:05:4D:22:75:B3:9C:7F:CA:3E:C0:97:80:78:B0:F0:EA:76:E5:61:A6:C7:43:3E
+# Fingerprint (SHA1): 22:FD:D0:B7:FD:A2:4E:0D:AC:49:2C:A0:AC:A6:7B:6A:1F:E3:F7:66
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certplus Root CA G1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\042\375\320\267\375\242\116\015\254\111\054\240\254\246\173\152
+\037\343\367\146
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\177\011\234\367\331\271\134\151\151\126\325\067\076\024\015\102
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\125\203\344\055\076\124\126\205\055\203\067\267
+\054\334\106\021
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Certplus Root CA G2"
+#
+# Issuer: CN=Certplus Root CA G2,O=Certplus,C=FR
+# Serial Number:11:20:d9:91:ce:ae:a3:e8:c5:e7:ff:e9:02:af:cf:73:bc:55
+# Subject: CN=Certplus Root CA G2,O=Certplus,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 6C:C0:50:41:E6:44:5E:74:69:6C:4C:FB:C9:F8:0F:54:3B:7E:AB:BB:44:B4:CE:6F:78:7C:6A:99:71:C4:2F:17
+# Fingerprint (SHA1): 4F:65:8E:1F:E9:06:D8:28:02:E9:54:47:41:C9:54:25:5D:69:CC:1A
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certplus Root CA G2"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\062
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\331\221\316\256\243\350\305\347\377\351\002\257
+\317\163\274\125
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\002\034\060\202\001\242\240\003\002\001\002\002\022\021
+\040\331\221\316\256\243\350\305\347\377\351\002\257\317\163\274
+\125\060\012\006\010\052\206\110\316\075\004\003\003\060\076\061
+\013\060\011\006\003\125\004\006\023\002\106\122\061\021\060\017
+\006\003\125\004\012\014\010\103\145\162\164\160\154\165\163\061
+\034\060\032\006\003\125\004\003\014\023\103\145\162\164\160\154
+\165\163\040\122\157\157\164\040\103\101\040\107\062\060\036\027
+\015\061\064\060\065\062\066\060\060\060\060\060\060\132\027\015
+\063\070\060\061\061\065\060\060\060\060\060\060\132\060\076\061
+\013\060\011\006\003\125\004\006\023\002\106\122\061\021\060\017
+\006\003\125\004\012\014\010\103\145\162\164\160\154\165\163\061
+\034\060\032\006\003\125\004\003\014\023\103\145\162\164\160\154
+\165\163\040\122\157\157\164\040\103\101\040\107\062\060\166\060
+\020\006\007\052\206\110\316\075\002\001\006\005\053\201\004\000
+\042\003\142\000\004\315\017\133\126\202\337\360\105\032\326\255
+\367\171\360\035\311\254\226\326\236\116\234\037\264\102\021\312
+\206\277\155\373\205\243\305\345\031\134\327\356\246\077\151\147
+\330\170\342\246\311\304\333\055\171\056\347\213\215\002\157\061
+\042\115\006\343\140\162\105\235\016\102\167\236\316\317\345\177
+\205\233\030\344\374\314\056\162\323\026\223\116\312\231\143\134
+\241\005\052\154\006\243\143\060\141\060\016\006\003\125\035\017
+\001\001\377\004\004\003\002\001\006\060\017\006\003\125\035\023
+\001\001\377\004\005\060\003\001\001\377\060\035\006\003\125\035
+\016\004\026\004\024\332\203\143\002\171\216\332\114\306\074\043
+\024\330\217\303\040\253\050\140\131\060\037\006\003\125\035\043
+\004\030\060\026\200\024\332\203\143\002\171\216\332\114\306\074
+\043\024\330\217\303\040\253\050\140\131\060\012\006\010\052\206
+\110\316\075\004\003\003\003\150\000\060\145\002\060\160\376\260
+\013\331\367\203\227\354\363\125\035\324\334\263\006\016\376\063
+\230\235\213\071\220\153\224\041\355\266\327\135\326\114\327\041
+\247\347\277\041\017\053\315\367\052\334\205\007\235\002\061\000
+\206\024\026\345\334\260\145\302\300\216\024\237\277\044\026\150
+\345\274\371\171\151\334\255\105\053\367\266\061\163\314\006\245
+\123\223\221\032\223\256\160\152\147\272\327\236\345\141\032\137
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Certplus Root CA G2"
+# Issuer: CN=Certplus Root CA G2,O=Certplus,C=FR
+# Serial Number:11:20:d9:91:ce:ae:a3:e8:c5:e7:ff:e9:02:af:cf:73:bc:55
+# Subject: CN=Certplus Root CA G2,O=Certplus,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 6C:C0:50:41:E6:44:5E:74:69:6C:4C:FB:C9:F8:0F:54:3B:7E:AB:BB:44:B4:CE:6F:78:7C:6A:99:71:C4:2F:17
+# Fingerprint (SHA1): 4F:65:8E:1F:E9:06:D8:28:02:E9:54:47:41:C9:54:25:5D:69:CC:1A
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certplus Root CA G2"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\117\145\216\037\351\006\330\050\002\351\124\107\101\311\124\045
+\135\151\314\032
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\247\356\304\170\055\033\356\055\271\051\316\326\247\226\062\061
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\021\060\017\006\003\125\004\012\014\010\103\145\162\164\160\154
+\165\163\061\034\060\032\006\003\125\004\003\014\023\103\145\162
+\164\160\154\165\163\040\122\157\157\164\040\103\101\040\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\331\221\316\256\243\350\305\347\377\351\002\257
+\317\163\274\125
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "OpenTrust Root CA G1"
+#
+# Issuer: CN=OpenTrust Root CA G1,O=OpenTrust,C=FR
+# Serial Number:11:20:b3:90:55:39:7d:7f:36:6d:64:c2:a7:9f:6b:63:8e:67
+# Subject: CN=OpenTrust Root CA G1,O=OpenTrust,C=FR
+# Not Valid Before: Mon May 26 08:45:50 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 56:C7:71:28:D9:8C:18:D9:1B:4C:FD:FF:BC:25:EE:91:03:D4:75:8E:A2:AB:AD:82:6A:90:F3:45:7D:46:0E:B4
+# Fingerprint (SHA1): 79:91:E8:34:F7:E2:EE:DD:08:95:01:52:E9:55:2D:14:E9:58:D5:7E
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "OpenTrust Root CA G1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\061
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\263\220\125\071\175\177\066\155\144\302\247\237
+\153\143\216\147
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\157\060\202\003\127\240\003\002\001\002\002\022\021
+\040\263\220\125\071\175\177\066\155\144\302\247\237\153\143\216
+\147\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\061\060\036\027\015\061\064\060\065\062\066\060\070\064\065
+\065\060\132\027\015\063\070\060\061\061\065\060\060\060\060\060
+\060\132\060\100\061\013\060\011\006\003\125\004\006\023\002\106
+\122\061\022\060\020\006\003\125\004\012\014\011\117\160\145\156
+\124\162\165\163\164\061\035\060\033\006\003\125\004\003\014\024
+\117\160\145\156\124\162\165\163\164\040\122\157\157\164\040\103
+\101\040\107\061\060\202\002\042\060\015\006\011\052\206\110\206
+\367\015\001\001\001\005\000\003\202\002\017\000\060\202\002\012
+\002\202\002\001\000\370\171\106\332\226\305\060\136\212\161\003
+\055\160\244\273\260\305\010\334\315\346\065\300\200\244\021\055
+\335\346\207\256\135\075\221\322\207\154\067\267\332\142\236\233
+\302\044\327\217\361\333\246\246\337\106\157\121\246\161\313\076
+\033\061\147\142\367\021\133\064\047\325\171\116\214\233\130\275
+\042\020\015\134\047\014\335\060\345\250\323\135\041\070\164\027
+\376\343\037\266\117\073\153\055\333\175\140\037\214\175\114\005
+\302\353\001\026\025\230\024\216\321\220\167\042\077\354\302\071
+\270\171\072\360\111\044\342\225\221\334\141\064\222\214\124\164
+\357\261\175\214\001\342\070\175\301\137\152\137\044\262\216\142
+\027\255\171\040\255\253\035\267\340\264\226\110\117\146\103\020
+\006\026\044\003\341\340\234\216\306\106\117\216\032\231\341\217
+\271\216\063\154\151\336\130\255\240\016\247\144\124\021\151\104
+\146\117\114\022\247\216\054\175\304\324\133\305\000\064\060\301
+\331\231\376\062\316\007\204\264\116\315\012\377\066\115\142\361
+\247\143\127\344\333\152\247\256\277\053\271\311\346\262\047\211
+\345\176\232\034\115\150\306\301\030\336\063\053\121\106\113\034
+\216\367\075\014\371\212\064\024\304\373\063\065\043\361\314\361
+\052\307\245\273\260\242\316\376\123\153\115\101\033\146\050\262
+\226\372\247\256\012\116\271\071\063\104\234\164\301\223\034\370
+\340\236\044\045\103\361\233\043\202\252\337\054\040\260\334\066
+\116\003\263\174\002\324\346\173\032\252\207\023\277\076\241\164
+\273\233\016\341\300\223\237\327\244\146\312\273\033\073\343\060
+\364\063\131\212\007\162\003\125\347\163\152\003\061\156\157\226
+\033\343\242\237\257\222\307\355\365\102\267\045\114\073\023\004
+\317\034\226\257\034\042\243\320\253\005\262\114\022\043\122\334
+\375\031\133\047\234\036\073\172\375\102\043\333\043\200\023\360
+\274\121\025\124\224\246\167\076\320\164\121\275\121\024\010\071
+\067\313\037\064\251\060\235\122\204\056\125\220\261\272\337\125
+\000\013\330\126\055\261\111\111\162\200\251\142\327\300\366\030
+\021\004\125\315\164\173\317\141\160\171\364\173\054\134\134\222
+\374\345\270\132\253\114\223\225\241\047\356\245\276\317\161\043
+\102\272\233\166\055\002\003\001\000\001\243\143\060\141\060\016
+\006\003\125\035\017\001\001\377\004\004\003\002\001\006\060\017
+\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060
+\035\006\003\125\035\016\004\026\004\024\227\106\041\127\041\065
+\332\066\125\307\363\361\067\160\345\010\366\223\051\266\060\037
+\006\003\125\035\043\004\030\060\026\200\024\227\106\041\127\041
+\065\332\066\125\307\363\361\067\160\345\010\366\223\051\266\060
+\015\006\011\052\206\110\206\367\015\001\001\013\005\000\003\202
+\002\001\000\035\335\002\140\174\340\065\247\346\230\173\352\104
+\316\147\100\117\362\223\156\146\324\071\211\046\254\323\115\004
+\074\273\207\041\077\067\364\161\045\332\113\272\253\226\202\201
+\221\266\355\331\261\244\145\227\342\157\144\131\244\226\356\140
+\312\037\043\373\105\272\377\217\044\360\312\251\061\177\171\037
+\200\263\055\062\272\144\147\140\257\271\131\315\337\232\111\323
+\250\202\261\371\230\224\212\314\340\273\340\004\033\231\140\261
+\106\145\334\010\242\262\106\236\104\210\352\223\176\127\026\322
+\025\162\137\056\113\253\324\235\143\270\343\110\345\376\204\056
+\130\012\237\103\035\376\267\030\222\206\103\113\016\234\062\206
+\054\140\365\351\110\352\225\355\160\051\361\325\057\375\065\264
+\127\317\333\205\110\231\271\302\157\154\217\315\170\225\254\144
+\050\375\126\260\303\157\303\276\131\122\341\137\204\217\200\362
+\364\015\066\255\166\263\243\265\341\144\166\072\130\334\175\117
+\136\126\154\345\125\131\127\245\337\361\212\146\060\214\324\122
+\142\070\167\264\276\050\327\312\066\304\233\005\360\370\025\333
+\333\361\357\064\235\035\170\112\210\126\147\156\140\377\217\310
+\213\341\216\275\102\251\063\012\131\102\022\022\052\372\261\235
+\103\216\005\233\231\332\142\255\127\066\263\035\266\015\171\055
+\226\270\353\362\014\113\014\245\224\306\060\247\046\031\055\355
+\114\006\120\060\361\375\130\075\271\113\027\137\031\264\152\204
+\124\264\070\117\071\242\015\226\150\303\050\224\375\355\055\037
+\112\153\103\226\056\220\001\020\373\070\246\201\013\320\277\165
+\323\324\271\316\361\077\157\016\034\036\067\161\345\030\207\165
+\031\077\120\271\136\244\105\064\255\260\312\346\345\023\166\017
+\061\024\251\216\055\224\326\325\205\115\163\025\117\113\362\262
+\076\355\154\275\375\016\235\146\163\260\075\264\367\277\250\340
+\021\244\304\256\165\011\112\143\000\110\040\246\306\235\013\011
+\212\264\340\346\316\076\307\076\046\070\351\053\336\246\010\111
+\003\004\220\212\351\217\277\350\266\264\052\243\043\215\034\034
+\262\071\222\250\217\002\134\100\071\165\324\163\101\002\167\336
+\315\340\103\207\326\344\272\112\303\154\022\177\376\052\346\043
+\326\214\161
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "OpenTrust Root CA G1"
+# Issuer: CN=OpenTrust Root CA G1,O=OpenTrust,C=FR
+# Serial Number:11:20:b3:90:55:39:7d:7f:36:6d:64:c2:a7:9f:6b:63:8e:67
+# Subject: CN=OpenTrust Root CA G1,O=OpenTrust,C=FR
+# Not Valid Before: Mon May 26 08:45:50 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 56:C7:71:28:D9:8C:18:D9:1B:4C:FD:FF:BC:25:EE:91:03:D4:75:8E:A2:AB:AD:82:6A:90:F3:45:7D:46:0E:B4
+# Fingerprint (SHA1): 79:91:E8:34:F7:E2:EE:DD:08:95:01:52:E9:55:2D:14:E9:58:D5:7E
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "OpenTrust Root CA G1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\171\221\350\064\367\342\356\335\010\225\001\122\351\125\055\024
+\351\130\325\176
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\166\000\314\201\051\315\125\136\210\152\172\056\367\115\071\332
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\263\220\125\071\175\177\066\155\144\302\247\237
+\153\143\216\147
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "OpenTrust Root CA G2"
+#
+# Issuer: CN=OpenTrust Root CA G2,O=OpenTrust,C=FR
+# Serial Number:11:20:a1:69:1b:bf:bd:b9:bd:52:96:8f:23:e8:48:bf:26:11
+# Subject: CN=OpenTrust Root CA G2,O=OpenTrust,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 27:99:58:29:FE:6A:75:15:C1:BF:E8:48:F9:C4:76:1D:B1:6C:22:59:29:25:7B:F4:0D:08:94:F2:9E:A8:BA:F2
+# Fingerprint (SHA1): 79:5F:88:60:C5:AB:7C:3D:92:E6:CB:F4:8D:E1:45:CD:11:EF:60:0B
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "OpenTrust Root CA G2"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\062
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\241\151\033\277\275\271\275\122\226\217\043\350
+\110\277\046\021
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\157\060\202\003\127\240\003\002\001\002\002\022\021
+\040\241\151\033\277\275\271\275\122\226\217\043\350\110\277\046
+\021\060\015\006\011\052\206\110\206\367\015\001\001\015\005\000
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\062\060\036\027\015\061\064\060\065\062\066\060\060\060\060
+\060\060\132\027\015\063\070\060\061\061\065\060\060\060\060\060
+\060\132\060\100\061\013\060\011\006\003\125\004\006\023\002\106
+\122\061\022\060\020\006\003\125\004\012\014\011\117\160\145\156
+\124\162\165\163\164\061\035\060\033\006\003\125\004\003\014\024
+\117\160\145\156\124\162\165\163\164\040\122\157\157\164\040\103
+\101\040\107\062\060\202\002\042\060\015\006\011\052\206\110\206
+\367\015\001\001\001\005\000\003\202\002\017\000\060\202\002\012
+\002\202\002\001\000\314\266\127\245\063\224\020\201\062\123\337
+\141\176\017\166\071\317\134\302\123\165\035\111\172\226\070\335
+\242\163\152\361\157\336\136\242\132\271\161\041\276\066\331\241
+\374\274\356\154\250\174\064\032\161\032\350\032\330\137\016\104
+\006\355\247\340\363\322\141\013\340\062\242\226\321\070\360\302
+\332\001\027\374\344\254\117\350\356\211\036\164\253\117\277\036
+\011\266\066\152\126\363\341\356\226\211\146\044\006\344\315\102
+\072\112\335\340\232\260\304\202\105\263\376\311\253\134\174\076
+\311\353\027\057\014\175\156\256\245\217\310\254\045\012\157\372
+\325\105\230\322\065\011\366\003\103\224\376\331\277\040\225\171
+\200\230\212\331\211\065\273\121\033\244\067\175\374\231\073\253
+\377\277\254\015\217\103\261\231\173\026\020\176\035\157\107\304
+\025\217\004\226\010\006\102\004\370\204\326\035\274\221\246\102
+\276\111\325\152\210\077\274\055\121\321\236\215\340\122\314\127
+\335\065\065\130\333\264\217\044\210\344\213\337\334\153\124\322
+\201\053\262\316\222\113\034\037\106\372\035\330\222\313\166\147
+\265\011\231\011\345\254\027\024\125\160\306\074\240\126\012\003
+\263\334\142\031\337\310\265\060\177\365\074\046\165\021\275\327
+\033\263\207\236\007\257\145\161\345\240\317\032\247\011\020\035
+\223\211\146\133\350\074\142\062\265\265\072\156\351\205\001\213
+\236\103\214\147\163\050\131\133\353\343\334\054\314\245\046\162
+\142\022\264\346\234\203\104\366\121\244\342\300\172\044\127\312
+\016\245\077\072\265\073\213\345\166\356\160\346\222\336\026\134
+\050\133\227\031\047\222\376\172\222\124\316\223\071\012\026\207
+\274\143\263\365\261\223\134\340\156\267\320\352\371\142\062\210
+\104\373\277\047\050\266\060\225\135\022\050\271\225\276\217\123
+\030\345\242\030\026\342\126\244\262\054\020\365\035\067\246\370
+\267\366\320\131\134\211\367\302\325\265\224\164\321\325\376\033
+\266\360\346\326\036\173\322\074\313\250\343\365\030\363\041\037
+\156\357\115\150\006\173\055\135\156\103\211\246\300\371\240\277
+\202\036\317\123\177\264\353\054\333\135\366\152\175\100\044\005
+\162\211\070\001\223\313\161\302\071\135\006\021\366\157\170\370
+\067\015\071\204\047\002\003\001\000\001\243\143\060\141\060\016
+\006\003\125\035\017\001\001\377\004\004\003\002\001\006\060\017
+\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060
+\035\006\003\125\035\016\004\026\004\024\152\071\372\102\042\367
+\346\211\000\115\136\175\063\203\313\270\156\167\206\257\060\037
+\006\003\125\035\043\004\030\060\026\200\024\152\071\372\102\042
+\367\346\211\000\115\136\175\063\203\313\270\156\167\206\257\060
+\015\006\011\052\206\110\206\367\015\001\001\015\005\000\003\202
+\002\001\000\230\313\253\100\074\345\063\002\227\177\055\207\246
+\217\324\136\112\257\270\036\347\273\161\373\200\144\045\251\263
+\032\076\150\135\047\046\247\272\052\341\360\127\203\012\144\117
+\036\042\164\033\351\220\137\360\254\317\377\117\150\172\070\244
+\020\154\015\261\307\244\167\200\030\266\242\050\104\166\247\064
+\235\161\204\057\312\131\322\107\210\231\101\042\311\060\230\141
+\156\075\250\250\005\155\321\037\300\121\104\126\177\047\065\002
+\335\136\230\012\102\353\060\277\215\241\233\121\252\073\352\223
+\106\144\305\000\171\336\041\153\366\127\240\206\327\006\162\354
+\160\106\113\213\163\335\240\041\165\076\334\035\300\217\323\117
+\163\034\205\331\376\177\142\310\225\157\266\323\173\214\272\123
+\302\157\233\104\114\171\320\035\160\263\327\237\002\364\262\007
+\260\307\345\370\255\043\016\246\126\311\051\022\167\110\331\057
+\106\375\073\360\374\164\160\222\245\216\070\010\037\144\060\266
+\267\113\373\066\254\020\216\240\122\063\143\235\003\065\126\305
+\151\275\306\043\132\047\224\366\244\022\370\055\063\074\241\126
+\245\137\326\031\351\355\174\010\275\167\315\047\144\314\224\332
+\116\106\120\207\340\371\301\123\200\036\273\255\373\107\122\213
+\033\375\242\371\336\016\042\267\075\063\131\154\324\336\365\225
+\006\062\015\121\031\101\134\076\117\006\367\271\053\200\047\366
+\243\252\172\174\006\341\103\303\023\071\142\032\066\275\340\050
+\056\224\002\344\051\056\140\125\256\100\075\260\164\222\136\360
+\040\144\226\077\137\105\135\210\265\212\332\002\240\133\105\124
+\336\070\075\011\300\250\112\145\106\026\374\252\277\124\116\115
+\133\276\070\103\267\050\312\213\063\252\032\045\272\045\134\051
+\057\133\112\156\214\352\055\234\052\366\005\166\340\167\227\200
+\210\335\147\023\157\035\150\044\213\117\267\164\201\345\364\140
+\237\172\125\327\076\067\332\026\153\076\167\254\256\030\160\225
+\010\171\051\003\212\376\301\073\263\077\032\017\244\073\136\037
+\130\241\225\311\253\057\163\112\320\055\156\232\131\017\125\030
+\170\055\074\121\246\227\213\346\273\262\160\252\114\021\336\377
+\174\053\067\324\172\321\167\064\217\347\371\102\367\074\201\014
+\113\122\012
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "OpenTrust Root CA G2"
+# Issuer: CN=OpenTrust Root CA G2,O=OpenTrust,C=FR
+# Serial Number:11:20:a1:69:1b:bf:bd:b9:bd:52:96:8f:23:e8:48:bf:26:11
+# Subject: CN=OpenTrust Root CA G2,O=OpenTrust,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): 27:99:58:29:FE:6A:75:15:C1:BF:E8:48:F9:C4:76:1D:B1:6C:22:59:29:25:7B:F4:0D:08:94:F2:9E:A8:BA:F2
+# Fingerprint (SHA1): 79:5F:88:60:C5:AB:7C:3D:92:E6:CB:F4:8D:E1:45:CD:11:EF:60:0B
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "OpenTrust Root CA G2"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\171\137\210\140\305\253\174\075\222\346\313\364\215\341\105\315
+\021\357\140\013
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\127\044\266\131\044\153\256\310\376\034\014\040\362\300\116\353
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\241\151\033\277\275\271\275\122\226\217\043\350
+\110\277\046\021
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "OpenTrust Root CA G3"
+#
+# Issuer: CN=OpenTrust Root CA G3,O=OpenTrust,C=FR
+# Serial Number:11:20:e6:f8:4c:fc:24:b0:be:05:40:ac:da:83:1b:34:60:3f
+# Subject: CN=OpenTrust Root CA G3,O=OpenTrust,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): B7:C3:62:31:70:6E:81:07:8C:36:7C:B8:96:19:8F:1E:32:08:DD:92:69:49:DD:8F:57:09:A4:10:F7:5B:62:92
+# Fingerprint (SHA1): 6E:26:64:F3:56:BF:34:55:BF:D1:93:3F:7C:01:DE:D8:13:DA:8A:A6
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "OpenTrust Root CA G3"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\063
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\346\370\114\374\044\260\276\005\100\254\332\203
+\033\064\140\077
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\002\041\060\202\001\246\240\003\002\001\002\002\022\021
+\040\346\370\114\374\044\260\276\005\100\254\332\203\033\064\140
+\077\060\012\006\010\052\206\110\316\075\004\003\003\060\100\061
+\013\060\011\006\003\125\004\006\023\002\106\122\061\022\060\020
+\006\003\125\004\012\014\011\117\160\145\156\124\162\165\163\164
+\061\035\060\033\006\003\125\004\003\014\024\117\160\145\156\124
+\162\165\163\164\040\122\157\157\164\040\103\101\040\107\063\060
+\036\027\015\061\064\060\065\062\066\060\060\060\060\060\060\132
+\027\015\063\070\060\061\061\065\060\060\060\060\060\060\132\060
+\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061\022
+\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162\165
+\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160\145
+\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040\107
+\063\060\166\060\020\006\007\052\206\110\316\075\002\001\006\005
+\053\201\004\000\042\003\142\000\004\112\356\130\256\115\312\146
+\336\006\072\243\021\374\340\030\360\156\034\272\055\060\014\211
+\331\326\356\233\163\203\251\043\025\214\057\131\212\132\335\024
+\352\235\131\053\103\267\006\354\062\266\272\356\101\265\255\135
+\241\205\314\352\035\024\146\243\147\176\106\342\224\363\347\266
+\126\241\025\131\241\117\067\227\271\042\036\275\021\353\364\262
+\037\136\303\024\232\345\331\227\231\243\143\060\141\060\016\006
+\003\125\035\017\001\001\377\004\004\003\002\001\006\060\017\006
+\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060\035
+\006\003\125\035\016\004\026\004\024\107\167\303\024\213\142\071
+\014\311\157\341\120\115\320\020\130\334\225\210\155\060\037\006
+\003\125\035\043\004\030\060\026\200\024\107\167\303\024\213\142
+\071\014\311\157\341\120\115\320\020\130\334\225\210\155\060\012
+\006\010\052\206\110\316\075\004\003\003\003\151\000\060\146\002
+\061\000\217\250\334\235\272\014\004\027\372\025\351\075\057\051
+\001\227\277\201\026\063\100\223\154\374\371\355\200\160\157\252
+\217\333\204\302\213\365\065\312\006\334\144\157\150\026\341\217
+\221\271\002\061\000\330\113\245\313\302\320\010\154\351\030\373
+\132\335\115\137\044\013\260\000\041\045\357\217\247\004\046\161
+\342\174\151\345\135\232\370\101\037\073\071\223\223\235\125\352
+\315\215\361\373\301
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "OpenTrust Root CA G3"
+# Issuer: CN=OpenTrust Root CA G3,O=OpenTrust,C=FR
+# Serial Number:11:20:e6:f8:4c:fc:24:b0:be:05:40:ac:da:83:1b:34:60:3f
+# Subject: CN=OpenTrust Root CA G3,O=OpenTrust,C=FR
+# Not Valid Before: Mon May 26 00:00:00 2014
+# Not Valid After : Fri Jan 15 00:00:00 2038
+# Fingerprint (SHA-256): B7:C3:62:31:70:6E:81:07:8C:36:7C:B8:96:19:8F:1E:32:08:DD:92:69:49:DD:8F:57:09:A4:10:F7:5B:62:92
+# Fingerprint (SHA1): 6E:26:64:F3:56:BF:34:55:BF:D1:93:3F:7C:01:DE:D8:13:DA:8A:A6
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "OpenTrust Root CA G3"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\156\046\144\363\126\277\064\125\277\321\223\077\174\001\336\330
+\023\332\212\246
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\041\067\264\027\026\222\173\147\106\160\251\226\327\250\023\044
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\100\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\022\060\020\006\003\125\004\012\014\011\117\160\145\156\124\162
+\165\163\164\061\035\060\033\006\003\125\004\003\014\024\117\160
+\145\156\124\162\165\163\164\040\122\157\157\164\040\103\101\040
+\107\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\022\021\040\346\370\114\374\044\260\276\005\100\254\332\203
+\033\064\140\077
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "ISRG Root X1"
+#
+# Issuer: CN=ISRG Root X1,O=Internet Security Research Group,C=US
+# Serial Number:00:82:10:cf:b0:d2:40:e3:59:44:63:e0:bb:63:82:8b:00
+# Subject: CN=ISRG Root X1,O=Internet Security Research Group,C=US
+# Not Valid Before: Thu Jun 04 11:04:38 2015
+# Not Valid After : Mon Jun 04 11:04:38 2035
+# Fingerprint (SHA-256): 96:BC:EC:06:26:49:76:F3:74:60:77:9A:CF:28:C5:A7:CF:E8:A3:C0:AA:E1:1A:8F:FC:EE:05:C0:BD:DF:08:C6
+# Fingerprint (SHA1): CA:BD:2A:79:A1:07:6A:31:F2:1D:25:36:35:CB:03:9D:43:29:A5:E8
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "ISRG Root X1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\117\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\051\060\047\006\003\125\004\012\023\040\111\156\164\145\162\156
+\145\164\040\123\145\143\165\162\151\164\171\040\122\145\163\145
+\141\162\143\150\040\107\162\157\165\160\061\025\060\023\006\003
+\125\004\003\023\014\111\123\122\107\040\122\157\157\164\040\130
+\061
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\117\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\051\060\047\006\003\125\004\012\023\040\111\156\164\145\162\156
+\145\164\040\123\145\143\165\162\151\164\171\040\122\145\163\145
+\141\162\143\150\040\107\162\157\165\160\061\025\060\023\006\003
+\125\004\003\023\014\111\123\122\107\040\122\157\157\164\040\130
+\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\202\020\317\260\322\100\343\131\104\143\340\273\143
+\202\213\000
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\153\060\202\003\123\240\003\002\001\002\002\021\000
+\202\020\317\260\322\100\343\131\104\143\340\273\143\202\213\000
+\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060
+\117\061\013\060\011\006\003\125\004\006\023\002\125\123\061\051
+\060\047\006\003\125\004\012\023\040\111\156\164\145\162\156\145
+\164\040\123\145\143\165\162\151\164\171\040\122\145\163\145\141
+\162\143\150\040\107\162\157\165\160\061\025\060\023\006\003\125
+\004\003\023\014\111\123\122\107\040\122\157\157\164\040\130\061
+\060\036\027\015\061\065\060\066\060\064\061\061\060\064\063\070
+\132\027\015\063\065\060\066\060\064\061\061\060\064\063\070\132
+\060\117\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\051\060\047\006\003\125\004\012\023\040\111\156\164\145\162\156
+\145\164\040\123\145\143\165\162\151\164\171\040\122\145\163\145
+\141\162\143\150\040\107\162\157\165\160\061\025\060\023\006\003
+\125\004\003\023\014\111\123\122\107\040\122\157\157\164\040\130
+\061\060\202\002\042\060\015\006\011\052\206\110\206\367\015\001
+\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202\002
+\001\000\255\350\044\163\364\024\067\363\233\236\053\127\050\034
+\207\276\334\267\337\070\220\214\156\074\346\127\240\170\367\165
+\302\242\376\365\152\156\366\000\117\050\333\336\150\206\154\104
+\223\266\261\143\375\024\022\153\277\037\322\352\061\233\041\176
+\321\063\074\272\110\365\335\171\337\263\270\377\022\361\041\232
+\113\301\212\206\161\151\112\146\146\154\217\176\074\160\277\255
+\051\042\006\363\344\300\346\200\256\342\113\217\267\231\176\224
+\003\237\323\107\227\174\231\110\043\123\350\070\256\117\012\157
+\203\056\321\111\127\214\200\164\266\332\057\320\070\215\173\003
+\160\041\033\165\362\060\074\372\217\256\335\332\143\253\353\026
+\117\302\216\021\113\176\317\013\350\377\265\167\056\364\262\173
+\112\340\114\022\045\014\160\215\003\051\240\341\123\044\354\023
+\331\356\031\277\020\263\112\214\077\211\243\141\121\336\254\207
+\007\224\364\143\161\354\056\342\157\133\230\201\341\211\134\064
+\171\154\166\357\073\220\142\171\346\333\244\232\057\046\305\320
+\020\341\016\336\331\020\216\026\373\267\367\250\367\307\345\002
+\007\230\217\066\010\225\347\342\067\226\015\066\165\236\373\016
+\162\261\035\233\274\003\371\111\005\330\201\335\005\264\052\326
+\101\351\254\001\166\225\012\017\330\337\325\275\022\037\065\057
+\050\027\154\322\230\301\250\011\144\167\156\107\067\272\316\254
+\131\136\150\235\177\162\326\211\305\006\101\051\076\131\076\335
+\046\365\044\311\021\247\132\243\114\100\037\106\241\231\265\247
+\072\121\156\206\073\236\175\162\247\022\005\170\131\355\076\121
+\170\025\013\003\217\215\320\057\005\262\076\173\112\034\113\163
+\005\022\374\306\352\340\120\023\174\103\223\164\263\312\164\347
+\216\037\001\010\320\060\324\133\161\066\264\007\272\301\060\060
+\134\110\267\202\073\230\246\175\140\212\242\243\051\202\314\272
+\275\203\004\033\242\203\003\101\241\326\005\361\033\302\266\360
+\250\174\206\073\106\250\110\052\210\334\166\232\166\277\037\152
+\245\075\031\217\353\070\363\144\336\310\053\015\012\050\377\367
+\333\342\025\102\324\042\320\047\135\341\171\376\030\347\160\210
+\255\116\346\331\213\072\306\335\047\121\156\377\274\144\365\063
+\103\117\002\003\001\000\001\243\102\060\100\060\016\006\003\125
+\035\017\001\001\377\004\004\003\002\001\006\060\017\006\003\125
+\035\023\001\001\377\004\005\060\003\001\001\377\060\035\006\003
+\125\035\016\004\026\004\024\171\264\131\346\173\266\345\344\001
+\163\200\010\210\310\032\130\366\351\233\156\060\015\006\011\052
+\206\110\206\367\015\001\001\013\005\000\003\202\002\001\000\125
+\037\130\251\274\262\250\120\320\014\261\330\032\151\040\047\051
+\010\254\141\165\134\212\156\370\202\345\151\057\325\366\126\113
+\271\270\163\020\131\323\041\227\176\347\114\161\373\262\322\140
+\255\071\250\013\352\027\041\126\205\361\120\016\131\353\316\340
+\131\351\272\311\025\357\206\235\217\204\200\366\344\351\221\220
+\334\027\233\142\033\105\360\146\225\322\174\157\302\352\073\357
+\037\317\313\326\256\047\361\251\260\310\256\375\175\176\232\372
+\042\004\353\377\331\177\352\221\053\042\261\027\016\217\362\212
+\064\133\130\330\374\001\311\124\271\270\046\314\212\210\063\211
+\114\055\204\074\202\337\356\226\127\005\272\054\273\367\304\267
+\307\116\073\202\276\061\310\042\163\163\222\321\302\200\244\071
+\071\020\063\043\202\114\074\237\206\262\125\230\035\276\051\206
+\214\042\233\236\342\153\073\127\072\202\160\115\334\011\307\211
+\313\012\007\115\154\350\135\216\311\357\316\253\307\273\265\053
+\116\105\326\112\320\046\314\345\162\312\010\152\245\225\343\025
+\241\367\244\355\311\054\137\245\373\377\254\050\002\056\276\327
+\173\273\343\161\173\220\026\323\007\136\106\123\174\067\007\102
+\214\323\304\226\234\325\231\265\052\340\225\032\200\110\256\114
+\071\007\316\314\107\244\122\225\053\272\270\373\255\322\063\123
+\175\345\035\115\155\325\241\261\307\102\157\346\100\047\065\134
+\243\050\267\007\215\347\215\063\220\347\043\237\373\120\234\171
+\154\106\325\264\025\263\226\156\176\233\014\226\072\270\122\055
+\077\326\133\341\373\010\302\204\376\044\250\243\211\332\254\152
+\341\030\052\261\250\103\141\133\323\037\334\073\215\166\362\055
+\350\215\165\337\027\063\154\075\123\373\173\313\101\137\377\334
+\242\320\141\070\341\226\270\254\135\213\067\327\165\325\063\300
+\231\021\256\235\101\301\162\165\204\276\002\101\102\137\147\044
+\110\224\321\233\047\276\007\077\271\270\117\201\164\121\341\172
+\267\355\235\043\342\276\340\325\050\004\023\074\061\003\236\335
+\172\154\217\306\007\030\306\177\336\107\216\077\050\236\004\006
+\317\245\124\064\167\275\354\211\233\351\027\103\337\133\333\137
+\376\216\036\127\242\315\100\235\176\142\042\332\336\030\047
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "ISRG Root X1"
+# Issuer: CN=ISRG Root X1,O=Internet Security Research Group,C=US
+# Serial Number:00:82:10:cf:b0:d2:40:e3:59:44:63:e0:bb:63:82:8b:00
+# Subject: CN=ISRG Root X1,O=Internet Security Research Group,C=US
+# Not Valid Before: Thu Jun 04 11:04:38 2015
+# Not Valid After : Mon Jun 04 11:04:38 2035
+# Fingerprint (SHA-256): 96:BC:EC:06:26:49:76:F3:74:60:77:9A:CF:28:C5:A7:CF:E8:A3:C0:AA:E1:1A:8F:FC:EE:05:C0:BD:DF:08:C6
+# Fingerprint (SHA1): CA:BD:2A:79:A1:07:6A:31:F2:1D:25:36:35:CB:03:9D:43:29:A5:E8
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "ISRG Root X1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\312\275\052\171\241\007\152\061\362\035\045\066\065\313\003\235
+\103\051\245\350
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\014\322\371\340\332\027\163\351\355\206\115\245\343\160\347\116
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\117\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\051\060\047\006\003\125\004\012\023\040\111\156\164\145\162\156
+\145\164\040\123\145\143\165\162\151\164\171\040\122\145\163\145
+\141\162\143\150\040\107\162\157\165\160\061\025\060\023\006\003
+\125\004\003\023\014\111\123\122\107\040\122\157\157\164\040\130
+\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\202\020\317\260\322\100\343\131\104\143\340\273\143
+\202\213\000
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "AC RAIZ FNMT-RCM"
+#
+# Issuer: OU=AC RAIZ FNMT-RCM,O=FNMT-RCM,C=ES
+# Serial Number:5d:93:8d:30:67:36:c8:06:1d:1a:c7:54:84:69:07
+# Subject: OU=AC RAIZ FNMT-RCM,O=FNMT-RCM,C=ES
+# Not Valid Before: Wed Oct 29 15:59:56 2008
+# Not Valid After : Tue Jan 01 00:00:00 2030
+# Fingerprint (SHA-256): EB:C5:57:0C:29:01:8C:4D:67:B1:AA:12:7B:AF:12:F7:03:B4:61:1E:BC:17:B7:DA:B5:57:38:94:17:9B:93:FA
+# Fingerprint (SHA1): EC:50:35:07:B2:15:C4:95:62:19:E2:A8:9A:5B:42:99:2C:4C:2C:20
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "AC RAIZ FNMT-RCM"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\073\061\013\060\011\006\003\125\004\006\023\002\105\123\061
+\021\060\017\006\003\125\004\012\014\010\106\116\115\124\055\122
+\103\115\061\031\060\027\006\003\125\004\013\014\020\101\103\040
+\122\101\111\132\040\106\116\115\124\055\122\103\115
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\073\061\013\060\011\006\003\125\004\006\023\002\105\123\061
+\021\060\017\006\003\125\004\012\014\010\106\116\115\124\055\122
+\103\115\061\031\060\027\006\003\125\004\013\014\020\101\103\040
+\122\101\111\132\040\106\116\115\124\055\122\103\115
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\017\135\223\215\060\147\066\310\006\035\032\307\124\204\151
+\007
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\203\060\202\003\153\240\003\002\001\002\002\017\135
+\223\215\060\147\066\310\006\035\032\307\124\204\151\007\060\015
+\006\011\052\206\110\206\367\015\001\001\013\005\000\060\073\061
+\013\060\011\006\003\125\004\006\023\002\105\123\061\021\060\017
+\006\003\125\004\012\014\010\106\116\115\124\055\122\103\115\061
+\031\060\027\006\003\125\004\013\014\020\101\103\040\122\101\111
+\132\040\106\116\115\124\055\122\103\115\060\036\027\015\060\070
+\061\060\062\071\061\065\065\071\065\066\132\027\015\063\060\060
+\061\060\061\060\060\060\060\060\060\132\060\073\061\013\060\011
+\006\003\125\004\006\023\002\105\123\061\021\060\017\006\003\125
+\004\012\014\010\106\116\115\124\055\122\103\115\061\031\060\027
+\006\003\125\004\013\014\020\101\103\040\122\101\111\132\040\106
+\116\115\124\055\122\103\115\060\202\002\042\060\015\006\011\052
+\206\110\206\367\015\001\001\001\005\000\003\202\002\017\000\060
+\202\002\012\002\202\002\001\000\272\161\200\172\114\206\156\177
+\310\023\155\300\306\175\034\000\227\217\054\014\043\273\020\232
+\100\251\032\267\207\210\370\233\126\152\373\346\173\216\213\222
+\216\247\045\135\131\021\333\066\056\267\121\027\037\251\010\037
+\004\027\044\130\252\067\112\030\337\345\071\324\127\375\327\301
+\054\221\001\221\342\042\324\003\300\130\374\167\107\354\217\076
+\164\103\272\254\064\215\115\070\166\147\216\260\310\157\060\063
+\130\161\134\264\365\153\156\324\001\120\270\023\176\154\112\243
+\111\321\040\031\356\274\300\051\030\145\247\336\376\357\335\012
+\220\041\347\032\147\222\102\020\230\137\117\060\274\076\034\105
+\264\020\327\150\100\024\300\100\372\347\167\027\172\346\013\217
+\145\133\074\331\232\122\333\265\275\236\106\317\075\353\221\005
+\002\300\226\262\166\114\115\020\226\073\222\372\234\177\017\231
+\337\276\043\065\105\036\002\134\376\265\250\233\231\045\332\136
+\363\042\303\071\365\344\052\056\323\306\037\304\154\252\305\034
+\152\001\005\112\057\322\305\301\250\064\046\135\146\245\322\002
+\041\371\030\267\006\365\116\231\157\250\253\114\121\350\317\120
+\030\305\167\310\071\011\054\111\222\062\231\250\273\027\027\171
+\260\132\305\346\243\304\131\145\107\065\203\136\251\350\065\013
+\231\273\344\315\040\306\233\112\006\071\265\150\374\042\272\356
+\125\214\053\116\352\363\261\343\374\266\231\232\325\102\372\161
+\115\010\317\207\036\152\161\175\371\323\264\351\245\161\201\173
+\302\116\107\226\245\366\166\205\243\050\217\351\200\156\201\123
+\245\155\137\270\110\371\302\371\066\246\056\111\377\270\226\302
+\214\007\263\233\210\130\374\353\033\034\336\055\160\342\227\222
+\060\241\211\343\274\125\250\047\326\113\355\220\255\213\372\143
+\045\131\055\250\065\335\312\227\063\274\345\315\307\235\321\354
+\357\136\016\112\220\006\046\143\255\271\331\065\055\007\272\166
+\145\054\254\127\217\175\364\007\224\327\201\002\226\135\243\007
+\111\325\172\320\127\371\033\347\123\106\165\252\260\171\102\313
+\150\161\010\351\140\275\071\151\316\364\257\303\126\100\307\255
+\122\242\011\344\157\206\107\212\037\353\050\047\135\203\040\257
+\004\311\154\126\232\213\106\365\002\003\001\000\001\243\201\203
+\060\201\200\060\017\006\003\125\035\023\001\001\377\004\005\060
+\003\001\001\377\060\016\006\003\125\035\017\001\001\377\004\004
+\003\002\001\006\060\035\006\003\125\035\016\004\026\004\024\367
+\175\305\375\304\350\232\033\167\144\247\365\035\240\314\277\207
+\140\232\155\060\076\006\003\125\035\040\004\067\060\065\060\063
+\006\004\125\035\040\000\060\053\060\051\006\010\053\006\001\005
+\005\007\002\001\026\035\150\164\164\160\072\057\057\167\167\167
+\056\143\145\162\164\056\146\156\155\164\056\145\163\057\144\160
+\143\163\057\060\015\006\011\052\206\110\206\367\015\001\001\013
+\005\000\003\202\002\001\000\007\220\112\337\363\043\116\360\303
+\234\121\145\233\234\042\242\212\014\205\363\163\051\153\115\376
+\001\342\251\014\143\001\277\004\147\245\235\230\137\375\001\023
+\372\354\232\142\351\206\376\266\142\322\156\114\224\373\300\165
+\105\174\145\014\370\262\067\317\254\017\317\215\157\371\031\367
+\217\354\036\362\160\236\360\312\270\357\267\377\166\067\166\133
+\366\156\210\363\257\142\062\042\223\015\072\152\216\024\146\014
+\055\123\164\127\145\036\325\262\335\043\201\073\245\146\043\047
+\147\011\217\341\167\252\103\315\145\121\010\355\121\130\376\346
+\071\371\313\107\204\244\025\361\166\273\244\356\244\073\304\137
+\357\262\063\226\021\030\267\311\145\276\030\341\243\244\334\372
+\030\371\323\274\023\233\071\172\064\272\323\101\373\372\062\212
+\052\267\053\206\013\151\203\070\276\315\212\056\013\160\255\215
+\046\222\356\036\365\001\053\012\331\326\227\233\156\340\250\031
+\034\072\041\213\014\036\100\255\003\347\335\146\176\365\271\040
+\015\003\350\226\371\202\105\324\071\340\240\000\135\327\230\346
+\175\236\147\163\303\232\052\367\253\213\241\072\024\357\064\274
+\122\016\211\230\232\004\100\204\035\176\105\151\223\127\316\353
+\316\370\120\174\117\034\156\004\103\233\371\326\073\043\030\351
+\352\216\321\115\106\215\361\073\344\152\312\272\373\043\267\233
+\372\231\001\051\132\130\132\055\343\371\324\155\016\046\255\301
+\156\064\274\062\370\014\005\372\145\243\333\073\067\203\042\351
+\326\334\162\063\375\135\362\040\275\166\074\043\332\050\367\371
+\033\353\131\144\325\334\137\162\176\040\374\315\211\265\220\147
+\115\142\172\077\116\255\035\303\071\376\172\364\050\026\337\101
+\366\110\200\005\327\017\121\171\254\020\253\324\354\003\146\346
+\152\260\272\061\222\102\100\152\276\072\323\162\341\152\067\125
+\274\254\035\225\267\151\141\362\103\221\164\346\240\323\012\044
+\106\241\010\257\326\332\105\031\226\324\123\035\133\204\171\360
+\300\367\107\357\213\217\305\006\256\235\114\142\235\377\106\004
+\370\323\311\266\020\045\100\165\376\026\252\311\112\140\206\057
+\272\357\060\167\344\124\342\270\204\231\130\200\252\023\213\121
+\072\117\110\366\213\266\263
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "AC RAIZ FNMT-RCM"
+# Issuer: OU=AC RAIZ FNMT-RCM,O=FNMT-RCM,C=ES
+# Serial Number:5d:93:8d:30:67:36:c8:06:1d:1a:c7:54:84:69:07
+# Subject: OU=AC RAIZ FNMT-RCM,O=FNMT-RCM,C=ES
+# Not Valid Before: Wed Oct 29 15:59:56 2008
+# Not Valid After : Tue Jan 01 00:00:00 2030
+# Fingerprint (SHA-256): EB:C5:57:0C:29:01:8C:4D:67:B1:AA:12:7B:AF:12:F7:03:B4:61:1E:BC:17:B7:DA:B5:57:38:94:17:9B:93:FA
+# Fingerprint (SHA1): EC:50:35:07:B2:15:C4:95:62:19:E2:A8:9A:5B:42:99:2C:4C:2C:20
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "AC RAIZ FNMT-RCM"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\354\120\065\007\262\025\304\225\142\031\342\250\232\133\102\231
+\054\114\054\040
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\342\011\004\264\323\275\321\240\024\375\032\322\107\304\127\035
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\073\061\013\060\011\006\003\125\004\006\023\002\105\123\061
+\021\060\017\006\003\125\004\012\014\010\106\116\115\124\055\122
+\103\115\061\031\060\027\006\003\125\004\013\014\020\101\103\040
+\122\101\111\132\040\106\116\115\124\055\122\103\115
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\017\135\223\215\060\147\066\310\006\035\032\307\124\204\151
+\007
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Amazon Root CA 1"
+#
+# Issuer: CN=Amazon Root CA 1,O=Amazon,C=US
+# Serial Number:06:6c:9f:cf:99:bf:8c:0a:39:e2:f0:78:8a:43:e6:96:36:5b:ca
+# Subject: CN=Amazon Root CA 1,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sun Jan 17 00:00:00 2038
+# Fingerprint (SHA-256): 8E:CD:E6:88:4F:3D:87:B1:12:5B:A3:1A:C3:FC:B1:3D:70:16:DE:7F:57:CC:90:4F:E1:CB:97:C6:AE:98:19:6E
+# Fingerprint (SHA1): 8D:A7:F9:65:EC:5E:FC:37:91:0F:1C:6E:59:FD:C1:CC:6A:6E:DE:16
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\061
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\317\231\277\214\012\071\342\360\170\212\103
+\346\226\066\133\312
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\003\101\060\202\002\051\240\003\002\001\002\002\023\006
+\154\237\317\231\277\214\012\071\342\360\170\212\103\346\226\066
+\133\312\060\015\006\011\052\206\110\206\367\015\001\001\013\005
+\000\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157
+\156\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172
+\157\156\040\122\157\157\164\040\103\101\040\061\060\036\027\015
+\061\065\060\065\062\066\060\060\060\060\060\060\132\027\015\063
+\070\060\061\061\067\060\060\060\060\060\060\132\060\071\061\013
+\060\011\006\003\125\004\006\023\002\125\123\061\017\060\015\006
+\003\125\004\012\023\006\101\155\141\172\157\156\061\031\060\027
+\006\003\125\004\003\023\020\101\155\141\172\157\156\040\122\157
+\157\164\040\103\101\040\061\060\202\001\042\060\015\006\011\052
+\206\110\206\367\015\001\001\001\005\000\003\202\001\017\000\060
+\202\001\012\002\202\001\001\000\262\170\200\161\312\170\325\343
+\161\257\107\200\120\164\175\156\330\327\210\166\364\231\150\367
+\130\041\140\371\164\204\001\057\254\002\055\206\323\240\103\172
+\116\262\244\320\066\272\001\276\215\333\110\310\007\027\066\114
+\364\356\210\043\307\076\353\067\365\265\031\370\111\150\260\336
+\327\271\166\070\035\141\236\244\376\202\066\245\345\112\126\344
+\105\341\371\375\264\026\372\164\332\234\233\065\071\057\372\260
+\040\120\006\154\172\320\200\262\246\371\257\354\107\031\217\120
+\070\007\334\242\207\071\130\370\272\325\251\371\110\147\060\226
+\356\224\170\136\157\211\243\121\300\060\206\146\241\105\146\272
+\124\353\243\303\221\371\110\334\377\321\350\060\055\175\055\164
+\160\065\327\210\044\367\236\304\131\156\273\163\207\027\362\062
+\106\050\270\103\372\267\035\252\312\264\362\237\044\016\055\113
+\367\161\134\136\151\377\352\225\002\313\070\212\256\120\070\157
+\333\373\055\142\033\305\307\036\124\341\167\340\147\310\017\234
+\207\043\326\077\100\040\177\040\200\304\200\114\076\073\044\046
+\216\004\256\154\232\310\252\015\002\003\001\000\001\243\102\060
+\100\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001
+\001\377\060\016\006\003\125\035\017\001\001\377\004\004\003\002
+\001\206\060\035\006\003\125\035\016\004\026\004\024\204\030\314
+\205\064\354\274\014\224\224\056\010\131\234\307\262\020\116\012
+\010\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000
+\003\202\001\001\000\230\362\067\132\101\220\241\032\305\166\121
+\050\040\066\043\016\256\346\050\273\252\370\224\256\110\244\060
+\177\033\374\044\215\113\264\310\241\227\366\266\361\172\160\310
+\123\223\314\010\050\343\230\045\317\043\244\371\336\041\323\174
+\205\011\255\116\232\165\072\302\013\152\211\170\166\104\107\030
+\145\154\215\101\216\073\177\232\313\364\265\247\120\327\005\054
+\067\350\003\113\255\351\141\240\002\156\365\362\360\305\262\355
+\133\267\334\372\224\134\167\236\023\245\177\122\255\225\362\370
+\223\073\336\213\134\133\312\132\122\133\140\257\024\367\113\357
+\243\373\237\100\225\155\061\124\374\102\323\307\106\037\043\255
+\331\017\110\160\232\331\165\170\161\321\162\103\064\165\156\127
+\131\302\002\134\046\140\051\317\043\031\026\216\210\103\245\324
+\344\313\010\373\043\021\103\350\103\051\162\142\241\251\135\136
+\010\324\220\256\270\330\316\024\302\320\125\362\206\366\304\223
+\103\167\146\141\300\271\350\101\327\227\170\140\003\156\112\162
+\256\245\321\175\272\020\236\206\154\033\212\271\131\063\370\353
+\304\220\276\361\271
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Amazon Root CA 1"
+# Issuer: CN=Amazon Root CA 1,O=Amazon,C=US
+# Serial Number:06:6c:9f:cf:99:bf:8c:0a:39:e2:f0:78:8a:43:e6:96:36:5b:ca
+# Subject: CN=Amazon Root CA 1,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sun Jan 17 00:00:00 2038
+# Fingerprint (SHA-256): 8E:CD:E6:88:4F:3D:87:B1:12:5B:A3:1A:C3:FC:B1:3D:70:16:DE:7F:57:CC:90:4F:E1:CB:97:C6:AE:98:19:6E
+# Fingerprint (SHA1): 8D:A7:F9:65:EC:5E:FC:37:91:0F:1C:6E:59:FD:C1:CC:6A:6E:DE:16
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\215\247\371\145\354\136\374\067\221\017\034\156\131\375\301\314
+\152\156\336\026
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\103\306\277\256\354\376\255\057\030\306\210\150\060\374\310\346
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\317\231\277\214\012\071\342\360\170\212\103
+\346\226\066\133\312
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Amazon Root CA 2"
+#
+# Issuer: CN=Amazon Root CA 2,O=Amazon,C=US
+# Serial Number:06:6c:9f:d2:96:35:86:9f:0a:0f:e5:86:78:f8:5b:26:bb:8a:37
+# Subject: CN=Amazon Root CA 2,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sat May 26 00:00:00 2040
+# Fingerprint (SHA-256): 1B:A5:B2:AA:8C:65:40:1A:82:96:01:18:F8:0B:EC:4F:62:30:4D:83:CE:C4:71:3A:19:C3:9C:01:1E:A4:6D:B4
+# Fingerprint (SHA1): 5A:8C:EF:45:D7:A6:98:59:76:7A:8C:8B:44:96:B5:78:CF:47:4B:1A
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 2"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\062
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\322\226\065\206\237\012\017\345\206\170\370
+\133\046\273\212\067
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\101\060\202\003\051\240\003\002\001\002\002\023\006
+\154\237\322\226\065\206\237\012\017\345\206\170\370\133\046\273
+\212\067\060\015\006\011\052\206\110\206\367\015\001\001\014\005
+\000\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157
+\156\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172
+\157\156\040\122\157\157\164\040\103\101\040\062\060\036\027\015
+\061\065\060\065\062\066\060\060\060\060\060\060\132\027\015\064
+\060\060\065\062\066\060\060\060\060\060\060\132\060\071\061\013
+\060\011\006\003\125\004\006\023\002\125\123\061\017\060\015\006
+\003\125\004\012\023\006\101\155\141\172\157\156\061\031\060\027
+\006\003\125\004\003\023\020\101\155\141\172\157\156\040\122\157
+\157\164\040\103\101\040\062\060\202\002\042\060\015\006\011\052
+\206\110\206\367\015\001\001\001\005\000\003\202\002\017\000\060
+\202\002\012\002\202\002\001\000\255\226\237\055\234\112\114\112
+\201\171\121\231\354\212\313\153\140\121\023\274\115\155\006\374
+\260\010\215\335\031\020\152\307\046\014\065\330\300\157\040\204
+\351\224\261\233\205\003\303\133\333\112\350\310\370\220\166\331
+\133\117\343\114\350\006\066\115\314\232\254\075\014\220\053\222
+\324\006\031\140\254\067\104\171\205\201\202\255\132\067\340\015
+\314\235\246\114\122\166\352\103\235\267\004\321\120\366\125\340
+\325\322\246\111\205\351\067\351\312\176\256\134\225\115\110\232
+\077\256\040\132\155\210\225\331\064\270\122\032\103\220\260\277
+\154\005\271\266\170\267\352\320\344\072\074\022\123\142\377\112
+\362\173\276\065\005\251\022\064\343\363\144\164\142\054\075\000
+\111\132\050\376\062\104\273\207\335\145\047\002\161\073\332\112
+\367\037\332\315\367\041\125\220\117\017\354\256\202\341\237\153
+\331\105\323\273\360\137\207\355\074\054\071\206\332\077\336\354
+\162\125\353\171\243\255\333\335\174\260\272\034\316\374\336\117
+\065\166\317\017\370\170\037\152\066\121\106\047\141\133\351\236
+\317\360\242\125\175\174\045\212\157\057\264\305\317\204\056\053
+\375\015\121\020\154\373\137\033\274\033\176\305\256\073\230\001
+\061\222\377\013\127\364\232\262\271\127\351\253\357\015\166\321
+\360\356\364\316\206\247\340\156\351\264\151\241\337\151\366\063
+\306\151\056\227\023\236\245\207\260\127\020\201\067\311\123\263
+\273\177\366\222\321\234\320\030\364\222\156\332\203\117\246\143
+\231\114\245\373\136\357\041\144\172\040\137\154\144\205\025\313
+\067\351\142\014\013\052\026\334\001\056\062\332\076\113\365\236
+\072\366\027\100\224\357\236\221\010\206\372\276\143\250\132\063
+\354\313\164\103\225\371\154\151\122\066\307\051\157\374\125\003
+\134\037\373\237\275\107\353\347\111\107\225\013\116\211\042\011
+\111\340\365\141\036\361\277\056\212\162\156\200\131\377\127\072
+\371\165\062\243\116\137\354\355\050\142\331\115\163\362\314\201
+\027\140\355\315\353\334\333\247\312\305\176\002\275\362\124\010
+\124\375\264\055\011\054\027\124\112\230\321\124\341\121\147\010
+\322\355\156\176\157\077\322\055\201\131\051\146\313\220\071\225
+\021\036\164\047\376\335\353\257\002\003\001\000\001\243\102\060
+\100\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001
+\001\377\060\016\006\003\125\035\017\001\001\377\004\004\003\002
+\001\206\060\035\006\003\125\035\016\004\026\004\024\260\014\360
+\114\060\364\005\130\002\110\375\063\345\122\257\113\204\343\146
+\122\060\015\006\011\052\206\110\206\367\015\001\001\014\005\000
+\003\202\002\001\000\252\250\200\217\016\170\243\340\242\324\315
+\346\365\230\172\073\352\000\003\260\227\016\223\274\132\250\366
+\054\214\162\207\251\261\374\177\163\375\143\161\170\245\207\131
+\317\060\341\015\020\262\023\132\155\202\365\152\346\200\237\240
+\005\013\150\344\107\153\307\152\337\266\375\167\062\162\345\030
+\372\011\364\240\223\054\135\322\214\165\205\166\145\220\014\003
+\171\267\061\043\143\255\170\203\011\206\150\204\312\377\371\317
+\046\232\222\171\347\315\113\305\347\141\247\027\313\363\251\022
+\223\223\153\247\350\057\123\222\304\140\130\260\314\002\121\030
+\133\205\215\142\131\143\266\255\264\336\232\373\046\367\000\047
+\300\135\125\067\164\231\311\120\177\343\131\056\104\343\054\045
+\356\354\114\062\167\264\237\032\351\113\135\040\305\332\375\034
+\207\026\306\103\350\324\273\046\232\105\160\136\251\013\067\123
+\342\106\173\047\375\340\106\362\211\267\314\102\266\313\050\046
+\156\331\245\311\072\310\101\023\140\367\120\214\025\256\262\155
+\032\025\032\127\170\346\222\052\331\145\220\202\077\154\002\257
+\256\022\072\047\226\066\004\327\035\242\200\143\251\233\361\345
+\272\264\174\024\260\116\311\261\037\164\137\070\366\121\352\233
+\372\054\242\021\324\251\055\047\032\105\261\257\262\116\161\015
+\300\130\106\326\151\006\313\123\313\263\376\153\101\315\101\176
+\175\114\017\174\162\171\172\131\315\136\112\016\254\233\251\230
+\163\171\174\264\364\314\271\270\007\014\262\164\134\270\307\157
+\210\241\220\247\364\252\371\277\147\072\364\032\025\142\036\267
+\237\276\075\261\051\257\147\241\022\362\130\020\031\123\003\060
+\033\270\032\211\366\234\275\227\003\216\243\011\363\035\213\041
+\361\264\337\344\034\321\237\145\002\006\352\134\326\023\263\204
+\357\242\245\134\214\167\051\247\150\300\153\256\100\322\250\264
+\352\315\360\215\113\070\234\031\232\033\050\124\270\211\220\357
+\312\165\201\076\036\362\144\044\307\030\257\116\377\107\236\007
+\366\065\145\244\323\012\126\377\365\027\144\154\357\250\042\045
+\111\223\266\337\000\027\332\130\176\135\356\305\033\260\321\321
+\137\041\020\307\371\363\272\002\012\047\007\305\361\326\307\323
+\340\373\011\140\154
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Amazon Root CA 2"
+# Issuer: CN=Amazon Root CA 2,O=Amazon,C=US
+# Serial Number:06:6c:9f:d2:96:35:86:9f:0a:0f:e5:86:78:f8:5b:26:bb:8a:37
+# Subject: CN=Amazon Root CA 2,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sat May 26 00:00:00 2040
+# Fingerprint (SHA-256): 1B:A5:B2:AA:8C:65:40:1A:82:96:01:18:F8:0B:EC:4F:62:30:4D:83:CE:C4:71:3A:19:C3:9C:01:1E:A4:6D:B4
+# Fingerprint (SHA1): 5A:8C:EF:45:D7:A6:98:59:76:7A:8C:8B:44:96:B5:78:CF:47:4B:1A
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 2"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\132\214\357\105\327\246\230\131\166\172\214\213\104\226\265\170
+\317\107\113\032
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\310\345\215\316\250\102\342\172\300\052\134\174\236\046\277\146
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\322\226\065\206\237\012\017\345\206\170\370
+\133\046\273\212\067
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Amazon Root CA 3"
+#
+# Issuer: CN=Amazon Root CA 3,O=Amazon,C=US
+# Serial Number:06:6c:9f:d5:74:97:36:66:3f:3b:0b:9a:d9:e8:9e:76:03:f2:4a
+# Subject: CN=Amazon Root CA 3,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sat May 26 00:00:00 2040
+# Fingerprint (SHA-256): 18:CE:6C:FE:7B:F1:4E:60:B2:E3:47:B8:DF:E8:68:CB:31:D0:2E:BB:3A:DA:27:15:69:F5:03:43:B4:6D:B3:A4
+# Fingerprint (SHA1): 0D:44:DD:8C:3C:8C:1A:1A:58:75:64:81:E9:0F:2E:2A:FF:B3:D2:6E
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 3"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\063
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\325\164\227\066\146\077\073\013\232\331\350
+\236\166\003\362\112
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\001\266\060\202\001\133\240\003\002\001\002\002\023\006
+\154\237\325\164\227\066\146\077\073\013\232\331\350\236\166\003
+\362\112\060\012\006\010\052\206\110\316\075\004\003\002\060\071
+\061\013\060\011\006\003\125\004\006\023\002\125\123\061\017\060
+\015\006\003\125\004\012\023\006\101\155\141\172\157\156\061\031
+\060\027\006\003\125\004\003\023\020\101\155\141\172\157\156\040
+\122\157\157\164\040\103\101\040\063\060\036\027\015\061\065\060
+\065\062\066\060\060\060\060\060\060\132\027\015\064\060\060\065
+\062\066\060\060\060\060\060\060\132\060\071\061\013\060\011\006
+\003\125\004\006\023\002\125\123\061\017\060\015\006\003\125\004
+\012\023\006\101\155\141\172\157\156\061\031\060\027\006\003\125
+\004\003\023\020\101\155\141\172\157\156\040\122\157\157\164\040
+\103\101\040\063\060\131\060\023\006\007\052\206\110\316\075\002
+\001\006\010\052\206\110\316\075\003\001\007\003\102\000\004\051
+\227\247\306\101\177\300\015\233\350\001\033\126\306\362\122\245
+\272\055\262\022\350\322\056\327\372\311\305\330\252\155\037\163
+\201\073\073\230\153\071\174\063\245\305\116\206\216\200\027\150
+\142\105\127\175\104\130\035\263\067\345\147\010\353\146\336\243
+\102\060\100\060\017\006\003\125\035\023\001\001\377\004\005\060
+\003\001\001\377\060\016\006\003\125\035\017\001\001\377\004\004
+\003\002\001\206\060\035\006\003\125\035\016\004\026\004\024\253
+\266\333\327\006\236\067\254\060\206\007\221\160\307\234\304\031
+\261\170\300\060\012\006\010\052\206\110\316\075\004\003\002\003
+\111\000\060\106\002\041\000\340\205\222\243\027\267\215\371\053
+\006\245\223\254\032\230\150\141\162\372\341\241\320\373\034\170
+\140\246\103\231\305\270\304\002\041\000\234\002\357\361\224\234
+\263\226\371\353\306\052\370\266\054\376\072\220\024\026\327\214
+\143\044\110\034\337\060\175\325\150\073
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Amazon Root CA 3"
+# Issuer: CN=Amazon Root CA 3,O=Amazon,C=US
+# Serial Number:06:6c:9f:d5:74:97:36:66:3f:3b:0b:9a:d9:e8:9e:76:03:f2:4a
+# Subject: CN=Amazon Root CA 3,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sat May 26 00:00:00 2040
+# Fingerprint (SHA-256): 18:CE:6C:FE:7B:F1:4E:60:B2:E3:47:B8:DF:E8:68:CB:31:D0:2E:BB:3A:DA:27:15:69:F5:03:43:B4:6D:B3:A4
+# Fingerprint (SHA1): 0D:44:DD:8C:3C:8C:1A:1A:58:75:64:81:E9:0F:2E:2A:FF:B3:D2:6E
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 3"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\015\104\335\214\074\214\032\032\130\165\144\201\351\017\056\052
+\377\263\322\156
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\240\324\357\013\367\265\330\111\225\052\354\365\304\374\201\207
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\325\164\227\066\146\077\073\013\232\331\350
+\236\166\003\362\112
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Amazon Root CA 4"
+#
+# Issuer: CN=Amazon Root CA 4,O=Amazon,C=US
+# Serial Number:06:6c:9f:d7:c1:bb:10:4c:29:43:e5:71:7b:7b:2c:c8:1a:c1:0e
+# Subject: CN=Amazon Root CA 4,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sat May 26 00:00:00 2040
+# Fingerprint (SHA-256): E3:5D:28:41:9E:D0:20:25:CF:A6:90:38:CD:62:39:62:45:8D:A5:C6:95:FB:DE:A3:C2:2B:0B:FB:25:89:70:92
+# Fingerprint (SHA1): F6:10:84:07:D6:F8:BB:67:98:0C:C2:E2:44:C2:EB:AE:1C:EF:63:BE
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 4"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\064
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\064
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\327\301\273\020\114\051\103\345\161\173\173
+\054\310\032\301\016
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\001\362\060\202\001\170\240\003\002\001\002\002\023\006
+\154\237\327\301\273\020\114\051\103\345\161\173\173\054\310\032
+\301\016\060\012\006\010\052\206\110\316\075\004\003\003\060\071
+\061\013\060\011\006\003\125\004\006\023\002\125\123\061\017\060
+\015\006\003\125\004\012\023\006\101\155\141\172\157\156\061\031
+\060\027\006\003\125\004\003\023\020\101\155\141\172\157\156\040
+\122\157\157\164\040\103\101\040\064\060\036\027\015\061\065\060
+\065\062\066\060\060\060\060\060\060\132\027\015\064\060\060\065
+\062\066\060\060\060\060\060\060\132\060\071\061\013\060\011\006
+\003\125\004\006\023\002\125\123\061\017\060\015\006\003\125\004
+\012\023\006\101\155\141\172\157\156\061\031\060\027\006\003\125
+\004\003\023\020\101\155\141\172\157\156\040\122\157\157\164\040
+\103\101\040\064\060\166\060\020\006\007\052\206\110\316\075\002
+\001\006\005\053\201\004\000\042\003\142\000\004\322\253\212\067
+\117\243\123\015\376\301\212\173\113\250\173\106\113\143\260\142
+\366\055\033\333\010\161\041\322\000\350\143\275\232\047\373\360
+\071\156\135\352\075\245\311\201\252\243\133\040\230\105\135\026
+\333\375\350\020\155\343\234\340\343\275\137\204\142\363\160\144
+\063\240\313\044\057\160\272\210\241\052\240\165\370\201\256\142
+\006\304\201\333\071\156\051\260\036\372\056\134\243\102\060\100
+\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001
+\377\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001
+\206\060\035\006\003\125\035\016\004\026\004\024\323\354\307\072
+\145\156\314\341\332\166\232\126\373\234\363\206\155\127\345\201
+\060\012\006\010\052\206\110\316\075\004\003\003\003\150\000\060
+\145\002\060\072\213\041\361\275\176\021\255\320\357\130\226\057
+\326\353\235\176\220\215\053\317\146\125\303\054\343\050\251\160
+\012\107\016\360\067\131\022\377\055\231\224\050\116\052\117\065
+\115\063\132\002\061\000\352\165\000\116\073\304\072\224\022\221
+\311\130\106\235\041\023\162\247\210\234\212\344\114\112\333\226
+\324\254\213\153\153\111\022\123\063\255\327\344\276\044\374\265
+\012\166\324\245\274\020
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Amazon Root CA 4"
+# Issuer: CN=Amazon Root CA 4,O=Amazon,C=US
+# Serial Number:06:6c:9f:d7:c1:bb:10:4c:29:43:e5:71:7b:7b:2c:c8:1a:c1:0e
+# Subject: CN=Amazon Root CA 4,O=Amazon,C=US
+# Not Valid Before: Tue May 26 00:00:00 2015
+# Not Valid After : Sat May 26 00:00:00 2040
+# Fingerprint (SHA-256): E3:5D:28:41:9E:D0:20:25:CF:A6:90:38:CD:62:39:62:45:8D:A5:C6:95:FB:DE:A3:C2:2B:0B:FB:25:89:70:92
+# Fingerprint (SHA1): F6:10:84:07:D6:F8:BB:67:98:0C:C2:E2:44:C2:EB:AE:1C:EF:63:BE
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Amazon Root CA 4"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\366\020\204\007\326\370\273\147\230\014\302\342\104\302\353\256
+\034\357\143\276
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\211\274\047\325\353\027\215\006\152\151\325\375\211\107\264\315
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\071\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\017\060\015\006\003\125\004\012\023\006\101\155\141\172\157\156
+\061\031\060\027\006\003\125\004\003\023\020\101\155\141\172\157
+\156\040\122\157\157\164\040\103\101\040\064
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\023\006\154\237\327\301\273\020\114\051\103\345\161\173\173
+\054\310\032\301\016
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "LuxTrust Global Root 2"
+#
+# Issuer: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU
+# Serial Number:0a:7e:a6:df:4b:44:9e:da:6a:24:85:9e:e6:b8:15:d3:16:7f:bb:b1
+# Subject: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU
+# Not Valid Before: Thu Mar 05 13:21:57 2015
+# Not Valid After : Mon Mar 05 13:21:57 2035
+# Fingerprint (SHA-256): 54:45:5F:71:29:C2:0B:14:47:C4:18:F9:97:16:8F:24:C5:8F:C5:02:3B:F5:DA:5B:E2:EB:6E:1D:D8:90:2E:D5
+# Fingerprint (SHA1): 1E:0E:56:19:0A:D1:8B:25:98:B2:04:44:FF:66:8A:04:17:99:5F:3F
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "LuxTrust Global Root 2"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\114\125\061
+\026\060\024\006\003\125\004\012\014\015\114\165\170\124\162\165
+\163\164\040\123\056\101\056\061\037\060\035\006\003\125\004\003
+\014\026\114\165\170\124\162\165\163\164\040\107\154\157\142\141
+\154\040\122\157\157\164\040\062
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\114\125\061
+\026\060\024\006\003\125\004\012\014\015\114\165\170\124\162\165
+\163\164\040\123\056\101\056\061\037\060\035\006\003\125\004\003
+\014\026\114\165\170\124\162\165\163\164\040\107\154\157\142\141
+\154\040\122\157\157\164\040\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\024\012\176\246\337\113\104\236\332\152\044\205\236\346\270
+\025\323\026\177\273\261
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\303\060\202\003\253\240\003\002\001\002\002\024\012
+\176\246\337\113\104\236\332\152\044\205\236\346\270\025\323\026
+\177\273\261\060\015\006\011\052\206\110\206\367\015\001\001\013
+\005\000\060\106\061\013\060\011\006\003\125\004\006\023\002\114
+\125\061\026\060\024\006\003\125\004\012\014\015\114\165\170\124
+\162\165\163\164\040\123\056\101\056\061\037\060\035\006\003\125
+\004\003\014\026\114\165\170\124\162\165\163\164\040\107\154\157
+\142\141\154\040\122\157\157\164\040\062\060\036\027\015\061\065
+\060\063\060\065\061\063\062\061\065\067\132\027\015\063\065\060
+\063\060\065\061\063\062\061\065\067\132\060\106\061\013\060\011
+\006\003\125\004\006\023\002\114\125\061\026\060\024\006\003\125
+\004\012\014\015\114\165\170\124\162\165\163\164\040\123\056\101
+\056\061\037\060\035\006\003\125\004\003\014\026\114\165\170\124
+\162\165\163\164\040\107\154\157\142\141\154\040\122\157\157\164
+\040\062\060\202\002\042\060\015\006\011\052\206\110\206\367\015
+\001\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202
+\002\001\000\327\205\227\277\021\230\351\360\142\203\114\074\207
+\371\123\152\067\013\362\017\074\207\316\157\334\046\051\275\305
+\211\272\311\203\075\367\356\312\133\306\155\111\163\264\311\106
+\243\033\064\023\077\301\211\105\127\364\331\261\373\066\145\113
+\373\010\342\110\161\021\310\156\073\236\235\337\211\145\067\246
+\205\366\073\104\030\266\306\067\060\142\104\222\227\151\175\102
+\060\044\344\015\014\211\153\143\336\305\341\337\116\251\024\154
+\123\340\141\316\366\027\057\035\074\275\346\042\114\035\223\365
+\020\304\241\166\354\152\336\305\154\337\226\264\126\100\102\300
+\142\222\060\241\055\025\224\240\322\040\006\011\156\152\155\345
+\353\267\276\324\360\361\025\174\213\346\116\272\023\314\113\047
+\136\231\074\027\135\217\201\177\063\075\117\323\077\033\354\134
+\077\360\074\114\165\156\362\246\325\235\332\055\007\143\002\306
+\162\351\224\274\114\111\225\117\210\122\310\333\350\151\202\370
+\314\064\133\042\360\206\247\211\275\110\012\155\146\201\155\310
+\310\144\373\001\341\364\341\336\331\236\335\333\133\324\052\231
+\046\025\033\036\114\222\051\202\236\325\222\201\222\101\160\031
+\367\244\345\223\113\274\167\147\061\335\034\375\061\160\015\027
+\231\014\371\014\071\031\052\027\265\060\161\125\325\017\256\130
+\341\075\057\064\233\317\237\366\170\205\302\223\172\162\076\146
+\217\234\026\021\140\217\236\211\157\147\276\340\107\132\073\014
+\232\147\213\317\106\306\256\070\243\362\247\274\346\326\205\153
+\063\044\160\042\113\313\010\233\273\310\370\002\051\035\276\040
+\014\106\277\153\207\233\263\052\146\102\065\106\154\252\272\255
+\371\230\173\351\120\125\024\061\277\261\332\055\355\200\255\150
+\044\373\151\253\330\161\023\060\346\147\263\207\100\375\211\176
+\362\103\321\021\337\057\145\057\144\316\137\024\271\261\277\061
+\275\207\170\132\131\145\210\252\374\131\062\110\206\326\114\271
+\051\113\225\323\166\363\167\045\155\102\034\070\203\115\375\243
+\137\233\177\055\254\171\033\016\102\061\227\143\244\373\212\151
+\325\042\015\064\220\060\056\250\264\340\155\266\224\254\274\213
+\116\327\160\374\305\070\216\144\045\341\115\071\220\316\311\207
+\204\130\161\002\003\001\000\001\243\201\250\060\201\245\060\017
+\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060
+\102\006\003\125\035\040\004\073\060\071\060\067\006\007\053\201
+\053\001\001\001\012\060\054\060\052\006\010\053\006\001\005\005
+\007\002\001\026\036\150\164\164\160\163\072\057\057\162\145\160
+\157\163\151\164\157\162\171\056\154\165\170\164\162\165\163\164
+\056\154\165\060\016\006\003\125\035\017\001\001\377\004\004\003
+\002\001\006\060\037\006\003\125\035\043\004\030\060\026\200\024
+\377\030\050\166\371\110\005\054\241\256\361\053\033\053\262\123
+\370\113\174\263\060\035\006\003\125\035\016\004\026\004\024\377
+\030\050\166\371\110\005\054\241\256\361\053\033\053\262\123\370
+\113\174\263\060\015\006\011\052\206\110\206\367\015\001\001\013
+\005\000\003\202\002\001\000\152\031\024\355\156\171\301\054\207
+\324\015\160\176\327\366\170\311\013\004\116\304\261\316\223\160
+\376\260\124\300\062\315\231\060\144\027\277\017\345\342\063\375
+\007\066\100\162\016\032\266\152\131\326\000\345\150\040\335\056
+\162\015\037\152\144\061\040\204\175\111\246\132\067\353\105\311
+\205\365\324\307\027\231\007\346\233\125\344\014\350\251\264\316
+\214\133\265\021\134\317\212\016\015\326\254\167\201\376\062\234
+\044\236\162\316\124\363\320\157\242\126\326\354\303\067\054\145
+\130\276\127\000\032\362\065\372\353\173\061\135\302\301\022\075
+\226\201\210\226\211\301\131\134\172\346\177\160\064\347\203\342
+\261\341\341\270\130\357\324\225\344\140\234\360\226\227\162\214
+\353\204\002\056\145\217\244\267\322\177\147\335\310\323\236\134
+\252\251\244\240\045\024\006\233\354\117\176\055\013\177\035\165
+\361\063\330\355\316\270\165\155\076\133\271\230\035\061\015\126
+\330\103\017\060\221\262\004\153\335\126\276\225\200\125\147\276
+\330\315\203\331\030\356\056\017\206\055\222\236\160\023\354\336
+\121\311\103\170\002\245\115\310\371\137\304\221\130\106\026\167
+\132\164\252\100\274\007\237\060\271\261\367\022\027\335\343\377
+\044\100\035\172\152\321\117\030\012\252\220\035\353\100\036\337
+\241\036\104\222\020\232\362\215\341\321\113\106\236\350\105\102
+\227\352\105\231\363\354\146\325\002\372\362\246\112\044\252\336
+\316\271\312\371\077\223\157\371\243\272\352\245\076\231\255\375
+\377\173\231\365\145\356\360\131\050\147\327\220\225\244\023\204
+\251\204\301\350\316\316\165\223\143\032\274\074\352\325\144\037
+\055\052\022\071\306\303\132\062\355\107\221\026\016\274\070\301
+\120\336\217\312\052\220\064\034\356\101\224\234\136\031\056\370
+\105\111\231\164\221\260\004\157\343\004\132\261\253\052\253\376
+\307\320\226\266\332\341\112\144\006\156\140\115\275\102\116\377
+\170\332\044\312\033\264\327\226\071\154\256\361\016\252\247\175
+\110\213\040\114\317\144\326\270\227\106\260\116\321\052\126\072
+\240\223\275\257\200\044\340\012\176\347\312\325\312\350\205\125
+\334\066\052\341\224\150\223\307\146\162\104\017\200\041\062\154
+\045\307\043\200\203\012\353
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "LuxTrust Global Root 2"
+# Issuer: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU
+# Serial Number:0a:7e:a6:df:4b:44:9e:da:6a:24:85:9e:e6:b8:15:d3:16:7f:bb:b1
+# Subject: CN=LuxTrust Global Root 2,O=LuxTrust S.A.,C=LU
+# Not Valid Before: Thu Mar 05 13:21:57 2015
+# Not Valid After : Mon Mar 05 13:21:57 2035
+# Fingerprint (SHA-256): 54:45:5F:71:29:C2:0B:14:47:C4:18:F9:97:16:8F:24:C5:8F:C5:02:3B:F5:DA:5B:E2:EB:6E:1D:D8:90:2E:D5
+# Fingerprint (SHA1): 1E:0E:56:19:0A:D1:8B:25:98:B2:04:44:FF:66:8A:04:17:99:5F:3F
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "LuxTrust Global Root 2"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\036\016\126\031\012\321\213\045\230\262\004\104\377\146\212\004
+\027\231\137\077
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\262\341\011\000\141\257\367\361\221\157\304\255\215\136\073\174
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\114\125\061
+\026\060\024\006\003\125\004\012\014\015\114\165\170\124\162\165
+\163\164\040\123\056\101\056\061\037\060\035\006\003\125\004\003
+\014\026\114\165\170\124\162\165\163\164\040\107\154\157\142\141
+\154\040\122\157\157\164\040\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\024\012\176\246\337\113\104\236\332\152\044\205\236\346\270
+\025\323\026\177\273\261
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Symantec Class 1 Public Primary Certification Authority - G6"
+#
+# Issuer: CN=Symantec Class 1 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:24:32:75:f2:1d:2f:d2:09:33:f7:b4:6a:ca:d0:f3:98
+# Subject: CN=Symantec Class 1 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Tue Oct 18 00:00:00 2011
+# Not Valid After : Tue Dec 01 23:59:59 2037
+# Fingerprint (SHA-256): 9D:19:0B:2E:31:45:66:68:5B:E8:A8:89:E2:7A:A8:C7:D7:AE:1D:8A:AD:DB:A3:C1:EC:F9:D2:48:63:CD:34:B9
+# Fingerprint (SHA1): 51:7F:61:1E:29:91:6B:53:82:FB:72:E7:44:D9:8D:C3:CC:53:6D:64
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 1 Public Primary Certification Authority - G6"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\066
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\066
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\044\062\165\362\035\057\322\011\063\367\264\152\312\320
+\363\230
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\003\366\060\202\002\336\240\003\002\001\002\002\020\044
+\062\165\362\035\057\322\011\063\367\264\152\312\320\363\230\060
+\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060\201
+\224\061\013\060\011\006\003\125\004\006\023\002\125\123\061\035
+\060\033\006\003\125\004\012\023\024\123\171\155\141\156\164\145
+\143\040\103\157\162\160\157\162\141\164\151\157\156\061\037\060
+\035\006\003\125\004\013\023\026\123\171\155\141\156\164\145\143
+\040\124\162\165\163\164\040\116\145\164\167\157\162\153\061\105
+\060\103\006\003\125\004\003\023\074\123\171\155\141\156\164\145
+\143\040\103\154\141\163\163\040\061\040\120\165\142\154\151\143
+\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146\151
+\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+\040\055\040\107\066\060\036\027\015\061\061\061\060\061\070\060
+\060\060\060\060\060\132\027\015\063\067\061\062\060\061\062\063
+\065\071\065\071\132\060\201\224\061\013\060\011\006\003\125\004
+\006\023\002\125\123\061\035\060\033\006\003\125\004\012\023\024
+\123\171\155\141\156\164\145\143\040\103\157\162\160\157\162\141
+\164\151\157\156\061\037\060\035\006\003\125\004\013\023\026\123
+\171\155\141\156\164\145\143\040\124\162\165\163\164\040\116\145
+\164\167\157\162\153\061\105\060\103\006\003\125\004\003\023\074
+\123\171\155\141\156\164\145\143\040\103\154\141\163\163\040\061
+\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171\040
+\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101\165
+\164\150\157\162\151\164\171\040\055\040\107\066\060\202\001\042
+\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003
+\202\001\017\000\060\202\001\012\002\202\001\001\000\307\071\327
+\111\144\251\231\202\042\114\352\105\331\007\026\343\173\364\203
+\350\231\163\372\153\261\066\340\232\167\240\100\302\201\215\001
+\307\314\214\275\217\175\367\171\343\172\114\003\115\331\373\375
+\207\070\050\054\335\232\213\124\010\333\147\373\033\214\376\050
+\222\057\276\267\262\110\247\201\241\330\136\210\303\314\071\100
+\101\132\321\334\345\332\020\237\057\332\001\115\375\056\106\174
+\371\056\047\012\151\067\356\221\243\033\152\314\104\277\033\307
+\303\324\021\262\120\140\227\011\275\056\042\365\101\204\146\237
+\315\100\246\251\000\200\301\037\225\222\237\336\363\110\357\333
+\035\167\141\374\177\337\356\226\244\162\320\266\076\377\170\047
+\257\313\222\025\151\010\333\143\020\342\346\227\254\156\334\254
+\366\242\316\036\107\231\271\211\267\022\346\241\324\315\131\021
+\147\303\157\205\330\102\116\050\276\131\125\131\004\225\253\217
+\067\200\277\015\360\374\037\072\144\061\130\201\170\327\342\065
+\366\040\077\051\270\217\026\156\076\110\334\265\114\007\341\362
+\032\352\176\012\171\326\250\275\353\135\206\053\115\002\003\001
+\000\001\243\102\060\100\060\016\006\003\125\035\017\001\001\377
+\004\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377
+\004\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026
+\004\024\063\101\350\310\071\022\025\223\110\362\226\062\056\132
+\365\332\224\137\123\140\060\015\006\011\052\206\110\206\367\015
+\001\001\013\005\000\003\202\001\001\000\025\343\163\127\261\027
+\266\137\111\151\104\246\366\136\172\147\254\322\336\165\111\253
+\376\045\125\307\072\311\104\025\020\156\277\061\153\313\331\007
+\223\177\034\205\143\000\343\062\022\340\314\313\373\071\154\217
+\342\123\342\074\100\063\331\244\214\107\346\255\130\373\211\257
+\343\336\206\051\126\064\054\105\270\022\372\104\211\156\055\024
+\045\050\044\001\145\326\352\122\254\005\156\126\022\011\075\320
+\164\364\327\275\006\312\250\072\215\126\102\372\215\162\076\164
+\361\003\162\337\207\033\136\016\172\125\226\054\070\267\230\205
+\315\115\063\104\311\224\217\132\061\060\067\113\243\072\022\263
+\347\066\321\041\150\113\055\070\346\123\256\034\045\126\010\126
+\003\147\204\235\306\303\316\044\142\307\114\066\317\260\006\104
+\267\365\137\002\335\331\124\351\057\220\116\172\310\116\203\100
+\014\232\227\074\067\277\277\354\366\360\264\205\167\050\301\013
+\310\147\202\020\027\070\242\267\006\352\233\277\072\370\351\043
+\007\277\164\340\230\070\025\125\170\356\162\000\134\031\243\364
+\322\063\340\377\275\321\124\071\051\017
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Symantec Class 1 Public Primary Certification Authority - G6"
+# Issuer: CN=Symantec Class 1 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:24:32:75:f2:1d:2f:d2:09:33:f7:b4:6a:ca:d0:f3:98
+# Subject: CN=Symantec Class 1 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Tue Oct 18 00:00:00 2011
+# Not Valid After : Tue Dec 01 23:59:59 2037
+# Fingerprint (SHA-256): 9D:19:0B:2E:31:45:66:68:5B:E8:A8:89:E2:7A:A8:C7:D7:AE:1D:8A:AD:DB:A3:C1:EC:F9:D2:48:63:CD:34:B9
+# Fingerprint (SHA1): 51:7F:61:1E:29:91:6B:53:82:FB:72:E7:44:D9:8D:C3:CC:53:6D:64
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 1 Public Primary Certification Authority - G6"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\121\177\141\036\051\221\153\123\202\373\162\347\104\331\215\303
+\314\123\155\144
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\057\250\264\332\366\144\113\036\202\371\106\075\124\032\174\260
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\066
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\044\062\165\362\035\057\322\011\063\367\264\152\312\320
+\363\230
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Symantec Class 2 Public Primary Certification Authority - G6"
+#
+# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:64:82:9e:fc:37:1e:74:5d:fc:97:ff:97:c8:b1:ff:41
+# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Tue Oct 18 00:00:00 2011
+# Not Valid After : Tue Dec 01 23:59:59 2037
+# Fingerprint (SHA-256): CB:62:7D:18:B5:8A:D5:6D:DE:33:1A:30:45:6B:C6:5C:60:1A:4E:9B:18:DE:DC:EA:08:E7:DA:AA:07:81:5F:F0
+# Fingerprint (SHA1): 40:B3:31:A0:E9:BF:E8:55:BC:39:93:CA:70:4F:4E:C2:51:D4:1D:8F
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G6"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\066
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\066
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\144\202\236\374\067\036\164\135\374\227\377\227\310\261
+\377\101
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\003\366\060\202\002\336\240\003\002\001\002\002\020\144
+\202\236\374\067\036\164\135\374\227\377\227\310\261\377\101\060
+\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060\201
+\224\061\013\060\011\006\003\125\004\006\023\002\125\123\061\035
+\060\033\006\003\125\004\012\023\024\123\171\155\141\156\164\145
+\143\040\103\157\162\160\157\162\141\164\151\157\156\061\037\060
+\035\006\003\125\004\013\023\026\123\171\155\141\156\164\145\143
+\040\124\162\165\163\164\040\116\145\164\167\157\162\153\061\105
+\060\103\006\003\125\004\003\023\074\123\171\155\141\156\164\145
+\143\040\103\154\141\163\163\040\062\040\120\165\142\154\151\143
+\040\120\162\151\155\141\162\171\040\103\145\162\164\151\146\151
+\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+\040\055\040\107\066\060\036\027\015\061\061\061\060\061\070\060
+\060\060\060\060\060\132\027\015\063\067\061\062\060\061\062\063
+\065\071\065\071\132\060\201\224\061\013\060\011\006\003\125\004
+\006\023\002\125\123\061\035\060\033\006\003\125\004\012\023\024
+\123\171\155\141\156\164\145\143\040\103\157\162\160\157\162\141
+\164\151\157\156\061\037\060\035\006\003\125\004\013\023\026\123
+\171\155\141\156\164\145\143\040\124\162\165\163\164\040\116\145
+\164\167\157\162\153\061\105\060\103\006\003\125\004\003\023\074
+\123\171\155\141\156\164\145\143\040\103\154\141\163\163\040\062
+\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171\040
+\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101\165
+\164\150\157\162\151\164\171\040\055\040\107\066\060\202\001\042
+\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003
+\202\001\017\000\060\202\001\012\002\202\001\001\000\315\314\351
+\005\310\143\205\313\077\100\143\027\275\030\372\065\346\004\147
+\127\145\230\051\244\117\311\134\217\017\064\322\370\332\250\023
+\142\252\270\036\120\147\170\260\026\114\240\071\251\025\172\256
+\355\322\242\300\360\220\067\051\030\046\134\350\015\074\266\154
+\111\077\301\340\334\331\113\266\024\031\013\246\323\226\341\326
+\011\343\031\046\034\371\037\145\113\371\032\103\034\000\203\326
+\320\252\111\242\324\333\346\142\070\272\120\024\103\155\371\061
+\370\126\026\331\070\002\221\317\353\154\335\273\071\116\231\341
+\060\147\105\361\324\360\215\303\337\376\362\070\007\041\175\000
+\136\126\104\263\344\140\275\221\053\234\253\133\004\162\017\262
+\050\331\162\253\005\040\102\045\251\133\003\152\040\020\314\061
+\360\053\332\065\054\320\373\232\227\116\360\202\113\053\330\137
+\066\243\013\055\257\143\015\035\045\177\241\156\134\142\241\215
+\050\076\241\374\034\040\370\001\057\272\125\232\021\260\031\322
+\310\120\171\153\016\152\005\327\252\004\066\262\243\362\341\137
+\167\247\167\234\345\036\334\351\337\152\301\145\135\002\003\001
+\000\001\243\102\060\100\060\016\006\003\125\035\017\001\001\377
+\004\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377
+\004\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026
+\004\024\207\214\040\225\310\230\112\321\326\200\006\112\220\064
+\104\337\034\115\277\260\060\015\006\011\052\206\110\206\367\015
+\001\001\013\005\000\003\202\001\001\000\201\216\262\245\146\226
+\267\041\245\266\357\157\043\132\137\333\201\305\102\245\170\301
+\151\375\364\074\327\371\134\153\160\162\032\374\132\227\115\000
+\200\210\210\202\212\303\161\015\216\305\211\233\054\355\215\013
+\322\162\124\365\175\324\134\103\127\351\363\256\245\002\021\366
+\166\053\201\127\335\175\332\164\060\375\124\107\366\340\026\156
+\246\264\012\110\346\347\165\007\017\051\031\071\316\171\364\266
+\154\305\137\231\325\037\113\372\337\155\054\074\015\124\200\160
+\360\210\013\200\317\306\150\242\270\035\160\331\166\214\374\356
+\245\311\317\255\035\317\231\045\127\132\142\105\313\026\153\275
+\111\315\245\243\214\151\171\045\256\270\114\154\213\100\146\113
+\026\077\317\002\032\335\341\154\153\007\141\152\166\025\051\231
+\177\033\335\210\200\301\277\265\217\163\305\246\226\043\204\246
+\050\206\044\063\152\001\056\127\163\045\266\136\277\217\346\035
+\141\250\100\051\147\035\207\233\035\177\233\237\231\315\061\326
+\124\276\142\273\071\254\150\022\110\221\040\245\313\261\335\376
+\157\374\132\344\202\125\131\257\061\251
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Symantec Class 2 Public Primary Certification Authority - G6"
+# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:64:82:9e:fc:37:1e:74:5d:fc:97:ff:97:c8:b1:ff:41
+# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G6,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Tue Oct 18 00:00:00 2011
+# Not Valid After : Tue Dec 01 23:59:59 2037
+# Fingerprint (SHA-256): CB:62:7D:18:B5:8A:D5:6D:DE:33:1A:30:45:6B:C6:5C:60:1A:4E:9B:18:DE:DC:EA:08:E7:DA:AA:07:81:5F:F0
+# Fingerprint (SHA1): 40:B3:31:A0:E9:BF:E8:55:BC:39:93:CA:70:4F:4E:C2:51:D4:1D:8F
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G6"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\100\263\061\240\351\277\350\125\274\071\223\312\160\117\116\302
+\121\324\035\217
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\175\013\203\345\373\174\255\007\117\040\251\265\337\143\355\171
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\066
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\144\202\236\374\067\036\164\135\374\227\377\227\310\261
+\377\101
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Symantec Class 1 Public Primary Certification Authority - G4"
+#
+# Issuer: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:21:6e:33:a5:cb:d3:88:a4:6f:29:07:b4:27:3c:c4:d8
+# Subject: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Wed Oct 05 00:00:00 2011
+# Not Valid After : Mon Jan 18 23:59:59 2038
+# Fingerprint (SHA-256): 36:3F:3C:84:9E:AB:03:B0:A2:A0:F6:36:D7:B8:6D:04:D3:AC:7F:CF:E2:6A:0A:91:21:AB:97:95:F6:E1:76:DF
+# Fingerprint (SHA1): 84:F2:E3:DD:83:13:3E:A9:1D:19:52:7F:02:D7:29:BF:C1:5F:E6:67
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 1 Public Primary Certification Authority - G4"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\064
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\064
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\041\156\063\245\313\323\210\244\157\051\007\264\047\074
+\304\330
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\002\250\060\202\002\055\240\003\002\001\002\002\020\041
+\156\063\245\313\323\210\244\157\051\007\264\047\074\304\330\060
+\012\006\010\052\206\110\316\075\004\003\003\060\201\224\061\013
+\060\011\006\003\125\004\006\023\002\125\123\061\035\060\033\006
+\003\125\004\012\023\024\123\171\155\141\156\164\145\143\040\103
+\157\162\160\157\162\141\164\151\157\156\061\037\060\035\006\003
+\125\004\013\023\026\123\171\155\141\156\164\145\143\040\124\162
+\165\163\164\040\116\145\164\167\157\162\153\061\105\060\103\006
+\003\125\004\003\023\074\123\171\155\141\156\164\145\143\040\103
+\154\141\163\163\040\061\040\120\165\142\154\151\143\040\120\162
+\151\155\141\162\171\040\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\055\040
+\107\064\060\036\027\015\061\061\061\060\060\065\060\060\060\060
+\060\060\132\027\015\063\070\060\061\061\070\062\063\065\071\065
+\071\132\060\201\224\061\013\060\011\006\003\125\004\006\023\002
+\125\123\061\035\060\033\006\003\125\004\012\023\024\123\171\155
+\141\156\164\145\143\040\103\157\162\160\157\162\141\164\151\157
+\156\061\037\060\035\006\003\125\004\013\023\026\123\171\155\141
+\156\164\145\143\040\124\162\165\163\164\040\116\145\164\167\157
+\162\153\061\105\060\103\006\003\125\004\003\023\074\123\171\155
+\141\156\164\145\143\040\103\154\141\163\163\040\061\040\120\165
+\142\154\151\143\040\120\162\151\155\141\162\171\040\103\145\162
+\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157
+\162\151\164\171\040\055\040\107\064\060\166\060\020\006\007\052
+\206\110\316\075\002\001\006\005\053\201\004\000\042\003\142\000
+\004\327\146\265\033\333\256\263\140\356\106\352\210\143\165\073
+\052\224\155\363\137\022\366\343\017\236\266\012\024\123\110\122
+\310\334\072\263\313\110\040\046\022\116\372\211\204\324\337\221
+\344\051\175\050\001\331\333\030\103\151\241\037\265\323\206\026
+\334\307\177\147\043\337\337\061\061\203\003\065\160\261\113\267
+\310\027\273\121\313\334\224\027\333\352\011\073\166\022\336\252
+\265\243\102\060\100\060\016\006\003\125\035\017\001\001\377\004
+\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377\004
+\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026\004
+\024\145\300\215\045\365\014\272\227\167\220\077\236\056\340\132
+\365\316\325\341\344\060\012\006\010\052\206\110\316\075\004\003
+\003\003\151\000\060\146\002\061\000\245\256\343\106\123\370\230
+\066\343\042\372\056\050\111\015\356\060\176\063\363\354\077\161
+\136\314\125\211\170\231\254\262\375\334\034\134\063\216\051\271
+\153\027\310\021\150\265\334\203\007\002\061\000\234\310\104\332
+\151\302\066\303\124\031\020\205\002\332\235\107\357\101\347\154
+\046\235\011\075\367\155\220\321\005\104\057\260\274\203\223\150
+\362\014\105\111\071\277\231\004\034\323\020\240
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Symantec Class 1 Public Primary Certification Authority - G4"
+# Issuer: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:21:6e:33:a5:cb:d3:88:a4:6f:29:07:b4:27:3c:c4:d8
+# Subject: CN=Symantec Class 1 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Wed Oct 05 00:00:00 2011
+# Not Valid After : Mon Jan 18 23:59:59 2038
+# Fingerprint (SHA-256): 36:3F:3C:84:9E:AB:03:B0:A2:A0:F6:36:D7:B8:6D:04:D3:AC:7F:CF:E2:6A:0A:91:21:AB:97:95:F6:E1:76:DF
+# Fingerprint (SHA1): 84:F2:E3:DD:83:13:3E:A9:1D:19:52:7F:02:D7:29:BF:C1:5F:E6:67
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 1 Public Primary Certification Authority - G4"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\204\362\343\335\203\023\076\251\035\031\122\177\002\327\051\277
+\301\137\346\147
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\004\345\200\077\125\377\131\207\244\062\322\025\245\345\252\346
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\061\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\064
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\041\156\063\245\313\323\210\244\157\051\007\264\047\074
+\304\330
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Symantec Class 2 Public Primary Certification Authority - G4"
+#
+# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:34:17:65:12:40:3b:b7:56:80:2d:80:cb:79:55:a6:1e
+# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Wed Oct 05 00:00:00 2011
+# Not Valid After : Mon Jan 18 23:59:59 2038
+# Fingerprint (SHA-256): FE:86:3D:08:22:FE:7A:23:53:FA:48:4D:59:24:E8:75:65:6D:3D:C9:FB:58:77:1F:6F:61:6F:9D:57:1B:C5:92
+# Fingerprint (SHA1): 67:24:90:2E:48:01:B0:22:96:40:10:46:B4:B1:67:2C:A9:75:FD:2B
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G4"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\064
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\064
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\064\027\145\022\100\073\267\126\200\055\200\313\171\125
+\246\036
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\002\250\060\202\002\055\240\003\002\001\002\002\020\064
+\027\145\022\100\073\267\126\200\055\200\313\171\125\246\036\060
+\012\006\010\052\206\110\316\075\004\003\003\060\201\224\061\013
+\060\011\006\003\125\004\006\023\002\125\123\061\035\060\033\006
+\003\125\004\012\023\024\123\171\155\141\156\164\145\143\040\103
+\157\162\160\157\162\141\164\151\157\156\061\037\060\035\006\003
+\125\004\013\023\026\123\171\155\141\156\164\145\143\040\124\162
+\165\163\164\040\116\145\164\167\157\162\153\061\105\060\103\006
+\003\125\004\003\023\074\123\171\155\141\156\164\145\143\040\103
+\154\141\163\163\040\062\040\120\165\142\154\151\143\040\120\162
+\151\155\141\162\171\040\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\055\040
+\107\064\060\036\027\015\061\061\061\060\060\065\060\060\060\060
+\060\060\132\027\015\063\070\060\061\061\070\062\063\065\071\065
+\071\132\060\201\224\061\013\060\011\006\003\125\004\006\023\002
+\125\123\061\035\060\033\006\003\125\004\012\023\024\123\171\155
+\141\156\164\145\143\040\103\157\162\160\157\162\141\164\151\157
+\156\061\037\060\035\006\003\125\004\013\023\026\123\171\155\141
+\156\164\145\143\040\124\162\165\163\164\040\116\145\164\167\157
+\162\153\061\105\060\103\006\003\125\004\003\023\074\123\171\155
+\141\156\164\145\143\040\103\154\141\163\163\040\062\040\120\165
+\142\154\151\143\040\120\162\151\155\141\162\171\040\103\145\162
+\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157
+\162\151\164\171\040\055\040\107\064\060\166\060\020\006\007\052
+\206\110\316\075\002\001\006\005\053\201\004\000\042\003\142\000
+\004\321\331\112\216\114\015\204\112\121\272\174\357\323\314\372
+\072\232\265\247\143\023\075\001\340\111\076\372\301\107\311\222
+\263\072\327\376\157\234\367\232\072\017\365\016\012\012\303\077
+\310\347\022\024\216\325\325\155\230\054\263\161\062\012\353\052
+\275\366\327\152\040\013\147\105\234\322\262\277\123\042\146\011
+\135\333\021\363\361\005\063\130\243\342\270\317\174\315\202\233
+\275\243\102\060\100\060\016\006\003\125\035\017\001\001\377\004
+\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377\004
+\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026\004
+\024\075\062\363\072\251\014\220\204\371\242\214\151\006\141\124
+\057\207\162\376\005\060\012\006\010\052\206\110\316\075\004\003
+\003\003\151\000\060\146\002\061\000\310\246\251\257\101\177\265
+\311\021\102\026\150\151\114\134\270\047\030\266\230\361\300\177
+\220\155\207\323\214\106\027\360\076\117\374\352\260\010\304\172
+\113\274\010\057\307\342\247\157\145\002\061\000\326\131\336\206
+\316\137\016\312\124\325\306\320\025\016\374\213\224\162\324\216
+\000\130\123\317\176\261\113\015\345\120\206\353\236\153\337\377
+\051\246\330\107\331\240\226\030\333\362\105\263
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Symantec Class 2 Public Primary Certification Authority - G4"
+# Issuer: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Serial Number:34:17:65:12:40:3b:b7:56:80:2d:80:cb:79:55:a6:1e
+# Subject: CN=Symantec Class 2 Public Primary Certification Authority - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
+# Not Valid Before: Wed Oct 05 00:00:00 2011
+# Not Valid After : Mon Jan 18 23:59:59 2038
+# Fingerprint (SHA-256): FE:86:3D:08:22:FE:7A:23:53:FA:48:4D:59:24:E8:75:65:6D:3D:C9:FB:58:77:1F:6F:61:6F:9D:57:1B:C5:92
+# Fingerprint (SHA1): 67:24:90:2E:48:01:B0:22:96:40:10:46:B4:B1:67:2C:A9:75:FD:2B
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Symantec Class 2 Public Primary Certification Authority - G4"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\147\044\220\056\110\001\260\042\226\100\020\106\264\261\147\054
+\251\165\375\053
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\160\325\060\361\332\224\227\324\327\164\337\276\355\150\336\226
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156
+\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061
+\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164
+\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153
+\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156
+\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154
+\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\055\040\107\064
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\064\027\145\022\100\073\267\126\200\055\200\313\171\125
+\246\036
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "D-TRUST Root CA 3 2013"
+#
+# Issuer: CN=D-TRUST Root CA 3 2013,O=D-Trust GmbH,C=DE
+# Serial Number: 1039788 (0xfddac)
+# Subject: CN=D-TRUST Root CA 3 2013,O=D-Trust GmbH,C=DE
+# Not Valid Before: Fri Sep 20 08:25:51 2013
+# Not Valid After : Wed Sep 20 08:25:51 2028
+# Fingerprint (SHA-256): A1:A8:6D:04:12:1E:B8:7F:02:7C:66:F5:33:03:C2:8E:57:39:F9:43:FC:84:B3:8A:D6:AF:00:90:35:DD:94:57
+# Fingerprint (SHA1): 6C:7C:CC:E7:D4:AE:51:5F:99:08:CD:3F:F6:E8:C3:78:DF:6F:EF:97
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "D-TRUST Root CA 3 2013"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\105\061\013\060\011\006\003\125\004\006\023\002\104\105\061
+\025\060\023\006\003\125\004\012\014\014\104\055\124\162\165\163
+\164\040\107\155\142\110\061\037\060\035\006\003\125\004\003\014
+\026\104\055\124\122\125\123\124\040\122\157\157\164\040\103\101
+\040\063\040\062\060\061\063
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\105\061\013\060\011\006\003\125\004\006\023\002\104\105\061
+\025\060\023\006\003\125\004\012\014\014\104\055\124\162\165\163
+\164\040\107\155\142\110\061\037\060\035\006\003\125\004\003\014
+\026\104\055\124\122\125\123\124\040\122\157\157\164\040\103\101
+\040\063\040\062\060\061\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\003\017\335\254
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\016\060\202\002\366\240\003\002\001\002\002\003\017
+\335\254\060\015\006\011\052\206\110\206\367\015\001\001\013\005
+\000\060\105\061\013\060\011\006\003\125\004\006\023\002\104\105
+\061\025\060\023\006\003\125\004\012\014\014\104\055\124\162\165
+\163\164\040\107\155\142\110\061\037\060\035\006\003\125\004\003
+\014\026\104\055\124\122\125\123\124\040\122\157\157\164\040\103
+\101\040\063\040\062\060\061\063\060\036\027\015\061\063\060\071
+\062\060\060\070\062\065\065\061\132\027\015\062\070\060\071\062
+\060\060\070\062\065\065\061\132\060\105\061\013\060\011\006\003
+\125\004\006\023\002\104\105\061\025\060\023\006\003\125\004\012
+\014\014\104\055\124\162\165\163\164\040\107\155\142\110\061\037
+\060\035\006\003\125\004\003\014\026\104\055\124\122\125\123\124
+\040\122\157\157\164\040\103\101\040\063\040\062\060\061\063\060
+\202\001\042\060\015\006\011\052\206\110\206\367\015\001\001\001
+\005\000\003\202\001\017\000\060\202\001\012\002\202\001\001\000
+\304\173\102\222\202\037\354\355\124\230\216\022\300\312\011\337
+\223\156\072\223\134\033\344\020\167\236\116\151\210\154\366\341
+\151\362\366\233\242\141\261\275\007\040\164\230\145\361\214\046
+\010\315\250\065\312\200\066\321\143\155\350\104\172\202\303\154
+\136\336\273\350\066\322\304\150\066\214\237\062\275\204\042\340
+\334\302\356\020\106\071\155\257\223\071\256\207\346\303\274\011
+\311\054\153\147\133\331\233\166\165\114\013\340\273\305\327\274
+\076\171\362\137\276\321\220\127\371\256\366\146\137\061\277\323
+\155\217\247\272\112\363\043\145\273\267\357\243\045\327\012\352
+\130\266\357\210\372\372\171\262\122\130\325\360\254\214\241\121
+\164\051\225\252\121\073\220\062\003\237\034\162\164\220\336\075
+\355\141\322\345\343\375\144\107\345\271\267\112\251\367\037\256
+\226\206\004\254\057\343\244\201\167\267\132\026\377\330\017\077
+\366\267\170\314\244\257\372\133\074\022\133\250\122\211\162\357
+\210\363\325\104\201\206\225\043\237\173\335\274\331\064\357\174
+\224\074\252\300\101\302\343\235\120\032\300\344\031\042\374\263
+\002\003\001\000\001\243\202\001\005\060\202\001\001\060\017\006
+\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060\035
+\006\003\125\035\016\004\026\004\024\077\220\310\175\307\025\157
+\363\044\217\251\303\057\113\242\017\041\262\057\347\060\016\006
+\003\125\035\017\001\001\377\004\004\003\002\001\006\060\201\276
+\006\003\125\035\037\004\201\266\060\201\263\060\164\240\162\240
+\160\206\156\154\144\141\160\072\057\057\144\151\162\145\143\164
+\157\162\171\056\144\055\164\162\165\163\164\056\156\145\164\057
+\103\116\075\104\055\124\122\125\123\124\045\062\060\122\157\157
+\164\045\062\060\103\101\045\062\060\063\045\062\060\062\060\061
+\063\054\117\075\104\055\124\162\165\163\164\045\062\060\107\155
+\142\110\054\103\075\104\105\077\143\145\162\164\151\146\151\143
+\141\164\145\162\145\166\157\143\141\164\151\157\156\154\151\163
+\164\060\073\240\071\240\067\206\065\150\164\164\160\072\057\057
+\143\162\154\056\144\055\164\162\165\163\164\056\156\145\164\057
+\143\162\154\057\144\055\164\162\165\163\164\137\162\157\157\164
+\137\143\141\137\063\137\062\060\061\063\056\143\162\154\060\015
+\006\011\052\206\110\206\367\015\001\001\013\005\000\003\202\001
+\001\000\016\131\016\130\344\164\110\043\104\317\064\041\265\234
+\024\032\255\232\113\267\263\210\155\134\251\027\160\360\052\237
+\215\173\371\173\205\372\307\071\350\020\010\260\065\053\137\317
+\002\322\323\234\310\013\036\356\005\124\256\067\223\004\011\175
+\154\217\302\164\274\370\034\224\276\061\001\100\055\363\044\040
+\267\204\125\054\134\310\365\164\112\020\031\213\243\307\355\065
+\326\011\110\323\016\300\272\071\250\260\106\002\260\333\306\210
+\131\302\276\374\173\261\053\317\176\142\207\125\226\314\001\157
+\233\147\041\225\065\213\370\020\374\161\033\267\113\067\151\246
+\073\326\354\213\356\301\260\363\045\311\217\222\175\241\352\303
+\312\104\277\046\245\164\222\234\343\164\353\235\164\331\313\115
+\207\330\374\264\151\154\213\240\103\007\140\170\227\351\331\223
+\174\302\106\274\233\067\122\243\355\212\074\023\251\173\123\113
+\111\232\021\005\054\013\156\126\254\037\056\202\154\340\151\147
+\265\016\155\055\331\344\300\025\361\077\372\030\162\341\025\155
+\047\133\055\060\050\053\237\110\232\144\053\231\357\362\165\111
+\137\134
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "D-TRUST Root CA 3 2013"
+# Issuer: CN=D-TRUST Root CA 3 2013,O=D-Trust GmbH,C=DE
+# Serial Number: 1039788 (0xfddac)
+# Subject: CN=D-TRUST Root CA 3 2013,O=D-Trust GmbH,C=DE
+# Not Valid Before: Fri Sep 20 08:25:51 2013
+# Not Valid After : Wed Sep 20 08:25:51 2028
+# Fingerprint (SHA-256): A1:A8:6D:04:12:1E:B8:7F:02:7C:66:F5:33:03:C2:8E:57:39:F9:43:FC:84:B3:8A:D6:AF:00:90:35:DD:94:57
+# Fingerprint (SHA1): 6C:7C:CC:E7:D4:AE:51:5F:99:08:CD:3F:F6:E8:C3:78:DF:6F:EF:97
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "D-TRUST Root CA 3 2013"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\154\174\314\347\324\256\121\137\231\010\315\077\366\350\303\170
+\337\157\357\227
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\267\042\146\230\176\326\003\340\301\161\346\165\315\126\105\277
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\105\061\013\060\011\006\003\125\004\006\023\002\104\105\061
+\025\060\023\006\003\125\004\012\014\014\104\055\124\162\165\163
+\164\040\107\155\142\110\061\037\060\035\006\003\125\004\003\014
+\026\104\055\124\122\125\123\124\040\122\157\157\164\040\103\101
+\040\063\040\062\060\061\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\003\017\335\254
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1"
+#
+# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1,OU=Kamu Sertifikasyon Merkezi - Kamu SM,O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK,L=Gebze - Kocaeli,C=TR
+# Serial Number: 1 (0x1)
+# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1,OU=Kamu Sertifikasyon Merkezi - Kamu SM,O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK,L=Gebze - Kocaeli,C=TR
+# Not Valid Before: Mon Nov 25 08:25:55 2013
+# Not Valid After : Sun Oct 25 08:25:55 2043
+# Fingerprint (SHA-256): 46:ED:C3:68:90:46:D5:3A:45:3F:B3:10:4A:B8:0D:CA:EC:65:8B:26:60:EA:16:29:DD:7E:86:79:90:64:87:16
+# Fingerprint (SHA1): 31:43:64:9B:EC:CE:27:EC:ED:3A:3F:0B:8F:0D:E4:E8:91:DD:EE:CA
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\322\061\013\060\011\006\003\125\004\006\023\002\124\122
+\061\030\060\026\006\003\125\004\007\023\017\107\145\142\172\145
+\040\055\040\113\157\143\141\145\154\151\061\102\060\100\006\003
+\125\004\012\023\071\124\165\162\153\151\171\145\040\102\151\154
+\151\155\163\145\154\040\166\145\040\124\145\153\156\157\154\157
+\152\151\153\040\101\162\141\163\164\151\162\155\141\040\113\165
+\162\165\155\165\040\055\040\124\125\102\111\124\101\113\061\055
+\060\053\006\003\125\004\013\023\044\113\141\155\165\040\123\145
+\162\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153
+\145\172\151\040\055\040\113\141\155\165\040\123\115\061\066\060
+\064\006\003\125\004\003\023\055\124\125\102\111\124\101\113\040
+\113\141\155\165\040\123\115\040\123\123\114\040\113\157\153\040
+\123\145\162\164\151\146\151\153\141\163\151\040\055\040\123\165
+\162\165\155\040\061
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\322\061\013\060\011\006\003\125\004\006\023\002\124\122
+\061\030\060\026\006\003\125\004\007\023\017\107\145\142\172\145
+\040\055\040\113\157\143\141\145\154\151\061\102\060\100\006\003
+\125\004\012\023\071\124\165\162\153\151\171\145\040\102\151\154
+\151\155\163\145\154\040\166\145\040\124\145\153\156\157\154\157
+\152\151\153\040\101\162\141\163\164\151\162\155\141\040\113\165
+\162\165\155\165\040\055\040\124\125\102\111\124\101\113\061\055
+\060\053\006\003\125\004\013\023\044\113\141\155\165\040\123\145
+\162\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153
+\145\172\151\040\055\040\113\141\155\165\040\123\115\061\066\060
+\064\006\003\125\004\003\023\055\124\125\102\111\124\101\113\040
+\113\141\155\165\040\123\115\040\123\123\114\040\113\157\153\040
+\123\145\162\164\151\146\151\153\141\163\151\040\055\040\123\165
+\162\165\155\040\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\143\060\202\003\113\240\003\002\001\002\002\001\001
+\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060
+\201\322\061\013\060\011\006\003\125\004\006\023\002\124\122\061
+\030\060\026\006\003\125\004\007\023\017\107\145\142\172\145\040
+\055\040\113\157\143\141\145\154\151\061\102\060\100\006\003\125
+\004\012\023\071\124\165\162\153\151\171\145\040\102\151\154\151
+\155\163\145\154\040\166\145\040\124\145\153\156\157\154\157\152
+\151\153\040\101\162\141\163\164\151\162\155\141\040\113\165\162
+\165\155\165\040\055\040\124\125\102\111\124\101\113\061\055\060
+\053\006\003\125\004\013\023\044\113\141\155\165\040\123\145\162
+\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153\145
+\172\151\040\055\040\113\141\155\165\040\123\115\061\066\060\064
+\006\003\125\004\003\023\055\124\125\102\111\124\101\113\040\113
+\141\155\165\040\123\115\040\123\123\114\040\113\157\153\040\123
+\145\162\164\151\146\151\153\141\163\151\040\055\040\123\165\162
+\165\155\040\061\060\036\027\015\061\063\061\061\062\065\060\070
+\062\065\065\065\132\027\015\064\063\061\060\062\065\060\070\062
+\065\065\065\132\060\201\322\061\013\060\011\006\003\125\004\006
+\023\002\124\122\061\030\060\026\006\003\125\004\007\023\017\107
+\145\142\172\145\040\055\040\113\157\143\141\145\154\151\061\102
+\060\100\006\003\125\004\012\023\071\124\165\162\153\151\171\145
+\040\102\151\154\151\155\163\145\154\040\166\145\040\124\145\153
+\156\157\154\157\152\151\153\040\101\162\141\163\164\151\162\155
+\141\040\113\165\162\165\155\165\040\055\040\124\125\102\111\124
+\101\113\061\055\060\053\006\003\125\004\013\023\044\113\141\155
+\165\040\123\145\162\164\151\146\151\153\141\163\171\157\156\040
+\115\145\162\153\145\172\151\040\055\040\113\141\155\165\040\123
+\115\061\066\060\064\006\003\125\004\003\023\055\124\125\102\111
+\124\101\113\040\113\141\155\165\040\123\115\040\123\123\114\040
+\113\157\153\040\123\145\162\164\151\146\151\153\141\163\151\040
+\055\040\123\165\162\165\155\040\061\060\202\001\042\060\015\006
+\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001\017
+\000\060\202\001\012\002\202\001\001\000\257\165\060\063\252\273
+\153\323\231\054\022\067\204\331\215\173\227\200\323\156\347\377
+\233\120\225\076\220\225\126\102\327\031\174\046\204\215\222\372
+\001\035\072\017\342\144\070\267\214\274\350\210\371\213\044\253
+\056\243\365\067\344\100\216\030\045\171\203\165\037\073\377\154
+\250\305\306\126\370\264\355\212\104\243\253\154\114\374\035\320
+\334\357\150\275\317\344\252\316\360\125\367\242\064\324\203\153
+\067\174\034\302\376\265\003\354\127\316\274\264\265\305\355\000
+\017\123\067\052\115\364\117\014\203\373\206\317\313\376\214\116
+\275\207\371\247\213\041\127\234\172\337\003\147\211\054\235\227
+\141\247\020\270\125\220\177\016\055\047\070\164\337\347\375\332
+\116\022\343\115\025\042\002\310\340\340\374\017\255\212\327\311
+\124\120\314\073\017\312\026\200\204\320\121\126\303\216\126\177
+\211\042\063\057\346\205\012\275\245\250\033\066\336\323\334\054
+\155\073\307\023\275\131\043\054\346\345\244\367\330\013\355\352
+\220\100\104\250\225\273\223\325\320\200\064\266\106\170\016\037
+\000\223\106\341\356\351\371\354\117\027\002\003\001\000\001\243
+\102\060\100\060\035\006\003\125\035\016\004\026\004\024\145\077
+\307\212\206\306\074\335\074\124\134\065\370\072\355\122\014\107
+\127\310\060\016\006\003\125\035\017\001\001\377\004\004\003\002
+\001\006\060\017\006\003\125\035\023\001\001\377\004\005\060\003
+\001\001\377\060\015\006\011\052\206\110\206\367\015\001\001\013
+\005\000\003\202\001\001\000\052\077\341\361\062\216\256\341\230
+\134\113\136\317\153\036\152\011\322\042\251\022\307\136\127\175
+\163\126\144\200\204\172\223\344\011\271\020\315\237\052\047\341
+\000\167\276\110\310\065\250\201\237\344\270\054\311\177\016\260
+\322\113\067\135\352\271\325\013\136\064\275\364\163\051\303\355
+\046\025\234\176\010\123\212\130\215\320\113\050\337\301\263\337
+\040\363\371\343\343\072\337\314\234\224\330\116\117\303\153\027
+\267\367\162\350\255\146\063\265\045\123\253\340\370\114\251\235
+\375\362\015\272\256\271\331\252\306\153\371\223\273\256\253\270
+\227\074\003\032\272\103\306\226\271\105\162\070\263\247\241\226
+\075\221\173\176\300\041\123\114\207\355\362\013\124\225\121\223
+\325\042\245\015\212\361\223\016\076\124\016\260\330\311\116\334
+\362\061\062\126\352\144\371\352\265\235\026\146\102\162\363\177
+\323\261\061\103\374\244\216\027\361\155\043\253\224\146\370\255
+\373\017\010\156\046\055\177\027\007\011\262\214\373\120\300\237
+\226\215\317\266\375\000\235\132\024\232\277\002\104\365\301\302
+\237\042\136\242\017\241\343
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1"
+# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1,OU=Kamu Sertifikasyon Merkezi - Kamu SM,O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK,L=Gebze - Kocaeli,C=TR
+# Serial Number: 1 (0x1)
+# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1,OU=Kamu Sertifikasyon Merkezi - Kamu SM,O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK,L=Gebze - Kocaeli,C=TR
+# Not Valid Before: Mon Nov 25 08:25:55 2013
+# Not Valid After : Sun Oct 25 08:25:55 2043
+# Fingerprint (SHA-256): 46:ED:C3:68:90:46:D5:3A:45:3F:B3:10:4A:B8:0D:CA:EC:65:8B:26:60:EA:16:29:DD:7E:86:79:90:64:87:16
+# Fingerprint (SHA1): 31:43:64:9B:EC:CE:27:EC:ED:3A:3F:0B:8F:0D:E4:E8:91:DD:EE:CA
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\061\103\144\233\354\316\047\354\355\072\077\013\217\015\344\350
+\221\335\356\312
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\334\000\201\334\151\057\076\057\260\073\366\075\132\221\216\111
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\322\061\013\060\011\006\003\125\004\006\023\002\124\122
+\061\030\060\026\006\003\125\004\007\023\017\107\145\142\172\145
+\040\055\040\113\157\143\141\145\154\151\061\102\060\100\006\003
+\125\004\012\023\071\124\165\162\153\151\171\145\040\102\151\154
+\151\155\163\145\154\040\166\145\040\124\145\153\156\157\154\157
+\152\151\153\040\101\162\141\163\164\151\162\155\141\040\113\165
+\162\165\155\165\040\055\040\124\125\102\111\124\101\113\061\055
+\060\053\006\003\125\004\013\023\044\113\141\155\165\040\123\145
+\162\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153
+\145\172\151\040\055\040\113\141\155\165\040\123\115\061\066\060
+\064\006\003\125\004\003\023\055\124\125\102\111\124\101\113\040
+\113\141\155\165\040\123\115\040\123\123\114\040\113\157\153\040
+\123\145\162\164\151\146\151\153\141\163\151\040\055\040\123\165
+\162\165\155\040\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
diff --git a/tools/doc/html.js b/tools/doc/html.js
index f7c7b46c540e66..7f22769e633dd3 100644
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -162,13 +162,35 @@ function analyticsScript(analytics) {
`;
}
+// replace placeholders in text tokens
+function replaceInText(text) {
+ return linkJsTypeDocs(linkManPages(text));
+}
+
// handle general body-text replacements
// for example, link man page references to the actual page
function parseText(lexed) {
lexed.forEach(function(tok) {
- if (tok.text && tok.type !== 'code') {
- tok.text = linkManPages(tok.text);
- tok.text = linkJsTypeDocs(tok.text);
+ if (tok.type === 'table') {
+ if (tok.cells) {
+ tok.cells.forEach((row, x) => {
+ row.forEach((_, y) => {
+ if (tok.cells[x] && tok.cells[x][y]) {
+ tok.cells[x][y] = replaceInText(tok.cells[x][y]);
+ }
+ });
+ });
+ }
+
+ if (tok.header) {
+ tok.header.forEach((_, i) => {
+ if (tok.header[i]) {
+ tok.header[i] = replaceInText(tok.header[i]);
+ }
+ });
+ }
+ } else if (tok.text && tok.type !== 'code') {
+ tok.text = replaceInText(tok.text);
}
});
}
diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js
index 38451b0e16b358..3f1ea9597c4fbe 100644
--- a/tools/doc/type-parser.js
+++ b/tools/doc/type-parser.js
@@ -5,12 +5,13 @@ const jsDocUrl = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/' +
const jsPrimitiveUrl = 'https://developer.mozilla.org/en-US/docs/Web/' +
'JavaScript/Data_structures';
const jsPrimitives = {
- 'Integer': 'Number', // this is for extending
- 'Number': 'Number',
- 'String': 'String',
- 'Boolean': 'Boolean',
- 'Null': 'Null',
- 'Symbol': 'Symbol'
+ 'boolean': 'Boolean',
+ 'integer': 'Number', // not a primitive, used for clarification
+ 'null': 'Null',
+ 'number': 'Number',
+ 'string': 'String',
+ 'symbol': 'Symbol',
+ 'undefined': 'Undefined'
};
const jsGlobalTypes = [
'Error', 'Object', 'Function', 'Array', 'TypedArray', 'Uint8Array',
@@ -49,7 +50,16 @@ module.exports = {
typeText = typeText.trim();
if (typeText) {
let typeUrl = null;
- const primitive = jsPrimitives[typeText];
+
+ // To support type[], we store the full string and use
+ // the bracket-less version to lookup the type URL
+ const typeTextFull = typeText;
+ if (/\[]$/.test(typeText)) {
+ typeText = typeText.slice(0, -2);
+ }
+
+ const primitive = jsPrimitives[typeText.toLowerCase()];
+
if (primitive !== undefined) {
typeUrl = `${jsPrimitiveUrl}#${primitive}_type`;
} else if (jsGlobalTypes.indexOf(typeText) !== -1) {
@@ -60,9 +70,10 @@ module.exports = {
if (typeUrl) {
typeLinks.push('<' +
- typeText + '> ');
+ typeTextFull + '>');
} else {
- typeLinks.push('<' + typeText + '> ');
+ typeLinks.push('<' + typeTextFull +
+ '> ');
}
}
});
diff --git a/tools/eslint-rules/assert-fail-single-argument.js b/tools/eslint-rules/assert-fail-single-argument.js
deleted file mode 100644
index 4ce790238181cc..00000000000000
--- a/tools/eslint-rules/assert-fail-single-argument.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @fileoverview Prohibit use of a single argument only in `assert.fail()`. It
- * is almost always an error.
- * @author Rich Trott
- */
-'use strict';
-
-//------------------------------------------------------------------------------
-// Rule Definition
-//------------------------------------------------------------------------------
-
-const msg = 'assert.fail() message should be third argument';
-
-function isAssert(node) {
- return node.callee.object && node.callee.object.name === 'assert';
-}
-
-function isFail(node) {
- return node.callee.property && node.callee.property.name === 'fail';
-}
-
-module.exports = function(context) {
- return {
- 'CallExpression': function(node) {
- if (isAssert(node) && isFail(node) && node.arguments.length === 1) {
- context.report(node, msg);
- }
- }
- };
-};
diff --git a/tools/eslint-rules/new-with-error.js b/tools/eslint-rules/new-with-error.js
deleted file mode 100644
index 655f34bf080956..00000000000000
--- a/tools/eslint-rules/new-with-error.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @fileoverview Require `throw new Error()` rather than `throw Error()`
- * @author Rich Trott
- */
-'use strict';
-
-//------------------------------------------------------------------------------
-// Rule Definition
-//------------------------------------------------------------------------------
-
-module.exports = function(context) {
-
- var errorList = context.options.length !== 0 ? context.options : ['Error'];
-
- return {
- 'ThrowStatement': function(node) {
- if (node.argument.type === 'CallExpression' &&
- errorList.indexOf(node.argument.callee.name) !== -1) {
- context.report(node, 'Use new keyword when throwing.');
- }
- }
- };
-};
-
-module.exports.schema = {
- 'type': 'array',
- 'additionalItems': {
- 'type': 'string'
- },
- 'uniqueItems': true
-};
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
- };
- }
-};
diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js
index 3e4a8e8aadfc82..4a444809b7115c 100644
--- a/tools/eslint-rules/required-modules.js
+++ b/tools/eslint-rules/required-modules.js
@@ -75,15 +75,15 @@ 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) {
context.report(
node,
'Mandatory module "{{moduleName}}" must be loaded.',
{ moduleName: moduleName }
- );
+ );
});
}
}
diff --git a/tools/eslint/CHANGELOG.md b/tools/eslint/CHANGELOG.md
deleted file mode 100644
index 4f4b3bbdb3fbbc..00000000000000
--- a/tools/eslint/CHANGELOG.md
+++ /dev/null
@@ -1,3939 +0,0 @@
-v3.19.0 - March 31, 2017
-
-* e09132f Fix: no-extra-parens false positive with exports and object literals (#8359) (Teddy Katz)
-* 91baed4 Update: allow custom messages in no-restricted-syntax (fixes #8298) (#8357) (Vitor Balocco)
-* 35c93e6 Fix: prevent space-before-function-paren from checking type annotations (#8349) (Teddy Katz)
-* 3342e9f Fix: don't modify operator precedence in operator-assignment autofixer (#8358) (Teddy Katz)
-* f88375f Docs: clarify that no-unsafe-negation is in eslint:recommended (#8371) (Teddy Katz)
-* 02f0d27 Docs: Add soda0289 to Development Team (#8367) (Kai Cataldo)
-* 155424c Fix: ignore empty path in patterns (fixes #8362) (#8364) (alberto)
-* 27616a8 Fix: prefer-const false positive with object spread (fixes #8187) (#8297) (Vitor Balocco)
-* 8569a90 Docs: add note about git's linebreak handling to linebreak-style docs (#8361) (Teddy Katz)
-* 5878593 Chore: fix invalid syntax in no-param-reassign test (#8360) (Teddy Katz)
-* 1b1046b Fix: don't classify plugins that throw errors as "missing" (fixes #6874) (#8323) (Teddy Katz)
-* 29f4ba5 Fix: no-useless-computed-key invalid autofix for getters and setters (#8335) (Teddy Katz)
-* 0541eaf Fix: no-implicit-coercion invalid autofix with consecutive identifiers (#8340) (Teddy Katz)
-* 41b9786 Fix: no-extra-parens false positive with objects following arrows (#8339) (Teddy Katz)
-* 3146167 Fix: `eslint.verify` should not mutate config argument (fixes #8329) (#8334) (alberto)
-* 927de90 Fix: dot-notation autofix produces invalid syntax for integer properties (#8332) (Teddy Katz)
-* a9d1bea Fix: comma-style autofix produces errors on parenthesized elements (#8331) (Teddy Katz)
-* d52173f Fix: don't generate invalid options in config-rule (#8326) (Teddy Katz)
-* 6eda3b5 Fix: no-extra-parens invalid autofix in for-of statements (#8337) (Teddy Katz)
-* 6c819d8 Fix: dot-notation autofix produces errors on parenthesized computed keys (#8330) (Teddy Katz)
-* 2d883d7 Fix: object-shorthand autofix produces errors on parenthesized functions (#8328) (Teddy Katz)
-* cd9b774 Fix: quotes false positive with backtick option in method names (#8327) (Teddy Katz)
-* d064ba2 Fix: no-else-return false positive for ifs in single-statement position (#8338) (Teddy Katz)
-* 6a718ba Chore: enable max-statements-per-line on ESLint codebase (#8321) (Teddy Katz)
-* 614b62e Chore: update sinon calls to deprecated API. (#8310) (alberto)
-* 0491572 Chore: use precalculated counts in codeframe formatter (#8296) (Vitor Balocco)
-* 8733e6a Chore: Fix incorrect error location properties in tests (#8307) (alberto)
-* c4ffb49 Chore: Fix typos in test option assertions (#8305) (Teddy Katz)
-* 79a97cb Upgrade: devDependencies (#8303) (alberto)
-* e4da200 Upgrade: Mocha to 3.2.0 (#8299) (Ilya Volodin)
-* 2f144ca Fix: operator-assignment autofix errors with parentheses (fixes #8293) (#8294) (Teddy Katz)
-* 7521cd5 Chore: update token logic in rules to use ast-utils (#8288) (Teddy Katz)
-* 9b509ce Chore: refactor space-before-function-paren rule (#8284) (Teddy Katz)
-* ddc6350 Fix: no-param-reassign false positive on destructuring (fixes #8279) (#8281) (Teddy Katz)
-* f8176b3 Chore: improve test coverage for node-event-generator (#8287) (Teddy Katz)
-* 602e9c2 Docs: fix incorrect selector examples (#8278) (Teddy Katz)
-
-v3.18.0 - March 17, 2017
-
-* 85f74ca Fix: broken code path of direct nested loops (fixes #8248) (#8274) (Toru Nagashima)
-* a61c359 Fix: Ignore hidden folders when resolving globs (fixes #8259) (#8270) (Ian VanSchooten)
-* 6f05546 Chore: convert StubModuleResolver in config tests to ES6 class (#8265) (Teddy Katz)
-* 0c0fc31 Fix: false positive of no-extra-parens about spread and sequense (#8275) (Toru Nagashima)
-* e104973 Docs: remove self-reference in no-restricted-syntax docs (#8277) (Vitor Balocco)
-* 23eca51 Update: Add allowTaggedTemplates to no-unused-expressions (fixes #7632) (#8253) (Kevin Partington)
-* f9ede3f Upgrade: doctrine to 2.0.0 (#8269) (alberto)
-* 1b678a6 New: allow rules to listen for AST selectors (fixes #5407) (#7833) (Teddy Katz)
-* 63ca0c5 Chore: use precalculated counts in stylish formatter (#8251) (alberto)
-* 47c3171 Fix: typo in console.error (#8258) (Jan Peer Stöcklmair)
-* e74ed6d Chore: convert Traverser to ES6 class (refs #7849) (#8232) (Teddy Katz)
-* 13eead9 Fix: sort-vars crash on mixed destructuring declarations (#8245) (Teddy Katz)
-* 133f489 Fix: func-name-matching crash on destructuring assignment to functions (#8247) (Teddy Katz)
-* a34b9c4 Fix: func-name-matching crash on non-string literal computed keys (#8246) (Teddy Katz)
-* 7276e6d Docs: remove unneeded semicolons in arrow-parens.md (#8249) (Dmitry Gershun)
-* 8c40a25 concat-stream known to be vulnerable prior 1.5.2 (#8228) (Samuel)
-* 149c055 Upgrade: mock-fs to v4.2.0 (fixes #8194) (#8243) (Teddy Katz)
-* a83bff9 Build: remove unneeded json config in demo (fixes #8237) (#8242) (alberto)
-* df12137 Docs: fix typos (#8235) (Gyandeep Singh)
-* b5e9788 Chore: rename no-extra-parens methods (#8225) (Vitor Balocco)
-* 7f8afe6 Update: no-extra-parens overlooked spread and superClass (fixes #8175) (#8209) (Toru Nagashima)
-* ce6ff56 Docs: set recommended true for no-global-assign (fixes #8215) (#8218) (BinYi LIU)
-* 5b5c236 Fix: wrong comment when module not found in config (fixes #8192) (#8196) (alberto)
-
-v3.17.1 - March 6, 2017
-
-* f8c8e6e Build: change mock-fs path without SSH (fixes #8207) (#8208) (Toru Nagashima)
-* f713f11 Fix: nonblock-statement-body-position multiline error (fixes #8202) (#8203) (Teddy Katz)
-* 41e3d9c Fix: `operator-assignment` with parenthesized expression (fixes #8190) (#8197) (alberto)
-* 5e3bca7 Chore: add eslint-plugin-eslint-plugin (#8198) (Teddy Katz)
-* 580da36 Chore: add missing `output` property to tests (#8195) (alberto)
-
-v3.17.0 - March 3, 2017
-
-* 4fdf6d7 Update: deprecate `applyDefaultPatterns` in `line-comment-position` (#8183) (alberto)
-* 25e5817 Fix: Don't autofix `+ +a` to `++a` in space-unary-ops (#8176) (Alan Pierce)
-* a6ce8f9 Build: Sort rules before dumping them to doc files (#8154) (Danny Andrews)
-* 0af9057 Chore: Upgrade to a patched version of mock-fs (fixes #8177) (#8188) (Teddy Katz)
-* bf4d8cf Update: ignore eslint comments in lines-arount-comment (fixes #4345) (#8155) (alberto)
-* dad20ad New: add SourceCode#getLocFromIndex and #getIndexFromLoc (fixes #8073) (#8158) (Teddy Katz)
-* 18a519f Update: let RuleTester cases assert that no autofix occurs (fixes #8157) (#8163) (Teddy Katz)
-* a30eb8d Docs: improve documentation for RuleTester cases (#8162) (Teddy Katz)
-* a78ec9f Chore: upgrade `coveralls` to ^2.11.16 (#8161) (alberto)
-* d02bd11 Fix: padded-blocks autofix problems with comments (#8149) (alberto)
-* 9994889 Docs: Add missing space to `create` in `no-use-before-define` (#8166) (Justin Anastos)
-* 4d542ba Docs: Remove unneeded statement about autofix (#8164) (alberto)
-* 20daea5 New: no-compare-neg-zero rule (#8091) (薛定谔的猫)
-* 4d35a81 Fix: Add a utility to avoid autofix conflicts (fixes #7928, fixes #8026) (#8067) (Alan Pierce)
-* 287e882 New: nonblock-statement-body-position rule (fixes #6067) (#8108) (Teddy Katz)
-* 7f1f4e5 Chore: remove unneeded devDeps `linefix` and `gh-got` (#8160) (alberto)
-* ca1694b Update: ignore negative ranges in fixes (#8133) (alberto)
-* 163d751 Docs: `lines-around-comment` doesn't disallow empty lines (#8151) (alberto)
-* 1c84922 Chore: upgrade eslint-plugin-node (#8156) (alberto)
-* 1ee5c27 Fix: Make RuleTester handle empty-string cases gracefully (fixes #8142) (#8143) (Teddy Katz)
-* 044bc10 Docs: Add details about "--fix" option for "sort-imports" rule (#8077) (Olivier Audard)
-* 3fec54a Add option to ignore property in no-param-reassign (#8087) (Christian Bundy)
-* 4e52cfc Fix: Improve keyword-spacing typescript support (fixes #8110) (#8111) (Reyad Attiyat)
-* 7ff42e8 New: Allow regexes in RuleTester (fixes #7837) (#8115) (Daniel Lo Nigro)
-* cbd7ded Build: display rules’ meta data in their docs (fixes #5774) (#8127) (Wilson Kurniawan)
-* da8e8af Update: include function name in report message if possible (fixes #7260) (#8058) (Dieter Luypaert)
-* 8f91e32 Fix: `ignoreRestSiblings` option didn't cover arguments (fixes #8119) (#8120) (Toru Nagashima)
-
-v3.16.1 - February 22, 2017
-
-* ff8a80c Fix: duplicated autofix output for inverted fix ranges (fixes #8116) (#8117) (Teddy Katz)
-* a421897 Docs: fix typo in arrow-parens.md (#8132) (Will Chen)
-* 22d7fbf Chore: fix invalid redeclared variables in tests (#8130) (Teddy Katz)
-* 8d95598 Chore: fix output assertion typos in rule tests (#8129) (Teddy Katz)
-* 9fa2559 Docs: Add missing quotes in key-spacing rule (#8121) (Glenn Reyes)
-* f3a6ced Build: package.json update for eslint-config-eslint release (ESLint Jenkins)
-
-v3.16.0 - February 20, 2017
-
-* d89d0b4 Update: fix quotes false negative for string literals as template tags (#8107) (Teddy Katz)
-* 21be366 Chore: Ensuring eslint:recommended rules are sorted. (#8106) (Kevin Partington)
-* 360dbe4 Update: Improve error message when extend config missing (fixes #6115) (#8100) (alberto)
-* f62a724 Chore: use updated token iterator methods (#8103) (Kai Cataldo)
-* daf6f26 Fix: check output in RuleTester when errors is a number (fixes #7640) (#8097) (alberto)
-* cfb65c5 Update: make no-lone-blocks report blocks in switch cases (fixes #8047) (#8062) (Teddy Katz)
-* 290fb1f Update: Add includeComments to getTokenByRangeStart (fixes #8068) (#8069) (Kai Cataldo)
-* ff066dc Chore: Incorrect source code test text (#8096) (Jack Ford)
-* 14d146d Docs: Clarify --ext only works with directories (fixes #7939) (#8095) (alberto)
-* 013a454 Docs: Add TSC meeting quorum requirement (#8086) (Kevin Partington)
-* 7516303 Fix: `sourceCode.getTokenAfter` shouldn't skip tokens after comments (#8055) (Toru Nagashima)
-* c53e034 Fix: unicode-bom fixer insert BOM in appropriate location (fixes #8083) (#8084) (pantosha)
-* 55ac302 Chore: fix the timing to define rules for tests (#8082) (Toru Nagashima)
-* c7e64f3 Upgrade: mock-fs (#8070) (Toru Nagashima)
-* acc3301 Update: handle uncommon linebreaks consistently in rules (fixes #7949) (#8049) (Teddy Katz)
-* 591b74a Chore: enable operator-linebreak on ESLint codebase (#8064) (Teddy Katz)
-* 6445d2a Docs: Add documentation for /* exported */ (fixes #7998) (#8065) (Lee Yi Min)
-* fcc38db Chore: simplify and improve performance for autofix (#8035) (Toru Nagashima)
-* b04fde7 Chore: improve performance of SourceCode constructor (#8054) (Teddy Katz)
-* 90fd555 Update: improve null detection in eqeqeq for ES6 regexes (fixes #8020) (#8042) (Teddy Katz)
-* 16248e2 Fix: no-extra-boolean-cast incorrect Boolean() autofixing (fixes #7977) (#8037) (Jonathan Wilsson)
-* 834f45d Update: rewrite TokenStore (fixes #7810) (#7936) (Toru Nagashima)
-* 329dcdc Chore: unify checks for statement list parents (#8048) (Teddy Katz)
-* c596690 Docs: Clarify generator-star-spacing config example (fixes #8027) (#8034) (Hòa Trần)
-* a11d4a6 Docs: fix a typo in shareable configs documentation (#8036) (Dan Homola)
-* 1e3d4c6 Update: add fixer for no-unused-labels (#7841) (Teddy Katz)
-* f47fb98 Update: ensure semi-spacing checks import/export declarations (#8033) (Teddy Katz)
-* e228d56 Update: no-undefined handles properties/classes/modules (fixes #7964) (#7966) (Kevin Partington)
-* 7bc92d9 Chore: fix invalid test cases (#8030) (Toru Nagashima)
-
-v3.15.0 - February 3, 2017
-
-* f2a3580 Fix: `no-extra-parens` incorrect precedence (fixes #7978) (#7999) (alberto)
-* d6b6ba1 Fix: no-var should fix ForStatement.init (#7993) (Toru Nagashima)
-* 99d386d Upgrade: Espree v3.4.0 (#8019) (Kai Cataldo)
-* 42390fd Docs: update README.md for team (#8016) (Toru Nagashima)
-* d7ffd88 Chore: enable template-tag-spacing on ESLint codebase (#8005) (Teddy Katz)
-* f2be7e3 Docs: Fix typo in object-curly-newline.md (#8002) (Danny Andrews)
-* df2351a Docs: Fix misleading section in brace-style documentation (#7996) (Teddy Katz)
-* 5ae6e00 Chore: avoid unnecessary feature detection for Symbol (#7992) (Teddy Katz)
-* 5d57c57 Chore: fix no-else-return lint error (refs #7986) (#7994) (Vitor Balocco)
-* 62fb054 Chore: enable no-else-return on ESLint codebase (#7986) (Teddy Katz)
-* c59a0ba Update: add ignoreRestSiblings option to no-unused-vars (#7968) (Zack Argyle)
-* 5cdfa99 Chore: enable no-unneeded-ternary on ESLint codebase (#7987) (Teddy Katz)
-* fbd7c13 Update: ensure operator-assignment handles exponentiation operators (#7970) (Teddy Katz)
-* c5066ce Update: add "variables" option to no-use-before-define (fixes #7111) (#7948) (Teddy Katz)
-* 09546a4 New: `template-tag-spacing` rule (fixes #7631) (#7913) (Jonathan Wilsson)
-
-v3.14.1 - January 25, 2017
-
-* 791f32b Fix: brace-style false positive for keyword method names (fixes #7974) (#7980) (Teddy Katz)
-* d7a0add Docs: Add ESLint tutorial embed to getting started (#7971) (Jamis Charles)
-* 72d41f0 Fix: no-var autofix syntax error in single-line statements (fixes #7961) (#7962) (Teddy Katz)
-* b9e5b68 Fix: indent rule crash on sparse array with object (fixes #7959) (#7960) (Gyandeep Singh)
-* a7bd66a Chore: Adding assign/redeclare tests to no-undefined (refs #7964) (#7965) (Kevin Partington)
-* 8bcbf5d Docs: typo in prefer-promise-reject-errors (#7958) (Patrick McElhaney)
-
-v3.14.0 - January 20, 2017
-
-* 506324a Fix: `no-var` does not fix if causes ReferenceError (fixes #7950) (#7953) (Toru Nagashima)
-* 05e7432 New: no-chained-assignments rule (fixes #6424) (#7904) (Stewart Rand)
-* 243e47d Update: Add fixer for no-else-return (fixes #7863) (#7864) (Xander Dumaine)
-* f091d95 New: `prefer-promise-reject-errors` rule (fixes #7685) (#7689) (Teddy Katz)
-* ca01e00 Fix: recognize all line terminators in func-call-spacing (fixes #7923) (#7924) (Francesco Trotta)
-* a664e8a Update: add ignoreJSX option to no-extra-parens (Fixes #7444) (#7926) (Robert Rossmann)
-* 8ac3518 Fix: no-useless-computed-key false positive with `__proto__` (#7934) (Teddy Katz)
-* c835e19 Docs: remove reference to deleted rule (#7942) (Alejandro Oviedo)
-* 3c1e63b Docs: Improve examples for no-case-declarations (fixes #6716) (#7920) (Kevin Rangel)
-* 7e04b33 Fix: Ignore inline plugin rule config in autoconfig (fixes #7860) (#7919) (Ian VanSchooten)
-* 6448ba0 Fix: add parentheses in no-extra-boolean-cast autofixer (fixes #7912) (#7914) (Szymon Przybylski)
-* b3f2094 Fix: brace-style crash with lone block statements (fixes #7908) (#7909) (Teddy Katz)
-* 5eb2e88 Docs: Correct typos in configuring.md (#7916) (Gabriel Delépine)
-* bd5e219 Update: ensure brace-style validates class bodies (fixes #7608) (#7871) (Teddy Katz)
-* 427543a Fix: catastrophic backtracking in astUtils linebreak regex (fixes #7893) (#7898) (Teddy Katz)
-* 995554c Fix: Correct typos in no-alert.md and lib/ast-utils.js (#7905) (Stewart Rand)
-* d6150e3 Chore: Enable comma-dangle on ESLint codebase (fixes #7725) (#7906) (Teddy Katz)
-* 075ec25 Chore: update to use ES6 classes (refs #7849) (#7891) (Claire Dranginis)
-* 55f0cb6 Update: refactor brace-style and fix inconsistencies (fixes #7869) (#7870) (Teddy Katz)
-
-v3.13.1 - January 9, 2017
-
-* 3fc4e3f Fix: prefer-destructuring reporting compound assignments (fixes #7881) (#7882) (Teddy Katz)
-* f90462e Fix: no-extra-label autofix should not remove labels used elsewhere (#7885) (Teddy Katz)
-
-v3.13.0 - January 6, 2017
-
-* cd4c025 Update: add fixer for no-extra-label (#7840) (Teddy Katz)
-* aa75c92 Fix: Ensure prefer-const fixes destructuring assignments (fixes #7852) (#7859) (Teddy Katz)
-* 4008022 Chore: Refactor to use ES6 Classes (Part 3)(refs #7849) (#7865) (Gyandeep Singh)
-* c9ba40a Update: add fixer for `no-unneeded-ternary` (#7540) (Teddy Katz)
-* dd56d87 Update: add object-shorthand option for arrow functions (fixes #7564) (#7746) (Teddy Katz)
-* fbafdc0 Docs: `padded-blocks` `never` case (fixes #7868) (#7878) (alberto)
-* ca1f841 Fix: no-useless-return stack overflow on loops after throw (fixes #7855) (#7856) (Teddy Katz)
-* d80d994 Update: add fixer for object-property-newline (fixes #7740) (#7808) (Teddy Katz)
-* bf3ea3a Fix: capitalized-comments: Ignore consec. comments if first is invalid (#7835) (Kevin Partington)
-* 616611a Chore: Refactor to use ES6 Classes (Part 2)(refs #7849) (#7847) (Gyandeep Singh)
-* 856084b Chore: Refactor to use ES6 Classes (Part 1)(refs #7849) (#7846) (Gyandeep Singh)
-* bf45893 Docs: Clarify that we only support Stage 4 proposals (#7845) (Kevin Partington)
-* 0fc24f7 Fix: adapt new-paren rule so it handles TypeScript (fixes #7817) (#7820) (Philipp A)
-* df0b06b Fix: no-multiple-empty-lines perf issue on large files (fixes #7803) (#7843) (Teddy Katz)
-* 18fa521 Chore: use ast-utils helper functions in no-multiple-empty-lines (#7842) (Teddy Katz)
-* 7122205 Docs: Array destructuring example for no-unused-vars (fixes #7838) (#7839) (Remco Haszing)
-* e21b36b Chore: add integration tests for cache files (refs #7748) (#7794) (Teddy Katz)
-* 2322733 Fix: Throw error if ruletester is missing required test scenarios (#7388) (Teddy Katz)
-* 1beecec Update: add fixer for `operator-linebreak` (#7702) (Teddy Katz)
-* c5c3b21 Fix: no-implied-eval false positive on 'setTimeoutFoo' (fixes #7821) (#7836) (Teddy Katz)
-* 00dd96c Chore: enable array-bracket-spacing on ESLint codebase (#7830) (Teddy Katz)
-* ebcae1f Update: no-return-await with with complex `return` argument (fixes #7594) (#7595) (Dalton Santos)
-* fd4cd3b Fix: Disable no-var autofixer in some incorrect cases in loops (#7811) (Alan Pierce)
-* 1f25834 Docs: update outdated info in Architecture page (#7816) (Teddy Katz)
-* f20b9e9 Fix: Relax no-useless-escape's handling of ']' in regexes (fixes #7789) (#7793) (Teddy Katz)
-* 3004c1e Fix: consistent-return shouldn't report class constructors (fixes #7790) (#7797) (Teddy Katz)
-* b938f1f Docs: Add an example for the spread operator to prefer-spread.md (#7802) (#7804) (butlermd)
-* b8ce2dc Docs: Remove .html extensions from links in developer-guide (#7805) (Kevin Partington)
-* aafebb2 Docs: Wrap placeholder sample in {% raw %} (#7798) (Daniel Lo Nigro)
-* bb6b73b Chore: replace unnecessary function callbacks with arrow functions (#7795) (Teddy Katz)
-* 428fbdf Fix: func-call-spacing "never" doesn't fix w/ line breaks (fixes #7787) (#7788) (Kevin Partington)
-* 6e61070 Fix: `semi` false positive before regex/template literals (fixes #7782) (#7783) (Teddy Katz)
-* ff0c050 Fix: remove internal property from config generation (fixes #7758) (#7761) (alberto)
-* 27424cb New: `prefer-destructuring` rule (fixes #6053) (#7741) (Alex LaFroscia)
-* bb648ce Docs: fix unclear example for no-useless-escape (#7781) (Teddy Katz)
-* 8c3a962 Fix: syntax errors from object-shorthand autofix (fixes #7744) (#7745) (Teddy Katz)
-* 8b296a2 Docs: fix in semi.md: correct instead of incorrect (#7779) (German Prostakov)
-* 3493241 Upgrade: strip-json-comments ~v2.0.1 (Janus Troelsen)
-* 75b7ba4 Chore: enable object-curly-spacing on ESLint codebase (refs #7725) (#7770) (Teddy Katz)
-* 7d1dc7e Update: Make default-case comment case-insensitive (fixes #7673) (#7742) (Robert Rossmann)
-* f1bf5ec Chore: convert remaining old-style context.report() calls to the new API (#7763) (Teddy Katz)
-
-v3.12.2 - December 14, 2016
-
-* dec3ec6 Fix: indent bug with AssignmentExpressions (fixes #7747) (#7750) (Teddy Katz)
-* 5344751 Build: Don't create blogpost links from rule names within other words (#7754) (Teddy Katz)
-* 639b798 Docs: Use `Object.prototype` in examples (#7755) (Alex Reardon)
-
-v3.12.1 - December 12, 2016
-
-* 0ad4d33 Fix: `indent` regression with function calls (fixes #7732, fixes #7733) (#7734) (Teddy Katz)
-* ab246dd Docs: Rules restricting globals/properties/syntax are linked together (#7743) (Kevin Partington)
-* df2f115 Docs: Add eslint-config-mdcs to JSCS Migration Guide (#7737) (Joshua Koo)
-* 4b77333 Build: avoid creating broken rule links in the changelog (#7731) (Teddy Katz)
-
-v3.12.0 - December 9, 2016
-
-* e569225 Update: fix false positive/negative of yoda rule (fixes #7676) (#7695) (Toru Nagashima)
-* e95a230 Fix: indent "first" option false positive on nested arrays (fixes #7727) (#7728) (Teddy Katz)
-* 81f9e7d Fix: Allow duplicated let declarations in `prefer-const` (fixes #7712) (#7717) (Teddy Katz)
-* 1d0d61d New: Add no-await-in-loop rule (#7563) (Nat Mote)
-* 2cdfb4e New: Additional APIs (fixes #6256) (#7669) (Ilya Volodin)
-* 4278c42 Update: make no-obj-calls report errors for Reflect (fixes #7700) (#7710) (Tomas Echeverri Valencia)
-* 4742d82 Docs: clarify the default behavior of `operator-linebreak` (fixes #7459) (#7726) (Teddy Katz)
-* a8489e2 Chore: Avoid parserOptions boilerplate in tests for ES6 rules (#7724) (Teddy Katz)
-* b921d1f Update: add `indent` options for array and object literals (fixes #7473) (#7681) (Teddy Katz)
-* 7079c89 Update: Add airbnb-base to init styleguides (fixes #6986) (#7699) (alberto)
-* 63bb3f8 Docs: improve the documentation for the autofix API (#7716) (Teddy Katz)
-* f8786fb Update: add fixer for `capitalized-comments` (#7701) (Teddy Katz)
-* abfd24f Fix: don't validate schemas for disabled rules (fixes #7690) (#7692) (Teddy Katz)
-* 2ac07d8 Upgrade: Update globals dependency to 9.14.0 (#7683) (Aleksandr Oleynikov)
-* 90a5d29 Docs: Remove incorrect info about issue requirements from PR guide (#7691) (Teddy Katz)
-* f80c278 Docs: Add sails-hook-lint to integrations list (#7679) (Anthony M)
-* e96da3f Docs: link first instance of `package.json` (#7684) (Kent C. Dodds)
-* bf20e20 Build: include links to rule pages in release blogpost (#7671) (Teddy Katz)
-* b30116c Docs: Fix code-blocks in spaced-comment docs (#7524) (Michał Gołębiowski)
-* 0a2a7fd Fix: Allow \u2028 and \u2029 as string escapes in no-useless-escape (#7672) (Teddy Katz)
-* 76c33a9 Docs: Change Sails.js integration to active npm package (#7675) (Anthony M)
-
-v3.11.1 - November 28, 2016
-
-* be739d0 Fix: capitalized-comments fatal error fixed (fixes #7663) (#7664) (Rich Trott)
-* cc4cedc Docs: Fix a typo in array-bracket-spacing documentation (#7667) (Alex Guerrero)
-* f8adadc Docs: fix a typo in capitalized-comments documentation (#7666) (Teddy Katz)
-
-v3.11.0 - November 25, 2016
-
-* ad56694 New: capitalized-comments rule (fixes #6055) (#7415) (Kevin Partington)
-* 7185567 Update: add fixer for `operator-assignment` (#7517) (Teddy Katz)
-* faf5f56 Update: fix false negative of `quotes` with \n in template (fixes #7646) (#7647) (Teddy Katz)
-* 474e444 Update: add fixer for `sort-imports` (#7535) (Teddy Katz)
-* f9b70b3 Docs: Enable example highlighting in rules examples (ref #6444) (#7644) (Alex Guerrero)
-* d50f6c1 Fix: incorrect location for `no-useless-escape` errors (fixes #7643) (#7645) (Teddy Katz)
-* 54a993c Docs: Fix a typo in the require-yield.md (#7652) (Vse Mozhet Byt)
-* eadd808 Chore: Fix prefer-arrow-callback lint errors (#7651) (Kevin Partington)
-* 89bd8de New: `require-await` rule (fixes #6820) (#7435) (Toru Nagashima)
-* b7432bd Chore: Ensure JS files are checked out with LF (#7624) (Kevin Partington)
-* 32a3547 Docs: Add absent quotes in rules documentation (#7625) (Denis Sikuler)
-* 5c9a4ad Fix: Prevent `quotes` from fixing templates to directives (fixes #7610) (#7617) (Teddy Katz)
-* d90ca46 Upgrade: Update markdownlint dependency to 0.3.1 (fixes #7589) (#7592) (David Anson)
-* 07124d1 Docs: add missing quote mark (+=" → "+=") (#7613) (Sean Juarez)
-* 8998043 Docs: fix wording in docs for no-extra-parens config (Michael Ficarra)
-
-v3.10.2 - November 15, 2016
-
-* 0643bfe Fix: correctly handle commented code in `indent` autofixer (fixes #7604) (#7606) (Teddy Katz)
-* bd0514c Fix: syntax error after `key-spacing` autofix with comment (fixes #7603) (#7607) (Teddy Katz)
-* f56c1ef Fix: `indent` crash on parenthesized global return values (fixes #7573) (#7596) (Teddy Katz)
-* 100c6e1 Docs: Fix example for curly "multi-or-nest" option (#7597) (Will Chen)
-* 6abb534 Docs: Update code of conduct link (#7599) (Nicholas C. Zakas)
-* 8302cdb Docs: Update no-tabs to match existing standards & improve readbility (#7590) (Matt Stow)
-
-v3.10.1 - November 14, 2016
-
-* 8a0e92a Fix: handle try/catch correctly in `no-return-await` (fixes #7581) (#7582) (Teddy Katz)
-* c4dd015 Fix: no-useless-return stack overflow on unreachable loops (fixes #7583) (#7584) (Teddy Katz)
-
-v3.10.0 - November 11, 2016
-
-* 7ee039b Update: Add comma-style options for calls, fns, imports (fixes #7470) (Max Englander)
-* 670e060 Chore: make the `object-shorthand` tests more readable (#7580) (Teddy Katz)
-* c3f4809 Update: Allow `func-names` to recognize inferred ES6 names (fixes #7235) (#7244) (Logan Smyth)
-* b8d6e48 Fix: syntax errors created by `object-shorthand` autofix (fixes #7574) (#7575) (Teddy Katz)
-* 1b3b65c Chore: ensure that files in tests/conf are linted (#7579) (Teddy Katz)
-* 2bd1dd7 Update: avoid creating extra whitespace in `arrow-body-style` fixer (#7504) (Teddy Katz)
-* 66fe9ff New: `no-return-await` rule. (fixes #7537) (#7547) (Jordan Harband)
-* 759525e Chore: Use process.exitCode instead of process.exit() in bin/eslint.js (#7569) (Teddy Katz)
-* 0d60db7 Fix: Curly rule doesn't account for leading comment (fixes #7538) (#7539) (Will Chen)
-* 5003b1c Update: fix in/instanceof handling with `space-infix-ops` (fixes #7525) (#7552) (Teddy Katz)
-* 3e6131e Docs: explain config option merging (#7499) (Danny Andrews)
-* 1766524 Update: "Error type should be" assertion in rule-tester (fixes 6106) (#7550) (Frans Jaspers)
-* 44eb274 Docs: Missing semicolon report was missing a comma (#7553) (James)
-* 6dbda15 Docs: Document the optional defaults argument for RuleTester (#7548) (Teddy Katz)
-* e117b80 Docs: typo fix (#7546) (oprogramador)
-* 25e5613 Chore: Remove incorrect test from indent.js. (#7531) (Scott Stern)
-* c0f4937 Fix: `arrow-parens` supports type annotations (fixes #7406) (#7436) (Toru Nagashima)
-* a838b8e Docs: `func-name-matching`: update with “always”/“never” option (#7536) (Jordan Harband)
-* 3c379ff Update: `no-restricted-{imports,modules}`: add “patterns” (fixes #6963) (#7433) (Jordan Harband)
-* f5764ee Docs: Update example of results returned from `executeOnFiles` (#7362) (Simen Bekkhus)
-* 4613ba0 Fix: Add support for escape char in JSX. (#7461) (Scott Stern)
-* ea0970d Fix: `curly` false positive with no-semicolon style (#7509) (Teddy Katz)
-* af1fde1 Update: fix `brace-style` false negative on multiline node (fixes #7493) (#7496) (Teddy Katz)
-* 3798aea Update: max-statements to report function name (refs #7260) (#7399) (Nicholas C. Zakas)
-* 0c215fa Update: Add `ArrowFunctionExpression` support to `require-jsdoc` rule (#7518) (Gyandeep Singh)
-* 578c373 Build: handle deprecated rules with no 'replacedBy' (refs #7471) (#7494) (Vitor Balocco)
-* a7f3976 Docs: Specify min ESLint version for new rule format (#7501) (cowchimp)
-* 8a3e717 Update: Fix `lines-around-directive` semicolon handling (fixes #7450) (#7483) (Teddy Katz)
-* e58cead Update: add a fixer for certain statically-verifiable `eqeqeq` cases (#7389) (Teddy Katz)
-* 0dea0ac Chore: Add Node 7 to travis ci build (#7506) (Gyandeep Singh)
-* 36338f0 Update: add fixer for `no-extra-boolean-cast` (#7387) (Teddy Katz)
-* 183def6 Chore: enable `prefer-arrow-callback` on ESLint codebase (fixes #6407) (#7503) (Teddy Katz)
-* 4f1fa67 Docs: Update copyright (#7497) (Nicholas C. Zakas)
-
-v3.9.1 - October 31, 2016
-
-* 2012258 Fix: incorrect `indent` check for array property access (fixes #7484) (#7485) (Teddy Katz)
-* 8a71d4a Fix: `no-useless-return` false positive on conditionals (fixes #7477) (#7482) (Teddy Katz)
-* 56a662b Fix: allow escaped backreferences in `no-useless-escape` (fixes #7472) (#7474) (Teddy Katz)
-* fffdf13 Build: Fix prefer-reflect rule to not crash site gen build (#7471) (Ilya Volodin)
-* 8ba68a3 Docs: Update broken link (#7490) (Devinsuit)
-* 65231d8 Docs: add the "fixable" icon for `no-useless-return` (#7480) (Teddy Katz)
-
-v3.9.0 - October 28, 2016
-
-* d933516 New: `no-useless-return` rule (fixes #7309) (#7441) (Toru Nagashima)
-* 5e7af30 Update: Add `CallExpression` option for `indent` (fixes #5946) (#7189) (Teddy Katz)
-* b200086 Fix: Support type annotations in array-bracket-spacing (#7445) (Jimmy Jia)
-* 5ed8b9b Update: Deprecate prefer-reflect (fixes #7226) (#7464) (Kai Cataldo)
-* 92ad43b Chore: Update deprecated rules in conf/eslint.json (#7467) (Kai Cataldo)
-* e46666b New: Codeframe formatter (fixes #5860) (#7437) (Vitor Balocco)
-* fe0d903 Upgrade: Shelljs to ^0.7.5 (fixes #7316) (#7465) (Gyandeep Singh)
-* 1d5146f Update: fix wrong indentation about `catch`,`finally` (#7371) (Toru Nagashima)
-* 77e3a34 Chore: Pin mock-fs dev dependency (#7466) (Gyandeep Singh)
-* c675d7d Update: Fix `no-useless-escape` false negative in regexes (fixes #7424) (#7425) (Teddy Katz)
-* ee3bcea Update: add fixer for `newline-after-var` (fixes #5959) (#7375) (Teddy Katz)
-* 6e9ff08 Fix: indent.js to support multiline array statements. (#7237) (Scott Stern)
-* f8153ad Build: Ensure absolute links in docs retain .md extensions (fixes #7419) (#7438) (Teddy Katz)
-* 16367a8 Fix: Return statement spacing. Fix for indent rule. (fixes #7164) (#7197) (Imad Elyafi)
-* 3813988 Update: fix false negative of `no-extra-parens` (fixes #7122) (#7432) (Toru Nagashima)
-* 23062e2 Docs: Fix typo in no-unexpected-multiline (fixes #7442) (#7447) (Denis Sikuler)
-* d257428 Update: `func-name-matching`: add “always”/“never” option (fixes #7391) (#7428) (Jordan Harband)
-* c710584 Fix: support for MemberExpression with function body. (#7400) (Scott Stern)
-* 2c8ed2d Build: ensure that all files are linted on bash (fixes #7426) (#7427) (Teddy Katz)
-* 18ff70f Chore: Enable `no-useless-escape` (#7403) (Vitor Balocco)
-* 8dfd802 Fix: avoid `camelcase` false positive with NewExpressions (fixes #7363) (#7409) (Teddy Katz)
-* e8159b4 Docs: Fix typo and explain static func calls for class-methods-use-this (#7421) (Scott O'Hara)
-* 85d7e24 Docs: add additional examples for MemberExpressions in Indent rule. (#7408) (Scott Stern)
-* 2aa1107 Docs: Include note on fatal: true in the node.js api section (#7376) (Simen Bekkhus)
-* e064a25 Update: add fixer for `arrow-body-style` (#7240) (Teddy Katz)
-* e0fe727 Update: add fixer for `brace-style` (fixes #7074) (#7347) (Teddy Katz)
-* cbbe420 New: Support enhanced parsers (fixes #6974) (#6975) (Nicholas C. Zakas)
-* 644d25b Update: Add an ignoreRegExpLiterals option to max-len (fixes #3229) (#7346) (Wilfred Hughes)
-* 6875576 Docs: Remove broken links to jslinterrors.com (fixes #7368) (#7369) (Dannii Willis)
-
-v3.8.1 - October 17, 2016
-
-* 681c78a Fix: `comma-dangle` was confused by type annotations (fixes #7370) (#7372) (Toru Nagashima)
-* 7525042 Fix: Allow useless escapes in tagged template literals (fixes #7383) (#7384) (Teddy Katz)
-* 9106964 Docs: Fix broken link for stylish formatter (#7386) (Vitor Balocco)
-* 49d3c1b Docs: Document the deprecated meta property (#7367) (Randy Coulman)
-* 19d2996 Docs: Relax permission for merging PRs (refs eslint/tsc-meetings#20) (#7360) (Brandon Mills)
-
-v3.8.0 - October 14, 2016
-
-* ee60acf Chore: add integration tests for autofixing (fixes #5909) (#7349) (Teddy Katz)
-* c8796e9 Update: `comma-dangle` supports trailing function commas (refs #7101) (#7181) (Toru Nagashima)
-* c4abaf0 Update: `space-before-function-paren` supports async/await (refs #7101) (#7180) (Toru Nagashima)
-* d0d3b28 Fix: id-length rule incorrectly firing on member access (fixes #6475) (#7365) (Burak Yiğit Kaya)
-* 2729d94 Fix: Don't report setter params in class bodies as unused (fixes #7351) (#7352) (Teddy Katz)
-* 0b85004 Chore: Enable prefer-template (fixes #6407) (#7357) (Kai Cataldo)
-* ca1947b Chore: Update pull request template (refs eslint/tsc-meetings#20) (#7359) (Brandon Mills)
-* d840afe Docs: remove broken link from no-loop-func doc (#7342) (Michael McDermott)
-* 5266793 Update: no-useless-escape checks template literals (fixes #7331) (#7332) (Kai Cataldo)
-* b08fb91 Update: add source property to LintResult object (fixes #7098) (#7304) (Vitor Balocco)
-* 0db4164 Chore: run prefer-template autofixer on test files (refs #6407) (#7354) (Kai Cataldo)
-* c1470b5 Update: Make the `prefer-template` fixer unescape quotes (fixes #7330) (#7334) (Teddy Katz)
-* 5d08c33 Fix: Handle parentheses correctly in `yoda` fixer (fixes #7326) (#7327) (Teddy Katz)
-* cd72bba New: `func-name-matching` rule (fixes #6065) (#7063) (Annie Zhang)
-* 55b5146 Fix: `RuleTester` didn't support `mocha --watch` (#7287) (Toru Nagashima)
-* f8387c1 Update: add fixer for `prefer-spread` (#7283) (Teddy Katz)
-* 52da71e Fix: Don't require commas after rest properties (fixes #7297) (#7298) (Teddy Katz)
-* 3b11d3f Chore: refactor `no-multiple-empty-lines` (#7314) (Teddy Katz)
-* 16d495d Docs: Updating CLI overview with latest changes (#7335) (Kevin Partington)
-* 52dfce5 Update: add fixer for `one-var-declaration-per-line` (#7295) (Teddy Katz)
-* 0e994ae Update: Improve the error messages for `no-unused-vars` (fixes #7282) (#7315) (Teddy Katz)
-* 93214aa Chore: Convert non-lib/test files to template literals (refs #6407) (#7329) (Kai Cataldo)
-* 72f394d Update: Fix false negative of `no-multiple-empty-lines` (fixes #7312) (#7313) (Teddy Katz)
-* 756bc5a Update: Use characters instead of code units for `max-len` (#7299) (Teddy Katz)
-* c9a7ec5 Fix: Improving optionator configuration for --print-config (#7206) (Kevin Partington)
-* 51bfade Fix: avoid `object-shorthand` crash with spread properties (fixes #7305) (#7306) (Teddy Katz)
-* a12d1a9 Update: add fixer for `no-lonely-if` (#7202) (Teddy Katz)
-* 1418384 Fix: Don't require semicolons before `++`/`--` (#7252) (Adrian Heine né Lang)
-* 2ffe516 Update: add fixer for `curly` (#7105) (Teddy Katz)
-* ac3504d Update: add functionPrototypeMethods to wrap-iife (fixes #7212) (#7284) (Eli White)
-* 5e16fb4 Update: add fixer for `no-extra-bind` (#7236) (Teddy Katz)
-
-v3.7.1 - October 3, 2016
-
-* 3dcae13 Fix: Use the correct location for `comma-dangle` errors (fixes #7291) (#7292) (Teddy Katz)
-* cb7ba6d Fix: no-implicit-coercion should not fix ~. (fixes #7272) (#7289) (Eli White)
-* ce590e2 Chore: Add additional tests for bin/eslint.js (#7290) (Teddy Katz)
-* 8ec82ee Docs: change links of templates to raw data (#7288) (Toru Nagashima)
-
-v3.7.0 - September 30, 2016
-
-* 2fee8ad Fix: object-shorthand's consistent-as-needed option (issue #7214) (#7215) (Naomi Jacobs)
-* c05a19c Update: add fixer for `prefer-numeric-literals` (#7205) (Teddy Katz)
-* 2f171f3 Update: add fixer for `no-undef-init` (#7210) (Teddy Katz)
-* 876d747 Docs: Steps for adding new committers/TSCers (#7221) (Nicholas C. Zakas)
-* dffb4fa Fix: `no-unused-vars` false positive (fixes #7250) (#7258) (Toru Nagashima)
-* 4448cec Docs: Adding missing ES8 reference to configuring (#7271) (Kevin Partington)
-* 332d213 Update: Ensure `indent` handles nested functions correctly (fixes #7249) (#7265) (Teddy Katz)
-* c36d842 Update: add fixer for `no-useless-computed-key` (#7207) (Teddy Katz)
-* 18376cf Update: add fixer for `lines-around-directive` (#7217) (Teddy Katz)
-* f8e8fab Update: add fixer for `wrap-iife` (#7196) (Teddy Katz)
-* 558b444 Docs: Add @not-an-aardvark to development team (#7279) (Ilya Volodin)
-* cd1dc57 Update: Add a fixer for `dot-location` (#7186) (Teddy Katz)
-* 89787b2 Update: for `yoda`, add a fixer (#7199) (Teddy Katz)
-* 742ae67 Fix: avoid indent and no-mixed-spaces-and-tabs conflicts (fixes #7248) (#7266) (Teddy Katz)
-* 85b8714 Fix: Use error templates even when reading from stdin (fixes #7213) (#7223) (Teddy Katz)
-* 66adac1 Docs: correction in prefer-reflect docs (fixes #7069) (#7150) (Scott Stern)
-* e3f95de Update: Fix `no-extra-parens` false negative (fixes #7229) (#7231) (Teddy Katz)
-* 2909c19 Docs: Fix typo in object-shorthand docs (#7267) (Brian Donovan)
-* 7bb800d Chore: add internal rule to enforce meta.docs conventions (fixes #6954) (#7155) (Vitor Balocco)
-* 722c68c Docs: add code fences to the issue template (#7254) (Teddy Katz)
-
-v3.6.1 - September 26, 2016
-
-* b467436 Upgrade: Upgrade Espree to 3.3.1 (#7253) (Ilya Volodin)
-* 299a563 Build: Do not strip .md extension from absolute URLs (#7222) (Kai Cataldo)
-* 27042d2 Chore: removed unused code related to scopeMap (#7218) (Yang Su)
-* d154204 Chore: Lint bin/eslint.js (#7243) (Kevin Partington)
-* 87625fa Docs: Improve eol-last examples in docs (#7227) (Chainarong Tangsurakit)
-* de8eaa4 Docs: `class-methods-use-this`: fix option name (#7224) (Jordan Harband)
-* 2355f8d Docs: Add Brunch plugin to integrations (#7225) (Aleksey Shvayka)
-* a5817ae Docs: Default option from `operator-linebreak` is `after`and not always (#7228) (Konstantin Pschera)
-
-v3.6.0 - September 23, 2016
-
-* 1b05d9c Update: add fixer for `strict` (fixes #6668) (#7198) (Teddy Katz)
-* 0a36138 Docs: Update ecmaVersion instructions (#7195) (Nicholas C. Zakas)
-* aaa3779 Update: Allow `space-unary-ops` to handle await expressions (#7174) (Teddy Katz)
-* 91bf477 Update: add fixer for `prefer-template` (fixes #6978) (#7165) (Teddy Katz)
-* 745343f Update: `no-extra-parens` supports async/await (refs #7101) (#7178) (Toru Nagashima)
-* 8e1fee1 Fix: Handle number literals correctly in `no-whitespace-before-property` (#7185) (Teddy Katz)
-* 462a3f7 Update: `keyword-spacing` supports async/await (refs #7101) (#7179) (Toru Nagashima)
-* 709a734 Update: Allow template string in `valid-typeof` comparison (fixes #7166) (#7168) (Teddy Katz)
-* f71937a Fix: Don't report async/generator callbacks in `array-callback-return` (#7172) (Teddy Katz)
-* 461b015 Fix: Handle async functions correctly in `prefer-arrow-callback` fixer (#7173) (Teddy Katz)
-* 7ea3e4b Fix: Handle await expressions correctly in `no-unused-expressions` (#7175) (Teddy Katz)
-* 16bb802 Update: Ensure `arrow-parens` handles async arrow functions correctly (#7176) (Teddy Katz)
-* 2d10657 Chore: add tests for `generator-star-spacing` and async (refs #7101) (#7182) (Toru Nagashima)
-* c118d21 Update: Let `no-restricted-properties` check destructuring (fixes #7147) (#7151) (Teddy Katz)
-* 9e0b068 Fix: valid-jsdoc does not throw on FieldType without value (fixes #7184) (#7187) (Kai Cataldo)
-* 4b5d9b7 Docs: Update process for evaluating proposals (fixes #7156) (#7183) (Kai Cataldo)
-* 95c777a Update: Make `no-restricted-properties` more flexible (fixes #7137) (#7139) (Teddy Katz)
-* 0fdf23c Update: fix `quotes` rule's false negative (fixes #7084) (#7141) (Toru Nagashima)
-* f2a789d Update: fix `no-unused-vars` false negative (fixes #7124) (#7143) (Toru Nagashima)
-* 6148d85 Fix: Report columns for `eol-last` correctly (fixes #7136) (#7149) (kdex)
-* e016384 Update: add fixer for quote-props (fixes #6996) (#7095) (Teddy Katz)
-* 35f7be9 Upgrade: espree to 3.2.0, remove tests with SyntaxErrors (fixes #7169) (#7170) (Teddy Katz)
-* 28ddcf8 Fix: `max-len`: `ignoreTemplateLiterals`: handle 3+ lines (fixes #7125) (#7138) (Jordan Harband)
-* 660e091 Docs: Update rule descriptions (fixes #5912) (#7152) (Kenneth Williams)
-* 8b3fc32 Update: Make `indent` report lines with mixed spaces/tabs (fixes #4274) (#7076) (Teddy Katz)
-* b39ac2c Update: add fixer for `no-regex-spaces` (#7113) (Teddy Katz)
-* cc80467 Docs: Update PR templates for formatting (#7128) (Nicholas C. Zakas)
-* 76acbb5 Fix: include LogicalExpression in indent length calc (fixes #6731) (#7087) (Alec)
-* a876673 Update: no-implicit-coercion checks TemplateLiterals (fixes #7062) (#7121) (Kai Cataldo)
-* 8db4f0c Chore: Enable `typeof` check for `no-undef` rule in eslint-config-eslint (#7103) (Teddy Katz)
-* 7e8316f Docs: Update release process (#7127) (Nicholas C. Zakas)
-* 22edd8a Update: `class-methods-use-this`: `exceptMethods` option (fixes #7085) (#7120) (Jordan Harband)
-* afd132a Fix: line-comment-position "above" string option now works (fixes #7100) (#7102) (Kevin Partington)
-* 1738b2e Chore: fix name of internal-no-invalid-meta test file (#7142) (Vitor Balocco)
-* ac0bb62 Docs: Fixes examples for allowTemplateLiterals (fixes #7115) (#7135) (Zoe Ingram)
-* bcfa3e5 Update: Add `always`/`never` option to `eol-last` (fixes #6938) (#6952) (kdex)
-* 0ca26d9 Docs: Distinguish examples for space-before-blocks (#7132) (Timo Tijhof)
-* 9a2aefb Chore: Don't require an issue reference in check-commit npm script (#7104) (Teddy Katz)
-* c85fd84 Fix: max-statements-per-line rule to force minimum to be 1 (fixes #7051) (#7092) (Scott Stern)
-* e462e47 Docs: updates category of no-restricted-properties (fixes #7112) (#7118) (Alec)
-* 6ae660b Fix: Don't report comparisons of two typeof expressions (fixes #7078) (#7082) (Teddy Katz)
-* 710f205 Docs: Fix typos in Issues section of Maintainer's Guide (#7114) (Kai Cataldo)
-* 546a3ca Docs: Clarify that linter does not process configuration (fixes #7108) (#7110) (Kevin Partington)
-* 0d50943 Docs: Elaborate on `guard-for-in` best practice (fixes #7071) (#7094) (Dallon Feldner)
-* 58e6d76 Docs: Fix examples for no-restricted-properties (#7099) (not-an-aardvark)
-* 6cfe519 Docs: Corrected typo in line-comment-position rule doc (#7097) (Alex Mercier)
-* f02e52a Docs: Add fixable note to no-implicit-coercion docs (#7096) (Brandon Mills)
-
-v3.5.0 - September 9, 2016
-
-* 08fa538 Update: fix false negative of `arrow-spacing` (fixes #7079) (#7080) (Toru Nagashima)
-* cec65e3 Update: add fixer for no-floating-decimal (fixes #7070) (#7081) (not-an-aardvark)
-* 2a3f699 Fix: Column number for no-multiple-empty-lines (fixes #7086) (#7088) (Ian VanSchooten)
-* 6947299 Docs: Add info about closing accepted issues to docs (fixes #6979) (#7089) (Kai Cataldo)
-* d30157a Docs: Add link to awesome-eslint in integrations page (#7090) (Vitor Balocco)
-* 457be1b Docs: Update so issues are not required (fixes #7015) (#7072) (Nicholas C. Zakas)
-* d9513b7 Fix: Allow linting of .hidden files/folders (fixes #4828) (#6844) (Ian VanSchooten)
-* 6d97c18 New: `max-len`: `ignoreStrings`+`ignoreTemplateLiterals` (fixes #5805) (#7049) (Jordan Harband)
-* 538d258 Update: make no-implicit-coercion support autofixing. (fixes #7056) (#7061) (Eli White)
-* 883316d Update: add fixer for prefer-arrow-callback (fixes #7002) (#7004) (not-an-aardvark)
-* 7502eed Update: auto-fix for `comma-style` (fixes #6941) (#6957) (Gyandeep Singh)
-* 645dda5 Update: add fixer for dot-notation (fixes #7014) (#7054) (not-an-aardvark)
-* 2657846 Fix: `no-console` ignores user-defined console (fixes #7010) (#7058) (Toru Nagashima)
-* 656bb6e Update: add fixer for newline-before-return (fixes #5958) (#7050) (Vitor Balocco)
-* 1f995c3 Fix: no-implicit-coercion string concat false positive (fixes #7057) (#7060) (Kai Cataldo)
-* 6718749 Docs: Clarify that `es6` env also sets `ecmaVersion` to 6 (#7067) (Jérémie Astori)
-* e118728 Update: add fixer for wrap-regex (fixes #7013) (#7048) (not-an-aardvark)
-* f4fcd1e Update: add more `indent` options for functions (fixes #6052) (#7043) (not-an-aardvark)
-* 657eee5 Update: add fixer for new-parens (fixes #6994) (#7047) (not-an-aardvark)
-* ff19aa9 Update: improve `max-statements-per-line` message (fixes #6287) (#7044) (Jordan Harband)
-* 3960617 New: `prefer-numeric-literals` rule (fixes #6068) (#7029) (Annie Zhang)
-* fa760f9 Chore: no-regex-spaces uses internal rule message format (fixes #7052) (#7053) (Kevin Partington)
-* 22c7e09 Update: no-magic-numbers false negative on reassigned vars (fixes #4616) (#7028) (not-an-aardvark)
-* be29599 Update: Throw error if whitespace found in plugin name (fixes #6854) (#6960) (Jesse Ostrander)
-* 4063a79 Fix: Rule message placeholders can be inside braces (fixes #6988) (#7041) (Kevin Partington)
-* 52e8d9c Docs: Clean up sort-vars (#7045) (Matthew Dunsdon)
-* 4126f12 Chore: Rule messages use internal rule message format (fixes #6977) (#6989) (Kevin Partington)
-* 46cb690 New: `no-restricted-properties` rule (fixes #3218) (#7017) (Eli White)
-* 00b3042 Update: Pass file path to parse function (fixes #5344) (#7024) (Annie Zhang)
-* 3f13325 Docs: Add kaicataldo and JamesHenry to our teams (#7039) (alberto)
-* 8e77f16 Update: `new-parens` false negative (fixes #6997) (#6999) (Toru Nagashima)
-* 326f457 Docs: Add missing 'to' in no-restricted-modules (#7022) (Oskar Risberg)
-* 8277357 New: `line-comment-position` rule (fixes #6077) (#6953) (alberto)
-* c1f0d76 New: `lines-around-directive` rule (fixes #6069) (#6998) (Kai Cataldo)
-* 61f1de0 Docs: Fix typo in no-debugger (#7019) (Denis Ciccale)
-* 256c4a2 Fix: Allow separate mode option for multiline and align (fixes #6691) (#6991) (Annie Zhang)
-* a989a7c Docs: Declaring dependency on eslint in shared config (fixes #6617) (#6985) (alberto)
-* 6869c60 Docs: Fix minor typo in no-extra-parens doc (#6992) (Jérémie Astori)
-* 28f1619 Docs: Update the example of SwitchCase (#6981) (fish)
-
-v3.4.0 - August 26, 2016
-
-* c210510 Update: add fixer for no-extra-parens (fixes #6944) (#6950) (not-an-aardvark)
-* ca3d448 Fix: `prefer-const` false negative about `eslintUsed` (fixes #5837) (#6971) (Toru Nagashima)
-* 1153955 Docs: Draft of JSCS migration guide (refs #5859) (#6942) (Nicholas C. Zakas)
-* 3e522be Fix: false negative of `indent` with `else if` statements (fixes #6956) (#6965) (not-an-aardvark)
-* 2dfb290 Docs: Distinguish examples in rules under Stylistic Issues part 7 (#6760) (Kenneth Williams)
-* 3c710c9 Fix: rename "AirBnB" => "Airbnb" init choice (fixes #6969) (Harrison Shoff)
-* 7660b39 Fix: `object-curly-spacing` for type annotations (fixes #6940) (#6945) (Toru Nagashima)
-* 21ab784 New: do not remove non visited files from cache. (fixes #6780) (#6921) (Roy Riojas)
-* 3a1763c Fix: enable `@scope/plugin/ruleId`-style specifier (refs #6362) (#6939) (Toru Nagashima)
-* d6fd064 Update: Add never option to multiline-ternary (fixes #6751) (#6905) (Kai Cataldo)
-* 0d268f1 New: `symbol-description` rule (fixes #6778) (#6825) (Jarek Rencz)
-* a063d4e Fix: no-cond-assign within a function expression (fixes #6908) (#6909) (Patrick McElhaney)
-* 16db93a Build: Tag docs, publish release notes (fixes #6892) (#6934) (Nicholas C. Zakas)
-* 0cf1d55 Chore: Fix object-shorthand errors (fixes #6958) (#6959) (Kai Cataldo)
-* 8851ddd Fix: Improve pref of globbing by inheriting glob.GlobSync (fixes #6710) (#6783) (Kael Zhang)
-* cf2242c Update: `requireStringLiterals` option for `valid-typeof` (fixes #6698) (#6923) (not-an-aardvark)
-* 8561389 Fix: `no-trailing-spaces` wrong fixing (fixes #6933) (#6937) (Toru Nagashima)
-* 6a92be5 Docs: Update semantic versioning policy (#6935) (alberto)
-* a5189a6 New: `class-methods-use-this` rule (fixes #5139) (#6881) (Gyandeep Singh)
-* 1563808 Update: add support for ecmaVersion 20xx (fixes #6750) (#6907) (Kai Cataldo)
-* d8b770c Docs: Change rule descriptions for consistent casing (#6915) (Brandon Mills)
-* c676322 Chore: Use object-shorthand batch 3 (refs #6407) (#6914) (Kai Cataldo)
-
-v3.3.1 - August 15, 2016
-
-* a2f06be Build: optimize rule page title for small browser tabs (fixes #6888) (#6904) (Vitor Balocco)
-* 02a00d6 Docs: clarify rule details for no-template-curly-in-string (#6900) (not-an-aardvark)
-* b9b3446 Fix: sort-keys ignores destructuring patterns (fixes #6896) (#6899) (Kai Cataldo)
-* 3fe3a4f Docs: Update options in `object-shorthand` (#6898) (Grant Snodgrass)
-* cd09c96 Chore: Use object-shorthand batch 2 (refs #6407) (#6897) (Kai Cataldo)
-* 2841008 Chore: Use object-shorthand batch 1 (refs #6407) (#6893) (Kai Cataldo)
-
-v3.3.0 - August 12, 2016
-
-* 683ac56 Build: Add CI release scripts (fixes #6884) (#6885) (Nicholas C. Zakas)
-* ebf8441 Update: `prefer-rest-params` relax for member accesses (fixes #5990) (#6871) (Toru Nagashima)
-* df01c4f Update: Add regex support for exceptions (fixes #5187) (#6883) (Annie Zhang)
-* 055742c Fix: `no-dupe-keys` type errors (fixes #6886) (#6889) (Toru Nagashima)
-* e456fd3 New: `sort-keys` rule (fixes #6076) (#6800) (Toru Nagashima)
-* 3e879fc Update: Rule "eqeqeq" to have more specific null handling (fixes #6543) (#6849) (Simon Sturmer)
-* e8cb7f9 Chore: use eslint-plugin-node (refs #6407) (#6862) (Toru Nagashima)
-* e37bbd8 Docs: Remove duplicate statement (#6878) (Richard Käll)
-* 11395ca Fix: `no-dupe-keys` false negative (fixes #6801) (#6863) (Toru Nagashima)
-* 1ecd2a3 Update: improve error message in `no-control-regex` (#6839) (Jordan Harband)
-* d610d6c Update: make `max-lines` report the actual number of lines (fixes #6766) (#6764) (Jarek Rencz)
-* b256c50 Chore: Fix glob for core js files for lint (fixes #6870) (#6872) (Gyandeep Singh)
-* f8ab8f1 New: func-call-spacing rule (fixes #6080) (#6749) (Brandon Mills)
-* be68f0b New: no-template-curly-in-string rule (fixes #6186) (#6767) (Jeroen Engels)
-* 80789ab Chore: don't throw if rule is in old format (fixes #6848) (#6850) (Vitor Balocco)
-* d47c505 Fix: `newline-after-var` false positive (fixes #6834) (#6847) (Toru Nagashima)
-* bf0afcb Update: validate void operator in no-constant-condition (fixes #5726) (#6837) (Vitor Balocco)
-* 5ef839e New: Add consistent and ..-as-needed to object-shorthand (fixes #5438) (#5439) (Martijn de Haan)
-* 7e1bf01 Fix: update peerDependencies of airbnb option for `--init` (fixes #6843) (#6846) (Vitor Balocco)
-* 8581f4f Fix: `no-invalid-this` false positive (fixes #6824) (#6827) (Toru Nagashima)
-* 90f78f4 Update: add `props` option to `no-self-assign` rule (fixes #6718) (#6721) (Toru Nagashima)
-* 30d71d6 Update: 'requireForBlockBody' modifier for 'arrow-parens' (fixes #6557) (#6558) (Nicolas Froidure)
-* cdded07 Chore: use native `Object.assign` (refs #6407) (#6832) (Gyandeep Singh)
-* 579ec49 Chore: Add link to rule change guidelines in "needs info" template (fixes #6829) (#6831) (Kevin Partington)
-* 117e7aa Docs: Remove incorrect "constructor" statement from `no-new-symbol` docs (#6830) (Jarek Rencz)
-* aef18b4 New: `no-unsafe-negation` rule (fixes #2716) (#6789) (Toru Nagashima)
-* d94e945 Docs: Update Getting Started w/ Readme installation instructions (#6823) (Kai Cataldo)
-* dfbc112 Upgrade: proxyquire to 1.7.10 (fixes #6821) (#6822) (alberto)
-* 4c5e911 Chore: enable `prefer-const` and apply it to our codebase (refs #6407) (#6805) (Toru Nagashima)
-* e524d16 Update: camelcase rule fix for import declarations (fixes #6755) (#6784) (Lorenzo Zottar)
-* 8f3509d Update: make `eslint:all` excluding deprecated rules (fixes #6734) (#6756) (Toru Nagashima)
-* 2b17459 New: `no-global-assign` rule (fixes #6586) (#6746) (alberto)
-
-v3.2.2 - August 1, 2016
-
-* 510ce4b Upgrade: file-entry-cache@^1.3.1 (fixes #6816, refs #6780) (#6819) (alberto)
-* 46b14cd Fix: ignore MemberExpression in VariableDeclarators (fixes #6795) (#6815) (Nicholas C. Zakas)
-
-v3.2.1 - August 1, 2016
-
-* 584577a Build: Pin file-entry-cache to avoid licence issue (refs #6816) (#6818) (alberto)
-* 38d0d23 Docs: clarify minor releases and suggest using `~ to version (#6804) (Henry Zhu)
-* 4ca809e Fix: Normalizes messages so all end with a period (fixes #6762) (#6807) (Patrick McElhaney)
-* c7488ac Fix: Make MemberExpression option opt-in (fixes #6797) (#6798) (Rich Trott)
-* 715e8fa Docs: Update issue closing policy (fixes #6765) (#6808) (Nicholas C. Zakas)
-* 288f7bf Build: Fix site generation (fixes #6791) (#6793) (Nicholas C. Zakas)
-* 261a9f3 Docs: Update JSCS status in README (#6802) (alberto)
-* 5ae0887 Docs: Update no-void.md (#6799) (Daniel Hritzkiv)
-
-v3.2.0 - July 29, 2016
-
-* 2438ee2 Upgrade: Update markdownlint dependency to 0.2.0 (fixes #6781) (#6782) (David Anson)
-* 4fc0018 Chore: dogfooding `no-var` rule and remove `var`s (refs #6407) (#6757) (Toru Nagashima)
-* b22eb5c New: `no-tabs` rule (fixes #6079) (#6772) (Gyandeep Singh)
-* ddea63a Chore: Updated no-control-regex tests to cover all cases (fixes #6438) (#6752) (Efe Gürkan YALAMAN)
-* 1025772 Docs: Add plugin example to disabling with comments guide (fixes #6742) (#6747) (Brandon Mills)
-* 628aae4 Docs: fix inconsistent spacing inside block comment (#6768) (Brian Jacobel)
-* 2983c32 Docs: Add options to func-names config comments (#6748) (Brandon Mills)
-* 2f94443 Docs: fix wrong path (#6763) (molee1905)
-* 6f3faa4 Revert "Build: Remove support for Node v5 (fixes #6743)" (#6758) (Nicholas C. Zakas)
-* 99dfd1c Docs: fix grammar issue in rule-changes page (#6761) (Vitor Balocco)
-* e825458 Fix: Rule no-unused-vars had missing period (fixes #6738) (#6739) (Brian Mock)
-* 71ae64c Docs: Clarify cache file deletion (fixes #4943) (#6712) (Nicholas C. Zakas)
-* 26c85dd Update: merge warnings of consecutive unreachable nodes (fixes #6583) (#6729) (Toru Nagashima)
-* 106e40b Fix: Correct grammar in object-curly-newline reports (fixes #6725) (#6728) (Vitor Balocco)
-* e00754c Chore: Dogfooding ES6 rules (refs #6407) (#6735) (alberto)
-* 181b26a Build: Remove support for Node v5 (fixes #6743) (#6744) (alberto)
-* 5320a6c Update: `no-use-before-define` false negative on for-in/of (fixes #6699) (#6719) (Toru Nagashima)
-* a2090cb Fix: space-infix-ops doesn't fail for type annotations(fixes #5211) (#6723) (Nicholas C. Zakas)
-* 9c36ecf Docs: Add @vitorbal and @platinumazure to development team (Ilya Volodin)
-* e09d1b8 Docs: describe all RuleTester options (fixes #4810, fixes #6709) (#6711) (Nicholas C. Zakas)
-* a157f47 Chore: Update CLIEngine option desc (fixes #5179) (#6713) (Nicholas C. Zakas)
-* a0727f9 Chore: fix `.gitignore` for vscode (refs #6383) (#6720) (Toru Nagashima)
-* 75d2d43 Docs: Clarify Closure type hint expectation (fixes #5231) (#6714) (Nicholas C. Zakas)
-* 95ea25a Update: Check indentation of multi-line chained properties (refs #1801) (#5940) (Rich Trott)
-* e7b1e1c Docs: Edit issue/PR waiting period docs (fixes #6009) (#6715) (Nicholas C. Zakas)
-* 053aa0c Update: Added 'allowSuper' option to `no-underscore-dangle` (fixes #6355) (#6662) (peteward44)
-* 8929045 Build: Automatically generate rule index (refs #2860) (#6658) (Ilya Volodin)
-* f916ae5 Docs: Fix multiline-ternary typos (#6704) (Cédric Malard)
-* c64b0c2 Chore: First ES6 refactoring (refs #6407) (#6570) (Nicholas C. Zakas)
-
-v3.1.1 - July 18, 2016
-
-* 565e584 Fix: `eslint:all` causes regression in 3.1.0 (fixes #6687) (#6696) (alberto)
-* cb90359 Fix: Allow named recursive functions (fixes #6616) (#6667) (alberto)
-* 3f206dd Fix: `balanced` false positive in `spaced-comment` (fixes #6689) (#6692) (Grant Snodgrass)
-* 57f1676 Docs: Add missing brackets from code examples (#6700) (Plusb Preco)
-* 124f066 Chore: Remove fixable key from multiline-ternary metadata (fixes #6683) (#6688) (Kai Cataldo)
-* 9f96086 Fix: Escape control characters in XML. (fixes #6673) (#6672) (George Chung)
-
-v3.1.0 - July 15, 2016
-
-* e8f8c6c Fix: incorrect exitCode when eslint is called with --stdin (fixes #6677) (#6682) (Steven Humphrey)
-* 38639bf Update: make `no-var` fixable (fixes #6639) (#6644) (Toru Nagashima)
-* dfc20e9 Fix: `no-unused-vars` false positive in loop (fixes #6646) (#6649) (Toru Nagashima)
-* 2ba75d5 Update: relax outerIIFEBody definition (fixes #6613) (#6653) (Stephen E. Baker)
-* 421e4bf Chore: combine multiple RegEx replaces with one (fixes #6669) (#6661) (Sakthipriyan Vairamani)
-* 089ee2c Docs: fix typos,wrong path,backticks (#6663) (molee1905)
-* ef827d2 Docs: Add another pre-commit hook to integrations (#6666) (David Alan Hjelle)
-* a343b3c Docs: Fix option typo in no-underscore-dangle (Fixes #6674) (#6675) (Luke Page)
-* 5985eb2 Chore: add internal rule that validates meta property (fixes #6383) (#6608) (Vitor Balocco)
-* 4adb15f Update: Add `balanced` option to `spaced-comment` (fixes #4133) (#6575) (Annie Zhang)
-* 1b13c25 Docs: fix incorrect example being mark as correct (#6660) (David Björklund)
-* a8b4e40 Fix: Install required eslint plugin for "standard" guide (fixes #6656) (#6657) (Feross Aboukhadijeh)
-* 720686b New: `endLine` and `endColumn` of the lint result. (refs #3307) (#6640) (Toru Nagashima)
-* 54faa46 Docs: Small tweaks to CLI documentation (fixes #6627) (#6642) (Kevin Partington)
-* e108850 Docs: Added examples and structure to `padded-blocks` (fixes #6628) (#6643) (alberto)
-* 350e1c0 Docs: Typo (#6650) (Peter Rood)
-* b837c92 Docs: Correct a term in max-len.md (fixes #6637) (#6641) (Vse Mozhet Byt)
-* baeb313 Fix: Warning behavior for executeOnText (fixes #6611) (#6632) (Nicholas C. Zakas)
-* e6004be Chore: Enable preferType in valid-jsdoc (refs #5188) (#6634) (Nicholas C. Zakas)
-* ca323cf Fix: Use default assertion messages (fixes #6532) (#6615) (Dmitrii Abramov)
-* 2bdf22c Fix: Do not throw exception if baseConfig is provided (fixes #6605) (#6625) (Kevin Partington)
-* e42cacb Upgrade: mock-fs to 3.10, fixes for Node 6.3 (fixes #6621) (#6624) (Tim Schaub)
-* 8a263ae New: multiline-ternary rule (fixes #6066) (#6590) (Kai Cataldo)
-* e951303 Update: Adding new `key-spacing` option (fixes #5613) (#5907) (Kyle Mendes)
-* 10c3e91 Docs: Remove reference from 3.0.0 migration guide (refs #6605) (#6618) (Kevin Partington)
-* 5010694 Docs: Removed non-existing resource (#6609) (Moritz Kröger)
-* 6d40d85 Docs: Note that PR requires ACCEPTED issue (refs #6568) (#6604) (Patrick McElhaney)
-
-v3.0.1 - July 5, 2016
-
-* 27700cf Fix: `no-unused-vars` false positive around callback (fixes #6576) (#6579) (Toru Nagashima)
-* 124d8a3 Docs: Pull request template (#6568) (Nicholas C. Zakas)
-* e9a2ed9 Docs: Fix rules\id-length exceptions typos (fixes #6397) (#6593) (GramParallelo)
-* a2cfa1b Fix: Make outerIIFEBody work correctly (fixes #6585) (#6596) (Nicholas C. Zakas)
-* 9c451a2 Docs: Use string severity in example (#6601) (Kenneth Williams)
-* 8308c0b Chore: remove path-is-absolute in favor of the built-in (fixes #6598) (#6600) (shinnn)
-* 7a63717 Docs: Add missing pull request step (fixes #6595) (#6597) (Nicholas C. Zakas)
-* de3ed84 Fix: make `no-unused-vars` ignore for-in (fixes #2342) (#6126) (Oleg Gaidarenko)
-* 6ef2cbe Fix: strip Unicode BOM of config files (fixes #6556) (#6580) (Toru Nagashima)
-* ee7fcfa Docs: Correct type of `outerIIFEBody` in `indent` (fixes #6581) (#6584) (alberto)
-* 25fc7b7 Fix: false negative of `max-len` (fixes #6564) (#6565) (not-an-aardvark)
-* f6b8452 Docs: Distinguish examples in rules under Stylistic Issues part 6 (#6567) (Kenneth Williams)
-
-v3.0.0 - July 1, 2016
-
-* 66de9d8 Docs: Update installation instructions on README (#6569) (Nicholas C. Zakas)
-* dc5b78b Breaking: Add `require-yield` rule to `eslint:recommended` (fixes #6550) (#6554) (Gyandeep Singh)
-* 7988427 Fix: lib/config.js tests pass if personal config exists (fixes #6559) (#6566) (Kevin Partington)
-* 4c05967 Docs: Update rule docs for new format (fixes #5417) (#6551) (Nicholas C. Zakas)
-* 70da5a8 Docs: Correct link to rules page (#fixes 6553) (#6561) (alberto)
-* e2b2030 Update: Check RegExp strings for `no-regex-spaces` (fixes #3586) (#6379) (Jackson Ray Hamilton)
-* 397e51b Update: Implement outerIIFEBody for indent rule (fixes #6259) (#6382) (David Shepherd)
-* 666da7c Docs: 3.0.0 migration guide (#6521) (Nicholas C. Zakas)
-* b9bf8fb Docs: Update Governance Policy (fixes #6452) (#6522) (Nicholas C. Zakas)
-* 1290657 Update: `no-unused-vars` ignores read it modifies itself (fixes #6348) (#6535) (Toru Nagashima)
-* d601f6b Fix: Delete cache only when executing on files (fixes #6459) (#6540) (Kai Cataldo)
-* e0d4b19 Breaking: Error thrown/printed if no config found (fixes #5987) (#6538) (Kevin Partington)
-* 18663d4 Fix: false negative of `no-useless-rename` (fixes #6502) (#6506) (Toru Nagashima)
-* 0a7936d Update: Add fixer for prefer-const (fixes #6448) (#6486) (Nick Heiner)
-* c60341f Chore: Update index and `meta` for `"eslint:recommended"` (refs #6403) (#6539) (Mark Pedrotti)
-* 73da28d Better wording for the error reported by the rule "no-else-return" #6411 (#6413) (Olivier Thomann)
-* e06a5b5 Update: Add fixer for arrow-parens (fixes #4766) (#6501) (madmed88)
-* 5f8f3e8 Docs: Remove Box as a sponsor (#6529) (Nicholas C. Zakas)
-* 7dfe0ad Docs: fix max-lines samples (fixes #6516) (#6515) (Dmitriy Shekhovtsov)
-* fa05119 Breaking: Update eslint:recommended (fixes #6403) (#6509) (Nicholas C. Zakas)
-* e96177b Docs: Add "Proposing a Rule Change" link to CONTRIBUTING.md (#6511) (Kevin Partington)
-* bea9096 Docs: Update pull request steps (fixes #6474) (#6510) (Nicholas C. Zakas)
-* 7bcf6e0 Docs: Consistent example headings & text pt3 (refs #5446) (#6492) (Guy Fraser)
-* 1a328d9 Docs: Consistent example headings & text pt4 (refs #5446) (#6493) (Guy Fraser)
-* ff5765e Docs: Consistent example headings & text pt2 (refs #5446)(#6491) (Guy Fraser)
-* 01384fa Docs: Fixing typos (refs #5446)(#6494) (Guy Fraser)
-* 4343ae8 Fix: false negative of `object-shorthand` (fixes #6429) (#6434) (Toru Nagashima)
-* b7d8c7d Docs: more accurate yoda-speak (#6497) (Tony Lukasavage)
-* 3b0ab0d Fix: add warnIgnored flag to CLIEngine.executeOnText (fixes #6302) (#6305) (Robert Levy)
-* c2c6cec Docs: Mark object-shorthand as fixable. (#6485) (Nick Heiner)
-* 5668236 Fix: Allow objectsInObjects exception when destructuring (fixes #6469) (#6470) (Adam Renklint)
-* 17ac0ae Fix: `strict` rule reports a syntax error for ES2016 (fixes #6405) (#6464) (Toru Nagashima)
-* 4545123 Docs: Rephrase documentation for `no-duplicate-imports` (#6463) (Simen Bekkhus)
-* 1b133e3 Docs: improve `no-native-reassign` and specifying globals (fixes #5358) (#6462) (Toru Nagashima)
-* b179373 Chore: Remove dead code in excuteOnFiles (fixes #6467) (#6466) (Andrew Hutchings)
-* 18fbc4b Chore: Simplify eslint process exit code (fixes #6368) (#6371) (alberto)
-* 58542e4 Breaking: Drop support for node < 4 (fixes #4483) (#6401) (alberto)
-* f50657e Breaking: use default for complexity in eslint:recommended (fixes #6021) (#6410) (alberto)
-* 3e690fb Fix: Exit init early if guide is chosen w/ no package.json (fixes #6476) (#6478) (Kai Cataldo)
-
-v2.13.1 - June 20, 2016
-
-* 434de7f Fix: wrong baseDir (fixes #6450) (#6457) (Toru Nagashima)
-* 3c9ce09 Fix: Keep indentation when fixing `padded-blocks` "never" (fixes #6454) (#6456) (Ed Lee)
-* a9d4cb2 Docs: Fix typo in max-params examples (#6471) (J. William Ashton)
-* 1e185b9 Fix: no-multiple-empty-lines errors when no line breaks (fixes #6449) (#6451) (strawbrary)
-
-v2.13.0 - June 17, 2016
-
-* cf223dd Fix: add test for a syntax error (fixes #6013) (#6378) (Toru Nagashima)
-* da30cf9 Update: Add fixer for object-shorthand (fixes #6412) (#6418) (Nick Heiner)
-* 2cd90eb Chore: Fix rule meta description inconsistencies (refs #5417) (#6422) (Mark Pedrotti)
-* d798b2c Added quotes around "classes" option key (#6441) (Guy Fraser)
-* 852b6df Docs: Delete empty table of links from Code Path Analysis (#6423) (Mark Pedrotti)
-* 5e9117e Chore: sort rules in eslint.json (fixes #6425) (#6426) (alberto)
-* c2b5277 Docs: Add gitter chat link to Reporting Bugs (#6430) (Mark Pedrotti)
-* 1316db0 Update: Add `never` option for `func-names` (fixes #6059) (#6392) (alberto)
-* 1c123e2 Update: Add autofix for `padded-blocks` (fixes #6320) (#6393) (alberto)
-* 8ec89c8 Fix: `--print-config` return config inside subdir (fixes #6329) (#6385) (alberto)
-* 4f73240 Fix: `object-curly-newline` multiline with comments (fixes #6381) (#6396) (Toru Nagashima)
-* 77697a7 Chore: Fake config hierarchy fixtures (fixes #6206) (#6402) (Gyandeep Singh)
-* 73a9a6d Docs: Fix links in Configuring ESLint (#6421) (Mark Pedrotti)
-* ed84c4c Fix: improve `newline-per-chained-call` message (fixes #6340) (#6360) (Toru Nagashima)
-* 9ea4e44 Docs: Update parser reference to `espree` instead of `esprima` (#6404) (alberto)
-* 7f57467 Docs: Make `fix` param clearer (fixes #6366) (#6367) (Nick Heiner)
-* fb49c7f Fix: nested `extends` with relative path (fixes #6358) (#6359) (Toru Nagashima)
-* 5122f73 Update: no-multiple-empty-lines fixer (fixes #6225) (#6226) (Ruurd Moelker)
-* 0e7ce72 Docs: Fix rest-spread-spacing's name (#6365) (cody)
-* cfdd524 Fix: allow semi as braceless body of statements (fixes #6386) (#6391) (alberto)
-* 6b08cfc Docs: key-spacing fixable documenation notes (fixes #6375) (#6376) (Ruurd Moelker)
-* 4b4be3b Docs: `max-lines` option: fix `skipComments` typo (#6374) (Jordan Harband)
-* 20ab4f6 Docs: Fix wrong link in object-curly-newline (#6373) (Grant Snodgrass)
-* 412ce8d Docs: Fix broken links in no-mixed-operators (#6372) (Grant Snodgrass)
-
-v2.12.0 - June 10, 2016
-
-* 54c30fb Update: Add explicit default option `always` for `eqeqeq` (refs #6144) (#6342) (alberto)
-* 2d63370 Update: max-len will warn indented comment lines (fixes #6322) (#6324) (Kai Cataldo)
-* dcd4ad7 Docs: clarify usage of inline disable comments (fixes #6335) (#6347) (Kai Cataldo)
-* c03300b Docs: Clarified how plugin rules look in plugin configs (fixes #6346) (#6351) (Kevin Partington)
-* 9c87709 Docs: Add semantic versioning policy (fixes #6244) (#6343) (Nicholas C. Zakas)
-* 5affab1 Docs: Describe values under Extending Configuration Files (refs #6240) (#6336) (Mark Pedrotti)
-* 2520f5a New: `max-lines` rule (fixes #6078) (#6321) (alberto)
-* 9bfbc64 Update: Option for object literals in `arrow-body-style` (fixes #5936) (#6216) (alberto)
-* 977cdd5 Chore: remove unused method from FileFinder (fixes #6344) (#6345) (alberto)
-* 477fbc1 Docs: Add section about customizing RuleTester (fixes #6227) (#6331) (Jeroen Engels)
-* 0e14016 New: `no-mixed-operators` rule (fixes #6023) (#6241) (Toru Nagashima)
-* 6e03c4b Update: Add never option to arrow-body-style (fixes #6317) (#6318) (Andrew Hyndman)
-* f804397 New: Add `eslint:all` option (fixes #6240) (#6248) (Robert Fletcher)
-* dfe05bf Docs: Link JSCS rules to their corresponding page. (#6334) (alberto)
-* 1cc4356 Docs: Remove reference to numeric config (fixes #6309) (#6327) (Kevin Partington)
-* 2d4efbe Docs: Describe options in rule under Strict Mode (#6312) (Mark Pedrotti)
-* c1953fa Docs: Typo fix 'and' -> 'any' (#6326) (Stephen Edgar)
-* d49ab4b Docs: Code conventions improvements (#6313) (Kevin Partington)
-* 316a507 Fix: one-var allows uninitialized vars in ForIn/ForOf (fixes #5744) (#6272) (Kai Cataldo)
-* 6cbee31 Docs: Typo fix 'colum' -> 'column' (#6306) (Andrew Cobby)
-* 2663569 New: `object-curly-newline` (fixes #6072) (#6223) (Toru Nagashima)
-* 72c2ea5 Update: callback-return allows for object methods (fixes #4711) (#6277) (Kai Cataldo)
-* 89580a4 Docs: Distinguish examples in rules under Stylistic Issues part 5 (#6291) (Kenneth Williams)
-* 1313804 New: rest-spread-spacing rule (fixes #5391) (#6278) (Kai Cataldo)
-* 61dfe68 Fix: `no-useless-rename` false positive in babel-eslint (fixes #6266) (#6290) (alberto)
-* c78c8cb Build: Remove commit check from appveyor (fixes #6292) (#6294) (alberto)
-* 3e38fc1 Chore: more tests for comments at the end of blocks (refs #6090) (#6273) (Kai Cataldo)
-* 38dccdd Docs: `--no-ignore` disables all forms of ignore (fixes #6260) (#6304) (alberto)
-* bb69380 Fix: no-useless-rename handles ExperimentalRestProperty (fixes #6284) (#6288) (Kevin Partington)
-* fca0679 Update: Improve perf not traversing default ignored dirs (fixes #5679) (#6276) (alberto)
-* 320e8b0 Docs: Describe options in rules under Possible Errors part 4 (#6270) (Mark Pedrotti)
-* 3e052c1 Docs: Mark no-useless-rename as fixable in rules index (#6297) (Dalton Santos)
-
-v2.11.1 - May 30, 2016
-
-* 64b0d0c Fix: failed to parse `/*eslint` comments by colon (fixes #6224) (#6258) (Toru Nagashima)
-* c8936eb Build: Don't check commit count (fixes #5935) (#6263) (Nicholas C. Zakas)
-* 113c1a8 Fix: `max-statements-per-line` false positive at exports (fixes #6264) (#6268) (Toru Nagashima)
-* 03beb27 Fix: `no-useless-rename` false positives (fixes #6266) (#6267) (alberto)
-* fe89037 Docs: Fix rule name in example (#6279) (Kenneth Williams)
-
-v2.11.0 - May 27, 2016
-
-* 77dd2b4 Fix: On --init, print message when package.json is invalid (fixes #6257) (#6261) (Kai Cataldo)
-* 7f60186 Fix: `--ignore-pattern` can't uningnore files (fixes #6127) (#6253) (alberto)
-* fea8fe6 New: no-useless-rename (fixes #6058) (#6249) (Kai Cataldo)
-* b4cff9d Fix: Incorrect object-property-newline behavior (fixes #6207) (#6213) (Rafał Ruciński)
-* 35b4656 Docs: Edit arrow-parens.md to show correct output value (#6245) (Adam Terlson)
-* ee0cd58 Fix: `newline-before-return` shouldn't disallow newlines (fixes #6176) (#6217) (alberto)
-* d4f5526 Fix: `vars-on-top` crashs at export declarations (fixes #6210) (#6220) (Toru Nagashima)
-* 088bda9 New: `unicode-bom` rule to allow or disallow BOM (fixes #5502) (#6230) (Andrew Johnston)
-* 14bfc03 Fix: `comma-dangle` wrong autofix (fixes #6233) (#6235) (Toru Nagashima)
-* cdd65d7 Docs: added examples for arrow-body-style (refs #5498) (#6242) (Tieme van Veen)
-* c10c07f Fix: lost code in autofixing (refs #6233) (#6234) (Toru Nagashima)
-* e6d5b1f Docs: Add rule deprecation section to user guide (fixes #5845) (#6201) (Kai Cataldo)
-* 777941e Upgrade: doctrine to 1.2.2 (fixes #6121) (#6231) (alberto)
-* 74c458d Update: key-spacing rule whitespace fixer (fixes #6167) (#6169) (Ruurd Moelker)
-* 04bd586 New: Disallow use of Object.prototype methods on objects (fixes #2693) (#6107) (Andrew Levine)
-* 53754ec Update: max in `max-statements-per-line` should be >=0 (fixes #6171) (#6172) (alberto)
-* 54d1201 Update: Add treatUndefinedAsUnspecified option (fixes #6026) (#6194) (Kenneth Williams)
-* 18152dd Update: Add checkLoops option to no-constant-condition (fixes #5477) (#6202) (Kai Cataldo)
-* 7644908 Fix: no-multiple-empty-lines BOF and EOF defaults (fixes #6179) (#6180) (Ruurd Moelker)
-* 72335eb Fix: `max-statements-per-line` false positive (fixes #6173, fixes #6153) (#6192) (Toru Nagashima)
-* 9fce04e Fix: `generator-star-spacing` false positive (fixes #6135) (#6168) (Toru Nagashima)
-
-v2.10.2 - May 16, 2016
-
-* bda5de5 Fix: Remove default parser from CLIEngine options (fixes #6182) (#6183) (alberto)
-* e59e5a0 Docs: Describe options in rules under Possible Errors part 3 (#6105) (Mark Pedrotti)
-* 842ab2e Build: Run phantomjs tests using karma (fixes #6128) (#6178) (alberto)
-
-v2.10.1 - May 14, 2016
-
-* 9397135 Fix: `valid-jsdoc` false positive at default parameters (fixes #6097) (#6170) (Toru Nagashima)
-* 2166ad4 Fix: warning & error count in `CLIEngine.getErrorResults` (fixes #6155) (#6157) (alberto)
-* 1e0a652 Fix: ignore empty statements in max-statements-per-line (fixes #6153) (#6156) (alberto)
-* f9ca0d6 Fix: `no-extra-parens` to check for nulls (fixes #6161) (#6164) (Gyandeep Singh)
-* d095ee3 Fix: Parser merge sequence in config (fixes #6158) (#6160) (Gyandeep Singh)
-* f33e49f Fix: `no-return-assign` to check for null tokens (fixes #6159) (#6162) (Gyandeep Singh)
-
-v2.10.0 - May 13, 2016
-
-* 098cd9c Docs: Distinguish examples in rules under Stylistic Issues part 4 (#6136) (Kenneth Williams)
-* 805742c Docs: Clarify JSX option usage (#6132) (Richard Collins)
-* 10b0933 Fix: Optimize no-irregular-whitespace for the common case (fixes #6116) (#6117) (Andres Suarez)
-* 36bec90 Docs: linkify URLs in development-environment.md (#6150) (chrisjshull)
-* 29c401a Docs: Convert rules in index under Removed from list to table (#6091) (Mark Pedrotti)
-* e13e696 Fix: `_` and `$` in isES5Constructor (fixes #6085) (#6094) (Kevin Locke)
-* 67916b9 Fix: `no-loop-func` crashed (fixes #6130) (#6138) (Toru Nagashima)
-* d311a62 Fix: Sort fixes consistently even if they overlap (fixes #6124) (#6133) (alberto)
-* 6294459 Docs: Correct syntax for default ignores and `.eslintignore` example (#6118) (alberto)
-* 067db14 Fix: Replace `assert.deepEqual` by `lodash.isEqual` (fixes #6111) (#6112) (alberto)
-* 52fdf04 Fix: `no-multiple-empty-lines` duplicate errors at BOF (fixes #6113) (#6114) (alberto)
-* e6f56da Docs: Document `--ignore-pattern` (#6120) (alberto)
-* ef739cd Fix: Merge various command line configs at the same time (fixes #6104) (#6108) (Ed Lee)
-* 767da6f Update: add returnAssign option to no-extra-parens (fixes #6036) (#6095) (Kai Cataldo)
-* 06f6252 Build: Use split instead of slice/indexOf for commit check (fixes #6109) (#6110) (Ed Lee)
-* c4fc39b Docs: Update headings of rules under Removed (refs #5774) (#6102) (Mark Pedrotti)
-* 716345f Build: Match rule id at beginning of heading (refs #5774) (#6089) (Mark Pedrotti)
-* 0734967 Update: Add an option to `prefer-const` (fixes #5692) (#6040) (Toru Nagashima)
-* 7941d5e Update: Add autofix for `lines-around-comment` (fixes #5956) (#6062) (alberto)
-* dc538aa Build: Pin proxyquire to ">=1.0.0 <1.7.5" (fixes #6096) (#6100) (alberto)
-* 04563ca Docs: Describe options in rules under Possible Errors part 2 (#6063) (Mark Pedrotti)
-* 5d390b2 Chore: Replace deprecated calls to context - batch 4 (fixes #6029) (#6087) (alberto)
-* 6df4b23 Fix: `no-return-assign` warning nested expressions (fixes #5913) (#6041) (Toru Nagashima)
-* 16fad58 Merge pull request #6088 from eslint/docs-one-var-per-line (alberto)
-* 0b67170 Docs: Correct default for `one-var-declaration-per-line` (fixes #6017) (#6022) (Ed Lee)
-* d40017f Fix: comma-style accounts for parens in array (fixes #6006) (#6038) (Kai Cataldo)
-* 992d9cf Docs: Fix typography/teriminology in indent doc (fixes #6045) (#6044) (Rich Trott)
-* 4ae39d2 Chore: Replace deprecated calls to context - batch 3 (refs #6029) (#6056) (alberto)
-* 8633e4d Update: multipass should not exit prematurely (fixes #5995) (#6048) (alberto)
-* 3c44c2c Update: Adds an avoidQuotes option for object-shorthand (fixes #3366) (#5870) (Chris Sauvé)
-* a9a4652 Fix: throw when rule uses `fix` but `meta.fixable` not set (fixes #5970) (#6043) (Vitor Balocco)
-* ad10106 Docs: Update comma-style docs (#6039) (Kai Cataldo)
-* 388d6f8 Fix: `no-sequences` false negative at arrow expressions (fixes #6082) (#6083) (Toru Nagashima)
-* 8e96064 Docs: Clarify rule example in README since we allow string error levels (#6061) (Kevin Partington)
-* a66bf19 Fix: `lines-around-comment` multiple errors on same line (fixes #5965) (#5994) (alberto)
-* a2cc54e Docs: Organize meta and describe visitor in Working with Rules (#5967) (Mark Pedrotti)
-* ef8cbff Fix: object-shorthand should only lint computed methods (fixes #6015) (#6024) (Kai Cataldo)
-* cd1b057 Chore: Replace deprecated calls to context - batch 2 (refs #6029) (#6049) (alberto)
-* a3a6e06 Update: no-irregal-whitespace in a regular expression (fixes #5840) (#6018) (Linda_pp)
-* 9b9d76c Chore: Replace deprecated calls to context - batch 1 (refs #6029) (#6034) (alberto)
-* dd8bf93 Fix: blockless else in max-statements-per-line (fixes #5926) (#5993) (Glen Mailer)
-* f84eb80 New: Add new rule `object-property-newline` (fixes #5667) (#5933) (Vitor Balocco)
-* d5f4104 Docs: mention parsing errors in strict mode (fixes #5485) (#5991) (Mark Pedrotti)
-* 249732e Docs: Move docs from eslint.github.io (fixes #5964) (#6012) (Nicholas C. Zakas)
-* 4c2de6c Docs: Add example of diff clarity to comma-dangle rule docs (#6035) (Vitor Balocco)
-* 3db2e89 Fix: Do not swallow exceptions in CLIEngine.getFormatter (fixes #5977) (#5978) (Gustav Nikolaj)
-* eb2fb44 Fix: Always ignore defaults unless explicitly passed (fixes #5547) (#5820) (Ian VanSchooten)
-* ab57e94 Docs: Add example of diff clarity to newline-per-chained-call (#5986) (Vitor Balocco)
-* 88bc014 Docs: Update readme info about jshint (#6027) (alberto)
-* a2c15cc Docs: put config example in code block (#6005) (Amos Wenger)
-* a5011cb Docs: Fix a wrong examples' header of `prefer-arrow-callback`. (#6020) (Toru Nagashima)
-* 1484ede Docs: Typo in nodejs-api (#6025) (alberto)
-* ade6a9b Docs: typo: "eslint-disable-line" not "eslint disable-line" (#6019) (Will Day)
-* 2f15354 Fix: Removed false positives of break and continue (fixes #5972) (#6000) (Onur Temizkan)
-
-v2.9.0 - April 29, 2016
-
-* a8a2cd8 Fix: Avoid autoconfig crashes from inline comments (fixes #5992) (#5999) (Ian VanSchooten)
-* 23b00e0 Upgrade: npm-license to 0.3.2 (fixes #5996) (#5998) (alberto)
-* 377167d Upgrade: ignore to 3.1.2 (fixes #5979) (#5988) (alberto)
-* 141b778 Fix: no-control-regex literal handling fixed. (fixes #5737) (#5943) (Efe Gürkan YALAMAN)
-* 577757d Fix: Clarify color option (fixes #5928) (#5974) (Grant Snodgrass)
-* e7e6581 Docs: Update CLA link (#5980) (Gustav Nikolaj)
-* 0be26bc Build: Add nodejs 6 to travis (fixes #5971) (#5973) (Gyandeep Singh)
-* e606523 New: Rule `no-unsafe-finally` (fixes #5808) (#5932) (Onur Temizkan)
-* 42d1ecc Chore: Add metadata to existing rules - Batch 7 (refs #5417) (#5969) (Vitor Balocco)
-* e2ad1ec Update: object-shorthand lints computed methods (fixes #5871) (#5963) (Chris Sauvé)
-* d24516a Chore: Add metadata to existing rules - Batch 6 (refs #5417) (#5966) (Vitor Balocco)
-* 1e7a3ef Fix: `id-match` false positive in property values (fixes #5885) (#5960) (Mike Sherov)
-* 51ddd4b Update: Use process @abstract when processing @return (fixes #5941) (#5945) (Simon Schick)
-* 52a4bea Update: Add autofix for `no-whitespace-before-property` (fixes #5927) (#5951) (alberto)
-* 46e058d Docs: Correct typo in configuring.md (#5957) (Nick S. Plekhanov)
-* 5f8abab Chore: Add metadata to existing rules - Batch 5 (refs #5417) (#5944) (Vitor Balocco)
-* 0562f77 Chore: Add missing newlines to test cases (fixes #5947) (Rich Trott)
-* fc78e78 Chore: Enable quote-props rule in eslint-config-eslint (refs #5188) (#5938) (Gyandeep Singh)
-* 43f6d05 Docs: Update docs to refer to column (#5937) (Sashko Stubailo)
-* 586478e Update: Add autofix for `comma-dangle` (fixes #3805) (#5925) (alberto)
-* a4f9c5a Docs: Distinguish examples in rules under Stylistic Issues part 3 (Kenneth Williams)
-* e7c0737 Chore: Enable no-console rule in eslint-config-eslint (refs #5188) (Kevin Partington)
-* 0023fe6 Build: Add “chore” to commit tags (fixes #5880) (#5929) (Mike Sherov)
-* 25d626a Upgrade: espree 3.1.4 (fixes #5923, fixes #5756) (Kai Cataldo)
-* a01b412 New: Add `no-useless-computed-key` rule (fixes #5402) (Burak Yigit Kaya)
-* 9afb9cb Chore: Remove workaround for espree and escope bugs (fixes #5852) (alberto)
-* 3ffc582 Chore: Update copyright and license info (alberto)
-* 249eb40 Docs: Clarify init sets up local installation (fixes #5874) (Kai Cataldo)
-* 6cd8c86 Docs: Describe options in rules under Possible Errors part 1 (Mark Pedrotti)
-* f842d18 Fix: `no-this-before-super` crash on unreachable paths (fixes #5894) (Toru Nagashima)
-* a02960b Docs: Fix missing delimiter in README links (Kevin Partington)
-* 3a9e72c Docs: Update developer guide with new standards (Nicholas C. Zakas)
-* cb78585 Update: Add `allowUnboundThis` to `prefer-arrow-callback` (fixes #4668) (Burak Yigit Kaya)
-* 02be29f Chore: Remove CLA check from bot (Nicholas C. Zakas)
-* 220713e Chore: Add metadata to existing rules - Batch 4 (refs #5417) (Vitor Balocco)
-* df53414 Chore: Include jQuery Foundation info (Nicholas C. Zakas)
-* f1b2992 Fix: `no-useless-escape` false positive in JSXAttribute (fixes #5882) (Toru Nagashima)
-* 74674ad Docs: Move `sort-imports` to 'ECMAScript 6' (Kenneth Williams)
-* ae69ddb Docs: Fix severity type in example (Kenneth Williams)
-* 19f6fff Update: Autofixing does multiple passes (refs #5329) (Nicholas C. Zakas)
-* 1e4b0ca Docs: Reduce length of paragraphs in rules index (Mark Pedrotti)
-* 8cfe1eb Docs: Fix a wrong option (Zach Orlovsky)
-* 8f6739f Docs: Add alberto as reviewer (alberto)
-* 2ae4938 Docs: Fix message for `inline-config` option (alberto)
-* 089900b Docs: Fix a wrong rule name in an example (Toru Nagashima)
-* c032b41 Docs: Fix emphasis (Toru Nagashima)
-* ae606f0 Docs: Update JSCS info in README (alberto)
-* a9c5323 Fix: Install ESLint on init if not installed (fixes #5833) (Kai Cataldo)
-* ed38358 Docs: Removed incorrect example (James M. Greene)
-* af3113c Docs: Fix config comments in indent docs (Brandon Mills)
-* 2b39461 Update: `commentPattern` option for `default-case` rule (fixes #5803) (Artyom Lvov)
-
-v2.8.0 - April 15, 2016
-
-* a8821a5 Docs: Distinguish examples in rules under Stylistic Issues part 2 (Kenneth Williams)
-* 76913b6 Update: Add metadata to existing rules - Batch 3 (refs #5417) (Vitor Balocco)
-* 34ad8d2 Fix: Check that module.paths exists (fixes #5791) (Nicholas C. Zakas)
-* 37239b1 Docs: Add new members of the team (Ilya Volodin)
-* fb3c2eb Update: allow template literals (fixes #5234) (Jonathan Haines)
-* 5a4a935 Update: Add metadata to existing rules - Batch 2 (refs #5417) (Vitor Balocco)
-* ea2e625 Fix: newline-before-return handles return as first token (fixes #5816) (Kevin Partington)
-* f8db9c9 Update: add nestedBinaryExpressions to no-extra-parens (fixes #3065) (Ilya Volodin)
-* 0045d57 Update: `allowNamedFunctions` in `prefer-arrow-callback` (fixes #5675) (alberto)
-* 19da72a Update: Add metadata to existing rules - Batch 1 (refs #5417) (Vitor Balocco)
-* cc14e43 Fix: `no-fallthrough` empty case with comment (fixes #5799) (alberto)
-* 13c8b14 Fix: LogicalExpression checks for short circuit (fixes #5693) (Vamshi krishna)
-* 73b225e Fix: Document and fix metadata (refs #5417) (Ilya Volodin)
-* 882d199 Docs: Improve options description in `no-redeclare` (alberto)
-* 6a71ceb Docs: Improve options description in `no-params-reassign` (alberto)
-* 24b6215 Update: Include 'typeof' in rule 'no-constant-condition' (fixes #5228) (Vamshi krishna)
-* a959063 Docs: Remove link to deprecated ESLintTester project (refs #3110) (Trey Thomas)
-* 6fd7d82 Update: Change order in `eslint --init` env options (fixes #5742) (alberto)
-* c59d909 Fix: Extra paren check around object arrow bodies (fixes #5789) (Brandon Mills)
-* 6f88546 Docs: Use double quotes for better Win compatibility (fixes #5796) (alberto)
-* 02743d5 Fix: catch self-assignment operators in `no-magic-number` (fixes #4400) (alberto)
-* c94e74e Docs: Make rule descriptions more consistent (Kenneth Williams)
-* 6028252 Docs: Distinguish examples in rules under Stylistic Issues part 1 (Mark Pedrotti)
-* ccd8ca9 Fix: Added property onlyDeclaration to id-match rule (fixes #3488) (Gajus Kuizinas)
-* 6703c02 Update: no-useless-escape / exact locations of errors (fixes #5751) (Onur Temizkan)
-* 3d84b91 Fix: ignore trailing whitespace in template literal (fixes #5786) (Kai Cataldo)
-* b0e6bc4 Update: add allowEmptyCatch option to no-empty (fixes #5800) (Kai Cataldo)
-* f1f1dd7 Docs: Add @pedrottimark as a committer (Brandon Mills)
-* 228f201 Update: `commentPattern` option for `no-fallthrough` rule (fixes #5757) (Artyom Lvov)
-* 41db670 Docs: Clarify disable inline comments (Kai Cataldo)
-* 9c9a295 Docs: Add note about shell vs node glob parameters in cli (alberto)
-* 5308ff9 Docs: Add code backticks to sentence in fixable rules (Mark Pedrotti)
-* 965ec06 Docs: fix the examples for space-before-function-paren. (Craig Silverstein)
-* 2b202fc Update: Add ignore option to space-before-function-parens (fixes #4127) (Craig Silverstein)
-* 24c12ba Fix: improve `constructor-super` errors for literals (fixes #5449) (Toru Nagashima)
-
-v2.7.0 - April 4, 2016
-
-* 134cb1f Revert "Update: adds nestedBinaryExpressions for no-extra-parens rule (fixes #3065)" (Ilya Volodin)
-* 7e80867 Docs: Update sentence in fixable rules (Mark Pedrotti)
-* 1b6d5a3 Update: adds nestedBinaryExpressions for no-extra-parens (fixes #3065) (Nick Fisher)
-* 4f93c32 Docs: Clarify `array-bracket-spacing` with newlines (fixes #5768) (alberto)
-* 161ddac Fix: remove `console.dir` (fixes #5770) (Toru Nagashima)
-* 0c33f6a Fix: indent rule uses wrong node for class indent level (fixes #5764) (Paul O’Shannessy)
-
-v2.6.0 - April 1, 2016
-
-* ce2accd Fix: vars-on-top now accepts exported variables (fixes #5711) (Olmo Kramer)
-* 7aacba7 Update: Deprecate option `maximum` in favor of `max` (fixes #5685) (Vitor Balocco)
-* 5fe6fca Fix: no-useless-escape \B regex escape (fixes #5750) (Onur Temizkan)
-* 9b73ffd Update: `destructuring` option of `prefer-const` rule (fixes #5594) (Toru Nagashima)
-* 8ac9206 Docs: Typo in `sort-imports` (alberto)
-* 12902c5 Fix: valid-jsdoc crash w/ Field & Array Type (fixes #5745) (fixes #5746) (Burak Yigit Kaya)
-* 2c8b65a Docs: Edit examples for a few rules (Mark Pedrotti)
-* d736bc2 Fix: Treat SwitchCase like a block in lines-around-comment (fixes #5718) (Scott O'Hara)
-* 24a61a4 Update: make `no-useless-escape` allowing line breaks (fixes #5689) (Toru Nagashima)
-* 4ecd45e Fix: Ensure proper lookup of config files (fixes #5175, fixes #5468) (Nicholas C. Zakas)
-* 088e26b Fix: Update doctrine to allow hyphens in JSDoc names (fixes #5612) (Kai Cataldo)
-* 692fd5d Upgrade: Old Chalk.JS deprecated method (fixes #5716) (Morris Singer)
-* f59d91d Update: no-param-reassign error msgs (fixes #5705) (Isaac Levy)
-* c1b16cd Fix: Object spread throws error in key-spacing rule. (fixes #5724) (Ziad El Khoury Hanna)
-* 3091613 Docs: Correct explanation about properties (James Monger)
-* cb0f0be Fix: Lint issue with `valid-jsdoc` rule (refs #5188) (Gyandeep Singh)
-* aba1954 Build: Ignore jsdoc folder internally (fixes #5714) (alberto)
-* a35f127 Fix: Lint for eslint project in regards to vars (refs #5188) (Gyandeep Singh)
-* d9ab4f0 Fix: Windows scoped package configs (fixes #5644) (Nicholas C. Zakas)
-* 8d0cd0d Update: Basic valid-jsdoc default parameter support (fixes #5658) (Tom Andrews)
-
-v2.5.3 - March 28, 2016
-
-* 8749ac5 Build: Disable bundling dependencies (fixes #5687) (Nicholas C. Zakas)
-
-v2.5.2 - March 28, 2016
-
-* 1cc7f8e Docs: Remove mention of minimatch for .eslintignore (Ian VanSchooten)
-* 5bd69a9 Docs: Reorder FAQ in README (alberto)
-* 98e6bd9 Fix: Correct default for indentation in `eslint --init` (fixes #5698) (alberto)
-* 679095e Fix: make the default of `options.cwd` in runtime (fixes #5694) (Toru Nagashima)
-* 4f06f2f Docs: Distinguish examples in rules under Best Practices part 2 (Mark Pedrotti)
-* 013a18e Build: Fix bundling script (fixes #5680) (Nicholas C. Zakas)
-* 8c5d954 Docs: Typo fix (István Donkó)
-* 09659d6 Docs: Use string severity (Kenneth Williams)
-* a4ae769 Docs: Manual changelog update for v2.5.1 (Nicholas C. Zakas)
-* c41fab9 Fix: don't use path.extname with undefined value (fixes #5678) (Myles Borins)
-
-v2.5.1 - March 25, 2016
-
-* Build: No functional changes, just republished with a working package.
-
-v2.5.0 - March 25, 2016
-
-* 7021aa9 Fix: lines-around-comment in ESLint repo, part 2 (refs #5188) (Kevin Partington)
-* 095c435 Docs: Remove ES2016 from experimental section of README (Kevin Partington)
-* 646f863 Build: Bundle dependencies in package.json (fixes #5013) (Nicholas C. Zakas)
-* ea06868 Docs: Clarify --ext does not apply to globs (fixes #5452) (Ian VanSchooten)
-* 569c478 Build: Fix phantomjs CI problems (fixes #5666) (alberto)
-* 6022426 Docs: Add link to chat room in README primary links (alberto)
-* 2fbb530 Docs: Add link to "Proposing a Rule Change" in README (alberto)
-* 25bf491 Upgrade: globals 9.x (fixes #5668) (Toru Nagashima)
-* d6f8409 New: Rule - No useless escape (fixes #5460) (Onur Temizkan)
-* 12a43f1 Docs: remove brace expansion from configuring.md (refs #5314) (Jonathan Haines)
-* 92d1749 New: max-statements-per-line (fixes #5424) (Kenneth Williams)
-* aaf324a Fix: missing support for json sub configs (fixes #5413) (Noam Okman)
-* 48ad5fe Update: Add 'caughtErrors' to rule no-unused-vars (fixes #3837) (vamshi)
-* ad90c2b Fix: incorrect config message (fixes #5653) (s0ph1e)
-* a551831 Docs: Distinguish examples in rules under Node.js and CommonJS (Mark Pedrotti)
-* 83cd651 Upgrade: chai to 3.5.0 (fixes #5647) (alberto)
-* 32748dc Fix: `radix` rule false positive at shadowed variables (fixes #5639) (Toru Nagashima)
-* 66db38d Fix: `--no-ignore` should not un-ignore default ignores (fixes #5547) (alberto)
-* e3e06f3 Docs: Distinguish examples in rules under Best Practices part 4 (Mark Pedrotti)
-* a9f0865 Docs: Update no-sequences rule docs for clarity (fixes #5536) (Kai Cataldo)
-* bae7b30 Docs: Add michaelficarra as committer (alberto)
-* e2990e7 Docs: Consistent wording in rules README (alberto)
-* 49b4d2a Docs: Update team list with new members (Ilya Volodin)
-* d0ae66c Update: Allow autoconfiguration for JSX code (fixes #5511) (Ian VanSchooten)
-* 38a0a64 Docs: Clarify `linebreak-style` docs (fixes #5628) (alberto)
-* 4b7305e Fix: Allow default ignored files to be unignored (fixes #5410) (Ian VanSchooten)
-* 4b05ce6 Update: Enforce repo coding conventions via ESLint (refs #5188) (Kevin Partington)
-* 051b255 Docs: Remove or rewrite references to former ecmaFeatures (Mark Pedrotti)
-* 9a22625 Fix: `prefer-const` false positive at non-blocked if (fixes #5610) (Toru Nagashima)
-* b1fd482 Fix: leading comments added from previous node (fixes #5531) (Kai Cataldo)
-* c335650 Docs: correct the no-confusing-arrow docs (Daniel Norman)
-* e94b77d Fix: Respect 'ignoreTrailingComments' in max-len rule (fixes #5563) (Vamshi Krishna)
-* 9289ef8 Fix: handle personal package.json without config (fixes #5496) (Denny Christochowitz)
-* 87d74b2 Fix: `prefer-const` got to not change scopes (refs #5284) (Toru Nagashima)
-* 5a881e7 Docs: Fix typo in code snippet for no-unmodified-loop-condition rule (Chris Rebert)
-* 03037c2 Update: Overrides for space-unary-ops (fixes #5060) (Afnan Fahim)
-* 24d986a Update: replace MD5 hashing of cache files with MurmurHash (fixes #5522) (Michael Ficarra)
-* f405030 Fix: Ensure allowing `await` as a property name (fixes #5564) (Toru Nagashima)
-* aefc90c Fix: `no-useless-constructor` clash (fixes #5573) (Toru Nagashima)
-* 9eaa20d Docs: Fix typo in CLI help message (ryym)
-* a7c3e67 Docs: Invalid json in `configuring.md` (alberto)
-* 4e50332 Docs: Make `prefer-template` examples consistent. (alberto)
-* cfc14a9 Fix: valid-jsdoc correctly checks type union (fixes #5260) (Kai Cataldo)
-* 689cb7d Fix: `quote-props` false positive on certain keys (fixes #5532) (Burak Yigit Kaya)
-* 167a03a Fix: `brace-style` erroneously ignoring certain errors (fixes #5197) (Burak Yigit Kaya)
-* 3133f28 Fix: object-curly-spacing doesn't know types (fixes #5537) (fixes #5538) (Burak Yigit Kaya)
-* d0ca171 Docs: Separate parser and config questions in issue template (Kevin Partington)
-* bc769ca Fix: Improve file path resolution (fixes #5314) (Ian VanSchooten)
-* 9ca8567 Docs: Distinguish examples in rules under Best Practices part 3 (Mark Pedrotti)
-* b9c69f1 Docs: Distinguish examples in rules under Variables part 2 (Mark Pedrotti)
-* c289414 New: `no-duplicate-imports` rule (fixes #3478) (Simen Bekkhus)
-
-v2.4.0 - March 11, 2016
-
-* 97b2466 Fix: estraverse/escope to work with unknowns (fixes #5476) (Nicholas C. Zakas)
-* 641b3f7 Fix: validate the type of severity level (fixes #5499) (Shinnosuke Watanabe)
-* 9ee8869 Docs: no-unused-expressions - add more edge unusable and usable examples (Brett Zamir)
-* 56bf864 Docs: Create parity between no-sequences examples (Brett Zamir)
-* 13ef1c7 New: add `--parser-options` to CLI (fixes #5495) (Jordan Harband)
-* ae1ee54 Docs: fix func-style arrow exception option (Craig Martin)
-* 91852fd Docs: no-lone-blocks - show non-problematic (and problematic) label (Brett Zamir)
-* b34458f Docs: Rearrange rules for better categories (and improve rule summaries) (Brett Zamir)
-* 1198b26 Docs: Minor README clarifications (Brett Zamir)
-* 03e6869 Fix: newline-before-return: bug with comment (fixes #5480) (mustafa)
-* ad100fd Fix: overindent in VariableDeclarator parens or brackets (fixes #5492) (David Greenspan)
-* 9b8e04b Docs: Replace all node references to Node.js which is the official name (Brett Zamir)
-* cc1f2f0 Docs: Minor fixes in no-new-func (Brett Zamir)
-* 6ab81d4 Docs: Distinguish examples in rules under Best Practices part 1 (Mark Pedrotti)
-* 9c6c70c Update: add `allowParens` option to `no-confusing-arrow` (fixes #5332) (Burak Yigit Kaya)
-* 979c096 Docs: Document linebreak-style as fixable. (Afnan Fahim)
-* 9f18a81 Fix: Ignore destructuring assignment in `object-shorthand` (fixes #5488) (alberto)
-* 5d9a798 Docs: README.md, prefer-const; change modified to reassigned (Michiel de Bruijne)
-* 38eb7f1 Fix: key-spacing checks ObjectExpression is multiline (fixes #5479) (Kevin Partington)
-* 9592c45 Fix: `no-unmodified-loop-condition` false positive (fixes #5445) (Toru Nagashima)
-
-v2.3.0 - March 4, 2016
-
-* 1b2c6e0 Update: Proposed no-magic-numbers option: ignoreJSXNumbers (fixes #5348) (Brandon Beeks)
-* 63c0b7d Docs: Fix incorrect environment ref. in Rules in Plugins. (fixes #5421) (Jesse McCarthy)
-* 124c447 Build: Add additional linebreak to docs (fixes #5464) (Ilya Volodin)
-* 0d3831b Docs: Add RuleTester parserOptions migration steps (Kevin Partington)
-* 50f4d5a Fix: extends chain (fixes #5411) (Toru Nagashima)
-* 0547072 Update: Replace getLast() with lodash.last() (fixes #5456) (Jordan Eldredge)
-* 8c29946 Docs: Distinguish examples in rules under Possible Errors part 1 (Mark Pedrotti)
-* 5319b4a Docs: Distinguish examples in rules under Possible Errors part 2 (Mark Pedrotti)
-* 1da2420 Fix: crash when SourceCode object was reused (fixes #5007) (Toru Nagashima)
-* 9e9daab New: newline-before-return rule (fixes #5009) (Kai Cataldo)
-* e1bbe45 Fix: Check space after anonymous generator star (fixes #5435) (alberto)
-* 119e0ed Docs: Distinguish examples in rules under Variables (Mark Pedrotti)
-* 905c049 Fix: `no-undef` false positive at new.target (fixes #5420) (Toru Nagashima)
-* 4a67b9a Update: Add ES7 support (fixes #5401) (Brandon Mills)
-* 89c757d Docs: Replace ecmaFeatures with parserOptions in working-with-rules (Kevin Partington)
-* 804c08e Docs: Add parserOptions to RuleTester section of working-with-rules (Kevin Partington)
-* 1982c50 Docs: Document string option for `no-unused-vars`. (alberto)
-* 4f82b2b Update: Support classes in `padded-blocks` (fixes #5092) (alberto)
-* ed5564f Docs: Specify results of `no-unused-var` with `args` (fixes #5334) (chinesedfan)
-* de0a4ef Fix: `getFormatter` throws an error when called as static (fixes #5378) (cowchimp)
-* 78f7ca9 Fix: Prevent crash from swallowing console.log (fixes #5381) (Ian VanSchooten)
-* 34b648d Fix: remove tests which have invalid syntax (fixes #5405) (Toru Nagashima)
-* 7de5ae4 Docs: Missing allow option in docs (Scott O'Hara)
-* cf14c71 Fix: `no-useless-constructor` rule crashes sometimes (fixes #5290) (Burak Yigit Kaya)
-* 70e3a02 Update: Allow string severity in config (fixes #3626) (Nicholas C. Zakas)
-* 13c7c19 Update: Exclude ES5 constructors from consistent-return (fixes #5379) (Kevin Locke)
-* 784d3bf Fix: Location info in `dot-notation` rule (fixes #5397) (Gyandeep Singh)
-* 6280b2d Update: Support switch statements in padded-blocks (fixes #5056) (alberto)
-* 25a5b2c Fix: Allow irregular whitespace in comments (fixes #5368) (Christophe Porteneuve)
-* 560c0d9 New: no-restricted-globals rule implementation (fixes #3966) (Benoît Zugmeyer)
-* c5bb478 Fix: `constructor-super` false positive after a loop (fixes #5394) (Toru Nagashima)
-* 6c0c4aa Docs: Add Issue template (fixes #5313) (Kai Cataldo)
-* 1170e67 Fix: indent rule doesn't handle constructor instantiation (fixes #5384) (Nate Cavanaugh)
-* 6bc9932 Fix: Avoid magic numbers in rule options (fixes #4182) (Brandon Beeks)
-* 694e1c1 Fix: Add tests to cover default magic number tests (fixes #5385) (Brandon Beeks)
-* 0b5349d Fix: .eslintignore paths should be absolute (fixes #5362) (alberto)
-* 8f6c2e7 Update: Better error message for plugins (refs #5221) (Nicholas C. Zakas)
-* 972d41b Update: Improve error message for rule-tester (fixes #5369) (Jeroen Engels)
-* fe3f6bd Fix: `no-self-assign` false positive at shorthand (fixes #5371) (Toru Nagashima)
-* 2376291 Docs: Missing space in `no-fallthrough` doc. (alberto)
-* 5aedb87 Docs: Add mysticatea as reviewer (Nicholas C. Zakas)
-* 1f9fd10 Update: no-invalid-regexp allows custom flags (fixes #5249) (Afnan Fahim)
-* f1eab9b Fix: Support for dash and slash in `valid-jsdoc` (fixes #1598) (Gyandeep Singh)
-* cd12a4b Fix:`newline-per-chained-call` should only warn on methods (fixes #5289) (Burak Yigit Kaya)
-* 0d1377d Docs: Add missing `symbol` type into valid list (Plusb Preco)
-* 6aa2380 Update: prefer-const; change modified to reassigned (fixes #5350) (Michiel de Bruijne)
-* d1d62c6 Fix: indent check for else keyword with Stroustrup style (fixes #5218) (Gyandeep Singh)
-* 7932f78 Build: Fix commit message validation (fixes #5340) (Nicholas C. Zakas)
-* 1c347f5 Fix: Cleanup temp files from tests (fixes #5338) (Nick)
-* 2f3e1ae Build: Change rules to warnings in perf test (fixes #5330) (Brandon Mills)
-* 36f40c2 Docs: Achieve consistent order of h2 in rule pages (Mark Pedrotti)
-
-v2.2.0 - February 19, 2016
-
-* 45a22b5 Docs: remove esprima-fb from suggested parsers (Henry Zhu)
-* a4d9cd3 Docs: Fix semi rule typo (Brandon Mills)
-* 9d005c0 Docs: Correct option name in `no-implicit-coercion` rule (Neil Kistner)
-* 2977248 Fix: Do not cache `.eslintrc.js` (fixes #5067) (Nick)
-* 211eb8f Fix: no-multi-spaces conflicts with smart tabs (fixes #2077) (Afnan Fahim)
-* 6dc9483 Fix: Crash in `constructor-super` (fixes #5319) (Burak Yigit Kaya)
-* 3f48875 Docs: Fix yield star spacing examples (Dmitriy Lazarev)
-* 4dab76e Docs: Update `preferType` heading to keep code format (fixes #5307) (chinesedfan)
-* 7020b82 Fix: `sort-imports` warned between default and members (fixes #5305) (Toru Nagashima)
-* 2f4cd1c Fix: `constructor-super` and `no-this-before-super` false (fixes #5261) (Toru Nagashima)
-* 59e9c5b New: eslint-disable-next-line (fixes #5206) (Kai Cataldo)
-* afb6708 Fix: `indent` rule forgot about some CallExpressions (fixes #5295) (Burak Yigit Kaya)
-* d18d406 Docs: Update PR creation bot message (fixes #5268) (Nicholas C. Zakas)
-* 0b1cd19 Fix: Ignore parser option if set to default parser (fixes #5241) (Kai Cataldo)
-
-v2.1.0 - February 15, 2016
-
-* 7981ef5 Build: Fix release script (Nicholas C. Zakas)
-* c9c34ea Fix: Skip computed members in `newline-per-chained-call` (fixes #5245) (Burak Yigit Kaya)
-* b32ddad Build: `npm run perf` command should check the exit code (fixes #5279) (Burak Yigit Kaya)
-* 6580d1c Docs: Fix incorrect `api.verify` JSDoc for `config` param (refs #5104) (Burak Yigit Kaya)
-* 1f47868 Docs: Update yield-star-spacing documentation for 2.0.0 (fixes #5272) (Burak Yigit Kaya)
-* 29da8aa Fix: `newline-after-var` crash on a switch statement (fixes #5277) (Toru Nagashima)
-* 86c5a20 Fix: `func-style` should ignore ExportDefaultDeclarations (fixes #5183) (Burak Yigit Kaya)
-* ba287aa Fix: Consolidate try/catches to top levels (fixes #5243) (Ian VanSchooten)
-* 3ef5da1 Docs: Update no-magic-numbers#ignorearrayindexes. (KazuakiM)
-* 0d6850e Update: Allow var declaration at end of block (fixes #5246) (alberto)
-* c1e3a73 Fix: Popular style init handles missing package.json keys (refs #5243) (Brandon Mills)
-* 68c6e22 Docs: fix default value of `keyword-spacing`'s overrides option. (Toru Nagashima)
-* 00fe46f Upgrade: inquirer (fixes #5265) (Bogdan Chadkin)
-* ef729d7 Docs: Remove option that is not being used in max-len rule (Thanos Lefteris)
-* 4a5ddd5 Docs: Fix rule config above examples for require-jsdoc (Thanos Lefteris)
-* c5cbc1b Docs: Add rule config above each example in jsx-quotes (Thanos Lefteris)
-* f0aceba Docs: Correct alphabetical ordering in rule list (Randy Coulman)
-* 1651ffa Docs: update migrating to 2.0.0 (fixes #5232) (Toru Nagashima)
-* 9078537 Fix: `indent` on variable declaration with separate array (fixes #5237) (Burak Yigit Kaya)
-* f8868b2 Docs: Typo fix in consistent-this rule doc fixes #5240 (Nicolas Froidure)
-* 44f6915 Fix: ESLint Bot mentions the wrong person for extra info (fixes #5229) (Burak Yigit Kaya)
-* c612a8e Fix: `no-empty-function` crash (fixes #5227) (Toru Nagashima)
-* ae663b6 Docs: Add links for issue documentation (Nicholas C. Zakas)
-* 717bede Build: Switch to using eslint-release (fixes #5223) (Nicholas C. Zakas)
-* 980e139 Fix: Combine all answers for processAnswers (fixes #5220) (Ian VanSchooten)
-* 1f2a1d5 Docs: Remove inline errors from doc examples (fixes #4104) (Burak Yigit Kaya)
-
-v2.0.0 - February 12, 2016
-
-* cc3a66b Docs: Issue message when more info is needed (Nicholas C. Zakas)
-* 2bc40fa Docs: Simplify hierarchy of headings in rule pages (Mark Pedrotti)
-* 1666254 Docs: Add note about only-whitespace rule for `--fix` (fixes #4774) (Burak Yigit Kaya)
-* 2fa09d2 Docs: Add `quotes` to related section of `prefer-template` (fixes #5192) (Burak Yigit Kaya)
-* 7b12995 Fix: `key-spacing` not enforcing no-space in minimum mode (fixes #5008) (Burak Yigit Kaya)
-* c1c4f4d Breaking: new `no-empty-function` rule (fixes #5161) (Toru Nagashima)
-
-v2.0.0-rc.1 - February 9, 2016
-
-* 4dad82a Update: Adding shared environment for node and browser (refs #5196) (Eli White)
-* b46c893 Fix: Config file relative paths (fixes #5164, fixes #5160) (Nicholas C. Zakas)
-* aa5b2ac Fix: no-whitespace-before-property fixes (fixes #5167) (Kai Cataldo)
-* 4e99924 Update: Replace several dependencies with lodash (fixes #5012) (Gajus Kuizinas)
-* 718dc68 Docs: Remove periods in rules' README for consistency. (alberto)
-* 7a47085 Docs: Correct `arrow-spacing` overview. (alberto)
-* a4cde1b Docs: Clarify global-require inside try/catch (fixes #3834) (Brandon Mills)
-* fd07925 Docs: Clarify docs for api.verify (fixes #5101, fixes #5104) (Burak Yigit Kaya)
-* 413247f New: Add a --print-config flag (fixes #5099) (Christopher Crouzet)
-* efeef42 Update: Implement auto fix for space-in-parens (fixes #5050) (alberto)
-* e07fdd4 Fix: code path analysis and labels (fixes #5171) (Toru Nagashima)
-* 2417bb2 Fix: `no-unmodified-loop-condition` false positive (fixes #5166) (Toru Nagashima)
-* fae1884 Fix: Allow same-line comments in padded-blocks (fixes #5055) (Brandon Mills)
-* a24d8ad Fix: Improve autoconfig logging (fixes #5119) (Ian VanSchooten)
-* e525923 Docs: Correct obvious inconsistencies in rules h2 elements (Mark Pedrotti)
-* 9675b5e Docs: `avoid-escape` does not allow backticks (fixes #5147) (alberto)
-* a03919a Fix: `no-unexpected-multiline` false positive (fixes #5148) (Feross Aboukhadijeh)
-* 74360d6 Docs: Note no-empty applies to empty block statements (fixes #5105) (alberto)
-* 6eeaa3f Build: Remove pending tests (fixes #5126) (Ian VanSchooten)
-* 02c83df Docs: Update docs/rules/no-plusplus.md (Sheldon Griffin)
-* 0c4de5c New: Added "table" formatter (fixes #4037) (Gajus Kuizinas)
-* 0a59926 Update: 'implied strict mode' ecmaFeature (fixes #4832) (Nick Evans)
-* 53a6eb3 Fix: Handle singular case in rule-tester error message (fixes #5141) (Bryan Smith)
-* 97ac91c Build: Increment eslint-config-eslint (Nicholas C. Zakas)
-
-v2.0.0-rc.0 - February 2, 2016
-
-* 973c499 Fix: `sort-imports` crash (fixes #5130) (Toru Nagashima)
-* e64b2c2 Breaking: remove `no-empty-label` (fixes #5042) (Toru Nagashima)
-* 79ebbc9 Breaking: update `eslint:recommended` (fixes #5103) (Toru Nagashima)
-* e1d7368 New: `no-extra-label` rule (fixes #5059) (Toru Nagashima)
-* c83b48c Fix: find ignore file only in cwd (fixes #5087) (Nicholas C. Zakas)
-* 3a24240 Docs: Fix jsdoc param names to match function param names (Thanos Lefteris)
-* 1d79746 Docs: Replace ecmaFeatures setting with link to config page (Thanos Lefteris)
-* e96ffd2 New: `template-curly-spacing` rule (fixes #5049) (Toru Nagashima)
-* 4b02902 Update: Extended no-console rule (fixes #5095) (EricHenry)
-* 757651e Docs: Remove reference to rules enabled by default (fixes #5100) (Brandon Mills)
-* 0d87f5d Docs: Clarify eslint-disable comments only affect rules (fixes #5005) (Brandon Mills)
-* 1e791a2 New: `no-self-assign` rule (fixes #4729) (Toru Nagashima)
-* c706eb9 Fix: reduced `no-loop-func` false positive (fixes #5044) (Toru Nagashima)
-* 3275e86 Update: Add extra aliases to consistent-this rule (fixes #4492) (Zachary Alexander Belford)
-* a227360 Docs: Replace joyent org with nodejs (Thanos Lefteris)
-* b2aedfe New: Rule to enforce newline after each call in the chain (fixes #4538) (Rajendra Patil)
-* d67bfdd New: `no-unused-labels` rule (fixes #5052) (Toru Nagashima)
-
-v2.0.0-beta.3 - January 29, 2016
-
-* 86a3e3d Update: Remove blank lines at beginning of files (fixes #5045) (Jared Sohn)
-* 4fea752 New: Autoconfiguration from source inspection (fixes #3567) (Ian VanSchooten)
-* 519f39f Breaking: Remove deprecated rules (fixes #5032) (Gyandeep Singh)
-* c75ee4a New: Add support for configs in plugins (fixes #3659) (Ilya Volodin)
-* 361377f Fix: `prefer-const` false positive reading before writing (fixes #5074) (Toru Nagashima)
-* ff2551d Build: Improve `npm run perf` command (fixes #5028) (Toru Nagashima)
-* bcca69b Update: add int32Hint option to `no-bitwise` rule (fixes #4873) (Maga D. Zandaqo)
-* e3f2683 Update: config extends dependency lookup (fixes #5023) (Nicholas C. Zakas)
-* a327a06 Fix: Indent rule for allman brace style scenario (fixes #5064) (Gyandeep Singh)
-* afdff6d Fix: `no-extra-bind` false positive (fixes #5058) (Toru Nagashima)
-* c1fad4f Update: add autofix support for spaced-comment (fixes #4969, fixes #5030) (Maga D. Zandaqo)
-* 889b942 Revert "Docs: Update readme for legend describing rules icons (refs #4355)" (Nicholas C. Zakas)
-* b0f21a0 Fix: `keyword-spacing` false positive in template strings (fixes #5043) (Toru Nagashima)
-* 53fa5d1 Fix: `prefer-const` false positive in a loop condition (fixes #5024) (Toru Nagashima)
-* 385d399 Docs: Update readme for legend describing rules icons (Kai Cataldo)
-* 505f1a6 Update: Allow parser to be relative to config (fixes #4985) (Nicholas C. Zakas)
-* 79e8a0b New: `one-var-declaration-per-line` rule (fixes #1622) (alberto)
-* 654e6e1 Update: Check extra Boolean calls in no-extra-boolean-cast (fixes #3650) (Andrew Sutton)
-
-v2.0.0-beta.2 - January 22, 2016
-
-* 3fa834f Docs: Fix formatter links (fixes #5006) (Gyandeep Singh)
-* 54b1bc8 Docs: Fix link in strict.md (fixes #5026) (Nick Evans)
-* e0c5cf7 Upgrade: Espree to 3.0.0 (fixes #5018) (Ilya Volodin)
-* 69f149d Docs: language tweaks (Andres Kalle)
-* 2b33c74 Update: valid-jsdoc to not require @return in constructors (fixes #4976) (Maga D. Zandaqo)
-* 6ac2e01 Docs: Fix description of exported comment (Mickael Jeanroy)
-* 29392f8 New: allow-multiline option on comma-dangle (fixes #4967) (Alberto Gimeno)
-* 05b8cb3 Update: Module overrides all 'strict' rule options (fixes #4936) (Nick Evans)
-* 8470474 New: Add metadata to few test rules (fixes #4494) (Ilya Volodin)
-* ba11c1b Docs: Add Algolia as sponsor to README (Nicholas C. Zakas)
-* b28a19d Breaking: Plugins envs and config removal (fixes #4782, fixes #4952) (Nicholas C. Zakas)
-* a456077 Docs: newline-after-var doesn't allow invalid options. (alberto)
-* 3e6a24e Breaking: Change `strict` default mode to "safe" (fixes #4961) (alberto)
-* 5b96265 Breaking: Update eslint:recommended (fixes #4953) (alberto)
-* 7457a4e Upgrade: glob to 6.x (fixes #4991) (Gyandeep Singh)
-* d3f4bdd Build: Cleanup for code coverage (fixes #4983) (Gyandeep Singh)
-* b8fbaa0 Fix: multiple message in TAP formatter (fixes #4975) (Simon Degraeve)
-* 990f8da Fix: `getNodeByRangeIndex` performance issue (fixes #4989) (Toru Nagashima)
-* 8ac1dac Build: Update markdownlint dependency to 0.1.0 (fixes #4988) (David Anson)
-* 5cd5429 Fix: function expression doc in call expression (fixes #4964) (Tim Schaub)
-* 4173baa Fix: `no-dupe-class-members` false positive (fixes #4981) (Toru Nagashima)
-* 12fe803 Breaking: Supports Unicode BOM (fixes #4878) (Toru Nagashima)
-* 1fc80e9 Build: Increment eslint-config-eslint (Nicholas C. Zakas)
-* e0a9024 Update: Report newline between template tag and literal (fixes #4210) (Rajendra Patil)
-* da3336c Update: Rules should get `sourceType` from Program node (fixes #4960) (Nick Evans)
-* a2ac359 Update: Make jsx-quotes fixable (refs #4377) (Gabriele Petronella)
-* ee1014d Fix: Incorrect error location for object-curly-spacing (fixes #4957) (alberto)
-* b52ed17 Fix: Incorrect error location for space-in-parens (fixes #4956) (alberto)
-* 9c1bafb Fix: Columns of parse errors are off by 1 (fixes #4896) (alberto)
-* 5e4841e New: 'id-blacklist' rule (fixes #3358) (Keith Cirkel)
-* 700b8bc Update: Add "allow" option to allow specific operators (fixes #3308) (Rajendra Patil)
-* d82eeb1 Update: Add describe around rule tester blocks (fixes #4907) (Ilya Volodin)
-* 2967402 Update: Add minimum value to integer values in schema (fixes #4941) (Ilya Volodin)
-* 7b632f8 Upgrade: Globals to ^8.18.0 (fixes #4728) (Gyandeep Singh)
-* 86e6e57 Fix: Incorrect error at EOF for no-multiple-empty-lines (fixes #4917) (alberto)
-* 7f058f3 Fix: Incorrect location for padded-blocks (fixes #4913) (alberto)
-* b3de8f7 Fix: Do not show ignore messages for default ignored files (fixes #4931) (Gyandeep Singh)
-* b1360da Update: Support multiLine and singleLine options (fixes #4697) (Rajendra Patil)
-* 82fbe09 Docs: Small semantic issue in documentation example (fixes #4937) (Marcelo Zarate)
-* 13a4e30 Docs: Formatting inconsistencies (fixes #4912) (alberto)
-* d487013 Update: Option to allow extra parens for cond assign (fixes #3317) (alberto)
-* 0f469b4 Fix: JSDoc for function expression on object property (fixes #4900) (Tim Schaub)
-* c2dee27 Update: Add module tests to no-extra-semi (fixes #4915) (Nicholas C. Zakas)
-* 5a633bf Update: Add `preferType` option to `valid-jsdoc` rule (fixes #3056) (Gyandeep Singh)
-* ebd01b7 Build: Fix version number on release (fixes #4921) (Nicholas C. Zakas)
-* 2d626a3 Docs: Fix typo in changelog (Nicholas C. Zakas)
-* c4c4139 Fix: global-require no longer warns if require is shadowed (fixes #4812) (Kevin Partington)
-* bbf7f27 New: provide config.parser via `parserName` on RuleContext (fixes #3670) (Ben Mosher)
-
-v2.0.0-beta.1 - January 11, 2016
-
-* 6c70d84 Build: Fix prerelease script (fixes #4919) (Nicholas C. Zakas)
-* d5c9435 New: 'sort-imports' rule (refs #3143) (Christian Schuller)
-* a8cfd56 Fix: remove duplicate of eslint-config-eslint (fixes #4909) (Toru Nagashima)
-* 19a9fbb Breaking: `space-before-blocks` ignores after keywords (fixes #1338) (Toru Nagashima)
-* c275b41 Fix: no-extra-parens ExpressionStatement restricted prods (fixes #4902) (Michael Ficarra)
-* b795850 Breaking: don't load ~/.eslintrc when using --config flag (fixes #4881) (alberto)
-* 3906481 Build: Add AppVeyor CI (fixes #4894) (Gyandeep Singh)
-* 6390862 Docs: Fix missing footnote (Yoshiya Hinosawa)
-* e5e06f8 Fix: Jsdoc comment for multi-line function expressions (fixes #4889) (Gyandeep Singh)
-* 7c9be60 Fix: Fix path errors in windows (fixes #4888) (Gyandeep Singh)
-* a1840e7 Fix: gray text was invisible on Solarized Dark theme (fixes #4886) (Jack Leigh)
-* fc9f528 Docs: Modify unnecessary flag docs in quote-props (Matija Marohnić)
-* 186e8f0 Update: Ignore camelcase in object destructuring (fixes #3185) (alberto)
-* 7c97201 Upgrade: doctrine version to 1.1.0 (fixes #4854) (Tim Schaub)
-* ceaf324 New: Add no-new-symbol rule (fixes #4862) (alberto)
-* e2f2b66 Breaking: Remove defaults from `eslint:recommended` (fixes #4809) (Ian VanSchooten)
-* 0b3c01e Docs: Specify default for func-style (fixes #4834) (Ian VanSchooten)
-* 008ea39 Docs: Document default for operator assignment (fixes #4835) (alberto)
-* b566f56 Docs: no-new-func typo (alberto)
-* 1569695 Update: Adds default 'that' for consistent-this (fixes #4833) (alberto)
-* f7b28b7 Docs: clarify `requireReturn` option for valid-jsdoc rule (fixes #4859) (Tim Schaub)
-* 407f329 Build: Fix prerelease script (Nicholas C. Zakas)
-* 688f277 Fix: Set proper exit code for Node > 0.10 (fixes #4691) (Nicholas C. Zakas)
-* 58715e9 Fix: Use single quotes in context.report messages (fixes #4845) (Joe Lencioni)
-* 5b7586b Fix: do not require a @return tag for @interface (fixes #4860) (Tim Schaub)
-* d43f26c Breaking: migrate from minimatch to node-ignore (fixes #2365) (Stefan Grönke)
-* c07ca39 Breaking: merges keyword spacing rules (fixes #3869) (Toru Nagashima)
-* 871f534 Upgrade: Optionator version to 0.8.1 (fixes #4851) (Eric Johnson)
-* 82d4cd9 Update: Add atomtest env (fixes #4848) (Andres Suarez)
-* 9c9beb5 Update: Add "ignore" override for operator-linebreak (fixes #4294) (Rajendra Patil)
-* 9c03abc Update: Add "allowCall" option (fixes #4011) (Rajendra Patil)
-* 29516f1 Docs: fix migration guide for no-arrow-condition rule (Peter Newnham)
-* 2ef7549 Docs: clarify remedy to some prefer-const errors (Turadg Aleahmad)
-* 1288ba4 Update: Add default limit to `complexity` (fixes #4808) (Ian VanSchooten)
-* d3e8179 Fix: env is rewritten by modules (fixes #4814) (Toru Nagashima)
-* fd72aba Docs: Example fix for `no-extra-parens` rule (fixes #3527) (Gyandeep Singh)
-* 315f272 Fix: Change max-warnings type to Int (fixes #4660) (George Zahariev)
-* 5050768 Update: Ask for `commonjs` under config init (fixes #3553) (Gyandeep Singh)
-* 4665256 New: Add no-whitespace-before-property rule (fixes #1086) (Kai Cataldo)
-* f500d7d Fix: allow extending @scope/eslint/file (fixes #4800) (André Cruz)
-* 5ab564e New: 'ignoreArrayIndexes' option for 'no-magic-numbers' (fixes #4370) (Christian Schuller)
-* 97cdb95 New: Add no-useless-constructor rule (fixes #4785) (alberto)
-* b9bcbaf Fix: Bug in no-extra-bind (fixes #4806) (Andres Kalle)
-* 246a6d2 Docs: Documentation fix (Andres Kalle)
-* 9ea6b36 Update: Ignore case in jsdoc tags (fixes #4576) (alberto)
-* acdda24 Fix: ignore argument parens in no-unexpected-multiline (fixes #4658) (alberto)
-* 4931f56 Update: optionally allow bitwise operators (fixes #4742) (Swaagie)
-
-v2.0.0-alpha-2 - December 23, 2015
-
-* Build: Add prerelease script (Nicholas C. Zakas)
-* Update: Allow to omit semi for one-line blocks (fixes #4385) (alberto)
-* Fix: Handle getters and setters in key-spacing (fixes #4792) (Brandon Mills)
-* Fix: ObjectRestSpread throws error in key-spacing rule (fixes #4763) (Ziad El Khoury Hanna)
-* Docs: Typo in generator-star (alberto)
-* Fix: Backtick behavior in quotes rule (fixes #3090) (Nicholas C. Zakas)
-* Fix: Empty schemas forbid any options (fixes #4789) (Brandon Mills)
-* Fix: Remove `isMarkedAsUsed` function name (fixes #4783) (Gyandeep Singh)
-* Fix: support arrow functions in no-return-assign (fixes #4743) (alberto)
-* Docs: Add license header to Working with Rules guide (Brandon Mills)
-* Fix: RuleTester to show parsing errors (fixes #4779) (Nicholas C. Zakas)
-* Docs: Escape underscores in no-path-concat (alberto)
-* Update: configuration for classes in space-before-blocks (fixes #4089) (alberto)
-* Docs: Typo in no-useless-concat (alberto)
-* Docs: fix typos, suggests (molee1905)
-* Docs: Typos in space-before-keywords and space-unary-ops (fixes #4771) (alberto)
-* Upgrade: beefy to ^2.0.0, fixes installation errors (fixes #4760) (Kai Cataldo)
-* Docs: Typo in no-unexpected-multiline (fixes #4756) (alberto)
-* Update: option to ignore top-level max statements (fixes #4309) (alberto)
-* Update: Implement auto fix for semi-spacing rule (fixes #3829) (alberto)
-* Fix: small typos in code examples (Plusb Preco)
-* Docs: Add section on file extensions to user-guide/configuring (adam)
-* Fix: Comma first issue in `indent` (fixes #4739, fixes #3456) (Gyandeep Singh)
-* Fix: no-constant-condition false positive (fixes #4737) (alberto)
-* Fix: Add source property for fatal errors (fixes #3325) (Gyandeep Singh)
-* New: Add a comment length option to the max-len rule (fixes #4665) (Ian)
-* Docs: RuleTester doesn't require any tests (fixes #4681) (alberto)
-* Fix: Remove path analysis from debug log (fixes #4631) (Ilya Volodin)
-* Fix: Set null to property ruleId when fatal is true (fixes #4722) (Sébastien Règne)
-* New: Visual Studio compatible formatter (fixes #4708) (rhpijnacker)
-* New: Add greasemonkey environment (fixes #4715) (silverwind)
-* Fix: always-multiline for comma-dangle import (fixes #4704) (Nicholas C. Zakas)
-* Fix: Check 1tbs non-block else (fixes #4692) (Nicholas C. Zakas)
-* Fix: Apply environment configs last (fixes #3915) (Nicholas C. Zakas)
-* New: `no-unmodified-loop-condition` rule (fixes #4523) (Toru Nagashima)
-* Breaking: deprecate `no-arrow-condition` rule (fixes #4417) (Luke Karrys)
-* Update: Add cwd option for cli-engine (fixes #4472) (Ilya Volodin)
-* New: Add no-confusing-arrow rule (refs #4417) (Luke Karrys)
-* Fix: ensure `ConfigOps.merge` do a deep copy (fixes #4682) (Toru Nagashima)
-* Fix: `no-invalid-this` allows this in static method (fixes #4669) (Toru Nagashima)
-* Fix: Export class syntax for `require-jsdoc` rule (fixes #4667) (Gyandeep Singh)
-* Update: Add "safe" mode to strict (fixes #3306) (Brandon Mills)
-
-v2.0.0-alpha-1 - December 11, 2015
-
-* Breaking: Correct links between variables and references (fixes #4615) (Toru Nagashima)
-* Fix: Update rule tests for parser options (fixes #4673) (Nicholas C. Zakas)
-* Breaking: Implement parserOptions (fixes #4641) (Nicholas C. Zakas)
-* Fix: max-len rule overestimates the width of some tabs (fixes #4661) (Nick Evans)
-* New: Add no-implicit-globals rule (fixes #4542) (Joshua Peek)
-* Update: `no-use-before-define` checks invalid initializer (fixes #4280) (Toru Nagashima)
-* Fix: Use oneValuePerFlag for --ignore-pattern option (fixes #4507) (George Zahariev)
-* New: `array-callback-return` rule (fixes #1128) (Toru Nagashima)
-* Upgrade: Handlebars to >= 4.0.5 for security reasons (fixes #4642) (Jacques Favreau)
-* Update: Add class body support to `indent` rule (fixes #4372) (Gyandeep Singh)
-* Breaking: Remove space-after-keyword newline check (fixes #4149) (Nicholas C. Zakas)
-* Breaking: Treat package.json like the rest of configs (fixes #4451) (Ilya Volodin)
-* Docs: writing mistake (molee1905)
-* Update: Add 'method' option to no-empty (fixes #4605) (Kai Cataldo)
-* Breaking: Remove autofix from eqeqeq (fixes #4578) (Ilya Volodin)
-* Breaking: Remove ES6 global variables from builtins (fixes #4085) (Brandon Mills)
-* Fix: Handle forbidden LineTerminators in no-extra-parens (fixes #4229) (Brandon Mills)
-* Update: Option to ignore constructor Fns object-shorthand (fixes #4487) (Kai Cataldo)
-* Fix: Check YieldExpression argument in no-extra-parens (fixes #4608) (Brandon Mills)
-* Fix: Do not cache `package.json` (fixes #4611) (Spain)
-* Build: Consume no-underscore-dangle allowAfterThis option (fixes #4599) (Kevin Partington)
-* New: Add no-restricted-imports rule (fixes #3196) (Guy Ellis)
-* Docs: no-extra-semi no longer refers to deprecated rule (fixes #4598) (Kevin Partington)
-* Fix: `consistent-return` checks the last (refs #3530, fixes #3373) (Toru Nagashima)
-* Update: add class option to `no-use-before-define` (fixes #3944) (Toru Nagashima)
-* Breaking: Simplify rule schemas (fixes #3625) (Nicholas C. Zakas)
-* Docs: Update docs/rules/no-plusplus.md (Xiangyun Chi)
-* Breaking: added bower_components to default ignore (fixes #3550) (Julian Laval)
-* Fix: `no-unreachable` with the code path (refs #3530, fixes #3939) (Toru Nagashima)
-* Fix: `no-this-before-super` with the code path analysis (refs #3530) (Toru Nagashima)
-* Fix: `no-fallthrough` with the code path analysis (refs #3530) (Toru Nagashima)
-* Fix: `constructor-super` with the code path analysis (refs #3530) (Toru Nagashima)
-* Breaking: Switch to Espree 3.0.0 (fixes #4334) (Nicholas C. Zakas)
-* Breaking: Freeze context object (fixes #4495) (Nicholas C. Zakas)
-* Docs: Add Code of Conduct (fixes #3095) (Nicholas C. Zakas)
-* Breaking: Remove warnings of readonly from `no-undef` (fixes #4504) (Toru Nagashima)
-* Update: allowAfterThis option in no-underscore-dangle (fixes #3435) (just-boris)
-* Fix: Adding options unit tests for --ignore-pattern (refs #4507) (Kevin Partington)
-* Breaking: Implement yield-star-spacing rule (fixes #4115) (Bryan Smith)
-* New: `prefer-rest-params` rule (fixes #4108) (Toru Nagashima)
-* Update: `prefer-const` begins to cover separating init (fixes #4474) (Toru Nagashima)
-* Fix: `no-eval` come to catch indirect eval (fixes #4399, fixes #4441) (Toru Nagashima)
-* Breaking: Default no-magic-numbers to none. (fixes #4193) (alberto)
-* Breaking: Allow empty arrow body (fixes #4411) (alberto)
-* New: Code Path Analysis (fixes #3530) (Toru Nagashima)
-
-v1.10.3 - December 1, 2015
-
-* Docs: Update strict rule docs (fixes #4583) (Nicholas C. Zakas)
-* Docs: Reference .eslintrc.* in contributing docs (fixes #4532) (Kai Cataldo)
-* Fix: Add for-of to `curly` rule (fixes #4571) (Kai Cataldo)
-* Fix: Ignore space before function in array start (fixes #4569) (alberto)
-
-v1.10.2 - November 27, 2015
-
-* Upgrade: escope@3.3.0 (refs #4485) (Nicholas C. Zakas)
-* Upgrade: Pinned down js-yaml to avoid breaking dep (fixes #4553) (alberto)
-* Fix: lines-around-comment with multiple comments (fixes #3509) (alberto)
-* Upgrade: doctrine@0.7.1 (fixes #4545) (Kevin Partington)
-* Fix: Bugfix for eqeqeq autofix (fixes #4540) (Kevin Partington)
-* Fix: Add for-in to `curly` rule (fixes #4436) (Kai Cataldo)
-* Fix: `valid-jsdoc` unneeded require check fix (fixes #4527) (Gyandeep Singh)
-* Fix: `brace-style` ASI fix for if-else condition (fixes #4520) (Gyandeep Singh)
-* Build: Add branch update during release process (fixes #4491) (Gyandeep Singh)
-* Build: Allow revert commits in commit messages (fixes #4452) (alberto)
-* Fix: Incorrect location in no-fallthrough (fixes #4516) (alberto)
-* Fix: `no-spaced-func` had been crashed (fixes #4508) (Toru Nagashima)
-* Fix: Add a RestProperty test of `no-undef` (fixes #3271) (Toru Nagashima)
-* Docs: Load badge from HTTPS (Brian J Brennan)
-* Build: Update eslint bot messages (fixes #4497) (Nicholas C. Zakas)
-
-v1.10.1 - November 20, 2015
-
-* Fix: Revert freezing context object (refs #4495) (Nicholas C. Zakas)
-* 1.10.0 (Nicholas C. Zakas)
-
-v1.10.0 - November 20, 2015
-
-* Docs: Remove dupes from changelog (Nicholas C. Zakas)
-* Update: --init to create extensioned files (fixes #4476) (Nicholas C. Zakas)
-* Docs: Update description of exported comment (fixes #3916) (Nicholas C. Zakas)
-* Docs: Move legacy rules to stylistic (files #4111) (Nicholas C. Zakas)
-* Docs: Clean up description of recommended rules (fixes #4365) (Nicholas C. Zakas)
-* Docs: Fix home directory config description (fixes #4398) (Nicholas C. Zakas)
-* Update: Add class support to `require-jsdoc` rule (fixes #4268) (Gyandeep Singh)
-* Update: return type error in `valid-jsdoc` rule (fixes #4443) (Gyandeep Singh)
-* Update: Display errors at the place where fix should go (fixes #4470) (nightwing)
-* Docs: Fix typo in default `cacheLocation` value (Andrew Hutchings)
-* Fix: Handle comments in block-spacing (fixes #4387) (alberto)
-* Update: Accept array for `ignorePattern` (fixes #3982) (Jesse McCarthy)
-* Update: replace label and break with IIFE and return (fixes #4459) (Ilya Panasenko)
-* Fix: space-before-keywords false positive (fixes #4449) (alberto)
-* Fix: Improves performance (refs #3530) (Toru Nagashima)
-* Fix: Autofix quotes produces invalid javascript (fixes #4380) (nightwing)
-* Docs: Update indent.md (Nathan Brown)
-* New: Disable comment config option (fixes #3901) (Matthew Riley MacPherson)
-* New: Config files with extensions (fixes #4045, fixes #4263) (Nicholas C. Zakas)
-* Revert "Update: Add JSX exceptions to no-extra-parens (fixes #4229)" (Brandon Mills)
-* Update: Add JSX exceptions to no-extra-parens (fixes #4229) (Brandon Mills)
-* Docs: Replace link to deprecated rule with newer rule (Andrew Marshall)
-* Fix: `no-extend-native` crashed at empty defineProperty (fixes #4438) (Toru Nagashima)
-* Fix: Support empty if blocks in lines-around-comment (fixes #4339) (alberto)
-* Fix: `curly` warns wrong location for `else` (fixes #4362) (Toru Nagashima)
-* Fix: `id-length` properties never option (fixes #4347) (Toru Nagashima)
-* Docs: missing close rbracket in example (@storkme)
-* Revert "Update: Allow empty arrow body (fixes #4411)" (Nicholas C. Zakas)
-* Fix: eqeqeq autofix avoids clashes with space-infix-ops (fixes #4423) (Kevin Partington)
-* Docs: Document semi-spacing behaviour (fixes #4404) (alberto)
-* Update: Allow empty arrow body (fixes #4411) (alberto)
-* Fix: Handle comments in comma-spacing (fixes #4389) (alberto)
-* Update: Refactor eslint.verify args (fixes #4395) (Nicholas C. Zakas)
-* Fix: no-undef-init should ignore const (fixes #4284) (Nicholas C. Zakas)
-* Fix: Add the missing "as-needed" docs to the radix rule (fixes #4364) (Michał Gołębiowski)
-* Fix: Display singular/plural version of "line" in message (fixes #4359) (Marius Schulz)
-* Update: Add Popular Style Guides (fixes #4320) (Jamund Ferguson)
-* Fix: eslint.report can be called w/o node if loc provided (fixes #4220) (Kevin Partington)
-* Update: no-implicit-coercion validate AssignmentExpression (fixes #4348) (Ilya Panasenko)
-
-v1.9.0 - November 6, 2015
-
-* Update: Make radix accept a "as-needed" option (fixes #4048) (Michał Gołębiowski)
-* Fix: Update the message to include number of lines (fixes #4342) (Brian Delahunty)
-* Docs: ASI causes problem whether semicolons are used or not (Thai Pangsakulyanont)
-* Fix: Fixer to not overlap ranges among fix objects (fixes #4321) (Gyandeep Singh)
-* Update: Add default to `max-nested-callbacks` (fixes #4297) (alberto)
-* Fix: Check comments in space-in-parens (fixes #4302) (alberto)
-* Update: Add quotes to error messages to improve clarity (fixes #4313) (alberto)
-* Fix: tests failing due to differences in temporary paths (fixes #4324) (alberto)
-* Fix: Make tests compatible with Windows (fixes #4315) (Ian VanSchooten)
-* Update: Extract glob and filesystem logic from cli-engine (fixes #4305) (Ian VanSchooten)
-* Build: Clarify commit-check messages (fixes #4256) (Ian VanSchooten)
-* Upgrade: Upgrade various dependencies (fixes #4303) (Gyandeep Singh)
-* Build: Add node 5 to travis build (fixes #4310) (Gyandeep Singh)
-* Fix: ensure using correct estraverse (fixes #3951) (Toru Nagashima)
-* Docs: update docs about using gitignore (Mateusz Derks)
-* Update: Detect and fix wrong linebreaks (fixes #3981) (alberto)
-* New: Add no-case-declarations rule (fixes #4278) (Erik Arvidsson)
-
-v1.8.0 - October 30, 2015
-
-* Fix: Check for node property before testing type (fixes #4298) (Ian VanSchooten)
-* Docs: Specify 'double' as default for quotes (fixes #4270) (Ian VanSchooten)
-* Fix: Missing errors in space-in-parens (fixes #4257, fixes #3996) (alberto)
-* Docs: fixed typo (Mathieu M-Gosselin)
-* Fix: `cacheLocation` handles paths in windows style. (fixes #4285) (royriojas)
-* Docs: fixed typo (mpal9000)
-* Update: Add support for class in `valid-jsdoc` rule (fixes #4279) (Gyandeep Singh)
-* Update: cache-file accepts a directory. (fixes #4241) (royriojas)
-* Update: Add `maxEOF` to no-multiple-empty-lines (fixes #4235) (Adrien Vergé)
-* Update: fix option for comma-spacing (fixes #4232) (HIPP Edgar (PRESTA EXT))
-* Docs: Fix use of wrong word in configuration doc (Jérémie Astori)
-* Fix: Prepare config before verifying SourceCode (fixes #4230) (Ian VanSchooten)
-* Update: RuleTester come to check AST was not modified (fixes #4156) (Toru Nagashima)
-* Fix: wrong count for 'no-multiple-empty-lines' on last line (fixes #4228) (alberto)
-* Update: Add `allow` option to `no-shadow` rule (fixes #3035) (Gyandeep Singh)
-* Doc: Correct the spelling of Alberto's surname (alberto)
-* Docs: Add alberto as a committer (Gyandeep Singh)
-* Build: Do not stub console in testing (fixes #1328) (Gyandeep Singh)
-* Fix: Check node exists before checking type (fixes #4231) (Ian VanSchooten)
-* Update: Option to exclude afterthoughts from no-plusplus (fixes #4093) (Brody McKee)
-* New: Add rule no-arrow-condition (fixes #3280) (Luke Karrys)
-* Update: Add linebreak style option to eol-last (fixes #4148) (alberto)
-* New: arrow-body-style rule (fixes #4109) (alberto)
-
-v1.7.3 - October 21, 2015
-
-* Fix: Support comma-first style in key-spacing (fixes #3877) (Brandon Mills)
-* Fix: no-magic-numbers: variable declarations (fixes #4192) (Ilya Panasenko)
-* Fix: Support ES6 shorthand in key-spacing (fixes #3678) (Brandon Mills)
-* Fix: `indent` array with memberExpression (fixes #4203) (Gyandeep Singh)
-* Fix: `indent` param function on sameline (fixes #4174) (Gyandeep Singh)
-* Fix: no-multiple-empty-lines fails when empty line at EOF (fixes #4214) (alberto)
-* Fix: `comma-dangle` false positive (fixes #4200) (Nicholas C. Zakas)
-* Fix: `valid-jsdoc` prefer problem (fixes #4205) (Nicholas C. Zakas)
-* Docs: Add missing single-quote (Kevin Lamping)
-* Fix: correct no-multiple-empty-lines at EOF (fixes #4140) (alberto)
-
-v1.7.2 - October 19, 2015
-
-* Fix: comma-dangle confused by parens (fixes #4195) (Nicholas C. Zakas)
-* Fix: no-mixed-spaces-and-tabs (fixes #4189, fixes #4190) (alberto)
-* Fix: no-extend-native disallow using Object.properties (fixes #4180) (Nathan Woltman)
-* Fix: no-magic-numbers should ignore Number.parseInt (fixes #4167) (Henry Zhu)
-
-v1.7.1 - October 16, 2015
-
-* Fix: id-match schema (fixes #4155) (Nicholas C. Zakas)
-* Fix: no-magic-numbers should ignore parseInt (fixes #4167) (Nicholas C. Zakas)
-* Fix: `indent` param function fix (fixes #4165, fixes #4164) (Gyandeep Singh)
-
-v1.7.0 - October 16, 2015
-
-* Fix: array-bracket-spacing for empty array (fixes #4141) (alberto)
-* Fix: `indent` arrow function check fix (fixes #4142) (Gyandeep Singh)
-* Update: Support .js files for config (fixes #3102) (Gyandeep Singh)
-* Fix: Make eslint-config-eslint work (fixes #4145) (Nicholas C. Zakas)
-* Fix: `prefer-arrow-callback` had been wrong at arguments (fixes #4095) (Toru Nagashima)
-* Docs: Update various rules docs (Nicholas C. Zakas)
-* New: Create eslint-config-eslint (fixes #3525) (Nicholas C. Zakas)
-* Update: RuleTester allows string errors in invalid cases (fixes #4117) (Kevin Partington)
-* Docs: Reference no-unexpected-multiline in semi (fixes #4114) (alberto)
-* Update: added exceptions to `lines-around-comment` rule. (fixes #2965) (Mathieu M-Gosselin)
-* Update: Add `matchDescription` option to `valid-jsdoc` (fixes #2449) (Gyandeep Singh)
-* Fix: check for objects or arrays in array-bracket-spacing (fixes #4083) (alberto)
-* Docs: Alphabetize Rules lists (Kenneth Chung)
-* Fix: message templates fail when no parameters are passed (fixes #4080) (Ilya Volodin)
-* Fix: `indent` multi-line function call (fixes #4073, fixes #4075) (Gyandeep Singh)
-* Docs: Improve comma-dangle documentation (Gilad Peleg)
-* Fix: no-mixed-tabs-and-spaces fails with some comments (fixes #4086) (alberto)
-* Fix: `semi` to check for do-while loops (fixes #4090) (Gyandeep Singh)
-* Build: Fix path related failures on Windows in tests (fixes #4061) (Burak Yigit Kaya)
-* Fix: `no-unused-vars` had been missing some parameters (fixes #4047) (Toru Nagashima)
-* Fix: no-mixed-spaces-and-tabs with comments and templates (fixes #4077) (alberto)
-* Update: Add `allow` option for `no-underscore-dangle` rule (fixes #2135) (Gyandeep Singh)
-* Update: `allowArrowFunctions` option for `func-style` rule (fixes #1897) (Gyandeep Singh)
-* Fix: Ignore template literals in no-mixed-tabs-and-spaces (fixes #4054) (Nicholas C. Zakas)
-* Build: Enable CodeClimate (fixes #4068) (Nicholas C. Zakas)
-* Fix: `no-cond-assign` had needed double parens in `for` (fixes #4023) (Toru Nagashima)
-* Update: Ignore end of function in newline-after-var (fixes #3682) (alberto)
-* Build: Performance perf to not ignore jshint file (refs #3765) (Gyandeep Singh)
-* Fix: id-match bug incorrectly errors on `NewExpression` (fixes #4042) (Burak Yigit Kaya)
-* Fix: `no-trailing-spaces` autofix to handle linebreaks (fixes #4050) (Gyandeep Singh)
-* Fix: renamed no-magic-number to no-magic-numbers (fixes #4053) (Vincent Lemeunier)
-* New: add "consistent" option to the "curly" rule (fixes #2390) (Benoît Zugmeyer)
-* Update: Option to ignore for loops in init-declarations (fixes #3641) (alberto)
-* Update: Add webextensions environment (fixes #4051) (Blake Winton)
-* Fix: no-cond-assign should report assignment location (fixes #4040) (alberto)
-* New: no-empty-pattern rule (fixes #3668) (alberto)
-* Upgrade: Upgrade globals to 8.11.0 (fixes #3599) (Burak Yigit Kaya)
-* Docs: Re-tag JSX code fences (fixes #4020) (Brandon Mills)
-* New: no-magic-number rule (fixes #4027) (Vincent Lemeunier)
-* Docs: Remove list of users from README (fixes #3881) (Brandon Mills)
-* Fix: `no-redeclare` and `no-sahadow` for builtin globals (fixes #3971) (Toru Nagashima)
-* Build: Add `.eslintignore` file for the project (fixes #3765) (Gyandeep Singh)
-
-v1.6.0 - October 2, 2015
-
-* Fix: cache is basically not working (fixes #4008) (Richard Hansen)
-* Fix: a test failure on Windows (fixes #3968) (Toru Nagashima)
-* Fix: `no-invalid-this` had been missing globals in node (fixes #3961) (Toru Nagashima)
-* Fix: `curly` with `multi` had false positive (fixes #3856) (Toru Nagashima)
-* Build: Add load performance check inside perf function (fixes #3994) (Gyandeep Singh)
-* Fix: space-before-keywords fails with super keyword (fixes #3946) (alberto)
-* Fix: CLI should not fail on account of ignored files (fixes #3978) (Dominic Barnes)
-* Fix: brace-style rule incorrectly flagging switch (fixes #4002) (Aparajita Fishman)
-* Update: Implement auto fix for space-unary-ops rule (fixes #3976) (alberto)
-* Update: Implement auto fix for computed-property-spacing (fixes #3975) (alberto)
-* Update: Implement auto fix for no-multi-spaces rule (fixes #3979) (alberto)
-* Fix: Report shorthand method names in complexity rule (fixes #3955) (Tijn Kersjes)
-* Docs: Add note about typeof check for isNaN (fixes #3985) (Daniel Lo Nigro)
-* Update: ESLint reports parsing errors with clear prefix. (fixes #3555) (Kevin Partington)
-* Build: Update markdownlint dependency (fixes #3954) (David Anson)
-* Update: `no-mixed-require` to have non boolean option (fixes #3922) (Gyandeep Singh)
-* Fix: trailing spaces auto fix to check for line breaks (fixes #3940) (Gyandeep Singh)
-* Update: Add `typeof` option to `no-undef` rule (fixes #3684) (Gyandeep Singh)
-* Docs: Fix explanation and typos for accessor-pairs (alberto)
-* Docs: Fix typos for camelcase (alberto)
-* Docs: Fix typos for max-statements (Danny Guo)
-* Update: Implement auto fix for object-curly-spacing (fixes #3857) (alberto)
-* Update: Implement auto fix for array-bracket-spacing rule (fixes #3858) (alberto)
-* Fix: Add schema to `global-require` rule (fixes #3923) (Gyandeep Singh)
-* Update: Apply lazy loading for rules (fixes #3930) (Gyandeep Singh)
-* Docs: Fix typo for arrow-spacing (Danny Guo)
-* Docs: Fix typos for wrap-regex (Danny Guo)
-* Docs: Fix explanation for space-before-keywords (Danny Guo)
-* Docs: Fix typos for operator-linebreak (Danny Guo)
-* Docs: Fix typos for callback-return (Danny Guo)
-* Fix: no-trailing-spaces autofix to account for blank lines (fixes #3912) (Gyandeep Singh)
-* Docs: Fix example in no-negated-condition.md (fixes #3908) (alberto)
-* Update:warn message use @return when prefer.returns=return (fixes #3889) (闲耘™)
-* Update: Implement auto fix for generator-star-spacing rule (fixes #3873) (alberto)
-* Update: Implement auto fix for arrow-spacing rule (fixes #3860) (alberto)
-* Update: Implement auto fix for block-spacing rule (fixes #3859) (alberto)
-* Fix: Support allman style for switch statement (fixes #3903) (Gyandeep Singh)
-* New: no-negated-condition rule (fixes #3740) (alberto)
-* Docs: Fix typo in blog post template (Nicholas C. Zakas)
-* Update: Add env 'nashorn' to support Java 8 Nashorn Engine (fixes #3874) (Benjamin Winterberg)
-* Docs: Prepare for rule doc linting (refs #2271) (Ian VanSchooten)
-
-v1.5.1 - September 22, 2015
-
-* Fix: valid-jsdoc fix for param with properties (fixes #3476) (Gyandeep Singh)
-* Fix: valid-jsdoc error with square braces (fixes #2270) (Gyandeep Singh)
-* Upgrade: `doctrine` to 0.7.0 (fixes #3891) (Gyandeep Singh)
-* Fix: `space-before-keywords` had been wrong on getters (fixes #3854) (Toru Nagashima)
-* Fix: `no-dupe-args` had been wrong for nested destructure (fixes #3867) (Toru Nagashima)
-* Docs: io.js is the new Node.js (thefourtheye)
-* Docs: Fix method signature on working-with-rules docs (fixes #3862) (alberto)
-* Docs: Add related ternary links (refs #3835) (Ian VanSchooten)
-* Fix: don’t ignore config if cwd is the home dir (fixes #3846) (Mathias Schreck)
-* Fix: `func-style` had been warning arrows with `this` (fixes #3819) (Toru Nagashima)
-* Fix: `space-before-keywords`; allow opening curly braces (fixes #3789) (Marko Raatikka)
-* Build: Fix broken .gitattributes generation (fixes #3566) (Nicholas C. Zakas)
-* Build: Fix formatter docs generation (fixes #3847) (Nicholas C. Zakas)
-
-v1.5.0 - September 18, 2015
-
-* Fix: invalidate cache when config changes. (fixes #3770) (royriojas)
-* Fix: function body indent issues (fixes #3614, fixes #3799) (Gyandeep Singh)
-* Update: Add configuration option to `space-before-blocks` (fixes #3758) (Phil Vargas)
-* Fix: space checking between tokens (fixes #2211) (Nicholas C. Zakas)
-* Fix: env-specified ecmaFeatures had been wrong (fixes #3735) (Toru Nagashima)
-* Docs: Change example wording from warnings to problems (fixes #3676) (Ian VanSchooten)
-* Build: Generate formatter example docs (fixes #3560) (Ian VanSchooten)
-* New: Add --debug flag to CLI (fixes #2692) (Nicholas C. Zakas)
-* Docs: Update no-undef-init docs (fixes #3170) (Nicholas C. Zakas)
-* Docs: Update no-unused-expressions docs (fixes #3685) (Nicholas C. Zakas)
-* Docs: Clarify node types in no-multi-spaces (fixes #3781) (Nicholas C. Zakas)
-* Docs: Update new-cap docs (fixes #3798) (Nicholas C. Zakas)
-* Fix: `space-before-blocks` had conflicted `arrow-spacing` (fixes #3769) (Toru Nagashima)
-* Fix: `comma-dangle` had not been checking imports/exports (fixes #3794) (Toru Nagashima)
-* Fix: tests fail due to differences in temporary paths. (fixes #3778) (royriojas)
-* Fix: Directory ignoring should work (fixes #3812) (Nicholas C. Zakas)
-* Fix: Ensure **/node_modules works in ignore files (fixes #3788) (Nicholas C. Zakas)
-* Update: Implement auto fix for `space-infix-ops` rule (fixes #3801) (Gyandeep Singh)
-* Fix: `no-warning-comments` can't be set via config comment (fixes #3619) (Burak Yigit Kaya)
-* Update: `key-spacing` should allow 1+ around colon (fixes #3363) (Burak Yigit Kaya)
-* Fix: false alarm of semi-spacing with semi set to never (fixes #1983) (Chen Yicai)
-* Fix: Ensure ./ works correctly with CLI (fixes #3792) (Nicholas C. Zakas)
-* Docs: add more examples + tests for block-scoped-var (fixes #3791) (JT)
-* Update: Implement auto fix for `indent` rule (fixes #3734) (Gyandeep Singh)
-* Fix: `space-before-keywords` fails to handle some cases (fixes #3756) (Marko Raatikka)
-* Docs: Add if-else example (fixes #3722) (Ian VanSchooten)
-* Fix: jsx-quotes exception for attributes without value (fixes #3793) (Mathias Schreck)
-* Docs: Fix closing code fence on cli docs (Ian VanSchooten)
-* Update: Implement auto fix for `space-before-blocks` rule (fixes #3776) (Gyandeep Singh)
-* Update: Implement auto fix for `space-after-keywords` rule (fixes #3773) (Gyandeep Singh)
-* Fix: `semi-spacing` had conflicted with `block-spacing` (fixes #3721) (Toru Nagashima)
-* Update: Implement auto fix for `space-before-keywords` rule (fixes #3771) (Gyandeep Singh)
-* Update: auto fix for space-before-function-paren rule (fixes #3766) (alberto)
-* Update: Implement auto fix for `no-extra-semi` rule (fixes #3745) (Gyandeep Singh)
-* Update: Refactors the traversing logic (refs #3530) (Toru Nagashima)
-* Update: Implement auto fix for `space-return-throw-case` (fixes #3732) (Gyandeep Singh)
-* Update: Implement auto fix for `no-spaced-func` rule (fixes #3728) (Gyandeep Singh)
-* Update: Implement auto fix for `eol-last` rule (fixes #3725) (Gyandeep Singh)
-* Update: Implement auto fix for `no-trailing-spaces` rule (fixes #3723) (Gyandeep Singh)
-
-v1.4.3 - September 15, 2015
-
-* Fix: Directory ignoring should work (fixes #3812) (Nicholas C. Zakas)
-* Fix: jsx-quotes exception for attributes without value (fixes #3793) (Mathias Schreck)
-
-v1.4.2 - September 15, 2015
-
-* Fix: Ensure **/node_modules works in ignore files (fixes #3788) (Nicholas C. Zakas)
-* Fix: Ensure ./ works correctly with CLI (fixes #3792) (Nicholas C. Zakas)
-
-v1.4.1 - September 11, 2015
-
-* Fix: CLIEngine default cache parameter name (fixes #3755) (Daniel G. Taylor)
-* Fix: Glob pattern from .eslintignore not applied (fixes #3750) (Burak Yigit Kaya)
-* Fix: Skip JSDoc from NewExpression (fixes #3744) (Nicholas C. Zakas)
-* Docs: Shorten and simplify autocomment for new issues (Nicholas C. Zakas)
-
-v1.4.0 - September 11, 2015
-
-* Docs: Add new formatters to API docs (Ian VanSchooten)
-* New: Implement autofixing (fixes #3134) (Nicholas C. Zakas)
-* Fix: Remove temporary `"allow-null"` (fixes #3705) (Toru Nagashima)
-* Fix: `no-unused-vars` had been crashed at `/*global $foo*/` (fixes #3714) (Toru Nagashima)
-* Build: check-commit now checks commit message length. (fixes #3706) (Kevin Partington)
-* Fix: make getScope acquire innermost scope (fixes #3700) (voideanvalue)
-* Docs: Fix spelling mistake (domharrington)
-* Fix: Allow whitespace in rule message parameters. (fixes #3690) (Kevin Partington)
-* Fix: Eqeqeq rule with no option does not warn on 'a == null' (fixes #3699) (fediev)
-* Fix: `no-unused-expressions` with `allowShortCircuit` false positive if left has no effect (fixes #3675) (Toru Nagashima)
-* Update: Add Node 4 to travis builds (fixes #3697) (Ian VanSchooten)
-* Fix: Not check for punctuator if on same line as last var (fixes #3694) (Gyandeep Singh)
-* Docs: Make `quotes` docs clearer (fixes #3646) (Nicholas C. Zakas)
-* Build: Increase mocha timeout (fixes #3692) (Nicholas C. Zakas)
-* Fix: `no-extra-bind` to flag all arrow funcs (fixes #3672) (Nicholas C. Zakas)
-* Docs: Update README with release and sponsor info (Nicholas C. Zakas)
-* Fix: `object-curly-spacing` had been crashing on an empty object pattern (fixes #3658) (Toru Nagashima)
-* Fix: `no-extra-parens` false positive at IIFE with member accessing (fixes #3653) (Toru Nagashima)
-* Fix: `comma-dangle` with `"always"`/`"always-multiline"` false positive after a rest element (fixes #3627) (Toru Nagashima)
-* New: `jsx-quotes` rule (fixes #2011) (Mathias Schreck)
-* Docs: Add linting for second half of rule docs (refs #2271) (Ian VanSchooten)
-* Fix: `no-unused-vars` had not shown correct locations for `/*global` (fixes #3617) (Toru Nagashima)
-* Fix: `space-after-keywords` not working for `catch` (fixes #3654) (Burak Yigit Kaya)
-* Fix: Incorrectly warning about ignored files (fixes #3649) (Burak Yigit Kaya)
-* Fix: Indent rule VariableDeclarator doesn't apply to arrow functions (fixes #3661) (Burak Yigit Kaya)
-* Upgrade: Consuming handlebars@^4.0.0 (fixes #3632) (Kevin Partington)
-* Docs: Fixing typos in plugin processor section. (fixes #3648) (Kevin Partington)
-* Fix: Invalid env keys would cause an unhandled exception.(fixes #3265) (Ray Booysen)
-* Docs: Fixing broken link in documentation (Ilya Volodin)
-* Update: Check for default assignment in no-unneeded-ternary (fixes #3232) (cjihrig)
-* Fix: `consistent-as-needed` mode with `keyword: true` (fixes #3636) (Alex Guerrero)
-* New: Implement cache in order to only operate on changed files since previous run. (fixes #2998) (Roy Riojas)
-* Update: Grouping related CLI options. (fixes #3612) (Kevin Partington)
-* Update: Using @override does not require @param or @returns (fixes #3629) (Whitney Young)
-* Docs: Use eslint-env in no-undef (fixes #3616) (Ian VanSchooten)
-* New: `require-jsdoc` rule (fixes #1842) (Gyandeep Singh)
-* New: Support glob path on command line (fixes #3402) (Burak Yigit Kaya)
-* Update: Short circuit and ternary support in no-unused-expressions (fixes #2733) (David Warkentin)
-* Docs: Replace to npmjs.com (Ryuichi Okumura)
-* Fix: `indent` should only indent chain calls if the first call is single line (fixes #3591) (Burak Yigit Kaya)
-* Fix: `quote-props` should not crash for object rest spread syntax (fixes #3595) (Joakim Carlstein)
-* Update: Use `globals` module for the `commonjs` globals (fixes #3606) (Sindre Sorhus)
-* New: `no-restricted-syntax` rule to forbid certain syntax (fixes #2422) (Burak Yigit Kaya)
-* Fix: `no-useless-concat` false positive at numbers (fixes #3575, fixes #3589) (Toru Nagashima)
-* New: Add --max-warnings flag to CLI (fixes #2769) (Kevin Partington)
-* New: Add `parser` as an option (fixes #3127) (Gyandeep Singh)
-* New: `space-before-keywords` rule (fixes #1631) (Marko Raatikka)
-* Update: Allowing inline comments to disable eslint rules (fixes #3472) (Whitney Young)
-* Docs: Including for(;;) as valid case in no-constant-condition (Kevin Partington)
-* Update: Add quotes around the label in `no-redeclare` error messages (fixes #3583) (Ian VanSchooten)
-* Docs: correct contributing URL (Dieter Luypaert)
-* Fix: line number for duplicate object keys error (fixes #3573) (Elliot Lynde)
-* New: global-require rule (fixes #2318) (Jamund Ferguson)
-
-v1.3.1 - August 29, 2015
-
-* Fix: `indent` to not crash on empty files (fixes #3570) (Gyandeep Singh)
-* Fix: Remove unused config file (fixes #2227) (Gyandeep Singh)
-
-v1.3.0 - August 28, 2015
-
-* Build: Autogenerate release blog post (fixes #3562) (Nicholas C. Zakas)
-* New: `no-useless-concat` rule (fixes #3506) (Henry Zhu)
-* Update: Add `keywords` flag to `consistent-as-needed` mode in `quote-props` (fixes #3532) (Burak Yigit Kaya)
-* Update: adds `numbers` option to quote-props (fixes #2914) (Jose Roberto Vidal)
-* Fix: `quote-props` rule should ignore computed and shorthand properties (fixes #3557) (fixes #3544) (Burak Yigit Kaya)
-* Docs: Add config comments for rule examples 'accessor-pairs' to 'no-extra-semi' (refs #2271) (Ian VanSchooten)
-* Update: Return to accept `undefined` type (fixes #3382) (Gyandeep Singh)
-* New: Added HTML formatter (fixes #3505) (Julian Laval)
-* Fix: check space after yield keyword in space-unary-ops (fixes #2707) (Mathias Schreck)
-* Docs: (curly) Fix broken code in example (Kent C. Dodds)
-* Update: Quote var name in `no-unused-vars` error messages (refs #3526) (Burak Yigit Kaya)
-* Update: Move methods to SourceCode (fixes #3516) (Nicholas C. Zakas)
-* Fix: Don't try too hard to find fault in `no-implicit-coercion` (refs #3402) (Burak Yigit Kaya)
-* Fix: Detect ternary operator in operator-linebreak rule (fixes #3274) (Burak Yigit Kaya)
-* Docs: Clearer plugin rule configuration (fixes #2022) (Nicholas C. Zakas)
-* Update: Add quotes around the label in `no-empty-label` error reports (fixes #3526) (Burak Yigit Kaya)
-* Docs: Turn off Liquid in example (Nicholas C. Zakas)
-* Docs: Mention CommonJS along with Node.js (fixes #3388) (Nicholas C. Zakas)
-* Docs: Make it clear which rules are recommended (fixes #3398) (Nicholas C. Zakas)
-* Docs: Add links to JSON Schema resources (fixes #3411) (Nicholas C. Zakas)
-* Docs: Add more info to migration guide (fixes #3439) (Nicholas C. Zakas)
-* Fix: ASI indentation issue (fixes #3514) (Burak Yigit Kaya)
-* Fix: Make `no-implicit-coercion` smarter about numerical expressions (fixes #3510) (Burak Yigit Kaya)
-* Fix: `prefer-template` had not been handling TemplateLiteral as literal node (fixes #3507) (Toru Nagashima)
-* Update: `newline-after-var` Allow comment + blank after var (fixes #2852) (Ian VanSchooten)
-* Update: Add `unnecessary` option to `quote-props` (fixes #3381) (Burak Yigit Kaya)
-* Fix: `indent` shouldn't check the last line unless it is a punctuator (fixes #3498) (Burak Yigit Kaya)
-* Fix: `indent` rule does not indent when doing multi-line chain calls (fixes #3279) (Burak Yigit Kaya)
-* Fix: sort-vars rule fails when memo is undefined (fixes #3474) (Burak Yigit Kaya)
-* Fix: `brace-style` doesn't report some closing brace errors (fixes #3486) (Burak Yigit Kaya)
-* Update: separate options for block and line comments in `spaced-comment` rule (fixes #2897) (Burak Yigit Kaya)
-* Fix: `indent` does not check FunctionDeclaration nodes properly (fixes #3173) (Burak Yigit Kaya)
-* Update: Added "properties" option to `id-length` rule to ignore property names. (fixes #3450) (Mathieu M-Gosselin)
-* Update: add new ignore pattern options to no-unused-vars (fixes #2321) (Mathias Schreck)
-* New: Protractor environment (fixes #3457) (James Whitney)
-* Docs: Added section to shareable config (Gregory Waxman)
-* Update: Allow pre-parsed code (fixes #1025, fixes #948) (Nicholas C. Zakas)
-
-v1.2.1 - August 20, 2015
-
-* Fix: "key-spacing" crashes eslint on object literal shorthand properties (fixes #3463) (Burak Yigit Kaya)
-* Fix: ignore leading space check for `null` elements in comma-spacing (fixes #3392) (Mathias Schreck)
-* Fix: `prefer-arrow-callback` false positive at recursive functions (fixes #3454) (Toru Nagashima)
-* Fix: one-var rule doesn’t have default options (fixes #3449) (Burak Yigit Kaya)
-* Fix: Refactor `no-duplicate-case` to be simpler and more efficient (fixes #3440) (Burak Yigit Kaya)
-* Docs: Fix trailing spaces in README (Nicholas C. Zakas)
-* Docs: Update gyandeeps and add byk (Nicholas C. Zakas)
-* Docs: Update plugins documentation for 1.0.0 (Nicholas C. Zakas)
-* Docs: `object-curly-spacing` doc is inaccurate about exceptions (Burak Yigit Kaya)
-* Fix: `object-curly-spacing` shows the incorrect column for opening brace (fixes #3438) (Burak Yigit Kaya)
-
-v1.2.0 - August 18, 2015
-
-* Update: add support for semicolon in comma-first setup in indent rule (fixes #3423) (Burak Yigit Kaya)
-* Docs: better JSDoc for indent rule (Burak Yigit Kaya)
-* Docs: Document the second argument of `CLIEngine.executeOnText()` (Sindre Sorhus)
-* New: `no-dupe-class-members` rule (fixes #3294) (Toru Nagashima)
-* Fix: exclude `AssignmentExpression` and `Property` nodes from extra indentation on first line (fixes #3391) (Burak Yigit Kaya)
-* Update: Separate indent options for var, let and const (fixes #3339) (Burak Yigit Kaya)
-* Fix: Add AssignmentPattern to space-infix-ops (fixes #3380) (Burak Yigit Kaya)
-* Docs: Fix typo: exception label (tienslebien)
-* Update: Clean up tests for CLI config support (refs #2543) (Gyandeep Singh)
-* New: `block-spacing` rule (fixes #3303) (Toru Nagashima)
-* Docs: Update docs for no-iterator (fixes #3405) (Nicholas C. Zakas)
-* Upgrade: bump `espree` dependency to `2.2.4` (fixes #3403) (Burak Yigit Kaya)
-* Fix: false positive on switch 'no duplicate case', (fixes #3408) (Cristian Carlesso)
-* Fix: `valid-jsdoc` test does not recognize aliases for `@param` (fixes #3399) (Burak Yigit Kaya)
-* New: enable `-c` flag to accept a shareable config (fixes #2543) (Shinnosuke Watanabe)
-* Fix: Apply plugin given in CLI (fixes #3383) (Ian VanSchooten)
-* New: Add commonjs environment (fixes #3377) (Nicholas C. Zakas)
-* Docs: Update no-unused-var docs (Nicholas C. Zakas)
-* Fix: trailing commas in object-curly-spacing for import/export (fixes #3324) (Henry Zhu)
-* Update: Make `baseConfig` to behave as other config options (fixes #3371) (Gyandeep Singh)
-* Docs: Add "Compatibility" section to linebreak-style (Vitor Balocco)
-* New: `prefer-arrow-callback` rule (fixes #3140) (Toru Nagashima)
-* Docs: Clarify what an unused var is (fixes #2342) (Nicholas C. Zakas)
-* Docs: Mention double-byte character limitation in max-len (fixes #2370) (Nicholas C. Zakas)
-* Fix: object curly spacing incorrectly warning for import with default and multiple named specifiers (fixes #3370) (Luke Karrys)
-* Fix: Indent rule errors with array of objects (fixes #3329) (Burak Yigit Kaya)
-* Update: Make it clear that `space-infix-ops` support `const` (fixes #3299) (Burak Yigit Kaya)
-* New: `prefer-template` rule (fixes #3014) (Toru Nagashima)
-* Docs: Clarify `no-process-env` docs (fixes #3318) (Nicholas C. Zakas)
-* Docs: Fix arrow name typo (fixes #3309) (Nicholas C. Zakas)
-* Update: Improve error message for `indent` rule violation (fixes #3340) (Burak Yigit Kaya)
-* Fix: radix rule does not apply for Number.parseInt (ES6) (fixes #3364) (Burak Yigit Kaya)
-* Fix: `key-spacing.align` doesn't pay attention to non-whitespace before key (fixes #3267) (Burak Yigit Kaya)
-* Fix: arrow-parens & destructuring/default params (fixes #3353) (Jamund Ferguson)
-* Update: Add support for Allman to brace-style rule, brackets on newline (fixes #3347) (Burak Yigit Kaya)
-* Fix: Regression no-catch-shadow (1.1.0) (fixes #3322) (Burak Yigit Kaya)
-* Docs: remove note outdated in 1.0.0 (Denis Sokolov)
-* Build: automatically convert line endings in release script (fixes #2642) (Burak Yigit Kaya)
-* Update: allow disabling new-cap on object methods (fixes #3172) (Burak Yigit Kaya)
-* Update: Improve checkstyle format (fixes #3183) (Burak Yigit Kaya)
-* Fix: Indent rule errors if an array literal starts a new statement (fixes #3328) (Burak Yigit Kaya)
-* Update: Improve validation error messages (fixes #3193) (Burak Yigit Kaya)
-* Docs: fix syntax error in space-before-function-paren (Fabrício Matté)
-* Fix: `indent` rule to check for last line correctly (fixes #3327) (Gyandeep Singh)
-* Fix: Inconsistent off-by-one errors with column numbers (fixes #3231) (Burak Yigit Kaya)
-* Fix: Keyword "else" must not be followed by a newline (fixes #3226) (Burak Yigit Kaya)
-* Fix: `id-length` does not work for most of the new ES6 patterns (fixes #3286) (Burak Yigit Kaya)
-* Fix: Spaced Comment Exceptions Not Working (fixes #3276) (Jamund Ferguson)
-
-v1.1.0 - August 7, 2015
-
-* Update: Added as-needed option to arrow-parens (fixes #3277) (Jamund Ferguson)
-* Fix: curly-spacing missing import case (fixes #3302) (Jamund Ferguson)
-* Fix: `eslint-env` in comments had not been setting `ecmaFeatures` (fixes #2134) (Toru Nagashima)
-* Fix: `es6` env had been missing `spread` and `newTarget` (fixes #3281) (Toru Nagashima)
-* Fix: Report no-spaced-func on last token before paren (fixes #3289) (Benjamin Woodruff)
-* Fix: Check for null elements in indent rule (fixes #3272) (Gyandeep Singh)
-* Docs: Use backticks for option heading (Gyandeep Singh)
-* Fix: `no-invalid-this` had been missing jsdoc comment (fixes #3287) (Toru Nagashima)
-* Fix: `indent` rule for multi-line objects and arrays (fixes #3236) (Gyandeep Singh)
-* Update: add new `multi-or-nest` option for the `curly` rule (fixes #1806) (Ivan Nikulin)
-* Fix: `no-cond-assign` had been missing simplest pattern (fixes #3249) (Toru Nagashima)
-* Fix: id-length rule doesn't catch violations in arrow function parameters (fixes #3275) (Burak Yigit Kaya)
-* New: Added grep-style formatter (fixes #2991) (Nobody Really)
-* Update: Split out generic AST methods into utility (fixes #962) (Gyandeep Singh)
-* Fix: `accessor-pairs` false positive (fixes #3262) (Toru Nagashima)
-* Fix: `context.getScope()` returns correct scope in blockBindings (fixes #3254) (Toru Nagashima)
-* Update: Expose `getErrorResults` as a static method on `CLIEngine` (fixes #3242) (Gyandeep Singh)
-* Update: Expose `getFormatter` as a static method on `CLIEngine` (fixes #3239) (Gyandeep Singh)
-* Docs: use correct encoding for id-match.md (fixes #3246) (Matthieu Larcher)
-* Docs: place id-match rule at correct place in README.md (fixes #3245) (Matthieu Larcher)
-* Docs: Update no-proto.md (Joe Zimmerman)
-* Docs: Fix typo in object-shorthand docs (Gunnar Lium)
-* Upgrade: inquirer dependency (fixes #3241) (Gyandeep Singh)
-* Fix: `indent` rule for objects and nested one line blocks (fixes #3238, fixes #3237) (Gyandeep Singh)
-* Docs: Fix wrong options in examples of key-spacing (keik)
-* Docs: Adds missing "not" to semi.md (Marius Schulz)
-* Docs: Update no-multi-spaces.md (Kenneth Powers)
-* Fix: `indent` to not error on same line nodes (fixes #3228) (Gyandeep Singh)
-* New: Jest environment (fixes #3212) (Darshak Parikh)
-
-v1.0.0 - July 31, 2015
-
-* Update: merge `no-reserved-keys` into `quote-props` (fixes #1539) (Jose Roberto Vidal)
-* Fix: `indent` error message (fixes #3220) (Gyandeep Singh)
-* Update: Add embertest env (fixes #3205) (ismay)
-* Docs: Correct documentation errors for `id-length` rule. (Jess Telford)
-* Breaking: `indent` rule to have node specific options (fixes #3210) (Gyandeep Singh)
-* Fix: space-after-keyword shouldn't allow newlines (fixes #3198) (Brandon Mills)
-* New: Add JSON formatter (fixes #3036) (Burak Yigit Kaya)
-* Breaking: Switch to RuleTester (fixes #3186) (Nicholas C. Zakas)
-* Breaking: remove duplicate warnings of `no-undef` from `block-scoped-var` (fixes #3201) (Toru Nagashima)
-* Fix: `init-declarations` ignores in for-in/of (fixes #3202) (Toru Nagashima)
-* Fix: `quotes` with `"backtick"` ignores ModuleSpecifier and LiteralPropertyName (fixes #3181) (Toru Nagashima)
-* Fix: space-in-parens in Template Strings (fixes #3182) (Ian VanSchooten)
-* Fix: Check for concatenation in no-throw-literal (fixes #3099, fixes #3101) (Ian VanSchooten)
-* Build: Remove `eslint-tester` from devDependencies (fixes #3189) (Gyandeep Singh)
-* Fix: Use new ESLintTester (fixes #3187) (Nicholas C. Zakas)
-* Update: `new-cap` supports fullnames (fixes #2584) (Toru Nagashima)
-* Fix: Non object rule options merge (fixes #3179) (Gyandeep Singh)
-* New: add id-match rule (fixes #2829) (Matthieu Larcher)
-* Fix: Rule options merge (fixes #3175) (Gyandeep Singh)
-* Fix: `spaced-comment` allows a mix of markers and exceptions (fixes #2895) (Toru Nagashima)
-* Fix: `block-scoped-var` issues (fixes #2253, fixes #2747, fixes #2967) (Toru Nagashima)
-* New: Add id-length rule (fixes #2784) (Burak Yigit Kaya)
-* Update: New parameters for quote-props rule (fixes #1283, fixes #1658) (Tomasz Olędzki)
-
-v1.0.0-rc-3 - July 24, 2015
-
-* Fix: Make Chai and Mocha as a dependency (fixes #3156) (Gyandeep Singh)
-* Fix: traverse `ExperimentalSpread/RestProperty.argument` (fixes #3157) (Toru Nagashima)
-* Fix: Check shareable config package prefix correctly (fixes #3146) (Gyandeep Singh)
-* Update: move redeclaration checking for builtins (fixes #3070) (Toru Nagashima)
-* Fix: `quotes` with `"backtick"` allows directive prologues (fixes #3132) (Toru Nagashima)
-* Fix: `ESLintTester` path in exposed API (fixes #3149) (Gyandeep Singh)
-* Docs: Remove AppVeyor badge (Gyandeep Singh)
-* Fix: Check no-new-func on CallExpressions (fixes #3145) (Benjamin Woodruff)
-
-v1.0.0-rc-2 - July 23, 2015
-
-* Docs: Mention eslint-tester in migration guide (Nicholas C. Zakas)
-* Docs: Mention variables defined in a global comment (fixes #3137) (William Becker)
-* Docs: add documentation about custom-formatters. (fixes #1260) (royriojas)
-* Fix: Multi-line variable declarations indent (fixes #3139) (Gyandeep Singh)
-* Fix: handles blocks in no-use-before-define (fixes #2960) (Jose Roberto Vidal)
-* Update: `props` option of `no-param-reassign` (fixes #1600) (Toru Nagashima)
-* New: Support shared configs named `@scope/eslint-config`, with shortcuts of `@scope` and `@scope/` (fixes #3123) (Jordan Harband)
-* New: Add ignorePattern, ignoreComments, and ignoreUrls options to max-len (fixes #2934, fixes #2221, fixes #1661) (Benjamin Woodruff)
-* Build: Increase Windows Mocha timeout (fixes #3133) (Ian VanSchooten)
-* Docs: incorrect syntax in the example for rule «one-var» (Alexander Burtsev)
-* Build: Check commit message format at end of tests (fixes #3058) (Ian VanSchooten)
-* Update: Move eslint-tester into repo (fixes #3110) (Nicholas C. Zakas)
-* Fix: Not load configs outside config with `root: true` (fixes #3109) (Gyandeep Singh)
-* Docs: Add config information to README (fixes #3074) (Nicholas C. Zakas)
-* Docs: Add mysticatea as committer (Nicholas C. Zakas)
-* Docs: Grammar fixes in rule descriptions (refs #3038) (Greg Cochard)
-* Fix: Update sort-vars to ignore Array and ObjectPattern (fixes #2954) (Harry Ho)
-* Fix: block-scoped-var rule incorrectly flagging break/continue with label (fixes #3082) (Aparajita Fishman)
-* Fix: spaces trigger wrong in `no-useless-call` and `prefer-spread` (fixes #3054) (Toru Nagashima)
-* Fix: `arrow-spacing` allow multi-spaces and line-endings (fixes #3079) (Toru Nagashima)
-* Fix: add missing loop scopes to one-var (fixes #3073) (Jose Roberto Vidal)
-* New: the `no-invalid-this` rule (fixes #2815) (Toru Nagashima)
-* Fix: allow empty loop body in no-extra-semi (fixes #3075) (Mathias Schreck)
-* Update: Add qunit to environments (fixes #2870) (Nicholas C. Zakas)
-* Fix: `space-before-blocks` to consider classes (fixes #3062) (Gyandeep Singh)
-* Fix: Include phantomjs globals (fixes #3064) (Linus Unnebäck)
-* Fix: no-else-return handles multiple else-if blocks (fixes #3015) (Jose Roberto Vidal)
-* Fix: `no-*-assgin` rules support destructuring (fixes #3029) (Toru Nagashima)
-* New: the `no-implicit-coercion` rule (fixes #1621) (Toru Nagashima)
-* Fix: Make no-implied-eval match more types of strings (fixes #2898) (Benjamin Woodruff)
-* Docs: Clarify that bot message is automatic (Ian VanSchooten)
-* Fix: Skip rest properties in no-dupe-keys (fixes 3042) (Nicholas C. Zakas)
-* Docs: New issue template (fixes #3048) (Nicholas C. Zakas)
-* Fix: strict rule supports classes (fixes #2977) (Toru Nagashima)
-* New: the `prefer-reflect` rule (fixes #2939) (Keith Cirkel)
-* Docs: make grammar consistent in rules index (Greg Cochard)
-* Docs: Fix unmatched paren in rule description (Greg Cochard)
-* Docs: Small typo fix in no-useless-call documentation (Paul O’Shannessy)
-* Build: readd phantomjs dependency with locked down version (fixes #3026) (Mathias Schreck)
-* Docs: Add IanVS as committer (Nicholas C. Zakas)
-* docs: additional computed-property-spacing documentation (fixes #2941) (Jamund Ferguson)
-* Docs: Add let and const examples for newline-after-var (fixes #3020) (James Whitney)
-* Build: Remove unnecessary phantomjs devDependency (fixes #3021) (Gyandeep Singh)
-* Update: added shared builtins list (fixes #2972) (Jose Roberto Vidal)
-
-v1.0.0-rc-1 - July 15, 2015
-
-* Upgrade: Espree to 2.2.0 (fixes #3011) (Nicholas C. Zakas)
-* Docs: fix a typo (bartmichu)
-* Fix: indent rule should recognize single line statements with ASI (fixes #3001, fixes #3000) (Mathias Schreck)
-* Update: Handle CRLF line endings in spaced-comment rule - 2 (fixes #3005) (Burak Yigit Kaya)
-* Fix: Indent rule error on empty block body (fixes #2999) (Gyandeep Singh)
-* New: the `no-class-assign` rule (fixes #2718) (Toru Nagashima)
-* New: the `no-const-assign` rule (fixes #2719) (Toru Nagashima)
-* Docs: Add 1.0.0 migration guide (fixes #2994) (Nicholas C. Zakas)
-* Docs: Update changelog for 0.24.1 (fixes #2976) (Nicholas C. Zakas)
-* Breaking: Remove deprecated rules (fixes #1898) (Ian VanSchooten)
-* Fix: multi-line + fat arrow indent (fixes #2239) (Gyandeep Singh)
-* Breaking: Create eslint:recommended and add to --init (fixes #2713) (Greg Cochard)
-* Fix: Indent rule (fixes #1797, fixes #1799, fixes #2248, fixes #2343, fixes #2278, fixes #1800) (Gyandeep Singh)
-* New: `context.getDeclaredVariables(node)` (fixes #2801) (Toru Nagashima)
-* New: the `no-useless-call` rule (fixes #1925) (Toru Nagashima)
-* New: the `prefer-spread` rule (fixes #2946) (Toru Nagashima)
-* Fix: `valid-jsdoc` counts `return` for arrow expressions (fixes #2952) (Toru Nagashima)
-* New: Add exported comment option (fixes #1200) (Jamund Ferguson)
-* Breaking: Default to --reset behavior (fixes #2100) (Brandon Mills)
-* New: Add arrow-parens and arrow-spacing rule (fixes #2628) (Jxck)
-* Fix: Shallow cloning issues in eslint config (fixes #2961) (Gyandeep Singh)
-* Add: Warn on missing rule definition or deprecation (fixes #1549) (Ian VanSchooten)
-* Update: adding some tests for no-redeclare to test named functions (fixes #2953) (Dominic Barnes)
-* New: Add support for root: true in config files (fixes #2736) (Ian VanSchooten)
-* Fix: workaround for leading and trailing comments in padded-block (fixes #2336 and fixes #2788) (Mathias Schreck)
-* Fix: object-shorthand computed props (fixes #2937) (Jamund Ferguson)
-* Fix: Remove invalid check inside `getJSDocComment` function (fixes #2938) (Gyandeep Singh)
-* Docs: Clarify when not to use space-before-blocks (Ian VanSchooten)
-* Update: `no-loop-func` allows block-scoped variables (fixes #2517) (Toru Nagashima)
-* Docs: remove mistaken "off by default" (Jan Schär)
-* Build: Add appveyor CI system (fixes #2923) (Gyandeep Singh)
-* Docs: Fix typo in the shareable configs doc (Siddharth Kannan)
-* Fix: max-len to report correct column number (fixes #2926) (Mathias Schreck)
-* Fix: add destructuring support to comma-dangle rule (fixes #2911) (Mathias Schreck)
-* Docs: clarification in no-unused-vars (Jan Schär)
-* Fix: `no-redeclare` checks module scopes (fixes #2903) (Toru Nagashima)
-* Docs: missing quotes in JSON (Jan Schär)
-* Breaking: Switch to 1-based columns (fixes #2284) (Nicholas C. Zakas)
-* Docs: array-bracket-spacing examples used space-in-brackets (Brandon Mills)
-* Docs: Add spaced-line-comment deprecation notice (Brandon Mills)
-* Docs: Add space-in-brackets deprecation notice (Brandon Mills)
-* Fix: Include execScript in no-implied-eval rule (fixes #2873) (Frederik Braun)
-* Fix: Support class syntax for line-around-comment rule (fixes #2894) (Gyandeep Singh)
-* Fix: lines-around-comment was crashing in some cases due to a missing check (fixes #2892) (Mathieu M-Gosselin)
-* New: Add init-declarations rule (fixes #2606) (cjihrig)
-* Docs: Fix typo in array-bracket-spacing rule (zallek)
-* Fix: Added missing export syntax support to the block-scoped-var rule. (fixes #2887) (Mathieu M-Gosselin)
-* Build: gensite target supports rule removal (refs #1898) (Brandon Mills)
-* Update: Handle CRLF line endings in spaced-comment rule (fixes #2884) (David Anson)
-* Update: Attach parent in getNodeByRangeIndex (fixes #2863) (Brandon Mills)
-* Docs: Fix typo (Bryan Smith)
-* New: Add serviceworker environment (fixes #2557) (Gyandeep Singh)
-* Fix: Yoda should ignore comparisons where both sides are constants (fixes #2867) (cjihrig)
-* Update: Loosens regex rules around intentional fall through comments (Fixes #2811) (greg5green)
-* Update: Add missing schema to rules (fixes #2858) (Ilya Volodin)
-* New: `require-yield` rule (fixes #2822) (Toru Nagashima)
-* New: add callback-return rule (fixes #994) (Jamund Ferguson)
-
-v0.24.1 - July 10, 2015
-
-* Docs: Clarify when not to use space-before-blocks (Ian VanSchooten)
-* Docs: remove mistaken "off by default" (Jan Schär)
-* Docs: remove mistaken "off by default" (Jan Schär)
-* Docs: Fix typo in the shareable configs doc (Siddharth Kannan)
-* Docs: clarification in no-unused-vars (Jan Schär)
-* Docs: missing quotes in JSON (Jan Schär)
-* Fix: Revert 1-based column changes in tests for patch (refs #2284) (Nicholas C. Zakas)
-* Fix: Shallow cloning issues in eslint config (fixes #2961) (Gyandeep Singh)
-* Fix: object-shorthand computed props (fixes #2937) (Jamund Ferguson)
-* Fix: Remove invalid check inside `getJSDocComment` function (fixes #2938) (Gyandeep Singh)
-* Fix: max-len to report correct column number (fixes #2926) (Mathias Schreck)
-* Fix: add destructuring support to comma-dangle rule (fixes #2911) (Mathias Schreck)
-* Fix: `no-redeclare` checks module scopes (fixes #2903) (Toru Nagashima)
-* Fix: Include execScript in no-implied-eval rule (fixes #2873) (Frederik Braun)
-* Fix: Support class syntax for line-around-comment rule (fixes #2894) (Gyandeep Singh)
-* Fix: lines-around-comment was crashing in some cases due to a missing check (fixes #2892) (Mathieu M-Gosselin)
-* Fix: Added missing export syntax support to the block-scoped-var rule. (fixes #2887) (Mathieu M-Gosselin)
-* Fix: Yoda should ignore comparisons where both sides are constants (fixes #2867) (cjihrig)
-* Docs: array-bracket-spacing examples used space-in-brackets (Brandon Mills)
-* Docs: Add spaced-line-comment deprecation notice (Brandon Mills)
-* Docs: Add space-in-brackets deprecation notice (Brandon Mills)
-
-v0.24.0 - June 26, 2015
-
-* Upgrade: eslint-tester to 0.8.1 (Nicholas C. Zakas)
-* Fix: no-dupe-args sparse array crash (fixes #2848) (Chris Walker)
-* Fix: space-after-keywords should ignore extra parens (fixes #2847) (Mathias Schreck)
-* New: add no-unexpected-multiline rule (fixes #746) (Glen Mailer)
-* Update: refactor handle-callback-err to improve performance (fixes #2841) (Mathias Schreck)
-* Fix: Add --init to the CLI options (fixes #2817) (Gyandeep Singh)
-* Update: Add `except-parens` option to `no-return-assign` rule (fixes #2809) (Toru Nagashima)
-* Fix: handle-callback-err missing arrow functions (fixes #2823) (Jamund Ferguson)
-* Fix: `no-extra-semi` in class bodies (fixes #2794) (Toru Nagashima)
-* Fix: Check type to be file when looking for config files (fixes #2790) (Gyandeep Singh)
-* Fix: valid-jsdoc to work for object getters (fixes #2407) (Gyandeep Singh)
-* Update: Add an option as an object to `generator-star-spacing` rule (fixes #2787) (Toru Nagashima)
-* Build: Update markdownlint dependency (David Anson)
-* Fix: context report message to handle more scenarios (fixes #2746) (Gyandeep Singh)
-* Update: Ignore JsDoc comments by default for `spaced-comment` (fixes #2766) (Gyandeep Singh)
-* Fix: one-var 'never' option for mixed initialization (Fixes #2786) (Ian VanSchooten)
-* Docs: Fix a minor typo in a prefer-const example (jviide)
-* Fix: comma-dangle always-multiline: no comma right before the last brace (fixes #2091) (Benoît Zugmeyer)
-* Fix: Allow blocked comments with markers and new-line (fixes #2777) (Gyandeep Singh)
-* Docs: small fix in quote-props examples (Jose Roberto Vidal)
-* Fix: object-shorthand rule should not warn for NFEs (fixes #2748) (Michael Ficarra)
-* Fix: arraysInObjects for object-curly-spacing (fixes #2752) (Jamund Ferguson)
-* Docs: Clarify --rule description (fixes #2773) (Nicholas C. Zakas)
-* Fix: object literals in arrow function bodies (fixes #2702) (Jose Roberto Vidal)
-* New: `constructor-super` rule (fixes #2720) (Toru Nagashima)
-* New: `no-this-before-super` rule (fixes #2721) (Toru Nagashima)
-* Fix: space-unary-ops flags expressions starting w/ keyword (fixes #2764) (Michael Ficarra)
-* Update: Add block options to `lines-around-comment` rule (fixes #2667) (Gyandeep Singh)
-* New: array-bracket-spacing (fixes #2226) (Jamund Ferguson)
-* Fix: No-shadow rule duplicating error messages (fixes #2706) (Aliaksei Shytkin)
-
-v0.23.0 - June 14, 2015
-
-* Build: Comment out auto publishing of release notes (refs #2640) (Ilya Volodin)
-* Fix: "extends" within package.json (fixes #2754) (Gyandeep Singh)
-* Upgrade: globals@8.0.0 (fixes #2759) (silverwind)
-* Docs: eol-last docs fix (fixes #2755) (Gyandeep Singh)
-* Docs: btmills is a reviewer (Nicholas C. Zakas)
-* Build: Revert lock io.js to v2.1.0 (refs #2745) (Brandon Mills)
-* New: computed-property-spacing (refs #2226) (Jamund Ferguson)
-* Build: Pin Sinon version (fixes #2742) (Ilya Volodin)
-* Fix: `prefer-const` treats `for-in`/`for-of` with the same way (Fixes #2739) (Toru Nagashima)
-* Docs: Add links to team members profile (Gyandeep Singh)
-* Docs: add team and ES7 info to readme (Nicholas C. Zakas)
-* Fix: don't try to strip "line:" prefix from parser errors with no such prefix (fixes #2698) (Tim Cuthbertson)
-* Fix: never ignore config comment options (fixes #2725) (Brandon Mills)
-* Update: Add clarification to spaced-comment (refs #2588) (Greg Cochard)
-* Update: Add markers to spaced-comment (fixes #2588) (Greg Cochard)
-* Fix: no-trailing-spaces now handles skipBlankLines (fixes #2575) (Greg Cochard)
-* Docs: Mark global-strict on by default (fixes #2629) (Ilya Volodin)
-* New: Allow extends to be an array (fixes #2699) (Justin Morris)
-* New: globals@7.1.0 (fixes #2682) (silverwind)
-* New: `prefer-const` rule (fixes #2333) (Toru Nagashima)
-* Fix: remove hard-coded list of unary keywords in space-unary-ops rule (fixes #2696) (Tim Cuthbertson)
-* Breaking: Automatically validate rule options (fixes #2595) (Brandon Mills)
-* Update: no-lone-blocks does not report block-level scopes (fixes #2119) (Jose Roberto Vidal)
-* Update: yoda onlyEquality option (fixes #2638) (Denis Sokolov)
-* Docs: update comment to align with source code it's referencing (Michael Ficarra)
-* Fix: Misconfigured default option for lines-around-comment rule (fixes #2677) (Gyandeep Singh)
-* Fix: `no-shadow` allows shadowing in the TDZ (fixes #2568) (Toru Nagashima)
-* New: spaced-comment rule (fixes #1088) (Gyandeep Singh)
-* Fix: Check unused vars in exported functions (fixes #2678) (Gyandeep Singh)
-* Build: Stringify payload of release notes (fixes #2640) (Greg Cochard)
-* Fix: Allowing u flag in regex to properly lint no-empty-character-class (fixes #2679) (Dominic Barnes)
-* Docs: deprecate no-wrap-func (fixes #2644) (Jose Roberto Vidal)
-* Docs: Fixing grammar: then -> than (E)
-* Fix: trailing commas in object-curly-spacing (fixes #2647) (Jamund Ferguson)
-* Docs: be consistent about deprecation status (Matthew Dapena-Tretter)
-* Docs: Fix mistakes in object-curly-spacing docs (Matthew Dapena-Tretter)
-* New: run processors when calling executeOnText (fixes #2331) (Mordy Tikotzky)
-* Update: move executeOnText() tests to the correct describe block (fixes #2648) (Mordy Tikotzky)
-* Update: add tests to assert that the preprocessor is running (fixes #2651) (Mordy Tikotzky)
-* Build: Lock io.js to v2.1.0 (fixes #2653) (Ilya Volodin)
-
-v0.22.1 - May 30, 2015
-
-* Build: Remove release notes auto-publish (refs #2640) (Ilya Volodin)
-
-v0.22.0 - May 30, 2015
-
-* Upgrade: escope 3.1.0 (fixes #2310, #2405) (Toru Nagashima)
-* Fix: “consistent-this” incorrectly flagging destructuring of `this` (fixes #2633) (David Aurelio)
-* Upgrade: eslint-tester to 0.7.0 (Ilya Volodin)
-* Update: allow shadowed references in no-alert (fixes #1105) (Mathias Schreck)
-* Fix: no-multiple-empty-lines and template strings (fixes #2605) (Jamund Ferguson)
-* New: object-curly-spacing (fixes #2225) (Jamund Ferguson)
-* Docs: minor fix for one-var rule (Jamund Ferguson)
-* Fix: Shared config being clobbered by other config (fixes #2592) (Dominic Barnes)
-* Update: adds "functions" option to no-extra-parens (fixes #2477) (Jose Roberto Vidal)
-* Docs: Fix json formatting for lines-around-comments rule (Gyandeep Singh)
-* Fix: Improve around function/class names of `no-shadow` (fixes #2556, #2552) (Toru Nagashima)
-* Fix: Improve code coverage (fixes #2590) (Ilya Volodin)
-* Fix: Allow scoped configs to have sub-configs (fixes #2594) (Greg Cochard)
-* Build: Add auto-update of release tag on github (fixes #2566) (Greg Cochard)
-* New: lines-around-comment (fixes #1344) (Jamund Ferguson)
-* Build: Unblock build by increasing code coverage (Ilya Volodin)
-* New: accessor-pairs rule to object initializations (fixes #1638) (Gyandeep Singh)
-* Fix: counting of variables statements in one-var (fixes #2570) (Mathias Schreck)
-* Build: Add sudo:false for Travis (fixes #2582) (Ilya Volodin)
-* New: Add rule schemas (refs #2179) (Brandon Mills)
-* Docs: Fix typo in shareable-configs example (fixes #2571) (Ted Piotrowski)
-* Build: Relax markdownlint rules by disabling style-only items (David Anson)
-* Fix: Object shorthand rule incorrectly flagging getters/setters (fixes #2563) (Brad Dougherty)
-* New: Add config validator (refs #2179) (Brandon Mills)
-* New: Add worker environment (fixes #2442) (Ilya Volodin)
-* New no-empty-character class (fixes #2508) (Jamund Ferguson)
-* New: Adds --ignore-pattern option. (fixes #1742) (Patrick McElhaney)
-
-v0.21.2 - May 18, 2015
-
-* 0.21.2 (Nicholas C. Zakas)
-* Fix: one-var exception for ForStatement.init (fixes #2505) (Brandon Mills)
-* Fix: Don't throw spurious shadow errors for classes (fixes #2545) (Jimmy Jia)
-* Fix: valid-jsdoc rule to support exported functions (fixes #2522) (Gyandeep Singh)
-* Fix: Allow scoped packages in configuration extends (fixes #2544) (Eric Isakson)
-* Docs: Add chatroom to FAQ (Nicholas C. Zakas)
-* Docs: Move Gitter badge (Nicholas C. Zakas)
-
-v0.21.1 - May 15, 2015
-
-* 0.21.1 (Nicholas C. Zakas)
-* Fix: loc obj in report fn expects column (fixes #2481) (Varun Verma)
-* Build: Make sure that all md files end with empty line (fixes #2520) (Ilya Volodin)
-* Added Gitter badge (The Gitter Badger)
-* Fix: forced no-shadow to check all scopes (fixes #2294) (Jose Roberto Vidal)
-* Fix: --init indent setting (fixes #2493) (Nicholas C. Zakas)
-* Docs: Mention bundling multiple shareable configs (Nicholas C. Zakas)
-* Fix: Not to override the required extended config object directly (fixes #2487) (Gyandeep Singh)
-* Build: Update markdownlint dependency (David Anson)
-* Docs: added recursive function example to no-unused-vars (Jose Roberto Vidal)
-* Docs: Fix typo (then -> than) (Vladimir Agafonkin)
-* Revert "Fix: sanitise Jekyll interpolation during site generation (fixes #2297)" (Nicholas C. Zakas)
-* Fix: dot-location should use correct dot token (fixes #2504) (Mathias Schreck)
-* Fix: Stop linebreak-style from crashing (fixes #2490) (James Whitney)
-* Fix: rule no-duplicate-case problem with CallExpressions. (fixes #2499) (Matthias Osswald)
-* Fix: Enable full support for eslint-env comments (refs #2134) (Ilya Volodin)
-* Build: Speed up site generation (fixes #2475) (Ilya Volodin)
-* Docs: Fixing trailing spaces (Fixes #2478) (Ilya Volodin)
-* Docs: Update README FAQs (Nicholas C. Zakas)
-* Fix: Allow comment before comma for comma-spacing rule (fixes #2408) (Gyandeep Singh)
-
-v0.21.0 - May 9, 2015
-
-* 0.21.0 (Nicholas C. Zakas)
-* New: Shareable configs (fixes #2415) (Nicholas C. Zakas)
-* Fix: Edge cases for no-wrap-func (fixes #2466) (Nicholas C. Zakas)
-* Docs: Update ecmaFeatures description (Nicholas C. Zakas)
-* New: Add dot-location rule. (fixes #1884) (Greg Cochard)
-* New: Add addPlugin method to CLI-engine (Fixes #1971) (Ilya Volodin)
-* Breaking: Do not check unset declaration types (Fixes #2448) (Ilya Volodin)
-* Fix: no-redeclare switch scoping (fixes #2337) (Nicholas C. Zakas)
-* Fix: Check extra scope in no-use-before-define (fixes #2372) (Nicholas C. Zakas)
-* Fix: Ensure baseConfig isn't changed (fixes #2380) (Nicholas C. Zakas)
-* Fix: Don't warn for member expression functions (fixes #2402) (Nicholas C. Zakas)
-* New: Adds skipBlankLines option to the no-trailing-spaces rule (fixes #2303) (Andrew Vaughan)
-* Fix: Adding exception for last line (Refs #2423) (Greg Cochard)
-* Fix: crash on 0 max (fixes #2423) (gcochard)
-* Fix object-shorthand arrow functions (fixes #2414) (Jamund Ferguson)
-* Fix: Improves detection of self-referential functions (fixes #2363) (Jose Roberto Vidal)
-* Update: key-spacing groups must be consecutive lines (fixes #1728) (Brandon Mills)
-* Docs: grammar fix in no-sync (Tony Lukasavage)
-* Docs: Update configuring.md to fix incorrect link. (Ans)
-* New: Check --stdin-filename by ignore settings (fixes #2432) (Aliaksei Shytkin)
-* Fix: `no-loop-func` rule allows functions at init part (fixes #2427) (Toru Nagashima)
-* New: Add init command (fixes #2302) (Ilya Volodin)
-* Fix: no-irregular-whitespace should work with irregular line breaks (fixes #2316) (Mathias Schreck)
-* Fix: generator-star-spacing with class methods (fixes #2351) (Brandon Mills)
-* New: no-unneeded-ternary rule to disallow boolean literals in conditional expressions (fixes #2391) (Gyandeep Singh)
-* Docs: Add `restParams` to `ecmaFeatures` options list (refs: #2346) (Bogdan Savluk)
-* Fix: space-in-brackets Cannot read property 'range' (fixes #2392) (Gyandeep Singh)
-* Docs: Sort the rules (Lukas Böcker)
-* Add: Exception option for `no-extend-native` and `no-native-reassign` (fixes #2355) (Gyandeep Singh)
-* Fix: space-in-brackets import declaration (fixes #2378) (Gyandeep Singh)
-* Update: Add uninitialized and initialized options (fixes #2206) (Ian VanSchooten)
-* Fix: brace-style to not warn about curly mix ifStatements (fixes #1739) (Gyandeep Singh)
-* Fix: npm run profile script should use espree (fixes #2150) (Mathias Schreck)
-* New: Add support for extending configurations (fixes #1637) (Espen Hovlandsdal)
-* Fix: Include string literal keys in object-shorthand (Fixes #2374) (Jamund Ferguson)
-* Docs: Specify language for all code fences, enable corresponding markdownlint rule. (David Anson)
-* New: linebreak-style rule (fixes #1255) (Erik Müller)
-* Update: Add "none" option to operator-linebreak rule (fixes #2295) (Casey Visco)
-* Fix: sanitise Jekyll interpolation during site generation (fixes #2297) (Michael Ficarra)
-
-v0.20.0 - April 24, 2015
-
-* 0.20.0 (Nicholas C. Zakas)
-* Fix: support arrow functions in no-extra-parens (fixes #2367) (Michael Ficarra)
-* Fix: Column position in space-infix-ops rule (fixes #2354) (Gyandeep Singh)
-* Fix: allow plugins to be namespaced (fixes #2360) (Seth Pollack)
-* Update: one-var: enable let & const (fixes #2301) (Joey Baker)
-* Docs: Add meteor to avaiable environments list (bartmichu)
-* Update: Use `Object.assign()` polyfill for all object merging (fixes #2348) (Sindre Sorhus)
-* Docs: Update markdownlint dependency, resolve/suppress new issues. (David Anson)
-* Fix: newline-after-var declare and export (fixes #2325) (Gyandeep Singh)
-* Docs: Some typos and grammar. (AlexKVal)
-* Fix: newline-after-var to ignore declare in for specifiers (fixes #2317) (Gyandeep Singh)
-* New: add --stdin-filename option (fixes #1950) (Mordy Tikotzky)
-* Fix: Load .eslintrc in $HOME only if no other .eslintrc is found (fixes #2279) (Jasper Woudenberg)
-* Fix: Add `v8` module to no-mixed-requires rule (fixes #2320) (Gyandeep Singh)
-* Fix: key-spacing with single properties (fixes #2311) (Brandon Mills)
-* Docs: `no-invalid-regexp`: add `ecmaFeatures` flags for `u`/`y` (Jordan Harband)
-* New: object-shorthand rule (refs: #1617) (Jamund Ferguson)
-* Update: backticks support for quotes rule (fixes #2153) (borislavjivkov)
-* Fix: space-in-brackets to work with modules (fixes #2216) (Nicholas C. Zakas)
-
-v0.19.0 - April 11, 2015
-
-* 0.19.0 (Nicholas C. Zakas)
-* Upgrade: Espree to 2.0.1 (Nicholas C. Zakas)
-* Docs: Update one-var documentation (fixes #2210) (Nicholas C. Zakas)
-* Update: Add test for no-undef (fixes #2214) (Nicholas C. Zakas)
-* Fix: Report better location for padded-blocks error (fixes #2224) (Nicholas C. Zakas)
-* Fix: Don't check concise methods in quote-props (fixes #2251) (Nicholas C. Zakas)
-* Fix: Consider tabs for space-in-parens rule (fixes #2191) (Josh Quintana)
-* Fix: block-scoped-var to work with classes (fixes #2280) (Nicholas C. Zakas)
-* Docs: Remove trailing spaces, enable corresponding markdownlint rule. (David Anson)
-* Fix: padded-blocks with ASI (fixes #2273) (Brandon Mills)
-* Fix: Handle comment lines in newline-after-var (fixed #2237) (Casey Visco)
-* Docs: Standardize on '*' for unordered lists, enable corresponding markdownlint rule. (David Anson)
-* Fix: no-undef and no-underscore-dangle to use double quotes (fixes #2258) (Gyandeep Singh)
-* Docs: Improve grammar and style in comma-dangle.md (Nate Eagleson)
-* Docs: Improve grammar and style in padded-blocks.md (Nate Eagleson)
-* Docs: Update URL in no-wrap-func.md to resolve 404 (Nate Eagleson)
-* Docs: Fix typo in command-line-interface.md (Nate Eagleson)
-* Docs: Fix typo in working-with-rules.md (Nate Eagleson)
-* Docs: Remove hard tabs from *.md, enable corresponding markdownlint rule. (David Anson)
-* Fix: Function id missing in parent scope when using ecmaFeature `modules` for rule block-scoped-var (fixes #2242) (Michael Ferris)
-* Fix: Ignore single lines for vertical alignment (fixes #2018) (Ian VanSchooten)
-* Fix: Allow inline comments in newline-after-var rule (fixes #2229) (Casey Visco)
-* Upgrade: Espree 2.0.0 and escope 3.0.0 (fixes #2234, fixes #2201, fixes (Nicholas C. Zakas)
-* Docs: Update --no-ignore warning (Brandon Mills)
-* Build: Remove jshint files (fixes #2222) (Jeff Tan)
-* Docs: no-empty fix comment change (refs #2188) (Gyandeep Singh)
-* Fix: duplicate semi and no-extra-semi errors (fixes #2207) (Brandon Mills)
-* Docs: Update processors description (Nicholas C. Zakas)
-* Fix: semi error on export declaration (fixes #2194) (Brandon Mills)
-* New: operator-linebreak rule (fixes #1405) (Benoît Zugmeyer)
-* Docs: Fixing broken links in documentation (Ilya Volodin)
-* Upgrade: Espree to 0.12.3 (fixes #2195) (Gyandeep Singh)
-* Fix: camelcase rule with {properties: never} shouldn't check assignment (fixes #2189) (Gyandeep Singh)
-* New: Allow modifying base config (fixes #2143) (Meo)
-* New: no-continue rule (fixes #1945) (borislavjivkov)
-* Fix: `no-empty` rule should allow any comments (fixes #2188) (Gyandeep Singh)
-* Docs: Fix spell in camelcase doc (fixes #2190) (Gyandeep Singh)
-* Fix: Require semicolon after import/export statements (fixes #2174) (Gyandeep Singh)
-* Build: Add linting of Markdown files to "npm test" script (fixes #2182) (David Anson)
-* Build: Fixing site generation (Ilya Volodin)
-* Build: Fix gensite task to work even if files are missing (Nicholas C. Zakas)
-
-v0.18.0 - March 28, 2015
-
-* 0.18.0 (Nicholas C. Zakas)
-* Fix: Mark variables as used in module scope (fixes #2137) (Nicholas C. Zakas)
-* Fix: arrow functions need wrapping (fixes #2113) (Nicholas C. Zakas)
-* Fix: Don't crash on empty array pattern item (fixes #2111) (Nicholas C. Zakas)
-* Fix: Don't error on destructured params (fixes #2051) (Nicholas C. Zakas)
-* Docs: Fixing broken links (Ilya Volodin)
-* Fix: no-constant-condition should not flag += (fixes #2155) (Nicholas C. Zakas)
-* Fix: Ensure piped in code will trigger correct errors (fixes #2154) (Nicholas C. Zakas)
-* Fix: block-scoped-var to handle imports (fixes #2087) (Nicholas C. Zakas)
-* Fix: no-dupe-args to work with destructuring (fixes #2148) (Nicholas C. Zakas)
-* Fix: key-spacing crash on computed properties (fixes #2120) (Brandon Mills)
-* Fix: indent crash on caseless switch (fixes #2144) (Brandon Mills)
-* Fix: Don't warn about destructured catch params (fixes #2125) (Nicholas C. Zakas)
-* Update: Omit setter param from no-unused-vars (fixes #2133) (Nicholas C. Zakas)
-* Docs: Cleaning dead links (Ilya Volodin)
-* Docs: Moving documentation out of the repository and modifying build scripts (Ilya Volodin)
-* Docs: Update link to Documentation (Kate Lizogubova)
-* Docs: Adding back deprecated space-unary-word-ops documentation (Ilya Volodin)
-* Fix: Unused recursive functions should be flagged (issue2095) (Nicholas C. Zakas)
-* Breaking: Remove JSX support from no-undef (fixes #2093) (Nicholas C. Zakas)
-* Fix: markVariableAsUsed() should work in Node.js env (fixes #2089) (Nicholas C. Zakas)
-* New: Add "always" and "never" options to "one-var" rule. (fixes #1619) (Danny Fritz)
-* New: newline-after-var rule (fixes #2057) (Gopal Venkatesan)
-* Fix: func-names with ES6 classes (fixes #2103) (Marsup)
-* Fix: Add "Error" to the "new-cap" rule exceptions (fixes #2098) (Mickaël Tricot)
-* Fix: vars-on-top conflict with ES6 import (fixes #2099) (Gyandeep Singh)
-* Docs: Fixed JSON syntax (Sajin)
-* New: space-before-function-paren rule (fixes #2028) (Brandon Mills)
-* Breaking: rule no-empty also checking for empty catch blocks. (fixes #1841) (Dieter Oberkofler)
-* Update: rule camelcase to allow snake_case in object literals. (fixes #1919) (Dieter Oberkofler)
-* New: Added option int32Hint for space-infix-ops (fixes #1295) (Kirill Efimov)
-* New: no-param-reassign rule (fixes #1599) (Nat Burns)
-
-v0.17.1 - March 17, 2015
-
-* 0.17.1 (Nicholas C. Zakas)
-* Fix: no-func-assign should not fail on import declarations (fixes #2060) (Igor Zalutsky)
-* Fix: block-scoped-var to work with destructuring (fixes #2059) (Nicholas C. Zakas)
-* Fix: no-redeclare should check Node.js scope (fixes #2064) (Nicholas C. Zakas)
-* Fix: space-before-function-parentheses generator methods (fixes #2082) (Brandon Mills)
-* Fix: Method name resolution in complexity rule (fixes #2049) (Nicholas C. Zakas)
-* Fix: no-unused-vars crash from escope workaround (fixes #2042) (Brandon Mills)
-* Fix: restrict dot-notation keywords to actual ES3 keywords (fixes #2075) (Michael Ficarra)
-* Fix: block-scoped-var to work with classes (fixes #2048) (Nicholas C. Zakas)
-* Docs: Update no-new documentation (fixes #2044) (Nicholas C. Zakas)
-* Fix: yoda range exceptions with this (fixes #2063) (Brandon Mills)
-* Docs: Fix documentation on configuring eslint with comments (Miguel Ping)
-* Fix: rule no-duplicate-case problem with MemberExpressions. (fixes #2038) (Dieter Oberkofler)
-* Fix: Exempt \0 from no-octal-escape (fixes #1923) (Michael Ficarra)
-
-v0.17.0 - March 14, 2015
-
-* 0.17.0 (Nicholas C. Zakas)
-* Fix: module import specifiers should be defined (refs #1978) (Nicholas C. Zakas)
-* Fix: Ignore super in no-undef (refs #1968) (Nicholas C. Zakas)
-* Upgrade: Espree to v0.12.0 (refs #1968) (Nicholas C. Zakas)
-* Fix: destructured arguments should work in block-scoped-var (fixes #1996) (Nicholas C. Zakas)
-* Fix: Line breaking with just carriage return (fixes #2005) (Nicholas C. Zakas)
-* Fix: location of new-cap error messages (fixes #2025) (Mathias Schreck)
-* Breaking: Stop checking JSX variable use, expose API instead (fixes #1911) (Glen Mailer)
-* Fix: Check spacing of class methods (fixes #1989) (Nicholas C. Zakas)
-* New: no-duplicate-case rule to disallow a duplicate case label (fixes #2015) (Dieter Oberkofler)
-* Clarify issue requirement for doc pull requests (Ian)
-* Add quotes around object key (Ian)
-* Fix: Add comma-dangle allow-multiline (fixes #1984) (Keith Cirkel)
-* Fix: Don't explode on default export function (fixes #1985) (Nicholas C. Zakas)
-* Update: Add AST node exceptions to comma-style. (fixes #1932) (Evan Simmons)
-* Docs: Add spread operator to available language options (Nicholas C. Zakas)
-* New: generator-star-spacing rule (fixes #1680, fixes #1949) (Brandon Mills)
-
-v0.16.2 - March 10, 2015
-
-* 0.16.2 (Nicholas C. Zakas)
-* Fix: Ensure globalReturn isn't on when node:false (fixes #1995) (Nicholas C. Zakas)
-* Downgrade: escope pegged to 2.0.6 (refs #2001) (Nicholas C. Zakas)
-* Upgrade: escope to 2.0.7 (fixes #1978) (Nicholas C. Zakas)
-* Docs: Update descriptive text for --no-ignore option. (David Anson)
-* Upgrade: estraverse to latest for ESTree support (fixes #1986) (Nicholas C. Zakas)
-* Fix: Global block-scope-var check should work (fixes #1980) (Nicholas C. Zakas)
-* Fix: Don't warn about parens around yield (fixes #1981) (Nicholas C. Zakas)
-
-v0.16.1 - March 8, 2015
-
-* 0.16.1 (Nicholas C. Zakas)
-* Fix: Node.js scoping in block-scoped-var (fixes #1969) (Nicholas C. Zakas)
-* Update: Enable ES6 scoping for more options (Nicholas C. Zakas)
-* Fix: Ensure all export nodes are traversable (fixes #1965) (Nicholas C. Zakas)
-* Fix: Ensure class names are marked as used (fixes #1967) (Nicholas C. Zakas)
-* Fix: remove typo that caused a crash (fixes #1963) (Fabricio C Zuardi)
-* Docs: Added missing "are" (Sean Wilkinson)
-
-v0.16.0 - March 7, 2015
-
-* 0.16.0 (Nicholas C. Zakas)
-* Fix: Pass correct sourceType to escope (fixes #1959) (Nicholas C. Zakas)
-* Fix: Scoping for Node.js (fixes #892) (Nicholas C. Zakas)
-* Fix: strict rule should honor module code (fixes #1956) (Nicholas C. Zakas)
-* New: Add es6 environment (fixes #1864, fixes #1944) (Nicholas C. Zakas)
-* Docs: Update ecmaFeatures list (fixes #1942) (Nicholas C. Zakas)
-* Fix: Make no-unused-vars ignore exports (fixes #1903) (Nicholas C. Zakas)
-* Upgrade: Espree to v1.11.0 (Nicholas C. Zakas)
-* Fix: Comment configuration of rule doesn't work (fixes #1792) (Jary)
-* Fix: Rest args should work in no-undef and block-scoped-var (fixes #1543) (Nicholas C. Zakas)
-* Breaking: change no-comma-dangle to comma-dangle (fixes #1350) (Mathias Schreck)
-* Update: space-before-function-parentheses to support generators (fixes #1929) (Brandon Mills)
-* New: Adding support for "// eslint-disable-line rule" style comments (Billy Matthews)
-* Fix: Use unversioned sinon file in browser test (fixes #1947) (Nicholas C. Zakas)
-* Docs: Add mention of compatible parsers (Nicholas C. Zakas)
-* Fix: Better error when given null as rule config (fixes #1760) (Glen Mailer)
-* Update: no-empty to check TryStatement.handler (fixes #1930) (Brandon Mills)
-* Fix: space-before-function-parentheses and object methods (fixes #1920) (Brandon Mills)
-* New: no-dupe-args rule (fixes #1880) (Jamund Ferguson)
-* Fix: comma-spacing should ignore JSX text (fixes #1916) (Brandon Mills)
-* Breaking: made eol-last less strict (fixes #1460) (Glen Mailer)
-* New: generator-star middle option (fixes #1808) (Jamund Ferguson)
-* Upgrade: Espree to 1.10.0 for classes support (Nicholas C. Zakas)
-* Docs: no-plusplus.md - auto semicolon insertion (Miroslav Obradović)
-* Docs: Use union types in TokenStore JSDoc (refs #1878) (Brandon Mills)
-* Fix: block-scoped-var to work with destructuring (fixes #1863) (Nicholas C. Zakas)
-* Docs: Update docs for token-related methods (fixes #1878) (Nicholas C. Zakas)
-* Update: Remove preferGlobal from package.json (fixes #1877) (Nicholas C. Zakas)
-* Fix: allow block bindings in no-inner-declarations (fixes #1893) (Roberto Vidal)
-* Fix: getScope and no-use-before-define for arrow functions (fixes #1895) (Brandon Mills)
-* Fix: Make no-inner-declarations look for arrow functions (fixes #1892) (Brandon Mills)
-* Breaking: Change no-space-before-semi to semi-spacing and add "after" option (fixes #1671) (Mathias Schreck)
-* Update: Add support for custom preprocessors (fixes #1817) (Ilya Volodin)
-
-v0.15.1 - February 26, 2015
-
-* 0.15.1 (Nicholas C. Zakas)
-* Build: Fix release task (Nicholas C. Zakas)
-* Fix: check all semicolons in no-space-before-semi (fixes #1885) (Mathias Schreck)
-* Fix: Refactor comma-spacing (fixes #1587, fixes #1845) (Roberto Vidal)
-* Fix: Allow globalReturn in consistent-return (fixes #1868) (Brandon Mills)
-* Fix: semi rule should check throw statements (fixes #1873) (Mathias Schreck)
-* Docs: Added HolidayCheck AG as user (0xPIT)
-* Upgrade: `chalk` to 1.0.0 (Sindre Sorhus)
-* Docs: Add CustomInk to the list of companies (Derek Lindahl)
-* Docs: Alphabetize project & company usage list (Derek Lindahl)
-* Docs: fix typo (Henry Zhu)
-* Docs: Fix typo (Brenard Cubacub)
-
-v0.15.0 - February 21, 2015
-
-* 0.15.0 (Nicholas C. Zakas)
-* Upgrade: Espree to 1.9.1 (fixes #1816, fixes #1805) (Nicholas C. Zakas)
-* Fix: make rules work with for-of statements (fixes #1859) (Mathias Schreck)
-* Fix: Enable globalReturn for Node.js environment (fixes #1158) (Nicholas C. Zakas)
-* Fix: Location of extra paren message (fixes #1814) (Nicholas C. Zakas)
-* Fix: Remove unnecessary file exists check (fixes #1831) (Nicholas C. Zakas)
-* Fix: Don't count else-if in max-depth (fixes #1835) (Nicholas C. Zakas)
-* Fix: Don't flag for-of statement (fixes #1852) (Nicholas C. Zakas)
-* Build: Test using io.js as well (Nicholas C. Zakas)
-* Change customformat value to path (suisho)
-* Docs: Add a missing word in the Contributing doc (Ben Linskey)
-* Docs: Fix typo in wrap-iife rule doc title (Ben Linskey)
-* Docs: Update pages to fix rendering of lists (David Anson)
-* Fix: new-cap should allow defining exceptions (fixes #1424) (Brian Di Palma)
-* Update: Add requireReturnDescription for valid-jsdoc (fixes #1833) (Brian Di Palma)
-* New: rule no-throw-literal added (fixes #1791) (Dieter Oberkofler)
-* New: multi-line option for the curly rule (fixes #1812) (Hugo Wood)
-* Docs: fix typo in configuring docs (mendenhallmagic)
-* Update: Backslashes in path (fixes #1818) (Jan Schär)
-* Docs: Update pages to fix rendering of lists and fenced code blocks (David Anson)
-* Docs: add webpack loader to the docs/integrations page (Maxime Thirouin)
-* Breaking: space-before-function-parentheses replaces space-after-function-name and checkFunctionKeyword (fixes #1618) (Mathias Schreck)
-
-v0.14.1 - February 8, 2015
-
-* 0.14.1 (Nicholas C. Zakas)
-* Fix: Exit code should be 1 for any number of errors (fixes #1795) (Nicholas C. Zakas)
-* Fix: Check indentation of first line (fixes #1796) (Nicholas C. Zakas)
-* Fix: strict rules shouldn't throw on arrow functions (fixes #1789) (Nicholas C. Zakas)
-
-v0.14.0 - February 7, 2015
-
-* 0.14.0 (Nicholas C. Zakas)
-* Update: Fix indentation of comment (Nicholas C. Zakas)
-* Fix: comma-spacing for template literals (fixes #1736) (Nicholas C. Zakas)
-* Build: Add Node.js 0.12 testing (Nicholas C. Zakas)
-* Breaking: Remove node from results (fixes #957) (Nicholas C. Zakas)
-* Breaking: Exit code is now error count (Nicholas C. Zakas)
-* Docs: Correct getFormatter() documentation (refs #1723) (Nicholas C. Zakas)
-* Update: Make rules work with arrow functions (fixes #1508, fixes #1509, fixes #1493) (Nicholas C. Zakas)
-* Fix: Ensure template string references count (fixes #1542) (Nicholas C. Zakas)
-* Fix: no-undef to work with arrow functions (fixes #1604) (Nicholas C. Zakas)
-* Upgrade: Espree to version 1.8.0 (Nicholas C. Zakas)
-* Fix: Don't throw error for arguments (fixes #1759) (Nicholas C. Zakas)
-* Fix: Don't warn on computed nonliteral properties (fixes #1762) (Nicholas C. Zakas)
-* New: Allow parser to be configured (fixes #1624) (Nicholas C. Zakas)
-* Docs: Added double quotes for JSON keys for comma-spacing and key-spacing rule (Dmitry Polovka)
-* New: Rule indent (fixes #1022) (Dmitriy Shekhovtsov)
-* Revert "New: Rule indent (fixes #1022)" (Nicholas C. Zakas)
-* Update: fix eslint indentations (fixes #1770) (Dmitriy Shekhovtsov)
-* Fix: Scoping issues for no-unused-vars (fixes #1741) (Nicholas C. Zakas)
-* Docs: Added `eslint-enable` inline (Ivan Fraixedes)
-* New: Add predefined Meteor globals (fixes #1763) (Johan Brook)
-* New: Rule indent (fixes #1022) (Dmitriy Shekhovtsov)
-* Update: Check all assignments for consistent-this (fixes #1513) (Timothy Jones)
-* Fix: Support exceptions in no-multi-spaces (fixes #1755) (Brandon Mills)
-* Docs: Forgotten parentheses in code snippet (Ivan Fraixedes)
-* Update: CLIEngine results include warning and error count (fixes #1732) (gyandeeps)
-* Fix: Scoping issues for no-unused-vars (fixes #1733) (Nicholas C. Zakas)
-* Update: Add getNodeByRangeIndex method (refs #1755) (Brandon Mills)
-* Update: Replace getTokenByRange(Index->Start) (refs #1721) (Brandon Mills)
-* Update: Fast-path for empty input (fixes #546) (Nicholas C. Zakas)
-* Fix: Allow single line else-if (fixes #1739) (Nicholas C. Zakas)
-* Fix: Don't crash when $HOME isn't set (fixes #1465) (Nicholas C. Zakas)
-* Fix: Make no-multi-spaces work for every case (fixes #1603, fixes #1659) (Nicholas C. Zakas)
-* Breaking: Show error and warning counts in stylish summary (fixes #1746) (Brandon Mills)
-* Docs: fixed typo in no-lone-blocks docs (Vitor Balocco)
-* Docs: fixed typo in consistent-return docs (Vitor Balocco)
-* Breaking: remove implied eval check from no-eval (fixes #1202) (Mathias Schreck)
-* Update: Improve CLIEngine.getFormatter() (refs #1723) (Nicholas C. Zakas)
-* Docs: Add Backbone plugin link (Ilya Volodin)
-* Docs: use npm's keyword route (Tom Vincent)
-* Build: Update sitegen script (Closes #1725) (Ilya Volodin)
-
-v0.13.0 - January 24, 2015
-
-* 0.13.0 (Nicholas C. Zakas)
-* Update: The rule spaced-line-comment now also allows tabs and not only spaces as whitespace. (fixes #1713) (Dieter Oberkofler)
-* Docs: add Jasmine rules and eslintplugin npm links (Tom Vincent)
-* Fix: Make no-redeclare work with let (fixes #917) (Nicholas C. Zakas)
-* Update: Add CLIEngine.getFormatter() (fixes #1653) (Nicholas C. Zakas)
-* Breaking: Update escope (fixes #1642) (Nicholas C. Zakas)
-* Update: Switch to using estraverse-fb (fixes #1712) (Nicholas C. Zakas)
-* Docs: Update README FAQ (Nicholas C. Zakas)
-* Update: no-warning-comments matches on whole word only (fixes #1709) (Nick Fisher)
-* Build: Add JSDoc generation (fixes #1363) (Nicholas C. Zakas)
-* Docs: Add more info about context (fixes #1330) (Nicholas C. Zakas)
-* Upgrade: Espree to 1.7.1 (fixes #1706) (Nicholas C. Zakas)
-* Docs: Make CLA notice more prominent (Nicholas C. Zakas)
-* Update: Added globals for: phantom,jquery, prototypejs, shelljs (fixes #1704) (Dmitriy Shekhovtsov)
-* Docs: Fixed example for the space-return-throw-case rule (mpal9000)
-* Fix: Except object literal methods from func-names (fixes #1699) (Brandon Mills)
-* Update: use global strict mode everywhere (fixes #1691) (Brandon Mills)
-* Update: Add allowPattern option for dot-notation rule (fixes #1679) (Tim Schaub)
-* Fix: Missing undeclared variables in JSX (fixes #1676) (Yannick Croissant)
-* Fix: no-unused-expressions rule incorrectly flagging yield (fixes #1672) (Rémi Gérard-Marchant)
-* Update: Combine strict mode rules (fixes #1246) (Brandon Mills)
-* Fix: disregards leading './' in ignore pattern or file name (fixes #1685) (Chris Montrois)
-* Upgrade: globals module to latest (fixes #1670) (Nicholas C. Zakas)
-* Fix: generator-star should allow params (fixes #1677) (Brandon Mills)
-* Fix: no-unused-vars for JSX (fixes #1673 and fixes #1534) (Yannick Croissant)
-* Docs: Add angularjs-eslint link into the integration doc (Emmanuel DEMEY)
-
-v0.12.0 - January 17, 2015
-
-* 0.12.0 (Nicholas C. Zakas)
-* Fix: Track JSX global variable correctly (fixes #1534) (Nicholas C. Zakas)
-* Fix: Property regex flag checking (fixes #1537) (Nicholas C. Zakas)
-* Docs: Add angularjs-eslint link into the integration doc (Emmanuel DEMEY)
-* Update: Expose ecmaFeatures on context (fixes #1648) (Nicholas C. Zakas)
-* Docs: Added Fitbit to the list of companies (Igor Zalutsky)
-* New: gen-star rule (refs #1617) (Jamund Ferguson)
-* New: no-var rule (refs #1617) (Jamund Ferguson)
-* Fix: Support JSX spread operator (fixes #1634) (Nicholas C. Zakas)
-* Docs: Document ecmaFeatures (Nicholas C. Zakas)
-* Upgrade: several dependencies (fixes #1377) (Nicholas C. Zakas)
-* Fix: Broken JSX test (Nicholas C. Zakas)
-* Fix: no-bitwise reports on bitwise assignment expressions (fixes #1643) (Mathias Schreck)
-* Fix: Find JSXIdentifier refs in no-unused-vars (fixes #1534) (Nicholas C. Zakas)
-* Update: Add a couple JSX tests (Nicholas C. Zakas)
-* Fix: quotes rule ignores JSX literals (fixes #1477) (Nicholas C. Zakas)
-* Fix: Don't warn on JSX literals with newlines (fixes #1533) (Nicholas C. Zakas)
-* Update: Fully enable JSX support (fixes #1640) (Nicholas C. Zakas)
-* Breaking: Allow parser feature flips (fixes #1602) (Nicholas C. Zakas)
-* Fix: Allow comments in key-spacing groups (fixes #1632) (Brandon Mills)
-* Fix: block-scoped-var reports labels (fixes #1630) (Michael Ficarra)
-* Docs: add newline to no-process-env (fixes #1627) (Tom Vincent)
-* Fix: Update optionator, --no in help (fixes #1134) (George Zahariev)
-* Fix: Allow individual newlines in space-in-brackets (fixes #1614) (Brandon Mills)
-* Docs: Correct alignment in example project tree (Tim Schaub)
-* Docs: Remove references to Esprima (Nicholas C. Zakas)
-* Docs: Remove illegal code fence (Nicholas C. Zakas)
-
-v0.11.0 - December 30, 2014
-
-* 0.11.0 (Nicholas C. Zakas)
-* Fix: Adding regexp literal exception (fixes #1589) (Greg Cochard)
-* Fix: padded-blocks incorrectly complained on comments (fixes #1416) (Mathias Schreck)
-* Fix: column location of key-spacing with additional tokens (fixes #1458) (Mathias Schreck)
-* Build: tag correct commit (refs #1606) (Mathias Schreck)
-* Upgrade: Updat Espree to 1.3.1 (Nicholas C. Zakas)
-* Fix: add es3 config option to dot-notation rule (fixes #1484) (Michael Ficarra)
-* Fix: valid-jsdoc should recognize @class (fixes #1585) (Nicholas C. Zakas)
-* Update: Switch to use Espree (fixes #1595) (Nicholas C. Zakas)
-* Fix: brace-style stroustrup should report on cuddled elseif (fixes #1583) (Ian Christian Myers)
-* New: Configuration via package.json (fixes #698) (Michael Mclaughlin)
-* Update: Set environments w/ globals (fixes #1577) (Elan Shanker)
-* Fix: yoda treats negative numbers as literals (fixes #1571) (Brandon Mills)
-* Fix: function arguments now count towards no-shadow check (fixes #1584) (Glen Mailer)
-* Fix: check if next statement is on newline when warning against extra semicolons. (fixes #1580) (Evan You)
-* Update: add yoda exception for range tests (fixes #1561) (Brandon Mills)
-* New: space-after-function-name (fixes #1340) (Roberto Vidal)
-
-v0.10.2 - December 12, 2014
-
-* 0.10.2 (Nicholas C. Zakas)
-* Fix: detect for...in in no-loop-func (fixes #1573) (Greg Cochard)
-* Update: simplify comma-spacing logic (fixes #1562) (Brandon Mills)
-* Fix: operator-assignment addition is non-commutative (fixes#1556) (Brandon Mills)
-* 0.10.1 (Nicholas C. Zakas)
-* Update: Add new-cap exception configurations. (Fixes #1487) - `newCapsAllowed` - `nonNewCapsAllowed` (Jordan Harband)
-
-v0.10.1 - December 6, 2014
-
-* 0.10.1 (Nicholas C. Zakas)
-* Docs: Fix v0.10.0 changelog (Nicholas C. Zakas)
-* Build: Ensure changelog works with large semver versions (Nicholas C. Zakas)
-* Fix: comma-spacing and comma-style to work with array literals (fixes #1492) (Nicholas C. Zakas)
-* Update: better operator regex in use-isnan rule (fixes #1551) (Michael Ficarra)
-* Fix: wrong op index in no-multi-spaces (fixes #1547) (Brandon Mills)
-* Fix: Restrict use-isnan violations to comparison operators. (Fixes #1535) (Jordan Harband)
-* Fix: comma-spacing has false positives when parenthesis are used (fixes #1457) (Jamund Ferguson)
-* Docs: alphabetize the "Stylistic Issues" section (Jeff Williams)
-* Build: make the "gensite" target work when DOCS_DIR does not exist (fixes #1530) (Jeff Williams)
-* Docs: badges should only refer to master branch (Mathias Schreck)
-* Fix: prevent crash on empty blocks in no-else-return (fixes #1527) (Mathias Schreck)
-* Build: Fix md to html conversion regex (fixes #1525) (Brandon Mills)
-* 0.10.0 (Nicholas C. Zakas)
-
-v0.10.0 - November 27, 2014
-
-* 0.10.0 (Nicholas C. Zakas)
-* Fix: Add Object and Function as exceptions in new-cap (refs #1487) (Nicholas C. Zakas)
-* Breaking: Allow extensionless files to be passed on CLI (fixes #1131) (Nicholas C. Zakas)
-* Fix: typo: iffe to iife, none to non (Michael Ficarra)
-* Update: refactor tokens API (refs #1212) (Brandon Mills)
-* New: Allow other file extensions (fixes #801) (Nicholas C. Zakas)
-* Update: Add Event to browser globals (fixes #1474) (Nicholas C. Zakas)
-* Fix: check function call arguments in comma-spacing (fixes #1515) (Mathias Schreck)
-* Update: Add no-cond-assign option to disallow nested assignments in conditionals (fixes #1444) (Jeff Williams)
-* Fix: crash in no-multi-spaces on empty array elements (fixes #1418) (Brandon Mills)
-* Fix: Don't explode on directory traversal (fixes #1452) (Nicholas C. Zakas)
-* Fix: no-fallthrough should work when semis are missing (fixes #1447) (Nicholas C. Zakas)
-* Fix: JSDoc parsing by updating doctrine (fixes #1442) (Nicholas C. Zakas)
-* Update: restore the "runs" global present in Jasmine 1.3 (fixes #1498) (Michał Gołębiowski)
-* Fix: ignore undefined identifiers in typeof (fixes #1482) (Mathias Schreck)
-* Fix: Ignoring empty comments. (fixes #1488) (Greg Cochard)
-* New: Add space-unary-ops rules (#1346) (Marcin Kumorek)
-* Update: Remove shebang workaround in spaced-line-comment (fixes #1433) (Michael Ficarra)
-* Docs: change 'and' to 'an' in docs/rules/valid-jsdoc.md (fixes #1441) (Michael Ficarra)
-* Update: Add `beforeAll` and `afterAll` to the Jasmine globals (fixes #1478) (Gyandeep Singh)
-* Update: Add exception options to space-in-parens (fixes #1368) (David Clark)
-* Build: Add check for license issues (fixes #782) (Brandon Mills)
-* Docs: update badges (Yoshua Wuyts)
-* Docs: Update pages to fix rendering of lists and fenced code blocks (David Anson)
-* Fix: env rules merging for command line config (fixes #1271) (Roberto Vidal)
-* Fix: Collect variables declare in switch-case.(fixes #1453) (chris)
-* Fix: remove extra capture group (Nate-Wilkins)
-* Update: allow distinct alignment groups in key-spacing (fixes #1439) (Brandon Mills)
-* Fix: message for numeric property names in quote-props (fixes #1459) (Brandon Mills)
-* Docs: Remove assumption about the rule config (Alexander Schmidt)
-* New: Add ability to time individual rules (fixes #1437) (Brandon Mills)
-* Fix: single quotes (Nate-Wilkins)
-* Docs: Fix broken code fences in key-spacing docs (Brandon Mills)
-* Docs: Explain .eslintignore features (fixes #1094) (Brandon Mills)
-* Breaking: ignore node_modules by default (fixes #1163) (Brandon Mills)
-* Fix: Adds clamping to getSource beforeCount (fixes #1427) (Greg Gianforcaro)
-* New: add no-inline-comment rule (fixes #1366) (Greg Cochard)
-* Fix: '.md' to '.html' with anchors (fixes #1415) (Nate-Wilkins)
-* Build: Filter and sort versions in gensite (fixes #1430) (Brandon Mills)
-* Build: Escape period in regex (fixes #1428) (Brandon Mills)
-* Revert "Fix: '.md' to '.html' with anchors (fixes #1415)" (Nicholas C. Zakas)
-* 0.9.2 (Nicholas C. Zakas)
-* New: Add operator-assignment rule (fixes #1420) (Brandon Mills)
-
-v0.9.2 - November 1, 2014
-
-* 0.9.2 (Nicholas C. Zakas)
-* Fix: '.md' to '.html' with anchors (fixes #1415) (Nate-Wilkins)
-* Fix: Allow line breaks in key-spacing rule (fixes #1407) (Brandon Mills)
-* Build: add coveralls integration (fixes #1411) (Mathias Schreck)
-* Fix: add severity flag for ignored file warning (fixes #1401) (Mathias Schreck)
-* Fix: Keep sinon at ~1.10.3 (fixes #1406) (Brandon Mills)
-* Fix: ! negates .eslintignore patterns (fixes #1093) (Brandon Mills)
-* Fix: let fs.stat throw if a file does not exist (fixes #1296) (Mathias Schreck)
-* Fix: check switch statements in space-before-blocks (fixes #1397) (Mathias Schreck)
-* Docs: fix rule name in example configuration (Mathias Schreck)
-* Fix: disable colors during test run (fixes #1395) (Mathias Schreck)
-* New: add isPathIgnored method to CLIEngine (fixes #1392) (Mathias Schreck)
-* Docs: changing eslint to ESLint and add missing backtick (Mathias Schreck)
-* Docs: Documents the functionality to load a custom formatter from a file (Adam Baldwin)
-* 0.9.1 (Nicholas C. Zakas)
-* Update: Option type for mixed tabs and spaces (fixes #1374) (Max Nordlund)
-* Fix: Nested occurrences of no-else-return now show multiple reports (fixes #1369) (Jordan Hawker)
-
-v0.9.1 - October 25, 2014
-
-* 0.9.1 (Nicholas C. Zakas)
-* Docs: fix link on governance model (azu)
-* Fix: plugins without rulesConfig causes crash (fixes #1388) (Mathias Schreck)
-* 0.9.0 (Nicholas C. Zakas)
-
-v0.9.0 - October 24, 2014
-
-* 0.9.0 (Nicholas C. Zakas)
-* New: Allow reading from STDIN (fixes #368) (Nicholas C. Zakas)
-* New: add --quiet option (fixes #905) (Mathias Schreck)
-* Update: Add support for plugin default configuration (fixes #1358) (Ilya Volodin)
-* Fix: Make sure shebang comment node is removed (fixes #1352) (Nicholas C. Zakas)
-* New: Adding in rule for irregular whitespace checking. (fixes #1024) (Jonathan Kingston)
-* Fix: space-in-parens should not throw for multiline statements (fixes #1351) (Jary)
-* Docs: Explain global vs. local plugins (fixes #1238) (Nicholas C. Zakas)
-* Docs: Add docs on Node.js API (fixes #1247) (Nicholas C. Zakas)
-* Docs: Add recommended keywords for plugins (fixes #1248) (Nicholas C. Zakas)
-* Update: Add CLIEngine#getConfigForFile (fixes #1309) (Nicholas C. Zakas)
-* Update: turn on comma-style for project (fixes #1316) (Nicholas C. Zakas)
-* Fix: Ensure messages are sorted by line (fixes #1343) (Nicholas C. Zakas)
-* Update: Added arraysInObjects and objectsInObjects options to space-in-brackets rule (fixes #1265, fixes #1302) (vegetableman)
-* Breaking: Removed comma spacing check from space-infix-ops (fixes #1361) (vegetableman)
-* Fix: addressed linting errors (Nicholas C. Zakas)
-* Docs: Add Contributor Model (fixes #1341) (Nicholas C. Zakas)
-* Docs: Add reference to CLA (Nicholas C. Zakas)
-* Build: add version numbers to docs (fixes #1170) (Mathias Schreck)
-* Fix: no-fallthrough incorrectly flagged falls through annotations (fixes #1353) (Mathias Schreck)
-* Build: separate site publishing form generation (fixes #1356) (Mathias Schreck)
-* New: Add key-spacing rule (fixes #1280) (Brandon Mills)
-* New: add spaced-line-comment rule (fixes #1345) (Greg Cochard)
-* Docs: added more Related Rules sections (fixes #1347) (Delapouite)
-* Fix: resolve linting issue in (fixes #1339) (Nicholas C. Zakas)
-* New: add space-before-blocks rule (fixes #1277) (Mathias Schreck)
-* Docs: Remove moot integration plugins (Sindre Sorhus)
-* New: add rule for multiple empty lines (fixes #1254) (Greg Cochard)
-* Fix: no-shadow rule should consider function expressions (fixes #1322) (Mathias Schreck)
-* Update: remove globals present only in Jasmine plugins (fixes #1326) (Michał Gołębiowski)
-* New: added no-multi-spaces rule (fixes #630) (vegetableman)
-* New: Added comma-spacing rule (Fixes #628, Fixes #1319) (vegetableman)
-* New: add rule for padded blocks (fixes #1278) (Mathias Schreck)
-* Docs: fix eqeqeq isNullCheck comment (Denis Sokolov)
-* Fix: no-comma-dangle violation in unit test and Makefile.js/lint not checking return codes (fixes #1306) (David Anson)
-* Fix: allow comma-last with object properties having line breaks (fixes #1314) (vegetableman)
-* New: Added comma-style rule (fixes #1282) (vegetableman)
-* Update: add space after function keyword check (fixes #1276) (Mathias Schreck)
-* Update: Add missing environments and fix sorting/grouping of rules (fixes #1307, fixes #1308) (David Anson)
-* Docs: Fix sorting of rules within each section (David Anson)
-* Docs: Correct a few misspelled words (David Anson)
-* Docs: Update multiple pages to fix rendering of fenced code blocks (David Anson)
-* New: Added no-process-env rule (fixes #657) (vegetableman)
-* Fix: add rule ensuring #1258 is fixed by recent rewrite (fixes #1258) (Michael Ficarra)
-* Update: split propertyName from singleValue in space-in-brackets (fixes #1253) (Michael Ficarra)
-* Update: add "as-needed" option to quote-props rule (fixes #1279) (Michael Ficarra)
-* Docs: fixed broken link and changed warning level to error level (vegetableman)
-* Docs: Added "the native web" to the list of companies that use ESLint. (Golo Roden)
-* Docs: Add BountySource badge to README (Nicholas C. Zakas)
-* 0.8.2 (Nicholas C. Zakas)
-
-v0.8.2 - September 20, 2014
-
-* 0.8.2 (Nicholas C. Zakas)
-* Docs: Updated contribution guidelines to add accepted/bounty issues descriptions (Nicholas C. Zakas)
-* Docs: Update README with links and FAQs (Nicholas C. Zakas)
-* Docs: add finally to space-after-keywords documentation (Mathias Schreck)
-* New: add ignoreCase option to sort-vars (fixes #1272) (Mathias Schreck)
-* Docs: fix typo (Barry Handelman)
-* Docs: Fix broken Markdown on configuration page (Nicholas C. Zakas)
-* Docs: Fix reference to wrong rule name (Harry Wolff)
-* Upgrade: Most dev dependencies (Nicholas C. Zakas)
-* Upgrade: shelljs to 0.3.0 (Nicholas C. Zakas)
-* Upgrade: doctrine to 0.5.2 (Nicholas C. Zakas)
-* Upgrade: esprima to 1.2.2 (Nicholas C. Zakas)
-* Upgrade: eslint-tester to latest (Nicholas C. Zakas)
-* Fix: Load .eslintrc in directory with $HOME as an ancestor (fixes #1266) (Beau Gunderson)
-* Fix: load .eslintrc from HOME (fixes #1262) (Beau Gunderson)
-* New: Add sharable rule settings (fixes #1233) (Ilya Volodin)
-* Upgrade: upgrade outdated dependencies (fixes #1251) (Mathias Schreck)
-* Docs: fix typo in no-ex-assign documentation (Michael Ficarra)
-* Docs: add intellij plugin to integrations (ido)
-* Docs: Changing NPM to npm (Peter deHaan)
-* Fix: strict should check function expressions (fixes #1244) (Brandon Mills)
-* Docs: fix vars-on-top documentation (fixes #1234) (Mathias Schreck)
-* 0.8.1 (Nicholas C. Zakas)
-* Docs: Fixed a typo in brace-style.md (Anton Antonov)
-
-v0.8.1 - September 9, 2014
-
-* 0.8.1 (Nicholas C. Zakas)
-* Fix: Ensure exit code is 1 when there's a syntax error (fixes #1239) (Nicholas C. Zakas)
-* Docs: fix up vars-on-top documentation (fixes #1234) (Michael Ficarra)
-* Fix: vars-on-top directive support (fixes #1235) (Michael Ficarra)
-* Fix: Avoid mutating node.range in max-len (fixes #1224) (Brandon Mills)
-* Docs: Typo, add missing quotation mark (Ádám Lippai)
-* Update: space-in-brackets to allow exceptions (fixes #1142) (Brandyn Bennett)
-* 0.8.0 (Nicholas C. Zakas)
-
-v0.8.0 - September 5, 2014
-
-* 0.8.0 (Nicholas C. Zakas)
-* Perf-related revert "Fix: Speed up tokens API (refs #1212)" (Nicholas C. Zakas)
-* Fix: no-fallthrough: continue affects control flow, too (fixes #1220) (Michael Ficarra)
-* Fix: rewrite no-unused-vars rule (refs #1212) (Michael Ficarra)
-* Fix: Error when there's a \r in .eslintrc (#1172) (Gyandeep Singh)
-* Added rule disallowing reserved words being used as keys (fixes #1144) (Emil Bay)
-* Fix: rewrite no-spaced-func rule (refs #1212) (Michael Ficarra)
-* Fix: Speed up getScope() (refs #1212) (Brandon Mills)
-* Fix: no-extra-strict behavior for named function expressions (fixes #1209) (Mathias Schreck)
-* Add Date.UTC to allowed capitalized functions (David Brockman Smoliansky)
-* New: Adding 'vars-on-top' rule (fixes #1148) (Gyandeep Singh)
-* Fix: Speed up tokens API (refs #1212) (Brandon Mills)
-* Docs: document plugin usage (fixes #1117) (Mathias Schreck)
-* New: accept plugins from cli (fixes #1113) (Mathias Schreck)
-* Docs: fix some typos. (Mathias Schreck)
-* New: Load plugins from configs (fixes #1115). (Mathias Schreck)
-* Fix: no-unused-expressions better directive detection (fixes #1195) (Michael Ficarra)
-* Fix: no-unused-expressions directive support (fixes #1185) (Michael Ficarra)
-* Update: Add 'allowSingleLine' option to brace-style (fixes #1089) (John Gozde)
-* Docs: Spell checking and one extra closing curly in code example (Juga Paazmaya)
-* Fix: mergeConfigs ensures the plugins property exists (fixes #1191). (Mathias Schreck)
-* Update: Declare ES6 collections (Map, Set, WeakMap, WeakSet) as built-in globals (fixes #1189) (Michał Gołębiowski)
-* New: Adding 'plugin' CLI option (fixes #1112) (Greg)
-* Fix: Correct a typo in the error message in tests (Michał Gołębiowski)
-* New: Add no-extra-bind rule to flag unnecessary bind calls (fixes #982) (Bence Dányi)
-* Fix: Useless bind call in cli-engine (fixes #1181) (Bence Dányi)
-* Docs: Updates `amd` description (fixes #1175) (James Whitney)
-* New: Adds support for the `jasmine` env (fixes #1176) (James Whitney)
-* Fix: for-in support to no-empty-label rule (fixes #1161) (Marc Harter)
-* docs: Update link (Mathias Bynens)
-* Fix: crash when loading empty eslintrc file (fixes #1164) (Michael Ficarra)
-* Fix: no-unused-var should respect compound assignments (fixes #1166) (Michael Ficarra)
-* Update: ES3 `ReservedWord`s (fixes #1151) Adds ES3 `ReservedWord`s to the list of keywords in the `dot-notation` rule (fixes #1151) (Emil Bay)
-* Update: Update comment parser to read rule slashes (fixes #1116) (Jary)
-* New: add no-void rule (fixes #1017). (Mike Sidorov)
-* New: Add rules.import() (fixes #1114) (Mathias Schreck)
-* New: Make mergeConfigs() merge plugin entries (fixes #1111) (Mathias Schreck)
-* Breaking: Change no-global-strict to global-strict and add "always" option (fixes #989) (Brandon Mills)
-* Fix: no-unreachable should check top-level statements (fixes #1138) (Brandon Mills)
-* Fix: Speed up no-unreachable (fixes #1135) (Brandon Mills)
-* New: advanced handle-callback-err configuration (fixes #1124) (Mathias Schreck)
-* New: Expose CLIEngine (fixes #1083) (Gyandeep Singh)
-* Docs: Add link to new Atom linter (fixes #1125) (Gil Pedersen)
-* Fix: space-after-keywords checks finally of TryStatement (fixes #1122) (Michael Ficarra)
-* Fix: space-after-keywords checks while of DoWhileStatement (fixes #1120) (Michael Ficarra)
-* Fix: space-after-keywords w/ "never" should allow else-if (fixes #1118) (Michael Ficarra)
-* Fix: dot-notation rule flags non-keyword reserved words (fixes #1102) (Michael Ficarra)
-* Update: Use xml-escape instead of inline helper (Ref #848) (jrajav)
-* Update: Added comments support to .eslintignore (fixes #1084) (Vitaly Puzrin)
-* Update: enabled 'no-trailing-spaces' rule by default (fixes #1051) (Vitaly Puzrin)
-* Breaking: Ignore children of all patterns by adding "/**" (Fixes #1069) (jrajav)
-* Fix: skip dot files and ignored dirs on traverse (fixes #1077, related to #814) (Vitaly Puzrin)
-* Docs: Added Gruntjs plugin on integrations page (Gyandeep Singh)
-* Fix: don't break node offsets if hasbang present (fixes #1078) (Vitaly Puzrin)
-* Build: Exclude readme/index from rules Resources generation (Fixes #1072) (jrajav)
-* Docs: Change eol-last examples to `` (Fixes #1068) (jrajav)
-* 0.7.4 (Nicholas C. Zakas)
-* New: space-in-parens rule (Closes #627) (jrajav)
-
-v0.7.4 - July 10, 2014
-
-* 0.7.4 (Nicholas C. Zakas)
-* Docs: Fix 'lintinging' typo and ref links (Tom Vincent)
-* Fix: Transform envs option to object in Config (Fixes #1064) (jrajav)
-* 0.7.3 (Nicholas C. Zakas)
-
-v0.7.3 - July 9, 2014
-
-* 0.7.3 (Nicholas C. Zakas)
-* Update: Address code review comment for strict rule (refs #1011) (Nicholas C. Zakas)
-* Docs: Update copyright policy (Nicholas C. Zakas)
-* Docs: Update documentation for max-len to include description of second option (fixes #1006) (Nicholas C. Zakas)
-* Fix: Avoid double warnings for strict rule (fixes #1011) (Nicholas C. Zakas)
-* Fix: Check envs for true/false (Fixes #1059) (jrajav)
-* 0.7.2 (Nicholas C. Zakas)
-
-v0.7.2 - July 8, 2014
-
-* 0.7.2 (Nicholas C. Zakas)
-* Fix: no-mixed-spaces-and-tabs incorrectly flagging multiline comments (fixes #1055) (Nicholas C. Zakas)
-* Fix: new-cap error that throws on non-string member (fixes #1056) (Nicholas C. Zakas)
-* Fix: Always make globals an object (Fixes #1049) (jrajav)
-* 0.7.1 (Nicholas C. Zakas)
-
-v0.7.1 - July 7, 2014
-
-* 0.7.1 (Nicholas C. Zakas)
-* Docs: Add Related Rules sections (Fixes #990) (jrajav)
-* Fix: Check output file isn't dir, fix tests (Fixes #1034) (jrajav)
-* Docs: Updated documentation for several rules (Nicholas C. Zakas)
-* Docs: Updated contributor guide and dev env setup guide (Nicholas C. Zakas)
-* Breaking: Implement configuration hierarchy (fixes #963) (Nicholas C. Zakas)
-* Update: greatly simplify eqeqeq's operator finding logic (fixes #1037) (Michael Ficarra)
-* New: Add getSourceLines() to core and rule context (fixed #1005) (Jary)
-* Build + Docs: Adding generated resource links to rule docs (Fixes #1021) (jrajav)
-* Fix: Ignore unused params for args: 'none' (Fixes #1026) (jrajav)
-* Fix: Point eqeqeq error at operator (Fixes #1029) (jrajav)
-* New: report output to a file (fixes #1027) (Gyandeep Singh)
-* Breaking: CLIEngine abstraction for CLI operations; formatters no longer are passed configs (fixes #935) (Nicholas C. Zakas)
-* Fix: Allow stdout to drain before exiting (fixes #317) (Nicholas C. Zakas)
-* New: add no-undefined rule (fixes #1020) (Michael Ficarra)
-* New: Added no-mixed-spaces-and-tabs rule (fixes #1003) (Jary)
-* New: Added no-trailing-spaces rule (fixes #995) (Vitaly Puzrin)
-* Update: Factor ignores out of Config (fixes #958) (jrajav)
-* Fix: rewrite eol-last rule (fixes #1007) (fixes #1008) (Michael Ficarra)
-* Fix: add additional IIFE exception in no-extra-parens (fixes #1004) (Michael Ficarra)
-* Docs: Removed reference to brace-style Stroustrup default (fixes #1000) (Caleb Troughton)
-* New: Added eol-last rule (Fixes #996) (Vitaly Puzrin)
-* Fix: Put rule severity in messages (Fixes #984); deprecates passing full config to Formatters (jrajav)
-* Fix: no-unused-vars to check only file globals (fixes #975) (Aliaksei Shytkin)
-* Build: Makefile - Check for rule ids in docs titles (Fixes #969) (Delapouite)
-* Docs: guard-for-in - added missing id in title (Fixes #969) (Delapouite)
-* Breaking: Change 'no-yoda' rule to 'yoda' and add "always" option (Fixes #959) (jrajav)
-* Fix: Fixes no-unused-vars to check /*globals*/ (Fixes #955) (jrajav)
-* Update: no-eval to also warn on setTimeout and setInterval (fixes #721) (Nicholas C. Zakas)
-* Remove: experimental match() method (Nicholas C. Zakas)
-* Update: space-in-brackets now always allows empty object and array literals to have no spaces (fixes #797) (Nicholas C. Zakas)
-* New: Allow the cli parameter "color" and "no-color" (fixes #954) (Tom Gallacher)
-* Fix: valid-jsdoc no more warning for multi-level params (Fixes #925) (Delapouite)
-* Update: Search parent directories for .eslintignore (Fixes #933) (jrajav)
-* Fix: Correct order of arguments passed to assert.equal (fixes #945) (Michał Gołębiowski)
-* Update: Write the summary in stylish formatter in yellow if no errors (fixes #906); test coloring of messages (Michał Gołębiowski)
-* Fix: Corrects configs merging into base config (Fixes #838) (jrajav)
-* Fix: Adding check if char is non-alphabetic to new-cap (Fixes #940) (jrajav)
-* Docs: Update about page description (fixes #936) (Nicholas C. Zakas)
-* Docs: Add '/', forgotten in first commit (Fixes #931) (jrajav)
-* Update: Rule `new-cap` checks capitalized functions (fixes #904) (Aliaksei Shytkin)
-* Docs: Mention allowed semicolons in "never" mode for 'semi' rule (fixes #931) (jrajav)
-* Docs: Mention Yeoman generator in dev setup (fixes #914) (Nicholas C. Zakas)
-* Build: Remove flaky perf test from Travis (Nicholas C. Zakas)
-* Breaking: Refactor .eslintignore functionality (refs #928, fixes #901, fixes #837, fixes #853) (Nicholas C. Zakas)
-* 0.6.2 (Nicholas C. Zakas)
-* Breaking: Remove JSON support for .eslintignore (fixes #883) (icebox)
-
-v0.6.2 - May 23, 2014
-
-* 0.6.2 (Nicholas C. Zakas)
-* Fix: Adding per-environment rule configs to docs and doc validation (Fixes #918) (jrajav)
-* Docs: Updated contribution guidelines (Nicholas C. Zakas)
-* Docs: Update description of eqeqeq to mention special cases (fixes #924) (Nicholas C. Zakas)
-* Fix: block-scoped-var CatchClause handling (fixes #922) (Michael Ficarra)
-* Fix: block-scoped-var respects decls in for and for-in (fixes #919) (Michael Ficarra)
-* Update: Implement eqeqeq option "allow-null" (fixes #910) (Michał Gołębiowski)
-* Fix: new-cap should allow non-alpha characters (fixes #897) (Michael Ficarra)
-* Update: Refactor ESLintTester to fix dependency hell (fixes #602) (Nicholas C. Zakas)
-* Fix: Merge configs with ancestors (Fixes #820) (jrajav)
-* Fix: no-fallthrough should respect block statements in case statements (fixes #893) (Nicholas C. Zakas)
-* Docs: Fix layout issue in configuration docs (fixes #889) (Nicholas C. Zakas)
-* Build: Enable default-case rule (fixes #881) (icebox)
-* Build: Enable space-after-keywords (fixes #884) (icebox)
-* Fix api double emit on comment nodes (fixes #876) (Aliaksei Shytkin)
-* 0.6.1 (Nicholas C. Zakas)
-
-v0.6.1 - May 17, 2014
-
-* 0.6.1 (Nicholas C. Zakas)
-* Upgrade: Optionator to 0.4.0 (fixes #885) (Nicholas C. Zakas)
-* 0.6.0 (Nicholas C. Zakas)
-
-v0.6.0 - May 17, 2014
-
-* 0.6.0 (Nicholas C. Zakas)
-* Fix: Remove -r alias for --rule (fixes #882) (Nicholas C. Zakas)
-* Docs: Update dev setup, contributing, default-case descriptions (Nicholas C. Zakas)
-* Update: valid-jsdoc now allows you to optionally turn off parameter description checks (fixes #822) (Nicholas C. Zakas)
-* Breaking: brace-style now disallows block statements where curlies are on the same line (fixes #758) (Nicholas C. Zakas)
-* Add linting Makefile.js (fixes #870) (icebox)
-* add rule flag, closes #692 (George Zahariev)
-* Add check between rules doc and index (fixes #865) (icebox)
-* Add Build Next mention in integrations README. (icebox)
-* document new IIFE exception for no-extra parens added as part of #655 (Michael Ficarra)
-* (fixes #622) Add rule ID on documentation pages (Delapouite)
-* fixes #655: add IIFE exception to no-extra-parens (Michael Ficarra)
-* add new rule "no-new-require" (Wil Moore III)
-* exit with non-zero status when tests fail (fixes #858) (Márton Salomváry)
-* removed unicode zero width space character from messages (fixes #857) (Márton Salomváry)
-* Change: --rulesdir now can be specified multiple times (fixes #830) (Nicholas C. Zakas)
-* Update: Node 0.8 no longer supported (fixes #734) (Nicholas C. Zakas)
-* Update: Add typed arrays into builtin environment globals (fixes #846) (Nicholas C. Zakas)
-* Fix: Add prototype methods to global scope (fixes #700) (Nicholas C. Zakas)
-* Rule: no-restricted-modules (fixes #791) (Christian)
-* Upgrade: Esprima to 1.2 (fixes #842) (Nicholas C. Zakas)
-* Docs: reporting level 2 is an error (fixes #843) (Brandon Mills)
-* Upgrade: Esprima to 1.2, switch to using Esprima comment attachment (fixes #730) (Nicholas C. Zakas)
-* Fix: Semi rule incorrectly flagging extra semicolon (fixes #840) (Nicholas C. Zakas)
-* Build: Update Travis to only test Node 0.10 (refs #734) (Nicholas C. Zakas)
-* Add "nofunc" option (fixes #829) (Conrad Zimmerman)
-* Rule: no-inner-declarations (fixes #587) (Brandon Mills)
-* Rule 'block-scoped-var': correct scope for functions, arguments (fixes #832) (Aliaksei Shytkin)
-* Rule: default-case (fixes #787) (Aliaksei Shytkin)
-* Ignored files are excluded unless --force is passed on the CLI (Nick Fisher)
-* Fixes a typo and a broken link in the documentation (Nick Fisher)
-* Replaces .some() with .indexOf() where appropriate (Nick Fisher)
-* Fix correct config merge for array values (fixes #819) (Aliaksei Shytkin)
-* Remove warning about ESLint being in Alpha (Nick Fisher)
-* Adds `space-after-keywords` rule (fixes #807) (Nick Fisher)
-* Rule: no-lonely-if (fixes #790) (Brandon Mills)
-* Add ignore comments in file (fixes #305) (Aliaksei Shytkin)
-* 0.5.1 (Nicholas C. Zakas)
-* Change: no-unused-vars default to 'all' (fixes #760) (Nicholas C. Zakas)
-
-v0.5.1 - April 17, 2014
-
-* 0.5.1 (Nicholas C. Zakas)
-* Fix general config not to be modified by comment config in files (fixes #806) (Aliaksei Shytkin)
-* SVG badges (Ryuichi Okumura)
-* fixes #804: clean up implementation of #803 (which fixed #781) (Michael Ficarra)
-* Build: Fix perf test to take median of three runs (fixes #781) (Nicholas C. Zakas)
-* Fix: --reset will now properly ignore default rules in environments.json (fixes #800) (Nicholas C. Zakas)
-* Docs: Updated contributor guidelines (Nicholas C. Zakas)
-* Added Mocha global variables for TDD style. Fixes #793. (Golo Roden)
-* Rule: no-sequences (fixes #561) (Brandon Mills)
-* Change .eslintingore to plain text (fixes #761) (Brandon Mills)
-* Change 'no-spaced-func' message (fixes #762) (Aliaksei Shytkin)
-* Rule 'block-scoped-var' works correct when object inits (fixes #783) (Aliaksei Shytkin)
-* Build: Always build docs site on top of origin/master (Nicholas C. Zakas)
-* 0.5.0 (Nicholas C. Zakas)
-
-v0.5.0 - April 10, 2014
-
-* 0.5.0 (Nicholas C. Zakas)
-* Build: Bump perf limit so Travis won't fail every time (fixes #780) (Nicholas C. Zakas)
-* Add tests to cover 100% of eslint.js (Aliaksei Shytkin)
-* Fix: Make sure no-path-concat doesn't flag non-concat operations (fixes #776) (Nicholas C. Zakas)
-* Rule 'no-unused-var' in functional expression with identifier (fixes #775) (Aliaksei Shytkin)
-* Rule: valid-typeof (Ian Christian Myers)
-* Add global cli flag (ref #692) (Brandon Mills)
-* update to latest Optionator (George Zahariev)
-* Add options for rule 'no-unused-vars' to check all arguments in functions (fixes #728) (Aliaksei Shytkin)
-* Fix: Cleanup package.json (Nicholas C. Zakas)
-* New: Experimental support for CSS Auron (fixes #765) (Nicholas C. Zakas)
-* Lint tests on build (fixes #764) (Aliaksei Shytkin)
-* Rule block-scoped-var works correct with object properties (fixes #755) (Aliaksei Shytkin)
-* Breaking: implement eslint-env and remove jshint/jslint environment comment support (fixes #759) (Aliaksei Shytkin)
-* readme: npm i -> npm install (Linus Unnebäck)
-* Add env flag to cli options summary (fixes #752) (Brandon Mills)
-* Fix: Give the perf test a better calculated budget (fixes #749) (Nicholas C. Zakas)
-* give the `env` flag type `[String]`, improve code (fixes #748) (George Zahariev)
-* fixes #735: add new, more efficient getTokens interfaces (Michael Ficarra)
-* Add --env cli flag (ref #692) (Brandon Mills)
-* Fixes #740 - Make sure callbacks exist before marking them as 'handled'. (mstuart)
-* fixes #743: wrap-regex rule warns on regex used in dynamic member access (Michael Ficarra)
-* replace tab indents with 4 spaces in lib/rules/handle-callback-err.js (Michael Ficarra)
-* Adding homepage and bugs links to package.json (Peter deHaan)
-* JSDoc for rules (Anton Rudeshko)
-* 0.4.5 (Nicholas C. Zakas)
-
-v0.4.5 - March 29, 2014
-
-* 0.4.5 (Nicholas C. Zakas)
-* Build: Add perf check into Travis build to better monitor performance regressions (fixes #732) (Nicholas C. Zakas)
-* Fix: Make sure semi reports correct location of missing semicolon (fixes #726) (Nicholas C. Zakas)
-* Add --no-eslintrc cli flag (ref #717) (Brandon Mills)
-* Fix #716 crash with reset flag (Brandon Mills)
-* Fixed JSON formatting and highlighting (Anton Rudeshko (Tesla))
-* fixes #723: block-scoped-var throws on unnamed function expression (Michael Ficarra)
-* Fix: Make stroustrup brace-style closing message make sense (fixes #719) (Nicholas C. Zakas)
-* no-comma-dangle reports correct line number (Andrey Popp)
-* Upgrade: Esprima to 1.1.1 and EScope to 1.0.1 (fixes #718) (Nicholas C. Zakas)
-* Add reset cli flag (refs #692) (Brandon Mills)
-* Relax eqeqeq null check (fixes #669) (Brandon Mills)
-* 0.4.4 (Nicholas C. Zakas)
-* New Rule: handle-callback-err (fixes #567) (Jamund Ferguson)
-
-v0.4.4 - March 25, 2014
-
-* 0.4.4 (Nicholas C. Zakas)
-* Fix no-used-vars to report FunctionExpression params (fixes #697). (Andrey Popp)
-* fixes #711: eslint reports wrong line number for files with shebang (Michael Ficarra)
-* Fix for no-unused-vars and MemberExpression (Andrey Popp)
-* added no-warning-comments rule (Alexander Schmidt)
-* fixes #699: brace-style does not check function expressions (Michael Ficarra)
-* rewrite block-scoped-var (Michael Ficarra)
-* recommend using hasOwnProperty from Object.prototype in guard-for-in docs (Michael Ficarra)
-* change conf/environments.json spacing to be simpler and more consistent (Michael Ficarra)
-* Update API to use context.getFilename() instead of .filename. (Loren Segal)
-* Small changes, JSDoc is clarified (Aliaksei Shytkin)
-* Move FileFinder to separate file (Aliaksei Shytkin)
-* Cache if file is not found (Aliaksei Shytkin)
-* Use cache on config files seach (Aliaksei Shytkin)
-* Added .eslintignore to load from parents folders (fixes #681) (Aliaksei Shytkin)
-* fix 'node-modules' typo in docs (Fred K. Schott)
-* Upgrade to the latest version of doctrine. (Brian Di Palma)
-* Document optional filename and default it to `input`. (Loren Segal)
-* Fix: Compatibility for Node 0.8 (Nicholas C. Zakas)
-* Update: Makefile.js now uses shelljs-nodecli (Nicholas C. Zakas)
-* #681 apply all .eslintignore exclusions (Aliaksei Shytkin)
-* Add RuleContext.filename property (for eslint/eslint#468). (Loren Segal)
-* 0.4.3 (Nicholas C. Zakas)
-
-v0.4.3 - March 18, 2014
-
-* 0.4.3 (Nicholas C. Zakas)
-* fixes #682: rewrite no-constant-condition rule (Michael Ficarra)
-* Fixes #673 allow configuration of @return errors via requireReturn - (fixes #673) (Brian Di Palma)
-* Tweaking inline code formatting for "if, while, dowhile" (Peter deHaan)
-* Fixes #677 getJSDocComment() should not search beyond FunctionExpression or FunctionDeclaration parent nodes. (Brian Di Palma)
-* Relaxed enforcement of camelcase rule (Ian Christian Myers)
-* Fixing issue #675. Incorrect triggering of no-else-return rule. (Brian Di Palma)
-* Added style option for wrap-iife (Mathias Schreck)
-* Fix: Issues with named function expressions in no-unused-vars and no-shadow (fixes #662) (Nicholas C. Zakas)
-* Update: camelcase rule now doesn't flag function calls (fixes #656) (Nicholas C. Zakas)
-* Updating documentation description for: no-space-before-semi rule, changing rules to exempt strings with semicolons and test for that condition. Fixes #629. (Jonathan Kingston)
-* Adding in rule no-space-before-semi to prevent spaces before semicolons. fixes #629 (Jonathan Kingston)
-* show NPM version (Paul Verest)
-* adapt code formatting (Mathias Schreck)
-* Added a TextMate 2 integration to the docs (Nate Silva)
-* 0.4.2 (Nicholas C. Zakas)
-
-v0.4.2 - March 3, 2014
-
-* 0.4.2 (Nicholas C. Zakas)
-* fixes #651: disable no-catch-shadow rule in node environment (Michael Ficarra)
-* Fixed context.report message parsing (Ian Christian Myers)
-* fixe #648: wrap-iife rule should actually check that IIFEs are wrapped (Michael Ficarra)
-* Added "stroustrup" option for brace-style (Ian Christian Myers)
-* 0.4.1 (Nicholas C. Zakas)
-
-v0.4.1 - February 27, 2014
-
-* 0.4.1 (Nicholas C. Zakas)
-* Created space-in-brackets rule (Ian Christian Myers)
-* Update: Allow valid-jsdoc to specify replacement tags (fixes #637) (Nicholas C. Zakas)
-* Fix: Ensure getJSDocComment() works for all function declarations (fixes #638) (Nicholas C. Zakas)
-* Added broccoli-eslint to integration docs (Christian)
-* fixes #634: getters/setters shouldn't trigger no-dupe-keys (Michael Ficarra)
-* Update: semi to also enforce not using semicolons (fixes #618) (Nicholas C. Zakas)
-* New Rule: no-constant-condition - removed SwitchStatement discriminant check - removed AssignmentExpression with right Identifier - fixed copy paste error - added DoWhileStatement, ForStatement based on discussion: https://github.com/eslint/eslint/pull/624 (fixes #621) (Christian)
-* New Rule: no-constant-condition (fixes #621) (Christian)
-* Adding mimosa-eslint to Build System list (dbashford)
-* Fix: Make sure semi flags return statements without a semicolon (fixes #616) (Nicholas C. Zakas)
-* Fix: stylish formatter blue text -> white text (fixes #607) (Nicholas C. Zakas)
-* Fix: radix rule should warn (not throw error) when parseInt() is called without arguments (fixes #611) (Nicholas C. Zakas)
-* Update README.md (Dmitry)
-* Adding JSDoc comments for TAP format helper functions (Jonathan Kingston)
-* Updating documentation to include TAP format option (Jonathan Kingston)
-* Fixing validation issues to TAP formatter (Jonathan Kingston)
-* Adding TAP formatter and basic tests (Jonathan Kingston)
-* Docs: Updated integrations page (Nicholas C. Zakas)
-* 0.4.0 (Nicholas C. Zakas)
-
-v0.4.0 - February 12, 2014
-
-* 0.4.0 (Nicholas C. Zakas)
-* Change: Switch :after to :exit (fixes #605) (Nicholas C. Zakas)
-* Fix: Make sure no-unused-vars doesn't get confused by nested functions (fixes #584) (Nicholas C. Zakas)
-* Update: .eslintrc to check more things (Nicholas C. Zakas)
-* Fix: Make sure JSDoc parser accepts JSDoc3-style optional parameters (Nicholas C. Zakas)
-* Docs: Update documentation with linking instructions for ESLintTester (Nicholas C. Zakas)
-* New Rule: valid-jsdoc (fixes #536) (Nicholas C. Zakas)
-* #595 improved func-names documentation (Kyle Nunery)
-* #595 added more func-names tests (Kyle Nunery)
-* #595 fix rule message and add more tests (Kyle Nunery)
-* use optionator for option parsing, not optimist (George Zahariev)
-* Include instructions for working with ESLintTester (Nicholas C. Zakas)
-* #595 remove needless 'function Foo() {}' in tests (Kyle Nunery)
-* #595 fix whitespace (Kyle Nunery)
-* #595 fix markdown for js code blocks (Kyle Nunery)
-* Adding information about Yeomen generator (Ilya Volodin)
-* #595 add docs for rule func-names (Kyle Nunery)
-* #595 add func-names rule (Kyle Nunery)
-* migrate variables array to map (Brandon Mills)
-* Perf: Move try-catch out of verify() function to allow V8 optimization (refs #574) (Nicholas C. Zakas)
-* Docs: Added instructions for running npm run profile (Nicholas C. Zakas)
-* refactor variable name lookup into a separate function (Brandon Mills)
-* optimize findVariable() in no-unused-vars (Brandon Mills)
-* move to tests/bench (Chris Dickinson)
-* add `npm run profile`. (Chris Dickinson)
-* #586 refactor based on https://github.com/eslint/eslint/pull/590#discussion_r9476367 (Christian)
-* #586 added no-unreachable jsdoc, documentation note on hoisting case (Christian)
-* #586 add hoisting check to no-unreachable (Christian)
-* readme: Remove stray asterisk (Timo Tijhof)
-* #580 Remove eslint.getAllComments(), related docs, related tests (Christian)
-* Added test for bug fix #582. Test Passes (Shmueli Englard)
-* Added curly braces to if statment (Shmueli Englard)
-* Added new test for fix to #582 (fixes 582) (Shmueli Englard)
-* Bug #582: Added check if node.value isn't a string just exit (Shmueli Englard)
-* Update Rule: implement curly options for single-statement bodies (fixes #511) (Nicholas C. Zakas)
-* New Rule: no-extra-boolean-cast (fixes #557) (Brandon Mills)
-* New Rule: no-sparse-arrays (fixes #499) (Nicholas C. Zakas)
-* Fix: no-spaced-func is now an error (Nicholas C. Zakas)
-* New Rule: no-process-exit (fixes #568) (Nicholas C. Zakas)
-* New Rule: no-labels (fixes #550) (Nicholas C. Zakas)
-* New Rule: no-lone-blocks (fixes #512) (Brandon Mills)
-* Added Emacs/Flycheck integration (Nikolai Prokoschenko)
-* Build: Add perf test (Nicholas C. Zakas)
-* Fix: no-cond-assign shouldn't throw error when there's a for loop with an empty conditional (fixes #53) (Nicholas C. Zakas)
-* Docs: Add docs for no-regex-spaces and all doc errors now break build (closes #562) (Nicholas C. Zakas)
-* Rename: regex-spaces to no-regex-spaces (Nicholas C. Zakas)
-* Docs: Add docs for no-underscore-dangle (refs #562) (Nicholas C. Zakas)
-* Docs: Add docs for no-undef-init (refs #562) (Nicholas C. Zakas)
-* Docs: Add docs for no-return-assign (refs #562) (Nicholas C. Zakas)
-* Fix: Misspelling in no-return-assign message (Nicholas C. Zakas)
-* Docs: Add docs for no-new-wrappers (refs #562) (Nicholas C. Zakas)
-* Docs: Add docs for no-new-object (refs #562) (Nicholas C. Zakas)
-* Docs: Add docs for no-implied-eval (refs #562) (Nicholas C. Zakas)
-* Docs: Updated documentation for developing rules (Nicholas C. Zakas)
-* Testing: Move ESLintTester to be external dependency (fixes #480) (Nicholas C. Zakas)
-* Docs: Add list of known integrations (Nicholas C. Zakas)
-* Fix #570 (dmp42)
-* document no-array-constructor rule (Michael Ficarra)
-* fixes #500: no-array-constructor should not flag 1-argument construction (Michael Ficarra)
-* fixes #501: no-array-constructor recognises CallExpression form (Michael Ficarra)
-* rename no-new-array rule to no-array-constructor; ref #501 (Michael Ficarra)
-* Fix: Make radix rule warn on invalid second parameter (fixes #563) (Nicholas C. Zakas)
-* Docs: Added no-floating-decimal docs (refs #562) (Nicholas C. Zakas)
-* New Rule: no-path-concat (fixes #540) (Nicholas C. Zakas)
-* Docs: Add some missing rule docs (refs #562) (Nicholas C. Zakas)
-* Fix: CLI should not output anything when there are no warnings (fixes #558) (Nicholas C. Zakas)
-* New Rule: no-yoda (fixes #504) (Nicholas C. Zakas)
-* New Rule: consistent-return (fixes #481) (Nicholas C. Zakas)
-* Rewrite configuration documentation to include information about globals (fixes #555) (Nicholas C. Zakas)
-* Allow YAML configuration files (fixes #491) (Nicholas C. Zakas)
-* 0.3.0 (Nicholas C. Zakas)
-
-v0.3.0 - January 20, 2014
-
-* 0.3.0 (Nicholas C. Zakas)
-* Config: Allow comments in JSON configuration files (fixes #492) (Nicholas C. Zakas)
-* Bug: max-len fix to report correct line number (fixes #552) (Nicholas C. Zakas)
-* Build: Use browserify to create browser-ready ESLint (fixes #119) (Nicholas C. Zakas)
-* Docs: Ensure all rules have entry on top-level rules index page (Nicholas C. Zakas)
-* Docs: Add docs for no-fallthrough rule (Nicholas C. Zakas)
-* Update README.md (Peter deHaan)
-* Update README.md (Peter deHaan)
-* Update package.json (Peter deHaan)
-* Docs: Added documentation for semi rule (Nicholas C. Zakas)
-* Build: Reset branch coverage target (Nicholas C. Zakas)
-* Update build system to generate eslint.org during release (Nicholas C. Zakas)
-* Updated setup doc (Nicholas C. Zakas)
-* Fix #525 & #528 (Mangled Deutz)
-* Improve no-negated-in-lhs description (David Bruant)
-* Fixing typo (David Bruant)
-* Update no-new.md (Tamas Fodor)
-* Update no-extra-semi.md (Tamas Fodor)
-* Fixing broken links in documentation (Ilya Volodin)
-* Update about page (Nicholas C. Zakas)
-* Site generation build step and documentation updates to support it (fixes #478) (Nicholas C. Zakas)
-* Change message for brace-style rule (fixes #490) (Nicholas C. Zakas)
-* Add question about ES6 support to FAQ (fixes #530) (Nicholas C. Zakas)
-* Set unlimited number of listeners for event emitter (fixes #524) (Nicholas C. Zakas)
-* Add support for comment events (fixes #531) Add :after events for comments (Nicholas C. Zakas)
-* Add :after events for comments (Nicholas C. Zakas)
-* Allow config files to have any name (fixes #486). (Aparajita Fishman)
-* List available formatters (fixes #533). (Aparajita Fishman)
-* Add support for comment events (fixes #531) (Nicholas C. Zakas)
-* Add Stylish formatter and make it default. Fixes #517 (Sindre Sorhus)
-* Fix missing code exit (Mangled Deutz)
-* Added unit test for calling Config.getConfig with no arguments. (Aparajita Fishman)
-* Typo (Mangled Deutz)
-* Fixed docs typo (Nicholas C. Zakas)
-* Mark functions as used when any method is called on them (Nicholas C. Zakas)
-* Fixed: Config.getConfig is called either with a file path or with no args (fixes #520) (Aparajita Fishman)
-* Fix minor bug in no-empty rule (Nicholas C. Zakas)
-* add more info for failure messages (Nicholas C. Zakas)
-* Add ruleId to all formatters output (fixes #472) (Nicholas C. Zakas)
-* Remove unused code (Nicholas C. Zakas)
-* Correctly handle case with both finally and catch in no-empty (Nicholas C. Zakas)
-* Update documentation for no-unused-vars (Nicholas C. Zakas)
-* Ensure that bound function expressions are reported as being used (fixes #510) (Nicholas C. Zakas)
-* Allow empty catch/finally blocks (fixes #514) and update documentation (fixes #513) (Nicholas C. Zakas)
-* Updated contribution guidelines (Nicholas C. Zakas)
-* Add default setting for no-cond-assign (Nicholas C. Zakas)
-* Add build step to check rule consistency (Nicholas C. Zakas)
-* update docs: explicit cli args are exempt from eslintignore exclusions (Michael Ficarra)
-* fixes #505: no-cond-assign should ignore doubly parenthesised tests (Michael Ficarra)
-* Renamed unnecessary-strict to no-extra-strict (Nicholas C. Zakas)
-* Fixed missing documentation links (Nicholas C. Zakas)
-* Add build task to check for missing docs and tests for rules (Nicholas C. Zakas)
-* Slight reorganization of rule groups (Nicholas C. Zakas)
-* Added one-var and sorted some rules (Nicholas C. Zakas)
-* Updated Travis badge for new location (Nicholas C. Zakas)
-* fixes #494: allow shebangs in processed JS files (Michael Ficarra)
-* fixes #496: lint ignored files when explicitly specified via the CLI (Michael Ficarra)
-* More tests (Ilya Volodin)
-* Upgrade Istanbul (Ilya Volodin)
-* fixes #495: holey arrays cause no-comma-dangle rule to throw (Michael Ficarra)
-* Documentation and minor changes (Ilya Volodin)
-* Adding missing package registration (Ilya Volodin)
-* Adding support for .eslintignore and .jshintignore (Closes #484) (Ilya Volodin)
-* fixes #482: brace-style bug with multiline conditions (Michael Ficarra)
-* Switching Travis to use ESLint (Closes #462) (Ilya Volodin)
-* 0.2.0 (Nicholas C. Zakas)
-
-v0.2.0 - January 1, 2014
-
-* 0.2.0 (Nicholas C. Zakas)
-* Bump code coverage checks (Nicholas C. Zakas)
-* Take care of unreachable code in case statement (Nicholas C. Zakas)
-* Updated rule messaging and added extra tests (Nicholas C. Zakas)
-* Fixing eslint errors and unittests (Ilya Volodin)
-* Rule: max-nested-callbacks (Ian Christian Myers)
-* Fix fall-through rule with nested switch statements (fixes #430) (Nicholas C. Zakas)
-* Fixed trailing comma (Nicholas C. Zakas)
-* Added more tests for func-style (Nicholas C. Zakas)
-* Fixed documentation for func-style (Nicholas C. Zakas)
-* Fixed linting error (Nicholas C. Zakas)
-* Rule to enforce function style (fixes #460) (Nicholas C. Zakas)
-* Rule is off by default. Updated documentation (Ilya Volodin)
-* Rule: sort variables. Closes #457 (Ilya Volodin)
-* Update architecture.md (Nicholas C. Zakas)
-* Change quotes option to avoid-escapes and update docs (fixes #199) (Brandon Payton)
-* Add allow-avoiding-escaped-quotes option to quotes rule (fixes #199) (Brandon Payton)
-* Update no-empty-class.md (Nicholas C. Zakas)
-* Updated titles on all rule documentation (fixes #348) (Nicholas C. Zakas)
-* Fixing eslint errors in codebase (Ilya Volodin)
-* fixes #464: space-infix-ops checks for VariableDeclarator init spacing (Michael Ficarra)
-* Add options to no-unused-vars. Fixes #367 (Ilya Volodin)
-* rename escape function to xmlEscape in checkstyle formatter (Michael Ficarra)
-* The semi rule now reports correct line number (Ian Christian Myers)
-* context.report now takes optional location (Ian Christian Myers)
-* fixes #454: escape values for XML in checkstyle formatter (Michael Ficarra)
-* Add color to Mocha test reporting (Ian Christian Myers)
-* Rule no-nested-ternary (Ian Christian Myers)
-* Fixing no-unused-var and no-redeclare (Ilya Volodin)
-* fixes #449: no-mixed-requires throws TypeError when grouping is enabled (Michael Ficarra)
-* Fixed reported line number for trailing comma error (Ian Christian Myers)
-* Update doc title for quote (Matthew DuVall)
-* fixes #446: join paths without additional delimiters (Michael Ficarra)
-* docs: add documentation for quotes rule (Matthew DuVall)
-* minor style changes to lib/rules/space-infix-ops.js as requested in #444 (Michael Ficarra)
-* remove "function invalid(){ return D }" from some tests (Michael Ficarra)
-* fixes #429: require spaces around infix operators; enabled by default (Michael Ficarra)
-* simplify fix for #442 (Michael Ficarra)
-* Fix broken test, ensure tests get run before a release is pushed (Nicholas C. Zakas)
-* 0.1.4 (Nicholas C. Zakas)
-
-v0.1.4 - December 5, 2013
-
-* 0.1.4 (Nicholas C. Zakas)
-* Add release scripts to package.json (Nicholas C. Zakas)
-* Fixed release error in Makefile (Nicholas C. Zakas)
-* Fix JSHint warnings (Nicholas C. Zakas)
-* Make sure 'default' isn't flagged by no-space-returns-throw rule (fixes #442) (Nicholas C. Zakas)
-* Fixing documentation (Ilya Volodin)
-* Fixing disabling rules with invalid comments Closes #435 (Ilya Volodin)
-* improve assertion on wrong number of errors (Christoph Neuroth)
-* fixes #431: no-unused-expressions should not flag statement level void (Michael Ficarra)
-* fixes #437: fragile no-extend-native rule (Michael Ficarra)
-* change space-* rule documentation headers to be more descriptive (Michael Ficarra)
-* Moved to tabs, added comments, a few more tests (Jamund Ferguson)
-* split GH-332 rule into space-unary-word-ops and space-return-throw-case (Michael Ficarra)
-* fixes #346: validate strings passed to the RegExp constructor (Michael Ficarra)
-* change some documentation extensions from js to md (Michael Ficarra)
-* fixes #332: unary word operators must be followed by whitespace (Michael Ficarra)
-* Add some docs (Jamund Ferguson)
-* DRYing cli tests and improving code coverage (Ilya Volodin)
-* fixes #371: add no-shadow-restricted-names rule (Michael Ficarra)
-* Added Support for Object.defineProperty() checking (Jamund Ferguson)
-* fixes #333: add rule to disallow gratuitously parenthesised expressions (Michael Ficarra)
-* improve rule test coverage (Michael Ficarra)
-* No Extend Native (Jamund Ferguson)
-* change getTokens 2nd/3rd arguments to count tokens, not characters (Michael Ficarra)
-* fixes #416: no-fallthrough flagging last case + reporting wrong line num (Michael Ficarra)
-* fixes #415: fix unnecessary-strict rule false positives (Michael Ficarra)
-* Add missing dependency (Nicholas C. Zakas)
-* Update docs related to running unit tests (Nicholas C. Zakas)
-* Add JSHint as missing dependency (Nicholas C. Zakas)
-* Switch to using ShellJS makefile (fixes #418) (Nicholas C. Zakas)
-* Updated documentation to reflect test changes (refs #417) (Nicholas C. Zakas)
-* Change to eslintTester.addRuleTest (fixes #417) (Nicholas C. Zakas)
-* Fix false positives for no-script-url (fixes #400) (Nicholas C. Zakas)
-* Fix lint warning (Nicholas C. Zakas)
-* Fixing ESLint warnings, introducing Makefile.js (not yet wired in) (Nicholas C. Zakas)
-* fixes #384: include builtin module list to avoid repl dependency (Michael Ficarra)
-* 0.1.3 (Nicholas C. Zakas)
-
-v0.1.3 - November 25, 2013
-
-* 0.1.3 (Nicholas C. Zakas)
-* Updated changelog (Nicholas C. Zakas)
-* Vows is gone. Mocha is now default (Ilya Volodin)
-* fixes #412: remove last remaining false positives in no-spaced-func (Michael Ficarra)
-* fixes #407: no-spaced-func rule flagging non-argument-list spaced parens (Michael Ficarra)
-* Add no-extra-semi to configuration (fixes #386) (Nicholas C. Zakas)
-* Converting formatter tests and core (Ilya Volodin)
-* Don't output anything when there are no errors in compact formatter (fixes #408) (Nicholas C. Zakas)
-* Removing Node 0.11 test - it fails all the time (Nicholas C. Zakas)
-* Completing conversion of rule's tests to mocha (Ilya Volodin)
-* added mocha conversion tests for strict, quote-props and one-var; enhanced one of the invalid one-var tests that was expecting two messages (Michael Paulukonis)
-
-
-v0.1.2 - November 23, 2013
-
-* 0.1.2 (Nicholas C. Zakas)
-* added mocha tests for radix and quotes; fixed some of the internals on quotes from vows annotations (Michael Paulukonis)
-* added tests for regex-spaces, strict, unnecessary-strict; fixed some types in overview/author notes in other tests. (Michael Paulukonis)
-* Converting unittests to mocha (Ilya Volodin)
-* mocha conversions of tests for 'use-isnan' and 'wrap-iife' (Michael Paulukonis)
-* added mocha tests semi.js and wrap-regex.js (Michael Paulukonis)
-* Converting more tests to mocha (Ilya Volodin)
-* Update CONTRIBUTING.md (Nicholas C. Zakas)
-* Cleaning up eslintTester (Ilya Volodin)
-* DRYing unittests and converting them to mocha (Ilya Volodin)
-* Reformatted Gruntfile (Nicholas C. Zakas)
-* Add tests to config load order: base, env, user. (icebox)
-* Fixing indent in gruntfile (Ilya Volodin)
-* Removing jake, adding Grunt, Travis now runs grunt (Ilya Volodin)
-* Add rules per environments to config. (icebox)
-* Add globals property to the environments. (icebox)
-* Fix error about IIFE if the function is in a new (Marsup)
-* Fix a broken link in the docs (Brian J Brennan)
-* Add test coverage for additional cases, fix open paren at beginning of expr (Matthew DuVall)
-* Fixing no-undef for eval use case (Ilya Volodin)
-* fixes #372: disallow negated left operand in `in` operator (Michael Ficarra)
-* Fixing no-self-compare rule to check for operator (Ilya Volodin)
-* bug: open parens in args causes no-spaced-func to trigger (Matthew DuVall)
-* fixes #369: restrict UnaryExpressions to delete in no-unused-expressions (Michael Ficarra)
-* Make sure delete operator isn't flagged as unused expression (fixes #364) (Nicholas C. Zakas)
-* Don't flag ++ or -- as unused expressions (fixes #366) (Nicholas C. Zakas)
-* Ensure that 'use strict' isn't flagged as an unused expression (fixes #361) (Nicholas C. Zakas)
-* Increase test coverage for strict-related rules (refs #361) (Nicholas C. Zakas)
-* Up code coverage numbers (Nicholas C. Zakas)
-* Fixes error in new-cap rule when 'new' is used without a constructor (fixes #360) (Nicholas C. Zakas)
-* added files array in package json (Christian)
-* removed unused jshint dependency (Christian)
-* Add test coverage for new Foo constructor usage (Matt DuVall)
-* Pull code coverage up by removing unused method (Matt DuVall)
-* recognise CallExpression variant of RegExp ctor in no-control-regex rule (Michael Ficarra)
-* Merge smart-eqeqeq into eqeqeq (Matt DuVall)
-* Catch additional cases for a.b, new F, iife (Matt DuVall)
-* 0.2.0-dev (Nicholas C. Zakas)
-* Version 0.1.0 (Nicholas C. Zakas)
-* rule: no-spaced-func disallow spaces between function identifier and application (Matt DuVall)
-
-v0.1.1 - November 09, 2013
-
-* Ensure mergeConfigs() doesn't thrown an error when keys are missing in base config (fixes #358) (Nicholas C. Zakas)
-
-v0.1.0 - November 03, 2013
-
-* Version 0.1.0 (Nicholas C. Zakas)
-* Updated Readme for v0.1.0 (Nicholas C. Zakas)
-* Bump code coverage verification to 95% across the board (Nicholas C. Zakas)
-* Fixed broken links (Nicholas C. Zakas)
-* Added information about runtime rules (Nicholas C. Zakas)
-* Added documentation about configuration files (Nicholas C. Zakas)
-* Added description of -v option (Nicholas C. Zakas)
-* Updated architecture documentation (Nicholas C. Zakas)
-* Fix bug in no-control-regex (fixes #347) (Nicholas C. Zakas)
-* Fix link to architecture doc in readme (azu)
-* Rule: No control characters in regular expressions (fixes #338) (Nicholas C. Zakas)
-* Add escaping \= test (Matt DuVall)
-* Add docs for rule (Matt DuVall)
-* rule: no-div-regex for catching ambiguous division operators in regexes (Matt DuVall)
-* Change context-var to block-scoped-var (Matt DuVall)
-* Implement config.globals (Oleg Grenrus)
-* Add 'config-declared global' test (Oleg Grenrus)
-* Adding ability to separate rules with comma (Ilya Volodin)
-* Added rule for missing 'use strict' (fixes #321) (Nicholas C. Zakas)
-* Fixing unittests and finishing code (Ilya Volodin)
-* Disabling/enabling rules through comments (Ilya Volodin)
-* Rename rule to context-var and add documentation (Matt DuVall)
-* Added link to no-global-strict doc in readme (Nicholas C. Zakas)
-* Add try-catch scoping with tests (Matt DuVall)
-* Fix linting error (Matt DuVall)
-* Store FunctionDeclarations in scope as they can be used as literals (Matt DuVall)
-* Fix to use getTokens and add test for MemberExpression usage (Matt DuVall)
-* rule: block-scope-var to check for variables declared in block-scope (Matt DuVall)
-* no-unused-expressions rule: add test and doc mention for `a && b()` (Michael Ficarra)
-* rule: wrap-regex for parens around regular expression literals (Matt DuVall)
-* fixes #308: implement no-unused-expressions rule; ref. jshint rule W030 (Michael Ficarra)
-* Updated change log script to filter out merge messages (Nicholas C. Zakas)
-* Updated changelog (Nicholas C. Zakas)
-* 0.1.0-dev (Nicholas C. Zakas)
-
-v0.0.9 - October 5, 2013
-
-* Version 0.0.9 release (Nicholas C. Zakas)
-* Added rule for no global strict mode (fixes #322) (Nicholas C. Zakas)
-* Change default on to be errors instead of warnings (fixes #326) (Nicholas C. Zakas)
-* Fixed bug where JSHint was using the wrong file in lint task (Nicholas C. Zakas)
-* Updated docs for no-unused vars rule. (Andrew de Andrade)
-* Removed console.log in tests. (Andrew de Andrade)
-* Added link to roadmap and JSHint feature parity list. (Andrew de Andrade)
-* Fixed warning when unused var declared as param in FunctionExpression/Declaration can be ignored because later param is used (Andrew de Andrade)
-* Rename test for smartereqeqeq.js to smarter-eqeqeq.js (Andrew de Andrade)
-* Keep test filename inline with rule name (Andrew de Andrade)
-* Added further instructions for multiline test cases. (Andrew de Andrade)
-* Protecting private method (Seth McLaughlin)
-* Updating look up algorithm for local config files (Seth McLaughlin)
-* Fixing ESLint errors (Ilya Volodin)
-* Implemented local default config file (Seth McLaughlin)
-* Upgrading escope version and fixing related bugs (Ilya Volodin)
-* Fixing assignment during initialization issue (Ilya Volodin)
-* add plain-English regexp description to no-empty-class rule (Michael Ficarra)
-* fixes #289: no-empty-class flags regexps with... flags (Michael Ficarra)
-* Rule: no-catch-shadow (Ian Christian Myers)
-* Update no-empty for compatibility with esprima@1.0.4 (fixes #290) (Mark Macdonald)
-* Fixing bug with _ in MemberExpression (Ilya Volodin)
-* Rule: no-func-assign (Ian Christian Myers)
-* Fix false warning from no-undef rule (fixes #283) (Mark Macdonald)
-* Adding eslint to jake (Ilya Volodin)
-* Rule no redeclare (Ilya Volodin)
-* Fixing no use before define issues (Ilya Volodin)
-* Rule: no-octal-escape (Ian Christian Myers)
-* Fix for `no-proto` and `no-iterator` false positive (Ian Christian Myers)
-* Rule: no-iterator (Ian Christian Myers)
-* Fixing type in guard-for-in documentation (Ilya Volodin)
-* Rule No use before define (Ilya Volodin)
-* Added documentation for the `no-new` rule (Ian Christian Myers)
-* Added documentation for the `no-eval` rule (Ian Christian Myers)
-* Added documentation for the `no-caller` rule (Ian Christian Myers)
-* Added documentation for the `no-bitwise` rule (Ian Christian Myers)
-* simplify no-empty-class rule (Michael Ficarra)
-* Fix `no-empty-class` false negatives (Ian Christian Myers)
-* Added documentation for the `no-alert` rule (Ian Christian Myers)
-* Added documentation for the `new-parens` rule (Ian Christian Myers)
-* Added documentation for the `max-params` rule (Ian Christian Myers)
-* Added documentation for `max-len` rule (Ian Christian Myers)
-* Created link from rules README.md to no-plusplus.md documentation (Ian Christian Myers)
-* Added documentation for `guard-for-in` rule (Ian Christian Myers)
-* Added documentation for `dot-notation` rule (Ian Christian Myers)
-* Added documentation for `curly` rule (Ian Christian Myers)
-* Updated `camelcase` rule documentation (Ian Christian Myers)
-* Added documentation for `complexity` rule (Ian Christian Myers)
-* Changed `no-dangle` documentation to `no-comma-dangle` (Ian Christian Myers)
-* Rule: no-empty-class (Ian Christian Myers)
-* Increased test coverage for max-depth (Ian Christian Myers)
-* Increased test coverage for no-shadow (Ian Christian Myers)
-* Increased test coverage on no-mixed-requires (Ian Christian Myers)
-* Added docs for eqeqeq and no-with (fixes #262) (Raphael Pigulla)
-* Create camelcase.md (Micah Eschbacher)
-* Fix issues with function in no-unused-vars (Ilya Volodin)
-* Rule: No shadow (Ilya Volodin)
-* fixes #252: semi rule errors on VariableDeclarations in ForInStatements (Michael Ficarra)
-* rule: max-len to lint maximum length of a line (Matt DuVall)
-* Fixes #249 (Raphael Pigulla)
-* Merge branch 'master' of https://github.com/beardtwizzle/eslint (Jonathan Mahoney)
-* Re-add lines that were accidentally deleted from config (Jonathan Mahoney)
-* Add support for pre-defined environment globals (re: #228) (Jonathan Mahoney)
-* Rule: no-else-return (Ian Christian Myers)
-* Re-add lines that were accidentally deleted from config (Jonathan Mahoney)
-* Add support for pre-defined environment globals (re: #228) (Jonathan Mahoney)
-* Fix no-unused-vars to report correct line numbers (Ilya Volodin)
-* Rule: no proto (Ilya Volodin)
-* Rule: No Script URL (Ilya Volodin)
-* Rule: max-depth (Ian Christian Myers)
-* Fix: Error severity for rules with options. (Ian Christian Myers)
-* Rule: No wrap func (Ilya Volodin)
-* bug: Fixes semi rule for VariableDeclaration in ForStatement (Matt DuVall)
-* Individual perf tests for rules (Ilya Volodin)
-* Fix loading rules from a rules directory (Ian Christian Myers)
-* Rule no-mixed-requires (fixes #221) (Raphael Pigulla)
-* bug: Add ForStatement for no-cond-assign check (Matthew DuVall)
-* JSLint XML formatter now escapes special characters in the evidence and reason attributes. (Ian Christian Myers)
-* Formatter: JSLint XML (Ian Christian Myers)
-* Refactored `max-statements` rule. (Ian Christian Myers)
-* Fix tests broken due to new rule message text (James Allardice)
-* Merge branch 'master' into match-jshint-messages (James Allardice)
-* Refactored `one-var` rule. (Ian Christian Myers)
-* split eslint.define into eslint.defineRule and eslint.defineRules (Michael Ficarra)
-* Removed unnecessary rules.js test. (Ian Christian Myers)
-* Rule: one-var (Ian Christian Myers)
-* Rule: No unused variables (Ilya Volodin)
-* expose interface for defining new rules at runtime without fs access (Michael Ficarra)
-* disallow 00 in no-octal rule (Michael Ficarra)
-* Increased test coverage for `lib/cli.js`. (Ian Christian Myers)
-* Increased test coverage for `lib/rules.js` (Ian Christian Myers)
-* Increased test coverage for jUnit formatter. (Ian Christian Myers)
-* scripts/bundle: output bundle+map to /build directory (Michael Ficarra)
-* add test for 0X... hex literals in no-octal tests (Michael Ficarra)
-* fixes #200: no-octals should not see leading-0 floats as violations (Michael Ficarra)
-* add back tests for loading rules from a directory (Michael Ficarra)
-* add back in ability to load rules from a directory (Michael Ficarra)
-* Increased test coverage for `complexity` rule. (Ian Christian Myers)
-* Increased test coverage for `max-params` rule. (Ian Christian Myers)
-* also output source map when generating bundle (Michael Ficarra)
-* Rule: unnecessary-strict (Ian Christian Myers)
-* Improve performance of getTokens (Ilya Volodin)
-* Performance jake task (Ilya Volodin)
-* don't force explicit listing of rules; generate listing for bundle (Michael Ficarra)
-* Rule: no-dupe-keys (Ian Christian Myers)
-* fixes #145: create a browser bundle (Michael Ficarra)
-* Fixing no-caller bug (Ilya Volodin)
-* Check for use of underscore library as an exception for var declarations (Matthew DuVall)
-* Merge branch 'master' of https://github.com/nzakas/eslint into no-underscore-dangle (Matthew DuVall)
-* Fixing spelling (Ilya Volodin)
-* Rule: no-empty-label (Ilya Volodin)
-* Add builtin globals to the global scope (fixes #185) (Mark Macdonald)
-* Rule: no-loop-func (Ilya Volodin)
-* Merge branch 'master' of https://github.com/nzakas/eslint into no-underscore-dangle (Matt DuVall)
-* Use proper node declarations and __proto__ exception (Matt DuVall)
-* Updating no-undef patch (see pull request #164) - Simplify parseBoolean() - Make knowledge of```/*jshint*/``` and ```/*global */``` internal to eslint object - Put user-declared globals in Program scope (Mark Macdonald)
-* Rule: no-eq-null (Ian Christian Myers)
-* fixed broken merge (Raphael Pigulla)
-* fixes #143 (Raphael Pigulla)
-* added consistent-this rule (Raphael Pigulla)
-* Rule: no-sync to encourage async usage (Matt DuVall)
-* Update eslint.json with no-underscore-dangle rule (Matt DuVall)
-* Rule: no-underscore-dangle for func/var declarations (Matt DuVall)
-* Warn on finding the bitwise NOT operator (James Allardice)
-* Updating no-undef patch (see pull request #164) 3. Move parsing of ```/*global */``` and ```/*jshint */``` to eslint.js (Mark Macdonald)
-* Warn on finding a bitwise shift operator (fixes #170) (James Allardice)
-* Fix broken test (James Allardice)
-* Add support for the do-while statement to the curly rule (closes #167) (James Allardice)
-* Removing nasty leading underscores (Patrick Brosset)
-* Added tests and test cases for a few files (Patrick Brosset)
-* CLI: -f now accepts a file path (Ian Christian Myers)
-* Updating no-undef patch (see pull request #164) 1. Move predefined globals to ```conf/environments.json``` 2. Move mixin() to ```lib/util.js``` (Mark Macdonald)
-* Match messages to JS[LH]int where appropriate, and ensure consistent message formatting (closes #163) (James Allardice)
-* Add support for the do-while statement to the curly rule (closes #167) (James Allardice)
-* Removing nasty leading underscores (Patrick Brosset)
-* Added tests and test cases for a few files (Patrick Brosset)
-* Merge branch 'master' of github.com:nzakas/jscheck (Nicholas C. Zakas)
-* Added acceptance criteria for rules to docs (Nicholas C. Zakas)
-* Add no-undef (fixes #6) (Mark Macdonald)
-* Fixing no-self-compare (Ilya Volodin)
-* Rule: No multiline strings (Ilya Volodin)
-* CLI refactor to remove process.exit(), file not found now a regular error message, updated formatters to handle this case (Nicholas C. Zakas)
-* Rule: no-self-compare (Ilya Volodin)
-* Rule: No unnecessary semicolons (fixes #158) (Nicholas C. Zakas)
-* Fixed error in no-ex-assign when return statement as found in catch clause (Nicholas C. Zakas)
-* Rename no-exc-assign to no-ex-assign and add to config (Nicholas C. Zakas)
-* Renamed count-spaces to regex-spaces (Nicholas C. Zakas)
-* Documentation updates (Nicholas C. Zakas)
-* Put all rules into strict mode and update docs accordingly (Nicholas C. Zakas)
-* Merge branch 'master' of github.com:nzakas/jscheck (Nicholas C. Zakas)
-* Ensure getScope() works properly when called from Program node (fixes #148) (Nicholas C. Zakas)
-* Rule: wrap-iife (Ilya Volodin)
-* add additional test for no-cond-assign rule (Stephen Murray)
-* Merge branch 'master' of github.com:nzakas/jscheck (Nicholas C. Zakas)
-* Experimental support for Jake as a build system (fixes #151) (Nicholas C. Zakas)
-* fixes #152 (Stephen Murray)
-* add docs for no-exc-assign (Stephen Murray)
-* Merge branch 'master' of https://github.com/nzakas/eslint into no-new-object-array-literals (Matt DuVall)
-* Merge branch 'master' of https://github.com/nzakas/eslint into count-spaces (Matt DuVall)
-* Added a test for getting global scope from Program node (refs #148) (Nicholas C. Zakas)
-* Add positive test case for `object.Array` (Matthew DuVall)
-* Only support space characters for repetitions (Matthew DuVall)
-* fix line length per code conventions (Stephen Murray)
-* fix indentation per code conventions (Stephen Murray)
-* fixes #149 (Stephen Murray)
-* Rule: no-ternary (Ian Christian Myers)
-* Check that the return statement has an argument before checking its type (James Allardice)
-* Rule: count-spaces for multiple spaces in regular expressions (Matt DuVall)
-* Update eslint.json configuration file for literal rules (Matt DuVall)
-* Created no-label-var rule. (Ian Christian Myers)
-* Rule: no-new-array and no-new-object (Matt DuVall)
-* Added ability to retrieve scope using escope. (Ian Christian Myers)
-* Corrected unused arguments (Patrick Brosset)
-* Reporting function complexity on function:after and using array push/pop to handle nesting (Patrick Brosset)
-* Fixing style issues discovered while npm testing (Patrick Brosset)
-* First draft proposal for a cyclomatic complexity ESLint rule (Patrick Brosset)
-* Corrected file extension on no-plusplus rule documentation. (Ian Christian Myers)
-* Documentation for no-delete-var rule. Closes #129 (Ilya Volodin)
-* Rule: max-statements (Ian Christian Myers)
-* Better documentation for the `no-plusplus` rule. (Ian Christian Myers)
-* Rule: no-plusplus (Ian Christian Myers)
-* Rule: no assignment in return statement (Ilya Volodin)
-* Updating max-params rule name (Ilya Volodin)
-* Rule: Function has too many parameters (Ilya Volodin)
-* Removing merge originals (Ilya Volodin)
-* Rebasing on master (Ilya Volodin)
-* Rule: Variables should not be deleted (Ilya Volodin)
-* Fixes incorrect reporting of missing semicolon (Ian Christian Myers)
-* Rebase against master branch (Mathias Bynens)
-* Rule to warn on use of Math and JSON as functions (James Allardice)
-* Formatter: Checkstyle (Ian Christian Myers)
-* docs: Clean up structure (Mathias Bynens)
-* Merging no-native-reassign and no-redefine (Ilya Volodin)
-* Rule: no native reassignment (Ilya Volodin)
-* 0.0.8-dev (Nicholas C. Zakas)
-* v0.0.7 released (Nicholas C. Zakas)
-* Updated Tests, etc. (Jamund Ferguson)
-* Added jUnit Support (Fixes #16) (Jamund Ferguson)
-
-v0.0.7 - July 22, 2013
-
-* 0.0.7 (Nicholas C. Zakas)
-* Add code coverage checks to npm test and update rule tests to have better coverage (Nicholas C. Zakas)
-* Fixed CLI output on serial programatic executions (Ian Christian Myers)
-* Removes line length from code style convention docs (Josh Perez)
-* Adds escapeRegExp and fixes documentation (Josh Perez)
-* Add quotes rule and test coverage for configuration options (Matt DuVall)
-* Adds templating for lint messages and refactors rules to use it (Josh Perez)
-* Fixes lint rules for unchecked test file (Josh Perez)
-* Changes dotnotation rule to match JSHint style (Josh Perez)
-* Change configInfo to options and add test coverage (Matt DuVall)
-* Merge branch 'master' of https://github.com/nzakas/eslint into optional-args-for-rule (Matt DuVall)
-* Adds dot notation lint rule (Josh Perez)
-* Strip trailing underscores in camelcase rule - Fixes #94 (Patrick Brosset)
-* add mailing list link (Douglas Campos)
-* Strip leading underscores in camelcase rule - Fixes #94 (Patrick Brosset)
-* Created no-dangle rule. (Ian Christian Myers)
-* Fixed rule name (James Allardice)
-* Make sure the callee type is Identifier (James Allardice)
-* Add rule for implied eval via setTimeout/Interval (James Allardice)
-* Fix rule name in config (James Allardice)
-* Fixes #90 -- updates docstrings (Stephen Murray)
-* Fixes issue with fs.existsSync on NodeJS 0.6 (Ian Christian Myers)
-* Fixing -c config option. (Ian Christian Myers)
-* Allow arrays to be passed as multiple args to rule (Matt DuVall)
-* Test to make sure empty case with one line break is safe (Matt DuVall)
-* Rule: The Function constructor is eval (Ilya Volodin)
-* Enabled require("eslint") and exposed out CLI. (Ian Christian Myers)
-* Adds test and fix for issue #82 (Mark Macdonald)
-* Merge branch 'master' of https://github.com/nzakas/eslint into ok (Yusuke Suzuki)
-* Created brace-style rule. (Ian Christian Myers)
-* Formatters can now process multiple files at once (Jamund Ferguson)
-* Rule: Do not use 'new' for side effects (Ilya Volodin)
-* Adds smarter-eqeqeq rule (Josh Perez)
-* Add EditorConfig file for consistent editor/IDE behavior (Jed Hunsaker)
-* Fix the positive case for no-unreachable where there is no return statement at all, or if the return is at the end. Those cases should not return any errors. The error condition was not be checked before throwing the rule error. (Joel Feenstra)
-* Adds test and fix for no-octal on 0 literal (Mark Macdonald)
-* Don't report no-empty warnings when a parent is FunctionExpression / FunctionDeclaration (Yusuke Suzuki)
-* Add api.getAncestors (Yusuke Suzuki)
-* Ensure estraverse version 1.2.0 or later (Yusuke Suzuki)
-* Fixes no-alert lint rule for non identifier calls (Josh Perez)
-* Fixes exception when init is null (Josh Perez)
-* Fixes no-octal check to only check for numbers (Josh Perez)
-* 0.0.7-dev (Nicholas C. Zakas)
-* 0.0.6 (Nicholas C. Zakas)
-* Follow the rule naming conventions (James Allardice)
-* Add rule for missing radix argument to parseInt (James Allardice)
-* Allow return, falls-through comment, and throw for falls-through (Matt DuVall)
-* Merge branch 'master' of https://github.com/nzakas/eslint into rule-fall-through (Matt DuVall)
-* Globals are not good, declare len (Matt DuVall)
-* Rule to add no-fall-through (Matt DuVall)
-
-v0.0.6 - July 16, 2013
-
-* 0.0.6 (Nicholas C. Zakas)
-* Changed semi rule to use tokens instead of source (Nicholas C. Zakas)
-* Renaming new-parens rule (Ilya Volodin)
-* Renaming no-new-wrappers rule and adding tests (Ilya Volodin)
-* Add license URL (Nick Schonning)
-* Remove unused sinon requires (Nick Schonning)
-* Remove redundant JSHint directives (Nick Schonning)
-* Rule: Do not use constructor for wrapper objects (Ilya Volodin)
-* Test node 0.11 unstable but allow it to fail (Nick Schonning)
-* Rule: Constructor should use parentheses (Ilya Volodin)
-* Fix reference to "CSS Lint" in Contributing documentation (Brian McKenna)
-* Add git attributes file for line endings (Andy Hu)
-* Rename to create an 'index' file in GH web view (Evan Goer)
-* Avoid accidentally creating a markdown link (Evan Goer)
-* Add headings and correct internal links (Evan Goer)
-* Add wiki files to docs directory (Evan Goer)
-* Add rules for leading/trailing decimal points (James Allardice)
-* Add rule to prevent comparisons with value NaN (James Allardice)
-* Fixing jshint error (Ilya Volodin)
-* Rule: no octal literals (Ilya Volodin)
-* Rule: no undefined when initializing variables (Ilya Volodin)
-* Updated CONTRIBUTING.md (Nicholas C. Zakas)
-* Make sure namespaces are honored in new-cap (Nicholas C. Zakas)
-* Make sure no-empty also checks for ';;' (Nicholas C. Zakas)
-* Add CLI option to output version (Nicholas C. Zakas)
-* Updated contribution guidelines (Nicholas C. Zakas)
-* Fixing jshint complaints. (Joel Feenstra)
-* Converting to a switch statement and declaring variables. (Joel Feenstra)
-* Added .jshintrc file (until ESLint can lint itself) and cleaned up JSHint warnings (Nicholas C. Zakas)
-* Merge branch 'master' of github.com:nzakas/jscheck (Nicholas C. Zakas)
-* A bit of cleanup (Nicholas C. Zakas)
-* Add unreachable code detection for switch cases and after continue/break. (Joel Feenstra)
-* Add support for detecting unreachable code after a throw or return statement. (Joel Feenstra)
-* Fix curly brace check when an if statement is the alternate. (Joel Feenstra)
-* Check for empty switch statements with no cases. (Matt DuVall)
-* Added CONTRIBUTING.md (Nicholas C. Zakas)
-* Added rule to check for missing semicolons (fixes #9) (Nicholas C. Zakas)
-* Verify that file paths exist before reading the file (Matt DuVall)
-* Added guard-for-in rule (fixes #1) (Nicholas C. Zakas)
-* Run linting with npm test as well (Nicholas C. Zakas)
-* Removed foo.txt (Nicholas C. Zakas)
-* Updated config file with new no-caller ID (Nicholas C. Zakas)
-* Changed name of no-arg to no-caller (Nicholas C. Zakas)
-* Increased test coverage (Nicholas C. Zakas)
-* Got npm test to work with istanbul, huzzah\! (Nicholas C. Zakas)
-* Moved /config to /conf (Nicholas C. Zakas)
-* Added script to auto-generate changelog (Nicholas C. Zakas)
-* Add `quote-props` rule (Mathias Bynens)
-* Cleaned up relationship between bin/eslint, lib/cli.js, and lib/eslint.js (Nicholas C. Zakas)
-* Add problem count to compact formatter (Nicholas C. Zakas)
-* Fix merge conflict (Nicholas C. Zakas)
-* Change reporters to formatters, add format command line option. Also added tests for compact format. (Nicholas C. Zakas)
-* Change reporters to formatters, add format command line option (Nicholas C. Zakas)
-* Start development of 0.0.6-dev (Nicholas C. Zakas)
diff --git a/tools/eslint/LICENSE b/tools/eslint/LICENSE
index 777939e8fc1a7f..7fe552a8661505 100644
--- a/tools/eslint/LICENSE
+++ b/tools/eslint/LICENSE
@@ -1,4 +1,3 @@
-ESLint
Copyright JS Foundation and other contributors, https://js.foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/tools/eslint/README.md b/tools/eslint/README.md
index 1ccdbb9bfd4262..7fb4fa343af06e 100644
--- a/tools/eslint/README.md
+++ b/tools/eslint/README.md
@@ -5,6 +5,7 @@
[![Downloads][downloads-image]][downloads-url]
[](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
[](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_shield)
# ESLint
@@ -13,7 +14,7 @@
[Rules](http://eslint.org/docs/rules/) |
[Contributing](http://eslint.org/docs/developer-guide/contributing) |
[Reporting Bugs](http://eslint.org/docs/developer-guide/contributing/reporting-bugs) |
-[Code of Conduct](https://js.foundation/conduct/) |
+[Code of Conduct](https://js.foundation/community/code-of-conduct) |
[Twitter](https://twitter.com/geteslint) |
[Mailing List](https://groups.google.com/group/eslint) |
[Chat Room](https://gitter.im/eslint/eslint)
@@ -123,7 +124,7 @@ These folks keep the project moving and are resources for help.
* Michael Ficarra ([@michaelficarra](https://github.com/michaelficarra))
* Mark Pedrotti ([@pedrottimark](https://github.com/pedrottimark))
* Oleg Gaidarenko ([@markelog](https://github.com/markelog))
-* Mike Sherov [@mikesherov](https://github.com/mikesherov))
+* Mike Sherov ([@mikesherov](https://github.com/mikesherov))
* Henry Zhu ([@hzoo](https://github.com/hzoo))
* Marat Dulin ([@mdevils](https://github.com/mdevils))
* Alexej Yaroshevich ([@zxqfox](https://github.com/zxqfox))
@@ -172,6 +173,10 @@ ESLint follows [semantic versioning](http://semver.org). However, due to the nat
According to our policy, any minor update may report more errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds.
+## License
+
+[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_large)
+
## Frequently Asked Questions
### How is ESLint different from JSHint?
@@ -205,7 +210,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi
### What about ECMAScript 6 support?
-ESLint has full support for ECMAScript 6. By default, this support is off. You can enable ECMAScript 6 support through [configuration](http://eslint.org/docs/user-guide/configuring).
+ESLint has full support for ECMAScript 6. By default, this support is off. You can enable ECMAScript 6 syntax and global variables through [configuration](http://eslint.org/docs/user-guide/configuring).
### What about experimental features?
diff --git a/tools/eslint/bin/eslint.js b/tools/eslint/bin/eslint.js
index bf534971f24d9b..2b5d4e7fe89944 100755
--- a/tools/eslint/bin/eslint.js
+++ b/tools/eslint/bin/eslint.js
@@ -61,14 +61,12 @@ if (useStdIn) {
} else if (init) {
const configInit = require("../lib/config/config-initializer");
- configInit.initializeConfig(err => {
- if (err) {
- process.exitCode = 1;
- console.error(err.message);
- console.error(err.stack);
- } else {
- process.exitCode = 0;
- }
+ configInit.initializeConfig().then(() => {
+ process.exitCode = 0;
+ }).catch(err => {
+ process.exitCode = 1;
+ console.error(err.message);
+ console.error(err.stack);
});
} else {
process.exitCode = cli.execute(process.argv);
diff --git a/tools/eslint/conf/cli-options.js b/tools/eslint/conf/cli-options.js
deleted file mode 100644
index b377f3da7f391e..00000000000000
--- a/tools/eslint/conf/cli-options.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * @fileoverview Default CLIEngineOptions.
- * @author Ian VanSchooten
- */
-
-"use strict";
-
-module.exports = {
- configFile: null,
- baseConfig: false,
- rulePaths: [],
- useEslintrc: true,
- envs: [],
- globals: [],
- rules: {},
- extensions: [".js"],
- ignore: true,
- ignorePath: null,
- parser: "", // must be empty
- cache: false,
-
- // in order to honor the cacheFile option if specified
- // this option should not have a default value otherwise
- // it will always be used
- cacheLocation: "",
- cacheFile: ".eslintcache",
- fix: false,
- allowInlineConfig: true
-};
diff --git a/tools/eslint/conf/config-schema.json b/tools/eslint/conf/config-schema.json
new file mode 100644
index 00000000000000..c3676bde92523b
--- /dev/null
+++ b/tools/eslint/conf/config-schema.json
@@ -0,0 +1,15 @@
+{
+ "type": "object",
+ "properties": {
+ "root": { "type": "boolean" },
+ "globals": { "type": ["object"] },
+ "parser": { "type": ["string", "null"] },
+ "env": { "type": "object" },
+ "plugins": { "type": ["array"] },
+ "settings": { "type": "object" },
+ "extends": { "type": ["string", "array"] },
+ "rules": { "type": "object" },
+ "parserOptions": { "type": "object" }
+ },
+ "additionalProperties": false
+}
diff --git a/tools/eslint/conf/default-cli-options.js b/tools/eslint/conf/default-cli-options.js
new file mode 100644
index 00000000000000..6dfdb54421a393
--- /dev/null
+++ b/tools/eslint/conf/default-cli-options.js
@@ -0,0 +1,27 @@
+/**
+ * @fileoverview Default CLIEngineOptions.
+ * @author Ian VanSchooten
+ */
+
+"use strict";
+
+module.exports = {
+ configFile: null,
+ baseConfig: false,
+ rulePaths: [],
+ useEslintrc: true,
+ envs: [],
+ globals: [],
+ extensions: [".js"],
+ ignore: true,
+ ignorePath: null,
+ cache: false,
+
+ // in order to honor the cacheFile option if specified
+ // this option should not have a default value otherwise
+ // it will always be used
+ cacheLocation: "",
+ cacheFile: ".eslintcache",
+ fix: false,
+ allowInlineConfig: true
+};
diff --git a/tools/eslint/conf/default-config-options.js b/tools/eslint/conf/default-config-options.js
new file mode 100644
index 00000000000000..63d28c48b66d0b
--- /dev/null
+++ b/tools/eslint/conf/default-config-options.js
@@ -0,0 +1,33 @@
+/**
+ * @fileoverview Default config options
+ * @author Teddy Katz
+ */
+
+"use strict";
+
+/**
+ * Freezes an object and all its nested properties
+ * @param {Object} obj The object to deeply freeze
+ * @returns {Object} `obj` after freezing it
+ */
+function deepFreeze(obj) {
+ if (obj === null || typeof obj !== "object") {
+ return obj;
+ }
+
+ Object.keys(obj).map(key => obj[key]).forEach(deepFreeze);
+ return Object.freeze(obj);
+}
+
+module.exports = deepFreeze({
+ env: {},
+ globals: {},
+ rules: {},
+ settings: {},
+ parser: "espree",
+ parserOptions: {
+ ecmaVersion: 5,
+ sourceType: "script",
+ ecmaFeatures: {}
+ }
+});
diff --git a/tools/eslint/conf/eslint-all.js b/tools/eslint/conf/eslint-all.js
index 28d745a9210c7b..43db54fb718723 100644
--- a/tools/eslint/conf/eslint-all.js
+++ b/tools/eslint/conf/eslint-all.js
@@ -10,7 +10,8 @@
//------------------------------------------------------------------------------
const load = require("../lib/load-rules"),
- rules = require("../lib/rules");
+ Rules = require("../lib/rules");
+const rules = new Rules();
//------------------------------------------------------------------------------
// Helpers
diff --git a/tools/eslint/conf/eslint-recommended.js b/tools/eslint/conf/eslint-recommended.js
index 63c2fc770d214a..0d8d19e447d42c 100755
--- a/tools/eslint/conf/eslint-recommended.js
+++ b/tools/eslint/conf/eslint-recommended.js
@@ -10,15 +10,14 @@
/* eslint-disable sort-keys */
module.exports = {
- parser: "espree",
- ecmaFeatures: {},
-
rules: {
/* eslint-enable sort-keys */
"accessor-pairs": "off",
+ "array-bracket-newline": "off",
"array-bracket-spacing": "off",
"array-callback-return": "off",
+ "array-element-newline": "off",
"arrow-body-style": "off",
"arrow-parens": "off",
"arrow-spacing": "off",
@@ -43,6 +42,7 @@ module.exports = {
"dot-notation": "off",
"eol-last": "off",
"eqeqeq": "off",
+ "for-direction": "off",
"func-call-spacing": "off",
"func-name-matching": "off",
"func-names": "off",
@@ -55,6 +55,7 @@ module.exports = {
"id-length": "off",
"id-match": "off",
"indent": "off",
+ "indent-legacy": "off",
"init-declarations": "off",
"jsx-quotes": "off",
"key-spacing": "off",
@@ -80,11 +81,12 @@ module.exports = {
"no-array-constructor": "off",
"no-await-in-loop": "off",
"no-bitwise": "off",
+ "no-buffer-constructor": "off",
"no-caller": "off",
"no-case-declarations": "error",
"no-catch-shadow": "off",
"no-class-assign": "error",
- "no-compare-neg-zero": "off",
+ "no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-confusing-arrow": "off",
"no-console": "error",
@@ -202,7 +204,7 @@ module.exports = {
"no-useless-computed-key": "off",
"no-useless-concat": "off",
"no-useless-constructor": "off",
- "no-useless-escape": "off",
+ "no-useless-escape": "error",
"no-useless-rename": "off",
"no-useless-return": "off",
"no-var": "off",
@@ -212,7 +214,7 @@ module.exports = {
"no-with": "off",
"nonblock-statement-body-position": "off",
"object-curly-newline": "off",
- "object-curly-spacing": ["off", "never"],
+ "object-curly-spacing": "off",
"object-property-newline": "off",
"object-shorthand": "off",
"one-var": "off",
@@ -220,6 +222,7 @@ module.exports = {
"operator-assignment": "off",
"operator-linebreak": "off",
"padded-blocks": "off",
+ "padding-line-between-statements": "off",
"prefer-arrow-callback": "off",
"prefer-const": "off",
"prefer-destructuring": "off",
@@ -238,6 +241,7 @@ module.exports = {
"rest-spread-spacing": "off",
"semi": "off",
"semi-spacing": "off",
+ "semi-style": "off",
"sort-imports": "off",
"sort-keys": "off",
"sort-vars": "off",
@@ -248,6 +252,7 @@ module.exports = {
"space-unary-ops": "off",
"spaced-comment": "off",
"strict": "off",
+ "switch-colon-spacing": "off",
"symbol-description": "off",
"template-curly-spacing": "off",
"template-tag-spacing": "off",
diff --git a/tools/eslint/lib/api.js b/tools/eslint/lib/api.js
index 664e9a5b40ee95..0a0832a47645d3 100644
--- a/tools/eslint/lib/api.js
+++ b/tools/eslint/lib/api.js
@@ -5,8 +5,11 @@
"use strict";
+const Linter = require("./linter");
+
module.exports = {
- linter: require("./eslint"),
+ linter: new Linter(),
+ Linter,
CLIEngine: require("./cli-engine"),
RuleTester: require("./testers/rule-tester"),
SourceCode: require("./util/source-code")
diff --git a/tools/eslint/lib/ast-utils.js b/tools/eslint/lib/ast-utils.js
index 0f2f3d6af539e3..98775f5ef0c274 100644
--- a/tools/eslint/lib/ast-utils.js
+++ b/tools/eslint/lib/ast-utils.js
@@ -10,6 +10,7 @@
//------------------------------------------------------------------------------
const esutils = require("esutils");
+const espree = require("espree");
//------------------------------------------------------------------------------
// Helpers
@@ -27,6 +28,7 @@ const thisTagPattern = /^[\s*]*@this/m;
const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/;
const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
const LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/;
+const SHEBANG_MATCHER = /^#!([^\r\n]+)/;
// A set of node types that can contain a list of statements
const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]);
@@ -243,7 +245,7 @@ function hasJSDocThisTag(node, sourceCode) {
// because callbacks don't have its JSDoc comment.
// e.g.
// sinon.test(/* @this sinon.Sandbox */function() { this.spy(); });
- return sourceCode.getComments(node).leading.some(comment => thisTagPattern.test(comment.value));
+ return sourceCode.getCommentsBefore(node).some(comment => thisTagPattern.test(comment.value));
}
/**
@@ -412,6 +414,7 @@ module.exports = {
COMMENTS_IGNORE_PATTERN,
LINEBREAKS,
LINEBREAK_MATCHER,
+ SHEBANG_MATCHER,
STATEMENT_LIST_PARENTS,
/**
@@ -524,7 +527,7 @@ module.exports = {
/**
* Returns whether the provided node is an ESLint directive comment or not
- * @param {LineComment|BlockComment} node The node to be checked
+ * @param {Line|Block} node The comment token to be checked
* @returns {boolean} `true` if the node is an ESLint directive comment
*/
isDirectiveComment(node) {
@@ -556,9 +559,9 @@ module.exports = {
/**
* Finds the variable by a given name in a given scope and its upper scopes.
*
- * @param {escope.Scope} initScope - A scope to start find.
+ * @param {eslint-scope.Scope} initScope - A scope to start find.
* @param {string} name - A variable name to find.
- * @returns {escope.Variable|null} A found variable or `null`.
+ * @returns {eslint-scope.Variable|null} A found variable or `null`.
*/
getVariableByName(initScope, name) {
let scope = initScope;
@@ -1252,5 +1255,52 @@ module.exports = {
* `node.regex` instead. Also see: https://github.com/eslint/eslint/issues/8020
*/
return node.type === "Literal" && node.value === null && !node.regex;
+ },
+
+ /**
+ * Determines whether two tokens can safely be placed next to each other without merging into a single token
+ * @param {Token|string} leftValue The left token. If this is a string, it will be tokenized and the last token will be used.
+ * @param {Token|string} rightValue The right token. If this is a string, it will be tokenized and the first token will be used.
+ * @returns {boolean} If the tokens cannot be safely placed next to each other, returns `false`. If the tokens can be placed
+ * next to each other, behavior is undefined (although it should return `true` in most cases).
+ */
+ canTokensBeAdjacent(leftValue, rightValue) {
+ let leftToken;
+
+ if (typeof leftValue === "string") {
+ const leftTokens = espree.tokenize(leftValue, { ecmaVersion: 2015 });
+
+ leftToken = leftTokens[leftTokens.length - 1];
+ } else {
+ leftToken = leftValue;
+ }
+
+ const rightToken = typeof rightValue === "string" ? espree.tokenize(rightValue, { ecmaVersion: 2015 })[0] : rightValue;
+
+ if (leftToken.type === "Punctuator" || rightToken.type === "Punctuator") {
+ if (leftToken.type === "Punctuator" && rightToken.type === "Punctuator") {
+ const PLUS_TOKENS = new Set(["+", "++"]);
+ const MINUS_TOKENS = new Set(["-", "--"]);
+
+ return !(
+ PLUS_TOKENS.has(leftToken.value) && PLUS_TOKENS.has(rightToken.value) ||
+ MINUS_TOKENS.has(leftToken.value) && MINUS_TOKENS.has(rightToken.value)
+ );
+ }
+ return true;
+ }
+
+ if (
+ leftToken.type === "String" || rightToken.type === "String" ||
+ leftToken.type === "Template" || rightToken.type === "Template"
+ ) {
+ return true;
+ }
+
+ if (leftToken.type !== "Numeric" && rightToken.type === "Numeric" && rightToken.value.startsWith(".")) {
+ return true;
+ }
+
+ return false;
}
};
diff --git a/tools/eslint/lib/cli-engine.js b/tools/eslint/lib/cli-engine.js
index de875a4d352926..d0abc0a550ebf7 100644
--- a/tools/eslint/lib/cli-engine.js
+++ b/tools/eslint/lib/cli-engine.js
@@ -17,12 +17,10 @@
const fs = require("fs"),
path = require("path"),
- rules = require("./rules"),
- eslint = require("./eslint"),
- defaultOptions = require("../conf/cli-options"),
+ defaultOptions = require("../conf/default-cli-options"),
+ Linter = require("./linter"),
IgnoredPaths = require("./ignored-paths"),
Config = require("./config"),
- Plugins = require("./config/plugins"),
fileEntryCache = require("file-entry-cache"),
globUtil = require("./util/glob-util"),
SourceCodeFixer = require("./util/source-code-fixer"),
@@ -73,8 +71,10 @@ const debug = require("debug")("eslint:cli-engine");
* @typedef {Object} LintResult
* @property {string} filePath The path to the file that was linted.
* @property {LintMessage[]} messages All of the messages for the result.
- * @property {number} errorCount Number or errors for the result.
- * @property {number} warningCount Number or warnings for the result.
+ * @property {number} errorCount Number of errors for the result.
+ * @property {number} warningCount Number of warnings for the result.
+ * @property {number} fixableErrorCount Number of fixable errors for the result.
+ * @property {number} fixableWarningCount Number of fixable warnings for the result.
* @property {string=} [source] The source code of the file that was linted.
* @property {string=} [output] The source code of the file that was linted, with as many fixes applied as possible.
*/
@@ -93,13 +93,21 @@ function calculateStatsPerFile(messages) {
return messages.reduce((stat, message) => {
if (message.fatal || message.severity === 2) {
stat.errorCount++;
+ if (message.fix) {
+ stat.fixableErrorCount++;
+ }
} else {
stat.warningCount++;
+ if (message.fix) {
+ stat.fixableWarningCount++;
+ }
}
return stat;
}, {
errorCount: 0,
- warningCount: 0
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0
});
}
@@ -113,10 +121,14 @@ function calculateStatsPerRun(results) {
return results.reduce((stat, result) => {
stat.errorCount += result.errorCount;
stat.warningCount += result.warningCount;
+ stat.fixableErrorCount += result.fixableErrorCount;
+ stat.fixableWarningCount += result.fixableWarningCount;
return stat;
}, {
errorCount: 0,
- warningCount: 0
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0
});
}
@@ -129,11 +141,12 @@ function calculateStatsPerRun(results) {
* @param {string} options.filename The filename from which the text was read.
* @param {boolean} options.allowInlineConfig Flag indicating if inline comments
* should be allowed.
+ * @param {Linter} linter Linter context
* @returns {Object} The result of the fix operation as returned from the
* SourceCodeFixer.
* @private
*/
-function multipassFix(text, config, options) {
+function multipassFix(text, config, options, linter) {
const MAX_PASSES = 10;
let messages = [],
fixedResult,
@@ -153,10 +166,10 @@ function multipassFix(text, config, options) {
passNumber++;
debug(`Linting code for ${options.filename} (pass ${passNumber})`);
- messages = eslint.verify(text, config, options);
+ messages = linter.verify(text, config, options);
debug(`Generating fixed text for ${options.filename} (pass ${passNumber})`);
- fixedResult = SourceCodeFixer.applyFixes(eslint.getSourceCode(), messages);
+ fixedResult = SourceCodeFixer.applyFixes(linter.getSourceCode(), messages);
// stop if there are any syntax errors.
// 'fixedResult.output' is a empty string.
@@ -181,7 +194,7 @@ function multipassFix(text, config, options) {
* the most up-to-date information.
*/
if (fixedResult.fixed) {
- fixedResult.messages = eslint.verify(text, config, options);
+ fixedResult.messages = linter.verify(text, config, options);
}
@@ -200,13 +213,14 @@ function multipassFix(text, config, options) {
* @param {string} filename An optional string representing the texts filename.
* @param {boolean} fix Indicates if fixes should be processed.
* @param {boolean} allowInlineConfig Allow/ignore comments that change config.
+ * @param {Linter} linter Linter context
* @returns {LintResult} The results for linting on this text.
* @private
*/
-function processText(text, configHelper, filename, fix, allowInlineConfig) {
+function processText(text, configHelper, filename, fix, allowInlineConfig, linter) {
// clear all existing settings for a new file
- eslint.reset();
+ linter.reset();
let filePath,
messages,
@@ -224,10 +238,10 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {
const config = configHelper.getConfig(filePath);
if (config.plugins) {
- Plugins.loadAll(config.plugins);
+ configHelper.plugins.loadAll(config.plugins);
}
- const loadedPlugins = Plugins.getAll();
+ const loadedPlugins = configHelper.plugins.getAll();
for (const plugin in loadedPlugins) {
if (loadedPlugins[plugin].processors && Object.keys(loadedPlugins[plugin].processors).indexOf(fileExtension) >= 0) {
@@ -242,7 +256,7 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {
const unprocessedMessages = [];
parsedBlocks.forEach(block => {
- unprocessedMessages.push(eslint.verify(block, config, {
+ unprocessedMessages.push(linter.verify(block, config, {
filename,
allowInlineConfig
}));
@@ -258,10 +272,10 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {
fixedResult = multipassFix(text, config, {
filename,
allowInlineConfig
- });
+ }, linter);
messages = fixedResult.messages;
} else {
- messages = eslint.verify(text, config, {
+ messages = linter.verify(text, config, {
filename,
allowInlineConfig
});
@@ -274,7 +288,9 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {
filePath: filename,
messages,
errorCount: stats.errorCount,
- warningCount: stats.warningCount
+ warningCount: stats.warningCount,
+ fixableErrorCount: stats.fixableErrorCount,
+ fixableWarningCount: stats.fixableWarningCount
};
if (fixedResult && fixedResult.fixed) {
@@ -294,13 +310,14 @@ function processText(text, configHelper, filename, fix, allowInlineConfig) {
* @param {string} filename The filename of the file being checked.
* @param {Object} configHelper The configuration options for ESLint.
* @param {Object} options The CLIEngine options object.
+ * @param {Linter} linter Linter context
* @returns {LintResult} The results for linting on this file.
* @private
*/
-function processFile(filename, configHelper, options) {
+function processFile(filename, configHelper, options, linter) {
const text = fs.readFileSync(path.resolve(filename), "utf8"),
- result = processText(text, configHelper, filename, options.fix, options.allowInlineConfig);
+ result = processText(text, configHelper, filename, options.fix, options.allowInlineConfig, linter);
return result;
@@ -339,7 +356,9 @@ function createIgnoreResult(filePath, baseDir) {
}
],
errorCount: 0,
- warningCount: 1
+ warningCount: 1,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0
};
}
@@ -432,141 +451,104 @@ function getCacheFile(cacheFile, cwd) {
// Public Interface
//------------------------------------------------------------------------------
-/**
- * Creates a new instance of the core CLI engine.
- * @param {CLIEngineOptions} options The options for this instance.
- * @constructor
- */
-function CLIEngine(options) {
-
- options = Object.assign(
- Object.create(null),
- defaultOptions,
- { cwd: process.cwd() },
- options
- );
-
- /**
- * Stored options for this instance
- * @type {Object}
- */
- this.options = options;
-
- const cacheFile = getCacheFile(this.options.cacheLocation || this.options.cacheFile, this.options.cwd);
+class CLIEngine {
/**
- * Cache used to avoid operating on files that haven't changed since the
- * last successful execution (e.g., file passed linting with no errors and
- * no warnings).
- * @type {Object}
+ * Creates a new instance of the core CLI engine.
+ * @param {CLIEngineOptions} options The options for this instance.
+ * @constructor
*/
- this._fileCache = fileEntryCache.create(cacheFile);
-
- // load in additional rules
- if (this.options.rulePaths) {
- const cwd = this.options.cwd;
-
- this.options.rulePaths.forEach(rulesdir => {
- debug(`Loading rules from ${rulesdir}`);
- rules.load(rulesdir, cwd);
- });
- }
-
- Object.keys(this.options.rules || {}).forEach(name => {
- validator.validateRuleOptions(name, this.options.rules[name], "CLI");
- });
-}
+ constructor(options) {
-/**
- * Returns the formatter representing the given format or null if no formatter
- * with the given name can be found.
- * @param {string} [format] The name of the format to load or the path to a
- * custom formatter.
- * @returns {Function} The formatter function or null if not found.
- */
-CLIEngine.getFormatter = function(format) {
-
- let formatterPath;
+ options = Object.assign(
+ Object.create(null),
+ defaultOptions,
+ { cwd: process.cwd() },
+ options
+ );
- // default is stylish
- format = format || "stylish";
+ /**
+ * Stored options for this instance
+ * @type {Object}
+ */
+ this.options = options;
+ this.linter = new Linter();
- // only strings are valid formatters
- if (typeof format === "string") {
+ const cacheFile = getCacheFile(this.options.cacheLocation || this.options.cacheFile, this.options.cwd);
- // replace \ with / for Windows compatibility
- format = format.replace(/\\/g, "/");
+ /**
+ * Cache used to avoid operating on files that haven't changed since the
+ * last successful execution (e.g., file passed linting with no errors and
+ * no warnings).
+ * @type {Object}
+ */
+ this._fileCache = fileEntryCache.create(cacheFile);
- // if there's a slash, then it's a file
- if (format.indexOf("/") > -1) {
- const cwd = this.options ? this.options.cwd : process.cwd();
+ // load in additional rules
+ if (this.options.rulePaths) {
+ const cwd = this.options.cwd;
- formatterPath = path.resolve(cwd, format);
- } else {
- formatterPath = `./formatters/${format}`;
+ this.options.rulePaths.forEach(rulesdir => {
+ debug(`Loading rules from ${rulesdir}`);
+ this.linter.rules.load(rulesdir, cwd);
+ });
}
- try {
- return require(formatterPath);
- } catch (ex) {
- ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`;
- throw ex;
- }
+ Object.keys(this.options.rules || {}).forEach(name => {
+ validator.validateRuleOptions(name, this.options.rules[name], "CLI", this.linter.rules);
+ });
- } else {
- return null;
+ this.config = new Config(this.options, this.linter);
}
-};
-/**
- * Returns results that only contains errors.
- * @param {LintResult[]} results The results to filter.
- * @returns {LintResult[]} The filtered results.
- */
-CLIEngine.getErrorResults = function(results) {
- const filtered = [];
-
- results.forEach(result => {
- const filteredMessages = result.messages.filter(isErrorMessage);
-
- if (filteredMessages.length > 0) {
- filtered.push(
- Object.assign(result, {
- messages: filteredMessages,
- errorCount: filteredMessages.length,
- warningCount: 0
- })
- );
- }
- });
-
- return filtered;
-};
+ /**
+ * Returns results that only contains errors.
+ * @param {LintResult[]} results The results to filter.
+ * @returns {LintResult[]} The filtered results.
+ */
+ static getErrorResults(results) {
+ const filtered = [];
+
+ results.forEach(result => {
+ const filteredMessages = result.messages.filter(isErrorMessage);
+
+ if (filteredMessages.length > 0) {
+ filtered.push(
+ Object.assign(result, {
+ messages: filteredMessages,
+ errorCount: filteredMessages.length,
+ warningCount: 0,
+ fixableErrorCount: result.fixableErrorCount,
+ fixableWarningCount: 0
+ })
+ );
+ }
+ });
-/**
- * Outputs fixes from the given results to files.
- * @param {Object} report The report object created by CLIEngine.
- * @returns {void}
- */
-CLIEngine.outputFixes = function(report) {
- report.results.filter(result => result.hasOwnProperty("output")).forEach(result => {
- fs.writeFileSync(result.filePath, result.output);
- });
-};
+ return filtered;
+ }
-CLIEngine.prototype = {
+ /**
+ * Outputs fixes from the given results to files.
+ * @param {Object} report The report object created by CLIEngine.
+ * @returns {void}
+ */
+ static outputFixes(report) {
+ report.results.filter(result => result.hasOwnProperty("output")).forEach(result => {
+ fs.writeFileSync(result.filePath, result.output);
+ });
+ }
- constructor: CLIEngine,
/**
- * Add a plugin by passing it's configuration
+ * Add a plugin by passing its configuration
* @param {string} name Name of the plugin.
* @param {Object} pluginobject Plugin configuration object.
* @returns {void}
*/
addPlugin(name, pluginobject) {
- Plugins.define(name, pluginobject);
- },
+ this.config.plugins.define(name, pluginobject);
+ }
/**
* Resolves the patterns passed into executeOnFiles() into glob-based patterns
@@ -576,7 +558,7 @@ CLIEngine.prototype = {
*/
resolveFileGlobPatterns(patterns) {
return globUtil.resolveFileGlobPatterns(patterns, this.options);
- },
+ }
/**
* Executes the current configuration on an array of file and directory names.
@@ -587,7 +569,7 @@ CLIEngine.prototype = {
const results = [],
options = this.options,
fileCache = this._fileCache,
- configHelper = new Config(options);
+ configHelper = this.config;
let prevConfig; // the previous configuration used
/**
@@ -624,9 +606,10 @@ CLIEngine.prototype = {
* unsupported file extensions and any files that are already linted.
* @param {string} filename The resolved filename of the file to be linted
* @param {boolean} warnIgnored always warn when a file is ignored
+ * @param {Linter} linter Linter context
* @returns {void}
*/
- function executeOnFile(filename, warnIgnored) {
+ function executeOnFile(filename, warnIgnored, linter) {
let hashOfConfig,
descriptor;
@@ -669,7 +652,7 @@ CLIEngine.prototype = {
debug(`Processing ${filename}`);
- const res = processFile(filename, configHelper, options);
+ const res = processFile(filename, configHelper, options, linter);
if (options.cache) {
@@ -702,12 +685,11 @@ CLIEngine.prototype = {
const startTime = Date.now();
-
patterns = this.resolveFileGlobPatterns(patterns);
const fileList = globUtil.listFilesToProcess(patterns, options);
fileList.forEach(fileInfo => {
- executeOnFile(fileInfo.filename, fileInfo.ignored);
+ executeOnFile(fileInfo.filename, fileInfo.ignored, this.linter);
});
const stats = calculateStatsPerRun(results);
@@ -723,9 +705,11 @@ CLIEngine.prototype = {
return {
results,
errorCount: stats.errorCount,
- warningCount: stats.warningCount
+ warningCount: stats.warningCount,
+ fixableErrorCount: stats.fixableErrorCount,
+ fixableWarningCount: stats.fixableWarningCount
};
- },
+ }
/**
* Executes the current configuration on text.
@@ -738,7 +722,7 @@ CLIEngine.prototype = {
const results = [],
options = this.options,
- configHelper = new Config(options),
+ configHelper = this.config,
ignoredPaths = new IgnoredPaths(options);
// resolve filename based on options.cwd (for reporting, ignoredPaths also resolves)
@@ -751,7 +735,7 @@ CLIEngine.prototype = {
results.push(createIgnoreResult(filename, options.cwd));
}
} else {
- results.push(processText(text, configHelper, filename, options.fix, options.allowInlineConfig));
+ results.push(processText(text, configHelper, filename, options.fix, options.allowInlineConfig, this.linter));
}
const stats = calculateStatsPerRun(results);
@@ -759,9 +743,11 @@ CLIEngine.prototype = {
return {
results,
errorCount: stats.errorCount,
- warningCount: stats.warningCount
+ warningCount: stats.warningCount,
+ fixableErrorCount: stats.fixableErrorCount,
+ fixableWarningCount: stats.fixableWarningCount
};
- },
+ }
/**
* Returns a configuration object for the given file based on the CLI options.
@@ -771,10 +757,10 @@ CLIEngine.prototype = {
* @returns {Object} A configuration object for the file.
*/
getConfigForFile(filePath) {
- const configHelper = new Config(this.options);
+ const configHelper = this.config;
return configHelper.getConfig(filePath);
- },
+ }
/**
* Checks if a given path is ignored by ESLint.
@@ -786,12 +772,51 @@ CLIEngine.prototype = {
const ignoredPaths = new IgnoredPaths(this.options);
return ignoredPaths.contains(resolvedPath);
- },
+ }
+
+ /**
+ * Returns the formatter representing the given format or null if no formatter
+ * with the given name can be found.
+ * @param {string} [format] The name of the format to load or the path to a
+ * custom formatter.
+ * @returns {Function} The formatter function or null if not found.
+ */
+ getFormatter(format) {
+
+ let formatterPath;
- getFormatter: CLIEngine.getFormatter
+ // default is stylish
+ format = format || "stylish";
-};
+ // only strings are valid formatters
+ if (typeof format === "string") {
+
+ // replace \ with / for Windows compatibility
+ format = format.replace(/\\/g, "/");
+
+ // if there's a slash, then it's a file
+ if (format.indexOf("/") > -1) {
+ const cwd = this.options ? this.options.cwd : process.cwd();
+
+ formatterPath = path.resolve(cwd, format);
+ } else {
+ formatterPath = `./formatters/${format}`;
+ }
+
+ try {
+ return require(formatterPath);
+ } catch (ex) {
+ ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`;
+ throw ex;
+ }
+
+ } else {
+ return null;
+ }
+ }
+}
CLIEngine.version = pkg.version;
+CLIEngine.getFormatter = CLIEngine.prototype.getFormatter;
module.exports = CLIEngine;
diff --git a/tools/eslint/lib/cli.js b/tools/eslint/lib/cli.js
index 640bd81baba6ea..530bfbc423d00e 100644
--- a/tools/eslint/lib/cli.js
+++ b/tools/eslint/lib/cli.js
@@ -17,7 +17,6 @@
const fs = require("fs"),
path = require("path"),
- shell = require("shelljs"),
options = require("./options"),
CLIEngine = require("./cli-engine"),
mkdirp = require("mkdirp"),
@@ -83,7 +82,7 @@ function printResults(engine, results, format, outputFile) {
if (outputFile) {
const filePath = path.resolve(process.cwd(), outputFile);
- if (shell.test("-d", filePath)) {
+ if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) {
log.error("Cannot write to output file path, it is a directory: %s", outputFile);
return false;
}
diff --git a/tools/eslint/lib/code-path-analysis/code-path-state.js b/tools/eslint/lib/code-path-analysis/code-path-state.js
index 3faff3ebb85970..a5adb554ff95ea 100644
--- a/tools/eslint/lib/code-path-analysis/code-path-state.js
+++ b/tools/eslint/lib/code-path-analysis/code-path-state.js
@@ -988,7 +988,7 @@ class CodePathState {
switch (context.type) {
case "WhileStatement":
case "ForStatement":
- choiceContext = this.popChoiceContext();
+ this.popChoiceContext();
makeLooped(
this,
forkContext.head,
diff --git a/tools/eslint/lib/config.js b/tools/eslint/lib/config.js
index 03fda87c973c3b..5407134d6f24e5 100644
--- a/tools/eslint/lib/config.js
+++ b/tools/eslint/lib/config.js
@@ -10,13 +10,12 @@
//------------------------------------------------------------------------------
const path = require("path"),
+ os = require("os"),
ConfigOps = require("./config/config-ops"),
ConfigFile = require("./config/config-file"),
Plugins = require("./config/plugins"),
FileFinder = require("./file-finder"),
- userHome = require("user-home"),
- isResolvable = require("is-resolvable"),
- pathIsInside = require("path-is-inside");
+ isResolvable = require("is-resolvable");
const debug = require("debug")("eslint:config");
@@ -24,7 +23,7 @@ const debug = require("debug")("eslint:config");
// Constants
//------------------------------------------------------------------------------
-const PERSONAL_CONFIG_DIR = userHome || null;
+const PERSONAL_CONFIG_DIR = os.homedir() || null;
//------------------------------------------------------------------------------
// Helpers
@@ -43,10 +42,11 @@ function isObject(item) {
/**
* Load and parse a JSON config object from a file.
* @param {string|Object} configToLoad the path to the JSON config file or the config object itself.
+ * @param {Config} configContext config instance object
* @returns {Object} the parsed config object (empty object if there was a parse error)
* @private
*/
-function loadConfig(configToLoad) {
+function loadConfig(configToLoad, configContext) {
let config = {},
filePath = "";
@@ -56,32 +56,33 @@ function loadConfig(configToLoad) {
config = configToLoad;
if (config.extends) {
- config = ConfigFile.applyExtends(config, filePath);
+ config = ConfigFile.applyExtends(config, configContext, filePath);
}
} else {
filePath = configToLoad;
- config = ConfigFile.load(filePath);
+ config = ConfigFile.load(filePath, configContext);
}
}
-
return config;
}
/**
* Get personal config object from ~/.eslintrc.
+ * @param {Config} configContext Plugin context for the config instance
* @returns {Object} the personal config object (null if there is no personal config)
* @private
*/
-function getPersonalConfig() {
+function getPersonalConfig(configContext) {
let config;
if (PERSONAL_CONFIG_DIR) {
+
const filename = ConfigFile.getFilenameForDirectory(PERSONAL_CONFIG_DIR);
if (filename) {
debug("Using personal config");
- config = loadConfig(filename);
+ config = loadConfig(filename, configContext);
}
}
@@ -99,21 +100,18 @@ function hasRules(options) {
/**
* Get a local config object.
- * @param {Object} thisConfig A Config object.
+ * @param {Config} thisConfig A Config object.
* @param {string} directory The directory to start looking in for a local config file.
* @returns {Object} The local config object, or an empty object if there is no local config.
*/
function getLocalConfig(thisConfig, directory) {
- const localConfigFiles = thisConfig.findLocalConfigFiles(directory),
- numFiles = localConfigFiles.length,
- projectConfigPath = ConfigFile.getFilenameForDirectory(thisConfig.options.cwd);
- let found,
- config = {},
- rootPath;
- for (let i = 0; i < numFiles; i++) {
+ const projectConfigPath = ConfigFile.getFilenameForDirectory(thisConfig.options.cwd);
+ const localConfigFiles = thisConfig.findLocalConfigFiles(directory);
+ let found,
+ config = {};
- const localConfigFile = localConfigFiles[i];
+ for (const localConfigFile of localConfigFiles) {
// Don't consider the personal config file in the home directory,
// except if the home directory is the same as the current working directory
@@ -121,27 +119,22 @@ function getLocalConfig(thisConfig, directory) {
continue;
}
- // If root flag is set, don't consider file if it is above root
- if (rootPath && !pathIsInside(path.dirname(localConfigFile), rootPath)) {
- continue;
- }
-
debug(`Loading ${localConfigFile}`);
- const localConfig = loadConfig(localConfigFile);
+ const localConfig = loadConfig(localConfigFile, thisConfig);
// Don't consider a local config file found if the config is null
if (!localConfig) {
continue;
}
- // Check for root flag
- if (localConfig.root === true) {
- rootPath = path.dirname(localConfigFile);
- }
-
found = true;
debug(`Using ${localConfigFile}`);
config = ConfigOps.merge(localConfig, config);
+
+ // Check for root flag
+ if (localConfig.root === true) {
+ break;
+ }
}
if (!found && !thisConfig.useSpecificConfig) {
@@ -152,7 +145,7 @@ function getLocalConfig(thisConfig, directory) {
* - Otherwise, if no rules were manually passed in, throw and error.
* - Note: This function is not called if useEslintrc is false.
*/
- const personalConfig = getPersonalConfig();
+ const personalConfig = getPersonalConfig(thisConfig);
if (personalConfig) {
config = ConfigOps.merge(config, personalConfig);
@@ -186,17 +179,21 @@ class Config {
/**
* Config options
* @param {Object} options Options to be passed in
+ * @param {Linter} linterContext Linter instance object
*/
- constructor(options) {
+ constructor(options, linterContext) {
options = options || {};
+ this.linterContext = linterContext;
+ this.plugins = new Plugins(linterContext.environments, linterContext.rules);
+
this.ignore = options.ignore;
this.ignorePath = options.ignorePath;
this.cache = {};
this.parser = options.parser;
this.parserOptions = options.parserOptions || {};
- this.baseConfig = options.baseConfig ? loadConfig(options.baseConfig) : { rules: {} };
+ this.baseConfig = options.baseConfig ? loadConfig(options.baseConfig, this) : { rules: {} };
this.useEslintrc = (options.useEslintrc !== false);
@@ -219,16 +216,22 @@ class Config {
return globals;
}, {});
- const useConfig = options.configFile;
-
this.options = options;
+ this.loadConfigFile(options.configFile);
+ }
- if (useConfig) {
- debug(`Using command line config ${useConfig}`);
- if (isResolvable(useConfig) || isResolvable(`eslint-config-${useConfig}`) || useConfig.charAt(0) === "@") {
- this.useSpecificConfig = loadConfig(useConfig);
+ /**
+ * Loads the config from the configuration file
+ * @param {string} configFile - patch to the config file
+ * @returns {undefined}
+ */
+ loadConfigFile(configFile) {
+ if (configFile) {
+ debug(`Using command line config ${configFile}`);
+ if (isResolvable(configFile) || isResolvable(`eslint-config-${configFile}`) || configFile.charAt(0) === "@") {
+ this.useSpecificConfig = loadConfig(configFile, this);
} else {
- this.useSpecificConfig = loadConfig(path.resolve(this.options.cwd, useConfig));
+ this.useSpecificConfig = loadConfig(path.resolve(this.options.cwd, configFile), this);
}
}
}
@@ -248,7 +251,6 @@ class Config {
debug(`Constructing config for ${filePath ? filePath : "text"}`);
config = this.cache[directory];
-
if (config) {
debug("Using config from cache");
return config;
@@ -306,13 +308,13 @@ class Config {
// Step 8: Merge in command line plugins
if (this.options.plugins) {
debug("Merging command line plugins");
- Plugins.loadAll(this.options.plugins);
+ this.plugins.loadAll(this.options.plugins);
config = ConfigOps.merge(config, { plugins: this.options.plugins });
}
// Step 9: Apply environments to the config if present
if (config.env) {
- config = ConfigOps.applyEnvironments(config);
+ config = ConfigOps.applyEnvironments(config, this.linterContext.environments);
}
this.cache[directory] = config;
@@ -323,7 +325,7 @@ class Config {
/**
* Find local config files from directory and parent directories.
* @param {string} directory The directory to start searching from.
- * @returns {string[]} The paths of local config files found.
+ * @returns {GeneratorFunction} The paths of local config files found.
*/
findLocalConfigFiles(directory) {
diff --git a/tools/eslint/lib/config/autoconfig.js b/tools/eslint/lib/config/autoconfig.js
index 4a50ce25cdd248..88204a7a45f192 100644
--- a/tools/eslint/lib/config/autoconfig.js
+++ b/tools/eslint/lib/config/autoconfig.js
@@ -10,12 +10,13 @@
//------------------------------------------------------------------------------
const lodash = require("lodash"),
- eslint = require("../eslint"),
+ Linter = require("../linter"),
configRule = require("./config-rule"),
ConfigOps = require("./config-ops"),
recConfig = require("../../conf/eslint-recommended");
const debug = require("debug")("eslint:autoconfig");
+const linter = new Linter();
//------------------------------------------------------------------------------
// Data
@@ -37,11 +38,11 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only
* @param {number} errorCount The number of errors encountered when linting with the config
*/
- /**
- * This callback is used to measure execution status in a progress bar
- * @callback progressCallback
- * @param {number} The total number of times the callback will be called.
- */
+/**
+ * This callback is used to measure execution status in a progress bar
+ * @callback progressCallback
+ * @param {number} The total number of times the callback will be called.
+ */
/**
* Create registryItems for rules
@@ -290,7 +291,7 @@ class Registry {
ruleSets.forEach(ruleSet => {
const lintConfig = Object.assign({}, config, { rules: ruleSet });
- const lintResults = eslint.verify(sourceCodes[filename], lintConfig);
+ const lintResults = linter.verify(sourceCodes[filename], lintConfig);
lintResults.forEach(result => {
@@ -310,7 +311,7 @@ class Registry {
ruleSetIdx += 1;
if (cb) {
- cb(totalFilesLinting); // eslint-disable-line callback-return
+ cb(totalFilesLinting); // eslint-disable-line callback-return
}
});
diff --git a/tools/eslint/lib/config/config-file.js b/tools/eslint/lib/config/config-file.js
index 4e886b8af27b67..c9fcc9dff803ae 100644
--- a/tools/eslint/lib/config/config-file.js
+++ b/tools/eslint/lib/config/config-file.js
@@ -13,17 +13,13 @@
const fs = require("fs"),
path = require("path"),
- shell = require("shelljs"),
ConfigOps = require("./config-ops"),
validator = require("./config-validator"),
- Plugins = require("./plugins"),
pathUtil = require("../util/path-util"),
ModuleResolver = require("../util/module-resolver"),
pathIsInside = require("path-is-inside"),
- stripBom = require("strip-bom"),
stripComments = require("strip-json-comments"),
stringify = require("json-stable-stringify"),
- defaultOptions = require("../../conf/eslint-recommended"),
requireUncached = require("require-uncached");
const debug = require("debug")("eslint:config-file");
@@ -63,11 +59,11 @@ const resolver = new ModuleResolver();
/**
* Convenience wrapper for synchronously reading file contents.
* @param {string} filePath The filename to read.
- * @returns {string} The file contents.
+ * @returns {string} The file contents, with the BOM removed.
* @private
*/
function readFile(filePath) {
- return stripBom(fs.readFileSync(filePath, "utf8"));
+ return fs.readFileSync(filePath, "utf8").replace(/^\ufeff/, "");
}
/**
@@ -368,18 +364,18 @@ function getLookupPath(configFilePath) {
function getEslintCoreConfigPath(name) {
if (name === "eslint:recommended") {
- /*
- * Add an explicit substitution for eslint:recommended to
- * conf/eslint-recommended.js.
- */
+ /*
+ * Add an explicit substitution for eslint:recommended to
+ * conf/eslint-recommended.js.
+ */
return path.resolve(__dirname, "../../conf/eslint-recommended.js");
}
if (name === "eslint:all") {
- /*
- * Add an explicit substitution for eslint:all to conf/eslint-all.js
- */
+ /*
+ * Add an explicit substitution for eslint:all to conf/eslint-all.js
+ */
return path.resolve(__dirname, "../../conf/eslint-all.js");
}
@@ -389,6 +385,7 @@ function getEslintCoreConfigPath(name) {
/**
* Applies values from the "extends" field in a configuration file.
* @param {Object} config The configuration information.
+ * @param {Config} configContext Plugin context for the config instance
* @param {string} filePath The file path from which the configuration information
* was loaded.
* @param {string} [relativeTo] The path to resolve relative to.
@@ -396,7 +393,7 @@ function getEslintCoreConfigPath(name) {
* loaded and merged.
* @private
*/
-function applyExtends(config, filePath, relativeTo) {
+function applyExtends(config, configContext, filePath, relativeTo) {
let configExtends = config.extends;
// normalize into an array for easier handling
@@ -421,7 +418,7 @@ function applyExtends(config, filePath, relativeTo) {
);
}
debug(`Loading ${parentPath}`);
- return ConfigOps.merge(load(parentPath, false, relativeTo), previousValue);
+ return ConfigOps.merge(load(parentPath, configContext, false, relativeTo), previousValue);
} catch (e) {
/*
@@ -516,19 +513,18 @@ function resolve(filePath, relativeTo) {
return { filePath };
-
}
/**
* Loads a configuration file from the given file path.
* @param {string} filePath The filename or package name to load the configuration
* information from.
+ * @param {Config} configContext Plugins context
* @param {boolean} [applyEnvironments=false] Set to true to merge in environment settings.
* @param {string} [relativeTo] The path to resolve relative to.
* @returns {Object} The configuration information.
- * @private
*/
-function load(filePath, applyEnvironments, relativeTo) {
+function load(filePath, configContext, applyEnvironments, relativeTo) {
const resolvedPath = resolve(filePath, relativeTo),
dirname = path.dirname(resolvedPath.filePath),
lookupPath = getLookupPath(dirname);
@@ -538,12 +534,7 @@ function load(filePath, applyEnvironments, relativeTo) {
// ensure plugins are properly loaded first
if (config.plugins) {
- Plugins.loadAll(config.plugins);
- }
-
- // remove parser from config if it is the default parser
- if (config.parser === defaultOptions.parser) {
- config.parser = null;
+ configContext.plugins.loadAll(config.plugins);
}
// include full path of parser if present
@@ -556,20 +547,20 @@ function load(filePath, applyEnvironments, relativeTo) {
}
// validate the configuration before continuing
- validator.validate(config, filePath);
+ validator.validate(config, filePath, configContext.linterContext.rules, configContext.linterContext.environments);
/*
* If an `extends` property is defined, it represents a configuration file to use as
* a "parent". Load the referenced file and merge the configuration recursively.
*/
if (config.extends) {
- config = applyExtends(config, filePath, dirname);
+ config = applyExtends(config, configContext, filePath, dirname);
}
if (config.env && applyEnvironments) {
// Merge in environment-specific globals and parserOptions.
- config = ConfigOps.applyEnvironments(config);
+ config = ConfigOps.applyEnvironments(config, configContext.linterContext.environments);
}
}
@@ -603,7 +594,7 @@ module.exports = {
for (let i = 0, len = CONFIG_FILES.length; i < len; i++) {
const filename = path.join(directory, CONFIG_FILES[i]);
- if (shell.test("-f", filename)) {
+ if (fs.existsSync(filename) && fs.statSync(filename).isFile()) {
return filename;
}
}
diff --git a/tools/eslint/lib/config/config-initializer.js b/tools/eslint/lib/config/config-initializer.js
index 0062a46504fdf5..ed4bde8757e4e4 100644
--- a/tools/eslint/lib/config/config-initializer.js
+++ b/tools/eslint/lib/config/config-initializer.js
@@ -282,13 +282,12 @@ function getConfigForStyleGuide(guide) {
/* istanbul ignore next: no need to test inquirer*/
/**
* Ask use a few questions on command prompt
- * @param {Function} callback callback function when file has been written
- * @returns {void}
+ * @returns {Promise} The promise with the result of the prompt
*/
-function promptUser(callback) {
+function promptUser() {
let config;
- inquirer.prompt([
+ return inquirer.prompt([
{
type: "list",
name: "source",
@@ -343,29 +342,26 @@ function promptUser(callback) {
return ((answers.source === "guide" && answers.packageJsonExists) || answers.source === "auto");
}
}
- ], earlyAnswers => {
+ ]).then(earlyAnswers => {
// early exit if you are using a style guide
if (earlyAnswers.source === "guide") {
if (!earlyAnswers.packageJsonExists) {
log.info("A package.json is necessary to install plugins such as style guides. Run `npm init` to create a package.json file and try again.");
- return;
+ return void 0;
}
if (earlyAnswers.styleguide === "airbnb" && !earlyAnswers.airbnbReact) {
earlyAnswers.styleguide = "airbnb-base";
}
- try {
- config = getConfigForStyleGuide(earlyAnswers.styleguide);
- writeFile(config, earlyAnswers.format);
- } catch (err) {
- callback(err);
- return;
- }
- return;
+
+ config = getConfigForStyleGuide(earlyAnswers.styleguide);
+ writeFile(config, earlyAnswers.format);
+
+ return void 0;
}
// continue with the questions otherwise...
- inquirer.prompt([
+ return inquirer.prompt([
{
type: "confirm",
name: "es6",
@@ -412,25 +408,21 @@ function promptUser(callback) {
return answers.jsx;
}
}
- ], secondAnswers => {
+ ]).then(secondAnswers => {
// early exit if you are using automatic style generation
if (earlyAnswers.source === "auto") {
- try {
- const combinedAnswers = Object.assign({}, earlyAnswers, secondAnswers);
-
- config = processAnswers(combinedAnswers);
- installModules(config);
- writeFile(config, earlyAnswers.format);
- } catch (err) {
- callback(err);
- return;
- }
- return;
+ const combinedAnswers = Object.assign({}, earlyAnswers, secondAnswers);
+
+ config = processAnswers(combinedAnswers);
+ installModules(config);
+ writeFile(config, earlyAnswers.format);
+
+ return void 0;
}
// continue with the style questions otherwise...
- inquirer.prompt([
+ return inquirer.prompt([
{
type: "list",
name: "indent",
@@ -465,16 +457,12 @@ function promptUser(callback) {
default: "JavaScript",
choices: ["JavaScript", "YAML", "JSON"]
}
- ], answers => {
- try {
- const totalAnswers = Object.assign({}, earlyAnswers, secondAnswers, answers);
-
- config = processAnswers(totalAnswers);
- installModules(config);
- writeFile(config, answers.format);
- } catch (err) {
- callback(err); // eslint-disable-line callback-return
- }
+ ]).then(answers => {
+ const totalAnswers = Object.assign({}, earlyAnswers, secondAnswers, answers);
+
+ config = processAnswers(totalAnswers);
+ installModules(config);
+ writeFile(config, answers.format);
});
});
});
@@ -487,8 +475,8 @@ function promptUser(callback) {
const init = {
getConfigForStyleGuide,
processAnswers,
- /* istanbul ignore next */initializeConfig(callback) {
- promptUser(callback);
+ /* istanbul ignore next */initializeConfig() {
+ return promptUser();
}
};
diff --git a/tools/eslint/lib/config/config-ops.js b/tools/eslint/lib/config/config-ops.js
index 52dea1a106df79..e1d9a90135716d 100644
--- a/tools/eslint/lib/config/config-ops.js
+++ b/tools/eslint/lib/config/config-ops.js
@@ -9,8 +9,6 @@
// Requirements
//------------------------------------------------------------------------------
-const Environments = require("./environments");
-
const debug = require("debug")("eslint:config-ops");
//------------------------------------------------------------------------------
@@ -46,10 +44,11 @@ module.exports = {
/**
* Creates an environment config based on the specified environments.
* @param {Object} env The environment settings.
+ * @param {Environments} envContext The environment context.
* @returns {Object} A configuration object with the appropriate rules and globals
* set.
*/
- createEnvironmentConfig(env) {
+ createEnvironmentConfig(env, envContext) {
const envConfig = this.createEmptyConfig();
@@ -58,7 +57,7 @@ module.exports = {
envConfig.env = env;
Object.keys(env).filter(name => env[name]).forEach(name => {
- const environment = Environments.get(name);
+ const environment = envContext.get(name);
if (environment) {
debug(`Creating config for environment ${name}`);
@@ -80,12 +79,13 @@ module.exports = {
* Given a config with environment settings, applies the globals and
* ecmaFeatures to the configuration and returns the result.
* @param {Object} config The configuration information.
+ * @param {Environments} envContent env context.
* @returns {Object} The updated configuration information.
*/
- applyEnvironments(config) {
+ applyEnvironments(config, envContent) {
if (config.env && typeof config.env === "object") {
debug("Apply environment settings to config");
- return this.merge(this.createEnvironmentConfig(config.env), config);
+ return this.merge(this.createEnvironmentConfig(config.env, envContent), config);
}
return config;
@@ -175,7 +175,7 @@ module.exports = {
}
Object.keys(src).forEach(key => {
if (Array.isArray(src[key]) || Array.isArray(target[key])) {
- dst[key] = deepmerge(target[key], src[key], key === "plugins", isRule);
+ dst[key] = deepmerge(target[key], src[key], key === "plugins" || key === "extends", isRule);
} else if (typeof src[key] !== "object" || !src[key] || key === "exported" || key === "astGlobals") {
dst[key] = src[key];
} else {
diff --git a/tools/eslint/lib/config/config-rule.js b/tools/eslint/lib/config/config-rule.js
index a8a073caa3707d..174b34a47d6bb0 100644
--- a/tools/eslint/lib/config/config-rule.js
+++ b/tools/eslint/lib/config/config-rule.js
@@ -9,9 +9,10 @@
// Requirements
//------------------------------------------------------------------------------
-const rules = require("../rules"),
+const Rules = require("../rules"),
loadRules = require("../load-rules");
+const rules = new Rules();
//------------------------------------------------------------------------------
// Helpers
@@ -168,16 +169,16 @@ function combinePropertyObjects(objArr1, objArr2) {
return res;
}
- /**
- * Creates a new instance of a rule configuration set
- *
- * A rule configuration set is an array of configurations that are valid for a
- * given rule. For example, the configuration set for the "semi" rule could be:
- *
- * ruleConfigSet.ruleConfigs // -> [[2], [2, "always"], [2, "never"]]
- *
- * Rule configuration set class
- */
+/**
+ * Creates a new instance of a rule configuration set
+ *
+ * A rule configuration set is an array of configurations that are valid for a
+ * given rule. For example, the configuration set for the "semi" rule could be:
+ *
+ * ruleConfigSet.ruleConfigs // -> [[2], [2, "always"], [2, "never"]]
+ *
+ * Rule configuration set class
+ */
class RuleConfigSet {
/**
diff --git a/tools/eslint/lib/config/config-validator.js b/tools/eslint/lib/config/config-validator.js
index 36e0e9fddb32ae..329a5087df9e41 100644
--- a/tools/eslint/lib/config/config-validator.js
+++ b/tools/eslint/lib/config/config-validator.js
@@ -9,9 +9,8 @@
// Requirements
//------------------------------------------------------------------------------
-const rules = require("../rules"),
- Environments = require("./environments"),
- schemaValidator = require("is-my-json-valid"),
+const schemaValidator = require("is-my-json-valid"),
+ configSchema = require("../../conf/config-schema.json"),
util = require("util");
const validators = {
@@ -25,10 +24,11 @@ const validators = {
/**
* Gets a complete options schema for a rule.
* @param {string} id The rule's unique name.
+ * @param {Rules} rulesContext Rule context
* @returns {Object} JSON Schema for the rule's options.
*/
-function getRuleOptionsSchema(id) {
- const rule = rules.get(id),
+function getRuleOptionsSchema(id, rulesContext) {
+ const rule = rulesContext.get(id),
schema = rule && rule.schema || rule && rule.meta && rule.meta.schema;
// Given a tuple of schemas, insert warning level at the beginning
@@ -72,10 +72,11 @@ function validateRuleSeverity(options) {
* Validates the non-severity options passed to a rule, based on its schema.
* @param {string} id The rule's unique name
* @param {array} localOptions The options for the rule, excluding severity
+* @param {Rules} rulesContext Rule context
* @returns {void}
*/
-function validateRuleSchema(id, localOptions) {
- const schema = getRuleOptionsSchema(id);
+function validateRuleSchema(id, localOptions, rulesContext) {
+ const schema = getRuleOptionsSchema(id, rulesContext);
if (!validators.rules[id] && schema) {
validators.rules[id] = schemaValidator(schema, { verbose: true });
@@ -95,15 +96,16 @@ function validateRuleSchema(id, localOptions) {
* Validates a rule's options against its schema.
* @param {string} id The rule's unique name.
* @param {array|number} options The given options for the rule.
- * @param {string} source The name of the configuration source.
+ * @param {string} source The name of the configuration source to report in any errors.
+ * @param {Rules} rulesContext Rule context
* @returns {void}
*/
-function validateRuleOptions(id, options, source) {
+function validateRuleOptions(id, options, source, rulesContext) {
try {
const severity = validateRuleSeverity(options);
if (severity !== 0 && !(typeof severity === "string" && severity.toLowerCase() === "off")) {
- validateRuleSchema(id, Array.isArray(options) ? options.slice(1) : []);
+ validateRuleSchema(id, Array.isArray(options) ? options.slice(1) : [], rulesContext);
}
} catch (err) {
throw new Error(`${source}:\n\tConfiguration for rule "${id}" is invalid:\n${err.message}`);
@@ -113,51 +115,91 @@ function validateRuleOptions(id, options, source) {
/**
* Validates an environment object
* @param {Object} environment The environment config object to validate.
- * @param {string} source The location to report with any errors.
+ * @param {string} source The name of the configuration source to report in any errors.
+ * @param {Environments} envContext Env context
* @returns {void}
*/
-function validateEnvironment(environment, source) {
+function validateEnvironment(environment, source, envContext) {
// not having an environment is ok
if (!environment) {
return;
}
- if (Array.isArray(environment)) {
- throw new Error("Environment must not be an array");
- }
+ Object.keys(environment).forEach(env => {
+ if (!envContext.get(env)) {
+ const message = `${source}:\n\tEnvironment key "${env}" is unknown\n`;
+
+ throw new Error(message);
+ }
+ });
+}
- if (typeof environment === "object") {
- Object.keys(environment).forEach(env => {
- if (!Environments.get(env)) {
- const message = [
- source, ":\n",
- "\tEnvironment key \"", env, "\" is unknown\n"
- ];
-
- throw new Error(message.join(""));
- }
- });
- } else {
- throw new Error("Environment must be an object");
+/**
+ * Validates a rules config object
+ * @param {Object} rulesConfig The rules config object to validate.
+ * @param {string} source The name of the configuration source to report in any errors.
+ * @param {Rules} rulesContext Rule context
+ * @returns {void}
+ */
+function validateRules(rulesConfig, source, rulesContext) {
+ if (!rulesConfig) {
+ return;
}
+
+ Object.keys(rulesConfig).forEach(id => {
+ validateRuleOptions(id, rulesConfig[id], source, rulesContext);
+ });
}
/**
- * Validates an entire config object.
+ * Formats an array of schema validation errors.
+ * @param {Array} errors An array of error messages to format.
+ * @returns {string} Formatted error message
+ */
+function formatErrors(errors) {
+
+ return errors.map(error => {
+ if (error.message === "has additional properties") {
+ return `Unexpected top-level property "${error.value.replace(/^data\./, "")}"`;
+ }
+ if (error.message === "is the wrong type") {
+ const formattedField = error.field.replace(/^data\./, "");
+ const formattedExpectedType = typeof error.type === "string" ? error.type : error.type.join("/");
+ const formattedValue = JSON.stringify(error.value);
+
+ return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`;
+ }
+ return `"${error.field.replace(/^(data\.)/, "")}" ${error.message}. Value: ${error.value}`;
+ }).map(message => `\t- ${message}.\n`).join("");
+}
+
+/**
+ * Validates the top level properties of the config object.
* @param {Object} config The config object to validate.
- * @param {string} source The location to report with any errors.
+ * @param {string} source The name of the configuration source to report in any errors.
* @returns {void}
*/
-function validate(config, source) {
+function validateConfigSchema(config, source) {
+ const validator = schemaValidator(configSchema, { verbose: true });
- if (typeof config.rules === "object") {
- Object.keys(config.rules).forEach(id => {
- validateRuleOptions(id, config.rules[id], source);
- });
+ if (!validator(config)) {
+ throw new Error(`${source}:\n\tESLint configuration is invalid:\n${formatErrors(validator.errors)}`);
}
+}
- validateEnvironment(config.env, source);
+/**
+ * Validates an entire config object.
+ * @param {Object} config The config object to validate.
+ * @param {string} source The name of the configuration source to report in any errors.
+ * @param {Rules} rulesContext The rules context
+ * @param {Environments} envContext The env context
+ * @returns {void}
+ */
+function validate(config, source, rulesContext, envContext) {
+ validateConfigSchema(config, source);
+ validateRules(config.rules, source, rulesContext);
+ validateEnvironment(config.env, source, envContext);
}
//------------------------------------------------------------------------------
diff --git a/tools/eslint/lib/config/environments.js b/tools/eslint/lib/config/environments.js
index 5c34da9328a4da..1ec9438af5de2a 100644
--- a/tools/eslint/lib/config/environments.js
+++ b/tools/eslint/lib/config/environments.js
@@ -11,32 +11,30 @@
const envs = require("../../conf/environments");
//------------------------------------------------------------------------------
-// Private
+// Public Interface
//------------------------------------------------------------------------------
-let environments = new Map();
+class Environments {
-/**
- * Loads the default environments.
- * @returns {void}
- * @private
- */
-function load() {
- Object.keys(envs).forEach(envName => {
- environments.set(envName, envs[envName]);
- });
-}
-
-// always load default environments upfront
-load();
-
-//------------------------------------------------------------------------------
-// Public Interface
-//------------------------------------------------------------------------------
+ /**
+ * create env context
+ */
+ constructor() {
+ this._environments = new Map();
-module.exports = {
+ this.load();
+ }
- load,
+ /**
+ * Loads the default environments.
+ * @returns {void}
+ * @private
+ */
+ load() {
+ Object.keys(envs).forEach(envName => {
+ this._environments.set(envName, envs[envName]);
+ });
+ }
/**
* Gets the environment with the given name.
@@ -44,8 +42,19 @@ module.exports = {
* @returns {Object?} The environment object or null if not found.
*/
get(name) {
- return environments.get(name) || null;
- },
+ return this._environments.get(name) || null;
+ }
+
+ /**
+ * Gets all the environment present
+ * @returns {Object} The environment object for each env name
+ */
+ getAll() {
+ return Array.from(this._environments).reduce((coll, env) => {
+ coll[env[0]] = env[1];
+ return coll;
+ }, {});
+ }
/**
* Defines an environment.
@@ -54,8 +63,8 @@ module.exports = {
* @returns {void}
*/
define(name, env) {
- environments.set(name, env);
- },
+ this._environments.set(name, env);
+ }
/**
* Imports all environments from a plugin.
@@ -69,14 +78,7 @@ module.exports = {
this.define(`${pluginName}/${envName}`, plugin.environments[envName]);
});
}
- },
-
- /**
- * Resets all environments. Only use for tests!
- * @returns {void}
- */
- testReset() {
- environments = new Map();
- load();
}
-};
+}
+
+module.exports = Environments;
diff --git a/tools/eslint/lib/config/plugins.js b/tools/eslint/lib/config/plugins.js
index e28a77929c0b5f..11852df5c968fa 100644
--- a/tools/eslint/lib/config/plugins.js
+++ b/tools/eslint/lib/config/plugins.js
@@ -8,56 +8,61 @@
// Requirements
//------------------------------------------------------------------------------
-const Environments = require("./environments"),
- Rules = require("../rules");
-
const debug = require("debug")("eslint:plugins");
//------------------------------------------------------------------------------
// Private
//------------------------------------------------------------------------------
-let plugins = Object.create(null);
-
const PLUGIN_NAME_PREFIX = "eslint-plugin-",
NAMESPACE_REGEX = /^@.*\//i;
-/**
- * Removes the prefix `eslint-plugin-` from a plugin name.
- * @param {string} pluginName The name of the plugin which may have the prefix.
- * @returns {string} The name of the plugin without prefix.
- */
-function removePrefix(pluginName) {
- return pluginName.indexOf(PLUGIN_NAME_PREFIX) === 0 ? pluginName.substring(PLUGIN_NAME_PREFIX.length) : pluginName;
-}
+//------------------------------------------------------------------------------
+// Public Interface
+//------------------------------------------------------------------------------
/**
- * Gets the scope (namespace) of a plugin.
- * @param {string} pluginName The name of the plugin which may have the prefix.
- * @returns {string} The name of the plugins namepace if it has one.
+ * Plugin class
*/
-function getNamespace(pluginName) {
- return pluginName.match(NAMESPACE_REGEX) ? pluginName.match(NAMESPACE_REGEX)[0] : "";
-}
+class Plugins {
-/**
- * Removes the namespace from a plugin name.
- * @param {string} pluginName The name of the plugin which may have the prefix.
- * @returns {string} The name of the plugin without the namespace.
- */
-function removeNamespace(pluginName) {
- return pluginName.replace(NAMESPACE_REGEX, "");
-}
+ /**
+ * Creates the plugins context
+ * @param {Environments} envContext - env context
+ * @param {Rules} rulesContext - rules context
+ */
+ constructor(envContext, rulesContext) {
+ this._plugins = Object.create(null);
+ this._environments = envContext;
+ this._rules = rulesContext;
+ }
-//------------------------------------------------------------------------------
-// Public Interface
-//------------------------------------------------------------------------------
+ /**
+ * Removes the prefix `eslint-plugin-` from a plugin name.
+ * @param {string} pluginName The name of the plugin which may have the prefix.
+ * @returns {string} The name of the plugin without prefix.
+ */
+ static removePrefix(pluginName) {
+ return pluginName.startsWith(PLUGIN_NAME_PREFIX) ? pluginName.substring(PLUGIN_NAME_PREFIX.length) : pluginName;
+ }
-module.exports = {
+ /**
+ * Gets the scope (namespace) of a plugin.
+ * @param {string} pluginName The name of the plugin which may have the prefix.
+ * @returns {string} The name of the plugins namepace if it has one.
+ */
+ static getNamespace(pluginName) {
+ return pluginName.match(NAMESPACE_REGEX) ? pluginName.match(NAMESPACE_REGEX)[0] : "";
+ }
- removePrefix,
- getNamespace,
- removeNamespace,
+ /**
+ * Removes the namespace from a plugin name.
+ * @param {string} pluginName The name of the plugin which may have the prefix.
+ * @returns {string} The name of the plugin without the namespace.
+ */
+ static removeNamespace(pluginName) {
+ return pluginName.replace(NAMESPACE_REGEX, "");
+ }
/**
* Defines a plugin with a given name rather than loading from disk.
@@ -66,22 +71,16 @@ module.exports = {
* @returns {void}
*/
define(pluginName, plugin) {
- const pluginNamespace = getNamespace(pluginName),
- pluginNameWithoutNamespace = removeNamespace(pluginName),
- pluginNameWithoutPrefix = removePrefix(pluginNameWithoutNamespace),
+ const pluginNamespace = Plugins.getNamespace(pluginName),
+ pluginNameWithoutNamespace = Plugins.removeNamespace(pluginName),
+ pluginNameWithoutPrefix = Plugins.removePrefix(pluginNameWithoutNamespace),
shortName = pluginNamespace + pluginNameWithoutPrefix;
// load up environments and rules
- plugins[shortName] = plugin;
- Environments.importPlugin(plugin, shortName);
- Rules.importPlugin(plugin, shortName);
-
- // load up environments and rules for the name that '@scope/' was omitted
- // 3 lines below will be removed by 4.0.0
- plugins[pluginNameWithoutPrefix] = plugin;
- Environments.importPlugin(plugin, pluginNameWithoutPrefix);
- Rules.importPlugin(plugin, pluginNameWithoutPrefix);
- },
+ this._plugins[shortName] = plugin;
+ this._environments.importPlugin(plugin, shortName);
+ this._rules.importPlugin(plugin, shortName);
+ }
/**
* Gets a plugin with the given name.
@@ -89,16 +88,16 @@ module.exports = {
* @returns {Object} The plugin or null if not loaded.
*/
get(pluginName) {
- return plugins[pluginName] || null;
- },
+ return this._plugins[pluginName] || null;
+ }
/**
* Returns all plugins that are loaded.
* @returns {Object} The plugins cache.
*/
getAll() {
- return plugins;
- },
+ return this._plugins;
+ }
/**
* Loads a plugin with the given name.
@@ -107,9 +106,9 @@ module.exports = {
* @throws {Error} If the plugin cannot be loaded.
*/
load(pluginName) {
- const pluginNamespace = getNamespace(pluginName),
- pluginNameWithoutNamespace = removeNamespace(pluginName),
- pluginNameWithoutPrefix = removePrefix(pluginNameWithoutNamespace),
+ const pluginNamespace = Plugins.getNamespace(pluginName),
+ pluginNameWithoutNamespace = Plugins.removeNamespace(pluginName),
+ pluginNameWithoutPrefix = Plugins.removePrefix(pluginNameWithoutNamespace),
shortName = pluginNamespace + pluginNameWithoutPrefix,
longName = pluginNamespace + PLUGIN_NAME_PREFIX + pluginNameWithoutPrefix;
let plugin = null;
@@ -124,7 +123,7 @@ module.exports = {
throw whitespaceError;
}
- if (!plugins[shortName]) {
+ if (!this._plugins[shortName]) {
try {
plugin = require(longName);
} catch (pluginLoadErr) {
@@ -150,7 +149,7 @@ module.exports = {
this.define(pluginName, plugin);
}
- },
+ }
/**
* Loads all plugins from an array.
@@ -160,13 +159,7 @@ module.exports = {
*/
loadAll(pluginNames) {
pluginNames.forEach(this.load, this);
- },
-
- /**
- * Resets plugin information. Use for tests only.
- * @returns {void}
- */
- testReset() {
- plugins = Object.create(null);
}
-};
+}
+
+module.exports = Plugins;
diff --git a/tools/eslint/lib/eslint.js b/tools/eslint/lib/eslint.js
deleted file mode 100755
index a9066c4c8b6884..00000000000000
--- a/tools/eslint/lib/eslint.js
+++ /dev/null
@@ -1,1234 +0,0 @@
-/**
- * @fileoverview Main ESLint object.
- * @author Nicholas C. Zakas
- */
-
-"use strict";
-
-//------------------------------------------------------------------------------
-// Requirements
-//------------------------------------------------------------------------------
-
-const assert = require("assert"),
- EventEmitter = require("events").EventEmitter,
- escope = require("escope"),
- levn = require("levn"),
- blankScriptAST = require("../conf/blank-script.json"),
- DEFAULT_PARSER = require("../conf/eslint-recommended").parser,
- replacements = require("../conf/replacements.json"),
- CodePathAnalyzer = require("./code-path-analysis/code-path-analyzer"),
- ConfigOps = require("./config/config-ops"),
- validator = require("./config/config-validator"),
- Environments = require("./config/environments"),
- CommentEventGenerator = require("./util/comment-event-generator"),
- NodeEventGenerator = require("./util/node-event-generator"),
- SourceCode = require("./util/source-code"),
- Traverser = require("./util/traverser"),
- RuleContext = require("./rule-context"),
- rules = require("./rules"),
- timing = require("./timing"),
-
- pkg = require("../package.json");
-
-
-//------------------------------------------------------------------------------
-// Typedefs
-//------------------------------------------------------------------------------
-
-/**
- * The result of a parsing operation from parseForESLint()
- * @typedef {Object} CustomParseResult
- * @property {ASTNode} ast The ESTree AST Program node.
- * @property {Object} services An object containing additional services related
- * to the parser.
- */
-
-//------------------------------------------------------------------------------
-// Helpers
-//------------------------------------------------------------------------------
-
-/**
- * Parses a list of "name:boolean_value" or/and "name" options divided by comma or
- * whitespace.
- * @param {string} string The string to parse.
- * @param {Comment} comment The comment node which has the string.
- * @returns {Object} Result map object of names and boolean values
- */
-function parseBooleanConfig(string, comment) {
- const items = {};
-
- // Collapse whitespace around `:` and `,` to make parsing easier
- string = string.replace(/\s*([:,])\s*/g, "$1");
-
- string.split(/\s|,+/).forEach(name => {
- if (!name) {
- return;
- }
- const pos = name.indexOf(":");
- let value;
-
- if (pos !== -1) {
- value = name.substring(pos + 1, name.length);
- name = name.substring(0, pos);
- }
-
- items[name] = {
- value: (value === "true"),
- comment
- };
-
- });
- return items;
-}
-
-/**
- * Parses a JSON-like config.
- * @param {string} string The string to parse.
- * @param {Object} location Start line and column of comments for potential error message.
- * @param {Object[]} messages The messages queue for potential error message.
- * @returns {Object} Result map object
- */
-function parseJsonConfig(string, location, messages) {
- let items = {};
-
- // Parses a JSON-like comment by the same way as parsing CLI option.
- try {
- items = levn.parse("Object", string) || {};
-
- // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc*/`.
- // Also, commaless notations have invalid severity:
- // "no-alert: 2 no-console: 2" --> {"no-alert": "2 no-console: 2"}
- // Should ignore that case as well.
- if (ConfigOps.isEverySeverityValid(items)) {
- return items;
- }
- } catch (ex) {
-
- // ignore to parse the string by a fallback.
- }
-
- // Optionator cannot parse commaless notations.
- // But we are supporting that. So this is a fallback for that.
- items = {};
- string = string.replace(/([a-zA-Z0-9\-/]+):/g, "\"$1\":").replace(/(]|[0-9])\s+(?=")/, "$1,");
- try {
- items = JSON.parse(`{${string}}`);
- } catch (ex) {
-
- messages.push({
- ruleId: null,
- fatal: true,
- severity: 2,
- source: null,
- message: `Failed to parse JSON from '${string}': ${ex.message}`,
- line: location.start.line,
- column: location.start.column + 1
- });
-
- }
-
- return items;
-}
-
-/**
- * Parses a config of values separated by comma.
- * @param {string} string The string to parse.
- * @returns {Object} Result map of values and true values
- */
-function parseListConfig(string) {
- const items = {};
-
- // Collapse whitespace around ,
- string = string.replace(/\s*,\s*/g, ",");
-
- string.split(/,+/).forEach(name => {
- name = name.trim();
- if (!name) {
- return;
- }
- items[name] = true;
- });
- return items;
-}
-
-/**
- * Ensures that variables representing built-in properties of the Global Object,
- * and any globals declared by special block comments, are present in the global
- * scope.
- * @param {ASTNode} program The top node of the AST.
- * @param {Scope} globalScope The global scope.
- * @param {Object} config The existing configuration data.
- * @returns {void}
- */
-function addDeclaredGlobals(program, globalScope, config) {
- const declaredGlobals = {},
- exportedGlobals = {},
- explicitGlobals = {},
- builtin = Environments.get("builtin");
-
- Object.assign(declaredGlobals, builtin);
-
- Object.keys(config.env).forEach(name => {
- if (config.env[name]) {
- const env = Environments.get(name),
- environmentGlobals = env && env.globals;
-
- if (environmentGlobals) {
- Object.assign(declaredGlobals, environmentGlobals);
- }
- }
- });
-
- Object.assign(exportedGlobals, config.exported);
- Object.assign(declaredGlobals, config.globals);
- Object.assign(explicitGlobals, config.astGlobals);
-
- Object.keys(declaredGlobals).forEach(name => {
- let variable = globalScope.set.get(name);
-
- if (!variable) {
- variable = new escope.Variable(name, globalScope);
- variable.eslintExplicitGlobal = false;
- globalScope.variables.push(variable);
- globalScope.set.set(name, variable);
- }
- variable.writeable = declaredGlobals[name];
- });
-
- Object.keys(explicitGlobals).forEach(name => {
- let variable = globalScope.set.get(name);
-
- if (!variable) {
- variable = new escope.Variable(name, globalScope);
- variable.eslintExplicitGlobal = true;
- variable.eslintExplicitGlobalComment = explicitGlobals[name].comment;
- globalScope.variables.push(variable);
- globalScope.set.set(name, variable);
- }
- variable.writeable = explicitGlobals[name].value;
- });
-
- // mark all exported variables as such
- Object.keys(exportedGlobals).forEach(name => {
- const variable = globalScope.set.get(name);
-
- if (variable) {
- variable.eslintUsed = true;
- }
- });
-
- /*
- * "through" contains all references which definitions cannot be found.
- * Since we augment the global scope using configuration, we need to update
- * references and remove the ones that were added by configuration.
- */
- globalScope.through = globalScope.through.filter(reference => {
- const name = reference.identifier.name;
- const variable = globalScope.set.get(name);
-
- if (variable) {
-
- /*
- * Links the variable and the reference.
- * And this reference is removed from `Scope#through`.
- */
- reference.resolved = variable;
- variable.references.push(reference);
-
- return false;
- }
-
- return true;
- });
-}
-
-/**
- * Add data to reporting configuration to disable reporting for list of rules
- * starting from start location
- * @param {Object[]} reportingConfig Current reporting configuration
- * @param {Object} start Position to start
- * @param {string[]} rulesToDisable List of rules
- * @returns {void}
- */
-function disableReporting(reportingConfig, start, rulesToDisable) {
-
- if (rulesToDisable.length) {
- rulesToDisable.forEach(rule => {
- reportingConfig.push({
- start,
- end: null,
- rule
- });
- });
- } else {
- reportingConfig.push({
- start,
- end: null,
- rule: null
- });
- }
-}
-
-/**
- * Add data to reporting configuration to enable reporting for list of rules
- * starting from start location
- * @param {Object[]} reportingConfig Current reporting configuration
- * @param {Object} start Position to start
- * @param {string[]} rulesToEnable List of rules
- * @returns {void}
- */
-function enableReporting(reportingConfig, start, rulesToEnable) {
- let i;
-
- if (rulesToEnable.length) {
- rulesToEnable.forEach(rule => {
- for (i = reportingConfig.length - 1; i >= 0; i--) {
- if (!reportingConfig[i].end && reportingConfig[i].rule === rule) {
- reportingConfig[i].end = start;
- break;
- }
- }
- });
- } else {
-
- // find all previous disabled locations if they was started as list of rules
- let prevStart;
-
- for (i = reportingConfig.length - 1; i >= 0; i--) {
- if (prevStart && prevStart !== reportingConfig[i].start) {
- break;
- }
-
- if (!reportingConfig[i].end) {
- reportingConfig[i].end = start;
- prevStart = reportingConfig[i].start;
- }
- }
- }
-}
-
-/**
- * Parses comments in file to extract file-specific config of rules, globals
- * and environments and merges them with global config; also code blocks
- * where reporting is disabled or enabled and merges them with reporting config.
- * @param {string} filename The file being checked.
- * @param {ASTNode} ast The top node of the AST.
- * @param {Object} config The existing configuration data.
- * @param {Object[]} reportingConfig The existing reporting configuration data.
- * @param {Object[]} messages The messages queue.
- * @returns {Object} Modified config object
- */
-function modifyConfigsFromComments(filename, ast, config, reportingConfig, messages) {
-
- let commentConfig = {
- exported: {},
- astGlobals: {},
- rules: {},
- env: {}
- };
- const commentRules = {};
-
- ast.comments.forEach(comment => {
-
- let value = comment.value.trim();
- const match = /^(eslint(-\w+){0,3}|exported|globals?)(\s|$)/.exec(value);
-
- if (match) {
- value = value.substring(match.index + match[1].length);
-
- if (comment.type === "Block") {
- switch (match[1]) {
- case "exported":
- Object.assign(commentConfig.exported, parseBooleanConfig(value, comment));
- break;
-
- case "globals":
- case "global":
- Object.assign(commentConfig.astGlobals, parseBooleanConfig(value, comment));
- break;
-
- case "eslint-env":
- Object.assign(commentConfig.env, parseListConfig(value));
- break;
-
- case "eslint-disable":
- disableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
- break;
-
- case "eslint-enable":
- enableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
- break;
-
- case "eslint": {
- const items = parseJsonConfig(value, comment.loc, messages);
-
- Object.keys(items).forEach(name => {
- const ruleValue = items[name];
-
- validator.validateRuleOptions(name, ruleValue, `${filename} line ${comment.loc.start.line}`);
- commentRules[name] = ruleValue;
- });
- break;
- }
-
- // no default
- }
- } else { // comment.type === "Line"
- if (match[1] === "eslint-disable-line") {
- disableReporting(reportingConfig, { line: comment.loc.start.line, column: 0 }, Object.keys(parseListConfig(value)));
- enableReporting(reportingConfig, comment.loc.end, Object.keys(parseListConfig(value)));
- } else if (match[1] === "eslint-disable-next-line") {
- disableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
- enableReporting(reportingConfig, { line: comment.loc.start.line + 2 }, Object.keys(parseListConfig(value)));
- }
- }
- }
- });
-
- // apply environment configs
- Object.keys(commentConfig.env).forEach(name => {
- const env = Environments.get(name);
-
- if (env) {
- commentConfig = ConfigOps.merge(commentConfig, env);
- }
- });
- Object.assign(commentConfig.rules, commentRules);
-
- return ConfigOps.merge(config, commentConfig);
-}
-
-/**
- * Check if message of rule with ruleId should be ignored in location
- * @param {Object[]} reportingConfig Collection of ignore records
- * @param {string} ruleId Id of rule
- * @param {Object} location Location of message
- * @returns {boolean} True if message should be ignored, false otherwise
- */
-function isDisabledByReportingConfig(reportingConfig, ruleId, location) {
-
- for (let i = 0, c = reportingConfig.length; i < c; i++) {
-
- const ignore = reportingConfig[i];
-
- if ((!ignore.rule || ignore.rule === ruleId) &&
- (location.line > ignore.start.line || (location.line === ignore.start.line && location.column >= ignore.start.column)) &&
- (!ignore.end || (location.line < ignore.end.line || (location.line === ignore.end.line && location.column <= ignore.end.column)))) {
- return true;
- }
- }
-
- return false;
-}
-
-/**
- * Normalize ECMAScript version from the initial config
- * @param {number} ecmaVersion ECMAScript version from the initial config
- * @param {boolean} isModule Whether the source type is module or not
- * @returns {number} normalized ECMAScript version
- */
-function normalizeEcmaVersion(ecmaVersion, isModule) {
-
- // Need at least ES6 for modules
- if (isModule && (!ecmaVersion || ecmaVersion < 6)) {
- ecmaVersion = 6;
- }
-
- // Calculate ECMAScript edition number from official year version starting with
- // ES2015, which corresponds with ES6 (or a difference of 2009).
- if (ecmaVersion >= 2015) {
- ecmaVersion -= 2009;
- }
-
- return ecmaVersion;
-}
-
-/**
- * Process initial config to make it safe to extend by file comment config
- * @param {Object} config Initial config
- * @returns {Object} Processed config
- */
-function prepareConfig(config) {
-
- config.globals = config.globals || config.global || {};
- delete config.global;
-
- const copiedRules = {};
- let parserOptions = {};
-
- if (typeof config.rules === "object") {
- Object.keys(config.rules).forEach(k => {
- const rule = config.rules[k];
-
- if (rule === null) {
- throw new Error(`Invalid config for rule '${k}'.`);
- }
- if (Array.isArray(rule)) {
- copiedRules[k] = rule.slice();
- } else {
- copiedRules[k] = rule;
- }
- });
- }
-
- // merge in environment parserOptions
- if (typeof config.env === "object") {
- Object.keys(config.env).forEach(envName => {
- const env = Environments.get(envName);
-
- if (config.env[envName] && env && env.parserOptions) {
- parserOptions = ConfigOps.merge(parserOptions, env.parserOptions);
- }
- });
- }
-
- const preparedConfig = {
- rules: copiedRules,
- parser: config.parser || DEFAULT_PARSER,
- globals: ConfigOps.merge({}, config.globals),
- env: ConfigOps.merge({}, config.env || {}),
- settings: ConfigOps.merge({}, config.settings || {}),
- parserOptions: ConfigOps.merge(parserOptions, config.parserOptions || {})
- };
- const isModule = preparedConfig.parserOptions.sourceType === "module";
-
- if (isModule) {
- if (!preparedConfig.parserOptions.ecmaFeatures) {
- preparedConfig.parserOptions.ecmaFeatures = {};
- }
-
- // can't have global return inside of modules
- preparedConfig.parserOptions.ecmaFeatures.globalReturn = false;
- }
-
- preparedConfig.parserOptions.ecmaVersion = normalizeEcmaVersion(preparedConfig.parserOptions.ecmaVersion, isModule);
-
- return preparedConfig;
-}
-
-/**
- * Provide a stub rule with a given message
- * @param {string} message The message to be displayed for the rule
- * @returns {Function} Stub rule function
- */
-function createStubRule(message) {
-
- /**
- * Creates a fake rule object
- * @param {Object} context context object for each rule
- * @returns {Object} collection of node to listen on
- */
- function createRuleModule(context) {
- return {
- Program(node) {
- context.report(node, message);
- }
- };
- }
-
- if (message) {
- return createRuleModule;
- }
- throw new Error("No message passed to stub rule");
-
-}
-
-/**
- * Provide a rule replacement message
- * @param {string} ruleId Name of the rule
- * @returns {string} Message detailing rule replacement
- */
-function getRuleReplacementMessage(ruleId) {
- if (ruleId in replacements.rules) {
- const newRules = replacements.rules[ruleId];
-
- return `Rule '${ruleId}' was removed and replaced by: ${newRules.join(", ")}`;
- }
-
- return null;
-}
-
-const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//g;
-
-/**
- * Checks whether or not there is a comment which has "eslint-env *" in a given text.
- * @param {string} text - A source code text to check.
- * @returns {Object|null} A result of parseListConfig() with "eslint-env *" comment.
- */
-function findEslintEnv(text) {
- let match, retv;
-
- eslintEnvPattern.lastIndex = 0;
-
- while ((match = eslintEnvPattern.exec(text))) {
- retv = Object.assign(retv || {}, parseListConfig(match[1]));
- }
-
- return retv;
-}
-
-/**
- * Strips Unicode BOM from a given text.
- *
- * @param {string} text - A text to strip.
- * @returns {string} The stripped text.
- */
-function stripUnicodeBOM(text) {
-
- /*
- * Check Unicode BOM.
- * In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF.
- * http://www.ecma-international.org/ecma-262/6.0/#sec-unicode-format-control-characters
- */
- if (text.charCodeAt(0) === 0xFEFF) {
- return text.slice(1);
- }
- return text;
-}
-
-//------------------------------------------------------------------------------
-// Public Interface
-//------------------------------------------------------------------------------
-
-/**
- * Object that is responsible for verifying JavaScript text
- * @name eslint
- */
-module.exports = (function() {
-
- const api = Object.create(new EventEmitter());
- let messages = [],
- currentConfig = null,
- currentScopes = null,
- scopeManager = null,
- currentFilename = null,
- traverser = null,
- reportingConfig = [],
- sourceCode = null;
-
- /**
- * Parses text into an AST. Moved out here because the try-catch prevents
- * optimization of functions, so it's best to keep the try-catch as isolated
- * as possible
- * @param {string} text The text to parse.
- * @param {Object} config The ESLint configuration object.
- * @param {string} filePath The path to the file being parsed.
- * @returns {ASTNode|CustomParseResult} The AST or parse result if successful,
- * or null if not.
- * @private
- */
- function parse(text, config, filePath) {
-
- let parser,
- parserOptions = {
- loc: true,
- range: true,
- raw: true,
- tokens: true,
- comment: true,
- attachComment: true,
- filePath
- };
-
- try {
- parser = require(config.parser);
- } catch (ex) {
- messages.push({
- ruleId: null,
- fatal: true,
- severity: 2,
- source: null,
- message: ex.message,
- line: 0,
- column: 0
- });
-
- return null;
- }
-
- // merge in any additional parser options
- if (config.parserOptions) {
- parserOptions = Object.assign({}, config.parserOptions, parserOptions);
- }
-
- /*
- * Check for parsing errors first. If there's a parsing error, nothing
- * else can happen. However, a parsing error does not throw an error
- * from this method - it's just considered a fatal error message, a
- * problem that ESLint identified just like any other.
- */
- try {
- if (typeof parser.parseForESLint === "function") {
- return parser.parseForESLint(text, parserOptions);
- }
- return parser.parse(text, parserOptions);
-
- } catch (ex) {
-
- // If the message includes a leading line number, strip it:
- const message = ex.message.replace(/^line \d+:/i, "").trim();
- const source = (ex.lineNumber) ? SourceCode.splitLines(text)[ex.lineNumber - 1] : null;
-
- messages.push({
- ruleId: null,
- fatal: true,
- severity: 2,
- source,
- message: `Parsing error: ${message}`,
-
- line: ex.lineNumber,
- column: ex.column
- });
-
- return null;
- }
- }
-
- /**
- * Get the severity level of a rule (0 - none, 1 - warning, 2 - error)
- * Returns 0 if the rule config is not valid (an Array or a number)
- * @param {Array|number} ruleConfig rule configuration
- * @returns {number} 0, 1, or 2, indicating rule severity
- */
- function getRuleSeverity(ruleConfig) {
- if (typeof ruleConfig === "number") {
- return ruleConfig;
- } else if (Array.isArray(ruleConfig)) {
- return ruleConfig[0];
- }
- return 0;
-
- }
-
- /**
- * Get the options for a rule (not including severity), if any
- * @param {Array|number} ruleConfig rule configuration
- * @returns {Array} of rule options, empty Array if none
- */
- function getRuleOptions(ruleConfig) {
- if (Array.isArray(ruleConfig)) {
- return ruleConfig.slice(1);
- }
- return [];
-
- }
-
- // set unlimited listeners (see https://github.com/eslint/eslint/issues/524)
- api.setMaxListeners(0);
-
- /**
- * Resets the internal state of the object.
- * @returns {void}
- */
- api.reset = function() {
- this.removeAllListeners();
- messages = [];
- currentConfig = null;
- currentScopes = null;
- scopeManager = null;
- traverser = null;
- reportingConfig = [];
- sourceCode = null;
- };
-
- /**
- * Configuration object for the `verify` API. A JS representation of the eslintrc files.
- * @typedef {Object} ESLintConfig
- * @property {Object} rules The rule configuration to verify against.
- * @property {string} [parser] Parser to use when generatig the AST.
- * @property {Object} [parserOptions] Options for the parsed used.
- * @property {Object} [settings] Global settings passed to each rule.
- * @property {Object} [env] The environment to verify in.
- * @property {Object} [globals] Available globalsto the code.
- */
-
- /**
- * Verifies the text against the rules specified by the second argument.
- * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object.
- * @param {ESLintConfig} config An ESLintConfig instance to configure everything.
- * @param {(string|Object)} [filenameOrOptions] The optional filename of the file being checked.
- * If this is not set, the filename will default to ' ' in the rule context. If
- * an object, then it has "filename", "saveState", and "allowInlineConfig" properties.
- * @param {boolean} [saveState] Indicates if the state from the last run should be saved.
- * Mostly useful for testing purposes.
- * @param {boolean} [filenameOrOptions.allowInlineConfig] Allow/disallow inline comments' ability to change config once it is set. Defaults to true if not supplied.
- * Useful if you want to validate JS without comments overriding rules.
- * @returns {Object[]} The results as an array of messages or null if no messages.
- */
- api.verify = function(textOrSourceCode, config, filenameOrOptions, saveState) {
- const text = (typeof textOrSourceCode === "string") ? textOrSourceCode : null;
- let ast,
- parseResult,
- shebang,
- allowInlineConfig;
-
- // evaluate arguments
- if (typeof filenameOrOptions === "object") {
- currentFilename = filenameOrOptions.filename;
- allowInlineConfig = filenameOrOptions.allowInlineConfig;
- saveState = filenameOrOptions.saveState;
- } else {
- currentFilename = filenameOrOptions;
- }
-
- if (!saveState) {
- this.reset();
- }
-
- // search and apply "eslint-env *".
- const envInFile = findEslintEnv(text || textOrSourceCode.text);
-
- config = Object.assign({}, config);
-
- if (envInFile) {
- if (config.env) {
- config.env = Object.assign({}, config.env, envInFile);
- } else {
- config.env = envInFile;
- }
- }
-
- // process initial config to make it safe to extend
- config = prepareConfig(config);
-
- // only do this for text
- if (text !== null) {
-
- // there's no input, just exit here
- if (text.trim().length === 0) {
- sourceCode = new SourceCode(text, blankScriptAST);
- return messages;
- }
-
- parseResult = parse(
- stripUnicodeBOM(text).replace(/^#!([^\r\n]+)/, (match, captured) => {
- shebang = captured;
- return `//${captured}`;
- }),
- config,
- currentFilename
- );
-
- // if this result is from a parseForESLint() method, normalize
- if (parseResult && parseResult.ast) {
- ast = parseResult.ast;
- } else {
- ast = parseResult;
- parseResult = null;
- }
-
- if (ast) {
- sourceCode = new SourceCode(text, ast);
- }
-
- } else {
- sourceCode = textOrSourceCode;
- ast = sourceCode.ast;
- }
-
- // if espree failed to parse the file, there's no sense in setting up rules
- if (ast) {
-
- // parse global comments and modify config
- if (allowInlineConfig !== false) {
- config = modifyConfigsFromComments(currentFilename, ast, config, reportingConfig, messages);
- }
-
- // ensure that severities are normalized in the config
- ConfigOps.normalize(config);
-
- // enable appropriate rules
- Object.keys(config.rules).filter(key => getRuleSeverity(config.rules[key]) > 0).forEach(key => {
- let ruleCreator;
-
- ruleCreator = rules.get(key);
-
- if (!ruleCreator) {
- const replacementMsg = getRuleReplacementMessage(key);
-
- if (replacementMsg) {
- ruleCreator = createStubRule(replacementMsg);
- } else {
- ruleCreator = createStubRule(`Definition for rule '${key}' was not found`);
- }
- rules.define(key, ruleCreator);
- }
-
- const severity = getRuleSeverity(config.rules[key]);
- const options = getRuleOptions(config.rules[key]);
-
- try {
- const ruleContext = new RuleContext(
- key, api, severity, options,
- config.settings, config.parserOptions, config.parser,
- ruleCreator.meta,
- (parseResult && parseResult.services ? parseResult.services : {})
- );
-
- const rule = ruleCreator.create ? ruleCreator.create(ruleContext)
- : ruleCreator(ruleContext);
-
- // add all the selectors from the rule as listeners
- Object.keys(rule).forEach(selector => {
- api.on(selector, timing.enabled
- ? timing.time(key, rule[selector])
- : rule[selector]
- );
- });
- } catch (ex) {
- ex.message = `Error while loading rule '${key}': ${ex.message}`;
- throw ex;
- }
- });
-
- // save config so rules can access as necessary
- currentConfig = config;
- traverser = new Traverser();
-
- const ecmaFeatures = currentConfig.parserOptions.ecmaFeatures || {};
- const ecmaVersion = currentConfig.parserOptions.ecmaVersion || 5;
-
- // gather scope data that may be needed by the rules
- scopeManager = escope.analyze(ast, {
- ignoreEval: true,
- nodejsScope: ecmaFeatures.globalReturn,
- impliedStrict: ecmaFeatures.impliedStrict,
- ecmaVersion,
- sourceType: currentConfig.parserOptions.sourceType || "script",
- fallback: Traverser.getKeys
- });
-
- currentScopes = scopeManager.scopes;
-
- // augment global scope with declared global variables
- addDeclaredGlobals(ast, currentScopes[0], currentConfig);
-
- // remove shebang comments
- if (shebang && ast.comments.length && ast.comments[0].value === shebang) {
- ast.comments.splice(0, 1);
-
- if (ast.body.length && ast.body[0].leadingComments && ast.body[0].leadingComments[0].value === shebang) {
- ast.body[0].leadingComments.splice(0, 1);
- }
- }
-
- let eventGenerator = new NodeEventGenerator(api);
-
- eventGenerator = new CodePathAnalyzer(eventGenerator);
- eventGenerator = new CommentEventGenerator(eventGenerator, sourceCode);
-
- /*
- * Each node has a type property. Whenever a particular type of
- * node is found, an event is fired. This allows any listeners to
- * automatically be informed that this type of node has been found
- * and react accordingly.
- */
- traverser.traverse(ast, {
- enter(node, parent) {
- node.parent = parent;
- eventGenerator.enterNode(node);
- },
- leave(node) {
- eventGenerator.leaveNode(node);
- }
- });
- }
-
- // sort by line and column
- messages.sort((a, b) => {
- const lineDiff = a.line - b.line;
-
- if (lineDiff === 0) {
- return a.column - b.column;
- }
- return lineDiff;
-
- });
-
- return messages;
- };
-
- /**
- * Reports a message from one of the rules.
- * @param {string} ruleId The ID of the rule causing the message.
- * @param {number} severity The severity level of the rule as configured.
- * @param {ASTNode} node The AST node that the message relates to.
- * @param {Object=} location An object containing the error line and column
- * numbers. If location is not provided the node's start location will
- * be used.
- * @param {string} message The actual message.
- * @param {Object} opts Optional template data which produces a formatted message
- * with symbols being replaced by this object's values.
- * @param {Object} fix A fix command description.
- * @param {Object} meta Metadata of the rule
- * @returns {void}
- */
- api.report = function(ruleId, severity, node, location, message, opts, fix, meta) {
- if (node) {
- assert.strictEqual(typeof node, "object", "Node must be an object");
- }
-
- if (typeof location === "string") {
- assert.ok(node, "Node must be provided when reporting error if location is not provided");
-
- meta = fix;
- fix = opts;
- opts = message;
- message = location;
- location = node.loc.start;
- }
-
- // Store end location.
- const endLocation = location.end;
-
- location = location.start || location;
-
- if (isDisabledByReportingConfig(reportingConfig, ruleId, location)) {
- return;
- }
-
- if (opts) {
- message = message.replace(/\{\{\s*([^{}]+?)\s*\}\}/g, (fullMatch, term) => {
- if (term in opts) {
- return opts[term];
- }
-
- // Preserve old behavior: If parameter name not provided, don't replace it.
- return fullMatch;
- });
- }
-
- const problem = {
- ruleId,
- severity,
- message,
- line: location.line,
- column: location.column + 1, // switch to 1-base instead of 0-base
- nodeType: node && node.type,
- source: sourceCode.lines[location.line - 1] || ""
- };
-
- // Define endLine and endColumn if exists.
- if (endLocation) {
- problem.endLine = endLocation.line;
- problem.endColumn = endLocation.column + 1; // switch to 1-base instead of 0-base
- }
-
- // ensure there's range and text properties, otherwise it's not a valid fix
- if (fix && Array.isArray(fix.range) && (typeof fix.text === "string")) {
-
- // If rule uses fix, has metadata, but has no metadata.fixable, we should throw
- if (meta && !meta.fixable) {
- throw new Error("Fixable rules should export a `meta.fixable` property.");
- }
-
- problem.fix = fix;
- }
-
- messages.push(problem);
- };
-
- /**
- * Gets the SourceCode object representing the parsed source.
- * @returns {SourceCode} The SourceCode object.
- */
- api.getSourceCode = function() {
- return sourceCode;
- };
-
- // methods that exist on SourceCode object
- const externalMethods = {
- getSource: "getText",
- getSourceLines: "getLines",
- getAllComments: "getAllComments",
- getNodeByRangeIndex: "getNodeByRangeIndex",
- getComments: "getComments",
- getJSDocComment: "getJSDocComment",
- getFirstToken: "getFirstToken",
- getFirstTokens: "getFirstTokens",
- getLastToken: "getLastToken",
- getLastTokens: "getLastTokens",
- getTokenAfter: "getTokenAfter",
- getTokenBefore: "getTokenBefore",
- getTokenByRangeStart: "getTokenByRangeStart",
- getTokens: "getTokens",
- getTokensAfter: "getTokensAfter",
- getTokensBefore: "getTokensBefore",
- getTokensBetween: "getTokensBetween"
- };
-
- // copy over methods
- Object.keys(externalMethods).forEach(methodName => {
- const exMethodName = externalMethods[methodName];
-
- // All functions expected to have less arguments than 5.
- api[methodName] = function(a, b, c, d, e) {
- if (sourceCode) {
- return sourceCode[exMethodName](a, b, c, d, e);
- }
- return null;
- };
- });
-
- /**
- * Gets nodes that are ancestors of current node.
- * @returns {ASTNode[]} Array of objects representing ancestors.
- */
- api.getAncestors = function() {
- return traverser.parents();
- };
-
- /**
- * Gets the scope for the current node.
- * @returns {Object} An object representing the current node's scope.
- */
- api.getScope = function() {
- const parents = traverser.parents();
-
- // Don't do this for Program nodes - they have no parents
- if (parents.length) {
-
- // if current node introduces a scope, add it to the list
- const current = traverser.current();
-
- if (currentConfig.parserOptions.ecmaVersion >= 6) {
- if (["BlockStatement", "SwitchStatement", "CatchClause", "FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"].indexOf(current.type) >= 0) {
- parents.push(current);
- }
- } else {
- if (["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"].indexOf(current.type) >= 0) {
- parents.push(current);
- }
- }
-
- // Ascend the current node's parents
- for (let i = parents.length - 1; i >= 0; --i) {
-
- // Get the innermost scope
- const scope = scopeManager.acquire(parents[i], true);
-
- if (scope) {
- if (scope.type === "function-expression-name") {
- return scope.childScopes[0];
- }
- return scope;
-
- }
-
- }
-
- }
-
- return currentScopes[0];
- };
-
- /**
- * Record that a particular variable has been used in code
- * @param {string} name The name of the variable to mark as used
- * @returns {boolean} True if the variable was found and marked as used,
- * false if not.
- */
- api.markVariableAsUsed = function(name) {
- const hasGlobalReturn = currentConfig.parserOptions.ecmaFeatures && currentConfig.parserOptions.ecmaFeatures.globalReturn,
- specialScope = hasGlobalReturn || currentConfig.parserOptions.sourceType === "module";
- let scope = this.getScope(),
- i,
- len;
-
- // Special Node.js scope means we need to start one level deeper
- if (scope.type === "global" && specialScope) {
- scope = scope.childScopes[0];
- }
-
- do {
- const variables = scope.variables;
-
- for (i = 0, len = variables.length; i < len; i++) {
- if (variables[i].name === name) {
- variables[i].eslintUsed = true;
- return true;
- }
- }
- } while ((scope = scope.upper));
-
- return false;
- };
-
- /**
- * Gets the filename for the currently parsed source.
- * @returns {string} The filename associated with the source being parsed.
- * Defaults to " " if no filename info is present.
- */
- api.getFilename = function() {
- if (typeof currentFilename === "string") {
- return currentFilename;
- }
- return " ";
-
- };
-
- /**
- * Defines a new linting rule.
- * @param {string} ruleId A unique rule identifier
- * @param {Function} ruleModule Function from context to object mapping AST node types to event handlers
- * @returns {void}
- */
- const defineRule = api.defineRule = function(ruleId, ruleModule) {
- rules.define(ruleId, ruleModule);
- };
-
- /**
- * Defines many new linting rules.
- * @param {Object} rulesToDefine map from unique rule identifier to rule
- * @returns {void}
- */
- api.defineRules = function(rulesToDefine) {
- Object.getOwnPropertyNames(rulesToDefine).forEach(ruleId => {
- defineRule(ruleId, rulesToDefine[ruleId]);
- });
- };
-
- /**
- * Gets the default eslint configuration.
- * @returns {Object} Object mapping rule IDs to their default configurations
- */
- api.defaults = function() {
- return require("../conf/eslint-recommended");
- };
-
- /**
- * Gets an object with all loaded rules.
- * @returns {Map} All loaded rules
- */
- api.getRules = function() {
- return rules.getAllLoadedRules();
- };
-
- api.version = pkg.version;
-
- /**
- * Gets variables that are declared by a specified node.
- *
- * The variables are its `defs[].node` or `defs[].parent` is same as the specified node.
- * Specifically, below:
- *
- * - `VariableDeclaration` - variables of its all declarators.
- * - `VariableDeclarator` - variables.
- * - `FunctionDeclaration`/`FunctionExpression` - its function name and parameters.
- * - `ArrowFunctionExpression` - its parameters.
- * - `ClassDeclaration`/`ClassExpression` - its class name.
- * - `CatchClause` - variables of its exception.
- * - `ImportDeclaration` - variables of its all specifiers.
- * - `ImportSpecifier`/`ImportDefaultSpecifier`/`ImportNamespaceSpecifier` - a variable.
- * - others - always an empty array.
- *
- * @param {ASTNode} node A node to get.
- * @returns {escope.Variable[]} Variables that are declared by the node.
- */
- api.getDeclaredVariables = function(node) {
- return (scopeManager && scopeManager.getDeclaredVariables(node)) || [];
- };
-
- return api;
-
-}());
diff --git a/tools/eslint/lib/file-finder.js b/tools/eslint/lib/file-finder.js
index acb886c9d1e2c2..3458bbf52a4145 100644
--- a/tools/eslint/lib/file-finder.js
+++ b/tools/eslint/lib/file-finder.js
@@ -25,6 +25,7 @@ const fs = require("fs"),
*/
function getDirectoryEntries(directory) {
try {
+
return fs.readdirSync(directory);
} catch (ex) {
return [];
@@ -79,9 +80,9 @@ class FileFinder {
* Searches for all the file names in this.fileNames.
* Is currently used by lib/config.js to find .eslintrc and package.json files.
* @param {string} directory The directory to start the search from.
- * @returns {string[]} The file paths found.
+ * @returns {GeneratorFunction} to iterate the file paths found
*/
- findAllInDirectoryAndParents(directory) {
+ *findAllInDirectoryAndParents(directory) {
const cache = this.cache;
if (directory) {
@@ -91,7 +92,8 @@ class FileFinder {
}
if (cache.hasOwnProperty(directory)) {
- return cache[directory];
+ yield* cache[directory];
+ return; // to avoid doing the normal loop afterwards
}
const dirs = [];
@@ -114,19 +116,21 @@ class FileFinder {
for (let j = 0; j < searched; j++) {
cache[dirs[j]].push(filePath);
}
-
+ yield filePath;
break;
}
}
}
+
const child = directory;
// Assign parent directory to directory.
directory = path.dirname(directory);
if (directory === child) {
- return cache[dirs[0]];
+ return;
}
+
} while (!cache.hasOwnProperty(directory));
// Add what has been cached previously to the cache of each directory searched.
@@ -134,7 +138,7 @@ class FileFinder {
dirs.push.apply(cache[dirs[i]], cache[directory]);
}
- return cache[dirs[0]];
+ yield* cache[dirs[0]];
}
}
diff --git a/tools/eslint/lib/formatters/codeframe.js b/tools/eslint/lib/formatters/codeframe.js
index 1191ccb8efaae9..ed50ae608d48b0 100644
--- a/tools/eslint/lib/formatters/codeframe.js
+++ b/tools/eslint/lib/formatters/codeframe.js
@@ -74,11 +74,14 @@ function formatMessage(message, parentResult) {
* Gets the formatted output summary for a given number of errors and warnings.
* @param {number} errors The number of errors.
* @param {number} warnings The number of warnings.
+ * @param {number} fixableErrors The number of fixable errors.
+ * @param {number} fixableWarnings The number of fixable warnings.
* @returns {string} The formatted output summary.
*/
-function formatSummary(errors, warnings) {
+function formatSummary(errors, warnings, fixableErrors, fixableWarnings) {
const summaryColor = errors > 0 ? "red" : "yellow";
const summary = [];
+ const fixablesSummary = [];
if (errors > 0) {
summary.push(`${errors} ${pluralize("error", errors)}`);
@@ -88,7 +91,21 @@ function formatSummary(errors, warnings) {
summary.push(`${warnings} ${pluralize("warning", warnings)}`);
}
- return chalk[summaryColor].bold(`${summary.join(" and ")} found.`);
+ if (fixableErrors > 0) {
+ fixablesSummary.push(`${fixableErrors} ${pluralize("error", fixableErrors)}`);
+ }
+
+ if (fixableWarnings > 0) {
+ fixablesSummary.push(`${fixableWarnings} ${pluralize("warning", fixableWarnings)}`);
+ }
+
+ let output = chalk[summaryColor].bold(`${summary.join(" and ")} found.`);
+
+ if (fixableErrors || fixableWarnings) {
+ output += chalk[summaryColor].bold(`\n${fixablesSummary.join(" and ")} potentially fixable with the \`--fix\` option.`);
+ }
+
+ return output;
}
//------------------------------------------------------------------------------
@@ -98,6 +115,9 @@ function formatSummary(errors, warnings) {
module.exports = function(results) {
let errors = 0;
let warnings = 0;
+ let fixableErrors = 0;
+ let fixableWarnings = 0;
+
const resultsWithMessages = results.filter(result => result.messages.length > 0);
let output = resultsWithMessages.reduce((resultsOutput, result) => {
@@ -105,12 +125,14 @@ module.exports = function(results) {
errors += result.errorCount;
warnings += result.warningCount;
+ fixableErrors += result.fixableErrorCount;
+ fixableWarnings += result.fixableWarningCount;
return resultsOutput.concat(messages);
}, []).join("\n");
output += "\n";
- output += formatSummary(errors, warnings);
+ output += formatSummary(errors, warnings, fixableErrors, fixableWarnings);
return (errors + warnings) > 0 ? output : "";
};
diff --git a/tools/eslint/lib/formatters/stylish.js b/tools/eslint/lib/formatters/stylish.js
index c19b95d6e3b7be..4ec97a31af5bac 100644
--- a/tools/eslint/lib/formatters/stylish.js
+++ b/tools/eslint/lib/formatters/stylish.js
@@ -28,8 +28,10 @@ function pluralize(word, count) {
module.exports = function(results) {
let output = "\n",
- errors = 0,
- warnings = 0,
+ errorCount = 0,
+ warningCount = 0,
+ fixableErrorCount = 0,
+ fixableWarningCount = 0,
summaryColor = "yellow";
results.forEach(result => {
@@ -39,8 +41,10 @@ module.exports = function(results) {
return;
}
- errors += result.errorCount;
- warnings += result.warningCount;
+ errorCount += result.errorCount;
+ warningCount += result.warningCount;
+ fixableErrorCount += result.fixableErrorCount;
+ fixableWarningCount += result.fixableWarningCount;
output += `${chalk.underline(result.filePath)}\n`;
@@ -73,14 +77,22 @@ module.exports = function(results) {
).split("\n").map(el => el.replace(/(\d+)\s+(\d+)/, (m, p1, p2) => chalk.dim(`${p1}:${p2}`))).join("\n")}\n\n`;
});
- const total = errors + warnings;
+ const total = errorCount + warningCount;
if (total > 0) {
output += chalk[summaryColor].bold([
"\u2716 ", total, pluralize(" problem", total),
- " (", errors, pluralize(" error", errors), ", ",
- warnings, pluralize(" warning", warnings), ")\n"
+ " (", errorCount, pluralize(" error", errorCount), ", ",
+ warningCount, pluralize(" warning", warningCount), ")\n"
].join(""));
+
+ if (fixableErrorCount > 0 || fixableWarningCount > 0) {
+ output += chalk[summaryColor].bold([
+ " ", fixableErrorCount, pluralize(" error", fixableErrorCount), ", ",
+ fixableWarningCount, pluralize(" warning", fixableWarningCount),
+ " potentially fixable with the `--fix` option.\n"
+ ].join(""));
+ }
}
return total > 0 ? output : "";
diff --git a/tools/eslint/lib/formatters/table.js b/tools/eslint/lib/formatters/table.js
index b4859154ba610d..ebc3314e7ad6d1 100644
--- a/tools/eslint/lib/formatters/table.js
+++ b/tools/eslint/lib/formatters/table.js
@@ -9,7 +9,7 @@
//------------------------------------------------------------------------------
const chalk = require("chalk"),
- table = require("table").default,
+ table = require("table").table,
pluralize = require("pluralize");
//------------------------------------------------------------------------------
diff --git a/tools/eslint/lib/ignored-paths.js b/tools/eslint/lib/ignored-paths.js
index cfca7fa4ff1c3b..0d9152495ecac5 100644
--- a/tools/eslint/lib/ignored-paths.js
+++ b/tools/eslint/lib/ignored-paths.js
@@ -12,7 +12,6 @@
const fs = require("fs"),
path = require("path"),
ignore = require("ignore"),
- shell = require("shelljs"),
pathUtil = require("./util/path-util");
const debug = require("debug")("eslint:ignored-paths");
@@ -54,7 +53,7 @@ function findIgnoreFile(cwd) {
const ignoreFilePath = path.resolve(cwd, ESLINT_IGNORE_FILENAME);
- return shell.test("-f", ignoreFilePath) ? ignoreFilePath : "";
+ return fs.existsSync(ignoreFilePath) && fs.statSync(ignoreFilePath).isFile() ? ignoreFilePath : "";
}
/**
@@ -179,7 +178,7 @@ class IgnoredPaths {
let result = false;
const absolutePath = path.resolve(this.options.cwd, filepath);
- const relativePath = pathUtil.getRelativePath(absolutePath, this.options.cwd);
+ const relativePath = pathUtil.getRelativePath(absolutePath, this.baseDir);
if ((typeof category === "undefined") || (category === "default")) {
result = result || (this.ig.default.filter([relativePath]).length === 0);
@@ -213,15 +212,7 @@ class IgnoredPaths {
const filter = ig.createFilter();
- /**
- * TODO
- * 1.
- * Actually, it should be `this.options.baseDir`, which is the base dir of `ignore-path`,
- * as well as Line 177.
- * But doing this leads to a breaking change and fails tests.
- * Related to #6759
- */
- const base = this.options.cwd;
+ const base = this.baseDir;
return function(absolutePath) {
const relative = pathUtil.getRelativePath(absolutePath, base);
diff --git a/tools/eslint/lib/linter.js b/tools/eslint/lib/linter.js
new file mode 100755
index 00000000000000..25af05223d012f
--- /dev/null
+++ b/tools/eslint/lib/linter.js
@@ -0,0 +1,1227 @@
+/**
+ * @fileoverview Main Linter Class
+ * @author Gyandeep Singh
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const assert = require("assert"),
+ EventEmitter = require("events").EventEmitter,
+ eslintScope = require("eslint-scope"),
+ levn = require("levn"),
+ blankScriptAST = require("../conf/blank-script.json"),
+ defaultConfig = require("../conf/default-config-options.js"),
+ replacements = require("../conf/replacements.json"),
+ CodePathAnalyzer = require("./code-path-analysis/code-path-analyzer"),
+ ConfigOps = require("./config/config-ops"),
+ validator = require("./config/config-validator"),
+ Environments = require("./config/environments"),
+ NodeEventGenerator = require("./util/node-event-generator"),
+ SourceCode = require("./util/source-code"),
+ Traverser = require("./util/traverser"),
+ RuleContext = require("./rule-context"),
+ Rules = require("./rules"),
+ timing = require("./timing"),
+ astUtils = require("./ast-utils"),
+
+ pkg = require("../package.json");
+
+
+//------------------------------------------------------------------------------
+// Typedefs
+//------------------------------------------------------------------------------
+
+/**
+ * The result of a parsing operation from parseForESLint()
+ * @typedef {Object} CustomParseResult
+ * @property {ASTNode} ast The ESTree AST Program node.
+ * @property {Object} services An object containing additional services related
+ * to the parser.
+ */
+
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+/**
+ * Parses a list of "name:boolean_value" or/and "name" options divided by comma or
+ * whitespace.
+ * @param {string} string The string to parse.
+ * @param {Comment} comment The comment node which has the string.
+ * @returns {Object} Result map object of names and boolean values
+ */
+function parseBooleanConfig(string, comment) {
+ const items = {};
+
+ // Collapse whitespace around `:` and `,` to make parsing easier
+ string = string.replace(/\s*([:,])\s*/g, "$1");
+
+ string.split(/\s|,+/).forEach(name => {
+ if (!name) {
+ return;
+ }
+ const pos = name.indexOf(":");
+ let value;
+
+ if (pos !== -1) {
+ value = name.substring(pos + 1, name.length);
+ name = name.substring(0, pos);
+ }
+
+ items[name] = {
+ value: (value === "true"),
+ comment
+ };
+
+ });
+ return items;
+}
+
+/**
+ * Parses a JSON-like config.
+ * @param {string} string The string to parse.
+ * @param {Object} location Start line and column of comments for potential error message.
+ * @param {Object[]} messages The messages queue for potential error message.
+ * @returns {Object} Result map object
+ */
+function parseJsonConfig(string, location, messages) {
+ let items = {};
+
+ // Parses a JSON-like comment by the same way as parsing CLI option.
+ try {
+ items = levn.parse("Object", string) || {};
+
+ // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc*/`.
+ // Also, commaless notations have invalid severity:
+ // "no-alert: 2 no-console: 2" --> {"no-alert": "2 no-console: 2"}
+ // Should ignore that case as well.
+ if (ConfigOps.isEverySeverityValid(items)) {
+ return items;
+ }
+ } catch (ex) {
+
+ // ignore to parse the string by a fallback.
+ }
+
+ // Optionator cannot parse commaless notations.
+ // But we are supporting that. So this is a fallback for that.
+ items = {};
+ string = string.replace(/([a-zA-Z0-9\-/]+):/g, "\"$1\":").replace(/(]|[0-9])\s+(?=")/, "$1,");
+ try {
+ items = JSON.parse(`{${string}}`);
+ } catch (ex) {
+
+ messages.push({
+ ruleId: null,
+ fatal: true,
+ severity: 2,
+ source: null,
+ message: `Failed to parse JSON from '${string}': ${ex.message}`,
+ line: location.start.line,
+ column: location.start.column + 1
+ });
+
+ }
+
+ return items;
+}
+
+/**
+ * Parses a config of values separated by comma.
+ * @param {string} string The string to parse.
+ * @returns {Object} Result map of values and true values
+ */
+function parseListConfig(string) {
+ const items = {};
+
+ // Collapse whitespace around ,
+ string = string.replace(/\s*,\s*/g, ",");
+
+ string.split(/,+/).forEach(name => {
+ name = name.trim();
+ if (!name) {
+ return;
+ }
+ items[name] = true;
+ });
+ return items;
+}
+
+/**
+ * Ensures that variables representing built-in properties of the Global Object,
+ * and any globals declared by special block comments, are present in the global
+ * scope.
+ * @param {ASTNode} program The top node of the AST.
+ * @param {Scope} globalScope The global scope.
+ * @param {Object} config The existing configuration data.
+ * @param {Environments} envContext Env context
+ * @returns {void}
+ */
+function addDeclaredGlobals(program, globalScope, config, envContext) {
+ const declaredGlobals = {},
+ exportedGlobals = {},
+ explicitGlobals = {},
+ builtin = envContext.get("builtin");
+
+ Object.assign(declaredGlobals, builtin);
+
+ Object.keys(config.env).forEach(name => {
+ if (config.env[name]) {
+ const env = envContext.get(name),
+ environmentGlobals = env && env.globals;
+
+ if (environmentGlobals) {
+ Object.assign(declaredGlobals, environmentGlobals);
+ }
+ }
+ });
+
+ Object.assign(exportedGlobals, config.exported);
+ Object.assign(declaredGlobals, config.globals);
+ Object.assign(explicitGlobals, config.astGlobals);
+
+ Object.keys(declaredGlobals).forEach(name => {
+ let variable = globalScope.set.get(name);
+
+ if (!variable) {
+ variable = new eslintScope.Variable(name, globalScope);
+ variable.eslintExplicitGlobal = false;
+ globalScope.variables.push(variable);
+ globalScope.set.set(name, variable);
+ }
+ variable.writeable = declaredGlobals[name];
+ });
+
+ Object.keys(explicitGlobals).forEach(name => {
+ let variable = globalScope.set.get(name);
+
+ if (!variable) {
+ variable = new eslintScope.Variable(name, globalScope);
+ variable.eslintExplicitGlobal = true;
+ variable.eslintExplicitGlobalComment = explicitGlobals[name].comment;
+ globalScope.variables.push(variable);
+ globalScope.set.set(name, variable);
+ }
+ variable.writeable = explicitGlobals[name].value;
+ });
+
+ // mark all exported variables as such
+ Object.keys(exportedGlobals).forEach(name => {
+ const variable = globalScope.set.get(name);
+
+ if (variable) {
+ variable.eslintUsed = true;
+ }
+ });
+
+ /*
+ * "through" contains all references which definitions cannot be found.
+ * Since we augment the global scope using configuration, we need to update
+ * references and remove the ones that were added by configuration.
+ */
+ globalScope.through = globalScope.through.filter(reference => {
+ const name = reference.identifier.name;
+ const variable = globalScope.set.get(name);
+
+ if (variable) {
+
+ /*
+ * Links the variable and the reference.
+ * And this reference is removed from `Scope#through`.
+ */
+ reference.resolved = variable;
+ variable.references.push(reference);
+
+ return false;
+ }
+
+ return true;
+ });
+}
+
+/**
+ * Add data to reporting configuration to disable reporting for list of rules
+ * starting from start location
+ * @param {Object[]} reportingConfig Current reporting configuration
+ * @param {Object} start Position to start
+ * @param {string[]} rulesToDisable List of rules
+ * @returns {void}
+ */
+function disableReporting(reportingConfig, start, rulesToDisable) {
+
+ if (rulesToDisable.length) {
+ rulesToDisable.forEach(rule => {
+ reportingConfig.push({
+ start,
+ end: null,
+ rule
+ });
+ });
+ } else {
+ reportingConfig.push({
+ start,
+ end: null,
+ rule: null
+ });
+ }
+}
+
+/**
+ * Add data to reporting configuration to enable reporting for list of rules
+ * starting from start location
+ * @param {Object[]} reportingConfig Current reporting configuration
+ * @param {Object} start Position to start
+ * @param {string[]} rulesToEnable List of rules
+ * @returns {void}
+ */
+function enableReporting(reportingConfig, start, rulesToEnable) {
+ let i;
+
+ if (rulesToEnable.length) {
+ rulesToEnable.forEach(rule => {
+ for (i = reportingConfig.length - 1; i >= 0; i--) {
+ if (!reportingConfig[i].end && reportingConfig[i].rule === rule) {
+ reportingConfig[i].end = start;
+ break;
+ }
+ }
+ });
+ } else {
+
+ // find all previous disabled locations if they was started as list of rules
+ let prevStart;
+
+ for (i = reportingConfig.length - 1; i >= 0; i--) {
+ if (prevStart && prevStart !== reportingConfig[i].start) {
+ break;
+ }
+
+ if (!reportingConfig[i].end) {
+ reportingConfig[i].end = start;
+ prevStart = reportingConfig[i].start;
+ }
+ }
+ }
+}
+
+/**
+ * Parses comments in file to extract file-specific config of rules, globals
+ * and environments and merges them with global config; also code blocks
+ * where reporting is disabled or enabled and merges them with reporting config.
+ * @param {string} filename The file being checked.
+ * @param {ASTNode} ast The top node of the AST.
+ * @param {Object} config The existing configuration data.
+ * @param {Linter} linterContext Linter context object
+ * @returns {Object} Modified config object
+ */
+function modifyConfigsFromComments(filename, ast, config, linterContext) {
+
+ let commentConfig = {
+ exported: {},
+ astGlobals: {},
+ rules: {},
+ env: {}
+ };
+ const commentRules = {};
+ const messages = linterContext.messages;
+ const reportingConfig = linterContext.reportingConfig;
+
+ ast.comments.forEach(comment => {
+
+ let value = comment.value.trim();
+ const match = /^(eslint(-\w+){0,3}|exported|globals?)(\s|$)/.exec(value);
+
+ if (match) {
+ value = value.substring(match.index + match[1].length);
+
+ if (comment.type === "Block") {
+ switch (match[1]) {
+ case "exported":
+ Object.assign(commentConfig.exported, parseBooleanConfig(value, comment));
+ break;
+
+ case "globals":
+ case "global":
+ Object.assign(commentConfig.astGlobals, parseBooleanConfig(value, comment));
+ break;
+
+ case "eslint-env":
+ Object.assign(commentConfig.env, parseListConfig(value));
+ break;
+
+ case "eslint-disable":
+ disableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
+ break;
+
+ case "eslint-enable":
+ enableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
+ break;
+
+ case "eslint": {
+ const items = parseJsonConfig(value, comment.loc, messages);
+
+ Object.keys(items).forEach(name => {
+ const ruleValue = items[name];
+
+ validator.validateRuleOptions(name, ruleValue, `${filename} line ${comment.loc.start.line}`, linterContext.rules);
+ commentRules[name] = ruleValue;
+ });
+ break;
+ }
+
+ // no default
+ }
+ } else { // comment.type === "Line"
+ if (match[1] === "eslint-disable-line") {
+ disableReporting(reportingConfig, { line: comment.loc.start.line, column: 0 }, Object.keys(parseListConfig(value)));
+ enableReporting(reportingConfig, comment.loc.end, Object.keys(parseListConfig(value)));
+ } else if (match[1] === "eslint-disable-next-line") {
+ disableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
+ enableReporting(reportingConfig, { line: comment.loc.start.line + 2 }, Object.keys(parseListConfig(value)));
+ }
+ }
+ }
+ });
+
+ // apply environment configs
+ Object.keys(commentConfig.env).forEach(name => {
+ const env = linterContext.environments.get(name);
+
+ if (env) {
+ commentConfig = ConfigOps.merge(commentConfig, env);
+ }
+ });
+ Object.assign(commentConfig.rules, commentRules);
+
+ return ConfigOps.merge(config, commentConfig);
+}
+
+/**
+ * Check if message of rule with ruleId should be ignored in location
+ * @param {Object[]} reportingConfig Collection of ignore records
+ * @param {string} ruleId Id of rule
+ * @param {Object} location Location of message
+ * @returns {boolean} True if message should be ignored, false otherwise
+ */
+function isDisabledByReportingConfig(reportingConfig, ruleId, location) {
+
+ for (let i = 0, c = reportingConfig.length; i < c; i++) {
+
+ const ignore = reportingConfig[i];
+
+ if ((!ignore.rule || ignore.rule === ruleId) &&
+ (location.line > ignore.start.line || (location.line === ignore.start.line && location.column >= ignore.start.column)) &&
+ (!ignore.end || (location.line < ignore.end.line || (location.line === ignore.end.line && location.column <= ignore.end.column)))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Normalize ECMAScript version from the initial config
+ * @param {number} ecmaVersion ECMAScript version from the initial config
+ * @param {boolean} isModule Whether the source type is module or not
+ * @returns {number} normalized ECMAScript version
+ */
+function normalizeEcmaVersion(ecmaVersion, isModule) {
+
+ // Need at least ES6 for modules
+ if (isModule && (!ecmaVersion || ecmaVersion < 6)) {
+ ecmaVersion = 6;
+ }
+
+ // Calculate ECMAScript edition number from official year version starting with
+ // ES2015, which corresponds with ES6 (or a difference of 2009).
+ if (ecmaVersion >= 2015) {
+ ecmaVersion -= 2009;
+ }
+
+ return ecmaVersion;
+}
+
+/**
+ * Process initial config to make it safe to extend by file comment config
+ * @param {Object} config Initial config
+ * @param {Environments} envContext Env context
+ * @returns {Object} Processed config
+ */
+function prepareConfig(config, envContext) {
+ config.globals = config.globals || {};
+ const copiedRules = Object.assign({}, defaultConfig.rules);
+ let parserOptions = Object.assign({}, defaultConfig.parserOptions);
+
+ if (typeof config.rules === "object") {
+ Object.keys(config.rules).forEach(k => {
+ const rule = config.rules[k];
+
+ if (rule === null) {
+ throw new Error(`Invalid config for rule '${k}'.`);
+ }
+ if (Array.isArray(rule)) {
+ copiedRules[k] = rule.slice();
+ } else {
+ copiedRules[k] = rule;
+ }
+ });
+ }
+
+ // merge in environment parserOptions
+ if (typeof config.env === "object") {
+ Object.keys(config.env).forEach(envName => {
+ const env = envContext.get(envName);
+
+ if (config.env[envName] && env && env.parserOptions) {
+ parserOptions = ConfigOps.merge(parserOptions, env.parserOptions);
+ }
+ });
+ }
+
+ const preparedConfig = {
+ rules: copiedRules,
+ parser: config.parser || defaultConfig.parser,
+ globals: ConfigOps.merge(defaultConfig.globals, config.globals),
+ env: ConfigOps.merge(defaultConfig.env, config.env || {}),
+ settings: ConfigOps.merge(defaultConfig.settings, config.settings || {}),
+ parserOptions: ConfigOps.merge(parserOptions, config.parserOptions || {})
+ };
+ const isModule = preparedConfig.parserOptions.sourceType === "module";
+
+ if (isModule) {
+
+ // can't have global return inside of modules
+ preparedConfig.parserOptions.ecmaFeatures = Object.assign({}, preparedConfig.parserOptions.ecmaFeatures, { globalReturn: false });
+ }
+
+ preparedConfig.parserOptions.ecmaVersion = normalizeEcmaVersion(preparedConfig.parserOptions.ecmaVersion, isModule);
+
+ return preparedConfig;
+}
+
+/**
+ * Provide a stub rule with a given message
+ * @param {string} message The message to be displayed for the rule
+ * @returns {Function} Stub rule function
+ */
+function createStubRule(message) {
+
+ /**
+ * Creates a fake rule object
+ * @param {Object} context context object for each rule
+ * @returns {Object} collection of node to listen on
+ */
+ function createRuleModule(context) {
+ return {
+ Program(node) {
+ context.report(node, message);
+ }
+ };
+ }
+
+ if (message) {
+ return createRuleModule;
+ }
+ throw new Error("No message passed to stub rule");
+
+}
+
+/**
+ * Provide a rule replacement message
+ * @param {string} ruleId Name of the rule
+ * @returns {string} Message detailing rule replacement
+ */
+function getRuleReplacementMessage(ruleId) {
+ if (ruleId in replacements.rules) {
+ const newRules = replacements.rules[ruleId];
+
+ return `Rule '${ruleId}' was removed and replaced by: ${newRules.join(", ")}`;
+ }
+
+ return null;
+}
+
+const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//g;
+
+/**
+ * Checks whether or not there is a comment which has "eslint-env *" in a given text.
+ * @param {string} text - A source code text to check.
+ * @returns {Object|null} A result of parseListConfig() with "eslint-env *" comment.
+ */
+function findEslintEnv(text) {
+ let match, retv;
+
+ eslintEnvPattern.lastIndex = 0;
+
+ while ((match = eslintEnvPattern.exec(text))) {
+ retv = Object.assign(retv || {}, parseListConfig(match[1]));
+ }
+
+ return retv;
+}
+
+/**
+ * Strips Unicode BOM from a given text.
+ *
+ * @param {string} text - A text to strip.
+ * @returns {string} The stripped text.
+ */
+function stripUnicodeBOM(text) {
+
+ /*
+ * Check Unicode BOM.
+ * In JavaScript, string data is stored as UTF-16, so BOM is 0xFEFF.
+ * http://www.ecma-international.org/ecma-262/6.0/#sec-unicode-format-control-characters
+ */
+ if (text.charCodeAt(0) === 0xFEFF) {
+ return text.slice(1);
+ }
+ return text;
+}
+
+/**
+ * Get the severity level of a rule (0 - none, 1 - warning, 2 - error)
+ * Returns 0 if the rule config is not valid (an Array or a number)
+ * @param {Array|number} ruleConfig rule configuration
+ * @returns {number} 0, 1, or 2, indicating rule severity
+ */
+function getRuleSeverity(ruleConfig) {
+ if (typeof ruleConfig === "number") {
+ return ruleConfig;
+ } else if (Array.isArray(ruleConfig)) {
+ return ruleConfig[0];
+ }
+ return 0;
+
+}
+
+/**
+ * Get the options for a rule (not including severity), if any
+ * @param {Array|number} ruleConfig rule configuration
+ * @returns {Array} of rule options, empty Array if none
+ */
+function getRuleOptions(ruleConfig) {
+ if (Array.isArray(ruleConfig)) {
+ return ruleConfig.slice(1);
+ }
+ return [];
+
+}
+
+/**
+ * Parses text into an AST. Moved out here because the try-catch prevents
+ * optimization of functions, so it's best to keep the try-catch as isolated
+ * as possible
+ * @param {string} text The text to parse.
+ * @param {Object} config The ESLint configuration object.
+ * @param {string} filePath The path to the file being parsed.
+ * @returns {ASTNode|CustomParseResult} The AST or parse result if successful,
+ * or null if not.
+ * @param {Array} messages Messages array for the linter object
+ * @returns {*} parsed text if successful otherwise null
+ * @private
+ */
+function parse(text, config, filePath, messages) {
+
+ let parser,
+ parserOptions = {
+ loc: true,
+ range: true,
+ raw: true,
+ tokens: true,
+ comment: true,
+ filePath
+ };
+
+ try {
+ parser = require(config.parser);
+ } catch (ex) {
+ messages.push({
+ ruleId: null,
+ fatal: true,
+ severity: 2,
+ source: null,
+ message: ex.message,
+ line: 0,
+ column: 0
+ });
+
+ return null;
+ }
+
+ // merge in any additional parser options
+ if (config.parserOptions) {
+ parserOptions = Object.assign({}, config.parserOptions, parserOptions);
+ }
+
+ /*
+ * Check for parsing errors first. If there's a parsing error, nothing
+ * else can happen. However, a parsing error does not throw an error
+ * from this method - it's just considered a fatal error message, a
+ * problem that ESLint identified just like any other.
+ */
+ try {
+ if (typeof parser.parseForESLint === "function") {
+ return parser.parseForESLint(text, parserOptions);
+ }
+ return parser.parse(text, parserOptions);
+
+ } catch (ex) {
+
+ // If the message includes a leading line number, strip it:
+ const message = ex.message.replace(/^line \d+:/i, "").trim();
+ const source = (ex.lineNumber) ? SourceCode.splitLines(text)[ex.lineNumber - 1] : null;
+
+ messages.push({
+ ruleId: null,
+ fatal: true,
+ severity: 2,
+ source,
+ message: `Parsing error: ${message}`,
+
+ line: ex.lineNumber,
+ column: ex.column
+ });
+
+ return null;
+ }
+}
+
+//------------------------------------------------------------------------------
+// Public Interface
+//------------------------------------------------------------------------------
+
+/**
+ * Object that is responsible for verifying JavaScript text
+ * @name eslint
+ */
+class Linter extends EventEmitter {
+
+ constructor() {
+ super();
+ this.messages = [];
+ this.currentConfig = null;
+ this.currentScopes = null;
+ this.scopeManager = null;
+ this.currentFilename = null;
+ this.traverser = null;
+ this.reportingConfig = [];
+ this.sourceCode = null;
+ this.version = pkg.version;
+
+ this.rules = new Rules();
+ this.environments = new Environments();
+
+ // set unlimited listeners (see https://github.com/eslint/eslint/issues/524)
+ this.setMaxListeners(0);
+ }
+
+ /**
+ * Resets the internal state of the object.
+ * @returns {void}
+ */
+ reset() {
+ this.removeAllListeners();
+ this.messages = [];
+ this.currentConfig = null;
+ this.currentScopes = null;
+ this.scopeManager = null;
+ this.traverser = null;
+ this.reportingConfig = [];
+ this.sourceCode = null;
+ }
+
+ /**
+ * Configuration object for the `verify` API. A JS representation of the eslintrc files.
+ * @typedef {Object} ESLintConfig
+ * @property {Object} rules The rule configuration to verify against.
+ * @property {string} [parser] Parser to use when generatig the AST.
+ * @property {Object} [parserOptions] Options for the parsed used.
+ * @property {Object} [settings] Global settings passed to each rule.
+ * @property {Object} [env] The environment to verify in.
+ * @property {Object} [globals] Available globals to the code.
+ */
+
+ /**
+ * Verifies the text against the rules specified by the second argument.
+ * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object.
+ * @param {ESLintConfig} config An ESLintConfig instance to configure everything.
+ * @param {(string|Object)} [filenameOrOptions] The optional filename of the file being checked.
+ * If this is not set, the filename will default to ' ' in the rule context. If
+ * an object, then it has "filename", "saveState", and "allowInlineConfig" properties.
+ * @param {boolean} [saveState] Indicates if the state from the last run should be saved.
+ * Mostly useful for testing purposes.
+ * @param {boolean} [filenameOrOptions.allowInlineConfig] Allow/disallow inline comments' ability to change config once it is set. Defaults to true if not supplied.
+ * Useful if you want to validate JS without comments overriding rules.
+ * @returns {Object[]} The results as an array of messages or null if no messages.
+ */
+ verify(textOrSourceCode, config, filenameOrOptions, saveState) {
+ const text = (typeof textOrSourceCode === "string") ? textOrSourceCode : null;
+ let ast,
+ parseResult,
+ allowInlineConfig;
+
+ // evaluate arguments
+ if (typeof filenameOrOptions === "object") {
+ this.currentFilename = filenameOrOptions.filename;
+ allowInlineConfig = filenameOrOptions.allowInlineConfig;
+ saveState = filenameOrOptions.saveState;
+ } else {
+ this.currentFilename = filenameOrOptions;
+ }
+
+ if (!saveState) {
+ this.reset();
+ }
+
+ // search and apply "eslint-env *".
+ const envInFile = findEslintEnv(text || textOrSourceCode.text);
+
+ config = Object.assign({}, config);
+
+ if (envInFile) {
+ if (config.env) {
+ config.env = Object.assign({}, config.env, envInFile);
+ } else {
+ config.env = envInFile;
+ }
+ }
+
+ // process initial config to make it safe to extend
+ config = prepareConfig(config, this.environments);
+
+ // only do this for text
+ if (text !== null) {
+
+ // there's no input, just exit here
+ if (text.trim().length === 0) {
+ this.sourceCode = new SourceCode(text, blankScriptAST);
+ return this.messages;
+ }
+
+ parseResult = parse(
+ stripUnicodeBOM(text).replace(astUtils.SHEBANG_MATCHER, (match, captured) => `//${captured}`),
+ config,
+ this.currentFilename,
+ this.messages
+ );
+
+ // if this result is from a parseForESLint() method, normalize
+ if (parseResult && parseResult.ast) {
+ ast = parseResult.ast;
+ } else {
+ ast = parseResult;
+ parseResult = null;
+ }
+
+ if (ast) {
+ this.sourceCode = new SourceCode(text, ast);
+ }
+
+ } else {
+ this.sourceCode = textOrSourceCode;
+ ast = this.sourceCode.ast;
+ }
+
+ // if espree failed to parse the file, there's no sense in setting up rules
+ if (ast) {
+
+ // parse global comments and modify config
+ if (allowInlineConfig !== false) {
+ config = modifyConfigsFromComments(this.currentFilename, ast, config, this);
+ }
+
+ // ensure that severities are normalized in the config
+ ConfigOps.normalize(config);
+
+ // enable appropriate rules
+ Object.keys(config.rules).filter(key => getRuleSeverity(config.rules[key]) > 0).forEach(key => {
+ let ruleCreator;
+
+ ruleCreator = this.rules.get(key);
+
+ if (!ruleCreator) {
+ const replacementMsg = getRuleReplacementMessage(key);
+
+ if (replacementMsg) {
+ ruleCreator = createStubRule(replacementMsg);
+ } else {
+ ruleCreator = createStubRule(`Definition for rule '${key}' was not found`);
+ }
+ this.rules.define(key, ruleCreator);
+ }
+
+ const severity = getRuleSeverity(config.rules[key]);
+ const options = getRuleOptions(config.rules[key]);
+
+ try {
+ const ruleContext = new RuleContext(
+ key, this, severity, options,
+ config.settings, config.parserOptions, config.parser,
+ ruleCreator.meta,
+ (parseResult && parseResult.services ? parseResult.services : {})
+ );
+
+ const rule = ruleCreator.create ? ruleCreator.create(ruleContext)
+ : ruleCreator(ruleContext);
+
+ // add all the selectors from the rule as listeners
+ Object.keys(rule).forEach(selector => {
+ this.on(selector, timing.enabled
+ ? timing.time(key, rule[selector])
+ : rule[selector]
+ );
+ });
+ } catch (ex) {
+ ex.message = `Error while loading rule '${key}': ${ex.message}`;
+ throw ex;
+ }
+ });
+
+ // save config so rules can access as necessary
+ this.currentConfig = config;
+ this.traverser = new Traverser();
+
+ const ecmaFeatures = this.currentConfig.parserOptions.ecmaFeatures || {};
+ const ecmaVersion = this.currentConfig.parserOptions.ecmaVersion || 5;
+
+ // gather scope data that may be needed by the rules
+ this.scopeManager = eslintScope.analyze(ast, {
+ ignoreEval: true,
+ nodejsScope: ecmaFeatures.globalReturn,
+ impliedStrict: ecmaFeatures.impliedStrict,
+ ecmaVersion,
+ sourceType: this.currentConfig.parserOptions.sourceType || "script",
+ fallback: Traverser.getKeys
+ });
+
+ this.currentScopes = this.scopeManager.scopes;
+
+ // augment global scope with declared global variables
+ addDeclaredGlobals(ast, this.currentScopes[0], this.currentConfig, this.environments);
+
+ let eventGenerator = new NodeEventGenerator(this);
+
+ eventGenerator = new CodePathAnalyzer(eventGenerator);
+
+ /*
+ * Each node has a type property. Whenever a particular type of
+ * node is found, an event is fired. This allows any listeners to
+ * automatically be informed that this type of node has been found
+ * and react accordingly.
+ */
+ this.traverser.traverse(ast, {
+ enter(node, parent) {
+ node.parent = parent;
+ eventGenerator.enterNode(node);
+ },
+ leave(node) {
+ eventGenerator.leaveNode(node);
+ }
+ });
+ }
+
+ // sort by line and column
+ this.messages.sort((a, b) => {
+ const lineDiff = a.line - b.line;
+
+ if (lineDiff === 0) {
+ return a.column - b.column;
+ }
+ return lineDiff;
+
+ });
+
+ return this.messages;
+ }
+
+ /**
+ * Reports a message from one of the rules.
+ * @param {string} ruleId The ID of the rule causing the message.
+ * @param {number} severity The severity level of the rule as configured.
+ * @param {ASTNode} node The AST node that the message relates to.
+ * @param {Object=} location An object containing the error line and column
+ * numbers. If location is not provided the node's start location will
+ * be used.
+ * @param {string} message The actual message.
+ * @param {Object} opts Optional template data which produces a formatted message
+ * with symbols being replaced by this object's values.
+ * @param {Object} fix A fix command description.
+ * @param {Object} meta Metadata of the rule
+ * @returns {void}
+ */
+ report(ruleId, severity, node, location, message, opts, fix, meta) {
+ if (node) {
+ assert.strictEqual(typeof node, "object", "Node must be an object");
+ }
+
+ let endLocation;
+
+ if (typeof location === "string") {
+ assert.ok(node, "Node must be provided when reporting error if location is not provided");
+
+ meta = fix;
+ fix = opts;
+ opts = message;
+ message = location;
+ location = node.loc.start;
+ endLocation = node.loc.end;
+ } else {
+ endLocation = location.end;
+ }
+
+ location = location.start || location;
+
+ if (isDisabledByReportingConfig(this.reportingConfig, ruleId, location)) {
+ return;
+ }
+
+ if (opts) {
+ message = message.replace(/\{\{\s*([^{}]+?)\s*\}\}/g, (fullMatch, term) => {
+ if (term in opts) {
+ return opts[term];
+ }
+
+ // Preserve old behavior: If parameter name not provided, don't replace it.
+ return fullMatch;
+ });
+ }
+
+ const problem = {
+ ruleId,
+ severity,
+ message,
+ line: location.line,
+ column: location.column + 1, // switch to 1-base instead of 0-base
+ nodeType: node && node.type,
+ source: this.sourceCode.lines[location.line - 1] || ""
+ };
+
+ // Define endLine and endColumn if exists.
+ if (endLocation) {
+ problem.endLine = endLocation.line;
+ problem.endColumn = endLocation.column + 1; // switch to 1-base instead of 0-base
+ }
+
+ // ensure there's range and text properties, otherwise it's not a valid fix
+ if (fix && Array.isArray(fix.range) && (typeof fix.text === "string")) {
+
+ // If rule uses fix, has metadata, but has no metadata.fixable, we should throw
+ if (meta && !meta.fixable) {
+ throw new Error("Fixable rules should export a `meta.fixable` property.");
+ }
+
+ problem.fix = fix;
+ }
+
+ this.messages.push(problem);
+ }
+
+ /**
+ * Gets the SourceCode object representing the parsed source.
+ * @returns {SourceCode} The SourceCode object.
+ */
+ getSourceCode() {
+ return this.sourceCode;
+ }
+
+ /**
+ * Gets nodes that are ancestors of current node.
+ * @returns {ASTNode[]} Array of objects representing ancestors.
+ */
+ getAncestors() {
+ return this.traverser.parents();
+ }
+
+ /**
+ * Gets the scope for the current node.
+ * @returns {Object} An object representing the current node's scope.
+ */
+ getScope() {
+ const parents = this.traverser.parents();
+
+ // Don't do this for Program nodes - they have no parents
+ if (parents.length) {
+
+ // if current node introduces a scope, add it to the list
+ const current = this.traverser.current();
+
+ if (this.currentConfig.parserOptions.ecmaVersion >= 6) {
+ if (["BlockStatement", "SwitchStatement", "CatchClause", "FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"].indexOf(current.type) >= 0) {
+ parents.push(current);
+ }
+ } else {
+ if (["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"].indexOf(current.type) >= 0) {
+ parents.push(current);
+ }
+ }
+
+ // Ascend the current node's parents
+ for (let i = parents.length - 1; i >= 0; --i) {
+
+ // Get the innermost scope
+ const scope = this.scopeManager.acquire(parents[i], true);
+
+ if (scope) {
+ if (scope.type === "function-expression-name") {
+ return scope.childScopes[0];
+ }
+ return scope;
+
+ }
+
+ }
+
+ }
+
+ return this.currentScopes[0];
+ }
+
+ /**
+ * Record that a particular variable has been used in code
+ * @param {string} name The name of the variable to mark as used
+ * @returns {boolean} True if the variable was found and marked as used,
+ * false if not.
+ */
+ markVariableAsUsed(name) {
+ const hasGlobalReturn = this.currentConfig.parserOptions.ecmaFeatures && this.currentConfig.parserOptions.ecmaFeatures.globalReturn,
+ specialScope = hasGlobalReturn || this.currentConfig.parserOptions.sourceType === "module";
+ let scope = this.getScope(),
+ i,
+ len;
+
+ // Special Node.js scope means we need to start one level deeper
+ if (scope.type === "global" && specialScope) {
+ scope = scope.childScopes[0];
+ }
+
+ do {
+ const variables = scope.variables;
+
+ for (i = 0, len = variables.length; i < len; i++) {
+ if (variables[i].name === name) {
+ variables[i].eslintUsed = true;
+ return true;
+ }
+ }
+ } while ((scope = scope.upper));
+
+ return false;
+ }
+
+ /**
+ * Gets the filename for the currently parsed source.
+ * @returns {string} The filename associated with the source being parsed.
+ * Defaults to " " if no filename info is present.
+ */
+ getFilename() {
+ if (typeof this.currentFilename === "string") {
+ return this.currentFilename;
+ }
+ return " ";
+
+ }
+
+ /**
+ * Defines a new linting rule.
+ * @param {string} ruleId A unique rule identifier
+ * @param {Function} ruleModule Function from context to object mapping AST node types to event handlers
+ * @returns {void}
+ */
+ defineRule(ruleId, ruleModule) {
+ this.rules.define(ruleId, ruleModule);
+ }
+
+ /**
+ * Defines many new linting rules.
+ * @param {Object} rulesToDefine map from unique rule identifier to rule
+ * @returns {void}
+ */
+ defineRules(rulesToDefine) {
+ Object.getOwnPropertyNames(rulesToDefine).forEach(ruleId => {
+ this.defineRule(ruleId, rulesToDefine[ruleId]);
+ });
+ }
+
+ /**
+ * Gets the default eslint configuration.
+ * @returns {Object} Object mapping rule IDs to their default configurations
+ */
+ defaults() { // eslint-disable-line class-methods-use-this
+ return defaultConfig;
+ }
+
+ /**
+ * Gets an object with all loaded rules.
+ * @returns {Map} All loaded rules
+ */
+ getRules() {
+ return this.rules.getAllLoadedRules();
+ }
+
+ /**
+ * Gets variables that are declared by a specified node.
+ *
+ * The variables are its `defs[].node` or `defs[].parent` is same as the specified node.
+ * Specifically, below:
+ *
+ * - `VariableDeclaration` - variables of its all declarators.
+ * - `VariableDeclarator` - variables.
+ * - `FunctionDeclaration`/`FunctionExpression` - its function name and parameters.
+ * - `ArrowFunctionExpression` - its parameters.
+ * - `ClassDeclaration`/`ClassExpression` - its class name.
+ * - `CatchClause` - variables of its exception.
+ * - `ImportDeclaration` - variables of its all specifiers.
+ * - `ImportSpecifier`/`ImportDefaultSpecifier`/`ImportNamespaceSpecifier` - a variable.
+ * - others - always an empty array.
+ *
+ * @param {ASTNode} node A node to get.
+ * @returns {eslint-scope.Variable[]} Variables that are declared by the node.
+ */
+ getDeclaredVariables(node) {
+ return (this.scopeManager && this.scopeManager.getDeclaredVariables(node)) || [];
+ }
+}
+
+// methods that exist on SourceCode object
+const externalMethods = {
+ getSource: "getText",
+ getSourceLines: "getLines",
+ getAllComments: "getAllComments",
+ getNodeByRangeIndex: "getNodeByRangeIndex",
+ getComments: "getComments",
+ getCommentsBefore: "getCommentsBefore",
+ getCommentsAfter: "getCommentsAfter",
+ getCommentsInside: "getCommentsInside",
+ getJSDocComment: "getJSDocComment",
+ getFirstToken: "getFirstToken",
+ getFirstTokens: "getFirstTokens",
+ getLastToken: "getLastToken",
+ getLastTokens: "getLastTokens",
+ getTokenAfter: "getTokenAfter",
+ getTokenBefore: "getTokenBefore",
+ getTokenByRangeStart: "getTokenByRangeStart",
+ getTokens: "getTokens",
+ getTokensAfter: "getTokensAfter",
+ getTokensBefore: "getTokensBefore",
+ getTokensBetween: "getTokensBetween"
+};
+
+// copy over methods
+Object.keys(externalMethods).forEach(methodName => {
+ const exMethodName = externalMethods[methodName];
+
+ // All functions expected to have less arguments than 5.
+ Linter.prototype[methodName] = function(a, b, c, d, e) {
+ if (this.sourceCode) {
+ return this.sourceCode[exMethodName](a, b, c, d, e);
+ }
+ return null;
+ };
+});
+
+module.exports = Linter;
diff --git a/tools/eslint/lib/load-rules.js b/tools/eslint/lib/load-rules.js
index 92fb7bf20ada0c..b74905d65a50bc 100644
--- a/tools/eslint/lib/load-rules.js
+++ b/tools/eslint/lib/load-rules.js
@@ -12,6 +12,8 @@
const fs = require("fs"),
path = require("path");
+const rulesDirCache = {};
+
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
@@ -29,6 +31,11 @@ module.exports = function(rulesDir, cwd) {
rulesDir = path.resolve(cwd, rulesDir);
}
+ // cache will help performance as IO operation are expensive
+ if (rulesDirCache[rulesDir]) {
+ return rulesDirCache[rulesDir];
+ }
+
const rules = Object.create(null);
fs.readdirSync(rulesDir).forEach(file => {
@@ -37,5 +44,7 @@ module.exports = function(rulesDir, cwd) {
}
rules[file.slice(0, -3)] = path.join(rulesDir, file);
});
+ rulesDirCache[rulesDir] = rules;
+
return rules;
};
diff --git a/tools/eslint/lib/rules.js b/tools/eslint/lib/rules.js
index 9244c96c7a1ab3..893104f650b28f 100644
--- a/tools/eslint/lib/rules.js
+++ b/tools/eslint/lib/rules.js
@@ -11,115 +11,85 @@
const loadRules = require("./load-rules");
-//------------------------------------------------------------------------------
-// Privates
-//------------------------------------------------------------------------------
-
-let rules = Object.create(null);
-
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
-/**
- * Registers a rule module for rule id in storage.
- * @param {string} ruleId Rule id (file name).
- * @param {Function} ruleModule Rule handler.
- * @returns {void}
- */
-function define(ruleId, ruleModule) {
- rules[ruleId] = ruleModule;
-}
+class Rules {
+ constructor() {
+ this._rules = Object.create(null);
-/**
- * Loads and registers all rules from passed rules directory.
- * @param {string} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`.
- * @param {string} cwd Current working directory
- * @returns {void}
- */
-function load(rulesDir, cwd) {
- const newRules = loadRules(rulesDir, cwd);
+ this.load();
+ }
- Object.keys(newRules).forEach(ruleId => {
- define(ruleId, newRules[ruleId]);
- });
-}
+ /**
+ * Registers a rule module for rule id in storage.
+ * @param {string} ruleId Rule id (file name).
+ * @param {Function} ruleModule Rule handler.
+ * @returns {void}
+ */
+ define(ruleId, ruleModule) {
+ this._rules[ruleId] = ruleModule;
+ }
-/**
- * Registers all given rules of a plugin.
- * @param {Object} plugin The plugin object to import.
- * @param {string} pluginName The name of the plugin without prefix (`eslint-plugin-`).
- * @returns {void}
- */
-function importPlugin(plugin, pluginName) {
- if (plugin.rules) {
- Object.keys(plugin.rules).forEach(ruleId => {
- const qualifiedRuleId = `${pluginName}/${ruleId}`,
- rule = plugin.rules[ruleId];
+ /**
+ * Loads and registers all rules from passed rules directory.
+ * @param {string} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`.
+ * @param {string} cwd Current working directory
+ * @returns {void}
+ */
+ load(rulesDir, cwd) {
+ const newRules = loadRules(rulesDir, cwd);
- define(qualifiedRuleId, rule);
+ Object.keys(newRules).forEach(ruleId => {
+ this.define(ruleId, newRules[ruleId]);
});
}
-}
-/**
- * Access rule handler by id (file name).
- * @param {string} ruleId Rule id (file name).
- * @returns {Function} Rule handler.
- */
-function getHandler(ruleId) {
- if (typeof rules[ruleId] === "string") {
- return require(rules[ruleId]);
+ /**
+ * Registers all given rules of a plugin.
+ * @param {Object} plugin The plugin object to import.
+ * @param {string} pluginName The name of the plugin without prefix (`eslint-plugin-`).
+ * @returns {void}
+ */
+ importPlugin(plugin, pluginName) {
+ if (plugin.rules) {
+ Object.keys(plugin.rules).forEach(ruleId => {
+ const qualifiedRuleId = `${pluginName}/${ruleId}`,
+ rule = plugin.rules[ruleId];
+
+ this.define(qualifiedRuleId, rule);
+ });
+ }
}
- return rules[ruleId];
-
-}
-
-/**
- * Get an object with all currently loaded rules
- * @returns {Map} All loaded rules
- */
-function getAllLoadedRules() {
- const allRules = new Map();
-
- Object.keys(rules).forEach(name => {
- const rule = getHandler(name);
-
- allRules.set(name, rule);
- });
- return allRules;
-}
-/**
- * Reset rules storage.
- * Should be used only in tests.
- * @returns {void}
- */
-function testClear() {
- rules = Object.create(null);
-}
+ /**
+ * Access rule handler by id (file name).
+ * @param {string} ruleId Rule id (file name).
+ * @returns {Function} Rule handler.
+ */
+ get(ruleId) {
+ if (typeof this._rules[ruleId] === "string") {
+ return require(this._rules[ruleId]);
+ }
+ return this._rules[ruleId];
-module.exports = {
- define,
- load,
- importPlugin,
- get: getHandler,
- getAllLoadedRules,
- testClear,
+ }
/**
- * Resets rules to its starting state. Use for tests only.
- * @returns {void}
+ * Get an object with all currently loaded rules
+ * @returns {Map} All loaded rules
*/
- testReset() {
- testClear();
- load();
- }
-};
+ getAllLoadedRules() {
+ const allRules = new Map();
-//------------------------------------------------------------------------------
-// Initialization
-//------------------------------------------------------------------------------
+ Object.keys(this._rules).forEach(name => {
+ const rule = this.get(name);
+
+ allRules.set(name, rule);
+ });
+ return allRules;
+ }
+}
-// loads built-in rules
-load();
+module.exports = Rules;
diff --git a/tools/eslint/lib/rules/array-bracket-newline.js b/tools/eslint/lib/rules/array-bracket-newline.js
new file mode 100644
index 00000000000000..319ac60f2cdf96
--- /dev/null
+++ b/tools/eslint/lib/rules/array-bracket-newline.js
@@ -0,0 +1,235 @@
+/**
+ * @fileoverview Rule to enforce linebreaks after open and before close array brackets
+ * @author Jan Peer Stöcklmair
+ */
+
+"use strict";
+
+const astUtils = require("../ast-utils");
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "enforce linebreaks after opening and before closing array brackets",
+ category: "Stylistic Issues",
+ recommended: false
+ },
+ fixable: "whitespace",
+ schema: [
+ {
+ oneOf: [
+ {
+ enum: ["always", "never"]
+ },
+ {
+ type: "object",
+ properties: {
+ multiline: {
+ type: "boolean"
+ },
+ minItems: {
+ type: ["integer", "null"],
+ minimum: 0
+ }
+ },
+ additionalProperties: false
+ }
+ ]
+ }
+ ]
+ },
+
+ create(context) {
+ const sourceCode = context.getSourceCode();
+
+
+ //----------------------------------------------------------------------
+ // Helpers
+ //----------------------------------------------------------------------
+
+ /**
+ * Normalizes a given option value.
+ *
+ * @param {string|Object|undefined} option - An option value to parse.
+ * @returns {{multiline: boolean, minItems: number}} Normalized option object.
+ */
+ function normalizeOptionValue(option) {
+ let multiline = false;
+ let minItems = 0;
+
+ if (option) {
+ if (option === "always" || option.minItems === 0) {
+ minItems = 0;
+ } else if (option === "never") {
+ minItems = Number.POSITIVE_INFINITY;
+ } else {
+ multiline = Boolean(option.multiline);
+ minItems = option.minItems || Number.POSITIVE_INFINITY;
+ }
+ } else {
+ multiline = true;
+ minItems = Number.POSITIVE_INFINITY;
+ }
+
+ return { multiline, minItems };
+ }
+
+ /**
+ * Normalizes a given option value.
+ *
+ * @param {string|Object|undefined} options - An option value to parse.
+ * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object.
+ */
+ function normalizeOptions(options) {
+ const value = normalizeOptionValue(options);
+
+ return { ArrayExpression: value, ArrayPattern: value };
+ }
+
+ /**
+ * Reports that there shouldn't be a linebreak after the first token
+ * @param {ASTNode} node - The node to report in the event of an error.
+ * @param {Token} token - The token to use for the report.
+ * @returns {void}
+ */
+ function reportNoBeginningLinebreak(node, token) {
+ context.report({
+ node,
+ loc: token.loc,
+ message: "There should be no linebreak after '['.",
+ fix(fixer) {
+ const nextToken = sourceCode.getTokenAfter(token, { includeComments: true });
+
+ if (astUtils.isCommentToken(nextToken)) {
+ return null;
+ }
+
+ return fixer.removeRange([token.range[1], nextToken.range[0]]);
+ }
+ });
+ }
+
+ /**
+ * Reports that there shouldn't be a linebreak before the last token
+ * @param {ASTNode} node - The node to report in the event of an error.
+ * @param {Token} token - The token to use for the report.
+ * @returns {void}
+ */
+ function reportNoEndingLinebreak(node, token) {
+ context.report({
+ node,
+ loc: token.loc,
+ message: "There should be no linebreak before ']'.",
+ fix(fixer) {
+ const previousToken = sourceCode.getTokenBefore(token, { includeComments: true });
+
+ if (astUtils.isCommentToken(previousToken)) {
+ return null;
+ }
+
+ return fixer.removeRange([previousToken.range[1], token.range[0]]);
+ }
+ });
+ }
+
+ /**
+ * Reports that there should be a linebreak after the first token
+ * @param {ASTNode} node - The node to report in the event of an error.
+ * @param {Token} token - The token to use for the report.
+ * @returns {void}
+ */
+ function reportRequiredBeginningLinebreak(node, token) {
+ context.report({
+ node,
+ loc: token.loc,
+ message: "A linebreak is required after '['.",
+ fix(fixer) {
+ return fixer.insertTextAfter(token, "\n");
+ }
+ });
+ }
+
+ /**
+ * Reports that there should be a linebreak before the last token
+ * @param {ASTNode} node - The node to report in the event of an error.
+ * @param {Token} token - The token to use for the report.
+ * @returns {void}
+ */
+ function reportRequiredEndingLinebreak(node, token) {
+ context.report({
+ node,
+ loc: token.loc,
+ message: "A linebreak is required before ']'.",
+ fix(fixer) {
+ return fixer.insertTextBefore(token, "\n");
+ }
+ });
+ }
+
+ /**
+ * Reports a given node if it violated this rule.
+ *
+ * @param {ASTNode} node - A node to check. This is an ObjectExpression node or an ObjectPattern node.
+ * @param {{multiline: boolean, minItems: number}} options - An option object.
+ * @returns {void}
+ */
+ function check(node) {
+ const elements = node.elements;
+ const normalizedOptions = normalizeOptions(context.options[0]);
+ const options = normalizedOptions[node.type];
+ const openBracket = sourceCode.getFirstToken(node);
+ const closeBracket = sourceCode.getLastToken(node);
+ const firstIncComment = sourceCode.getTokenAfter(openBracket, { includeComments: true });
+ const lastIncComment = sourceCode.getTokenBefore(closeBracket, { includeComments: true });
+ const first = sourceCode.getTokenAfter(openBracket);
+ const last = sourceCode.getTokenBefore(closeBracket);
+
+ const needsLinebreaks = (
+ elements.length >= options.minItems ||
+ (
+ options.multiline &&
+ elements.length > 0 &&
+ firstIncComment.loc.start.line !== lastIncComment.loc.end.line
+ )
+ );
+
+ /*
+ * Use tokens or comments to check multiline or not.
+ * But use only tokens to check whether linebreaks are needed.
+ * This allows:
+ * var arr = [ // eslint-disable-line foo
+ * 'a'
+ * ]
+ */
+
+ if (needsLinebreaks) {
+ if (astUtils.isTokenOnSameLine(openBracket, first)) {
+ reportRequiredBeginningLinebreak(node, openBracket);
+ }
+ if (astUtils.isTokenOnSameLine(last, closeBracket)) {
+ reportRequiredEndingLinebreak(node, closeBracket);
+ }
+ } else {
+ if (!astUtils.isTokenOnSameLine(openBracket, first)) {
+ reportNoBeginningLinebreak(node, openBracket);
+ }
+ if (!astUtils.isTokenOnSameLine(last, closeBracket)) {
+ reportNoEndingLinebreak(node, closeBracket);
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+
+ return {
+ ArrayPattern: check,
+ ArrayExpression: check
+ };
+ }
+};
diff --git a/tools/eslint/lib/rules/array-element-newline.js b/tools/eslint/lib/rules/array-element-newline.js
new file mode 100644
index 00000000000000..8cccae082e2917
--- /dev/null
+++ b/tools/eslint/lib/rules/array-element-newline.js
@@ -0,0 +1,230 @@
+/**
+ * @fileoverview Rule to enforce line breaks after each array element
+ * @author Jan Peer Stöcklmair
+ */
+
+"use strict";
+
+const astUtils = require("../ast-utils");
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "enforce line breaks after each array element",
+ category: "Stylistic Issues",
+ recommended: false
+ },
+ fixable: "whitespace",
+ schema: [
+ {
+ oneOf: [
+ {
+ enum: ["always", "never"]
+ },
+ {
+ type: "object",
+ properties: {
+ multiline: {
+ type: "boolean"
+ },
+ minItems: {
+ type: ["integer", "null"],
+ minimum: 0
+ }
+ },
+ additionalProperties: false
+ }
+ ]
+ }
+ ]
+ },
+
+ create(context) {
+ const sourceCode = context.getSourceCode();
+
+ //----------------------------------------------------------------------
+ // Helpers
+ //----------------------------------------------------------------------
+
+ /**
+ * Normalizes a given option value.
+ *
+ * @param {string|Object|undefined} option - An option value to parse.
+ * @returns {{multiline: boolean, minItems: number}} Normalized option object.
+ */
+ function normalizeOptionValue(option) {
+ let multiline = false;
+ let minItems;
+
+ option = option || "always";
+
+ if (option === "always" || option.minItems === 0) {
+ minItems = 0;
+ } else if (option === "never") {
+ minItems = Number.POSITIVE_INFINITY;
+ } else {
+ multiline = Boolean(option.multiline);
+ minItems = option.minItems || Number.POSITIVE_INFINITY;
+ }
+
+ return { multiline, minItems };
+ }
+
+ /**
+ * Normalizes a given option value.
+ *
+ * @param {string|Object|undefined} options - An option value to parse.
+ * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object.
+ */
+ function normalizeOptions(options) {
+ const value = normalizeOptionValue(options);
+
+ return { ArrayExpression: value, ArrayPattern: value };
+ }
+
+ /**
+ * Reports that there shouldn't be a line break after the first token
+ * @param {Token} token - The token to use for the report.
+ * @returns {void}
+ */
+ function reportNoLineBreak(token) {
+ const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true });
+
+ context.report({
+ loc: {
+ start: tokenBefore.loc.end,
+ end: token.loc.start
+ },
+ message: "There should be no linebreak here.",
+ fix(fixer) {
+ if (astUtils.isCommentToken(tokenBefore)) {
+ return null;
+ }
+
+ if (!astUtils.isTokenOnSameLine(tokenBefore, token)) {
+ return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " ");
+ }
+
+ /*
+ * This will check if the comma is on the same line as the next element
+ * Following array:
+ * [
+ * 1
+ * , 2
+ * , 3
+ * ]
+ *
+ * will be fixed to:
+ * [
+ * 1, 2, 3
+ * ]
+ */
+ const twoTokensBefore = sourceCode.getTokenBefore(tokenBefore, { includeComments: true });
+
+ if (astUtils.isCommentToken(twoTokensBefore)) {
+ return null;
+ }
+
+ return fixer.replaceTextRange([twoTokensBefore.range[1], tokenBefore.range[0]], "");
+
+ }
+ });
+ }
+
+ /**
+ * Reports that there should be a line break after the first token
+ * @param {Token} token - The token to use for the report.
+ * @returns {void}
+ */
+ function reportRequiredLineBreak(token) {
+ const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true });
+
+ context.report({
+ loc: {
+ start: tokenBefore.loc.end,
+ end: token.loc.start
+ },
+ message: "There should be a linebreak after this element.",
+ fix(fixer) {
+ return fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], "\n");
+ }
+ });
+ }
+
+ /**
+ * Reports a given node if it violated this rule.
+ *
+ * @param {ASTNode} node - A node to check. This is an ObjectExpression node or an ObjectPattern node.
+ * @param {{multiline: boolean, minItems: number}} options - An option object.
+ * @returns {void}
+ */
+ function check(node) {
+ const elements = node.elements;
+ const normalizedOptions = normalizeOptions(context.options[0]);
+ const options = normalizedOptions[node.type];
+
+ let elementBreak = false;
+
+ /*
+ * MULTILINE: true
+ * loop through every element and check
+ * if at least one element has linebreaks inside
+ * this ensures that following is not valid (due to elements are on the same line):
+ *
+ * [
+ * 1,
+ * 2,
+ * 3
+ * ]
+ */
+ if (options.multiline) {
+ elementBreak = elements
+ .filter(element => element !== null)
+ .some(element => element.loc.start.line !== element.loc.end.line);
+ }
+
+ const needsLinebreaks = (
+ elements.length >= options.minItems ||
+ (
+ options.multiline &&
+ elementBreak
+ )
+ );
+
+ elements.forEach((element, i) => {
+ const previousElement = elements[i - 1];
+
+ if (i === 0 || element === null || previousElement === null) {
+ return;
+ }
+
+ const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken);
+ const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken);
+ const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken);
+
+ if (needsLinebreaks) {
+ if (astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) {
+ reportRequiredLineBreak(firstTokenOfCurrentElement);
+ }
+ } else {
+ if (!astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) {
+ reportNoLineBreak(firstTokenOfCurrentElement);
+ }
+ }
+ });
+ }
+
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+
+ return {
+ ArrayPattern: check,
+ ArrayExpression: check
+ };
+ }
+};
diff --git a/tools/eslint/lib/rules/arrow-parens.js b/tools/eslint/lib/rules/arrow-parens.js
index c292d1b492979c..60a043bb31bd4e 100644
--- a/tools/eslint/lib/rules/arrow-parens.js
+++ b/tools/eslint/lib/rules/arrow-parens.js
@@ -50,14 +50,31 @@ module.exports = {
const sourceCode = context.getSourceCode();
-
/**
* Determines whether a arrow function argument end with `)`
* @param {ASTNode} node The arrow function node.
* @returns {void}
*/
function parens(node) {
- const token = sourceCode.getFirstToken(node, node.async ? 1 : 0);
+ const isAsync = node.async;
+ const firstTokenOfParam = sourceCode.getFirstToken(node, isAsync ? 1 : 0);
+
+ /**
+ * Remove the parenthesis around a parameter
+ * @param {Fixer} fixer Fixer
+ * @returns {string} fixed parameter
+ */
+ function fixParamsWithParenthesis(fixer) {
+ const paramToken = sourceCode.getTokenAfter(firstTokenOfParam);
+ const closingParenToken = sourceCode.getTokenAfter(paramToken);
+ const asyncToken = isAsync ? sourceCode.getTokenBefore(firstTokenOfParam) : null;
+ const shouldAddSpaceForAsync = asyncToken && (asyncToken.end === firstTokenOfParam.start);
+
+ return fixer.replaceTextRange([
+ firstTokenOfParam.range[0],
+ closingParenToken.range[1]
+ ], `${shouldAddSpaceForAsync ? " " : ""}${paramToken.value}`);
+ }
// "as-needed", { "requireForBlockBody": true }: x => x
if (
@@ -68,19 +85,11 @@ module.exports = {
node.body.type !== "BlockStatement" &&
!node.returnType
) {
- if (astUtils.isOpeningParenToken(token)) {
+ if (astUtils.isOpeningParenToken(firstTokenOfParam)) {
context.report({
node,
message: requireForBlockBodyMessage,
- fix(fixer) {
- const paramToken = context.getTokenAfter(token);
- const closingParenToken = context.getTokenAfter(paramToken);
-
- return fixer.replaceTextRange([
- token.range[0],
- closingParenToken.range[1]
- ], paramToken.value);
- }
+ fix: fixParamsWithParenthesis
});
}
return;
@@ -90,12 +99,12 @@ module.exports = {
requireForBlockBody &&
node.body.type === "BlockStatement"
) {
- if (!astUtils.isOpeningParenToken(token)) {
+ if (!astUtils.isOpeningParenToken(firstTokenOfParam)) {
context.report({
node,
message: requireForBlockBodyNoParensMessage,
fix(fixer) {
- return fixer.replaceText(token, `(${token.value})`);
+ return fixer.replaceText(firstTokenOfParam, `(${firstTokenOfParam.value})`);
}
});
}
@@ -109,26 +118,18 @@ module.exports = {
!node.params[0].typeAnnotation &&
!node.returnType
) {
- if (astUtils.isOpeningParenToken(token)) {
+ if (astUtils.isOpeningParenToken(firstTokenOfParam)) {
context.report({
node,
message: asNeededMessage,
- fix(fixer) {
- const paramToken = context.getTokenAfter(token);
- const closingParenToken = context.getTokenAfter(paramToken);
-
- return fixer.replaceTextRange([
- token.range[0],
- closingParenToken.range[1]
- ], paramToken.value);
- }
+ fix: fixParamsWithParenthesis
});
}
return;
}
- if (token.type === "Identifier") {
- const after = sourceCode.getTokenAfter(token);
+ if (firstTokenOfParam.type === "Identifier") {
+ const after = sourceCode.getTokenAfter(firstTokenOfParam);
// (x) => x
if (after.value !== ")") {
@@ -136,7 +137,7 @@ module.exports = {
node,
message,
fix(fixer) {
- return fixer.replaceText(token, `(${token.value})`);
+ return fixer.replaceText(firstTokenOfParam, `(${firstTokenOfParam.value})`);
}
});
}
diff --git a/tools/eslint/lib/rules/block-scoped-var.js b/tools/eslint/lib/rules/block-scoped-var.js
index bb0931a3ceb63f..0b4d855fae5024 100644
--- a/tools/eslint/lib/rules/block-scoped-var.js
+++ b/tools/eslint/lib/rules/block-scoped-var.js
@@ -41,7 +41,7 @@ module.exports = {
/**
* Reports a given reference.
- * @param {escope.Reference} reference - A reference to report.
+ * @param {eslint-scope.Reference} reference - A reference to report.
* @returns {void}
*/
function report(reference) {
diff --git a/tools/eslint/lib/rules/brace-style.js b/tools/eslint/lib/rules/brace-style.js
index bb4433cc45cc36..44bd6d2c80b6f2 100644
--- a/tools/eslint/lib/rules/brace-style.js
+++ b/tools/eslint/lib/rules/brace-style.js
@@ -62,10 +62,12 @@ module.exports = {
function removeNewlineBetween(firstToken, secondToken) {
const textRange = [firstToken.range[1], secondToken.range[0]];
const textBetween = sourceCode.text.slice(textRange[0], textRange[1]);
- const NEWLINE_REGEX = astUtils.createGlobalLinebreakMatcher();
// Don't do a fix if there is a comment between the tokens
- return fixer => fixer.replaceTextRange(textRange, textBetween.trim() ? null : textBetween.replace(NEWLINE_REGEX, ""));
+ if (textBetween.trim()) {
+ return null;
+ }
+ return fixer => fixer.replaceTextRange(textRange, " ");
}
/**
diff --git a/tools/eslint/lib/rules/capitalized-comments.js b/tools/eslint/lib/rules/capitalized-comments.js
index b8d5b8cd612d1e..bb5e5825a36e2b 100644
--- a/tools/eslint/lib/rules/capitalized-comments.js
+++ b/tools/eslint/lib/rules/capitalized-comments.js
@@ -19,7 +19,7 @@ const ALWAYS_MESSAGE = "Comments should not begin with a lowercase character",
NEVER_MESSAGE = "Comments should not begin with an uppercase character",
DEFAULT_IGNORE_PATTERN = astUtils.COMMENTS_IGNORE_PATTERN,
WHITESPACE = /\s/g,
- MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/, // TODO: Combine w/ max-len pattern?
+ MAYBE_URL = /^\s*[^:/?#\s]+:\/\/[^?#]/, // TODO: Combine w/ max-len pattern?
DEFAULTS = {
ignorePattern: null,
ignoreInlineComments: false,
@@ -270,7 +270,7 @@ module.exports = {
: NEVER_MESSAGE;
context.report({
- node: null, // Intentionally using loc instead
+ node: null, // Intentionally using loc instead
loc: comment.loc,
message,
fix(fixer) {
@@ -295,7 +295,7 @@ module.exports = {
Program() {
const comments = sourceCode.getAllComments();
- comments.forEach(processComment);
+ comments.filter(token => token.type !== "Shebang").forEach(processComment);
}
};
}
diff --git a/tools/eslint/lib/rules/comma-spacing.js b/tools/eslint/lib/rules/comma-spacing.js
index bb1dd68f63987e..25a0e7d82c8abe 100644
--- a/tools/eslint/lib/rules/comma-spacing.js
+++ b/tools/eslint/lib/rules/comma-spacing.js
@@ -87,8 +87,8 @@ module.exports = {
},
message: options[dir]
- ? "A space is required {{dir}} ','."
- : "There should be no space {{dir}} ','.",
+ ? "A space is required {{dir}} ','."
+ : "There should be no space {{dir}} ','.",
data: {
dir
}
diff --git a/tools/eslint/lib/rules/comma-style.js b/tools/eslint/lib/rules/comma-style.js
index fcaecc662bce8c..1a9382bea35b9d 100644
--- a/tools/eslint/lib/rules/comma-style.js
+++ b/tools/eslint/lib/rules/comma-style.js
@@ -202,7 +202,7 @@ module.exports = {
*/
if (astUtils.isCommaToken(commaToken)) {
validateCommaItemSpacing(previousItemToken, commaToken,
- currentItemToken, reportItem);
+ currentItemToken, reportItem);
}
if (item) {
diff --git a/tools/eslint/lib/rules/complexity.js b/tools/eslint/lib/rules/complexity.js
index 14617bc3537aef..e0313fa78f17c3 100644
--- a/tools/eslint/lib/rules/complexity.js
+++ b/tools/eslint/lib/rules/complexity.js
@@ -122,7 +122,7 @@ module.exports = {
// Avoiding `default`
if (node.test) {
- increaseComplexity(node);
+ increaseComplexity();
}
}
@@ -136,7 +136,7 @@ module.exports = {
// Avoiding &&
if (node.operator === "||") {
- increaseComplexity(node);
+ increaseComplexity();
}
}
diff --git a/tools/eslint/lib/rules/curly.js b/tools/eslint/lib/rules/curly.js
index cd15b2d93574df..e3cccc1f656fc3 100644
--- a/tools/eslint/lib/rules/curly.js
+++ b/tools/eslint/lib/rules/curly.js
@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
const astUtils = require("../ast-utils");
-const esUtils = require("esutils");
//------------------------------------------------------------------------------
// Rule Definition
@@ -240,7 +239,7 @@ module.exports = {
// e.g. `do{foo()} while (bar)` should be corrected to `do foo() while (bar)`
const needsPrecedingSpace = node.type === "DoWhileStatement" &&
sourceCode.getTokenBefore(bodyNode).end === bodyNode.start &&
- esUtils.code.isIdentifierPartES6(sourceCode.getText(bodyNode).charCodeAt(1));
+ !astUtils.canTokensBeAdjacent("do", sourceCode.getFirstToken(bodyNode, { skip: 1 }));
const openingBracket = sourceCode.getFirstToken(bodyNode);
const closingBracket = sourceCode.getLastToken(bodyNode);
@@ -294,7 +293,7 @@ module.exports = {
}
} else if (multiOrNest) {
if (hasBlock && body.body.length === 1 && isOneLiner(body.body[0])) {
- const leadingComments = sourceCode.getComments(body.body[0]).leading;
+ const leadingComments = sourceCode.getCommentsBefore(body.body[0]);
expected = leadingComments.length > 0;
} else if (!isOneLiner(body)) {
diff --git a/tools/eslint/lib/rules/default-case.js b/tools/eslint/lib/rules/default-case.js
index 3efcbbced5dcab..32cd8dfe4922d0 100644
--- a/tools/eslint/lib/rules/default-case.js
+++ b/tools/eslint/lib/rules/default-case.js
@@ -74,7 +74,7 @@ module.exports = {
let comment;
const lastCase = last(node.cases);
- const comments = sourceCode.getComments(lastCase).trailing;
+ const comments = sourceCode.getCommentsAfter(lastCase);
if (comments.length) {
comment = last(comments);
diff --git a/tools/eslint/lib/rules/dot-notation.js b/tools/eslint/lib/rules/dot-notation.js
index abb9b4b4881b34..55225b8cc41908 100644
--- a/tools/eslint/lib/rules/dot-notation.js
+++ b/tools/eslint/lib/rules/dot-notation.js
@@ -79,11 +79,17 @@ module.exports = {
return null;
}
+ const tokenAfterProperty = sourceCode.getTokenAfter(rightBracket);
+ const needsSpaceAfterProperty = tokenAfterProperty &&
+ rightBracket.range[1] === tokenAfterProperty.range[0] &&
+ !astUtils.canTokensBeAdjacent(String(node.property.value), tokenAfterProperty);
+
const textBeforeDot = astUtils.isDecimalInteger(node.object) ? " " : "";
+ const textAfterProperty = needsSpaceAfterProperty ? " " : "";
return fixer.replaceTextRange(
[leftBracket.range[0], rightBracket.range[1]],
- `${textBeforeDot}.${node.property.value}`
+ `${textBeforeDot}.${node.property.value}${textAfterProperty}`
);
}
});
diff --git a/tools/eslint/lib/rules/for-direction.js b/tools/eslint/lib/rules/for-direction.js
new file mode 100644
index 00000000000000..7178ced9db0a4b
--- /dev/null
+++ b/tools/eslint/lib/rules/for-direction.js
@@ -0,0 +1,105 @@
+/**
+ * @fileoverview enforce "for" loop update clause moving the counter in the right direction.(for-direction)
+ * @author Aladdin-ADD
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "enforce \"for\" loop update clause moving the counter in the right direction.",
+ category: "Possible Errors",
+ recommended: false
+ },
+ fixable: null,
+ schema: []
+ },
+
+ create(context) {
+
+ /**
+ * report an error.
+ * @param {ASTNode} node the node to report.
+ * @returns {void}
+ */
+ function report(node) {
+ context.report({
+ node,
+ message: "The update clause in this loop moves the variable in the wrong direction."
+ });
+ }
+
+ /**
+ * check UpdateExpression add/sub the counter
+ * @param {ASTNode} update UpdateExpression to check
+ * @param {string} counter variable name to check
+ * @returns {int} if add return 1, if sub return -1, if nochange, return 0
+ */
+ function getUpdateDirection(update, counter) {
+ if (update.argument.type === "Identifier" && update.argument.name === counter) {
+ if (update.operator === "++") {
+ return 1;
+ }
+ if (update.operator === "--") {
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * check AssignmentExpression add/sub the counter
+ * @param {ASTNode} update AssignmentExpression to check
+ * @param {string} counter variable name to check
+ * @returns {int} if add return 1, if sub return -1, if nochange, return 0
+ */
+ function getAssignmentDirection(update, counter) {
+ if (update.left.name === counter) {
+ if (update.operator === "+=") {
+ return 1;
+ }
+ if (update.operator === "-=") {
+ return -1;
+ }
+ }
+ return 0;
+ }
+ return {
+ ForStatement(node) {
+
+ if (node.test && node.test.type === "BinaryExpression" && node.test.left.type === "Identifier" && node.update) {
+ const counter = node.test.left.name;
+ const operator = node.test.operator;
+ const update = node.update;
+
+ if (operator === "<" || operator === "<=") {
+
+ // report error if update sub the counter (--, -=)
+ if (update.type === "UpdateExpression" && getUpdateDirection(update, counter) < 0) {
+ report(node);
+ }
+
+ if (update.type === "AssignmentExpression" && getAssignmentDirection(update, counter) < 0) {
+ report(node);
+ }
+ } else if (operator === ">" || operator === ">=") {
+
+ // report error if update add the counter (++, +=)
+ if (update.type === "UpdateExpression" && getUpdateDirection(update, counter) > 0) {
+ report(node);
+ }
+
+ if (update.type === "AssignmentExpression" && getAssignmentDirection(update, counter) > 0) {
+ report(node);
+ }
+ }
+ }
+ }
+ };
+ }
+};
diff --git a/tools/eslint/lib/rules/func-names.js b/tools/eslint/lib/rules/func-names.js
index e7f950c9ba593d..848ce9757413ea 100644
--- a/tools/eslint/lib/rules/func-names.js
+++ b/tools/eslint/lib/rules/func-names.js
@@ -13,7 +13,7 @@ const astUtils = require("../ast-utils");
/**
* Checks whether or not a given variable is a function name.
- * @param {escope.Variable} variable - A variable to check.
+ * @param {eslint-scope.Variable} variable - A variable to check.
* @returns {boolean} `true` if the variable is a function name.
*/
function isFunctionName(variable) {
diff --git a/tools/eslint/lib/rules/global-require.js b/tools/eslint/lib/rules/global-require.js
index 367fe590ed2210..beda8d99f1b033 100644
--- a/tools/eslint/lib/rules/global-require.js
+++ b/tools/eslint/lib/rules/global-require.js
@@ -17,7 +17,7 @@ const ACCEPTABLE_PARENTS = [
];
/**
- * Finds the escope reference in the given scope.
+ * Finds the eslint-scope reference in the given scope.
* @param {Object} scope The scope to search.
* @param {ASTNode} node The identifier node.
* @returns {Reference|null} Returns the found reference or null if none were found.
diff --git a/tools/eslint/lib/rules/id-length.js b/tools/eslint/lib/rules/id-length.js
index 341f929cdec27e..dad9c406493399 100644
--- a/tools/eslint/lib/rules/id-length.js
+++ b/tools/eslint/lib/rules/id-length.js
@@ -96,7 +96,7 @@ module.exports = {
const isLong = name.length > maxLength;
if (!(isShort || isLong) || exceptions[name]) {
- return; // Nothing to report
+ return; // Nothing to report
}
const isValidExpression = SUPPORTED_EXPRESSIONS[parent.type];
diff --git a/tools/eslint/lib/rules/indent-legacy.js b/tools/eslint/lib/rules/indent-legacy.js
new file mode 100644
index 00000000000000..f686c18ee3f9e5
--- /dev/null
+++ b/tools/eslint/lib/rules/indent-legacy.js
@@ -0,0 +1,1125 @@
+/**
+ * @fileoverview This option sets a specific tab width for your code
+ *
+ * This rule has been ported and modified from nodeca.
+ * @author Vitaly Puzrin
+ * @author Gyandeep Singh
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("../ast-utils");
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+/* istanbul ignore next: this rule has known coverage issues, but it's deprecated and shouldn't be updated in the future anyway. */
+module.exports = {
+ meta: {
+ docs: {
+ description: "enforce consistent indentation",
+ category: "Stylistic Issues",
+ recommended: false,
+ replacedBy: ["indent"]
+ },
+
+ deprecated: true,
+
+ fixable: "whitespace",
+
+ schema: [
+ {
+ oneOf: [
+ {
+ enum: ["tab"]
+ },
+ {
+ type: "integer",
+ minimum: 0
+ }
+ ]
+ },
+ {
+ type: "object",
+ properties: {
+ SwitchCase: {
+ type: "integer",
+ minimum: 0
+ },
+ VariableDeclarator: {
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ type: "object",
+ properties: {
+ var: {
+ type: "integer",
+ minimum: 0
+ },
+ let: {
+ type: "integer",
+ minimum: 0
+ },
+ const: {
+ type: "integer",
+ minimum: 0
+ }
+ }
+ }
+ ]
+ },
+ outerIIFEBody: {
+ type: "integer",
+ minimum: 0
+ },
+ MemberExpression: {
+ type: "integer",
+ minimum: 0
+ },
+ FunctionDeclaration: {
+ type: "object",
+ properties: {
+ parameters: {
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ enum: ["first"]
+ }
+ ]
+ },
+ body: {
+ type: "integer",
+ minimum: 0
+ }
+ }
+ },
+ FunctionExpression: {
+ type: "object",
+ properties: {
+ parameters: {
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ enum: ["first"]
+ }
+ ]
+ },
+ body: {
+ type: "integer",
+ minimum: 0
+ }
+ }
+ },
+ CallExpression: {
+ type: "object",
+ properties: {
+ parameters: {
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ enum: ["first"]
+ }
+ ]
+ }
+ }
+ },
+ ArrayExpression: {
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ enum: ["first"]
+ }
+ ]
+ },
+ ObjectExpression: {
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ enum: ["first"]
+ }
+ ]
+ }
+ },
+ additionalProperties: false
+ }
+ ]
+ },
+
+ create(context) {
+ const DEFAULT_VARIABLE_INDENT = 1;
+ const DEFAULT_PARAMETER_INDENT = null; // For backwards compatibility, don't check parameter indentation unless specified in the config
+ const DEFAULT_FUNCTION_BODY_INDENT = 1;
+
+ let indentType = "space";
+ let indentSize = 4;
+ const options = {
+ SwitchCase: 0,
+ VariableDeclarator: {
+ var: DEFAULT_VARIABLE_INDENT,
+ let: DEFAULT_VARIABLE_INDENT,
+ const: DEFAULT_VARIABLE_INDENT
+ },
+ outerIIFEBody: null,
+ FunctionDeclaration: {
+ parameters: DEFAULT_PARAMETER_INDENT,
+ body: DEFAULT_FUNCTION_BODY_INDENT
+ },
+ FunctionExpression: {
+ parameters: DEFAULT_PARAMETER_INDENT,
+ body: DEFAULT_FUNCTION_BODY_INDENT
+ },
+ CallExpression: {
+ arguments: DEFAULT_PARAMETER_INDENT
+ },
+ ArrayExpression: 1,
+ ObjectExpression: 1
+ };
+
+ const sourceCode = context.getSourceCode();
+
+ if (context.options.length) {
+ if (context.options[0] === "tab") {
+ indentSize = 1;
+ indentType = "tab";
+ } else /* istanbul ignore else : this will be caught by options validation */ if (typeof context.options[0] === "number") {
+ indentSize = context.options[0];
+ indentType = "space";
+ }
+
+ if (context.options[1]) {
+ const opts = context.options[1];
+
+ options.SwitchCase = opts.SwitchCase || 0;
+ const variableDeclaratorRules = opts.VariableDeclarator;
+
+ if (typeof variableDeclaratorRules === "number") {
+ options.VariableDeclarator = {
+ var: variableDeclaratorRules,
+ let: variableDeclaratorRules,
+ const: variableDeclaratorRules
+ };
+ } else if (typeof variableDeclaratorRules === "object") {
+ Object.assign(options.VariableDeclarator, variableDeclaratorRules);
+ }
+
+ if (typeof opts.outerIIFEBody === "number") {
+ options.outerIIFEBody = opts.outerIIFEBody;
+ }
+
+ if (typeof opts.MemberExpression === "number") {
+ options.MemberExpression = opts.MemberExpression;
+ }
+
+ if (typeof opts.FunctionDeclaration === "object") {
+ Object.assign(options.FunctionDeclaration, opts.FunctionDeclaration);
+ }
+
+ if (typeof opts.FunctionExpression === "object") {
+ Object.assign(options.FunctionExpression, opts.FunctionExpression);
+ }
+
+ if (typeof opts.CallExpression === "object") {
+ Object.assign(options.CallExpression, opts.CallExpression);
+ }
+
+ if (typeof opts.ArrayExpression === "number" || typeof opts.ArrayExpression === "string") {
+ options.ArrayExpression = opts.ArrayExpression;
+ }
+
+ if (typeof opts.ObjectExpression === "number" || typeof opts.ObjectExpression === "string") {
+ options.ObjectExpression = opts.ObjectExpression;
+ }
+ }
+ }
+
+ const caseIndentStore = {};
+
+ /**
+ * Creates an error message for a line, given the expected/actual indentation.
+ * @param {int} expectedAmount The expected amount of indentation characters for this line
+ * @param {int} actualSpaces The actual number of indentation spaces that were found on this line
+ * @param {int} actualTabs The actual number of indentation tabs that were found on this line
+ * @returns {string} An error message for this line
+ */
+ function createErrorMessage(expectedAmount, actualSpaces, actualTabs) {
+ const expectedStatement = `${expectedAmount} ${indentType}${expectedAmount === 1 ? "" : "s"}`; // e.g. "2 tabs"
+ const foundSpacesWord = `space${actualSpaces === 1 ? "" : "s"}`; // e.g. "space"
+ const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs"
+ let foundStatement;
+
+ if (actualSpaces > 0 && actualTabs > 0) {
+ foundStatement = `${actualSpaces} ${foundSpacesWord} and ${actualTabs} ${foundTabsWord}`; // e.g. "1 space and 2 tabs"
+ } else if (actualSpaces > 0) {
+
+ // Abbreviate the message if the expected indentation is also spaces.
+ // e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces'
+ foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`;
+ } else if (actualTabs > 0) {
+ foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`;
+ } else {
+ foundStatement = "0";
+ }
+
+ return `Expected indentation of ${expectedStatement} but found ${foundStatement}.`;
+ }
+
+ /**
+ * Reports a given indent violation
+ * @param {ASTNode} node Node violating the indent rule
+ * @param {int} needed Expected indentation character count
+ * @param {int} gottenSpaces Indentation space count in the actual node/code
+ * @param {int} gottenTabs Indentation tab count in the actual node/code
+ * @param {Object=} loc Error line and column location
+ * @param {boolean} isLastNodeCheck Is the error for last node check
+ * @param {int} lastNodeCheckEndOffset Number of charecters to skip from the end
+ * @returns {void}
+ */
+ function report(node, needed, gottenSpaces, gottenTabs, loc, isLastNodeCheck) {
+ if (gottenSpaces && gottenTabs) {
+
+ // To avoid conflicts with `no-mixed-spaces-and-tabs`, don't report lines that have both spaces and tabs.
+ return;
+ }
+
+ const desiredIndent = (indentType === "space" ? " " : "\t").repeat(needed);
+
+ const textRange = isLastNodeCheck
+ ? [node.range[1] - node.loc.end.column, node.range[1] - node.loc.end.column + gottenSpaces + gottenTabs]
+ : [node.range[0] - node.loc.start.column, node.range[0] - node.loc.start.column + gottenSpaces + gottenTabs];
+
+ context.report({
+ node,
+ loc,
+ message: createErrorMessage(needed, gottenSpaces, gottenTabs),
+ fix: fixer => fixer.replaceTextRange(textRange, desiredIndent)
+ });
+ }
+
+ /**
+ * Get the actual indent of node
+ * @param {ASTNode|Token} node Node to examine
+ * @param {boolean} [byLastLine=false] get indent of node's last line
+ * @returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also
+ contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and
+ `badChar` is the amount of the other indentation character.
+ */
+ function getNodeIndent(node, byLastLine) {
+ const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node);
+ const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split("");
+ const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t"));
+ const spaces = indentChars.filter(char => char === " ").length;
+ const tabs = indentChars.filter(char => char === "\t").length;
+
+ return {
+ space: spaces,
+ tab: tabs,
+ goodChar: indentType === "space" ? spaces : tabs,
+ badChar: indentType === "space" ? tabs : spaces
+ };
+ }
+
+ /**
+ * Checks node is the first in its own start line. By default it looks by start line.
+ * @param {ASTNode} node The node to check
+ * @param {boolean} [byEndLocation=false] Lookup based on start position or end
+ * @returns {boolean} true if its the first in the its start line
+ */
+ function isNodeFirstInLine(node, byEndLocation) {
+ const firstToken = byEndLocation === true ? sourceCode.getLastToken(node, 1) : sourceCode.getTokenBefore(node),
+ startLine = byEndLocation === true ? node.loc.end.line : node.loc.start.line,
+ endLine = firstToken ? firstToken.loc.end.line : -1;
+
+ return startLine !== endLine;
+ }
+
+ /**
+ * Check indent for node
+ * @param {ASTNode} node Node to check
+ * @param {int} neededIndent needed indent
+ * @param {boolean} [excludeCommas=false] skip comma on start of line
+ * @returns {void}
+ */
+ function checkNodeIndent(node, neededIndent) {
+ const actualIndent = getNodeIndent(node, false);
+
+ if (
+ node.type !== "ArrayExpression" &&
+ node.type !== "ObjectExpression" &&
+ (actualIndent.goodChar !== neededIndent || actualIndent.badChar !== 0) &&
+ isNodeFirstInLine(node)
+ ) {
+ report(node, neededIndent, actualIndent.space, actualIndent.tab);
+ }
+
+ if (node.type === "IfStatement" && node.alternate) {
+ const elseToken = sourceCode.getTokenBefore(node.alternate);
+
+ checkNodeIndent(elseToken, neededIndent);
+
+ if (!isNodeFirstInLine(node.alternate)) {
+ checkNodeIndent(node.alternate, neededIndent);
+ }
+ }
+
+ if (node.type === "TryStatement" && node.handler) {
+ const catchToken = sourceCode.getFirstToken(node.handler);
+
+ checkNodeIndent(catchToken, neededIndent);
+ }
+
+ if (node.type === "TryStatement" && node.finalizer) {
+ const finallyToken = sourceCode.getTokenBefore(node.finalizer);
+
+ checkNodeIndent(finallyToken, neededIndent);
+ }
+
+ if (node.type === "DoWhileStatement") {
+ const whileToken = sourceCode.getTokenAfter(node.body);
+
+ checkNodeIndent(whileToken, neededIndent);
+ }
+ }
+
+ /**
+ * Check indent for nodes list
+ * @param {ASTNode[]} nodes list of node objects
+ * @param {int} indent needed indent
+ * @param {boolean} [excludeCommas=false] skip comma on start of line
+ * @returns {void}
+ */
+ function checkNodesIndent(nodes, indent) {
+ nodes.forEach(node => checkNodeIndent(node, indent));
+ }
+
+ /**
+ * Check last node line indent this detects, that block closed correctly
+ * @param {ASTNode} node Node to examine
+ * @param {int} lastLineIndent needed indent
+ * @returns {void}
+ */
+ function checkLastNodeLineIndent(node, lastLineIndent) {
+ const lastToken = sourceCode.getLastToken(node);
+ const endIndent = getNodeIndent(lastToken, true);
+
+ if ((endIndent.goodChar !== lastLineIndent || endIndent.badChar !== 0) && isNodeFirstInLine(node, true)) {
+ report(
+ node,
+ lastLineIndent,
+ endIndent.space,
+ endIndent.tab,
+ { line: lastToken.loc.start.line, column: lastToken.loc.start.column },
+ true
+ );
+ }
+ }
+
+ /**
+ * Check last node line indent this detects, that block closed correctly
+ * This function for more complicated return statement case, where closing parenthesis may be followed by ';'
+ * @param {ASTNode} node Node to examine
+ * @param {int} firstLineIndent first line needed indent
+ * @returns {void}
+ */
+ function checkLastReturnStatementLineIndent(node, firstLineIndent) {
+
+ // in case if return statement ends with ');' we have traverse back to ')'
+ // otherwise we'll measure indent for ';' and replace ')'
+ const lastToken = sourceCode.getLastToken(node, astUtils.isClosingParenToken);
+ const textBeforeClosingParenthesis = sourceCode.getText(lastToken, lastToken.loc.start.column).slice(0, -1);
+
+ if (textBeforeClosingParenthesis.trim()) {
+
+ // There are tokens before the closing paren, don't report this case
+ return;
+ }
+
+ const endIndent = getNodeIndent(lastToken, true);
+
+ if (endIndent.goodChar !== firstLineIndent) {
+ report(
+ node,
+ firstLineIndent,
+ endIndent.space,
+ endIndent.tab,
+ { line: lastToken.loc.start.line, column: lastToken.loc.start.column },
+ true
+ );
+ }
+ }
+
+ /**
+ * Check first node line indent is correct
+ * @param {ASTNode} node Node to examine
+ * @param {int} firstLineIndent needed indent
+ * @returns {void}
+ */
+ function checkFirstNodeLineIndent(node, firstLineIndent) {
+ const startIndent = getNodeIndent(node, false);
+
+ if ((startIndent.goodChar !== firstLineIndent || startIndent.badChar !== 0) && isNodeFirstInLine(node)) {
+ report(
+ node,
+ firstLineIndent,
+ startIndent.space,
+ startIndent.tab,
+ { line: node.loc.start.line, column: node.loc.start.column }
+ );
+ }
+ }
+
+ /**
+ * Returns a parent node of given node based on a specified type
+ * if not present then return null
+ * @param {ASTNode} node node to examine
+ * @param {string} type type that is being looked for
+ * @param {string} stopAtList end points for the evaluating code
+ * @returns {ASTNode|void} if found then node otherwise null
+ */
+ function getParentNodeByType(node, type, stopAtList) {
+ let parent = node.parent;
+
+ if (!stopAtList) {
+ stopAtList = ["Program"];
+ }
+
+ while (parent.type !== type && stopAtList.indexOf(parent.type) === -1 && parent.type !== "Program") {
+ parent = parent.parent;
+ }
+
+ return parent.type === type ? parent : null;
+ }
+
+ /**
+ * Returns the VariableDeclarator based on the current node
+ * if not present then return null
+ * @param {ASTNode} node node to examine
+ * @returns {ASTNode|void} if found then node otherwise null
+ */
+ function getVariableDeclaratorNode(node) {
+ return getParentNodeByType(node, "VariableDeclarator");
+ }
+
+ /**
+ * Check to see if the node is part of the multi-line variable declaration.
+ * Also if its on the same line as the varNode
+ * @param {ASTNode} node node to check
+ * @param {ASTNode} varNode variable declaration node to check against
+ * @returns {boolean} True if all the above condition satisfy
+ */
+ function isNodeInVarOnTop(node, varNode) {
+ return varNode &&
+ varNode.parent.loc.start.line === node.loc.start.line &&
+ varNode.parent.declarations.length > 1;
+ }
+
+ /**
+ * Check to see if the argument before the callee node is multi-line and
+ * there should only be 1 argument before the callee node
+ * @param {ASTNode} node node to check
+ * @returns {boolean} True if arguments are multi-line
+ */
+ function isArgBeforeCalleeNodeMultiline(node) {
+ const parent = node.parent;
+
+ if (parent.arguments.length >= 2 && parent.arguments[1] === node) {
+ return parent.arguments[0].loc.end.line > parent.arguments[0].loc.start.line;
+ }
+
+ return false;
+ }
+
+ /**
+ * Check to see if the node is a file level IIFE
+ * @param {ASTNode} node The function node to check.
+ * @returns {boolean} True if the node is the outer IIFE
+ */
+ function isOuterIIFE(node) {
+ const parent = node.parent;
+ let stmt = parent.parent;
+
+ /*
+ * Verify that the node is an IIEF
+ */
+ if (
+ parent.type !== "CallExpression" ||
+ parent.callee !== node) {
+
+ return false;
+ }
+
+ /*
+ * Navigate legal ancestors to determine whether this IIEF is outer
+ */
+ while (
+ stmt.type === "UnaryExpression" && (
+ stmt.operator === "!" ||
+ stmt.operator === "~" ||
+ stmt.operator === "+" ||
+ stmt.operator === "-") ||
+ stmt.type === "AssignmentExpression" ||
+ stmt.type === "LogicalExpression" ||
+ stmt.type === "SequenceExpression" ||
+ stmt.type === "VariableDeclarator") {
+
+ stmt = stmt.parent;
+ }
+
+ return ((
+ stmt.type === "ExpressionStatement" ||
+ stmt.type === "VariableDeclaration") &&
+ stmt.parent && stmt.parent.type === "Program"
+ );
+ }
+
+ /**
+ * Check indent for function block content
+ * @param {ASTNode} node A BlockStatement node that is inside of a function.
+ * @returns {void}
+ */
+ function checkIndentInFunctionBlock(node) {
+
+ /*
+ * Search first caller in chain.
+ * Ex.:
+ *
+ * Models <- Identifier
+ * .User
+ * .find()
+ * .exec(function() {
+ * // function body
+ * });
+ *
+ * Looks for 'Models'
+ */
+ const calleeNode = node.parent; // FunctionExpression
+ let indent;
+
+ if (calleeNode.parent &&
+ (calleeNode.parent.type === "Property" ||
+ calleeNode.parent.type === "ArrayExpression")) {
+
+ // If function is part of array or object, comma can be put at left
+ indent = getNodeIndent(calleeNode, false).goodChar;
+ } else {
+
+ // If function is standalone, simple calculate indent
+ indent = getNodeIndent(calleeNode).goodChar;
+ }
+
+ if (calleeNode.parent.type === "CallExpression") {
+ const calleeParent = calleeNode.parent;
+
+ if (calleeNode.type !== "FunctionExpression" && calleeNode.type !== "ArrowFunctionExpression") {
+ if (calleeParent && calleeParent.loc.start.line < node.loc.start.line) {
+ indent = getNodeIndent(calleeParent).goodChar;
+ }
+ } else {
+ if (isArgBeforeCalleeNodeMultiline(calleeNode) &&
+ calleeParent.callee.loc.start.line === calleeParent.callee.loc.end.line &&
+ !isNodeFirstInLine(calleeNode)) {
+ indent = getNodeIndent(calleeParent).goodChar;
+ }
+ }
+ }
+
+ // function body indent should be indent + indent size, unless this
+ // is a FunctionDeclaration, FunctionExpression, or outer IIFE and the corresponding options are enabled.
+ let functionOffset = indentSize;
+
+ if (options.outerIIFEBody !== null && isOuterIIFE(calleeNode)) {
+ functionOffset = options.outerIIFEBody * indentSize;
+ } else if (calleeNode.type === "FunctionExpression") {
+ functionOffset = options.FunctionExpression.body * indentSize;
+ } else if (calleeNode.type === "FunctionDeclaration") {
+ functionOffset = options.FunctionDeclaration.body * indentSize;
+ }
+ indent += functionOffset;
+
+ // check if the node is inside a variable
+ const parentVarNode = getVariableDeclaratorNode(node);
+
+ if (parentVarNode && isNodeInVarOnTop(node, parentVarNode)) {
+ indent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind];
+ }
+
+ if (node.body.length > 0) {
+ checkNodesIndent(node.body, indent);
+ }
+
+ checkLastNodeLineIndent(node, indent - functionOffset);
+ }
+
+
+ /**
+ * Checks if the given node starts and ends on the same line
+ * @param {ASTNode} node The node to check
+ * @returns {boolean} Whether or not the block starts and ends on the same line.
+ */
+ function isSingleLineNode(node) {
+ const lastToken = sourceCode.getLastToken(node),
+ startLine = node.loc.start.line,
+ endLine = lastToken.loc.end.line;
+
+ return startLine === endLine;
+ }
+
+ /**
+ * Check to see if the first element inside an array is an object and on the same line as the node
+ * If the node is not an array then it will return false.
+ * @param {ASTNode} node node to check
+ * @returns {boolean} success/failure
+ */
+ function isFirstArrayElementOnSameLine(node) {
+ if (node.type === "ArrayExpression" && node.elements[0]) {
+ return node.elements[0].loc.start.line === node.loc.start.line && node.elements[0].type === "ObjectExpression";
+ }
+ return false;
+
+ }
+
+ /**
+ * Check indent for array block content or object block content
+ * @param {ASTNode} node node to examine
+ * @returns {void}
+ */
+ function checkIndentInArrayOrObjectBlock(node) {
+
+ // Skip inline
+ if (isSingleLineNode(node)) {
+ return;
+ }
+
+ let elements = (node.type === "ArrayExpression") ? node.elements : node.properties;
+
+ // filter out empty elements example would be [ , 2] so remove first element as espree considers it as null
+ elements = elements.filter(elem => elem !== null);
+
+ let nodeIndent;
+ let elementsIndent;
+ const parentVarNode = getVariableDeclaratorNode(node);
+
+ // TODO - come up with a better strategy in future
+ if (isNodeFirstInLine(node)) {
+ const parent = node.parent;
+
+ nodeIndent = getNodeIndent(parent).goodChar;
+ if (!parentVarNode || parentVarNode.loc.start.line !== node.loc.start.line) {
+ if (parent.type !== "VariableDeclarator" || parentVarNode === parentVarNode.parent.declarations[0]) {
+ if (parent.type === "VariableDeclarator" && parentVarNode.loc.start.line === parent.loc.start.line) {
+ nodeIndent = nodeIndent + (indentSize * options.VariableDeclarator[parentVarNode.parent.kind]);
+ } else if (parent.type === "ObjectExpression" || parent.type === "ArrayExpression") {
+ const parentElements = node.parent.type === "ObjectExpression" ? node.parent.properties : node.parent.elements;
+
+ if (parentElements[0] && parentElements[0].loc.start.line === parent.loc.start.line && parentElements[0].loc.end.line !== parent.loc.start.line) {
+
+ /*
+ * If the first element of the array spans multiple lines, don't increase the expected indentation of the rest.
+ * e.g. [{
+ * foo: 1
+ * },
+ * {
+ * bar: 1
+ * }]
+ * the second object is not indented.
+ */
+ } else if (typeof options[parent.type] === "number") {
+ nodeIndent += options[parent.type] * indentSize;
+ } else {
+ nodeIndent = parentElements[0].loc.start.column;
+ }
+ } else if (parent.type === "CallExpression" || parent.type === "NewExpression") {
+ if (typeof options.CallExpression.arguments === "number") {
+ nodeIndent += options.CallExpression.arguments * indentSize;
+ } else if (options.CallExpression.arguments === "first") {
+ if (parent.arguments.indexOf(node) !== -1) {
+ nodeIndent = parent.arguments[0].loc.start.column;
+ }
+ } else {
+ nodeIndent += indentSize;
+ }
+ } else if (parent.type === "LogicalExpression" || parent.type === "ArrowFunctionExpression") {
+ nodeIndent += indentSize;
+ }
+ }
+ } else if (!parentVarNode && !isFirstArrayElementOnSameLine(parent) && parent.type !== "MemberExpression" && parent.type !== "ExpressionStatement" && parent.type !== "AssignmentExpression" && parent.type !== "Property") {
+ nodeIndent = nodeIndent + indentSize;
+ }
+
+ checkFirstNodeLineIndent(node, nodeIndent);
+ } else {
+ nodeIndent = getNodeIndent(node).goodChar;
+ }
+
+ if (options[node.type] === "first") {
+ elementsIndent = elements.length ? elements[0].loc.start.column : 0; // If there are no elements, elementsIndent doesn't matter.
+ } else {
+ elementsIndent = nodeIndent + indentSize * options[node.type];
+ }
+
+ /*
+ * Check if the node is a multiple variable declaration; if so, then
+ * make sure indentation takes that into account.
+ */
+ if (isNodeInVarOnTop(node, parentVarNode)) {
+ elementsIndent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind];
+ }
+
+ checkNodesIndent(elements, elementsIndent);
+
+ if (elements.length > 0) {
+
+ // Skip last block line check if last item in same line
+ if (elements[elements.length - 1].loc.end.line === node.loc.end.line) {
+ return;
+ }
+ }
+
+ checkLastNodeLineIndent(node, nodeIndent + (isNodeInVarOnTop(node, parentVarNode) ? options.VariableDeclarator[parentVarNode.parent.kind] * indentSize : 0));
+ }
+
+ /**
+ * Check if the node or node body is a BlockStatement or not
+ * @param {ASTNode} node node to test
+ * @returns {boolean} True if it or its body is a block statement
+ */
+ function isNodeBodyBlock(node) {
+ return node.type === "BlockStatement" || node.type === "ClassBody" || (node.body && node.body.type === "BlockStatement") ||
+ (node.consequent && node.consequent.type === "BlockStatement");
+ }
+
+ /**
+ * Check indentation for blocks
+ * @param {ASTNode} node node to check
+ * @returns {void}
+ */
+ function blockIndentationCheck(node) {
+
+ // Skip inline blocks
+ if (isSingleLineNode(node)) {
+ return;
+ }
+
+ if (node.parent && (
+ node.parent.type === "FunctionExpression" ||
+ node.parent.type === "FunctionDeclaration" ||
+ node.parent.type === "ArrowFunctionExpression")
+ ) {
+ checkIndentInFunctionBlock(node);
+ return;
+ }
+
+ let indent;
+ let nodesToCheck = [];
+
+ /*
+ * For this statements we should check indent from statement beginning,
+ * not from the beginning of the block.
+ */
+ const statementsWithProperties = [
+ "IfStatement", "WhileStatement", "ForStatement", "ForInStatement", "ForOfStatement", "DoWhileStatement", "ClassDeclaration", "TryStatement"
+ ];
+
+ if (node.parent && statementsWithProperties.indexOf(node.parent.type) !== -1 && isNodeBodyBlock(node)) {
+ indent = getNodeIndent(node.parent).goodChar;
+ } else if (node.parent && node.parent.type === "CatchClause") {
+ indent = getNodeIndent(node.parent.parent).goodChar;
+ } else {
+ indent = getNodeIndent(node).goodChar;
+ }
+
+ if (node.type === "IfStatement" && node.consequent.type !== "BlockStatement") {
+ nodesToCheck = [node.consequent];
+ } else if (Array.isArray(node.body)) {
+ nodesToCheck = node.body;
+ } else {
+ nodesToCheck = [node.body];
+ }
+
+ if (nodesToCheck.length > 0) {
+ checkNodesIndent(nodesToCheck, indent + indentSize);
+ }
+
+ if (node.type === "BlockStatement") {
+ checkLastNodeLineIndent(node, indent);
+ }
+ }
+
+ /**
+ * Filter out the elements which are on the same line of each other or the node.
+ * basically have only 1 elements from each line except the variable declaration line.
+ * @param {ASTNode} node Variable declaration node
+ * @returns {ASTNode[]} Filtered elements
+ */
+ function filterOutSameLineVars(node) {
+ return node.declarations.reduce((finalCollection, elem) => {
+ const lastElem = finalCollection[finalCollection.length - 1];
+
+ if ((elem.loc.start.line !== node.loc.start.line && !lastElem) ||
+ (lastElem && lastElem.loc.start.line !== elem.loc.start.line)) {
+ finalCollection.push(elem);
+ }
+
+ return finalCollection;
+ }, []);
+ }
+
+ /**
+ * Check indentation for variable declarations
+ * @param {ASTNode} node node to examine
+ * @returns {void}
+ */
+ function checkIndentInVariableDeclarations(node) {
+ const elements = filterOutSameLineVars(node);
+ const nodeIndent = getNodeIndent(node).goodChar;
+ const lastElement = elements[elements.length - 1];
+
+ const elementsIndent = nodeIndent + indentSize * options.VariableDeclarator[node.kind];
+
+ checkNodesIndent(elements, elementsIndent);
+
+ // Only check the last line if there is any token after the last item
+ if (sourceCode.getLastToken(node).loc.end.line <= lastElement.loc.end.line) {
+ return;
+ }
+
+ const tokenBeforeLastElement = sourceCode.getTokenBefore(lastElement);
+
+ if (tokenBeforeLastElement.value === ",") {
+
+ // Special case for comma-first syntax where the semicolon is indented
+ checkLastNodeLineIndent(node, getNodeIndent(tokenBeforeLastElement).goodChar);
+ } else {
+ checkLastNodeLineIndent(node, elementsIndent - indentSize);
+ }
+ }
+
+ /**
+ * Check and decide whether to check for indentation for blockless nodes
+ * Scenarios are for or while statements without braces around them
+ * @param {ASTNode} node node to examine
+ * @returns {void}
+ */
+ function blockLessNodes(node) {
+ if (node.body.type !== "BlockStatement") {
+ blockIndentationCheck(node);
+ }
+ }
+
+ /**
+ * Returns the expected indentation for the case statement
+ * @param {ASTNode} node node to examine
+ * @param {int} [switchIndent] indent for switch statement
+ * @returns {int} indent size
+ */
+ function expectedCaseIndent(node, switchIndent) {
+ const switchNode = (node.type === "SwitchStatement") ? node : node.parent;
+ let caseIndent;
+
+ if (caseIndentStore[switchNode.loc.start.line]) {
+ return caseIndentStore[switchNode.loc.start.line];
+ }
+ if (typeof switchIndent === "undefined") {
+ switchIndent = getNodeIndent(switchNode).goodChar;
+ }
+
+ if (switchNode.cases.length > 0 && options.SwitchCase === 0) {
+ caseIndent = switchIndent;
+ } else {
+ caseIndent = switchIndent + (indentSize * options.SwitchCase);
+ }
+
+ caseIndentStore[switchNode.loc.start.line] = caseIndent;
+ return caseIndent;
+
+ }
+
+ /**
+ * Checks wether a return statement is wrapped in ()
+ * @param {ASTNode} node node to examine
+ * @returns {boolean} the result
+ */
+ function isWrappedInParenthesis(node) {
+ const regex = /^return\s*?\(\s*?\);*?/;
+
+ const statementWithoutArgument = sourceCode.getText(node).replace(
+ sourceCode.getText(node.argument), "");
+
+ return regex.test(statementWithoutArgument);
+ }
+
+ return {
+ Program(node) {
+ if (node.body.length > 0) {
+
+ // Root nodes should have no indent
+ checkNodesIndent(node.body, getNodeIndent(node).goodChar);
+ }
+ },
+
+ ClassBody: blockIndentationCheck,
+
+ BlockStatement: blockIndentationCheck,
+
+ WhileStatement: blockLessNodes,
+
+ ForStatement: blockLessNodes,
+
+ ForInStatement: blockLessNodes,
+
+ ForOfStatement: blockLessNodes,
+
+ DoWhileStatement: blockLessNodes,
+
+ IfStatement(node) {
+ if (node.consequent.type !== "BlockStatement" && node.consequent.loc.start.line > node.loc.start.line) {
+ blockIndentationCheck(node);
+ }
+ },
+
+ VariableDeclaration(node) {
+ if (node.declarations[node.declarations.length - 1].loc.start.line > node.declarations[0].loc.start.line) {
+ checkIndentInVariableDeclarations(node);
+ }
+ },
+
+ ObjectExpression(node) {
+ checkIndentInArrayOrObjectBlock(node);
+ },
+
+ ArrayExpression(node) {
+ checkIndentInArrayOrObjectBlock(node);
+ },
+
+ MemberExpression(node) {
+
+ if (typeof options.MemberExpression === "undefined") {
+ return;
+ }
+
+ if (isSingleLineNode(node)) {
+ return;
+ }
+
+ // The typical layout of variable declarations and assignments
+ // alter the expectation of correct indentation. Skip them.
+ // TODO: Add appropriate configuration options for variable
+ // declarations and assignments.
+ if (getParentNodeByType(node, "VariableDeclarator", ["FunctionExpression", "ArrowFunctionExpression"])) {
+ return;
+ }
+
+ if (getParentNodeByType(node, "AssignmentExpression", ["FunctionExpression"])) {
+ return;
+ }
+
+ const propertyIndent = getNodeIndent(node).goodChar + indentSize * options.MemberExpression;
+
+ const checkNodes = [node.property];
+
+ const dot = context.getTokenBefore(node.property);
+
+ if (dot.type === "Punctuator" && dot.value === ".") {
+ checkNodes.push(dot);
+ }
+
+ checkNodesIndent(checkNodes, propertyIndent);
+ },
+
+ SwitchStatement(node) {
+
+ // Switch is not a 'BlockStatement'
+ const switchIndent = getNodeIndent(node).goodChar;
+ const caseIndent = expectedCaseIndent(node, switchIndent);
+
+ checkNodesIndent(node.cases, caseIndent);
+
+
+ checkLastNodeLineIndent(node, switchIndent);
+ },
+
+ SwitchCase(node) {
+
+ // Skip inline cases
+ if (isSingleLineNode(node)) {
+ return;
+ }
+ const caseIndent = expectedCaseIndent(node);
+
+ checkNodesIndent(node.consequent, caseIndent + indentSize);
+ },
+
+ FunctionDeclaration(node) {
+ if (isSingleLineNode(node)) {
+ return;
+ }
+ if (options.FunctionDeclaration.parameters === "first" && node.params.length) {
+ checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column);
+ } else if (options.FunctionDeclaration.parameters !== null) {
+ checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionDeclaration.parameters);
+ }
+ },
+
+ FunctionExpression(node) {
+ if (isSingleLineNode(node)) {
+ return;
+ }
+ if (options.FunctionExpression.parameters === "first" && node.params.length) {
+ checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column);
+ } else if (options.FunctionExpression.parameters !== null) {
+ checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionExpression.parameters);
+ }
+ },
+
+ ReturnStatement(node) {
+ if (isSingleLineNode(node)) {
+ return;
+ }
+
+ const firstLineIndent = getNodeIndent(node).goodChar;
+
+ // in case if return statement is wrapped in parenthesis
+ if (isWrappedInParenthesis(node)) {
+ checkLastReturnStatementLineIndent(node, firstLineIndent);
+ } else {
+ checkNodeIndent(node, firstLineIndent);
+ }
+ },
+
+ CallExpression(node) {
+ if (isSingleLineNode(node)) {
+ return;
+ }
+ if (options.CallExpression.arguments === "first" && node.arguments.length) {
+ checkNodesIndent(node.arguments.slice(1), node.arguments[0].loc.start.column);
+ } else if (options.CallExpression.arguments !== null) {
+ checkNodesIndent(node.arguments, getNodeIndent(node).goodChar + indentSize * options.CallExpression.arguments);
+ }
+ }
+
+ };
+
+ }
+};
diff --git a/tools/eslint/lib/rules/indent.js b/tools/eslint/lib/rules/indent.js
index bba1b20bcf4407..82268975dfbcaa 100644
--- a/tools/eslint/lib/rules/indent.js
+++ b/tools/eslint/lib/rules/indent.js
@@ -12,12 +12,344 @@
// Requirements
//------------------------------------------------------------------------------
+const lodash = require("lodash");
const astUtils = require("../ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
+const KNOWN_NODES = new Set([
+ "AssignmentExpression",
+ "AssignmentPattern",
+ "ArrayExpression",
+ "ArrayPattern",
+ "ArrowFunctionExpression",
+ "AwaitExpression",
+ "BlockStatement",
+ "BinaryExpression",
+ "BreakStatement",
+ "CallExpression",
+ "CatchClause",
+ "ClassBody",
+ "ClassDeclaration",
+ "ClassExpression",
+ "ConditionalExpression",
+ "ContinueStatement",
+ "DoWhileStatement",
+ "DebuggerStatement",
+ "EmptyStatement",
+ "ExperimentalRestProperty",
+ "ExperimentalSpreadProperty",
+ "ExpressionStatement",
+ "ForStatement",
+ "ForInStatement",
+ "ForOfStatement",
+ "FunctionDeclaration",
+ "FunctionExpression",
+ "Identifier",
+ "IfStatement",
+ "Literal",
+ "LabeledStatement",
+ "LogicalExpression",
+ "MemberExpression",
+ "MetaProperty",
+ "MethodDefinition",
+ "NewExpression",
+ "ObjectExpression",
+ "ObjectPattern",
+ "Program",
+ "Property",
+ "RestElement",
+ "ReturnStatement",
+ "SequenceExpression",
+ "SpreadElement",
+ "Super",
+ "SwitchCase",
+ "SwitchStatement",
+ "TaggedTemplateExpression",
+ "TemplateElement",
+ "TemplateLiteral",
+ "ThisExpression",
+ "ThrowStatement",
+ "TryStatement",
+ "UnaryExpression",
+ "UpdateExpression",
+ "VariableDeclaration",
+ "VariableDeclarator",
+ "WhileStatement",
+ "WithStatement",
+ "YieldExpression",
+ "JSXIdentifier",
+ "JSXNamespacedName",
+ "JSXMemberExpression",
+ "JSXEmptyExpression",
+ "JSXExpressionContainer",
+ "JSXElement",
+ "JSXClosingElement",
+ "JSXOpeningElement",
+ "JSXAttribute",
+ "JSXSpreadAttribute",
+ "JSXText",
+ "ExportDefaultDeclaration",
+ "ExportNamedDeclaration",
+ "ExportAllDeclaration",
+ "ExportSpecifier",
+ "ImportDeclaration",
+ "ImportSpecifier",
+ "ImportDefaultSpecifier",
+ "ImportNamespaceSpecifier"
+]);
+
+/*
+ * General rule strategy:
+ * 1. An OffsetStorage instance stores a map of desired offsets, where each token has a specified offset from another
+ * specified token or to the first column.
+ * 2. As the AST is traversed, modify the desired offsets of tokens accordingly. For example, when entering a
+ * BlockStatement, offset all of the tokens in the BlockStatement by 1 indent level from the opening curly
+ * brace of the BlockStatement.
+ * 3. After traversing the AST, calculate the expected indentation levels of every token according to the
+ * OffsetStorage container.
+ * 4. For each line, compare the expected indentation of the first token to the actual indentation in the file,
+ * and report the token if the two values are not equal.
+ */
+
+/**
+ * A helper class to get token-based info related to indentation
+ */
+class TokenInfo {
+
+ /**
+ * @param {SourceCode} sourceCode A SourceCode object
+ */
+ constructor(sourceCode) {
+ this.sourceCode = sourceCode;
+ this.firstTokensByLineNumber = sourceCode.tokensAndComments.reduce((map, token) => {
+ if (!map.has(token.loc.start.line)) {
+ map.set(token.loc.start.line, token);
+ }
+ if (!map.has(token.loc.end.line) && sourceCode.text.slice(token.range[1] - token.loc.end.column, token.range[1]).trim()) {
+ map.set(token.loc.end.line, token);
+ }
+ return map;
+ }, new Map());
+ }
+
+ /**
+ * Gets all tokens and comments
+ * @returns {Token[]} A list of all tokens and comments
+ */
+ getAllTokens() {
+ return this.sourceCode.tokensAndComments;
+ }
+
+ /**
+ * Gets the first token on a given token's line
+ * @param {Token|ASTNode} token a node or token
+ * @returns {Token} The first token on the given line
+ */
+ getFirstTokenOfLine(token) {
+ return this.firstTokensByLineNumber.get(token.loc.start.line);
+ }
+
+ /**
+ * Determines whether a token is the first token in its line
+ * @param {Token} token The token
+ * @returns {boolean} `true` if the token is the first on its line
+ */
+ isFirstTokenOfLine(token) {
+ return this.getFirstTokenOfLine(token) === token;
+ }
+
+ /**
+ * Get the actual indent of a token
+ * @param {Token} token Token to examine. This should be the first token on its line.
+ * @returns {string} The indentation characters that precede the token
+ */
+ getTokenIndent(token) {
+ return this.sourceCode.text.slice(token.range[0] - token.loc.start.column, token.range[0]);
+ }
+}
+
+/**
+ * A class to store information on desired offsets of tokens from each other
+ */
+class OffsetStorage {
+
+ /**
+ * @param {TokenInfo} tokenInfo a TokenInfo instance
+ * @param {string} indentType The desired type of indentation (either "space" or "tab")
+ * @param {number} indentSize The desired size of each indentation level
+ */
+ constructor(tokenInfo, indentType, indentSize) {
+ this.tokenInfo = tokenInfo;
+ this.indentType = indentType;
+ this.indentSize = indentSize;
+
+ /*
+ * desiredOffsets, lockedFirstTokens, and desiredIndentCache conceptually map tokens to something else.
+ * However, they're implemented as objects with range indices as keys because this improves performance as of Node 7.
+ * This uses the assumption that no two tokens start at the same index in the program.
+ *
+ * The values of the desiredOffsets map are objects with the schema { offset: number, from: Token|null }.
+ * These objects should not be mutated or exposed outside of OffsetStorage.
+ */
+ const NO_OFFSET = { offset: 0, from: null };
+
+ this.desiredOffsets = tokenInfo.getAllTokens().reduce((desiredOffsets, token) => {
+ desiredOffsets[token.range[0]] = NO_OFFSET;
+
+ return desiredOffsets;
+ }, Object.create(null));
+ this.lockedFirstTokens = Object.create(null);
+ this.desiredIndentCache = Object.create(null);
+ this.ignoredTokens = new WeakSet();
+ }
+
+ /**
+ * Sets the indent of one token to match the indent of another.
+ * @param {Token} baseToken The first token
+ * @param {Token} offsetToken The second token, whose indent should be matched to the first token
+ * @returns {void}
+ */
+ matchIndentOf(baseToken, offsetToken) {
+ if (baseToken !== offsetToken) {
+ this.desiredOffsets[offsetToken.range[0]] = { offset: 0, from: baseToken };
+ }
+ }
+
+ /**
+ * Sets the offset column of token B to match the offset column of token A.
+ * This is different from matchIndentOf because it matches a *column*, even if baseToken is not
+ * the first token on its line.
+ * @param {Token} baseToken The first token
+ * @param {Token} offsetToken The second token, whose offset should be matched to the first token
+ * @returns {void}
+ */
+ matchOffsetOf(baseToken, offsetToken) {
+
+ /*
+ * lockedFirstTokens is a map from a token whose indentation is controlled by the "first" option to
+ * the token that it depends on. For example, with the `ArrayExpression: first` option, the first
+ * token of each element in the array after the first will be mapped to the first token of the first
+ * element. The desired indentation of each of these tokens is computed based on the desired indentation
+ * of the "first" element, rather than through the normal offset mechanism.
+ */
+ this.lockedFirstTokens[offsetToken.range[0]] = baseToken;
+ }
+
+ /**
+ * Sets the desired offset of a token
+ * @param {Token} token The token
+ * @param {Token} offsetFrom The token that this is offset from
+ * @param {number} offset The desired indent level
+ * @returns {void}
+ */
+ setDesiredOffset(token, offsetFrom, offset) {
+ if (offsetFrom && token.loc.start.line === offsetFrom.loc.start.line) {
+ this.matchIndentOf(offsetFrom, token);
+ } else {
+ this.desiredOffsets[token.range[0]] = { offset, from: offsetFrom };
+ }
+ }
+
+ /**
+ * Sets the desired offset of multiple tokens
+ * @param {Token[]} tokens A list of tokens. These tokens should be consecutive.
+ * @param {Token} offsetFrom The token that this is offset from
+ * @param {number} offset The desired indent level
+ * @returns {void}
+ */
+ setDesiredOffsets(tokens, offsetFrom, offset) {
+
+ /*
+ * TODO: (not-an-aardvark) This function is the main performance holdup for this rule. It works
+ * by setting the desired offset of each token to the given amount relative to the parent, but it's
+ * frequently called with a large list of tokens, and it takes time to set the offset for each token
+ * individually. Since the tokens are always consecutive, it might be possible to improve performance
+ * here by changing the data structure used to store offsets (e.g. allowing a *range* of tokens to
+ * be offset rather than offsetting each token individually).
+ */
+ tokens.forEach(token => this.setDesiredOffset(token, offsetFrom, offset));
+ }
+
+ /**
+ * Gets the desired indent of a token
+ * @param {Token} token The token
+ * @returns {number} The desired indent of the token
+ */
+ getDesiredIndent(token) {
+ if (!(token.range[0] in this.desiredIndentCache)) {
+
+ if (this.ignoredTokens.has(token)) {
+
+ // If the token is ignored, use the actual indent of the token as the desired indent.
+ // This ensures that no errors are reported for this token.
+ this.desiredIndentCache[token.range[0]] = this.tokenInfo.getTokenIndent(token).length / this.indentSize;
+ } else if (token.range[0] in this.lockedFirstTokens) {
+ const firstToken = this.lockedFirstTokens[token.range[0]];
+
+ this.desiredIndentCache[token.range[0]] =
+
+ // (indentation for the first element's line)
+ this.getDesiredIndent(this.tokenInfo.getFirstTokenOfLine(firstToken)) +
+
+ // (space between the start of the first element's line and the first element)
+ (firstToken.loc.start.column - this.tokenInfo.getFirstTokenOfLine(firstToken).loc.start.column) / this.indentSize;
+ } else {
+ const offsetInfo = this.desiredOffsets[token.range[0]];
+
+ this.desiredIndentCache[token.range[0]] = offsetInfo.offset + (offsetInfo.from ? this.getDesiredIndent(offsetInfo.from) : 0);
+ }
+ }
+ return this.desiredIndentCache[token.range[0]];
+ }
+
+ /**
+ * Ignores a token, preventing it from being reported.
+ * @param {Token} token The token
+ * @returns {void}
+ */
+ ignoreToken(token) {
+ if (this.tokenInfo.isFirstTokenOfLine(token)) {
+ this.ignoredTokens.add(token);
+ }
+ }
+
+ /**
+ * Gets the first token that the given token's indentation is dependent on
+ * @param {Token} token The token
+ * @returns {Token} The token that the given token depends on, or `null` if the given token is at the top level
+ */
+ getFirstDependency(token) {
+ return this.desiredOffsets[token.range[0]].from;
+ }
+
+ /**
+ * Increases the offset for a token from its parent by the given amount
+ * @param {Token} token The token whose offset should be increased
+ * @param {number} amount The number of indent levels that the offset should increase by
+ * @returns {void}
+ */
+ increaseOffset(token, amount) {
+ const currentOffsetInfo = this.desiredOffsets[token.range[0]];
+
+ this.desiredOffsets[token.range[0]] = { offset: currentOffsetInfo.offset + amount, from: currentOffsetInfo.from };
+ }
+}
+
+const ELEMENT_LIST_SCHEMA = {
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ enum: ["first", "off"]
+ }
+ ]
+};
+
module.exports = {
meta: {
docs: {
@@ -68,7 +400,8 @@ module.exports = {
type: "integer",
minimum: 0
}
- }
+ },
+ additionalProperties: false
}
]
},
@@ -77,86 +410,49 @@ module.exports = {
minimum: 0
},
MemberExpression: {
- type: "integer",
- minimum: 0
+ oneOf: [
+ {
+ type: "integer",
+ minimum: 0
+ },
+ {
+ enum: ["off"]
+ }
+ ]
},
FunctionDeclaration: {
type: "object",
properties: {
- parameters: {
- oneOf: [
- {
- type: "integer",
- minimum: 0
- },
- {
- enum: ["first"]
- }
- ]
- },
+ parameters: ELEMENT_LIST_SCHEMA,
body: {
type: "integer",
minimum: 0
}
- }
+ },
+ additionalProperties: false
},
FunctionExpression: {
type: "object",
properties: {
- parameters: {
- oneOf: [
- {
- type: "integer",
- minimum: 0
- },
- {
- enum: ["first"]
- }
- ]
- },
+ parameters: ELEMENT_LIST_SCHEMA,
body: {
type: "integer",
minimum: 0
}
- }
+ },
+ additionalProperties: false
},
CallExpression: {
type: "object",
properties: {
- parameters: {
- oneOf: [
- {
- type: "integer",
- minimum: 0
- },
- {
- enum: ["first"]
- }
- ]
- }
- }
+ arguments: ELEMENT_LIST_SCHEMA
+ },
+ additionalProperties: false
},
- ArrayExpression: {
- oneOf: [
- {
- type: "integer",
- minimum: 0
- },
- {
- enum: ["first"]
- }
- ]
- },
- ObjectExpression: {
- oneOf: [
- {
- type: "integer",
- minimum: 0
- },
- {
- enum: ["first"]
- }
- ]
+ ArrayExpression: ELEMENT_LIST_SCHEMA,
+ ObjectExpression: ELEMENT_LIST_SCHEMA,
+ flatTernaryExpressions: {
+ type: "boolean"
}
},
additionalProperties: false
@@ -166,7 +462,7 @@ module.exports = {
create(context) {
const DEFAULT_VARIABLE_INDENT = 1;
- const DEFAULT_PARAMETER_INDENT = null; // For backwards compatibility, don't check parameter indentation unless specified in the config
+ const DEFAULT_PARAMETER_INDENT = 1;
const DEFAULT_FUNCTION_BODY_INDENT = 1;
let indentType = "space";
@@ -178,7 +474,7 @@ module.exports = {
let: DEFAULT_VARIABLE_INDENT,
const: DEFAULT_VARIABLE_INDENT
},
- outerIIFEBody: null,
+ outerIIFEBody: 1,
FunctionDeclaration: {
parameters: DEFAULT_PARAMETER_INDENT,
body: DEFAULT_FUNCTION_BODY_INDENT
@@ -190,68 +486,40 @@ module.exports = {
CallExpression: {
arguments: DEFAULT_PARAMETER_INDENT
},
+ MemberExpression: 1,
ArrayExpression: 1,
- ObjectExpression: 1
+ ObjectExpression: 1,
+ ArrayPattern: 1,
+ ObjectPattern: 1,
+ flatTernaryExpressions: false
};
- const sourceCode = context.getSourceCode();
-
if (context.options.length) {
if (context.options[0] === "tab") {
indentSize = 1;
indentType = "tab";
- } else /* istanbul ignore else : this will be caught by options validation */ if (typeof context.options[0] === "number") {
+ } else if (typeof context.options[0] === "number") {
indentSize = context.options[0];
indentType = "space";
}
if (context.options[1]) {
- const opts = context.options[1];
-
- options.SwitchCase = opts.SwitchCase || 0;
- const variableDeclaratorRules = opts.VariableDeclarator;
+ lodash.merge(options, context.options[1]);
- if (typeof variableDeclaratorRules === "number") {
+ if (typeof options.VariableDeclarator === "number") {
options.VariableDeclarator = {
- var: variableDeclaratorRules,
- let: variableDeclaratorRules,
- const: variableDeclaratorRules
+ var: options.VariableDeclarator,
+ let: options.VariableDeclarator,
+ const: options.VariableDeclarator
};
- } else if (typeof variableDeclaratorRules === "object") {
- Object.assign(options.VariableDeclarator, variableDeclaratorRules);
- }
-
- if (typeof opts.outerIIFEBody === "number") {
- options.outerIIFEBody = opts.outerIIFEBody;
- }
-
- if (typeof opts.MemberExpression === "number") {
- options.MemberExpression = opts.MemberExpression;
- }
-
- if (typeof opts.FunctionDeclaration === "object") {
- Object.assign(options.FunctionDeclaration, opts.FunctionDeclaration);
- }
-
- if (typeof opts.FunctionExpression === "object") {
- Object.assign(options.FunctionExpression, opts.FunctionExpression);
- }
-
- if (typeof opts.CallExpression === "object") {
- Object.assign(options.CallExpression, opts.CallExpression);
- }
-
- if (typeof opts.ArrayExpression === "number" || typeof opts.ArrayExpression === "string") {
- options.ArrayExpression = opts.ArrayExpression;
- }
-
- if (typeof opts.ObjectExpression === "number" || typeof opts.ObjectExpression === "string") {
- options.ObjectExpression = opts.ObjectExpression;
}
}
}
- const caseIndentStore = {};
+ const sourceCode = context.getSourceCode();
+ const tokenInfo = new TokenInfo(sourceCode);
+ const offsets = new OffsetStorage(tokenInfo, indentType, indentSize);
+ const parameterParens = new WeakSet();
/**
* Creates an error message for a line, given the expected/actual indentation.
@@ -266,9 +534,7 @@ module.exports = {
const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs"
let foundStatement;
- if (actualSpaces > 0 && actualTabs > 0) {
- foundStatement = `${actualSpaces} ${foundSpacesWord} and ${actualTabs} ${foundTabsWord}`; // e.g. "1 space and 2 tabs"
- } else if (actualSpaces > 0) {
+ if (actualSpaces > 0) {
// Abbreviate the message if the expected indentation is also spaces.
// e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces'
@@ -284,836 +550,823 @@ module.exports = {
/**
* Reports a given indent violation
- * @param {ASTNode} node Node violating the indent rule
- * @param {int} needed Expected indentation character count
+ * @param {Token} token Node violating the indent rule
+ * @param {int} neededIndentLevel Expected indentation level
* @param {int} gottenSpaces Indentation space count in the actual node/code
* @param {int} gottenTabs Indentation tab count in the actual node/code
- * @param {Object=} loc Error line and column location
- * @param {boolean} isLastNodeCheck Is the error for last node check
- * @param {int} lastNodeCheckEndOffset Number of charecters to skip from the end
* @returns {void}
*/
- function report(node, needed, gottenSpaces, gottenTabs, loc, isLastNodeCheck) {
- if (gottenSpaces && gottenTabs) {
-
- // To avoid conflicts with `no-mixed-spaces-and-tabs`, don't report lines that have both spaces and tabs.
- return;
- }
-
- const desiredIndent = (indentType === "space" ? " " : "\t").repeat(needed);
-
- const textRange = isLastNodeCheck
- ? [node.range[1] - node.loc.end.column, node.range[1] - node.loc.end.column + gottenSpaces + gottenTabs]
- : [node.range[0] - node.loc.start.column, node.range[0] - node.loc.start.column + gottenSpaces + gottenTabs];
+ function report(token, neededIndentLevel) {
+ const actualIndent = Array.from(tokenInfo.getTokenIndent(token));
+ const numSpaces = actualIndent.filter(char => char === " ").length;
+ const numTabs = actualIndent.filter(char => char === "\t").length;
+ const neededChars = neededIndentLevel * indentSize;
context.report({
- node,
- loc,
- message: createErrorMessage(needed, gottenSpaces, gottenTabs),
- fix: fixer => fixer.replaceTextRange(textRange, desiredIndent)
+ node: token,
+ message: createErrorMessage(neededChars, numSpaces, numTabs),
+ loc: {
+ start: { line: token.loc.start.line, column: 0 },
+ end: { line: token.loc.start.line, column: token.loc.start.column }
+ },
+ fix(fixer) {
+ const range = [token.range[0] - token.loc.start.column, token.range[0]];
+ const newText = (indentType === "space" ? " " : "\t").repeat(neededChars);
+
+ return fixer.replaceTextRange(range, newText);
+ }
});
}
/**
- * Get the actual indent of node
- * @param {ASTNode|Token} node Node to examine
- * @param {boolean} [byLastLine=false] get indent of node's last line
- * @param {boolean} [excludeCommas=false] skip comma on start of line
- * @returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also
- contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and
- `badChar` is the amount of the other indentation character.
+ * Checks if a token's indentation is correct
+ * @param {Token} token Token to examine
+ * @param {int} desiredIndentLevel needed indent level
+ * @returns {boolean} `true` if the token's indentation is correct
*/
- function getNodeIndent(node, byLastLine) {
- const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node);
- const srcCharsBeforeNode = sourceCode.getText(token, token.loc.start.column).split("");
- const indentChars = srcCharsBeforeNode.slice(0, srcCharsBeforeNode.findIndex(char => char !== " " && char !== "\t"));
- const spaces = indentChars.filter(char => char === " ").length;
- const tabs = indentChars.filter(char => char === "\t").length;
-
- return {
- space: spaces,
- tab: tabs,
- goodChar: indentType === "space" ? spaces : tabs,
- badChar: indentType === "space" ? tabs : spaces
- };
- }
+ function validateTokenIndent(token, desiredIndentLevel) {
+ const indentation = tokenInfo.getTokenIndent(token);
+ const expectedChar = indentType === "space" ? " " : "\t";
- /**
- * Checks node is the first in its own start line. By default it looks by start line.
- * @param {ASTNode} node The node to check
- * @param {boolean} [byEndLocation=false] Lookup based on start position or end
- * @returns {boolean} true if its the first in the its start line
- */
- function isNodeFirstInLine(node, byEndLocation) {
- const firstToken = byEndLocation === true ? sourceCode.getLastToken(node, 1) : sourceCode.getTokenBefore(node),
- startLine = byEndLocation === true ? node.loc.end.line : node.loc.start.line,
- endLine = firstToken ? firstToken.loc.end.line : -1;
+ return indentation === expectedChar.repeat(desiredIndentLevel * indentSize) ||
- return startLine !== endLine;
+ // To avoid conflicts with no-mixed-spaces-and-tabs, don't report mixed spaces and tabs.
+ indentation.includes(" ") && indentation.includes("\t");
}
/**
- * Check indent for node
- * @param {ASTNode} node Node to check
- * @param {int} neededIndent needed indent
- * @param {boolean} [excludeCommas=false] skip comma on start of line
- * @returns {void}
+ * Check to see if the node is a file level IIFE
+ * @param {ASTNode} node The function node to check.
+ * @returns {boolean} True if the node is the outer IIFE
*/
- function checkNodeIndent(node, neededIndent) {
- const actualIndent = getNodeIndent(node, false);
-
- if (
- node.type !== "ArrayExpression" &&
- node.type !== "ObjectExpression" &&
- (actualIndent.goodChar !== neededIndent || actualIndent.badChar !== 0) &&
- isNodeFirstInLine(node)
- ) {
- report(node, neededIndent, actualIndent.space, actualIndent.tab);
- }
-
- if (node.type === "IfStatement" && node.alternate) {
- const elseToken = sourceCode.getTokenBefore(node.alternate);
-
- checkNodeIndent(elseToken, neededIndent);
-
- if (!isNodeFirstInLine(node.alternate)) {
- checkNodeIndent(node.alternate, neededIndent);
- }
- }
-
- if (node.type === "TryStatement" && node.handler) {
- const catchToken = sourceCode.getFirstToken(node.handler);
-
- checkNodeIndent(catchToken, neededIndent);
- }
-
- if (node.type === "TryStatement" && node.finalizer) {
- const finallyToken = sourceCode.getTokenBefore(node.finalizer);
+ function isOuterIIFE(node) {
- checkNodeIndent(finallyToken, neededIndent);
+ /*
+ * Verify that the node is an IIFE
+ */
+ if (!node.parent || node.parent.type !== "CallExpression" || node.parent.callee !== node) {
+ return false;
}
- if (node.type === "DoWhileStatement") {
- const whileToken = sourceCode.getTokenAfter(node.body);
+ /*
+ * Navigate legal ancestors to determine whether this IIFE is outer.
+ * A "legal ancestor" is an expression or statement that causes the function to get executed immediately.
+ * For example, `!(function(){})()` is an outer IIFE even though it is preceded by a ! operator.
+ */
+ let statement = node.parent && node.parent.parent;
- checkNodeIndent(whileToken, neededIndent);
+ while (
+ statement.type === "UnaryExpression" && ["!", "~", "+", "-"].indexOf(statement.operator) > -1 ||
+ statement.type === "AssignmentExpression" ||
+ statement.type === "LogicalExpression" ||
+ statement.type === "SequenceExpression" ||
+ statement.type === "VariableDeclarator"
+ ) {
+ statement = statement.parent;
}
- }
- /**
- * Check indent for nodes list
- * @param {ASTNode[]} nodes list of node objects
- * @param {int} indent needed indent
- * @param {boolean} [excludeCommas=false] skip comma on start of line
- * @returns {void}
- */
- function checkNodesIndent(nodes, indent) {
- nodes.forEach(node => checkNodeIndent(node, indent));
+ return (statement.type === "ExpressionStatement" || statement.type === "VariableDeclaration") && statement.parent.type === "Program";
}
/**
- * Check last node line indent this detects, that block closed correctly
- * @param {ASTNode} node Node to examine
- * @param {int} lastLineIndent needed indent
- * @returns {void}
- */
- function checkLastNodeLineIndent(node, lastLineIndent) {
- const lastToken = sourceCode.getLastToken(node);
- const endIndent = getNodeIndent(lastToken, true);
-
- if ((endIndent.goodChar !== lastLineIndent || endIndent.badChar !== 0) && isNodeFirstInLine(node, true)) {
- report(
- node,
- lastLineIndent,
- endIndent.space,
- endIndent.tab,
- { line: lastToken.loc.start.line, column: lastToken.loc.start.column },
- true
- );
- }
+ * Gets all tokens and comments for a node
+ * @param {ASTNode} node The node
+ * @returns {Token[]} A list of tokens and comments
+ */
+ function getTokensAndComments(node) {
+ return sourceCode.getTokens(node, { includeComments: true });
}
/**
- * Check last node line indent this detects, that block closed correctly
- * This function for more complicated return statement case, where closing parenthesis may be followed by ';'
- * @param {ASTNode} node Node to examine
- * @param {int} firstLineIndent first line needed indent
- * @returns {void}
- */
- function checkLastReturnStatementLineIndent(node, firstLineIndent) {
+ * Check indentation for lists of elements (arrays, objects, function params)
+ * @param {ASTNode[]} elements List of elements that should be offset
+ * @param {Token} startToken The start token of the list that element should be aligned against, e.g. '['
+ * @param {Token} endToken The end token of the list, e.g. ']'
+ * @param {number|string} offset The amount that the elements should be offset
+ * @returns {void}
+ */
+ function addElementListIndent(elements, startToken, endToken, offset) {
+
+ /**
+ * Gets the first token of a given element, including surrounding parentheses.
+ * @param {ASTNode} element A node in the `elements` list
+ * @returns {Token} The first token of this element
+ */
+ function getFirstToken(element) {
+ let token = sourceCode.getTokenBefore(element);
+
+ while (astUtils.isOpeningParenToken(token) && token !== startToken) {
+ token = sourceCode.getTokenBefore(token);
+ }
- // in case if return statement ends with ');' we have traverse back to ')'
- // otherwise we'll measure indent for ';' and replace ')'
- const lastToken = sourceCode.getLastToken(node, astUtils.isClosingParenToken);
- const textBeforeClosingParenthesis = sourceCode.getText(lastToken, lastToken.loc.start.column).slice(0, -1);
+ return sourceCode.getTokenAfter(token);
+ }
- if (textBeforeClosingParenthesis.trim()) {
+ // Run through all the tokens in the list, and offset them by one indent level (mainly for comments, other things will end up overridden)
+ // FIXME: (not-an-aardvark) This isn't performant at all.
+ offsets.setDesiredOffsets(
+ sourceCode.getTokensBetween(startToken, endToken, { includeComments: true }),
+ startToken,
+ offset === "first" ? 1 : offset
+ );
+ offsets.matchIndentOf(startToken, endToken);
- // There are tokens before the closing paren, don't report this case
+ // If the preference is "first" but there is no first element (e.g. sparse arrays w/ empty first slot), fall back to 1 level.
+ if (offset === "first" && elements.length && !elements[0]) {
return;
}
- const endIndent = getNodeIndent(lastToken, true);
+ elements.forEach((element, index) => {
+ if (offset === "off") {
+ offsets.ignoreToken(getFirstToken(element));
+ }
+ if (index === 0 || !element) {
+ return;
+ }
+ if (offset === "first" && tokenInfo.isFirstTokenOfLine(getFirstToken(element))) {
+ offsets.matchOffsetOf(getFirstToken(elements[0]), getFirstToken(element));
+ } else {
+ const previousElement = elements[index - 1];
+ const firstTokenOfPreviousElement = previousElement && getFirstToken(previousElement);
- if (endIndent.goodChar !== firstLineIndent) {
- report(
- node,
- firstLineIndent,
- endIndent.space,
- endIndent.tab,
- { line: lastToken.loc.start.line, column: lastToken.loc.start.column },
- true
- );
- }
+ if (previousElement && sourceCode.getLastToken(previousElement).loc.start.line > startToken.loc.end.line) {
+ offsets.matchIndentOf(firstTokenOfPreviousElement, getFirstToken(element));
+ }
+ }
+ });
}
/**
- * Check first node line indent is correct
- * @param {ASTNode} node Node to examine
- * @param {int} firstLineIndent needed indent
+ * Check indentation for blocks and class bodies
+ * @param {ASTNode} node The BlockStatement or ClassBody node to indent
* @returns {void}
*/
- function checkFirstNodeLineIndent(node, firstLineIndent) {
- const startIndent = getNodeIndent(node, false);
-
- if ((startIndent.goodChar !== firstLineIndent || startIndent.badChar !== 0) && isNodeFirstInLine(node)) {
- report(
- node,
- firstLineIndent,
- startIndent.space,
- startIndent.tab,
- { line: node.loc.start.line, column: node.loc.start.column }
- );
- }
- }
+ function addBlockIndent(node) {
- /**
- * Returns a parent node of given node based on a specified type
- * if not present then return null
- * @param {ASTNode} node node to examine
- * @param {string} type type that is being looked for
- * @param {string} stopAtList end points for the evaluating code
- * @returns {ASTNode|void} if found then node otherwise null
- */
- function getParentNodeByType(node, type, stopAtList) {
- let parent = node.parent;
+ let blockIndentLevel;
- if (!stopAtList) {
- stopAtList = ["Program"];
+ if (node.parent && isOuterIIFE(node.parent)) {
+ blockIndentLevel = options.outerIIFEBody;
+ } else if (node.parent && (node.parent.type === "FunctionExpression" || node.parent.type === "ArrowFunctionExpression")) {
+ blockIndentLevel = options.FunctionExpression.body;
+ } else if (node.parent && node.parent.type === "FunctionDeclaration") {
+ blockIndentLevel = options.FunctionDeclaration.body;
+ } else {
+ blockIndentLevel = 1;
}
- while (parent.type !== type && stopAtList.indexOf(parent.type) === -1 && parent.type !== "Program") {
- parent = parent.parent;
+ /*
+ * For blocks that aren't lone statements, ensure that the opening curly brace
+ * is aligned with the parent.
+ */
+ if (!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)) {
+ offsets.matchIndentOf(sourceCode.getFirstToken(node.parent), sourceCode.getFirstToken(node));
}
-
- return parent.type === type ? parent : null;
+ addElementListIndent(node.body, sourceCode.getFirstToken(node), sourceCode.getLastToken(node), blockIndentLevel);
}
/**
- * Returns the VariableDeclarator based on the current node
- * if not present then return null
+ * Check indent for array block content or object block content
* @param {ASTNode} node node to examine
- * @returns {ASTNode|void} if found then node otherwise null
+ * @returns {void}
*/
- function getVariableDeclaratorNode(node) {
- return getParentNodeByType(node, "VariableDeclarator");
- }
+ function addArrayOrObjectIndent(node) {
+ const tokens = getTokensAndComments(node);
- /**
- * Check to see if the node is part of the multi-line variable declaration.
- * Also if its on the same line as the varNode
- * @param {ASTNode} node node to check
- * @param {ASTNode} varNode variable declaration node to check against
- * @returns {boolean} True if all the above condition satisfy
- */
- function isNodeInVarOnTop(node, varNode) {
- return varNode &&
- varNode.parent.loc.start.line === node.loc.start.line &&
- varNode.parent.declarations.length > 1;
+ addElementListIndent(node.elements || node.properties, tokens[0], tokens[tokens.length - 1], options[node.type]);
}
/**
- * Check to see if the argument before the callee node is multi-line and
- * there should only be 1 argument before the callee node
- * @param {ASTNode} node node to check
- * @returns {boolean} True if arguments are multi-line
+ * Check and decide whether to check for indentation for blockless nodes
+ * Scenarios are for or while statements without braces around them
+ * @param {ASTNode} node node to examine
+ * @returns {void}
*/
- function isArgBeforeCalleeNodeMultiline(node) {
- const parent = node.parent;
+ function addBlocklessNodeIndent(node) {
+ if (node.type !== "BlockStatement") {
+ const lastParentToken = sourceCode.getTokenBefore(node, astUtils.isNotOpeningParenToken);
- if (parent.arguments.length >= 2 && parent.arguments[1] === node) {
- return parent.arguments[0].loc.end.line > parent.arguments[0].loc.start.line;
- }
+ let bodyTokens = getTokensAndComments(node);
- return false;
+ while (
+ astUtils.isOpeningParenToken(sourceCode.getTokenBefore(bodyTokens[0])) &&
+ astUtils.isClosingParenToken(sourceCode.getTokenAfter(bodyTokens[bodyTokens.length - 1]))
+ ) {
+ bodyTokens = [sourceCode.getTokenBefore(bodyTokens[0])].concat(bodyTokens).concat(sourceCode.getTokenAfter(bodyTokens[bodyTokens.length - 1]));
+ }
+
+ offsets.setDesiredOffsets(bodyTokens, lastParentToken, 1);
+
+ /*
+ * For blockless nodes with semicolon-first style, don't indent the semicolon.
+ * e.g.
+ * if (foo) bar()
+ * ; [1, 2, 3].map(foo)
+ */
+ const lastToken = sourceCode.getLastToken(node);
+
+ if (astUtils.isSemicolonToken(lastToken)) {
+ offsets.matchIndentOf(lastParentToken, lastToken);
+ }
+ }
}
/**
- * Check to see if the node is a file level IIFE
- * @param {ASTNode} node The function node to check.
- * @returns {boolean} True if the node is the outer IIFE
- */
- function isOuterIIFE(node) {
- const parent = node.parent;
- let stmt = parent.parent;
+ * Checks the indentation of a function's parameters
+ * @param {ASTNode} node The node
+ * @param {number} paramsIndent The indentation level option for the parameters
+ * @returns {void}
+ */
+ function addFunctionParamsIndent(node, paramsIndent) {
+ const openingParen = node.params.length ? sourceCode.getTokenBefore(node.params[0]) : sourceCode.getTokenBefore(node.body, 1);
- /*
- * Verify that the node is an IIEF
- */
- if (
- parent.type !== "CallExpression" ||
- parent.callee !== node) {
+ if (!openingParen) {
- return false;
+ // If there is no opening paren (e.g. for an arrow function with a single parameter), don't indent anything.
+ return;
}
- /*
- * Navigate legal ancestors to determine whether this IIEF is outer
- */
- while (
- stmt.type === "UnaryExpression" && (
- stmt.operator === "!" ||
- stmt.operator === "~" ||
- stmt.operator === "+" ||
- stmt.operator === "-") ||
- stmt.type === "AssignmentExpression" ||
- stmt.type === "LogicalExpression" ||
- stmt.type === "SequenceExpression" ||
- stmt.type === "VariableDeclarator") {
-
- stmt = stmt.parent;
- }
+ const closingParen = sourceCode.getTokenBefore(node.body);
+ const nodeTokens = getTokensAndComments(node);
+ const openingParenIndex = lodash.sortedIndexBy(nodeTokens, openingParen, token => token.range[0]);
+ const closingParenIndex = lodash.sortedIndexBy(nodeTokens, closingParen, token => token.range[0]);
- return ((
- stmt.type === "ExpressionStatement" ||
- stmt.type === "VariableDeclaration") &&
- stmt.parent && stmt.parent.type === "Program"
- );
+ parameterParens.add(nodeTokens[openingParenIndex]);
+ parameterParens.add(nodeTokens[closingParenIndex]);
+
+ addElementListIndent(node.params, nodeTokens[openingParenIndex], nodeTokens[closingParenIndex], paramsIndent);
}
/**
- * Check indent for function block content
- * @param {ASTNode} node A BlockStatement node that is inside of a function.
- * @returns {void}
- */
- function checkIndentInFunctionBlock(node) {
+ * Adds indentation for the right-hand side of binary/logical expressions.
+ * @param {ASTNode} node A BinaryExpression or LogicalExpression node
+ * @returns {void}
+ */
+ function addBinaryOrLogicalExpressionIndent(node) {
+ const tokens = getTokensAndComments(node);
+ const operator = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator);
+ const firstTokenAfterOperator = sourceCode.getTokenAfter(operator);
+ const tokensAfterOperator = tokens.slice(lodash.sortedIndexBy(tokens, firstTokenAfterOperator, token => token.range[0]));
/*
- * Search first caller in chain.
- * Ex.:
- *
- * Models <- Identifier
- * .User
- * .find()
- * .exec(function() {
- * // function body
- * });
- *
- * Looks for 'Models'
+ * For backwards compatibility, don't check BinaryExpression indents, e.g.
+ * var foo = bar &&
+ * baz;
*/
- const calleeNode = node.parent; // FunctionExpression
- let indent;
- if (calleeNode.parent &&
- (calleeNode.parent.type === "Property" ||
- calleeNode.parent.type === "ArrayExpression")) {
+ offsets.ignoreToken(operator);
+ offsets.ignoreToken(tokensAfterOperator[0]);
+ offsets.setDesiredOffset(tokensAfterOperator[0], sourceCode.getFirstToken(node), 1);
+ offsets.setDesiredOffsets(tokensAfterOperator, tokensAfterOperator[0], 1);
+ }
- // If function is part of array or object, comma can be put at left
- indent = getNodeIndent(calleeNode, false, false).goodChar;
+ /**
+ * Checks the indentation for nodes that are like function calls (`CallExpression` and `NewExpression`)
+ * @param {ASTNode} node A CallExpression or NewExpression node
+ * @returns {void}
+ */
+ function addFunctionCallIndent(node) {
+ let openingParen;
+
+ if (node.arguments.length) {
+ openingParen = sourceCode.getFirstTokenBetween(node.callee, node.arguments[0], astUtils.isOpeningParenToken);
} else {
-
- // If function is standalone, simple calculate indent
- indent = getNodeIndent(calleeNode).goodChar;
+ openingParen = sourceCode.getLastToken(node, 1);
}
+ const closingParen = sourceCode.getLastToken(node);
- if (calleeNode.parent.type === "CallExpression") {
- const calleeParent = calleeNode.parent;
-
- if (calleeNode.type !== "FunctionExpression" && calleeNode.type !== "ArrowFunctionExpression") {
- if (calleeParent && calleeParent.loc.start.line < node.loc.start.line) {
- indent = getNodeIndent(calleeParent).goodChar;
- }
- } else {
- if (isArgBeforeCalleeNodeMultiline(calleeNode) &&
- calleeParent.callee.loc.start.line === calleeParent.callee.loc.end.line &&
- !isNodeFirstInLine(calleeNode)) {
- indent = getNodeIndent(calleeParent).goodChar;
- }
- }
- }
+ parameterParens.add(openingParen);
+ parameterParens.add(closingParen);
+ offsets.matchIndentOf(sourceCode.getLastToken(node.callee), openingParen);
- // function body indent should be indent + indent size, unless this
- // is a FunctionDeclaration, FunctionExpression, or outer IIFE and the corresponding options are enabled.
- let functionOffset = indentSize;
+ addElementListIndent(node.arguments, openingParen, closingParen, options.CallExpression.arguments);
+ }
- if (options.outerIIFEBody !== null && isOuterIIFE(calleeNode)) {
- functionOffset = options.outerIIFEBody * indentSize;
- } else if (calleeNode.type === "FunctionExpression") {
- functionOffset = options.FunctionExpression.body * indentSize;
- } else if (calleeNode.type === "FunctionDeclaration") {
- functionOffset = options.FunctionDeclaration.body * indentSize;
+ /**
+ * Checks the indentation of ClassDeclarations and ClassExpressions
+ * @param {ASTNode} node A ClassDeclaration or ClassExpression node
+ * @returns {void}
+ */
+ function addClassIndent(node) {
+ if (node.superClass) {
+ const classToken = sourceCode.getFirstToken(node);
+ const extendsToken = sourceCode.getTokenBefore(node.superClass, astUtils.isNotOpeningParenToken);
+
+ offsets.setDesiredOffset(extendsToken, classToken, 1);
+ offsets.setDesiredOffsets(sourceCode.getTokensBetween(extendsToken, node.body, { includeComments: true }), classToken, 1);
}
- indent += functionOffset;
+ }
- // check if the node is inside a variable
- const parentVarNode = getVariableDeclaratorNode(node);
+ /**
+ * Checks the indentation of parenthesized values, given a list of tokens in a program
+ * @param {Token[]} tokens A list of tokens
+ * @returns {void}
+ */
+ function addParensIndent(tokens) {
+ const parenStack = [];
+ const parenPairs = [];
+
+ tokens.forEach(nextToken => {
+
+ // Accumulate a list of parenthesis pairs
+ if (astUtils.isOpeningParenToken(nextToken)) {
+ parenStack.push(nextToken);
+ } else if (astUtils.isClosingParenToken(nextToken)) {
+ parenPairs.unshift({ left: parenStack.pop(), right: nextToken });
+ }
+ });
- if (parentVarNode && isNodeInVarOnTop(node, parentVarNode)) {
- indent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind];
- }
+ parenPairs.forEach(pair => {
+ const leftParen = pair.left;
+ const rightParen = pair.right;
- if (node.body.length > 0) {
- checkNodesIndent(node.body, indent);
- }
+ // We only want to handle parens around expressions, so exclude parentheses that are in function parameters and function call arguments.
+ if (!parameterParens.has(leftParen) && !parameterParens.has(rightParen)) {
+ offsets.setDesiredOffset(sourceCode.getTokenAfter(leftParen), leftParen, 1);
+ }
- checkLastNodeLineIndent(node, indent - functionOffset);
+ offsets.matchIndentOf(leftParen, rightParen);
+ });
}
-
/**
- * Checks if the given node starts and ends on the same line
- * @param {ASTNode} node The node to check
- * @returns {boolean} Whether or not the block starts and ends on the same line.
- */
- function isSingleLineNode(node) {
- const lastToken = sourceCode.getLastToken(node),
- startLine = node.loc.start.line,
- endLine = lastToken.loc.end.line;
-
- return startLine === endLine;
+ * Ignore all tokens within an unknown node whose offset do not depend
+ * on another token's offset within the unknown node
+ * @param {ASTNode} node Unknown Node
+ * @returns {void}
+ */
+ function ignoreUnknownNode(node) {
+ const unknownNodeTokens = new Set(getTokensAndComments(node));
+
+ unknownNodeTokens.forEach(token => {
+ if (!unknownNodeTokens.has(offsets.getFirstDependency(token))) {
+ const firstTokenOfLine = tokenInfo.getFirstTokenOfLine(token);
+
+ if (token === firstTokenOfLine) {
+ offsets.ignoreToken(token);
+ } else {
+ offsets.matchIndentOf(firstTokenOfLine, token);
+ }
+ }
+ });
}
/**
- * Check to see if the first element inside an array is an object and on the same line as the node
- * If the node is not an array then it will return false.
- * @param {ASTNode} node node to check
- * @returns {boolean} success/failure
- */
- function isFirstArrayElementOnSameLine(node) {
- if (node.type === "ArrayExpression" && node.elements[0]) {
- return node.elements[0].loc.start.line === node.loc.start.line && node.elements[0].type === "ObjectExpression";
+ * Ignore node if it is unknown
+ * @param {ASTNode} node Node
+ * @returns {void}
+ */
+ function checkForUnknownNode(node) {
+ const isNodeUnknown = !(KNOWN_NODES.has(node.type));
+
+ if (isNodeUnknown) {
+ ignoreUnknownNode(node);
}
- return false;
-
}
/**
- * Check indent for array block content or object block content
- * @param {ASTNode} node node to examine
- * @returns {void}
+ * Check whether the given token is the first token of a statement.
+ * @param {Token} token The token to check.
+ * @param {ASTNode} leafNode The expression node that the token belongs directly.
+ * @returns {boolean} `true` if the token is the first token of a statement.
*/
- function checkIndentInArrayOrObjectBlock(node) {
-
- // Skip inline
- if (isSingleLineNode(node)) {
- return;
- }
-
- let elements = (node.type === "ArrayExpression") ? node.elements : node.properties;
-
- // filter out empty elements example would be [ , 2] so remove first element as espree considers it as null
- elements = elements.filter(elem => elem !== null);
-
- let nodeIndent;
- let elementsIndent;
- const parentVarNode = getVariableDeclaratorNode(node);
-
- // TODO - come up with a better strategy in future
- if (isNodeFirstInLine(node)) {
- const parent = node.parent;
-
- nodeIndent = getNodeIndent(parent).goodChar;
- if (!parentVarNode || parentVarNode.loc.start.line !== node.loc.start.line) {
- if (parent.type !== "VariableDeclarator" || parentVarNode === parentVarNode.parent.declarations[0]) {
- if (parent.type === "VariableDeclarator" && parentVarNode.loc.start.line === parent.loc.start.line) {
- nodeIndent = nodeIndent + (indentSize * options.VariableDeclarator[parentVarNode.parent.kind]);
- } else if (parent.type === "ObjectExpression" || parent.type === "ArrayExpression") {
- const parentElements = node.parent.type === "ObjectExpression" ? node.parent.properties : node.parent.elements;
-
- if (parentElements[0] && parentElements[0].loc.start.line === parent.loc.start.line && parentElements[0].loc.end.line !== parent.loc.start.line) {
-
- /*
- * If the first element of the array spans multiple lines, don't increase the expected indentation of the rest.
- * e.g. [{
- * foo: 1
- * },
- * {
- * bar: 1
- * }]
- * the second object is not indented.
- */
- } else if (typeof options[parent.type] === "number") {
- nodeIndent += options[parent.type] * indentSize;
- } else {
- nodeIndent = parentElements[0].loc.start.column;
- }
- } else if (parent.type === "CallExpression" || parent.type === "NewExpression") {
- if (typeof options.CallExpression.arguments === "number") {
- nodeIndent += options.CallExpression.arguments * indentSize;
- } else if (options.CallExpression.arguments === "first") {
- if (parent.arguments.indexOf(node) !== -1) {
- nodeIndent = parent.arguments[0].loc.start.column;
- }
- } else {
- nodeIndent += indentSize;
- }
- } else if (parent.type === "LogicalExpression" || parent.type === "ArrowFunctionExpression") {
- nodeIndent += indentSize;
- }
- }
- } else if (!parentVarNode && !isFirstArrayElementOnSameLine(parent) && parent.type !== "MemberExpression" && parent.type !== "ExpressionStatement" && parent.type !== "AssignmentExpression" && parent.type !== "Property") {
- nodeIndent = nodeIndent + indentSize;
- }
+ function isFirstTokenOfStatement(token, leafNode) {
+ let node = leafNode;
- checkFirstNodeLineIndent(node, nodeIndent);
- } else {
- nodeIndent = getNodeIndent(node).goodChar;
+ while (node.parent && !node.parent.type.endsWith("Statement") && !node.parent.type.endsWith("Declaration")) {
+ node = node.parent;
}
+ node = node.parent;
- if (options[node.type] === "first") {
- elementsIndent = elements.length ? elements[0].loc.start.column : 0; // If there are no elements, elementsIndent doesn't matter.
- } else {
- elementsIndent = nodeIndent + indentSize * options[node.type];
- }
+ return !node || node.range[0] === token.range[0];
+ }
- /*
- * Check if the node is a multiple variable declaration; if so, then
- * make sure indentation takes that into account.
- */
- if (isNodeInVarOnTop(node, parentVarNode)) {
- elementsIndent += indentSize * options.VariableDeclarator[parentVarNode.parent.kind];
- }
+ return {
+ ArrayExpression: addArrayOrObjectIndent,
+ ArrayPattern: addArrayOrObjectIndent,
- checkNodesIndent(elements, elementsIndent);
+ ArrowFunctionExpression(node) {
+ addFunctionParamsIndent(node, options.FunctionExpression.parameters);
+ addBlocklessNodeIndent(node.body);
- if (elements.length > 0) {
+ let arrowToken;
- // Skip last block line check if last item in same line
- if (elements[elements.length - 1].loc.end.line === node.loc.end.line) {
- return;
+ if (node.params.length) {
+ arrowToken = sourceCode.getTokenAfter(node.params[node.params.length - 1], astUtils.isArrowToken);
+ } else {
+ arrowToken = sourceCode.getFirstToken(node, astUtils.isArrowToken);
}
- }
+ offsets.matchIndentOf(sourceCode.getFirstToken(node), arrowToken);
+ },
- checkLastNodeLineIndent(node, nodeIndent + (isNodeInVarOnTop(node, parentVarNode) ? options.VariableDeclarator[parentVarNode.parent.kind] * indentSize : 0));
- }
+ AssignmentExpression(node) {
+ const operator = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator);
+ const nodeTokens = getTokensAndComments(node);
+ const tokensFromOperator = nodeTokens.slice(lodash.sortedIndexBy(nodeTokens, operator, token => token.range[0]));
- /**
- * Check if the node or node body is a BlockStatement or not
- * @param {ASTNode} node node to test
- * @returns {boolean} True if it or its body is a block statement
- */
- function isNodeBodyBlock(node) {
- return node.type === "BlockStatement" || node.type === "ClassBody" || (node.body && node.body.type === "BlockStatement") ||
- (node.consequent && node.consequent.type === "BlockStatement");
- }
+ offsets.setDesiredOffsets(tokensFromOperator, sourceCode.getFirstToken(node.left), 1);
+ offsets.ignoreToken(tokensFromOperator[0]);
+ offsets.ignoreToken(tokensFromOperator[1]);
+ },
- /**
- * Check indentation for blocks
- * @param {ASTNode} node node to check
- * @returns {void}
- */
- function blockIndentationCheck(node) {
+ BinaryExpression: addBinaryOrLogicalExpressionIndent,
+
+ BlockStatement: addBlockIndent,
+
+ CallExpression: addFunctionCallIndent,
+
+ ClassBody: addBlockIndent,
+
+ ClassDeclaration: addClassIndent,
+
+ ClassExpression: addClassIndent,
+
+ ConditionalExpression(node) {
+ const firstToken = sourceCode.getFirstToken(node);
+
+ // `flatTernaryExpressions` option is for the following style:
+ // var a =
+ // foo > 0 ? bar :
+ // foo < 0 ? baz :
+ // /*else*/ qiz ;
+ if (!options.flatTernaryExpressions ||
+ !astUtils.isTokenOnSameLine(node.test, node.consequent) ||
+ isFirstTokenOfStatement(firstToken, node)
+ ) {
+ const questionMarkToken = sourceCode.getFirstTokenBetween(node.test, node.consequent, token => token.type === "Punctuator" && token.value === "?");
+ const colonToken = sourceCode.getFirstTokenBetween(node.consequent, node.alternate, token => token.type === "Punctuator" && token.value === ":");
+
+ const consequentTokens = sourceCode.getTokensBetween(questionMarkToken, colonToken, { includeComments: true });
+ const alternateTokens = sourceCode.getTokensAfter(colonToken, token => token.range[1] <= node.range[1]);
+
+ offsets.setDesiredOffset(questionMarkToken, firstToken, 1);
+ offsets.setDesiredOffset(colonToken, firstToken, 1);
+
+ offsets.setDesiredOffset(consequentTokens[0], firstToken, 1);
+
+ /*
+ * The alternate and the consequent should usually have the same indentation.
+ * If they share part of a line, align the alternate against the first token of the consequent.
+ * This allows the alternate to be indented correctly in cases like this:
+ * foo ? (
+ * bar
+ * ) : ( // this '(' is aligned with the '(' above, so it's considered to be aligned with `foo`
+ * baz // as a result, `baz` is offset by 1 rather than 2
+ * )
+ */
+ if (consequentTokens[consequentTokens.length - 1].loc.end.line === alternateTokens[0].loc.start.line) {
+ offsets.matchIndentOf(consequentTokens[0], alternateTokens[0]);
+ } else {
+
+ /**
+ * If the alternate and consequent do not share part of a line, offset the alternate from the first
+ * token of the conditional expression. For example:
+ * foo ? bar
+ * : baz
+ *
+ * If `baz` were aligned with `bar` rather than being offset by 1 from `foo`, `baz` would end up
+ * having no expected indentation.
+ */
+ offsets.setDesiredOffset(alternateTokens[0], firstToken, 1);
+ }
- // Skip inline blocks
- if (isSingleLineNode(node)) {
- return;
- }
+ offsets.setDesiredOffsets(consequentTokens, consequentTokens[0], 0);
+ offsets.setDesiredOffsets(alternateTokens, alternateTokens[0], 0);
+ }
+ },
- if (node.parent && (
- node.parent.type === "FunctionExpression" ||
- node.parent.type === "FunctionDeclaration" ||
- node.parent.type === "ArrowFunctionExpression"
- )) {
- checkIndentInFunctionBlock(node);
- return;
- }
+ DoWhileStatement: node => addBlocklessNodeIndent(node.body),
- let indent;
- let nodesToCheck = [];
+ ExportNamedDeclaration(node) {
+ if (node.declaration === null) {
+ const tokensInNode = getTokensAndComments(node);
+ const closingCurly = sourceCode.getLastToken(node, astUtils.isClosingBraceToken);
+ const closingCurlyIndex = lodash.sortedIndexBy(tokensInNode, closingCurly, token => token.range[0]);
- /*
- * For this statements we should check indent from statement beginning,
- * not from the beginning of the block.
- */
- const statementsWithProperties = [
- "IfStatement", "WhileStatement", "ForStatement", "ForInStatement", "ForOfStatement", "DoWhileStatement", "ClassDeclaration", "TryStatement"
- ];
-
- if (node.parent && statementsWithProperties.indexOf(node.parent.type) !== -1 && isNodeBodyBlock(node)) {
- indent = getNodeIndent(node.parent).goodChar;
- } else if (node.parent && node.parent.type === "CatchClause") {
- indent = getNodeIndent(node.parent.parent).goodChar;
- } else {
- indent = getNodeIndent(node).goodChar;
- }
+ // Indent the specifiers in `export {foo, bar, baz}`
+ addElementListIndent(node.specifiers, sourceCode.getFirstToken(node, { skip: 1 }), closingCurly, 1);
- if (node.type === "IfStatement" && node.consequent.type !== "BlockStatement") {
- nodesToCheck = [node.consequent];
- } else if (Array.isArray(node.body)) {
- nodesToCheck = node.body;
- } else {
- nodesToCheck = [node.body];
- }
+ if (node.source) {
- if (nodesToCheck.length > 0) {
- checkNodesIndent(nodesToCheck, indent + indentSize);
- }
+ // Indent everything after and including the `from` token in `export {foo, bar, baz} from 'qux'`
+ offsets.setDesiredOffsets(tokensInNode.slice(closingCurlyIndex + 1), sourceCode.getFirstToken(node), 1);
+ }
+ }
+ },
- if (node.type === "BlockStatement") {
- checkLastNodeLineIndent(node, indent);
- }
- }
+ ForInStatement: node => addBlocklessNodeIndent(node.body),
- /**
- * Filter out the elements which are on the same line of each other or the node.
- * basically have only 1 elements from each line except the variable declaration line.
- * @param {ASTNode} node Variable declaration node
- * @returns {ASTNode[]} Filtered elements
- */
- function filterOutSameLineVars(node) {
- return node.declarations.reduce((finalCollection, elem) => {
- const lastElem = finalCollection[finalCollection.length - 1];
+ ForOfStatement: node => addBlocklessNodeIndent(node.body),
+
+ ForStatement(node) {
+ const forOpeningParen = sourceCode.getFirstToken(node, 1);
- if ((elem.loc.start.line !== node.loc.start.line && !lastElem) ||
- (lastElem && lastElem.loc.start.line !== elem.loc.start.line)) {
- finalCollection.push(elem);
+ if (node.init) {
+ offsets.setDesiredOffsets(getTokensAndComments(node.init), forOpeningParen, 1);
+ }
+ if (node.test) {
+ offsets.setDesiredOffsets(getTokensAndComments(node.test), forOpeningParen, 1);
}
+ if (node.update) {
+ offsets.setDesiredOffsets(getTokensAndComments(node.update), forOpeningParen, 1);
+ }
+ addBlocklessNodeIndent(node.body);
+ },
- return finalCollection;
- }, []);
- }
+ FunctionDeclaration(node) {
+ addFunctionParamsIndent(node, options.FunctionDeclaration.parameters);
+ },
- /**
- * Check indentation for variable declarations
- * @param {ASTNode} node node to examine
- * @returns {void}
- */
- function checkIndentInVariableDeclarations(node) {
- const elements = filterOutSameLineVars(node);
- const nodeIndent = getNodeIndent(node).goodChar;
- const lastElement = elements[elements.length - 1];
+ FunctionExpression(node) {
+ addFunctionParamsIndent(node, options.FunctionExpression.parameters);
+ },
- const elementsIndent = nodeIndent + indentSize * options.VariableDeclarator[node.kind];
+ IfStatement(node) {
+ addBlocklessNodeIndent(node.consequent);
+ if (node.alternate && node.alternate.type !== "IfStatement") {
+ addBlocklessNodeIndent(node.alternate);
+ }
+ },
- checkNodesIndent(elements, elementsIndent);
+ ImportDeclaration(node) {
+ if (node.specifiers.some(specifier => specifier.type === "ImportSpecifier")) {
+ const openingCurly = sourceCode.getFirstToken(node, astUtils.isOpeningBraceToken);
+ const closingCurly = sourceCode.getLastToken(node, astUtils.isClosingBraceToken);
- // Only check the last line if there is any token after the last item
- if (sourceCode.getLastToken(node).loc.end.line <= lastElement.loc.end.line) {
- return;
- }
+ addElementListIndent(node.specifiers.filter(specifier => specifier.type === "ImportSpecifier"), openingCurly, closingCurly, 1);
+ }
- const tokenBeforeLastElement = sourceCode.getTokenBefore(lastElement);
+ const fromToken = sourceCode.getLastToken(node, token => token.type === "Identifier" && token.value === "from");
- if (tokenBeforeLastElement.value === ",") {
+ if (fromToken) {
+ const tokensToOffset = sourceCode.getTokensBetween(fromToken, sourceCode.getLastToken(node), 1);
- // Special case for comma-first syntax where the semicolon is indented
- checkLastNodeLineIndent(node, getNodeIndent(tokenBeforeLastElement).goodChar);
- } else {
- checkLastNodeLineIndent(node, elementsIndent - indentSize);
- }
- }
+ offsets.setDesiredOffsets(tokensToOffset, sourceCode.getFirstToken(node), 1);
+ }
+ },
- /**
- * Check and decide whether to check for indentation for blockless nodes
- * Scenarios are for or while statements without braces around them
- * @param {ASTNode} node node to examine
- * @returns {void}
- */
- function blockLessNodes(node) {
- if (node.body.type !== "BlockStatement") {
- blockIndentationCheck(node);
- }
- }
+ LogicalExpression: addBinaryOrLogicalExpressionIndent,
- /**
- * Returns the expected indentation for the case statement
- * @param {ASTNode} node node to examine
- * @param {int} [switchIndent] indent for switch statement
- * @returns {int} indent size
- */
- function expectedCaseIndent(node, switchIndent) {
- const switchNode = (node.type === "SwitchStatement") ? node : node.parent;
- let caseIndent;
+ "MemberExpression, JSXMemberExpression"(node) {
+ const firstNonObjectToken = sourceCode.getFirstTokenBetween(node.object, node.property, astUtils.isNotClosingParenToken);
+ const secondNonObjectToken = sourceCode.getTokenAfter(firstNonObjectToken);
- if (caseIndentStore[switchNode.loc.start.line]) {
- return caseIndentStore[switchNode.loc.start.line];
- }
- if (typeof switchIndent === "undefined") {
- switchIndent = getNodeIndent(switchNode).goodChar;
- }
+ const tokenBeforeObject = sourceCode.getTokenBefore(node.object, token => astUtils.isNotOpeningParenToken(token) || parameterParens.has(token));
+ const firstObjectToken = tokenBeforeObject ? sourceCode.getTokenAfter(tokenBeforeObject) : sourceCode.ast.tokens[0];
+ const lastObjectToken = sourceCode.getTokenBefore(firstNonObjectToken);
- if (switchNode.cases.length > 0 && options.SwitchCase === 0) {
- caseIndent = switchIndent;
- } else {
- caseIndent = switchIndent + (indentSize * options.SwitchCase);
- }
+ if (node.computed) {
- caseIndentStore[switchNode.loc.start.line] = caseIndent;
- return caseIndent;
+ // For computed MemberExpressions, match the closing bracket with the opening bracket.
+ offsets.matchIndentOf(firstNonObjectToken, sourceCode.getLastToken(node));
+ }
- }
+ if (typeof options.MemberExpression === "number") {
+ const firstPropertyToken = node.computed ? firstNonObjectToken : secondNonObjectToken;
+
+ /*
+ * If the object ends on the same line that the property starts, match against the last token
+ * of the object, to ensure that the MemberExpression is not indented.
+ *
+ * Otherwise, match against the first token of the object, e.g.
+ * foo
+ * .bar
+ * .baz // <-- offset by 1 from `foo`
+ */
+ const offsetBase = lastObjectToken.loc.end.line === firstPropertyToken.loc.start.line
+ ? lastObjectToken
+ : firstObjectToken;
+
+ // Match the dot (for non-computed properties) or the opening bracket (for computed properties) against the object.
+ offsets.setDesiredOffset(firstNonObjectToken, offsetBase, options.MemberExpression);
+
+ /*
+ * For computed MemberExpressions, match the first token of the property against the opening bracket.
+ * Otherwise, match the first token of the property against the object.
+ */
+ offsets.setDesiredOffset(secondNonObjectToken, node.computed ? firstNonObjectToken : offsetBase, options.MemberExpression);
+ } else {
- /**
- * Checks wether a return statement is wrapped in ()
- * @param {ASTNode} node node to examine
- * @returns {boolean} the result
- */
- function isWrappedInParenthesis(node) {
- const regex = /^return\s*?\(\s*?\);*?/;
+ // If the MemberExpression option is off, ignore the dot and the first token of the property.
+ offsets.ignoreToken(firstNonObjectToken);
+ offsets.ignoreToken(secondNonObjectToken);
+ offsets.matchIndentOf(firstNonObjectToken, secondNonObjectToken);
+ }
+ },
- const statementWithoutArgument = sourceCode.getText(node).replace(
- sourceCode.getText(node.argument), "");
+ NewExpression(node) {
- return regex.test(statementWithoutArgument);
- }
+ // Only indent the arguments if the NewExpression has parens (e.g. `new Foo(bar)` or `new Foo()`, but not `new Foo`
+ if (node.arguments.length > 0 || astUtils.isClosingParenToken(sourceCode.getLastToken(node)) && astUtils.isOpeningParenToken(sourceCode.getLastToken(node, 1))) {
+ addFunctionCallIndent(node);
+ }
+ },
- return {
- Program(node) {
- if (node.body.length > 0) {
+ ObjectExpression: addArrayOrObjectIndent,
+ ObjectPattern: addArrayOrObjectIndent,
+
+ Property(node) {
+ if (!node.computed && !node.shorthand && !node.method && node.kind === "init") {
+ const colon = sourceCode.getFirstTokenBetween(node.key, node.value, astUtils.isColonToken);
- // Root nodes should have no indent
- checkNodesIndent(node.body, getNodeIndent(node).goodChar);
+ offsets.ignoreToken(sourceCode.getTokenAfter(colon));
}
},
- ClassBody: blockIndentationCheck,
+ SwitchStatement(node) {
+ const tokens = getTokensAndComments(node);
+ const openingCurlyIndex = tokens.findIndex(token => token.range[0] >= node.discriminant.range[1] && astUtils.isOpeningBraceToken(token));
- BlockStatement: blockIndentationCheck,
+ offsets.setDesiredOffsets(tokens.slice(openingCurlyIndex + 1, -1), tokens[openingCurlyIndex], options.SwitchCase);
- WhileStatement: blockLessNodes,
+ const caseKeywords = new WeakSet(node.cases.map(switchCase => sourceCode.getFirstToken(switchCase)));
+ const lastCaseKeyword = node.cases.length && sourceCode.getFirstToken(node.cases[node.cases.length - 1]);
+ const casesWithBlocks = new WeakSet(
+ node.cases
+ .filter(switchCase => switchCase.consequent.length === 1 && switchCase.consequent[0].type === "BlockStatement")
+ .map(switchCase => sourceCode.getFirstToken(switchCase))
+ );
+ let lastAnchor = tokens[openingCurlyIndex];
+
+ tokens.slice(openingCurlyIndex + 1, -1).forEach(token => {
+ if (caseKeywords.has(token)) {
+ lastAnchor = token;
+ } else if (lastAnchor === lastCaseKeyword && (token.type === "Line" || token.type === "Block")) {
+ offsets.ignoreToken(token);
+ } else if (!casesWithBlocks.has(lastAnchor)) {
+ offsets.setDesiredOffset(token, lastAnchor, 1);
+ }
+ });
+ },
- ForStatement: blockLessNodes,
+ TemplateLiteral(node) {
+ const tokens = getTokensAndComments(node);
- ForInStatement: blockLessNodes,
+ offsets.setDesiredOffsets(getTokensAndComments(node.quasis[0]), tokens[0], 0);
+ node.expressions.forEach((expression, index) => {
+ const previousQuasi = node.quasis[index];
+ const nextQuasi = node.quasis[index + 1];
+ const tokenToAlignFrom = previousQuasi.loc.start.line === previousQuasi.loc.end.line ? sourceCode.getFirstToken(previousQuasi) : null;
- ForOfStatement: blockLessNodes,
+ offsets.setDesiredOffsets(sourceCode.getTokensBetween(previousQuasi, nextQuasi), tokenToAlignFrom, 1);
+ offsets.setDesiredOffset(sourceCode.getFirstToken(nextQuasi), tokenToAlignFrom, 0);
+ });
+ },
+
+ VariableDeclaration(node) {
+ const variableIndent = options.VariableDeclarator.hasOwnProperty(node.kind) ? options.VariableDeclarator[node.kind] : DEFAULT_VARIABLE_INDENT;
- DoWhileStatement: blockLessNodes,
+ offsets.setDesiredOffsets(getTokensAndComments(node), sourceCode.getFirstToken(node), variableIndent);
+ const lastToken = sourceCode.getLastToken(node);
- IfStatement(node) {
- if (node.consequent.type !== "BlockStatement" && node.consequent.loc.start.line > node.loc.start.line) {
- blockIndentationCheck(node);
+ if (astUtils.isSemicolonToken(lastToken)) {
+ offsets.ignoreToken(lastToken);
}
},
- VariableDeclaration(node) {
- if (node.declarations[node.declarations.length - 1].loc.start.line > node.declarations[0].loc.start.line) {
- checkIndentInVariableDeclarations(node);
+ VariableDeclarator(node) {
+ if (node.init) {
+ const equalOperator = sourceCode.getTokenBefore(node.init, astUtils.isNotOpeningParenToken);
+ const tokenAfterOperator = sourceCode.getTokenAfter(equalOperator);
+
+ offsets.ignoreToken(equalOperator);
+ offsets.ignoreToken(tokenAfterOperator);
+ offsets.matchIndentOf(equalOperator, tokenAfterOperator);
}
},
- ObjectExpression(node) {
- checkIndentInArrayOrObjectBlock(node);
+ "VariableDeclarator:exit"(node) {
+
+ /*
+ * VariableDeclarator indentation is a bit different from other forms of indentation, in that the
+ * indentation of an opening bracket sometimes won't match that of a closing bracket. For example,
+ * the following indentations are correct:
+ *
+ * var foo = {
+ * ok: true
+ * };
+ *
+ * var foo = {
+ * ok: true,
+ * },
+ * bar = 1;
+ *
+ * Account for when exiting the AST (after indentations have already been set for the nodes in
+ * the declaration) by manually increasing the indentation level of the tokens in the first declarator if the
+ * parent declaration has more than one declarator.
+ */
+ if (node.parent.declarations.length > 1 && node.parent.declarations[0] === node && node.init) {
+ const valueTokens = new Set(getTokensAndComments(node.init));
+
+ valueTokens.forEach(token => {
+ if (!valueTokens.has(offsets.getFirstDependency(token))) {
+ offsets.increaseOffset(token, options.VariableDeclarator[node.parent.kind]);
+ }
+ });
+ }
},
- ArrayExpression(node) {
- checkIndentInArrayOrObjectBlock(node);
- },
+ WhileStatement: node => addBlocklessNodeIndent(node.body),
- MemberExpression(node) {
+ "*:exit": checkForUnknownNode,
- if (typeof options.MemberExpression === "undefined") {
- return;
- }
+ "JSXAttribute[value]"(node) {
+ const equalsToken = sourceCode.getFirstTokenBetween(node.name, node.value, token => token.type === "Punctuator" && token.value === "=");
+ const firstNameToken = sourceCode.getFirstToken(node.name);
- if (isSingleLineNode(node)) {
- return;
- }
+ offsets.setDesiredOffset(equalsToken, firstNameToken, 1);
+ offsets.setDesiredOffset(sourceCode.getFirstToken(node.value), firstNameToken, 1);
+ },
- // The typical layout of variable declarations and assignments
- // alter the expectation of correct indentation. Skip them.
- // TODO: Add appropriate configuration options for variable
- // declarations and assignments.
- if (getParentNodeByType(node, "VariableDeclarator", ["FunctionExpression", "ArrowFunctionExpression"])) {
- return;
+ JSXElement(node) {
+ if (node.closingElement) {
+ addElementListIndent(node.children, sourceCode.getFirstToken(node.openingElement), sourceCode.getFirstToken(node.closingElement), 1);
}
+ },
- if (getParentNodeByType(node, "AssignmentExpression", ["FunctionExpression"])) {
- return;
+ JSXOpeningElement(node) {
+ const firstToken = sourceCode.getFirstToken(node);
+ let closingToken;
+
+ if (node.selfClosing) {
+ closingToken = sourceCode.getLastToken(node, { skip: 1 });
+ offsets.matchIndentOf(closingToken, sourceCode.getLastToken(node));
+ } else {
+ closingToken = sourceCode.getLastToken(node);
}
+ offsets.setDesiredOffsets(getTokensAndComments(node.name), sourceCode.getFirstToken(node));
+ addElementListIndent(node.attributes, firstToken, closingToken, 1);
+ },
- const propertyIndent = getNodeIndent(node).goodChar + indentSize * options.MemberExpression;
+ JSXClosingElement(node) {
+ const firstToken = sourceCode.getFirstToken(node);
- const checkNodes = [node.property];
+ offsets.setDesiredOffsets(getTokensAndComments(node.name), firstToken, 1);
+ offsets.matchIndentOf(firstToken, sourceCode.getLastToken(node));
+ },
- const dot = context.getTokenBefore(node.property);
+ JSXExpressionContainer(node) {
+ const openingCurly = sourceCode.getFirstToken(node);
+ const firstExpressionToken = sourceCode.getFirstToken(node.expression);
- if (dot.type === "Punctuator" && dot.value === ".") {
- checkNodes.push(dot);
+ if (firstExpressionToken) {
+ offsets.setDesiredOffset(firstExpressionToken, openingCurly, 1);
}
- checkNodesIndent(checkNodes, propertyIndent);
+ offsets.matchIndentOf(openingCurly, sourceCode.getLastToken(node));
},
- SwitchStatement(node) {
-
- // Switch is not a 'BlockStatement'
- const switchIndent = getNodeIndent(node).goodChar;
- const caseIndent = expectedCaseIndent(node, switchIndent);
+ "Program:exit"() {
+ addParensIndent(sourceCode.ast.tokens);
- checkNodesIndent(node.cases, caseIndent);
+ /*
+ * Create a Map from (tokenOrComment) => (precedingToken).
+ * This is necessary because sourceCode.getTokenBefore does not handle a comment as an argument correctly.
+ */
+ const precedingTokens = sourceCode.ast.comments.reduce((commentMap, comment) => {
+ const tokenOrCommentBefore = sourceCode.getTokenBefore(comment, { includeComments: true });
+ return commentMap.set(comment, commentMap.has(tokenOrCommentBefore) ? commentMap.get(tokenOrCommentBefore) : tokenOrCommentBefore);
+ }, new WeakMap());
- checkLastNodeLineIndent(node, switchIndent);
- },
+ sourceCode.lines.forEach((line, lineIndex) => {
+ const lineNumber = lineIndex + 1;
- SwitchCase(node) {
+ if (!tokenInfo.firstTokensByLineNumber.has(lineNumber)) {
- // Skip inline cases
- if (isSingleLineNode(node)) {
- return;
- }
- const caseIndent = expectedCaseIndent(node);
+ // Don't check indentation on blank lines
+ return;
+ }
- checkNodesIndent(node.consequent, caseIndent + indentSize);
- },
+ const firstTokenOfLine = tokenInfo.firstTokensByLineNumber.get(lineNumber);
- FunctionDeclaration(node) {
- if (isSingleLineNode(node)) {
- return;
- }
- if (options.FunctionDeclaration.parameters === "first" && node.params.length) {
- checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column);
- } else if (options.FunctionDeclaration.parameters !== null) {
- checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionDeclaration.parameters);
- }
- },
+ if (firstTokenOfLine.loc.start.line !== lineNumber) {
- FunctionExpression(node) {
- if (isSingleLineNode(node)) {
- return;
- }
- if (options.FunctionExpression.parameters === "first" && node.params.length) {
- checkNodesIndent(node.params.slice(1), node.params[0].loc.start.column);
- } else if (options.FunctionExpression.parameters !== null) {
- checkNodesIndent(node.params, getNodeIndent(node).goodChar + indentSize * options.FunctionExpression.parameters);
- }
- },
+ // Don't check the indentation of multi-line tokens (e.g. template literals or block comments) twice.
+ return;
+ }
- ReturnStatement(node) {
- if (isSingleLineNode(node)) {
- return;
- }
+ // If the token matches the expected expected indentation, don't report it.
+ if (validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(firstTokenOfLine))) {
+ return;
+ }
- const firstLineIndent = getNodeIndent(node).goodChar;
+ if (astUtils.isCommentToken(firstTokenOfLine)) {
+ const tokenBefore = precedingTokens.get(firstTokenOfLine);
+ const tokenAfter = tokenBefore ? sourceCode.getTokenAfter(tokenBefore) : sourceCode.ast.tokens[0];
- // in case if return statement is wrapped in parenthesis
- if (isWrappedInParenthesis(node)) {
- checkLastReturnStatementLineIndent(node, firstLineIndent);
- } else {
- checkNodeIndent(node, firstLineIndent);
- }
- },
+ // If a comment matches the expected indentation of the token immediately before or after, don't report it.
+ if (
+ tokenBefore && validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(tokenBefore)) ||
+ tokenAfter && validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(tokenAfter))
+ ) {
+ return;
+ }
+ }
- CallExpression(node) {
- if (isSingleLineNode(node)) {
- return;
- }
- if (options.CallExpression.arguments === "first" && node.arguments.length) {
- checkNodesIndent(node.arguments.slice(1), node.arguments[0].loc.start.column);
- } else if (options.CallExpression.arguments !== null) {
- checkNodesIndent(node.arguments, getNodeIndent(node).goodChar + indentSize * options.CallExpression.arguments);
- }
+ // Otherwise, report the token/comment.
+ report(firstTokenOfLine, offsets.getDesiredIndent(firstTokenOfLine));
+ });
}
};
diff --git a/tools/eslint/lib/rules/key-spacing.js b/tools/eslint/lib/rules/key-spacing.js
index ce150753b849b6..03f45a6c679624 100644
--- a/tools/eslint/lib/rules/key-spacing.js
+++ b/tools/eslint/lib/rules/key-spacing.js
@@ -33,41 +33,6 @@ function last(arr) {
return arr[arr.length - 1];
}
-/**
- * Checks whether a property is a member of the property group it follows.
- * @param {ASTNode} lastMember The last Property known to be in the group.
- * @param {ASTNode} candidate The next Property that might be in the group.
- * @returns {boolean} True if the candidate property is part of the group.
- */
-function continuesPropertyGroup(lastMember, candidate) {
- const groupEndLine = lastMember.loc.start.line,
- candidateStartLine = candidate.loc.start.line;
-
- if (candidateStartLine - groupEndLine <= 1) {
- return true;
- }
-
- // Check that the first comment is adjacent to the end of the group, the
- // last comment is adjacent to the candidate property, and that successive
- // comments are adjacent to each other.
- const comments = candidate.leadingComments;
-
- if (
- comments &&
- comments[0].loc.start.line - groupEndLine <= 1 &&
- candidateStartLine - last(comments).loc.end.line <= 1
- ) {
- for (let i = 1; i < comments.length; i++) {
- if (comments[i].loc.start.line - comments[i - 1].loc.end.line > 1) {
- return false;
- }
- }
- return true;
- }
-
- return false;
-}
-
/**
* Checks whether a node is contained on a single line.
* @param {ASTNode} node AST Node being evaluated.
@@ -350,6 +315,41 @@ module.exports = {
const sourceCode = context.getSourceCode();
+ /**
+ * Checks whether a property is a member of the property group it follows.
+ * @param {ASTNode} lastMember The last Property known to be in the group.
+ * @param {ASTNode} candidate The next Property that might be in the group.
+ * @returns {boolean} True if the candidate property is part of the group.
+ */
+ function continuesPropertyGroup(lastMember, candidate) {
+ const groupEndLine = lastMember.loc.start.line,
+ candidateStartLine = candidate.loc.start.line;
+
+ if (candidateStartLine - groupEndLine <= 1) {
+ return true;
+ }
+
+ // Check that the first comment is adjacent to the end of the group, the
+ // last comment is adjacent to the candidate property, and that successive
+ // comments are adjacent to each other.
+ const leadingComments = sourceCode.getCommentsBefore(candidate);
+
+ if (
+ leadingComments.length &&
+ leadingComments[0].loc.start.line - groupEndLine <= 1 &&
+ candidateStartLine - last(leadingComments).loc.end.line <= 1
+ ) {
+ for (let i = 1; i < leadingComments.length; i++) {
+ if (leadingComments[i].loc.start.line - leadingComments[i - 1].loc.end.line > 1) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Determines if the given property is key-value property.
* @param {ASTNode} property Property node to check.
@@ -634,6 +634,5 @@ module.exports = {
};
-
}
};
diff --git a/tools/eslint/lib/rules/line-comment-position.js b/tools/eslint/lib/rules/line-comment-position.js
index dd8f2b9ad6aa91..0df806cca8cdeb 100644
--- a/tools/eslint/lib/rules/line-comment-position.js
+++ b/tools/eslint/lib/rules/line-comment-position.js
@@ -78,33 +78,37 @@ module.exports = {
//--------------------------------------------------------------------------
return {
- LineComment(node) {
- if (applyDefaultIgnorePatterns && (defaultIgnoreRegExp.test(node.value) || fallThroughRegExp.test(node.value))) {
- return;
- }
-
- if (ignorePattern && customIgnoreRegExp.test(node.value)) {
- return;
- }
-
- const previous = sourceCode.getTokenBefore(node, { includeComments: true });
- const isOnSameLine = previous && previous.loc.end.line === node.loc.start.line;
-
- if (above) {
- if (isOnSameLine) {
- context.report({
- node,
- message: "Expected comment to be above code."
- });
+ Program() {
+ const comments = sourceCode.getAllComments();
+
+ comments.filter(token => token.type === "Line").forEach(node => {
+ if (applyDefaultIgnorePatterns && (defaultIgnoreRegExp.test(node.value) || fallThroughRegExp.test(node.value))) {
+ return;
+ }
+
+ if (ignorePattern && customIgnoreRegExp.test(node.value)) {
+ return;
}
- } else {
- if (!isOnSameLine) {
- context.report({
- node,
- message: "Expected comment to be beside code."
- });
+
+ const previous = sourceCode.getTokenBefore(node, { includeComments: true });
+ const isOnSameLine = previous && previous.loc.end.line === node.loc.start.line;
+
+ if (above) {
+ if (isOnSameLine) {
+ context.report({
+ node,
+ message: "Expected comment to be above code."
+ });
+ }
+ } else {
+ if (!isOnSameLine) {
+ context.report({
+ node,
+ message: "Expected comment to be beside code."
+ });
+ }
}
- }
+ });
}
};
}
diff --git a/tools/eslint/lib/rules/lines-around-comment.js b/tools/eslint/lib/rules/lines-around-comment.js
index e37dd8611ddc8b..5b4cd8ebe92c05 100644
--- a/tools/eslint/lib/rules/lines-around-comment.js
+++ b/tools/eslint/lib/rules/lines-around-comment.js
@@ -31,7 +31,7 @@ function getEmptyLineNums(lines) {
/**
* Return an array with with any line numbers that contain comments.
- * @param {Array} comments An array of comment nodes.
+ * @param {Array} comments An array of comment tokens.
* @returns {Array} An array of line numbers.
*/
function getCommentLineNums(comments) {
@@ -131,38 +131,28 @@ module.exports = {
emptyLines = getEmptyLineNums(lines),
commentAndEmptyLines = commentLines.concat(emptyLines);
- /**
- * Returns whether or not a token is a comment node type
- * @param {Token} token The token to check
- * @returns {boolean} True if the token is a comment node
- */
- function isCommentNodeType(token) {
- return token && (token.type === "Block" || token.type === "Line");
- }
-
/**
* Returns whether or not comments are on lines starting with or ending with code
- * @param {ASTNode} node The comment node to check.
+ * @param {token} token The comment token to check.
* @returns {boolean} True if the comment is not alone.
*/
- function codeAroundComment(node) {
- let token;
+ function codeAroundComment(token) {
+ let currentToken = token;
- token = node;
do {
- token = sourceCode.getTokenBefore(token, { includeComments: true });
- } while (isCommentNodeType(token));
+ currentToken = sourceCode.getTokenBefore(currentToken, { includeComments: true });
+ } while (currentToken && astUtils.isCommentToken(currentToken));
- if (token && astUtils.isTokenOnSameLine(token, node)) {
+ if (currentToken && astUtils.isTokenOnSameLine(currentToken, token)) {
return true;
}
- token = node;
+ currentToken = token;
do {
- token = sourceCode.getTokenAfter(token, { includeComments: true });
- } while (isCommentNodeType(token));
+ currentToken = sourceCode.getTokenAfter(currentToken, { includeComments: true });
+ } while (currentToken && astUtils.isCommentToken(currentToken));
- if (token && astUtils.isTokenOnSameLine(node, token)) {
+ if (currentToken && astUtils.isTokenOnSameLine(token, currentToken)) {
return true;
}
@@ -171,137 +161,135 @@ module.exports = {
/**
* Returns whether or not comments are inside a node type or not.
- * @param {ASTNode} node The Comment node.
* @param {ASTNode} parent The Comment parent node.
* @param {string} nodeType The parent type to check against.
* @returns {boolean} True if the comment is inside nodeType.
*/
- function isCommentInsideNodeType(node, parent, nodeType) {
+ function isParentNodeType(parent, nodeType) {
return parent.type === nodeType ||
(parent.body && parent.body.type === nodeType) ||
(parent.consequent && parent.consequent.type === nodeType);
}
+ /**
+ * Returns the parent node that contains the given token.
+ * @param {token} token The token to check.
+ * @returns {ASTNode} The parent node that contains the given token.
+ */
+ function getParentNodeOfToken(token) {
+ return sourceCode.getNodeByRangeIndex(token.range[0]);
+ }
+
/**
* Returns whether or not comments are at the parent start or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @param {string} nodeType The parent type to check against.
* @returns {boolean} True if the comment is at parent start.
*/
- function isCommentAtParentStart(node, nodeType) {
- const ancestors = context.getAncestors();
- let parent;
+ function isCommentAtParentStart(token, nodeType) {
+ const parent = getParentNodeOfToken(token);
- if (ancestors.length) {
- parent = ancestors.pop();
- }
-
- return parent && isCommentInsideNodeType(node, parent, nodeType) &&
- node.loc.start.line - parent.loc.start.line === 1;
+ return parent && isParentNodeType(parent, nodeType) &&
+ token.loc.start.line - parent.loc.start.line === 1;
}
/**
* Returns whether or not comments are at the parent end or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @param {string} nodeType The parent type to check against.
* @returns {boolean} True if the comment is at parent end.
*/
- function isCommentAtParentEnd(node, nodeType) {
- const ancestors = context.getAncestors();
- let parent;
-
- if (ancestors.length) {
- parent = ancestors.pop();
- }
+ function isCommentAtParentEnd(token, nodeType) {
+ const parent = getParentNodeOfToken(token);
- return parent && isCommentInsideNodeType(node, parent, nodeType) &&
- parent.loc.end.line - node.loc.end.line === 1;
+ return parent && isParentNodeType(parent, nodeType) &&
+ parent.loc.end.line - token.loc.end.line === 1;
}
/**
* Returns whether or not comments are at the block start or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @returns {boolean} True if the comment is at block start.
*/
- function isCommentAtBlockStart(node) {
- return isCommentAtParentStart(node, "ClassBody") || isCommentAtParentStart(node, "BlockStatement") || isCommentAtParentStart(node, "SwitchCase");
+ function isCommentAtBlockStart(token) {
+ return isCommentAtParentStart(token, "ClassBody") || isCommentAtParentStart(token, "BlockStatement") || isCommentAtParentStart(token, "SwitchCase");
}
/**
* Returns whether or not comments are at the block end or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @returns {boolean} True if the comment is at block end.
*/
- function isCommentAtBlockEnd(node) {
- return isCommentAtParentEnd(node, "ClassBody") || isCommentAtParentEnd(node, "BlockStatement") || isCommentAtParentEnd(node, "SwitchCase") || isCommentAtParentEnd(node, "SwitchStatement");
+ function isCommentAtBlockEnd(token) {
+ return isCommentAtParentEnd(token, "ClassBody") || isCommentAtParentEnd(token, "BlockStatement") || isCommentAtParentEnd(token, "SwitchCase") || isCommentAtParentEnd(token, "SwitchStatement");
}
/**
* Returns whether or not comments are at the object start or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @returns {boolean} True if the comment is at object start.
*/
- function isCommentAtObjectStart(node) {
- return isCommentAtParentStart(node, "ObjectExpression") || isCommentAtParentStart(node, "ObjectPattern");
+ function isCommentAtObjectStart(token) {
+ return isCommentAtParentStart(token, "ObjectExpression") || isCommentAtParentStart(token, "ObjectPattern");
}
/**
* Returns whether or not comments are at the object end or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @returns {boolean} True if the comment is at object end.
*/
- function isCommentAtObjectEnd(node) {
- return isCommentAtParentEnd(node, "ObjectExpression") || isCommentAtParentEnd(node, "ObjectPattern");
+ function isCommentAtObjectEnd(token) {
+ return isCommentAtParentEnd(token, "ObjectExpression") || isCommentAtParentEnd(token, "ObjectPattern");
}
/**
* Returns whether or not comments are at the array start or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @returns {boolean} True if the comment is at array start.
*/
- function isCommentAtArrayStart(node) {
- return isCommentAtParentStart(node, "ArrayExpression") || isCommentAtParentStart(node, "ArrayPattern");
+ function isCommentAtArrayStart(token) {
+ return isCommentAtParentStart(token, "ArrayExpression") || isCommentAtParentStart(token, "ArrayPattern");
}
/**
* Returns whether or not comments are at the array end or not.
- * @param {ASTNode} node The Comment node.
+ * @param {token} token The Comment token.
* @returns {boolean} True if the comment is at array end.
*/
- function isCommentAtArrayEnd(node) {
- return isCommentAtParentEnd(node, "ArrayExpression") || isCommentAtParentEnd(node, "ArrayPattern");
+ function isCommentAtArrayEnd(token) {
+ return isCommentAtParentEnd(token, "ArrayExpression") || isCommentAtParentEnd(token, "ArrayPattern");
}
/**
- * Checks if a comment node has lines around it (ignores inline comments)
- * @param {ASTNode} node The Comment node.
+ * Checks if a comment token has lines around it (ignores inline comments)
+ * @param {token} token The Comment token.
* @param {Object} opts Options to determine the newline.
* @param {boolean} opts.after Should have a newline after this line.
* @param {boolean} opts.before Should have a newline before this line.
* @returns {void}
*/
- function checkForEmptyLine(node, opts) {
- if (applyDefaultIgnorePatterns && defaultIgnoreRegExp.test(node.value)) {
+ function checkForEmptyLine(token, opts) {
+ if (applyDefaultIgnorePatterns && defaultIgnoreRegExp.test(token.value)) {
return;
}
- if (ignorePattern && customIgnoreRegExp.test(node.value)) {
+ if (ignorePattern && customIgnoreRegExp.test(token.value)) {
return;
}
let after = opts.after,
before = opts.before;
- const prevLineNum = node.loc.start.line - 1,
- nextLineNum = node.loc.end.line + 1,
- commentIsNotAlone = codeAroundComment(node);
+ const prevLineNum = token.loc.start.line - 1,
+ nextLineNum = token.loc.end.line + 1,
+ commentIsNotAlone = codeAroundComment(token);
- const blockStartAllowed = options.allowBlockStart && isCommentAtBlockStart(node),
- blockEndAllowed = options.allowBlockEnd && isCommentAtBlockEnd(node),
- objectStartAllowed = options.allowObjectStart && isCommentAtObjectStart(node),
- objectEndAllowed = options.allowObjectEnd && isCommentAtObjectEnd(node),
- arrayStartAllowed = options.allowArrayStart && isCommentAtArrayStart(node),
- arrayEndAllowed = options.allowArrayEnd && isCommentAtArrayEnd(node);
+ const blockStartAllowed = options.allowBlockStart && isCommentAtBlockStart(token),
+ blockEndAllowed = options.allowBlockEnd && isCommentAtBlockEnd(token),
+ objectStartAllowed = options.allowObjectStart && isCommentAtObjectStart(token),
+ objectEndAllowed = options.allowObjectEnd && isCommentAtObjectEnd(token),
+ arrayStartAllowed = options.allowArrayStart && isCommentAtArrayStart(token),
+ arrayEndAllowed = options.allowArrayEnd && isCommentAtArrayEnd(token);
const exceptionStartAllowed = blockStartAllowed || objectStartAllowed || arrayStartAllowed;
const exceptionEndAllowed = blockEndAllowed || objectEndAllowed || arrayEndAllowed;
@@ -319,17 +307,17 @@ module.exports = {
return;
}
- const previousTokenOrComment = sourceCode.getTokenBefore(node, { includeComments: true });
- const nextTokenOrComment = sourceCode.getTokenAfter(node, { includeComments: true });
+ const previousTokenOrComment = sourceCode.getTokenBefore(token, { includeComments: true });
+ const nextTokenOrComment = sourceCode.getTokenAfter(token, { includeComments: true });
// check for newline before
if (!exceptionStartAllowed && before && !lodash.includes(commentAndEmptyLines, prevLineNum) &&
- !(isCommentNodeType(previousTokenOrComment) && astUtils.isTokenOnSameLine(previousTokenOrComment, node))) {
- const lineStart = node.range[0] - node.loc.start.column;
+ !(astUtils.isCommentToken(previousTokenOrComment) && astUtils.isTokenOnSameLine(previousTokenOrComment, token))) {
+ const lineStart = token.range[0] - token.loc.start.column;
const range = [lineStart, lineStart];
context.report({
- node,
+ node: token,
message: "Expected line before comment.",
fix(fixer) {
return fixer.insertTextBeforeRange(range, "\n");
@@ -339,12 +327,12 @@ module.exports = {
// check for newline after
if (!exceptionEndAllowed && after && !lodash.includes(commentAndEmptyLines, nextLineNum) &&
- !(isCommentNodeType(nextTokenOrComment) && astUtils.isTokenOnSameLine(node, nextTokenOrComment))) {
+ !(astUtils.isCommentToken(nextTokenOrComment) && astUtils.isTokenOnSameLine(token, nextTokenOrComment))) {
context.report({
- node,
+ node: token,
message: "Expected line after comment.",
fix(fixer) {
- return fixer.insertTextAfter(node, "\n");
+ return fixer.insertTextAfter(token, "\n");
}
});
}
@@ -356,25 +344,25 @@ module.exports = {
//--------------------------------------------------------------------------
return {
-
- LineComment(node) {
- if (options.beforeLineComment || options.afterLineComment) {
- checkForEmptyLine(node, {
- after: options.afterLineComment,
- before: options.beforeLineComment
- });
- }
- },
-
- BlockComment(node) {
- if (options.beforeBlockComment || options.afterBlockComment) {
- checkForEmptyLine(node, {
- after: options.afterBlockComment,
- before: options.beforeBlockComment
- });
- }
+ Program() {
+ comments.forEach(token => {
+ if (token.type === "Line") {
+ if (options.beforeLineComment || options.afterLineComment) {
+ checkForEmptyLine(token, {
+ after: options.afterLineComment,
+ before: options.beforeLineComment
+ });
+ }
+ } else if (token.type === "Block") {
+ if (options.beforeBlockComment || options.afterBlockComment) {
+ checkForEmptyLine(token, {
+ after: options.afterBlockComment,
+ before: options.beforeBlockComment
+ });
+ }
+ }
+ });
}
-
};
}
};
diff --git a/tools/eslint/lib/rules/lines-around-directive.js b/tools/eslint/lib/rules/lines-around-directive.js
index 89dd9c6aeedf40..65b6cd1db59e7d 100644
--- a/tools/eslint/lib/rules/lines-around-directive.js
+++ b/tools/eslint/lib/rules/lines-around-directive.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Require or disallow newlines around directives.
* @author Kai Cataldo
+ * @deprecated
*/
"use strict";
@@ -16,7 +17,8 @@ module.exports = {
docs: {
description: "require or disallow newlines around directives",
category: "Stylistic Issues",
- recommended: false
+ recommended: false,
+ replacedBy: ["padding-line-between-statements"]
},
schema: [{
oneOf: [
@@ -38,7 +40,8 @@ module.exports = {
}
]
}],
- fixable: "whitespace"
+ fixable: "whitespace",
+ deprecated: true
},
create(context) {
@@ -131,17 +134,12 @@ module.exports = {
}
const firstDirective = directives[0];
- const hasTokenOrCommentBefore = !!sourceCode.getTokenBefore(firstDirective, { includeComments: true });
+ const leadingComments = sourceCode.getCommentsBefore(firstDirective);
// Only check before the first directive if it is preceded by a comment or if it is at the top of
// the file and expectLineBefore is set to "never". This is to not force a newline at the top of
// the file if there are no comments as well as for compatibility with padded-blocks.
- if (
- firstDirective.leadingComments && firstDirective.leadingComments.length ||
-
- // Shebangs are not added to leading comments but are accounted for by the following.
- node.type === "Program" && hasTokenOrCommentBefore
- ) {
+ if (leadingComments.length) {
if (expectLineBefore === "always" && !hasNewlineBefore(firstDirective)) {
reportError(firstDirective, "before", true);
}
@@ -152,7 +150,7 @@ module.exports = {
} else if (
node.type === "Program" &&
expectLineBefore === "never" &&
- !hasTokenOrCommentBefore &&
+ !leadingComments.length &&
hasNewlineBefore(firstDirective)
) {
reportError(firstDirective, "before", false);
diff --git a/tools/eslint/lib/rules/max-len.js b/tools/eslint/lib/rules/max-len.js
index dd5a4e1ef62553..b693c8078c620e 100644
--- a/tools/eslint/lib/rules/max-len.js
+++ b/tools/eslint/lib/rules/max-len.js
@@ -108,7 +108,7 @@ module.exports = {
previousTabStopOffset = tabWidth ? totalOffset % tabWidth : 0,
spaceCount = tabWidth - previousTabStopOffset;
- extraCharacterCount += spaceCount - 1; // -1 for the replaced tab
+ extraCharacterCount += spaceCount - 1; // -1 for the replaced tab
});
return Array.from(line).length + extraCharacterCount;
}
@@ -268,13 +268,13 @@ module.exports = {
// we iterate over comments in parallel with the lines
let commentsIndex = 0;
- const strings = getAllStrings(sourceCode);
+ const strings = getAllStrings();
const stringsByLine = strings.reduce(groupByLineNumber, {});
- const templateLiterals = getAllTemplateLiterals(sourceCode);
+ const templateLiterals = getAllTemplateLiterals();
const templateLiteralsByLine = templateLiterals.reduce(groupByLineNumber, {});
- const regExpLiterals = getAllRegExpLiterals(sourceCode);
+ const regExpLiterals = getAllRegExpLiterals();
const regExpLiteralsByLine = regExpLiterals.reduce(groupByLineNumber, {});
lines.forEach((line, i) => {
@@ -321,21 +321,24 @@ module.exports = {
}
const lineLength = computeLineLength(line, tabWidth);
+ const commentLengthApplies = lineIsComment && maxCommentLength;
if (lineIsComment && ignoreComments) {
return;
}
- if (lineIsComment && lineLength > maxCommentLength) {
- context.report({
- node,
- loc: { line: lineNumber, column: 0 },
- message: "Line {{lineNumber}} exceeds the maximum comment line length of {{maxCommentLength}}.",
- data: {
- lineNumber: i + 1,
- maxCommentLength
- }
- });
+ if (commentLengthApplies) {
+ if (lineLength > maxCommentLength) {
+ context.report({
+ node,
+ loc: { line: lineNumber, column: 0 },
+ message: "Line {{lineNumber}} exceeds the maximum comment line length of {{maxCommentLength}}.",
+ data: {
+ lineNumber: i + 1,
+ maxCommentLength
+ }
+ });
+ }
} else if (lineLength > maxLength) {
context.report({
node,
diff --git a/tools/eslint/lib/rules/new-parens.js b/tools/eslint/lib/rules/new-parens.js
index ad37979d54ed91..aa0f7fe931db5f 100644
--- a/tools/eslint/lib/rules/new-parens.js
+++ b/tools/eslint/lib/rules/new-parens.js
@@ -38,7 +38,7 @@ module.exports = {
return {
NewExpression(node) {
if (node.arguments.length !== 0) {
- return; // shortcut: if there are arguments, there have to be parens
+ return; // shortcut: if there are arguments, there have to be parens
}
const lastToken = sourceCode.getLastToken(node);
diff --git a/tools/eslint/lib/rules/newline-after-var.js b/tools/eslint/lib/rules/newline-after-var.js
index 7b8d473d1dda17..744a52a580af53 100644
--- a/tools/eslint/lib/rules/newline-after-var.js
+++ b/tools/eslint/lib/rules/newline-after-var.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Rule to check empty newline after "var" statement
* @author Gopal Venkatesan
+ * @deprecated
*/
"use strict";
@@ -20,7 +21,8 @@ module.exports = {
docs: {
description: "require or disallow an empty line after variable declarations",
category: "Stylistic Issues",
- recommended: false
+ recommended: false,
+ replacedBy: ["padding-line-between-statements"]
},
schema: [
@@ -29,7 +31,9 @@ module.exports = {
}
],
- fixable: "whitespace"
+ fixable: "whitespace",
+
+ deprecated: true
},
create(context) {
diff --git a/tools/eslint/lib/rules/newline-before-return.js b/tools/eslint/lib/rules/newline-before-return.js
index 996039b6929b5e..1b9b0c79392a8b 100644
--- a/tools/eslint/lib/rules/newline-before-return.js
+++ b/tools/eslint/lib/rules/newline-before-return.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Rule to require newlines before `return` statement
* @author Kai Cataldo
+ * @deprecated
*/
"use strict";
@@ -13,10 +14,12 @@ module.exports = {
docs: {
description: "require an empty line before `return` statements",
category: "Stylistic Issues",
- recommended: false
+ recommended: false,
+ replacedBy: ["padding-line-between-statements"]
},
fixable: "whitespace",
- schema: []
+ schema: [],
+ deprecated: true
},
create(context) {
@@ -50,8 +53,8 @@ module.exports = {
if (node.parent.body) {
return Array.isArray(node.parent.body)
- ? node.parent.body[0] === node
- : node.parent.body === node;
+ ? node.parent.body[0] === node
+ : node.parent.body === node;
}
if (parentType === "IfStatement") {
@@ -73,7 +76,7 @@ module.exports = {
* @private
*/
function calcCommentLines(node, lineNumTokenBefore) {
- const comments = sourceCode.getComments(node).leading;
+ const comments = sourceCode.getCommentsBefore(node);
let numLinesComments = 0;
if (!comments.length) {
@@ -121,7 +124,7 @@ module.exports = {
if (tokenBefore) {
lineNumTokenBefore = tokenBefore.loc.end.line;
} else {
- lineNumTokenBefore = 0; // global return at beginning of script
+ lineNumTokenBefore = 0; // global return at beginning of script
}
return lineNumTokenBefore;
@@ -153,7 +156,7 @@ module.exports = {
* @private
*/
function canFix(node) {
- const leadingComments = sourceCode.getComments(node).leading;
+ const leadingComments = sourceCode.getCommentsBefore(node);
const lastLeadingComment = leadingComments[leadingComments.length - 1];
const tokenBefore = sourceCode.getTokenBefore(node);
diff --git a/tools/eslint/lib/rules/no-alert.js b/tools/eslint/lib/rules/no-alert.js
index f2cfc3a87762d2..232fa14449cb67 100644
--- a/tools/eslint/lib/rules/no-alert.js
+++ b/tools/eslint/lib/rules/no-alert.js
@@ -35,7 +35,7 @@ function report(context, node, identifierName) {
}
/**
- * Finds the escope reference in the given scope.
+ * Finds the eslint-scope reference in the given scope.
* @param {Object} scope The scope to search.
* @param {ASTNode} node The identifier node.
* @returns {Reference|null} Returns the found reference or null if none were found.
diff --git a/tools/eslint/lib/rules/no-buffer-constructor.js b/tools/eslint/lib/rules/no-buffer-constructor.js
new file mode 100644
index 00000000000000..1521ff2847e11d
--- /dev/null
+++ b/tools/eslint/lib/rules/no-buffer-constructor.js
@@ -0,0 +1,37 @@
+/**
+ * @fileoverview disallow use of the Buffer() constructor
+ * @author Teddy Katz
+ */
+"use strict";
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "disallow use of the Buffer() constructor",
+ category: "Node.js and CommonJS",
+ recommended: false
+ },
+ schema: []
+ },
+
+ create(context) {
+
+ //----------------------------------------------------------------------
+ // Public
+ //----------------------------------------------------------------------
+
+ return {
+ "CallExpression[callee.name='Buffer'], NewExpression[callee.name='Buffer']"(node) {
+ context.report({
+ node,
+ message: "{{example}} is deprecated. Use Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe() instead.",
+ data: { example: node.type === "CallExpression" ? "Buffer()" : "new Buffer()" }
+ });
+ }
+ };
+ }
+};
diff --git a/tools/eslint/lib/rules/no-compare-neg-zero.js b/tools/eslint/lib/rules/no-compare-neg-zero.js
index d93ade5d307134..604e221919922a 100644
--- a/tools/eslint/lib/rules/no-compare-neg-zero.js
+++ b/tools/eslint/lib/rules/no-compare-neg-zero.js
@@ -13,7 +13,7 @@ module.exports = {
docs: {
description: "disallow comparing against -0",
category: "Possible Errors",
- recommended: false
+ recommended: true
},
fixable: null,
schema: []
diff --git a/tools/eslint/lib/rules/no-confusing-arrow.js b/tools/eslint/lib/rules/no-confusing-arrow.js
index d6edbcc810e4fb..fc69ca39a9eda0 100644
--- a/tools/eslint/lib/rules/no-confusing-arrow.js
+++ b/tools/eslint/lib/rules/no-confusing-arrow.js
@@ -33,6 +33,8 @@ module.exports = {
recommended: false
},
+ fixable: "code",
+
schema: [{
type: "object",
properties: {
@@ -55,7 +57,15 @@ module.exports = {
const body = node.body;
if (isConditional(body) && !(config.allowParens && astUtils.isParenthesised(sourceCode, body))) {
- context.report({ node, message: "Arrow function used ambiguously with a conditional expression." });
+ context.report({
+ node,
+ message: "Arrow function used ambiguously with a conditional expression.",
+ fix(fixer) {
+
+ // if `allowParens` is not set to true dont bother wrapping in parens
+ return config.allowParens && fixer.replaceText(node.body, `(${sourceCode.getText(node.body)})`);
+ }
+ });
}
}
diff --git a/tools/eslint/lib/rules/no-console.js b/tools/eslint/lib/rules/no-console.js
index 9131a49a01ae55..32bdf6d1f4d78f 100644
--- a/tools/eslint/lib/rules/no-console.js
+++ b/tools/eslint/lib/rules/no-console.js
@@ -48,7 +48,7 @@ module.exports = {
/**
* Checks whether the given reference is 'console' or not.
*
- * @param {escope.Reference} reference - The reference to check.
+ * @param {eslint-scope.Reference} reference - The reference to check.
* @returns {boolean} `true` if the reference is 'console'.
*/
function isConsole(reference) {
@@ -74,7 +74,7 @@ module.exports = {
* Checks whether the given reference is a member access which is not
* allowed by options or not.
*
- * @param {escope.Reference} reference - The reference to check.
+ * @param {eslint-scope.Reference} reference - The reference to check.
* @returns {boolean} `true` if the reference is a member access which
* is not allowed by options.
*/
@@ -92,7 +92,7 @@ module.exports = {
/**
* Reports the given reference as a violation.
*
- * @param {escope.Reference} reference - The reference to report.
+ * @param {eslint-scope.Reference} reference - The reference to report.
* @returns {void}
*/
function report(reference) {
diff --git a/tools/eslint/lib/rules/no-debugger.js b/tools/eslint/lib/rules/no-debugger.js
index 897b3dbb6094f9..a158724fef118f 100644
--- a/tools/eslint/lib/rules/no-debugger.js
+++ b/tools/eslint/lib/rules/no-debugger.js
@@ -16,7 +16,7 @@ module.exports = {
category: "Possible Errors",
recommended: true
},
-
+ fixable: "code",
schema: []
},
@@ -24,7 +24,13 @@ module.exports = {
return {
DebuggerStatement(node) {
- context.report({ node, message: "Unexpected 'debugger' statement." });
+ context.report({
+ node,
+ message: "Unexpected 'debugger' statement.",
+ fix(fixer) {
+ return fixer.remove(node);
+ }
+ });
}
};
diff --git a/tools/eslint/lib/rules/no-dupe-args.js b/tools/eslint/lib/rules/no-dupe-args.js
index cdb38035c0a01f..c932be01d7615e 100644
--- a/tools/eslint/lib/rules/no-dupe-args.js
+++ b/tools/eslint/lib/rules/no-dupe-args.js
@@ -28,7 +28,7 @@ module.exports = {
/**
* Checks whether or not a given definition is a parameter's.
- * @param {escope.DefEntry} def - A definition to check.
+ * @param {eslint-scope.DefEntry} def - A definition to check.
* @returns {boolean} `true` if the definition is a parameter's.
*/
function isParameter(def) {
diff --git a/tools/eslint/lib/rules/no-empty-function.js b/tools/eslint/lib/rules/no-empty-function.js
index 115d8698eead71..38c915c33f9730 100644
--- a/tools/eslint/lib/rules/no-empty-function.js
+++ b/tools/eslint/lib/rules/no-empty-function.js
@@ -132,11 +132,15 @@ module.exports = {
function reportIfEmpty(node) {
const kind = getKind(node);
const name = astUtils.getFunctionNameWithKind(node);
+ const innerComments = sourceCode.getTokens(node.body, {
+ includeComments: true,
+ filter: astUtils.isCommentToken
+ });
if (allowed.indexOf(kind) === -1 &&
node.body.type === "BlockStatement" &&
node.body.body.length === 0 &&
- sourceCode.getComments(node.body).trailing.length === 0
+ innerComments.length === 0
) {
context.report({
node,
diff --git a/tools/eslint/lib/rules/no-empty.js b/tools/eslint/lib/rules/no-empty.js
index a9b0776c933b07..b71b8582a37195 100644
--- a/tools/eslint/lib/rules/no-empty.js
+++ b/tools/eslint/lib/rules/no-empty.js
@@ -59,7 +59,7 @@ module.exports = {
}
// any other block is only allowed to be empty, if it contains a comment
- if (sourceCode.getComments(node).trailing.length > 0) {
+ if (sourceCode.getCommentsInside(node).length > 0) {
return;
}
diff --git a/tools/eslint/lib/rules/no-eval.js b/tools/eslint/lib/rules/no-eval.js
index fe1456cba0a431..ee5f577f471ef9 100644
--- a/tools/eslint/lib/rules/no-eval.js
+++ b/tools/eslint/lib/rules/no-eval.js
@@ -166,7 +166,7 @@ module.exports = {
/**
* Reports accesses of `eval` via the global object.
*
- * @param {escope.Scope} globalScope - The global scope.
+ * @param {eslint-scope.Scope} globalScope - The global scope.
* @returns {void}
*/
function reportAccessingEvalViaGlobalObject(globalScope) {
@@ -200,7 +200,7 @@ module.exports = {
/**
* Reports all accesses of `eval` (excludes direct calls to eval).
*
- * @param {escope.Scope} globalScope - The global scope.
+ * @param {eslint-scope.Scope} globalScope - The global scope.
* @returns {void}
*/
function reportAccessingEval(globalScope) {
diff --git a/tools/eslint/lib/rules/no-extend-native.js b/tools/eslint/lib/rules/no-extend-native.js
index 547770d8f7e4af..c550cf5da57a25 100644
--- a/tools/eslint/lib/rules/no-extend-native.js
+++ b/tools/eslint/lib/rules/no-extend-native.js
@@ -9,8 +9,15 @@
// Requirements
//------------------------------------------------------------------------------
+const astUtils = require("../ast-utils");
const globals = require("globals");
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+const propertyDefinitionMethods = new Set(["defineProperty", "defineProperties"]);
+
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@@ -43,73 +50,123 @@ module.exports = {
create(context) {
const config = context.options[0] || {};
- const exceptions = config.exceptions || [];
- let modifiedBuiltins = Object.keys(globals.builtin).filter(builtin => builtin[0].toUpperCase() === builtin[0]);
+ const exceptions = new Set(config.exceptions || []);
+ const modifiedBuiltins = new Set(
+ Object.keys(globals.builtin)
+ .filter(builtin => builtin[0].toUpperCase() === builtin[0])
+ .filter(builtin => !exceptions.has(builtin))
+ );
+
+ /**
+ * Reports a lint error for the given node.
+ * @param {ASTNode} node The node to report.
+ * @param {string} builtin The name of the native builtin being extended.
+ * @returns {void}
+ */
+ function reportNode(node, builtin) {
+ context.report({
+ node,
+ message: "{{builtin}} prototype is read only, properties should not be added.",
+ data: {
+ builtin
+ }
+ });
+ }
- if (exceptions.length) {
- modifiedBuiltins = modifiedBuiltins.filter(builtIn => exceptions.indexOf(builtIn) === -1);
+ /**
+ * Check to see if the `prototype` property of the given object
+ * identifier node is being accessed.
+ * @param {ASTNode} identifierNode The Identifier representing the object
+ * to check.
+ * @returns {boolean} True if the identifier is the object of a
+ * MemberExpression and its `prototype` property is being accessed,
+ * false otherwise.
+ */
+ function isPrototypePropertyAccessed(identifierNode) {
+ return Boolean(
+ identifierNode &&
+ identifierNode.parent &&
+ identifierNode.parent.type === "MemberExpression" &&
+ identifierNode.parent.object === identifierNode &&
+ astUtils.getStaticPropertyName(identifierNode.parent) === "prototype"
+ );
}
- return {
+ /**
+ * Checks that an identifier is an object of a prototype whose member
+ * is being assigned in an AssignmentExpression.
+ * Example: Object.prototype.foo = "bar"
+ * @param {ASTNode} identifierNode The identifier to check.
+ * @returns {boolean} True if the identifier's prototype is modified.
+ */
+ function isInPrototypePropertyAssignment(identifierNode) {
+ return Boolean(
+ isPrototypePropertyAccessed(identifierNode) &&
+ identifierNode.parent.parent.type === "MemberExpression" &&
+ identifierNode.parent.parent.parent.type === "AssignmentExpression" &&
+ identifierNode.parent.parent.parent.left === identifierNode.parent.parent
+ );
+ }
- // handle the Array.prototype.extra style case
- AssignmentExpression(node) {
- const lhs = node.left;
+ /**
+ * Checks that an identifier is an object of a prototype whose member
+ * is being extended via the Object.defineProperty() or
+ * Object.defineProperties() methods.
+ * Example: Object.defineProperty(Array.prototype, "foo", ...)
+ * Example: Object.defineProperties(Array.prototype, ...)
+ * @param {ASTNode} identifierNode The identifier to check.
+ * @returns {boolean} True if the identifier's prototype is modified.
+ */
+ function isInDefinePropertyCall(identifierNode) {
+ return Boolean(
+ isPrototypePropertyAccessed(identifierNode) &&
+ identifierNode.parent.parent.type === "CallExpression" &&
+ identifierNode.parent.parent.arguments[0] === identifierNode.parent &&
+ identifierNode.parent.parent.callee.type === "MemberExpression" &&
+ identifierNode.parent.parent.callee.object.type === "Identifier" &&
+ identifierNode.parent.parent.callee.object.name === "Object" &&
+ identifierNode.parent.parent.callee.property.type === "Identifier" &&
+ propertyDefinitionMethods.has(identifierNode.parent.parent.callee.property.name)
+ );
+ }
- if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") {
- return;
- }
+ /**
+ * Check to see if object prototype access is part of a prototype
+ * extension. There are three ways a prototype can be extended:
+ * 1. Assignment to prototype property (Object.prototype.foo = 1)
+ * 2. Object.defineProperty()/Object.defineProperties() on a prototype
+ * If prototype extension is detected, report the AssignmentExpression
+ * or CallExpression node.
+ * @param {ASTNode} identifierNode The Identifier representing the object
+ * which prototype is being accessed and possibly extended.
+ * @returns {void}
+ */
+ function checkAndReportPrototypeExtension(identifierNode) {
+ if (isInPrototypePropertyAssignment(identifierNode)) {
+
+ // Identifier --> MemberExpression --> MemberExpression --> AssignmentExpression
+ reportNode(identifierNode.parent.parent.parent, identifierNode.name);
+ } else if (isInDefinePropertyCall(identifierNode)) {
+
+ // Identifier --> MemberExpression --> CallExpression
+ reportNode(identifierNode.parent.parent, identifierNode.name);
+ }
+ }
- const affectsProto = lhs.object.computed
- ? lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype"
- : lhs.object.property.name === "prototype";
+ return {
- if (!affectsProto) {
- return;
- }
+ "Program:exit"() {
+ const globalScope = context.getScope();
modifiedBuiltins.forEach(builtin => {
- if (lhs.object.object.name === builtin) {
- context.report({
- node,
- message: "{{builtin}} prototype is read only, properties should not be added.",
- data: {
- builtin
- }
- });
+ const builtinVar = globalScope.set.get(builtin);
+
+ if (builtinVar && builtinVar.references) {
+ builtinVar.references
+ .map(ref => ref.identifier)
+ .forEach(checkAndReportPrototypeExtension);
}
});
- },
-
- // handle the Object.definePropert[y|ies](Array.prototype) case
- CallExpression(node) {
-
- const callee = node.callee;
-
- // only worry about Object.definePropert[y|ies]
- if (callee.type === "MemberExpression" &&
- callee.object.name === "Object" &&
- (callee.property.name === "defineProperty" || callee.property.name === "defineProperties")) {
-
- // verify the object being added to is a native prototype
- const subject = node.arguments[0];
- const object = subject && subject.object;
-
- if (object &&
- object.type === "Identifier" &&
- (modifiedBuiltins.indexOf(object.name) > -1) &&
- subject.property.name === "prototype") {
-
- context.report({
- node,
- message: "{{objectName}} prototype is read only, properties should not be added.",
- data: {
- objectName: object.name
- }
- });
- }
- }
-
}
};
diff --git a/tools/eslint/lib/rules/no-extra-parens.js b/tools/eslint/lib/rules/no-extra-parens.js
index bbfae735c2d27f..d0d79c6a3295d8 100644
--- a/tools/eslint/lib/rules/no-extra-parens.js
+++ b/tools/eslint/lib/rules/no-extra-parens.js
@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
const astUtils = require("../ast-utils.js");
-const esUtils = require("esutils");
module.exports = {
meta: {
@@ -250,28 +249,27 @@ module.exports = {
const tokenBeforeLeftParen = sourceCode.getTokenBefore(node, 1);
const firstToken = sourceCode.getFirstToken(node);
- // If there is already whitespace before the previous token, don't add more.
- if (!tokenBeforeLeftParen || tokenBeforeLeftParen.end !== leftParenToken.start) {
- return false;
- }
-
- // If the parens are preceded by a keyword (e.g. `typeof(0)`), a space should be inserted (`typeof 0`)
- const precededByIdentiferPart = esUtils.code.isIdentifierPartES6(tokenBeforeLeftParen.value.slice(-1).charCodeAt(0));
-
- // However, a space should not be inserted unless the first character of the token is an identifier part
- // e.g. `typeof([])` should be fixed to `typeof[]`
- const startsWithIdentifierPart = esUtils.code.isIdentifierPartES6(firstToken.value.charCodeAt(0));
-
- // If the parens are preceded by and start with a unary plus/minus (e.g. `+(+foo)`), a space should be inserted (`+ +foo`)
- const precededByUnaryPlus = tokenBeforeLeftParen.type === "Punctuator" && tokenBeforeLeftParen.value === "+";
- const precededByUnaryMinus = tokenBeforeLeftParen.type === "Punctuator" && tokenBeforeLeftParen.value === "-";
-
- const startsWithUnaryPlus = firstToken.type === "Punctuator" && firstToken.value === "+";
- const startsWithUnaryMinus = firstToken.type === "Punctuator" && firstToken.value === "-";
+ return tokenBeforeLeftParen &&
+ tokenBeforeLeftParen.range[1] === leftParenToken.range[0] &&
+ leftParenToken.range[1] === firstToken.range[0] &&
+ !astUtils.canTokensBeAdjacent(tokenBeforeLeftParen, firstToken);
+ }
- return (precededByIdentiferPart && startsWithIdentifierPart) ||
- (precededByUnaryPlus && startsWithUnaryPlus) ||
- (precededByUnaryMinus && startsWithUnaryMinus);
+ /**
+ * Determines whether a node should be followed by an additional space when removing parens
+ * @param {ASTNode} node node to evaluate; must be surrounded by parentheses
+ * @returns {boolean} `true` if a space should be inserted after the node
+ * @private
+ */
+ function requiresTrailingSpace(node) {
+ const nextTwoTokens = sourceCode.getTokensAfter(node, { count: 2 });
+ const rightParenToken = nextTwoTokens[0];
+ const tokenAfterRightParen = nextTwoTokens[1];
+ const tokenBeforeRightParen = sourceCode.getLastToken(node);
+
+ return rightParenToken && tokenAfterRightParen &&
+ !sourceCode.isSpaceBetweenTokens(rightParenToken, tokenAfterRightParen) &&
+ !astUtils.canTokensBeAdjacent(tokenBeforeRightParen, tokenAfterRightParen);
}
/**
@@ -298,7 +296,7 @@ module.exports = {
return fixer.replaceTextRange([
leftParenToken.range[0],
rightParenToken.range[1]
- ], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource);
+ ], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource + (requiresTrailingSpace(node) ? " " : ""));
}
});
}
@@ -507,12 +505,18 @@ module.exports = {
if (hasExcessParens(node.right)) {
report(node.right);
}
+ if (hasExcessParens(node.left)) {
+ report(node.left);
+ }
},
ForOfStatement(node) {
if (hasExcessParens(node.right)) {
report(node.right);
}
+ if (hasExcessParens(node.left)) {
+ report(node.left);
+ }
},
ForStatement(node) {
diff --git a/tools/eslint/lib/rules/no-fallthrough.js b/tools/eslint/lib/rules/no-fallthrough.js
index 30d13da06ddc8f..082e8431d63dc6 100644
--- a/tools/eslint/lib/rules/no-fallthrough.js
+++ b/tools/eslint/lib/rules/no-fallthrough.js
@@ -25,7 +25,7 @@ const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/i;
*/
function hasFallthroughComment(node, context, fallthroughCommentPattern) {
const sourceCode = context.getSourceCode();
- const comment = lodash.last(sourceCode.getComments(node).leading);
+ const comment = lodash.last(sourceCode.getCommentsBefore(node));
return Boolean(comment && fallthroughCommentPattern.test(comment.value));
}
diff --git a/tools/eslint/lib/rules/no-floating-decimal.js b/tools/eslint/lib/rules/no-floating-decimal.js
index 7e023050294a8b..dfba453a4984d6 100644
--- a/tools/eslint/lib/rules/no-floating-decimal.js
+++ b/tools/eslint/lib/rules/no-floating-decimal.js
@@ -5,6 +5,12 @@
"use strict";
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("../ast-utils");
+
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@@ -23,16 +29,24 @@ module.exports = {
},
create(context) {
+ const sourceCode = context.getSourceCode();
return {
Literal(node) {
if (typeof node.value === "number") {
- if (node.raw.indexOf(".") === 0) {
+ if (node.raw.startsWith(".")) {
context.report({
node,
message: "A leading decimal point can be confused with a dot.",
- fix: fixer => fixer.insertTextBefore(node, "0")
+ fix(fixer) {
+ const tokenBefore = sourceCode.getTokenBefore(node);
+ const needsSpaceBefore = tokenBefore &&
+ tokenBefore.range[1] === node.range[0] &&
+ !astUtils.canTokensBeAdjacent(tokenBefore, `0${node.raw}`);
+
+ return fixer.insertTextBefore(node, needsSpaceBefore ? " 0" : "0");
+ }
});
}
if (node.raw.indexOf(".") === node.raw.length - 1) {
diff --git a/tools/eslint/lib/rules/no-implicit-coercion.js b/tools/eslint/lib/rules/no-implicit-coercion.js
index 387b3dae479597..cec411af75daa1 100644
--- a/tools/eslint/lib/rules/no-implicit-coercion.js
+++ b/tools/eslint/lib/rules/no-implicit-coercion.js
@@ -6,7 +6,6 @@
"use strict";
const astUtils = require("../ast-utils");
-const esUtils = require("esutils");
//------------------------------------------------------------------------------
// Helpers
@@ -215,8 +214,7 @@ module.exports = {
if (
tokenBefore &&
tokenBefore.range[1] === node.range[0] &&
- esUtils.code.isIdentifierPartES6(tokenBefore.value.slice(-1).charCodeAt(0)) &&
- esUtils.code.isIdentifierPartES6(recommendation.charCodeAt(0))
+ !astUtils.canTokensBeAdjacent(tokenBefore, recommendation)
) {
return fixer.replaceText(node, ` ${recommendation}`);
}
diff --git a/tools/eslint/lib/rules/no-inline-comments.js b/tools/eslint/lib/rules/no-inline-comments.js
index 46815d15418f6a..42b4753dfdd713 100644
--- a/tools/eslint/lib/rules/no-inline-comments.js
+++ b/tools/eslint/lib/rules/no-inline-comments.js
@@ -55,10 +55,11 @@ module.exports = {
//--------------------------------------------------------------------------
return {
+ Program() {
+ const comments = sourceCode.getAllComments();
- LineComment: testCodeAroundComment,
- BlockComment: testCodeAroundComment
-
+ comments.filter(token => token.type !== "Shebang").forEach(testCodeAroundComment);
+ }
};
}
};
diff --git a/tools/eslint/lib/rules/no-inner-declarations.js b/tools/eslint/lib/rules/no-inner-declarations.js
index 2a378487fd5b6b..e7d1b004e771fd 100644
--- a/tools/eslint/lib/rules/no-inner-declarations.js
+++ b/tools/eslint/lib/rules/no-inner-declarations.js
@@ -58,16 +58,14 @@ module.exports = {
* @returns {void}
*/
function check(node) {
- const body = nearestBody(node),
+ const body = nearestBody(),
valid = ((body.type === "Program" && body.distance === 1) ||
body.distance === 2);
if (!valid) {
context.report({ node, message: "Move {{type}} declaration to {{body}} root.", data: {
- type: (node.type === "FunctionDeclaration"
- ? "function" : "variable"),
- body: (body.type === "Program"
- ? "program" : "function body")
+ type: (node.type === "FunctionDeclaration" ? "function" : "variable"),
+ body: (body.type === "Program" ? "program" : "function body")
} });
}
}
diff --git a/tools/eslint/lib/rules/no-irregular-whitespace.js b/tools/eslint/lib/rules/no-irregular-whitespace.js
index 3882501a8629d3..cfbdfd1a5ef97b 100644
--- a/tools/eslint/lib/rules/no-irregular-whitespace.js
+++ b/tools/eslint/lib/rules/no-irregular-whitespace.js
@@ -16,8 +16,8 @@ const astUtils = require("../ast-utils");
// Constants
//------------------------------------------------------------------------------
-const ALL_IRREGULARS = /[\f\v\u0085\u00A0\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/;
-const IRREGULAR_WHITESPACE = /[\f\v\u0085\u00A0\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mg;
+const ALL_IRREGULARS = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/;
+const IRREGULAR_WHITESPACE = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mg;
const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/mg;
const LINE_BREAK = astUtils.createGlobalLinebreakMatcher();
@@ -60,9 +60,6 @@ module.exports = {
// Module store of errors that we have found
let errors = [];
- // Comment nodes. We accumulate these as we go, so we can be sure to trigger them after the whole `Program` entity is parsed, even for top-of-file comments.
- const commentNodes = [];
-
// Lookup the `skipComments` option, which defaults to `false`.
const options = context.options[0] || {};
const skipComments = !!options.skipComments;
@@ -71,6 +68,7 @@ module.exports = {
const skipTemplates = !!options.skipTemplates;
const sourceCode = context.getSourceCode();
+ const commentNodes = sourceCode.getAllComments();
/**
* Removes errors that occur inside a string node
@@ -188,16 +186,6 @@ module.exports = {
}
}
- /**
- * Stores a comment node (`LineComment` or `BlockComment`) for later stripping of errors within; a necessary deferring of processing to deal with top-of-file comments.
- * @param {ASTNode} node The comment node
- * @returns {void}
- * @private
- */
- function rememberCommentNode(node) {
- commentNodes.push(node);
- }
-
/**
* A no-op function to act as placeholder for comment accumulation when the `skipComments` option is `false`.
* @returns {void}
@@ -220,7 +208,6 @@ module.exports = {
* We can later filter the errors when they are found to be not an
* issue in nodes we don't care about.
*/
-
checkForIrregularWhitespace(node);
checkForIrregularLineTerminators(node);
};
@@ -228,13 +215,10 @@ module.exports = {
nodes.Identifier = removeInvalidNodeErrorsInIdentifierOrLiteral;
nodes.Literal = removeInvalidNodeErrorsInIdentifierOrLiteral;
nodes.TemplateElement = skipTemplates ? removeInvalidNodeErrorsInTemplateLiteral : noop;
- nodes.LineComment = skipComments ? rememberCommentNode : noop;
- nodes.BlockComment = skipComments ? rememberCommentNode : noop;
nodes["Program:exit"] = function() {
-
if (skipComments) {
- // First strip errors occurring in comment nodes. We have to do this post-`Program` to deal with top-of-file comments.
+ // First strip errors occurring in comment nodes.
commentNodes.forEach(removeInvalidNodeErrorsInComment);
}
diff --git a/tools/eslint/lib/rules/no-lone-blocks.js b/tools/eslint/lib/rules/no-lone-blocks.js
index 95a5b334c602a8..652812fba7bfa7 100644
--- a/tools/eslint/lib/rules/no-lone-blocks.js
+++ b/tools/eslint/lib/rules/no-lone-blocks.js
@@ -94,13 +94,13 @@ module.exports = {
ruleDef.VariableDeclaration = function(node) {
if (node.kind === "let" || node.kind === "const") {
- markLoneBlock(node);
+ markLoneBlock();
}
};
- ruleDef.FunctionDeclaration = function(node) {
+ ruleDef.FunctionDeclaration = function() {
if (context.getScope().isStrict) {
- markLoneBlock(node);
+ markLoneBlock();
}
};
diff --git a/tools/eslint/lib/rules/no-loop-func.js b/tools/eslint/lib/rules/no-loop-func.js
index b8bed958652e46..df0f1767894f6f 100644
--- a/tools/eslint/lib/rules/no-loop-func.js
+++ b/tools/eslint/lib/rules/no-loop-func.js
@@ -90,7 +90,7 @@ function getTopLoopNode(node, excludedNode) {
*
* @param {ASTNode} funcNode - A target function node.
* @param {ASTNode} loopNode - A containing loop node.
- * @param {escope.Reference} reference - A reference to check.
+ * @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the reference is safe or not.
*/
function isSafe(funcNode, loopNode, reference) {
@@ -131,7 +131,7 @@ function isSafe(funcNode, loopNode, reference) {
* - is readonly.
* - doesn't exist inside a local function and after the border.
*
- * @param {escope.Reference} upperRef - A reference to check.
+ * @param {eslint-scope.Reference} upperRef - A reference to check.
* @returns {boolean} `true` if the reference is safe.
*/
function isSafeReference(upperRef) {
diff --git a/tools/eslint/lib/rules/no-multi-spaces.js b/tools/eslint/lib/rules/no-multi-spaces.js
index 41a7f924a5e9de..30d650c3a0c3b0 100644
--- a/tools/eslint/lib/rules/no-multi-spaces.js
+++ b/tools/eslint/lib/rules/no-multi-spaces.js
@@ -33,6 +33,9 @@ module.exports = {
}
},
additionalProperties: false
+ },
+ ignoreEOLComments: {
+ type: "boolean"
}
},
additionalProperties: false
@@ -43,8 +46,10 @@ module.exports = {
create(context) {
// the index of the last comment that was checked
- const exceptions = { Property: true },
- options = context.options[0];
+ const sourceCode = context.getSourceCode(),
+ exceptions = { Property: true },
+ options = context.options[0] || {},
+ ignoreEOLComments = options.ignoreEOLComments;
let hasExceptions = true,
lastCommentIndex = 0;
@@ -59,6 +64,23 @@ module.exports = {
hasExceptions = Object.keys(exceptions).length > 0;
}
+ /**
+ * Checks if a given token is the last token of the line or not.
+ * @param {Token} token The token to check.
+ * @returns {boolean} Whether or not a token is at the end of the line it occurs in.
+ * @private
+ */
+ function isLastTokenOfLine(token) {
+ const nextToken = sourceCode.getTokenAfter(token, { includeComments: true });
+
+ // nextToken is null if the comment is the last token in the program.
+ if (!nextToken) {
+ return true;
+ }
+
+ return !astUtils.isTokenOnSameLine(token, nextToken);
+ }
+
/**
* Determines if a given source index is in a comment or not by checking
* the index against the comment range. Since the check goes straight
@@ -73,7 +95,7 @@ module.exports = {
while (lastCommentIndex < comments.length) {
const comment = comments[lastCommentIndex];
- if (comment.range[0] <= index && index < comment.range[1]) {
+ if (comment.range[0] < index && index < comment.range[1]) {
return true;
} else if (index > comment.range[1]) {
lastCommentIndex++;
@@ -85,6 +107,33 @@ module.exports = {
return false;
}
+ /**
+ * Formats value of given comment token for error message by truncating its length.
+ * @param {Token} token comment token
+ * @returns {string} formatted value
+ * @private
+ */
+ function formatReportedCommentValue(token) {
+ const valueLines = token.value.split("\n");
+ const value = valueLines[0];
+ const formattedValue = `${value.substring(0, 12)}...`;
+
+ return valueLines.length === 1 && value.length <= 12 ? value : formattedValue;
+ }
+
+ /**
+ * Creates a fix function that removes the multiple spaces between the two tokens
+ * @param {Token} leftToken left token
+ * @param {Token} rightToken right token
+ * @returns {Function} fix function
+ * @private
+ */
+ function createFix(leftToken, rightToken) {
+ return function(fixer) {
+ return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ");
+ };
+ }
+
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
@@ -92,47 +141,43 @@ module.exports = {
return {
Program() {
- const sourceCode = context.getSourceCode(),
- source = sourceCode.getText(),
+ const source = sourceCode.getText(),
allComments = sourceCode.getAllComments(),
- JOINED_LINEBEAKS = Array.from(astUtils.LINEBREAKS).join(""),
- pattern = new RegExp(String.raw`[^ \t${JOINED_LINEBEAKS}].? {2,}`, "g"); // note: repeating space
+ pattern = /[^\s].*? {2,}/g;
let parent;
-
- /**
- * Creates a fix function that removes the multiple spaces between the two tokens
- * @param {RuleFixer} leftToken left token
- * @param {RuleFixer} rightToken right token
- * @returns {Function} fix function
- * @private
- */
- function createFix(leftToken, rightToken) {
- return function(fixer) {
- return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ");
- };
- }
-
while (pattern.test(source)) {
// do not flag anything inside of comments
if (!isIndexInComment(pattern.lastIndex, allComments)) {
- const token = sourceCode.getTokenByRangeStart(pattern.lastIndex);
+ const token = sourceCode.getTokenByRangeStart(pattern.lastIndex, { includeComments: true });
if (token) {
- const previousToken = sourceCode.getTokenBefore(token);
+ if (ignoreEOLComments && astUtils.isCommentToken(token) && isLastTokenOfLine(token)) {
+ return;
+ }
+
+ const previousToken = sourceCode.getTokenBefore(token, { includeComments: true });
if (hasExceptions) {
parent = sourceCode.getNodeByRangeIndex(pattern.lastIndex - 1);
}
if (!parent || !exceptions[parent.type]) {
+ let value = token.value;
+
+ if (token.type === "Block") {
+ value = `/*${formatReportedCommentValue(token)}*/`;
+ } else if (token.type === "Line") {
+ value = `//${formatReportedCommentValue(token)}`;
+ }
+
context.report({
node: token,
loc: token.loc.start,
message: "Multiple spaces found before '{{value}}'.",
- data: { value: token.value },
+ data: { value },
fix: createFix(previousToken, token)
});
}
diff --git a/tools/eslint/lib/rules/no-multiple-empty-lines.js b/tools/eslint/lib/rules/no-multiple-empty-lines.js
index 2063ebd917c79e..9d1067c205dd0a 100644
--- a/tools/eslint/lib/rules/no-multiple-empty-lines.js
+++ b/tools/eslint/lib/rules/no-multiple-empty-lines.js
@@ -111,10 +111,19 @@ module.exports = {
message,
data: { max: maxAllowed, pluralizedLines: maxAllowed === 1 ? "line" : "lines" },
fix(fixer) {
- return fixer.removeRange([
- sourceCode.getIndexFromLoc({ line: lastLineNumber + 1, column: 0 }),
- sourceCode.getIndexFromLoc({ line: lineNumber - maxAllowed, column: 0 })
- ]);
+ const rangeStart = sourceCode.getIndexFromLoc({ line: lastLineNumber + 1, column: 0 });
+
+ /*
+ * The end of the removal range is usually the start index of the next line.
+ * However, at the end of the file there is no next line, so the end of the
+ * range is just the length of the text.
+ */
+ const lineNumberAfterRemovedLines = lineNumber - maxAllowed;
+ const rangeEnd = lineNumberAfterRemovedLines <= allLines.length
+ ? sourceCode.getIndexFromLoc({ line: lineNumberAfterRemovedLines, column: 0 })
+ : sourceCode.text.length;
+
+ return fixer.removeRange([rangeStart, rangeEnd]);
}
});
}
diff --git a/tools/eslint/lib/rules/no-redeclare.js b/tools/eslint/lib/rules/no-redeclare.js
index bfbc09ffb6f324..ccb57003ed628b 100644
--- a/tools/eslint/lib/rules/no-redeclare.js
+++ b/tools/eslint/lib/rules/no-redeclare.js
@@ -35,7 +35,7 @@ module.exports = {
/**
* Find variables in a given scope and flag redeclared ones.
- * @param {Scope} scope - An escope scope object.
+ * @param {Scope} scope - An eslint-scope scope object.
* @returns {void}
* @private
*/
diff --git a/tools/eslint/lib/rules/no-self-compare.js b/tools/eslint/lib/rules/no-self-compare.js
index 54f907f594be06..5beaa181b99022 100644
--- a/tools/eslint/lib/rules/no-self-compare.js
+++ b/tools/eslint/lib/rules/no-self-compare.js
@@ -22,15 +22,28 @@ module.exports = {
},
create(context) {
+ const sourceCode = context.getSourceCode();
+
+ /**
+ * Determines whether two nodes are composed of the same tokens.
+ * @param {ASTNode} nodeA The first node
+ * @param {ASTNode} nodeB The second node
+ * @returns {boolean} true if the nodes have identical token representations
+ */
+ function hasSameTokens(nodeA, nodeB) {
+ const tokensA = sourceCode.getTokens(nodeA);
+ const tokensB = sourceCode.getTokens(nodeB);
+
+ return tokensA.length === tokensB.length &&
+ tokensA.every((token, index) => token.type === tokensB[index].type && token.value === tokensB[index].value);
+ }
return {
BinaryExpression(node) {
- const operators = ["===", "==", "!==", "!=", ">", "<", ">=", "<="];
+ const operators = new Set(["===", "==", "!==", "!=", ">", "<", ">=", "<="]);
- if (operators.indexOf(node.operator) > -1 &&
- (node.left.type === "Identifier" && node.right.type === "Identifier" && node.left.name === node.right.name ||
- node.left.type === "Literal" && node.right.type === "Literal" && node.left.value === node.right.value)) {
+ if (operators.has(node.operator) && hasSameTokens(node.left, node.right)) {
context.report({ node, message: "Comparing to itself is potentially pointless." });
}
}
diff --git a/tools/eslint/lib/rules/no-this-before-super.js b/tools/eslint/lib/rules/no-this-before-super.js
index c8d5dc4698d7b0..2a686ac72e9dd1 100644
--- a/tools/eslint/lib/rules/no-this-before-super.js
+++ b/tools/eslint/lib/rules/no-this-before-super.js
@@ -89,7 +89,7 @@ module.exports = {
*/
function isBeforeCallOfSuper() {
return (
- isInConstructorOfDerivedClass(funcInfo) &&
+ isInConstructorOfDerivedClass() &&
!funcInfo.codePath.currentSegments.every(isCalled)
);
}
@@ -206,7 +206,7 @@ module.exports = {
* @returns {void}
*/
onCodePathSegmentStart(segment) {
- if (!isInConstructorOfDerivedClass(funcInfo)) {
+ if (!isInConstructorOfDerivedClass()) {
return;
}
@@ -230,7 +230,7 @@ module.exports = {
* @returns {void}
*/
onCodePathSegmentLoop(fromSegment, toSegment) {
- if (!isInConstructorOfDerivedClass(funcInfo)) {
+ if (!isInConstructorOfDerivedClass()) {
return;
}
diff --git a/tools/eslint/lib/rules/no-undefined.js b/tools/eslint/lib/rules/no-undefined.js
index d29ac1e720f2c6..7e9f96b921855a 100644
--- a/tools/eslint/lib/rules/no-undefined.js
+++ b/tools/eslint/lib/rules/no-undefined.js
@@ -36,7 +36,7 @@ module.exports = {
/**
* Checks the given scope for references to `undefined` and reports
* all references found.
- * @param {escope.Scope} scope The scope to check.
+ * @param {eslint-scope.Scope} scope The scope to check.
* @returns {void}
*/
function checkScope(scope) {
diff --git a/tools/eslint/lib/rules/no-unexpected-multiline.js b/tools/eslint/lib/rules/no-unexpected-multiline.js
index 6c15f5dd591e31..9398b8a6036bc3 100644
--- a/tools/eslint/lib/rules/no-unexpected-multiline.js
+++ b/tools/eslint/lib/rules/no-unexpected-multiline.js
@@ -30,6 +30,9 @@ module.exports = {
const FUNCTION_MESSAGE = "Unexpected newline between function and ( of function call.";
const PROPERTY_MESSAGE = "Unexpected newline between object and [ of property access.";
const TAGGED_TEMPLATE_MESSAGE = "Unexpected newline between template tag and template literal.";
+ const DIVISION_MESSAGE = "Unexpected newline between numerator and division operator.";
+
+ const REGEX_FLAG_MATCHER = /^[gimuy]+$/;
const sourceCode = context.getSourceCode();
@@ -75,6 +78,19 @@ module.exports = {
return;
}
checkForBreakAfter(node.callee, FUNCTION_MESSAGE);
+ },
+
+ "BinaryExpression[operator='/'] > BinaryExpression[operator='/'].left"(node) {
+ const secondSlash = sourceCode.getTokenAfter(node, token => token.value === "/");
+ const tokenAfterOperator = sourceCode.getTokenAfter(secondSlash);
+
+ if (
+ tokenAfterOperator.type === "Identifier" &&
+ REGEX_FLAG_MATCHER.test(tokenAfterOperator.value) &&
+ secondSlash.range[1] === tokenAfterOperator.range[0]
+ ) {
+ checkForBreakAfter(node.left, DIVISION_MESSAGE);
+ }
}
};
diff --git a/tools/eslint/lib/rules/no-unmodified-loop-condition.js b/tools/eslint/lib/rules/no-unmodified-loop-condition.js
index 8243611913a1e8..dbf35baeddf348 100644
--- a/tools/eslint/lib/rules/no-unmodified-loop-condition.js
+++ b/tools/eslint/lib/rules/no-unmodified-loop-condition.js
@@ -18,14 +18,14 @@ const Traverser = require("../util/traverser"),
const pushAll = Function.apply.bind(Array.prototype.push);
const SENTINEL_PATTERN = /(?:(?:Call|Class|Function|Member|New|Yield)Expression|Statement|Declaration)$/;
-const LOOP_PATTERN = /^(?:DoWhile|For|While)Statement$/; // for-in/of statements don't have `test` property.
+const LOOP_PATTERN = /^(?:DoWhile|For|While)Statement$/; // for-in/of statements don't have `test` property.
const GROUP_PATTERN = /^(?:BinaryExpression|ConditionalExpression)$/;
const SKIP_PATTERN = /^(?:ArrowFunction|Class|Function)Expression$/;
const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/;
/**
* @typedef {Object} LoopConditionInfo
- * @property {escope.Reference} reference - The reference.
+ * @property {eslint-scope.Reference} reference - The reference.
* @property {ASTNode} group - BinaryExpression or ConditionalExpression nodes
* that the reference is belonging to.
* @property {Function} isInLoop - The predicate which checks a given reference
@@ -37,7 +37,7 @@ const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/;
/**
* Checks whether or not a given reference is a write reference.
*
- * @param {escope.Reference} reference - A reference to check.
+ * @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the reference is a write reference.
*/
function isWriteReference(reference) {
@@ -77,7 +77,7 @@ function isUnmodifiedAndNotBelongToGroup(condition) {
* Checks whether or not a given reference is inside of a given node.
*
* @param {ASTNode} node - A node to check.
- * @param {escope.Reference} reference - A reference to check.
+ * @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the reference is inside of the node.
*/
function isInRange(node, reference) {
@@ -91,7 +91,7 @@ function isInRange(node, reference) {
* Checks whether or not a given reference is inside of a loop node's condition.
*
* @param {ASTNode} node - A node to check.
- * @param {escope.Reference} reference - A reference to check.
+ * @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the reference is inside of the loop node's
* condition.
*/
@@ -134,7 +134,7 @@ function hasDynamicExpressions(root) {
/**
* Creates the loop condition information from a given reference.
*
- * @param {escope.Reference} reference - A reference to create.
+ * @param {eslint-scope.Reference} reference - A reference to create.
* @returns {LoopConditionInfo|null} Created loop condition info, or null.
*/
function toLoopCondition(reference) {
@@ -188,7 +188,7 @@ function toLoopCondition(reference) {
* Gets the function which encloses a given reference.
* This supports only FunctionDeclaration.
*
- * @param {escope.Reference} reference - A reference to get.
+ * @param {eslint-scope.Reference} reference - A reference to get.
* @returns {ASTNode|null} The function node or null.
*/
function getEncloseFunctionDeclaration(reference) {
@@ -209,7 +209,7 @@ function getEncloseFunctionDeclaration(reference) {
* Updates the "modified" flags of given loop conditions with given modifiers.
*
* @param {LoopConditionInfo[]} conditions - The loop conditions to be updated.
- * @param {escope.Reference[]} modifiers - The references to update.
+ * @param {eslint-scope.Reference[]} modifiers - The references to update.
* @returns {void}
*/
function updateModifiedFlag(conditions, modifiers) {
@@ -311,7 +311,7 @@ module.exports = {
* Finds unmodified references which are inside of a loop condition.
* Then reports the references which are outside of groups.
*
- * @param {escope.Variable} variable - A variable to report.
+ * @param {eslint-scope.Variable} variable - A variable to report.
* @returns {void}
*/
function checkReferences(variable) {
diff --git a/tools/eslint/lib/rules/no-unneeded-ternary.js b/tools/eslint/lib/rules/no-unneeded-ternary.js
index b031927f9248cb..929991f86bb843 100644
--- a/tools/eslint/lib/rules/no-unneeded-ternary.js
+++ b/tools/eslint/lib/rules/no-unneeded-ternary.js
@@ -134,7 +134,17 @@ module.exports = {
node,
loc: node.consequent.loc.start,
message: "Unnecessary use of conditional expression for default assignment.",
- fix: fixer => fixer.replaceText(node, `${astUtils.getParenthesisedText(sourceCode, node.test)} || ${astUtils.getParenthesisedText(sourceCode, node.alternate)}`)
+ fix: fixer => {
+ let nodeAlternate = astUtils.getParenthesisedText(sourceCode, node.alternate);
+
+ if (node.alternate.type === "ConditionalExpression") {
+ const isAlternateParenthesised = astUtils.isParenthesised(sourceCode, node.alternate);
+
+ nodeAlternate = isAlternateParenthesised ? nodeAlternate : `(${nodeAlternate})`;
+ }
+
+ return fixer.replaceText(node, `${astUtils.getParenthesisedText(sourceCode, node.test)} || ${nodeAlternate}`);
+ }
});
}
}
diff --git a/tools/eslint/lib/rules/no-unused-vars.js b/tools/eslint/lib/rules/no-unused-vars.js
index 6f270396739c8a..3ed278d54dcd9e 100644
--- a/tools/eslint/lib/rules/no-unused-vars.js
+++ b/tools/eslint/lib/rules/no-unused-vars.js
@@ -108,7 +108,7 @@ module.exports = {
/**
* Determines if a given variable is being exported from a module.
- * @param {Variable} variable - EScope variable object.
+ * @param {Variable} variable - eslint-scope variable object.
* @returns {boolean} True if the variable is exported, false if not.
* @private
*/
@@ -134,7 +134,7 @@ module.exports = {
/**
* Determines if a variable has a sibling rest property
- * @param {Variable} variable - EScope variable object.
+ * @param {Variable} variable - eslint-scope variable object.
* @returns {boolean} True if the variable is exported, false if not.
* @private
*/
@@ -157,7 +157,7 @@ module.exports = {
/**
* Determines if a reference is a read operation.
- * @param {Reference} ref - An escope Reference
+ * @param {Reference} ref - An eslint-scope Reference
* @returns {boolean} whether the given reference represents a read operation
* @private
*/
@@ -212,7 +212,7 @@ module.exports = {
* - The reference is inside of a function scope which is different from
* the declaration.
*
- * @param {escope.Reference} ref - A reference to check.
+ * @param {eslint-scope.Reference} ref - A reference to check.
* @param {ASTNode} prevRhsNode - The previous RHS node.
* @returns {ASTNode|null} The RHS node or null.
* @private
@@ -322,7 +322,7 @@ module.exports = {
/**
* Checks whether a given reference is a read to update itself or not.
*
- * @param {escope.Reference} ref - A reference to check.
+ * @param {eslint-scope.Reference} ref - A reference to check.
* @param {ASTNode} rhsNode - The RHS node of the previous assignment.
* @returns {boolean} The reference is a read to update itself.
* @private
@@ -422,7 +422,7 @@ module.exports = {
/**
* Checks whether the given variable is the last parameter in the non-ignored parameters.
*
- * @param {escope.Variable} variable - The variable to check.
+ * @param {eslint-scope.Variable} variable - The variable to check.
* @returns {boolean} `true` if the variable is the last.
*/
function isLastInNonIgnoredParameters(variable) {
@@ -448,7 +448,7 @@ module.exports = {
/**
* Gets an array of variables without read references.
- * @param {Scope} scope - an escope Scope object.
+ * @param {Scope} scope - an eslint-scope Scope object.
* @param {Variable[]} unusedVars - an array that saving result.
* @returns {Variable[]} unused variables of the scope and descendant scopes.
* @private
@@ -513,7 +513,7 @@ module.exports = {
}
// if "args" option is "after-used", skip all but the last parameter
- if (config.args === "after-used" && !isLastInNonIgnoredParameters(variable)) {
+ if (config.args === "after-used" && astUtils.isFunction(def.name.parent) && !isLastInNonIgnoredParameters(variable)) {
continue;
}
} else {
@@ -540,7 +540,7 @@ module.exports = {
/**
* Gets the index of a given variable name in a given comment.
- * @param {escope.Variable} variable - A variable to get.
+ * @param {eslint-scope.Variable} variable - A variable to get.
* @param {ASTNode} comment - A comment node which includes the variable name.
* @returns {number} The index of the variable name's location.
* @private
@@ -561,7 +561,7 @@ module.exports = {
* Creates the correct location of a given variables.
* The location is at its name string in a `/*global` comment.
*
- * @param {escope.Variable} variable - A variable to get its location.
+ * @param {eslint-scope.Variable} variable - A variable to get its location.
* @returns {{line: number, column: number}} The location object for the variable.
* @private
*/
diff --git a/tools/eslint/lib/rules/no-use-before-define.js b/tools/eslint/lib/rules/no-use-before-define.js
index 1a779b86f2318e..bdff23934c21fd 100644
--- a/tools/eslint/lib/rules/no-use-before-define.js
+++ b/tools/eslint/lib/rules/no-use-before-define.js
@@ -37,7 +37,7 @@ function parseOptions(options) {
/**
* Checks whether or not a given variable is a function declaration.
*
- * @param {escope.Variable} variable - A variable to check.
+ * @param {eslint-scope.Variable} variable - A variable to check.
* @returns {boolean} `true` if the variable is a function declaration.
*/
function isFunction(variable) {
@@ -47,8 +47,8 @@ function isFunction(variable) {
/**
* Checks whether or not a given variable is a class declaration in an upper function scope.
*
- * @param {escope.Variable} variable - A variable to check.
- * @param {escope.Reference} reference - A reference to check.
+ * @param {eslint-scope.Variable} variable - A variable to check.
+ * @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the variable is a class declaration.
*/
function isOuterClass(variable, reference) {
@@ -60,8 +60,8 @@ function isOuterClass(variable, reference) {
/**
* Checks whether or not a given variable is a variable declaration in an upper function scope.
-* @param {escope.Variable} variable - A variable to check.
-* @param {escope.Reference} reference - A reference to check.
+* @param {eslint-scope.Variable} variable - A variable to check.
+* @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the variable is a variable declaration.
*/
function isOuterVariable(variable, reference) {
@@ -167,8 +167,8 @@ module.exports = {
/**
* Determines whether a given use-before-define case should be reported according to the options.
- * @param {escope.Variable} variable The variable that gets used before being defined
- * @param {escope.Reference} reference The reference to the variable
+ * @param {eslint-scope.Variable} variable The variable that gets used before being defined
+ * @param {eslint-scope.Reference} reference The reference to the variable
* @returns {boolean} `true` if the usage should be reported
*/
function isForbidden(variable, reference) {
@@ -250,7 +250,7 @@ module.exports = {
ruleDefinition["ArrowFunctionExpression:exit"] = function(node) {
if (node.body.type !== "BlockStatement") {
- findVariables(node);
+ findVariables();
}
};
} else {
diff --git a/tools/eslint/lib/rules/no-useless-computed-key.js b/tools/eslint/lib/rules/no-useless-computed-key.js
index fd5ec2c92b5c5c..23de2f3734a0b7 100644
--- a/tools/eslint/lib/rules/no-useless-computed-key.js
+++ b/tools/eslint/lib/rules/no-useless-computed-key.js
@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
const astUtils = require("../ast-utils");
-const esUtils = require("esutils");
//------------------------------------------------------------------------------
// Rule Definition
@@ -61,8 +60,7 @@ module.exports = {
// Insert a space before the key to avoid changing identifiers, e.g. ({ get[2]() {} }) to ({ get2() {} })
const needsSpaceBeforeKey = tokenBeforeLeftBracket.range[1] === leftSquareBracket.range[0] &&
- esUtils.code.isIdentifierPartES6(tokenBeforeLeftBracket.value.slice(-1).charCodeAt(0)) &&
- esUtils.code.isIdentifierPartES6(key.raw.charCodeAt(0));
+ !astUtils.canTokensBeAdjacent(tokenBeforeLeftBracket, sourceCode.getFirstToken(key));
const replacementKey = (needsSpaceBeforeKey ? " " : "") + key.raw;
diff --git a/tools/eslint/lib/rules/no-useless-escape.js b/tools/eslint/lib/rules/no-useless-escape.js
index ffe11999707ce2..0212bd60e3bdac 100644
--- a/tools/eslint/lib/rules/no-useless-escape.js
+++ b/tools/eslint/lib/rules/no-useless-escape.js
@@ -75,7 +75,7 @@ module.exports = {
docs: {
description: "disallow unnecessary escape characters",
category: "Best Practices",
- recommended: false
+ recommended: true
},
schema: []
diff --git a/tools/eslint/lib/rules/no-var.js b/tools/eslint/lib/rules/no-var.js
index 86373ad5009eda..c74e0b9ad9f6df 100644
--- a/tools/eslint/lib/rules/no-var.js
+++ b/tools/eslint/lib/rules/no-var.js
@@ -19,8 +19,8 @@ const astUtils = require("../ast-utils");
* Finds the nearest function scope or global scope walking up the scope
* hierarchy.
*
- * @param {escope.Scope} scope - The scope to traverse.
- * @returns {escope.Scope} a function scope or global scope containing the given
+ * @param {eslint-scope.Scope} scope - The scope to traverse.
+ * @returns {eslint-scope.Scope} a function scope or global scope containing the given
* scope.
*/
function getEnclosingFunctionScope(scope) {
@@ -34,7 +34,7 @@ function getEnclosingFunctionScope(scope) {
* Checks whether the given variable has any references from a more specific
* function expression (i.e. a closure).
*
- * @param {escope.Variable} variable - A variable to check.
+ * @param {eslint-scope.Variable} variable - A variable to check.
* @returns {boolean} `true` if the variable is used from a closure.
*/
function isReferencedInClosure(variable) {
@@ -93,7 +93,7 @@ function getScopeNode(node) {
/**
* Checks whether a given variable is redeclared or not.
*
- * @param {escope.Variable} variable - A variable to check.
+ * @param {eslint-scope.Variable} variable - A variable to check.
* @returns {boolean} `true` if the variable is redeclared.
*/
function isRedeclared(variable) {
@@ -112,7 +112,7 @@ function isUsedFromOutsideOf(scopeNode) {
/**
* Checks whether a given reference is inside of the specified scope or not.
*
- * @param {escope.Reference} reference - A reference to check.
+ * @param {eslint-scope.Reference} reference - A reference to check.
* @returns {boolean} `true` if the reference is inside of the specified
* scope.
*/
diff --git a/tools/eslint/lib/rules/no-warning-comments.js b/tools/eslint/lib/rules/no-warning-comments.js
index bda43086865a1c..c0ecaca9e7dff4 100644
--- a/tools/eslint/lib/rules/no-warning-comments.js
+++ b/tools/eslint/lib/rules/no-warning-comments.js
@@ -40,7 +40,8 @@ module.exports = {
create(context) {
- const configuration = context.options[0] || {},
+ const sourceCode = context.getSourceCode(),
+ configuration = context.options[0] || {},
warningTerms = configuration.terms || ["todo", "fixme", "xxx"],
location = configuration.location || "start",
selfConfigRegEx = /\bno-warning-comments\b/;
@@ -128,8 +129,11 @@ module.exports = {
}
return {
- BlockComment: checkComment,
- LineComment: checkComment
+ Program() {
+ const comments = sourceCode.getAllComments();
+
+ comments.filter(token => token.type !== "Shebang").forEach(checkComment);
+ }
};
}
};
diff --git a/tools/eslint/lib/rules/object-curly-newline.js b/tools/eslint/lib/rules/object-curly-newline.js
index a4451154dfb148..b78cb9cfce4979 100644
--- a/tools/eslint/lib/rules/object-curly-newline.js
+++ b/tools/eslint/lib/rules/object-curly-newline.js
@@ -30,6 +30,9 @@ const OPTION_VALUE = {
minProperties: {
type: "integer",
minimum: 0
+ },
+ consistent: {
+ type: "boolean"
}
},
additionalProperties: false,
@@ -42,11 +45,12 @@ const OPTION_VALUE = {
* Normalizes a given option value.
*
* @param {string|Object|undefined} value - An option value to parse.
- * @returns {{multiline: boolean, minProperties: number}} Normalized option object.
+ * @returns {{multiline: boolean, minProperties: number, consistent: boolean}} Normalized option object.
*/
function normalizeOptionValue(value) {
let multiline = false;
let minProperties = Number.POSITIVE_INFINITY;
+ let consistent = false;
if (value) {
if (value === "always") {
@@ -56,12 +60,13 @@ function normalizeOptionValue(value) {
} else {
multiline = Boolean(value.multiline);
minProperties = value.minProperties || Number.POSITIVE_INFINITY;
+ consistent = Boolean(value.consistent);
}
} else {
multiline = true;
}
- return { multiline, minProperties };
+ return { multiline, minProperties, consistent };
}
/**
@@ -172,7 +177,14 @@ module.exports = {
});
}
} else {
- if (!astUtils.isTokenOnSameLine(openBrace, first)) {
+ const consistent = options.consistent;
+ const hasLineBreakBetweenOpenBraceAndFirst = !astUtils.isTokenOnSameLine(openBrace, first);
+ const hasLineBreakBetweenCloseBraceAndLast = !astUtils.isTokenOnSameLine(last, closeBrace);
+
+ if (
+ (!consistent && hasLineBreakBetweenOpenBraceAndFirst) ||
+ (consistent && hasLineBreakBetweenOpenBraceAndFirst && !hasLineBreakBetweenCloseBraceAndLast)
+ ) {
context.report({
message: "Unexpected line break after this opening brace.",
node,
@@ -185,7 +197,10 @@ module.exports = {
}
});
}
- if (!astUtils.isTokenOnSameLine(last, closeBrace)) {
+ if (
+ (!consistent && hasLineBreakBetweenCloseBraceAndLast) ||
+ (consistent && !hasLineBreakBetweenOpenBraceAndFirst && hasLineBreakBetweenCloseBraceAndLast)
+ ) {
context.report({
message: "Unexpected line break before this closing brace.",
node,
diff --git a/tools/eslint/lib/rules/object-shorthand.js b/tools/eslint/lib/rules/object-shorthand.js
index 1d3d9dae195ddb..2f7b0ccf90489f 100644
--- a/tools/eslint/lib/rules/object-shorthand.js
+++ b/tools/eslint/lib/rules/object-shorthand.js
@@ -392,7 +392,7 @@ module.exports = {
});
}
} else if (APPLY_TO_METHODS && !node.value.id && (node.value.type === "FunctionExpression" || node.value.type === "ArrowFunctionExpression")) {
- if (IGNORE_CONSTRUCTORS && isConstructor(node.key.name)) {
+ if (IGNORE_CONSTRUCTORS && node.key.type === "Identifier" && isConstructor(node.key.name)) {
return;
}
if (AVOID_QUOTES && isStringLiteral(node.key)) {
diff --git a/tools/eslint/lib/rules/padded-blocks.js b/tools/eslint/lib/rules/padded-blocks.js
index 36036aec4d95df..a485c1770ddcdb 100644
--- a/tools/eslint/lib/rules/padded-blocks.js
+++ b/tools/eslint/lib/rules/padded-blocks.js
@@ -51,7 +51,11 @@ module.exports = {
const config = context.options[0] || "always";
if (typeof config === "string") {
- options.blocks = config === "always";
+ const shouldHavePadding = config === "always";
+
+ options.blocks = shouldHavePadding;
+ options.switches = shouldHavePadding;
+ options.classes = shouldHavePadding;
} else {
if (config.hasOwnProperty("blocks")) {
options.blocks = config.blocks === "always";
diff --git a/tools/eslint/lib/rules/padding-line-between-statements.js b/tools/eslint/lib/rules/padding-line-between-statements.js
new file mode 100644
index 00000000000000..707cf33d85cff7
--- /dev/null
+++ b/tools/eslint/lib/rules/padding-line-between-statements.js
@@ -0,0 +1,587 @@
+/**
+ * @fileoverview Rule to require or disallow newlines between statements
+ * @author Toru Nagashima
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("../ast-utils");
+
+//------------------------------------------------------------------------------
+// Helpers
+//------------------------------------------------------------------------------
+
+const LT = `[${Array.from(astUtils.LINEBREAKS).join("")}]`;
+const PADDING_LINE_SEQUENCE = new RegExp(
+ String.raw`^(\s*?${LT})\s*${LT}(\s*;?)$`
+);
+const CJS_EXPORT = /^(?:module\s*\.\s*)?exports(?:\s*\.|\s*\[|$)/;
+const CJS_IMPORT = /^require\(/;
+
+/**
+ * Creates tester which check if a node starts with specific keyword.
+ *
+ * @param {string} keyword The keyword to test.
+ * @returns {Object} the created tester.
+ * @private
+ */
+function newKeywordTester(keyword) {
+ return {
+ test: (node, sourceCode) =>
+ sourceCode.getFirstToken(node).value === keyword
+ };
+}
+
+/**
+ * Creates tester which check if a node is specific type.
+ *
+ * @param {string} type The node type to test.
+ * @returns {Object} the created tester.
+ * @private
+ */
+function newNodeTypeTester(type) {
+ return {
+ test: node =>
+ node.type === type
+ };
+}
+
+/**
+ * Checks the given node is an expression statement of IIFE.
+ *
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is an expression statement of IIFE.
+ * @private
+ */
+function isIIFEStatement(node) {
+ if (node.type === "ExpressionStatement") {
+ let call = node.expression;
+
+ if (call.type === "UnaryExpression") {
+ call = call.argument;
+ }
+ return call.type === "CallExpression" && astUtils.isFunction(call.callee);
+ }
+ return false;
+}
+
+/**
+ * Checks whether the given node is a block-like statement.
+ * This checks the last token of the node is the closing brace of a block.
+ *
+ * @param {SourceCode} sourceCode The source code to get tokens.
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is a block-like statement.
+ * @private
+ */
+function isBlockLikeStatement(sourceCode, node) {
+
+ // do-while with a block is a block-like statement.
+ if (node.type === "DoWhileStatement" && node.body.type === "BlockStatement") {
+ return true;
+ }
+
+ // IIFE is a block-like statement specially from
+ // JSCS#disallowPaddingNewLinesAfterBlocks.
+ if (isIIFEStatement(node)) {
+ return true;
+ }
+
+ // Checks the last token is a closing brace of blocks.
+ const lastToken = sourceCode.getLastToken(node, astUtils.isNotSemicolonToken);
+ const belongingNode = astUtils.isClosingBraceToken(lastToken)
+ ? sourceCode.getNodeByRangeIndex(lastToken.range[0])
+ : null;
+
+ return Boolean(belongingNode) && (
+ belongingNode.type === "BlockStatement" ||
+ belongingNode.type === "SwitchStatement"
+ );
+}
+
+/**
+ * Check whether the given node is a directive or not.
+ * @param {ASTNode} node The node to check.
+ * @param {SourceCode} sourceCode The source code object to get tokens.
+ * @returns {boolean} `true` if the node is a directive.
+ */
+function isDirective(node, sourceCode) {
+ return (
+ node.type === "ExpressionStatement" &&
+ (
+ node.parent.type === "Program" ||
+ (
+ node.parent.type === "BlockStatement" &&
+ astUtils.isFunction(node.parent.parent)
+ )
+ ) &&
+ node.expression.type === "Literal" &&
+ typeof node.expression.value === "string" &&
+ !astUtils.isParenthesised(sourceCode, node.expression)
+ );
+}
+
+/**
+ * Check whether the given node is a part of directive prologue or not.
+ * @param {ASTNode} node The node to check.
+ * @param {SourceCode} sourceCode The source code object to get tokens.
+ * @returns {boolean} `true` if the node is a part of directive prologue.
+ */
+function isDirectivePrologue(node, sourceCode) {
+ if (isDirective(node, sourceCode)) {
+ for (const sibling of node.parent.body) {
+ if (sibling === node) {
+ break;
+ }
+ if (!isDirective(sibling, sourceCode)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Gets the actual last token.
+ *
+ * If a semicolon is semicolon-less style's semicolon, this ignores it.
+ * For example:
+ *
+ * foo()
+ * ;[1, 2, 3].forEach(bar)
+ *
+ * @param {SourceCode} sourceCode The source code to get tokens.
+ * @param {ASTNode} node The node to get.
+ * @returns {Token} The actual last token.
+ * @private
+ */
+function getActualLastToken(sourceCode, node) {
+ const semiToken = sourceCode.getLastToken(node);
+ const prevToken = sourceCode.getTokenBefore(semiToken);
+ const nextToken = sourceCode.getTokenAfter(semiToken);
+ const isSemicolonLessStyle = Boolean(
+ prevToken &&
+ nextToken &&
+ prevToken.range[0] >= node.range[0] &&
+ astUtils.isSemicolonToken(semiToken) &&
+ semiToken.loc.start.line !== prevToken.loc.end.line &&
+ semiToken.loc.end.line === nextToken.loc.start.line
+ );
+
+ return isSemicolonLessStyle ? prevToken : semiToken;
+}
+
+/**
+ * This returns the concatenation of the first 2 captured strings.
+ * @param {string} _ Unused. Whole matched string.
+ * @param {string} trailingSpaces The trailing spaces of the first line.
+ * @param {string} indentSpaces The indentation spaces of the last line.
+ * @returns {string} The concatenation of trailingSpaces and indentSpaces.
+ * @private
+ */
+function replacerToRemovePaddingLines(_, trailingSpaces, indentSpaces) {
+ return trailingSpaces + indentSpaces;
+}
+
+/**
+ * Check and report statements for `any` configuration.
+ * It does nothing.
+ *
+ * @returns {void}
+ * @private
+ */
+function verifyForAny() {
+}
+
+/**
+ * Check and report statements for `never` configuration.
+ * This autofix removes blank lines between the given 2 statements.
+ * However, if comments exist between 2 blank lines, it does not remove those
+ * blank lines automatically.
+ *
+ * @param {RuleContext} context The rule context to report.
+ * @param {ASTNode} prevNode The previous node to check.
+ * @param {ASTNode} nextNode The next node to check.
+ * @param {Array} paddingLines The array of token pairs that blank
+ * lines exist between the pair.
+ * @returns {void}
+ * @private
+ */
+function verifyForNever(context, prevNode, nextNode, paddingLines) {
+ if (paddingLines.length === 0) {
+ return;
+ }
+
+ context.report({
+ node: nextNode,
+ message: "Unexpected blank line before this statement.",
+ fix(fixer) {
+ if (paddingLines.length >= 2) {
+ return null;
+ }
+
+ const prevToken = paddingLines[0][0];
+ const nextToken = paddingLines[0][1];
+ const start = prevToken.range[1];
+ const end = nextToken.range[0];
+ const text = context.getSourceCode().text
+ .slice(start, end)
+ .replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines);
+
+ return fixer.replaceTextRange([start, end], text);
+ }
+ });
+}
+
+/**
+ * Check and report statements for `always` configuration.
+ * This autofix inserts a blank line between the given 2 statements.
+ * If the `prevNode` has trailing comments, it inserts a blank line after the
+ * trailing comments.
+ *
+ * @param {RuleContext} context The rule context to report.
+ * @param {ASTNode} prevNode The previous node to check.
+ * @param {ASTNode} nextNode The next node to check.
+ * @param {Array} paddingLines The array of token pairs that blank
+ * lines exist between the pair.
+ * @returns {void}
+ * @private
+ */
+function verifyForAlways(context, prevNode, nextNode, paddingLines) {
+ if (paddingLines.length > 0) {
+ return;
+ }
+
+ context.report({
+ node: nextNode,
+ message: "Expected blank line before this statement.",
+ fix(fixer) {
+ const sourceCode = context.getSourceCode();
+ let prevToken = getActualLastToken(sourceCode, prevNode);
+ const nextToken = sourceCode.getFirstTokenBetween(
+ prevToken,
+ nextNode,
+ {
+ includeComments: true,
+
+ /**
+ * Skip the trailing comments of the previous node.
+ * This inserts a blank line after the last trailing comment.
+ *
+ * For example:
+ *
+ * foo(); // trailing comment.
+ * // comment.
+ * bar();
+ *
+ * Get fixed to:
+ *
+ * foo(); // trailing comment.
+ *
+ * // comment.
+ * bar();
+ *
+ * @param {Token} token The token to check.
+ * @returns {boolean} `true` if the token is not a trailing comment.
+ * @private
+ */
+ filter(token) {
+ if (astUtils.isTokenOnSameLine(prevToken, token)) {
+ prevToken = token;
+ return false;
+ }
+ return true;
+ }
+ }
+ ) || nextNode;
+ const insertText = astUtils.isTokenOnSameLine(prevToken, nextToken)
+ ? "\n\n"
+ : "\n";
+
+ return fixer.insertTextAfter(prevToken, insertText);
+ }
+ });
+}
+
+/**
+ * Types of blank lines.
+ * `any`, `never`, and `always` are defined.
+ * Those have `verify` method to check and report statements.
+ * @private
+ */
+const PaddingTypes = {
+ any: { verify: verifyForAny },
+ never: { verify: verifyForNever },
+ always: { verify: verifyForAlways }
+};
+
+/**
+ * Types of statements.
+ * Those have `test` method to check it matches to the given statement.
+ * @private
+ */
+const StatementTypes = {
+ "*": { test: () => true },
+ "block-like": {
+ test: (node, sourceCode) => isBlockLikeStatement(sourceCode, node)
+ },
+ "cjs-export": {
+ test: (node, sourceCode) =>
+ node.type === "ExpressionStatement" &&
+ node.expression.type === "AssignmentExpression" &&
+ CJS_EXPORT.test(sourceCode.getText(node.expression.left))
+ },
+ "cjs-import": {
+ test: (node, sourceCode) =>
+ node.type === "VariableDeclaration" &&
+ node.declarations.length > 0 &&
+ Boolean(node.declarations[0].init) &&
+ CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init))
+ },
+ directive: {
+ test: isDirectivePrologue
+ },
+ expression: {
+ test: (node, sourceCode) =>
+ node.type === "ExpressionStatement" &&
+ !isDirectivePrologue(node, sourceCode)
+ },
+ "multiline-block-like": {
+ test: (node, sourceCode) =>
+ node.loc.start.line !== node.loc.end.line &&
+ isBlockLikeStatement(sourceCode, node)
+ },
+
+ block: newNodeTypeTester("BlockStatement"),
+ empty: newNodeTypeTester("EmptyStatement"),
+
+ break: newKeywordTester("break"),
+ case: newKeywordTester("case"),
+ class: newKeywordTester("class"),
+ const: newKeywordTester("const"),
+ continue: newKeywordTester("continue"),
+ debugger: newKeywordTester("debugger"),
+ default: newKeywordTester("default"),
+ do: newKeywordTester("do"),
+ export: newKeywordTester("export"),
+ for: newKeywordTester("for"),
+ function: newKeywordTester("function"),
+ if: newKeywordTester("if"),
+ import: newKeywordTester("import"),
+ let: newKeywordTester("let"),
+ return: newKeywordTester("return"),
+ switch: newKeywordTester("switch"),
+ throw: newKeywordTester("throw"),
+ try: newKeywordTester("try"),
+ var: newKeywordTester("var"),
+ while: newKeywordTester("while"),
+ with: newKeywordTester("with")
+};
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "require or disallow padding lines between statements",
+ category: "Stylistic Issues",
+ recommended: false
+ },
+ fixable: "whitespace",
+ schema: {
+ definitions: {
+ paddingType: {
+ enum: Object.keys(PaddingTypes)
+ },
+ statementType: {
+ anyOf: [
+ { enum: Object.keys(StatementTypes) },
+ {
+ type: "array",
+ items: { enum: Object.keys(StatementTypes) },
+ minItems: 1,
+ uniqueItems: true,
+ additionalItems: false
+ }
+ ]
+ }
+ },
+ type: "array",
+ items: {
+ type: "object",
+ properties: {
+ blankLine: { $ref: "#/definitions/paddingType" },
+ prev: { $ref: "#/definitions/statementType" },
+ next: { $ref: "#/definitions/statementType" }
+ },
+ additionalProperties: false,
+ required: ["blankLine", "prev", "next"]
+ },
+ additionalItems: false
+ }
+ },
+
+ create(context) {
+ const sourceCode = context.getSourceCode();
+ const configureList = context.options || [];
+ let scopeInfo = null;
+
+ /**
+ * Processes to enter to new scope.
+ * This manages the current previous statement.
+ * @returns {void}
+ * @private
+ */
+ function enterScope() {
+ scopeInfo = {
+ upper: scopeInfo,
+ prevNode: null
+ };
+ }
+
+ /**
+ * Processes to exit from the current scope.
+ * @returns {void}
+ * @private
+ */
+ function exitScope() {
+ scopeInfo = scopeInfo.upper;
+ }
+
+ /**
+ * Checks whether the given node matches the given type.
+ *
+ * @param {ASTNode} node The statement node to check.
+ * @param {string|string[]} type The statement type to check.
+ * @returns {boolean} `true` if the statement node matched the type.
+ * @private
+ */
+ function match(node, type) {
+ while (node.type === "LabeledStatement") {
+ node = node.body;
+ }
+ if (Array.isArray(type)) {
+ return type.some(match.bind(null, node));
+ }
+ return StatementTypes[type].test(node, sourceCode);
+ }
+
+ /**
+ * Finds the last matched configure from configureList.
+ *
+ * @param {ASTNode} prevNode The previous statement to match.
+ * @param {ASTNode} nextNode The current statement to match.
+ * @returns {Object} The tester of the last matched configure.
+ * @private
+ */
+ function getPaddingType(prevNode, nextNode) {
+ for (let i = configureList.length - 1; i >= 0; --i) {
+ const configure = configureList[i];
+ const matched =
+ match(prevNode, configure.prev) &&
+ match(nextNode, configure.next);
+
+ if (matched) {
+ return PaddingTypes[configure.blankLine];
+ }
+ }
+ return PaddingTypes.any;
+ }
+
+ /**
+ * Gets padding line sequences between the given 2 statements.
+ * Comments are separators of the padding line sequences.
+ *
+ * @param {ASTNode} prevNode The previous statement to count.
+ * @param {ASTNode} nextNode The current statement to count.
+ * @returns {Array} The array of token pairs.
+ * @private
+ */
+ function getPaddingLineSequences(prevNode, nextNode) {
+ const pairs = [];
+ let prevToken = getActualLastToken(sourceCode, prevNode);
+
+ if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) {
+ do {
+ const token = sourceCode.getTokenAfter(
+ prevToken,
+ { includeComments: true }
+ );
+
+ if (token.loc.start.line - prevToken.loc.end.line >= 2) {
+ pairs.push([prevToken, token]);
+ }
+ prevToken = token;
+
+ } while (prevToken.range[0] < nextNode.range[0]);
+ }
+
+ return pairs;
+ }
+
+ /**
+ * Verify padding lines between the given node and the previous node.
+ *
+ * @param {ASTNode} node The node to verify.
+ * @returns {void}
+ * @private
+ */
+ function verify(node) {
+ const parentType = node.parent.type;
+ const validParent =
+ astUtils.STATEMENT_LIST_PARENTS.has(parentType) ||
+ parentType === "SwitchStatement";
+
+ if (!validParent) {
+ return;
+ }
+
+ // Save this node as the current previous statement.
+ const prevNode = scopeInfo.prevNode;
+
+ // Verify.
+ if (prevNode) {
+ const type = getPaddingType(prevNode, node);
+ const paddingLines = getPaddingLineSequences(prevNode, node);
+
+ type.verify(context, prevNode, node, paddingLines);
+ }
+
+ scopeInfo.prevNode = node;
+ }
+
+ /**
+ * Verify padding lines between the given node and the previous node.
+ * Then process to enter to new scope.
+ *
+ * @param {ASTNode} node The node to verify.
+ * @returns {void}
+ * @private
+ */
+ function verifyThenEnterScope(node) {
+ verify(node);
+ enterScope();
+ }
+
+ return {
+ Program: enterScope,
+ BlockStatement: enterScope,
+ SwitchStatement: enterScope,
+ "Program:exit": exitScope,
+ "BlockStatement:exit": exitScope,
+ "SwitchStatement:exit": exitScope,
+
+ ":statement": verify,
+
+ SwitchCase: verifyThenEnterScope,
+ "SwitchCase:exit": exitScope
+ };
+ }
+};
diff --git a/tools/eslint/lib/rules/prefer-arrow-callback.js b/tools/eslint/lib/rules/prefer-arrow-callback.js
index ee385042f1309e..43a8bb77dec634 100644
--- a/tools/eslint/lib/rules/prefer-arrow-callback.js
+++ b/tools/eslint/lib/rules/prefer-arrow-callback.js
@@ -11,7 +11,7 @@
/**
* Checks whether or not a given variable is a function name.
- * @param {escope.Variable} variable - A variable to check.
+ * @param {eslint-scope.Variable} variable - A variable to check.
* @returns {boolean} `true` if the variable is a function name.
*/
function isFunctionName(variable) {
@@ -31,8 +31,8 @@ function checkMetaProperty(node, metaName, propertyName) {
/**
* Gets the variable object of `arguments` which is defined implicitly.
- * @param {escope.Scope} scope - A scope to get.
- * @returns {escope.Variable} The found variable object.
+ * @param {eslint-scope.Scope} scope - A scope to get.
+ * @returns {eslint-scope.Variable} The found variable object.
*/
function getVariableOfArguments(scope) {
const variables = scope.variables;
@@ -159,7 +159,7 @@ module.exports = {
create(context) {
const options = context.options[0] || {};
- const allowUnboundThis = options.allowUnboundThis !== false; // default to true
+ const allowUnboundThis = options.allowUnboundThis !== false; // default to true
const allowNamedFunctions = options.allowNamedFunctions;
const sourceCode = context.getSourceCode();
@@ -277,15 +277,23 @@ module.exports = {
const paramsRightParen = sourceCode.getTokenBefore(node.body);
const asyncKeyword = node.async ? "async " : "";
const paramsFullText = sourceCode.text.slice(paramsLeftParen.range[0], paramsRightParen.range[1]);
-
- if (callbackInfo.isLexicalThis) {
-
- // If the callback function has `.bind(this)`, replace it with an arrow function and remove the binding.
- return fixer.replaceText(node.parent.parent, `${asyncKeyword}${paramsFullText} => ${sourceCode.getText(node.body)}`);
- }
-
- // Otherwise, only replace the `function` keyword and parameters with the arrow function parameters.
- return fixer.replaceTextRange([node.start, node.body.start], `${asyncKeyword}${paramsFullText} => `);
+ const arrowFunctionText = `${asyncKeyword}${paramsFullText} => ${sourceCode.getText(node.body)}`;
+
+ /*
+ * If the callback function has `.bind(this)`, replace it with an arrow function and remove the binding.
+ * Otherwise, just replace the arrow function itself.
+ */
+ const replacedNode = callbackInfo.isLexicalThis ? node.parent.parent : node;
+
+ /*
+ * If the replaced node is part of a BinaryExpression, LogicalExpression, or MemberExpression, then
+ * the arrow function needs to be parenthesized, because `foo || () => {}` is invalid syntax even
+ * though `foo || function() {}` is valid.
+ */
+ const needsParens = replacedNode.parent.type !== "CallExpression" && replacedNode.parent.type !== "ConditionalExpression";
+ const replacementText = needsParens ? `(${arrowFunctionText})` : arrowFunctionText;
+
+ return fixer.replaceText(replacedNode, replacementText);
}
});
}
diff --git a/tools/eslint/lib/rules/prefer-const.js b/tools/eslint/lib/rules/prefer-const.js
index 53bdc2ab7b0582..1395e0a8a08e92 100644
--- a/tools/eslint/lib/rules/prefer-const.js
+++ b/tools/eslint/lib/rules/prefer-const.js
@@ -73,7 +73,7 @@ function canBecomeVariableDeclaration(identifier) {
* warn such variables because this rule cannot distinguish whether the
* exported variables are reassigned or not.
*
- * @param {escope.Variable} variable - A variable to get.
+ * @param {eslint-scope.Variable} variable - A variable to get.
* @param {boolean} ignoreReadBeforeAssign -
* The value of `ignoreReadBeforeAssign` option.
* @returns {ASTNode|null}
@@ -85,17 +85,6 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) {
return null;
}
- /*
- * Due to a bug in acorn, code such as `let foo = 1; let foo = 2;` will not throw a syntax error. As a sanity
- * check, make sure that the variable only has one declaration. After the parsing bug is fixed, this check
- * will no longer be necessary, because variables declared with `let` or `const` should always have exactly one
- * declaration.
- * https://github.com/ternjs/acorn/issues/487
- */
- if (variable.defs.length > 1) {
- return null;
- }
-
// Finds the unique WriteReference.
let writer = null;
let isReadBeforeInit = false;
@@ -146,7 +135,7 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) {
* This is used to detect a mix of reassigned and never reassigned in a
* destructuring.
*
- * @param {escope.Reference} reference - A reference to get.
+ * @param {eslint-scope.Reference} reference - A reference to get.
* @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or
* null.
*/
@@ -172,7 +161,7 @@ function getDestructuringHost(reference) {
* This is used to detect a mix of reassigned and never reassigned in a
* destructuring.
*
- * @param {escope.Variable[]} variables - Variables to group by destructuring.
+ * @param {eslint-scope.Variable[]} variables - Variables to group by destructuring.
* @param {boolean} ignoreReadBeforeAssign -
* The value of `ignoreReadBeforeAssign` option.
* @returns {Map} Grouped identifier nodes.
@@ -274,7 +263,7 @@ module.exports = {
* the array is 1. In destructuring cases, the length of the array can
* be 2 or more.
*
- * @param {(escope.Reference|null)[]} nodes -
+ * @param {(eslint-scope.Reference|null)[]} nodes -
* References which are grouped by destructuring to report.
* @returns {void}
*/
diff --git a/tools/eslint/lib/rules/prefer-destructuring.js b/tools/eslint/lib/rules/prefer-destructuring.js
index d7fbc3559d7162..7f472b423bc18b 100644
--- a/tools/eslint/lib/rules/prefer-destructuring.js
+++ b/tools/eslint/lib/rules/prefer-destructuring.js
@@ -109,8 +109,10 @@ module.exports = {
return;
}
- if (checkArrays && isArrayIndexAccess(rightNode)) {
- report(reportNode, "array");
+ if (isArrayIndexAccess(rightNode)) {
+ if (checkArrays) {
+ report(reportNode, "array");
+ }
return;
}
diff --git a/tools/eslint/lib/rules/prefer-rest-params.js b/tools/eslint/lib/rules/prefer-rest-params.js
index a9db624dcb64aa..d55d5dad02a09e 100644
--- a/tools/eslint/lib/rules/prefer-rest-params.js
+++ b/tools/eslint/lib/rules/prefer-rest-params.js
@@ -11,8 +11,8 @@
/**
* Gets the variable object of `arguments` which is defined implicitly.
- * @param {escope.Scope} scope - A scope to get.
- * @returns {escope.Variable} The found variable object.
+ * @param {eslint-scope.Scope} scope - A scope to get.
+ * @returns {eslint-scope.Variable} The found variable object.
*/
function getVariableOfArguments(scope) {
const variables = scope.variables;
@@ -40,7 +40,7 @@ function getVariableOfArguments(scope) {
* - arguments[0] .... true // computed member access
* - arguments.length .... false // normal member access
*
- * @param {escope.Reference} reference - The reference to check.
+ * @param {eslint-scope.Reference} reference - The reference to check.
* @returns {boolean} `true` if the reference is not normal member access.
*/
function isNotNormalMemberAccess(reference) {
@@ -74,7 +74,7 @@ module.exports = {
/**
* Reports a given reference.
*
- * @param {escope.Reference} reference - A reference to report.
+ * @param {eslint-scope.Reference} reference - A reference to report.
* @returns {void}
*/
function report(reference) {
diff --git a/tools/eslint/lib/rules/radix.js b/tools/eslint/lib/rules/radix.js
index 0dfa081b6a3e35..0484c3bfb371b5 100644
--- a/tools/eslint/lib/rules/radix.js
+++ b/tools/eslint/lib/rules/radix.js
@@ -21,7 +21,7 @@ const MODE_ALWAYS = "always",
/**
* Checks whether a given variable is shadowed or not.
*
- * @param {escope.Variable} variable - A variable to check.
+ * @param {eslint-scope.Variable} variable - A variable to check.
* @returns {boolean} `true` if the variable is shadowed.
*/
function isShadowed(variable) {
diff --git a/tools/eslint/lib/rules/semi-style.js b/tools/eslint/lib/rules/semi-style.js
new file mode 100644
index 00000000000000..97fcc3ac8209bb
--- /dev/null
+++ b/tools/eslint/lib/rules/semi-style.js
@@ -0,0 +1,118 @@
+/**
+ * @fileoverview Rule to enforce location of semicolons.
+ * @author Toru Nagashima
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("../ast-utils");
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+const SELECTOR = `:matches(${
+ [
+ "BreakStatement", "ContinueStatement", "DebuggerStatement",
+ "DoWhileStatement", "EmptyStatement", "ExportAllDeclaration",
+ "ExportDefaultDeclaration", "ExportNamedDeclaration",
+ "ExpressionStatement", "ImportDeclaration", "ReturnStatement",
+ "ThrowStatement", "VariableDeclaration"
+ ].join(",")
+})`;
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "enforce location of semicolons",
+ category: "Stylistic Issues",
+ recommended: false
+ },
+ schema: [{ enum: ["last", "first"] }],
+ fixable: "whitespace"
+ },
+
+ create(context) {
+ const sourceCode = context.getSourceCode();
+ const option = context.options[0] || "last";
+
+ /**
+ * Check whether comments exist between the given 2 tokens.
+ * @param {Token} left The left token to check.
+ * @param {Token} right The right token to check.
+ * @returns {boolean} `true` if comments exist between the given 2 tokens.
+ */
+ function commentsExistBetween(left, right) {
+ return sourceCode.getFirstTokenBetween(
+ left,
+ right,
+ {
+ includeComments: true,
+ filter: astUtils.isCommentToken
+ }
+ ) !== null;
+ }
+
+ /**
+ * Check the given semicolon token.
+ * @param {Token} semiToken The semicolon token to check.
+ * @param {"first"|"last"} expected The expected location to check.
+ * @returns {void}
+ */
+ function check(semiToken, expected) {
+ const prevToken = sourceCode.getTokenBefore(semiToken);
+ const nextToken = sourceCode.getTokenAfter(semiToken);
+ const prevIsSameLine = !prevToken || astUtils.isTokenOnSameLine(prevToken, semiToken);
+ const nextIsSameLine = !nextToken || astUtils.isTokenOnSameLine(semiToken, nextToken);
+
+ if ((expected === "last" && !prevIsSameLine) || (expected === "first" && !nextIsSameLine)) {
+ context.report({
+ loc: semiToken.loc,
+ message: "Expected this semicolon to be at {{pos}}.",
+ data: {
+ pos: (expected === "last")
+ ? "the end of the previous line"
+ : "the beginning of the next line"
+ },
+ fix(fixer) {
+ if (prevToken && nextToken && commentsExistBetween(prevToken, nextToken)) {
+ return null;
+ }
+
+ const start = prevToken ? prevToken.range[1] : semiToken.range[0];
+ const end = nextToken ? nextToken.range[0] : semiToken.range[1];
+ const text = (expected === "last") ? ";\n" : "\n;";
+
+ return fixer.replaceTextRange([start, end], text);
+ }
+ });
+ }
+ }
+
+ return {
+ [SELECTOR](node) {
+ const lastToken = sourceCode.getLastToken(node);
+
+ if (astUtils.isSemicolonToken(lastToken)) {
+ check(lastToken, option);
+ }
+ },
+
+ ForStatement(node) {
+ const firstSemi = node.init && sourceCode.getTokenAfter(node.init, astUtils.isSemicolonToken);
+ const secondSemi = node.test && sourceCode.getTokenAfter(node.test, astUtils.isSemicolonToken);
+
+ if (firstSemi) {
+ check(firstSemi, "last");
+ }
+ if (secondSemi) {
+ check(secondSemi, "last");
+ }
+ }
+ };
+ }
+};
diff --git a/tools/eslint/lib/rules/sort-imports.js b/tools/eslint/lib/rules/sort-imports.js
index 2b382545efb3f7..74db02ad3dff74 100644
--- a/tools/eslint/lib/rules/sort-imports.js
+++ b/tools/eslint/lib/rules/sort-imports.js
@@ -149,7 +149,7 @@ module.exports = {
message: "Member '{{memberName}}' of the import declaration should be sorted alphabetically.",
data: { memberName: importSpecifiers[firstUnsortedIndex].local.name },
fix(fixer) {
- if (importSpecifiers.some(specifier => sourceCode.getComments(specifier).leading.length || sourceCode.getComments(specifier).trailing.length)) {
+ if (importSpecifiers.some(specifier => sourceCode.getCommentsBefore(specifier).length || sourceCode.getCommentsAfter(specifier).length)) {
// If there are comments in the ImportSpecifier list, don't rearrange the specifiers.
return null;
diff --git a/tools/eslint/lib/rules/space-before-function-paren.js b/tools/eslint/lib/rules/space-before-function-paren.js
index 53aac71ed6e162..8851c4587ac779 100644
--- a/tools/eslint/lib/rules/space-before-function-paren.js
+++ b/tools/eslint/lib/rules/space-before-function-paren.js
@@ -87,9 +87,7 @@ module.exports = {
// Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar
if (node.async && astUtils.isOpeningParenToken(sourceCode.getFirstToken(node, { skip: 1 }))) {
-
- // For backwards compatibility, the base config does not apply to async arrow functions.
- return overrideConfig.asyncArrow || "ignore";
+ return overrideConfig.asyncArrow || baseConfig;
}
} else if (isNamedFunction(node)) {
return overrideConfig.named || baseConfig;
diff --git a/tools/eslint/lib/rules/space-unary-ops.js b/tools/eslint/lib/rules/space-unary-ops.js
index 5b156fac2292d4..da525ea12c529f 100644
--- a/tools/eslint/lib/rules/space-unary-ops.js
+++ b/tools/eslint/lib/rules/space-unary-ops.js
@@ -4,6 +4,12 @@
*/
"use strict";
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("../ast-utils");
+
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@@ -68,21 +74,6 @@ module.exports = {
return node.argument && node.argument.type && node.argument.type === "ObjectExpression";
}
- /**
- * Check if it is safe to remove the spaces between the two tokens in
- * the context of a non-word prefix unary operator. For example, `+ +1`
- * cannot safely be changed to `++1`.
- * @param {Token} firstToken The operator for a non-word prefix unary operator
- * @param {Token} secondToken The first token of its operand
- * @returns {boolean} Whether or not the spacing between the tokens can be removed
- */
- function canRemoveSpacesBetween(firstToken, secondToken) {
- return !(
- (firstToken.value === "+" && secondToken.value[0] === "+") ||
- (firstToken.value === "-" && secondToken.value[0] === "-")
- );
- }
-
/**
* Checks if an override exists for a given operator.
* @param {ASTnode} node AST node
@@ -259,7 +250,7 @@ module.exports = {
operator: firstToken.value
},
fix(fixer) {
- if (canRemoveSpacesBetween(firstToken, secondToken)) {
+ if (astUtils.canTokensBeAdjacent(firstToken, secondToken)) {
return fixer.removeRange([firstToken.range[1], secondToken.range[0]]);
}
return null;
@@ -288,9 +279,11 @@ module.exports = {
* @returns {void}
*/
function checkForSpaces(node) {
- const tokens = sourceCode.getFirstTokens(node, 2),
- firstToken = tokens[0],
- secondToken = tokens[1];
+ const tokens = node.type === "UpdateExpression" && !node.prefix
+ ? sourceCode.getLastTokens(node, 2)
+ : sourceCode.getFirstTokens(node, 2);
+ const firstToken = tokens[0];
+ const secondToken = tokens[1];
if ((node.type === "NewExpression" || node.prefix) && firstToken.type === "Keyword") {
checkUnaryWordOperatorForSpaces(node, firstToken, secondToken);
diff --git a/tools/eslint/lib/rules/spaced-comment.js b/tools/eslint/lib/rules/spaced-comment.js
index 4e418fd19f3a86..b1e35055cecee4 100644
--- a/tools/eslint/lib/rules/spaced-comment.js
+++ b/tools/eslint/lib/rules/spaced-comment.js
@@ -229,6 +229,8 @@ module.exports = {
create(context) {
+ const sourceCode = context.getSourceCode();
+
// Unless the first option is never, require a space
const requireSpace = context.options[0] !== "never";
@@ -363,10 +365,11 @@ module.exports = {
}
return {
+ Program() {
+ const comments = sourceCode.getAllComments();
- LineComment: checkCommentForSpace,
- BlockComment: checkCommentForSpace
-
+ comments.filter(token => token.type !== "Shebang").forEach(checkCommentForSpace);
+ }
};
}
};
diff --git a/tools/eslint/lib/rules/switch-colon-spacing.js b/tools/eslint/lib/rules/switch-colon-spacing.js
new file mode 100644
index 00000000000000..400e850997e54e
--- /dev/null
+++ b/tools/eslint/lib/rules/switch-colon-spacing.js
@@ -0,0 +1,133 @@
+/**
+ * @fileoverview Rule to enforce spacing around colons of switch statements.
+ * @author Toru Nagashima
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const astUtils = require("../ast-utils");
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "enforce spacing around colons of switch statements",
+ category: "Stylistic Issues",
+ recommended: false
+ },
+ schema: [
+ {
+ type: "object",
+ properties: {
+ before: { type: "boolean" },
+ after: { type: "boolean" }
+ },
+ additionalProperties: false
+ }
+ ],
+ fixable: "whitespace"
+ },
+
+ create(context) {
+ const sourceCode = context.getSourceCode();
+ const options = context.options[0] || {};
+ const beforeSpacing = options.before === true; // false by default
+ const afterSpacing = options.after !== false; // true by default
+
+ /**
+ * Get the colon token of the given SwitchCase node.
+ * @param {ASTNode} node The SwitchCase node to get.
+ * @returns {Token} The colon token of the node.
+ */
+ function getColonToken(node) {
+ if (node.test) {
+ return sourceCode.getTokenAfter(node.test, astUtils.isColonToken);
+ }
+ return sourceCode.getFirstToken(node, 1);
+ }
+
+ /**
+ * Check whether the spacing between the given 2 tokens is valid or not.
+ * @param {Token} left The left token to check.
+ * @param {Token} right The right token to check.
+ * @param {boolean} expected The expected spacing to check. `true` if there should be a space.
+ * @returns {boolean} `true` if the spacing between the tokens is valid.
+ */
+ function isValidSpacing(left, right, expected) {
+ return (
+ astUtils.isClosingBraceToken(right) ||
+ !astUtils.isTokenOnSameLine(left, right) ||
+ sourceCode.isSpaceBetweenTokens(left, right) === expected
+ );
+ }
+
+ /**
+ * Check whether comments exist between the given 2 tokens.
+ * @param {Token} left The left token to check.
+ * @param {Token} right The right token to check.
+ * @returns {boolean} `true` if comments exist between the given 2 tokens.
+ */
+ function commentsExistBetween(left, right) {
+ return sourceCode.getFirstTokenBetween(
+ left,
+ right,
+ {
+ includeComments: true,
+ filter: astUtils.isCommentToken
+ }
+ ) !== null;
+ }
+
+ /**
+ * Fix the spacing between the given 2 tokens.
+ * @param {RuleFixer} fixer The fixer to fix.
+ * @param {Token} left The left token of fix range.
+ * @param {Token} right The right token of fix range.
+ * @param {boolean} spacing The spacing style. `true` if there should be a space.
+ * @returns {Fix|null} The fix object.
+ */
+ function fix(fixer, left, right, spacing) {
+ if (commentsExistBetween(left, right)) {
+ return null;
+ }
+ if (spacing) {
+ return fixer.insertTextAfter(left, " ");
+ }
+ return fixer.removeRange([left.range[1], right.range[0]]);
+ }
+
+ return {
+ SwitchCase(node) {
+ const colonToken = getColonToken(node);
+ const beforeToken = sourceCode.getTokenBefore(colonToken);
+ const afterToken = sourceCode.getTokenAfter(colonToken);
+
+ if (!isValidSpacing(beforeToken, colonToken, beforeSpacing)) {
+ context.report({
+ node,
+ loc: colonToken.loc,
+ message: "{{verb}} space(s) before this colon.",
+ data: { verb: beforeSpacing ? "Expected" : "Unexpected" },
+ fix: fixer => fix(fixer, beforeToken, colonToken, beforeSpacing)
+ });
+ }
+ if (!isValidSpacing(colonToken, afterToken, afterSpacing)) {
+ context.report({
+ node,
+ loc: colonToken.loc,
+ message: "{{verb}} space(s) after this colon.",
+ data: { verb: afterSpacing ? "Expected" : "Unexpected" },
+ fix: fixer => fix(fixer, colonToken, afterToken, afterSpacing)
+ });
+ }
+ }
+ };
+ }
+};
diff --git a/tools/eslint/lib/rules/template-tag-spacing.js b/tools/eslint/lib/rules/template-tag-spacing.js
index 808fe443891791..907c537ff30182 100755
--- a/tools/eslint/lib/rules/template-tag-spacing.js
+++ b/tools/eslint/lib/rules/template-tag-spacing.js
@@ -45,7 +45,7 @@ module.exports = {
loc: tagToken.loc.start,
message: "Unexpected space between template tag and template literal.",
fix(fixer) {
- const comments = sourceCode.getComments(node.quasi).leading;
+ const comments = sourceCode.getCommentsBefore(node.quasi);
// Don't fix anything if there's a single line comment after the template tag
if (comments.some(comment => comment.type === "Line")) {
diff --git a/tools/eslint/lib/rules/valid-jsdoc.js b/tools/eslint/lib/rules/valid-jsdoc.js
index 66ad1f8d45de1f..331ed7b69b6561 100644
--- a/tools/eslint/lib/rules/valid-jsdoc.js
+++ b/tools/eslint/lib/rules/valid-jsdoc.js
@@ -180,18 +180,18 @@ module.exports = {
let elements = [];
switch (type.type) {
- case "TypeApplication": // {Array.}
+ case "TypeApplication": // {Array.}
elements = type.applications[0].type === "UnionType" ? type.applications[0].elements : type.applications;
typesToCheck.push(getCurrentExpectedTypes(type));
break;
- case "RecordType": // {{20:String}}
+ case "RecordType": // {{20:String}}
elements = type.fields;
break;
- case "UnionType": // {String|number|Test}
- case "ArrayType": // {[String, number, Test]}
+ case "UnionType": // {String|number|Test}
+ case "ArrayType": // {[String, number, Test]}
elements = type.elements;
break;
- case "FieldType": // Array.<{count: number, votes: number}>
+ case "FieldType": // Array.<{count: number, votes: number}>
if (type.value) {
typesToCheck.push(getCurrentExpectedTypes(type.value));
}
diff --git a/tools/eslint/lib/testers/rule-tester.js b/tools/eslint/lib/testers/rule-tester.js
index 61fbdf597f8730..d66cd175a43e88 100644
--- a/tools/eslint/lib/testers/rule-tester.js
+++ b/tools/eslint/lib/testers/rule-tester.js
@@ -12,12 +12,12 @@
* RuleTester.add("{ruleName}", {
* valid: [
* "{code}",
- * { code: "{code}", options: {options}, global: {globals}, globals: {globals}, parser: "{parser}", settings: {settings} }
+ * { code: "{code}", options: {options}, globals: {globals}, parser: "{parser}", settings: {settings} }
* ],
* invalid: [
* { code: "{code}", errors: {numErrors} },
* { code: "{code}", errors: ["{errorMessage}"] },
- * { code: "{code}", options: {options}, global: {globals}, parser: "{parser}", settings: {settings}, errors: [{ message: "{errorMessage}", type: "{errorNodeType}"}] }
+ * { code: "{code}", options: {options}, globals: {globals}, parser: "{parser}", settings: {settings}, errors: [{ message: "{errorMessage}", type: "{errorNodeType}"}] }
* ]
* });
*
@@ -45,8 +45,8 @@ const lodash = require("lodash"),
util = require("util"),
validator = require("../config/config-validator"),
validate = require("is-my-json-valid"),
- eslint = require("../eslint"),
- rules = require("../rules"),
+ Linter = require("../linter"),
+ Environments = require("../config/environments"),
metaSchema = require("../../conf/json-schema-schema.json"),
SourceCodeFixer = require("../util/source-code-fixer");
@@ -69,8 +69,8 @@ const RuleTesterParameters = [
"code",
"filename",
"options",
- "args",
- "errors"
+ "errors",
+ "output"
];
const validateSchema = validate(metaSchema, { verbose: true });
@@ -129,114 +129,107 @@ function freezeDeeply(x) {
// Public Interface
//------------------------------------------------------------------------------
+// default separators for testing
+const DESCRIBE = Symbol("describe");
+const IT = Symbol("it");
+
/**
- * Creates a new instance of RuleTester.
- * @param {Object} [testerConfig] Optional, extra configuration for the tester
- * @constructor
+ * This is `it` or `describe` if those don't exist.
+ * @this {Mocha}
+ * @param {string} text - The description of the test case.
+ * @param {Function} method - The logic of the test case.
+ * @returns {any} Returned value of `method`.
*/
-function RuleTester(testerConfig) {
+function defaultHandler(text, method) {
+ return method.apply(this);
+}
+
+class RuleTester {
/**
- * The configuration to use for this tester. Combination of the tester
- * configuration and the default configuration.
- * @type {Object}
+ * Creates a new instance of RuleTester.
+ * @param {Object} [testerConfig] Optional, extra configuration for the tester
+ * @constructor
*/
- this.testerConfig = lodash.merge(
+ constructor(testerConfig) {
+
+ /**
+ * The configuration to use for this tester. Combination of the tester
+ * configuration and the default configuration.
+ * @type {Object}
+ */
+ this.testerConfig = lodash.merge(
- // we have to clone because merge uses the first argument for recipient
- lodash.cloneDeep(defaultConfig),
- testerConfig
- );
+ // we have to clone because merge uses the first argument for recipient
+ lodash.cloneDeep(defaultConfig),
+ testerConfig
+ );
+
+ /**
+ * Rule definitions to define before tests.
+ * @type {Object}
+ */
+ this.rules = {};
+ this.linter = new Linter();
+ }
/**
- * Rule definitions to define before tests.
- * @type {Object}
+ * Set the configuration to use for all future tests
+ * @param {Object} config the configuration to use.
+ * @returns {void}
*/
- this.rules = {};
-}
+ static setDefaultConfig(config) {
+ if (typeof config !== "object") {
+ throw new Error("RuleTester.setDefaultConfig: config must be an object");
+ }
+ defaultConfig = config;
-/**
- * Set the configuration to use for all future tests
- * @param {Object} config the configuration to use.
- * @returns {void}
- */
-RuleTester.setDefaultConfig = function(config) {
- if (typeof config !== "object") {
- throw new Error("RuleTester.setDefaultConfig: config must be an object");
+ // Make sure the rules object exists since it is assumed to exist later
+ defaultConfig.rules = defaultConfig.rules || {};
}
- defaultConfig = config;
- // Make sure the rules object exists since it is assumed to exist later
- defaultConfig.rules = defaultConfig.rules || {};
-};
-
-/**
- * Get the current configuration used for all tests
- * @returns {Object} the current configuration
- */
-RuleTester.getDefaultConfig = function() {
- return defaultConfig;
-};
+ /**
+ * Get the current configuration used for all tests
+ * @returns {Object} the current configuration
+ */
+ static getDefaultConfig() {
+ return defaultConfig;
+ }
-/**
- * Reset the configuration to the initial configuration of the tester removing
- * any changes made until now.
- * @returns {void}
- */
-RuleTester.resetDefaultConfig = function() {
- defaultConfig = lodash.cloneDeep(testerDefaultConfig);
-};
+ /**
+ * Reset the configuration to the initial configuration of the tester removing
+ * any changes made until now.
+ * @returns {void}
+ */
+ static resetDefaultConfig() {
+ defaultConfig = lodash.cloneDeep(testerDefaultConfig);
+ }
-// default separators for testing
-const DESCRIBE = Symbol("describe");
-const IT = Symbol("it");
-RuleTester[DESCRIBE] = RuleTester[IT] = null;
+ // If people use `mocha test.js --watch` command, `describe` and `it` function
+ // instances are different for each execution. So `describe` and `it` should get fresh instance
+ // always.
+ static get describe() {
+ return (
+ this[DESCRIBE] ||
+ (typeof describe === "function" ? describe : defaultHandler)
+ );
+ }
-/**
- * This is `it` or `describe` if those don't exist.
- * @this {Mocha}
- * @param {string} text - The description of the test case.
- * @param {Function} method - The logic of the test case.
- * @returns {any} Returned value of `method`.
- */
-function defaultHandler(text, method) {
- return method.apply(this);
-}
+ static set describe(value) {
+ this[DESCRIBE] = value;
+ }
-// If people use `mocha test.js --watch` command, `describe` and `it` function
-// instances are different for each execution. So this should get fresh instance
-// always.
-Object.defineProperties(RuleTester, {
- describe: {
- get() {
- return (
- RuleTester[DESCRIBE] ||
- (typeof describe === "function" ? describe : defaultHandler)
- );
- },
- set(value) {
- RuleTester[DESCRIBE] = value;
- },
- configurable: true,
- enumerable: true
- },
- it: {
- get() {
- return (
- RuleTester[IT] ||
- (typeof it === "function" ? it : defaultHandler)
- );
- },
- set(value) {
- RuleTester[IT] = value;
- },
- configurable: true,
- enumerable: true
+ static get it() {
+ return (
+ this[IT] ||
+ (typeof it === "function" ? it : defaultHandler)
+ );
}
-});
-RuleTester.prototype = {
+ static set it(value) {
+ this[IT] = value;
+ }
/**
* Define a rule for one particular run of tests.
@@ -246,7 +239,7 @@ RuleTester.prototype = {
*/
defineRule(name, rule) {
this.rules[name] = rule;
- },
+ }
/**
* Adds a new rule test to execute.
@@ -260,7 +253,8 @@ RuleTester.prototype = {
const testerConfig = this.testerConfig,
requiredScenarios = ["valid", "invalid"],
scenarioErrors = [],
- result = {};
+ result = {},
+ linter = this.linter;
if (lodash.isNil(test) || typeof test !== "object") {
throw new Error(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`);
@@ -312,18 +306,16 @@ RuleTester.prototype = {
filename = item.filename;
}
- if (item.options) {
- const options = item.options.concat();
-
- options.unshift(1);
- config.rules[ruleName] = options;
+ if (Object.prototype.hasOwnProperty.call(item, "options")) {
+ assert(Array.isArray(item.options), "options must be an array");
+ config.rules[ruleName] = [1].concat(item.options);
} else {
config.rules[ruleName] = 1;
}
- eslint.defineRule(ruleName, rule);
+ linter.defineRule(ruleName, rule);
- const schema = validator.getRuleOptionsSchema(ruleName);
+ const schema = validator.getRuleOptionsSchema(ruleName, linter.rules);
if (schema) {
validateSchema(schema);
@@ -335,29 +327,29 @@ RuleTester.prototype = {
}
}
- validator.validate(config, "rule-tester");
+ validator.validate(config, "rule-tester", linter.rules, new Environments());
/*
* Setup AST getters.
* The goal is to check whether or not AST was modified when
* running the rule under test.
*/
- eslint.reset();
+ linter.reset();
- eslint.on("Program", node => {
+ linter.on("Program", node => {
beforeAST = cloneDeeplyExcludesParent(node);
});
- eslint.on("Program:exit", node => {
+ linter.on("Program:exit", node => {
afterAST = node;
});
// Freezes rule-context properties.
- const originalGet = rules.get;
+ const originalGet = linter.rules.get;
try {
- rules.get = function(ruleId) {
- const rule = originalGet(ruleId);
+ linter.rules.get = function(ruleId) {
+ const rule = originalGet.call(linter.rules, ruleId);
if (typeof rule === "function") {
return function(context) {
@@ -384,12 +376,12 @@ RuleTester.prototype = {
};
return {
- messages: eslint.verify(code, config, filename, true),
+ messages: linter.verify(code, config, filename, true),
beforeAST,
afterAST: cloneDeeplyExcludesParent(afterAST)
};
} finally {
- rules.get = originalGet;
+ linter.rules.get = originalGet;
}
}
@@ -421,7 +413,7 @@ RuleTester.prototype = {
const messages = result.messages;
assert.equal(messages.length, 0, util.format("Should have no errors but had %d: %s",
- messages.length, util.inspect(messages)));
+ messages.length, util.inspect(messages)));
assertASTDidntChange(result.beforeAST, result.afterAST);
}
@@ -464,14 +456,17 @@ RuleTester.prototype = {
const messages = result.messages;
-
if (typeof item.errors === "number") {
assert.equal(messages.length, item.errors, util.format("Should have %d error%s but had %d: %s",
item.errors, item.errors === 1 ? "" : "s", messages.length, util.inspect(messages)));
} else {
- assert.equal(messages.length, item.errors.length,
- util.format("Should have %d error%s but had %d: %s",
- item.errors.length, item.errors.length === 1 ? "" : "s", messages.length, util.inspect(messages)));
+ assert.equal(
+ messages.length, item.errors.length,
+ util.format(
+ "Should have %d error%s but had %d: %s",
+ item.errors.length, item.errors.length === 1 ? "" : "s", messages.length, util.inspect(messages)
+ )
+ );
for (let i = 0, l = item.errors.length; i < l; i++) {
assert.ok(!("fatal" in messages[i]), `A fatal parsing error occurred: ${messages[i].message}`);
@@ -527,7 +522,7 @@ RuleTester.prototype = {
"Expected no autofixes to be suggested"
);
} else {
- const fixResult = SourceCodeFixer.applyFixes(eslint.getSourceCode(), messages);
+ const fixResult = SourceCodeFixer.applyFixes(linter.getSourceCode(), messages);
assert.equal(fixResult.output, item.output, "Output is incorrect.");
}
@@ -544,7 +539,7 @@ RuleTester.prototype = {
RuleTester.describe("valid", () => {
test.valid.forEach(valid => {
RuleTester.it(typeof valid === "object" ? valid.code : valid, () => {
- eslint.defineRules(this.rules);
+ linter.defineRules(this.rules);
testValidTemplate(ruleName, valid);
});
});
@@ -553,7 +548,7 @@ RuleTester.prototype = {
RuleTester.describe("invalid", () => {
test.invalid.forEach(invalid => {
RuleTester.it(invalid.code, () => {
- eslint.defineRules(this.rules);
+ linter.defineRules(this.rules);
testInvalidTemplate(ruleName, invalid);
});
});
@@ -562,7 +557,8 @@ RuleTester.prototype = {
return result.suite;
}
-};
+}
+RuleTester[DESCRIBE] = RuleTester[IT] = null;
module.exports = RuleTester;
diff --git a/tools/eslint/lib/timing.js b/tools/eslint/lib/timing.js
index 20456628640bf6..15c93800f1a698 100644
--- a/tools/eslint/lib/timing.js
+++ b/tools/eslint/lib/timing.js
@@ -98,7 +98,7 @@ function display(data) {
return ALIGN[index](":", w + 1, "-");
}).join("|"));
- console.log(table.join("\n")); // eslint-disable-line no-console
+ console.log(table.join("\n")); // eslint-disable-line no-console
}
/* istanbul ignore next */
diff --git a/tools/eslint/lib/token-store/index.js b/tools/eslint/lib/token-store/index.js
index 86d05cf7b3f834..86510bcb7c2ca9 100644
--- a/tools/eslint/lib/token-store/index.js
+++ b/tools/eslint/lib/token-store/index.js
@@ -12,34 +12,15 @@ const assert = require("assert");
const cursors = require("./cursors");
const ForwardTokenCursor = require("./forward-token-cursor");
const PaddedTokenCursor = require("./padded-token-cursor");
+const astUtils = require("../ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
-const PUBLIC_METHODS = Object.freeze([
- "getTokenByRangeStart",
-
- "getFirstToken",
- "getLastToken",
- "getTokenBefore",
- "getTokenAfter",
- "getFirstTokenBetween",
- "getLastTokenBetween",
-
- "getFirstTokens",
- "getLastTokens",
- "getTokensBefore",
- "getTokensAfter",
- "getFirstTokensBetween",
- "getLastTokensBetween",
-
- "getTokens",
- "getTokensBetween",
-
- "getTokenOrCommentBefore",
- "getTokenOrCommentAfter"
-]);
+const TOKENS = Symbol("tokens");
+const COMMENTS = Symbol("comments");
+const INDEX_MAP = Symbol("indexMap");
/**
* Creates the map from locations to indices in `tokens`.
@@ -192,6 +173,24 @@ function createCursorWithPadding(tokens, comments, indexMap, startLoc, endLoc, b
return createCursorWithCount(cursors.forward, tokens, comments, indexMap, startLoc, endLoc, beforeCount);
}
+/**
+ * Gets comment tokens that are adjacent to the current cursor position.
+ * @param {Cursor} cursor - A cursor instance.
+ * @returns {Array} An array of comment tokens adjacent to the current cursor position.
+ * @private
+ */
+function getAdjacentCommentTokensFromCursor(cursor) {
+ const tokens = [];
+ let currentToken = cursor.getOneToken();
+
+ while (currentToken && astUtils.isCommentToken(currentToken)) {
+ tokens.push(currentToken);
+ currentToken = cursor.getOneToken();
+ }
+
+ return tokens;
+}
+
//------------------------------------------------------------------------------
// Exports
//------------------------------------------------------------------------------
@@ -211,22 +210,13 @@ module.exports = class TokenStore {
/**
* Initializes this token store.
- *
- * ※ `comments` needs to be cloned for backward compatibility.
- * After this initialization, ESLint removes a shebang's comment from `comments`.
- * However, so far we had been concatenating 'tokens' and 'comments' before,
- * so the shebang's comment had remained in the concatenated array.
- * As a result, both the result of `getTokenOrCommentAfter` and `getTokenOrCommentBefore`
- * methods had included the shebang's comment.
- * And some rules depends on this behavior.
- *
* @param {Token[]} tokens - The array of tokens.
* @param {Comment[]} comments - The array of comments.
*/
constructor(tokens, comments) {
- this.tokens = tokens;
- this.comments = comments.slice(0);
- this.indexMap = createIndexMap(tokens, comments);
+ this[TOKENS] = tokens;
+ this[COMMENTS] = comments;
+ this[INDEX_MAP] = createIndexMap(tokens, comments);
}
//--------------------------------------------------------------------------
@@ -243,9 +233,9 @@ module.exports = class TokenStore {
getTokenByRangeStart(offset, options) {
const includeComments = options && options.includeComments;
const token = cursors.forward.createBaseCursor(
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
offset,
-1,
includeComments
@@ -269,9 +259,9 @@ module.exports = class TokenStore {
getFirstToken(node, options) {
return createCursorWithSkip(
cursors.forward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
node.range[0],
node.range[1],
options
@@ -281,18 +271,15 @@ module.exports = class TokenStore {
/**
* Gets the last token of the given node.
* @param {ASTNode} node - The AST node.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.skip=0] - The count of tokens the cursor skips.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken()
* @returns {Token|null} An object representing the token.
*/
getLastToken(node, options) {
return createCursorWithSkip(
cursors.backward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
node.range[0],
node.range[1],
options
@@ -302,18 +289,15 @@ module.exports = class TokenStore {
/**
* Gets the token that precedes a given node or token.
* @param {ASTNode|Token|Comment} node - The AST node or token.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.skip=0] - The count of tokens the cursor skips.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken()
* @returns {Token|null} An object representing the token.
*/
getTokenBefore(node, options) {
return createCursorWithSkip(
cursors.backward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
-1,
node.range[0],
options
@@ -323,18 +307,15 @@ module.exports = class TokenStore {
/**
* Gets the token that follows a given node or token.
* @param {ASTNode|Token|Comment} node - The AST node or token.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.skip=0] - The count of tokens the cursor skips.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken()
* @returns {Token|null} An object representing the token.
*/
getTokenAfter(node, options) {
return createCursorWithSkip(
cursors.forward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
node.range[1],
-1,
options
@@ -345,18 +326,15 @@ module.exports = class TokenStore {
* Gets the first token between two non-overlapping nodes.
* @param {ASTNode|Token|Comment} left - Node before the desired token range.
* @param {ASTNode|Token|Comment} right - Node after the desired token range.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.skip=0] - The count of tokens the cursor skips.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken()
* @returns {Token|null} An object representing the token.
*/
getFirstTokenBetween(left, right, options) {
return createCursorWithSkip(
cursors.forward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
left.range[1],
right.range[0],
options
@@ -367,18 +345,15 @@ module.exports = class TokenStore {
* Gets the last token between two non-overlapping nodes.
* @param {ASTNode|Token|Comment} left Node before the desired token range.
* @param {ASTNode|Token|Comment} right Node after the desired token range.
- * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.skip=0] - The count of tokens the cursor skips.
- * @returns {Token|null} Tokens between left and right.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken()
+ * @returns {Token|null} An object representing the token.
*/
getLastTokenBetween(left, right, options) {
return createCursorWithSkip(
cursors.backward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
left.range[1],
right.range[0],
options
@@ -427,9 +402,9 @@ module.exports = class TokenStore {
getFirstTokens(node, options) {
return createCursorWithCount(
cursors.forward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
node.range[0],
node.range[1],
options
@@ -439,18 +414,15 @@ module.exports = class TokenStore {
/**
* Gets the last `count` tokens of the given node.
* @param {ASTNode} node - The AST node.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens()
* @returns {Token[]} Tokens.
*/
getLastTokens(node, options) {
return createCursorWithCount(
cursors.backward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
node.range[0],
node.range[1],
options
@@ -460,18 +432,15 @@ module.exports = class TokenStore {
/**
* Gets the `count` tokens that precedes a given node or token.
* @param {ASTNode|Token|Comment} node - The AST node or token.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens()
* @returns {Token[]} Tokens.
*/
getTokensBefore(node, options) {
return createCursorWithCount(
cursors.backward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
-1,
node.range[0],
options
@@ -481,18 +450,15 @@ module.exports = class TokenStore {
/**
* Gets the `count` tokens that follows a given node or token.
* @param {ASTNode|Token|Comment} node - The AST node or token.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens()
* @returns {Token[]} Tokens.
*/
getTokensAfter(node, options) {
return createCursorWithCount(
cursors.forward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
node.range[1],
-1,
options
@@ -503,18 +469,15 @@ module.exports = class TokenStore {
* Gets the first `count` tokens between two non-overlapping nodes.
* @param {ASTNode|Token|Comment} left - Node before the desired token range.
* @param {ASTNode|Token|Comment} right - Node after the desired token range.
- * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens()
* @returns {Token[]} Tokens between left and right.
*/
getFirstTokensBetween(left, right, options) {
return createCursorWithCount(
cursors.forward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
left.range[1],
right.range[0],
options
@@ -525,18 +488,15 @@ module.exports = class TokenStore {
* Gets the last `count` tokens between two non-overlapping nodes.
* @param {ASTNode|Token|Comment} left Node before the desired token range.
* @param {ASTNode|Token|Comment} right Node after the desired token range.
- * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`.
- * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well.
- * @param {Function|null} [options.filter=null] - The predicate function to choose tokens.
- * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates.
+ * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens()
* @returns {Token[]} Tokens between left and right.
*/
getLastTokensBetween(left, right, options) {
return createCursorWithCount(
cursors.backward,
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
left.range[1],
right.range[0],
options
@@ -561,9 +521,9 @@ module.exports = class TokenStore {
*/
getTokens(node, beforeCount, afterCount) {
return createCursorWithPadding(
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
node.range[0],
node.range[1],
beforeCount,
@@ -590,15 +550,63 @@ module.exports = class TokenStore {
*/
getTokensBetween(left, right, padding) {
return createCursorWithPadding(
- this.tokens,
- this.comments,
- this.indexMap,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
left.range[1],
right.range[0],
padding,
padding
).getAllTokens();
}
-};
-module.exports.PUBLIC_METHODS = PUBLIC_METHODS;
+ /**
+ * Gets all comment tokens directly before the given node or token.
+ * @param {ASTNode|token} nodeOrToken The AST node or token to check for adjacent comment tokens.
+ * @returns {Array} An array of comments in occurrence order.
+ */
+ getCommentsBefore(nodeOrToken) {
+ const cursor = createCursorWithCount(
+ cursors.backward,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
+ -1,
+ nodeOrToken.range[0],
+ { includeComments: true }
+ );
+
+ return getAdjacentCommentTokensFromCursor(cursor).reverse();
+ }
+
+ /**
+ * Gets all comment tokens directly after the given node or token.
+ * @param {ASTNode|token} nodeOrToken The AST node or token to check for adjacent comment tokens.
+ * @returns {Array} An array of comments in occurrence order.
+ */
+ getCommentsAfter(nodeOrToken) {
+ const cursor = createCursorWithCount(
+ cursors.forward,
+ this[TOKENS],
+ this[COMMENTS],
+ this[INDEX_MAP],
+ nodeOrToken.range[1],
+ -1,
+ { includeComments: true }
+ );
+
+ return getAdjacentCommentTokensFromCursor(cursor);
+ }
+
+ /**
+ * Gets all comment tokens inside the given node.
+ * @param {ASTNode} node The AST node to get the comments for.
+ * @returns {Array} An array of comments in occurrence order.
+ */
+ getCommentsInside(node) {
+ return this.getTokens(node, {
+ includeComments: true,
+ filter: astUtils.isCommentToken
+ });
+ }
+};
diff --git a/tools/eslint/lib/util/comment-event-generator.js b/tools/eslint/lib/util/comment-event-generator.js
deleted file mode 100644
index 239a9834d0ed20..00000000000000
--- a/tools/eslint/lib/util/comment-event-generator.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * @fileoverview The event generator for comments.
- * @author Toru Nagashima
- */
-
-"use strict";
-
-//------------------------------------------------------------------------------
-// Helpers
-//------------------------------------------------------------------------------
-
-/**
- * Check collection of comments to prevent double event for comment as
- * leading and trailing, then emit event if passing
- * @param {ASTNode[]} comments - Collection of comment nodes
- * @param {EventEmitter} emitter - The event emitter which is the destination of events.
- * @param {Object[]} locs - List of locations of previous comment nodes
- * @param {string} eventName - Event name postfix
- * @returns {void}
- */
-function emitComments(comments, emitter, locs, eventName) {
- if (comments.length > 0) {
- comments.forEach(node => {
- const index = locs.indexOf(node.loc);
-
- if (index >= 0) {
- locs.splice(index, 1);
- } else {
- locs.push(node.loc);
- emitter.emit(node.type + eventName, node);
- }
- });
- }
-}
-
-/**
- * Shortcut to check and emit enter of comment nodes
- * @param {CommentEventGenerator} generator - A generator to emit.
- * @param {ASTNode[]} comments - Collection of comment nodes
- * @returns {void}
- */
-function emitCommentsEnter(generator, comments) {
- emitComments(
- comments,
- generator.emitter,
- generator.commentLocsEnter,
- "Comment");
-}
-
-/**
- * Shortcut to check and emit exit of comment nodes
- * @param {CommentEventGenerator} generator - A generator to emit.
- * @param {ASTNode[]} comments Collection of comment nodes
- * @returns {void}
- */
-function emitCommentsExit(generator, comments) {
- emitComments(
- comments,
- generator.emitter,
- generator.commentLocsExit,
- "Comment:exit");
-}
-
-//------------------------------------------------------------------------------
-// Public Interface
-//------------------------------------------------------------------------------
-
-/**
- * The event generator for comments.
- * This is the decorator pattern.
- * This generates events of comments before/after events which are generated the original generator.
- *
- * Comment event generator class
- */
-class CommentEventGenerator {
-
- /**
- * @param {EventGenerator} originalEventGenerator - An event generator which is the decoration target.
- * @param {SourceCode} sourceCode - A source code which has comments.
- */
- constructor(originalEventGenerator, sourceCode) {
- this.original = originalEventGenerator;
- this.emitter = originalEventGenerator.emitter;
- this.sourceCode = sourceCode;
- this.commentLocsEnter = [];
- this.commentLocsExit = [];
- }
-
- /**
- * Emits an event of entering comments.
- * @param {ASTNode} node - A node which was entered.
- * @returns {void}
- */
- enterNode(node) {
- const comments = this.sourceCode.getComments(node);
-
- emitCommentsEnter(this, comments.leading);
- this.original.enterNode(node);
- emitCommentsEnter(this, comments.trailing);
- }
-
- /**
- * Emits an event of leaving comments.
- * @param {ASTNode} node - A node which was left.
- * @returns {void}
- */
- leaveNode(node) {
- const comments = this.sourceCode.getComments(node);
-
- emitCommentsExit(this, comments.trailing);
- this.original.leaveNode(node);
- emitCommentsExit(this, comments.leading);
- }
-}
-
-module.exports = CommentEventGenerator;
diff --git a/tools/eslint/lib/util/glob-util.js b/tools/eslint/lib/util/glob-util.js
index 4c21fc55106d99..6a1f150a599a40 100644
--- a/tools/eslint/lib/util/glob-util.js
+++ b/tools/eslint/lib/util/glob-util.js
@@ -11,7 +11,6 @@
const fs = require("fs"),
path = require("path"),
GlobSync = require("./glob"),
- shell = require("shelljs"),
pathUtil = require("./path-util"),
IgnoredPaths = require("../ignored-paths");
@@ -64,7 +63,7 @@ function processPath(options) {
let newPath = pathname;
const resolvedPath = path.resolve(cwd, pathname);
- if (shell.test("-d", resolvedPath)) {
+ if (fs.existsSync(resolvedPath) && fs.statSync(resolvedPath).isDirectory()) {
newPath = pathname.replace(/[/\\]$/, "") + suffix;
}
@@ -151,10 +150,10 @@ function listFilesToProcess(globPatterns, options) {
globPatterns.forEach(pattern => {
const file = path.resolve(cwd, pattern);
- if (shell.test("-f", file)) {
+ if (fs.existsSync(file) && fs.statSync(file).isFile()) {
const ignoredPaths = new IgnoredPaths(options);
- addFile(fs.realpathSync(file), !shell.test("-d", file), ignoredPaths);
+ addFile(fs.realpathSync(file), true, ignoredPaths);
} else {
// regex to find .hidden or /.hidden patterns, but not ./relative or ../relative
diff --git a/tools/eslint/lib/util/module-resolver.js b/tools/eslint/lib/util/module-resolver.js
index 505c572822699b..470a54f7c45713 100644
--- a/tools/eslint/lib/util/module-resolver.js
+++ b/tools/eslint/lib/util/module-resolver.js
@@ -68,7 +68,7 @@ class ModuleResolver {
* lookup file paths when require() is called. So, we are hooking into the
* exact same logic that Node.js uses.
*/
- const result = Module._findPath(name, lookupPaths); // eslint-disable-line no-underscore-dangle
+ const result = Module._findPath(name, lookupPaths); // eslint-disable-line no-underscore-dangle
if (!result) {
throw new Error(`Cannot find module '${name}'`);
diff --git a/tools/eslint/lib/util/npm-util.js b/tools/eslint/lib/util/npm-util.js
index ef1c0c62936347..4859fabc9565ab 100644
--- a/tools/eslint/lib/util/npm-util.js
+++ b/tools/eslint/lib/util/npm-util.js
@@ -10,8 +10,8 @@
//------------------------------------------------------------------------------
const fs = require("fs"),
+ childProcess = require("child_process"),
path = require("path"),
- shell = require("shelljs"),
log = require("../logging");
//------------------------------------------------------------------------------
@@ -29,13 +29,13 @@ function findPackageJson(startDir) {
let dir = path.resolve(startDir || process.cwd());
do {
- const pkgfile = path.join(dir, "package.json");
+ const pkgFile = path.join(dir, "package.json");
- if (!shell.test("-f", pkgfile)) {
+ if (!fs.existsSync(pkgFile) || !fs.statSync(pkgFile).isFile()) {
dir = path.join(dir, "..");
continue;
}
- return pkgfile;
+ return pkgFile;
} while (dir !== path.resolve(dir, ".."));
return null;
}
@@ -53,7 +53,7 @@ function installSyncSaveDev(packages) {
if (Array.isArray(packages)) {
packages = packages.join(" ");
}
- shell.exec(`npm i --save-dev ${packages}`, { stdio: "inherit" });
+ childProcess.execSync(`npm i --save-dev ${packages}`, { stdio: "inherit", encoding: "utf8" });
}
/**
diff --git a/tools/eslint/lib/util/source-code-util.js b/tools/eslint/lib/util/source-code-util.js
index 892c32d22a00e8..6ffd243e2e1c65 100644
--- a/tools/eslint/lib/util/source-code-util.js
+++ b/tools/eslint/lib/util/source-code-util.js
@@ -10,9 +10,8 @@
//------------------------------------------------------------------------------
const CLIEngine = require("../cli-engine"),
- eslint = require("../eslint"),
globUtil = require("./glob-util"),
- baseDefaultOptions = require("../../conf/cli-options");
+ baseDefaultOptions = require("../../conf/default-cli-options");
const debug = require("debug")("eslint:source-code-util");
@@ -38,7 +37,7 @@ function getSourceCodeOfFile(filename, options) {
throw new Error(`(${filename}:${msg.line}:${msg.column}) ${msg.message}`);
}
- const sourceCode = eslint.getSourceCode();
+ const sourceCode = cli.linter.getSourceCode();
return sourceCode;
}
diff --git a/tools/eslint/lib/util/source-code.js b/tools/eslint/lib/util/source-code.js
index 5106c1e61fa98a..af01ff3fafaab3 100644
--- a/tools/eslint/lib/util/source-code.js
+++ b/tools/eslint/lib/util/source-code.js
@@ -101,91 +101,95 @@ function sortedMerge(tokens, comments) {
return result;
}
-
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
-/**
- * Represents parsed source code.
- * @param {string} text - The source code text.
- * @param {ASTNode} ast - The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
- * @constructor
- */
-function SourceCode(text, ast) {
- validate(ast);
+class SourceCode extends TokenStore {
/**
- * The flag to indicate that the source code has Unicode BOM.
- * @type boolean
+ * Represents parsed source code.
+ * @param {string} text - The source code text.
+ * @param {ASTNode} ast - The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
+ * @constructor
*/
- this.hasBOM = (text.charCodeAt(0) === 0xFEFF);
+ constructor(text, ast) {
+ validate(ast);
- /**
- * The original text source code.
- * BOM was stripped from this text.
- * @type string
- */
- this.text = (this.hasBOM ? text.slice(1) : text);
+ super(ast.tokens, ast.comments);
- /**
- * The parsed AST for the source code.
- * @type ASTNode
- */
- this.ast = ast;
+ /**
+ * The flag to indicate that the source code has Unicode BOM.
+ * @type boolean
+ */
+ this.hasBOM = (text.charCodeAt(0) === 0xFEFF);
- /**
- * The source code split into lines according to ECMA-262 specification.
- * This is done to avoid each rule needing to do so separately.
- * @type string[]
- */
- this.lines = [];
- this.lineStartIndices = [0];
-
- const lineEndingPattern = astUtils.createGlobalLinebreakMatcher();
- let match;
-
- /*
- * Previously, this was implemented using a regex that
- * matched a sequence of non-linebreak characters followed by a
- * linebreak, then adding the lengths of the matches. However,
- * this caused a catastrophic backtracking issue when the end
- * of a file contained a large number of non-newline characters.
- * To avoid this, the current implementation just matches newlines
- * and uses match.index to get the correct line start indices.
- */
- while ((match = lineEndingPattern.exec(this.text))) {
- this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1], match.index));
- this.lineStartIndices.push(match.index + match[0].length);
- }
- this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1]));
+ /**
+ * The original text source code.
+ * BOM was stripped from this text.
+ * @type string
+ */
+ this.text = (this.hasBOM ? text.slice(1) : text);
- this.tokensAndComments = sortedMerge(ast.tokens, ast.comments);
+ /**
+ * The parsed AST for the source code.
+ * @type ASTNode
+ */
+ this.ast = ast;
- // create token store methods
- const tokenStore = new TokenStore(ast.tokens, ast.comments);
+ // Check the source text for the presence of a shebang since it is parsed as a standard line comment.
+ const shebangMatched = this.text.match(astUtils.SHEBANG_MATCHER);
+ const hasShebang = shebangMatched && ast.comments.length && ast.comments[0].value === shebangMatched[1];
- for (const methodName of TokenStore.PUBLIC_METHODS) {
- this[methodName] = tokenStore[methodName].bind(tokenStore);
- }
+ if (hasShebang) {
+ ast.comments[0].type = "Shebang";
+ }
- // don't allow modification of this object
- Object.freeze(this);
- Object.freeze(this.lines);
-}
+ this.tokensAndComments = sortedMerge(ast.tokens, ast.comments);
-/**
- * Split the source code into multiple lines based on the line delimiters
- * @param {string} text Source code as a string
- * @returns {string[]} Array of source code lines
- * @public
- */
-SourceCode.splitLines = function(text) {
- return text.split(astUtils.createGlobalLinebreakMatcher());
-};
+ /**
+ * The source code split into lines according to ECMA-262 specification.
+ * This is done to avoid each rule needing to do so separately.
+ * @type string[]
+ */
+ this.lines = [];
+ this.lineStartIndices = [0];
+
+ const lineEndingPattern = astUtils.createGlobalLinebreakMatcher();
+ let match;
+
+ /*
+ * Previously, this was implemented using a regex that
+ * matched a sequence of non-linebreak characters followed by a
+ * linebreak, then adding the lengths of the matches. However,
+ * this caused a catastrophic backtracking issue when the end
+ * of a file contained a large number of non-newline characters.
+ * To avoid this, the current implementation just matches newlines
+ * and uses match.index to get the correct line start indices.
+ */
+ while ((match = lineEndingPattern.exec(this.text))) {
+ this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1], match.index));
+ this.lineStartIndices.push(match.index + match[0].length);
+ }
+ this.lines.push(this.text.slice(this.lineStartIndices[this.lineStartIndices.length - 1]));
-SourceCode.prototype = {
- constructor: SourceCode,
+ // Cache for comments found using getComments().
+ this._commentCache = new WeakMap();
+
+ // don't allow modification of this object
+ Object.freeze(this);
+ Object.freeze(this.lines);
+ }
+
+ /**
+ * Split the source code into multiple lines based on the line delimiters
+ * @param {string} text Source code as a string
+ * @returns {string[]} Array of source code lines
+ * @public
+ */
+ static splitLines(text) {
+ return text.split(astUtils.createGlobalLinebreakMatcher());
+ }
/**
* Gets the source code for the given node.
@@ -200,9 +204,7 @@ SourceCode.prototype = {
node.range[1] + (afterCount || 0));
}
return this.text;
-
-
- },
+ }
/**
* Gets the entire source text split into an array of lines.
@@ -210,7 +212,7 @@ SourceCode.prototype = {
*/
getLines() {
return this.lines;
- },
+ }
/**
* Retrieves an array containing all comments in the source code.
@@ -218,7 +220,7 @@ SourceCode.prototype = {
*/
getAllComments() {
return this.ast.comments;
- },
+ }
/**
* Gets all comments for the given node.
@@ -227,60 +229,111 @@ SourceCode.prototype = {
* @public
*/
getComments(node) {
+ if (this._commentCache.has(node)) {
+ return this._commentCache.get(node);
+ }
- let leadingComments = node.leadingComments || [];
- const trailingComments = node.trailingComments || [];
+ const comments = {
+ leading: [],
+ trailing: []
+ };
/*
- * espree adds a "comments" array on Program nodes rather than
- * leadingComments/trailingComments. Comments are only left in the
- * Program node comments array if there is no executable code.
+ * Return all comments as leading comments of the Program node when
+ * there is no executable code.
*/
if (node.type === "Program") {
if (node.body.length === 0) {
- leadingComments = node.comments;
+ comments.leading = node.comments;
+ }
+ } else {
+
+ /* Return comments as trailing comments of nodes that only contain
+ * comments (to mimic the comment attachment behavior present in Espree).
+ */
+ if ((node.type === "BlockStatement" || node.type === "ClassBody") && node.body.length === 0 ||
+ node.type === "ObjectExpression" && node.properties.length === 0 ||
+ node.type === "ArrayExpression" && node.elements.length === 0 ||
+ node.type === "SwitchStatement" && node.cases.length === 0
+ ) {
+ comments.trailing = this.getTokens(node, {
+ includeComments: true,
+ filter: astUtils.isCommentToken
+ });
+ }
+
+ /*
+ * Iterate over tokens before and after node and collect comment tokens.
+ * Do not include comments that exist outside of the parent node
+ * to avoid duplication.
+ */
+ let currentToken = this.getTokenBefore(node, { includeComments: true });
+
+ while (currentToken && astUtils.isCommentToken(currentToken)) {
+ if (node.parent && (currentToken.start < node.parent.start)) {
+ break;
+ }
+ comments.leading.push(currentToken);
+ currentToken = this.getTokenBefore(currentToken, { includeComments: true });
+ }
+
+ comments.leading.reverse();
+
+ currentToken = this.getTokenAfter(node, { includeComments: true });
+
+ while (currentToken && astUtils.isCommentToken(currentToken)) {
+ if (node.parent && (currentToken.end > node.parent.end)) {
+ break;
+ }
+ comments.trailing.push(currentToken);
+ currentToken = this.getTokenAfter(currentToken, { includeComments: true });
}
}
- return {
- leading: leadingComments,
- trailing: trailingComments
- };
- },
+ this._commentCache.set(node, comments);
+ return comments;
+ }
/**
* Retrieves the JSDoc comment for a given node.
* @param {ASTNode} node The AST node to get the comment for.
- * @returns {ASTNode} The BlockComment node containing the JSDoc for the
+ * @returns {ASTNode} The Block comment node containing the JSDoc for the
* given node or null if not found.
* @public
*/
getJSDocComment(node) {
-
let parent = node.parent;
+ const leadingComments = this.getCommentsBefore(node);
switch (node.type) {
case "ClassDeclaration":
case "FunctionDeclaration":
if (looksLikeExport(parent)) {
- return findJSDocComment(parent.leadingComments, parent.loc.start.line);
+ return findJSDocComment(this.getCommentsBefore(parent), parent.loc.start.line);
}
- return findJSDocComment(node.leadingComments, node.loc.start.line);
+ return findJSDocComment(leadingComments, node.loc.start.line);
case "ClassExpression":
- return findJSDocComment(parent.parent.leadingComments, parent.parent.loc.start.line);
+ return findJSDocComment(this.getCommentsBefore(parent.parent), parent.parent.loc.start.line);
case "ArrowFunctionExpression":
case "FunctionExpression":
-
if (parent.type !== "CallExpression" && parent.type !== "NewExpression") {
- while (parent && !parent.leadingComments && !/Function/.test(parent.type) && parent.type !== "MethodDefinition" && parent.type !== "Property") {
+ let parentLeadingComments = this.getCommentsBefore(parent);
+
+ while (!parentLeadingComments.length && !/Function/.test(parent.type) && parent.type !== "MethodDefinition" && parent.type !== "Property") {
parent = parent.parent;
+
+ if (!parent) {
+ break;
+ }
+
+ parentLeadingComments = this.getCommentsBefore(parent);
}
- return parent && (parent.type !== "FunctionDeclaration") ? findJSDocComment(parent.leadingComments, parent.loc.start.line) : null;
- } else if (node.leadingComments) {
- return findJSDocComment(node.leadingComments, node.loc.start.line);
+ return parent && parent.type !== "FunctionDeclaration" && parent.type !== "Program" ? findJSDocComment(parentLeadingComments, parent.loc.start.line) : null;
+ } else if (leadingComments.length) {
+ return findJSDocComment(leadingComments, node.loc.start.line);
}
// falls through
@@ -288,7 +341,7 @@ SourceCode.prototype = {
default:
return null;
}
- },
+ }
/**
* Gets the deepest node containing a range index.
@@ -317,7 +370,7 @@ SourceCode.prototype = {
});
return result ? Object.assign({ parent: resultParent }, result) : null;
- },
+ }
/**
* Determines if two tokens have at least one whitespace character
@@ -332,7 +385,7 @@ SourceCode.prototype = {
const text = this.text.slice(first.range[1], second.range[0]);
return /\s/.test(text.replace(/\/\*.*?\*\//g, ""));
- },
+ }
/**
* Converts a source text index into a (line, column) pair.
@@ -366,8 +419,7 @@ SourceCode.prototype = {
const lineNumber = lodash.sortedLastIndex(this.lineStartIndices, index);
return { line: lineNumber, column: index - this.lineStartIndices[lineNumber - 1] };
-
- },
+ }
/**
* Converts a (line, column) pair into a range index.
@@ -410,7 +462,6 @@ SourceCode.prototype = {
return positionIndex;
}
-};
-
+}
module.exports = SourceCode;
diff --git a/tools/eslint/node_modules/.bin/shjs b/tools/eslint/node_modules/.bin/shjs
deleted file mode 120000
index a0449975bf894c..00000000000000
--- a/tools/eslint/node_modules/.bin/shjs
+++ /dev/null
@@ -1 +0,0 @@
-../shelljs/bin/shjs
\ No newline at end of file
diff --git a/tools/eslint/node_modules/ajv/README.md b/tools/eslint/node_modules/ajv/README.md
index 984b7ba12d6f9c..a0a1ca2374de89 100644
--- a/tools/eslint/node_modules/ajv/README.md
+++ b/tools/eslint/node_modules/ajv/README.md
@@ -1,3 +1,5 @@
+
+
# Ajv: Another JSON Schema Validator
The fastest JSON Schema validator for node.js and browser. Supports [v5 proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals).
@@ -11,9 +13,9 @@ The fastest JSON Schema validator for node.js and browser. Supports [v5 proposal
[](https://gitter.im/ajv-validator/ajv)
-__Please note__: You can start using NEW beta version [5.0.3](https://github.com/epoberezkin/ajv/releases/tag/5.0.3-beta.0) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)) with the support of JSON-Schema draft-06 (not officially published yet): `npm install ajv@^5.0.3-beta`.
+__Please note__: You can start using NEW beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.3) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)) with the support of JSON-Schema draft-06 (not officially published yet): `npm install ajv@^5.0.4-beta`.
-Also see [docs](https://github.com/epoberezkin/ajv/tree/5.0.3-beta.0) for 5.0.3.
+Also see [docs](https://github.com/epoberezkin/ajv/tree/5.0.4-beta.3) for 5.0.4.
## Contents
@@ -94,10 +96,10 @@ Currently Ajv is the only validator that passes all the tests from [JSON Schema
npm install ajv
```
-To install a stable beta version [5.0.3](https://github.com/epoberezkin/ajv/releases/tag/5.0.3-beta.0) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)):
+To install a stable beta version [5.0.4](https://github.com/epoberezkin/ajv/releases/tag/5.0.4-beta.3) (see [migration guide from 4.x.x](https://github.com/epoberezkin/ajv/releases/tag/5.0.1-beta.0)):
```
-npm install ajv@^5.0.3-beta
+npm install ajv@^5.0.4-beta
```
@@ -163,7 +165,7 @@ Ajv is tested with these browsers:
[](https://saucelabs.com/u/epoberezkin)
-__Please note__: some frameworks, e.g. Dojo, may redifine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/epoberezkin/ajv/issues/234)).
+__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/epoberezkin/ajv/issues/234)).
## Command line interface
@@ -600,7 +602,7 @@ If the option were `"failing"` then property `additional1` would have been remov
__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example:
-```JSON
+```json
{
"type": "object",
"oneOf": [
@@ -628,7 +630,7 @@ With the option `removeAdditional: true` the validation will pass for the object
While this behaviour is unexpected (issues [#129](https://github.com/epoberezkin/ajv/issues/129), [#134](https://github.com/epoberezkin/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way:
-```JSON
+```json
{
"type": "object",
"properties": {
diff --git a/tools/eslint/node_modules/ajv/dist/ajv.bundle.js b/tools/eslint/node_modules/ajv/dist/ajv.bundle.js
deleted file mode 100644
index ce77b83b330d08..00000000000000
--- a/tools/eslint/node_modules/ajv/dist/ajv.bundle.js
+++ /dev/null
@@ -1,8041 +0,0 @@
-(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Ajv = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 1 && month <= 12 && day >= 1 && day <= DAYS[month];
-}
-
-
-function time(str, full) {
- var matches = str.match(TIME);
- if (!matches) return false;
-
- var hour = matches[1];
- var minute = matches[2];
- var second = matches[3];
- var timeZone = matches[5];
- return hour <= 23 && minute <= 59 && second <= 59 && (!full || timeZone);
-}
-
-
-var DATE_TIME_SEPARATOR = /t|\s/i;
-function date_time(str) {
- // http://tools.ietf.org/html/rfc3339#section-5.6
- var dateTime = str.split(DATE_TIME_SEPARATOR);
- return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
-}
-
-
-function hostname(str) {
- // https://tools.ietf.org/html/rfc1034#section-3.5
- // https://tools.ietf.org/html/rfc1123#section-2
- return str.length <= 255 && HOSTNAME.test(str);
-}
-
-
-var NOT_URI_FRAGMENT = /\/|\:/;
-function uri(str) {
- // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
- return NOT_URI_FRAGMENT.test(str) && URI.test(str);
-}
-
-
-function regex(str) {
- try {
- new RegExp(str);
- return true;
- } catch(e) {
- return false;
- }
-}
-
-
-function compareDate(d1, d2) {
- if (!(d1 && d2)) return;
- if (d1 > d2) return 1;
- if (d1 < d2) return -1;
- if (d1 === d2) return 0;
-}
-
-
-function compareTime(t1, t2) {
- if (!(t1 && t2)) return;
- t1 = t1.match(TIME);
- t2 = t2.match(TIME);
- if (!(t1 && t2)) return;
- t1 = t1[1] + t1[2] + t1[3] + (t1[4]||'');
- t2 = t2[1] + t2[2] + t2[3] + (t2[4]||'');
- if (t1 > t2) return 1;
- if (t1 < t2) return -1;
- if (t1 === t2) return 0;
-}
-
-
-function compareDateTime(dt1, dt2) {
- if (!(dt1 && dt2)) return;
- dt1 = dt1.split(DATE_TIME_SEPARATOR);
- dt2 = dt2.split(DATE_TIME_SEPARATOR);
- var res = compareDate(dt1[0], dt2[0]);
- if (res === undefined) return;
- return res || compareTime(dt1[1], dt2[1]);
-}
-
-},{"./util":11}],6:[function(require,module,exports){
-'use strict';
-
-var resolve = require('./resolve')
- , util = require('./util')
- , stableStringify = require('json-stable-stringify')
- , async = require('../async');
-
-var beautify;
-
-function loadBeautify(){
- if (beautify === undefined) {
- var name = 'js-beautify';
- try { beautify = require(name).js_beautify; }
- catch(e) { beautify = false; }
- }
-}
-
-var validateGenerator = require('../dotjs/validate');
-
-/**
- * Functions below are used inside compiled validations function
- */
-
-var co = require('co');
-var ucs2length = util.ucs2length;
-var equal = require('./equal');
-
-// this error is thrown by async schemas to return validation errors via exception
-var ValidationError = require('./validation_error');
-
-module.exports = compile;
-
-
-/**
- * Compiles schema to validation function
- * @this Ajv
- * @param {Object} schema schema object
- * @param {Object} root object with information about the root schema for this schema
- * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
- * @param {String} baseId base ID for IDs in the schema
- * @return {Function} validation function
- */
-function compile(schema, root, localRefs, baseId) {
- /* jshint validthis: true, evil: true */
- /* eslint no-shadow: 0 */
- var self = this
- , opts = this._opts
- , refVal = [ undefined ]
- , refs = {}
- , patterns = []
- , patternsHash = {}
- , defaults = []
- , defaultsHash = {}
- , customRules = []
- , keepSourceCode = opts.sourceCode !== false;
-
- root = root || { schema: schema, refVal: refVal, refs: refs };
-
- var c = checkCompiling.call(this, schema, root, baseId);
- var compilation = this._compilations[c.index];
- if (c.compiling) return (compilation.callValidate = callValidate);
-
- var formats = this._formats;
- var RULES = this.RULES;
-
- try {
- var v = localCompile(schema, root, localRefs, baseId);
- compilation.validate = v;
- var cv = compilation.callValidate;
- if (cv) {
- cv.schema = v.schema;
- cv.errors = null;
- cv.refs = v.refs;
- cv.refVal = v.refVal;
- cv.root = v.root;
- cv.$async = v.$async;
- if (keepSourceCode) cv.sourceCode = v.sourceCode;
- }
- return v;
- } finally {
- endCompiling.call(this, schema, root, baseId);
- }
-
- function callValidate() {
- var validate = compilation.validate;
- var result = validate.apply(null, arguments);
- callValidate.errors = validate.errors;
- return result;
- }
-
- function localCompile(_schema, _root, localRefs, baseId) {
- var isRoot = !_root || (_root && _root.schema == _schema);
- if (_root.schema != root.schema)
- return compile.call(self, _schema, _root, localRefs, baseId);
-
- var $async = _schema.$async === true;
- if ($async && !opts.transpile) async.setup(opts);
-
- var sourceCode = validateGenerator({
- isTop: true,
- schema: _schema,
- isRoot: isRoot,
- baseId: baseId,
- root: _root,
- schemaPath: '',
- errSchemaPath: '#',
- errorPath: '""',
- RULES: RULES,
- validate: validateGenerator,
- util: util,
- resolve: resolve,
- resolveRef: resolveRef,
- usePattern: usePattern,
- useDefault: useDefault,
- useCustomRule: useCustomRule,
- opts: opts,
- formats: formats,
- self: self
- });
-
- sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
- + vars(defaults, defaultCode) + vars(customRules, customRuleCode)
- + sourceCode;
-
- if (opts.beautify) {
- loadBeautify();
- /* istanbul ignore else */
- if (beautify) sourceCode = beautify(sourceCode, opts.beautify);
- else console.error('"npm install js-beautify" to use beautify option');
- }
- // console.log('\n\n\n *** \n', sourceCode);
- var validate, validateCode
- , transpile = opts._transpileFunc;
- try {
- validateCode = $async && transpile
- ? transpile(sourceCode)
- : sourceCode;
-
- var makeValidate = new Function(
- 'self',
- 'RULES',
- 'formats',
- 'root',
- 'refVal',
- 'defaults',
- 'customRules',
- 'co',
- 'equal',
- 'ucs2length',
- 'ValidationError',
- validateCode
- );
-
- validate = makeValidate(
- self,
- RULES,
- formats,
- root,
- refVal,
- defaults,
- customRules,
- co,
- equal,
- ucs2length,
- ValidationError
- );
-
- refVal[0] = validate;
- } catch(e) {
- console.error('Error compiling schema, function code:', validateCode);
- throw e;
- }
-
- validate.schema = _schema;
- validate.errors = null;
- validate.refs = refs;
- validate.refVal = refVal;
- validate.root = isRoot ? validate : _root;
- if ($async) validate.$async = true;
- if (keepSourceCode) validate.sourceCode = sourceCode;
- if (opts.sourceCode === true) {
- validate.source = {
- patterns: patterns,
- defaults: defaults
- };
- }
-
- return validate;
- }
-
- function resolveRef(baseId, ref, isRoot) {
- ref = resolve.url(baseId, ref);
- var refIndex = refs[ref];
- var _refVal, refCode;
- if (refIndex !== undefined) {
- _refVal = refVal[refIndex];
- refCode = 'refVal[' + refIndex + ']';
- return resolvedRef(_refVal, refCode);
- }
- if (!isRoot && root.refs) {
- var rootRefId = root.refs[ref];
- if (rootRefId !== undefined) {
- _refVal = root.refVal[rootRefId];
- refCode = addLocalRef(ref, _refVal);
- return resolvedRef(_refVal, refCode);
- }
- }
-
- refCode = addLocalRef(ref);
- var v = resolve.call(self, localCompile, root, ref);
- if (!v) {
- var localSchema = localRefs && localRefs[ref];
- if (localSchema) {
- v = resolve.inlineRef(localSchema, opts.inlineRefs)
- ? localSchema
- : compile.call(self, localSchema, root, localRefs, baseId);
- }
- }
-
- if (v) {
- replaceLocalRef(ref, v);
- return resolvedRef(v, refCode);
- }
- }
-
- function addLocalRef(ref, v) {
- var refId = refVal.length;
- refVal[refId] = v;
- refs[ref] = refId;
- return 'refVal' + refId;
- }
-
- function replaceLocalRef(ref, v) {
- var refId = refs[ref];
- refVal[refId] = v;
- }
-
- function resolvedRef(refVal, code) {
- return typeof refVal == 'object'
- ? { code: code, schema: refVal, inline: true }
- : { code: code, $async: refVal && refVal.$async };
- }
-
- function usePattern(regexStr) {
- var index = patternsHash[regexStr];
- if (index === undefined) {
- index = patternsHash[regexStr] = patterns.length;
- patterns[index] = regexStr;
- }
- return 'pattern' + index;
- }
-
- function useDefault(value) {
- switch (typeof value) {
- case 'boolean':
- case 'number':
- return '' + value;
- case 'string':
- return util.toQuotedString(value);
- case 'object':
- if (value === null) return 'null';
- var valueStr = stableStringify(value);
- var index = defaultsHash[valueStr];
- if (index === undefined) {
- index = defaultsHash[valueStr] = defaults.length;
- defaults[index] = value;
- }
- return 'default' + index;
- }
- }
-
- function useCustomRule(rule, schema, parentSchema, it) {
- var validateSchema = rule.definition.validateSchema;
- if (validateSchema && self._opts.validateSchema !== false) {
- var valid = validateSchema(schema);
- if (!valid) {
- var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
- if (self._opts.validateSchema == 'log') console.error(message);
- else throw new Error(message);
- }
- }
-
- var compile = rule.definition.compile
- , inline = rule.definition.inline
- , macro = rule.definition.macro;
-
- var validate;
- if (compile) {
- validate = compile.call(self, schema, parentSchema, it);
- } else if (macro) {
- validate = macro.call(self, schema, parentSchema, it);
- if (opts.validateSchema !== false) self.validateSchema(validate, true);
- } else if (inline) {
- validate = inline.call(self, it, rule.keyword, schema, parentSchema);
- } else {
- validate = rule.definition.validate;
- }
-
- var index = customRules.length;
- customRules[index] = validate;
-
- return {
- code: 'customRule' + index,
- validate: validate
- };
- }
-}
-
-
-/**
- * Checks if the schema is currently compiled
- * @this Ajv
- * @param {Object} schema schema to compile
- * @param {Object} root root object
- * @param {String} baseId base schema ID
- * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
- */
-function checkCompiling(schema, root, baseId) {
- /* jshint validthis: true */
- var index = compIndex.call(this, schema, root, baseId);
- if (index >= 0) return { index: index, compiling: true };
- index = this._compilations.length;
- this._compilations[index] = {
- schema: schema,
- root: root,
- baseId: baseId
- };
- return { index: index, compiling: false };
-}
-
-
-/**
- * Removes the schema from the currently compiled list
- * @this Ajv
- * @param {Object} schema schema to compile
- * @param {Object} root root object
- * @param {String} baseId base schema ID
- */
-function endCompiling(schema, root, baseId) {
- /* jshint validthis: true */
- var i = compIndex.call(this, schema, root, baseId);
- if (i >= 0) this._compilations.splice(i, 1);
-}
-
-
-/**
- * Index of schema compilation in the currently compiled list
- * @this Ajv
- * @param {Object} schema schema to compile
- * @param {Object} root root object
- * @param {String} baseId base schema ID
- * @return {Integer} compilation index
- */
-function compIndex(schema, root, baseId) {
- /* jshint validthis: true */
- for (var i=0; i= 0xD800 && value <= 0xDBFF && pos < len) {
- // high surrogate, and there is a next character
- value = str.charCodeAt(pos);
- if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
- }
- }
- return length;
-};
-
-},{}],11:[function(require,module,exports){
-'use strict';
-
-
-module.exports = {
- copy: copy,
- checkDataType: checkDataType,
- checkDataTypes: checkDataTypes,
- coerceToTypes: coerceToTypes,
- toHash: toHash,
- getProperty: getProperty,
- escapeQuotes: escapeQuotes,
- ucs2length: require('./ucs2length'),
- varOccurences: varOccurences,
- varReplace: varReplace,
- cleanUpCode: cleanUpCode,
- cleanUpVarErrors: cleanUpVarErrors,
- schemaHasRules: schemaHasRules,
- schemaHasRulesExcept: schemaHasRulesExcept,
- stableStringify: require('json-stable-stringify'),
- toQuotedString: toQuotedString,
- getPathExpr: getPathExpr,
- getPath: getPath,
- getData: getData,
- unescapeFragment: unescapeFragment,
- escapeFragment: escapeFragment,
- escapeJsonPointer: escapeJsonPointer
-};
-
-
-function copy(o, to) {
- to = to || {};
- for (var key in o) to[key] = o[key];
- return to;
-}
-
-
-function checkDataType(dataType, data, negate) {
- var EQUAL = negate ? ' !== ' : ' === '
- , AND = negate ? ' || ' : ' && '
- , OK = negate ? '!' : ''
- , NOT = negate ? '' : '!';
- switch (dataType) {
- case 'null': return data + EQUAL + 'null';
- case 'array': return OK + 'Array.isArray(' + data + ')';
- case 'object': return '(' + OK + data + AND +
- 'typeof ' + data + EQUAL + '"object"' + AND +
- NOT + 'Array.isArray(' + data + '))';
- case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
- NOT + '(' + data + ' % 1)' +
- AND + data + EQUAL + data + ')';
- default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
- }
-}
-
-
-function checkDataTypes(dataTypes, data) {
- switch (dataTypes.length) {
- case 1: return checkDataType(dataTypes[0], data, true);
- default:
- var code = '';
- var types = toHash(dataTypes);
- if (types.array && types.object) {
- code = types.null ? '(': '(!' + data + ' || ';
- code += 'typeof ' + data + ' !== "object")';
- delete types.null;
- delete types.array;
- delete types.object;
- }
- if (types.number) delete types.integer;
- for (var t in types)
- code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
-
- return code;
- }
-}
-
-
-var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
-function coerceToTypes(optionCoerceTypes, dataTypes) {
- if (Array.isArray(dataTypes)) {
- var types = [];
- for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
- return paths[lvl - up];
- }
-
- if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
- data = 'data' + ((lvl - up) || '');
- if (!jsonPointer) return data;
- }
-
- var expr = data;
- var segments = jsonPointer.split('/');
- for (var i=0; i',
- $result = 'result' + $lvl;
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- if ($isDataExcl) {
- var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
- $exclusive = 'exclusive' + $lvl,
- $opExpr = 'op' + $lvl,
- $opStr = '\' + ' + $opExpr + ' + \'';
- out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
- $schemaValueExcl = 'schemaExcl' + $lvl;
- out += ' if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && ' + ($schemaValueExcl) + ' !== undefined) { ' + ($valid) + ' = false; ';
- var $errorKeyword = $exclusiveKeyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '_formatExclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
- if (it.opts.messages !== false) {
- out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } ';
- if ($breakOnError) {
- $closingBraces += '}';
- out += ' else { ';
- }
- if ($isData) {
- out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
- $closingBraces += '}';
- }
- if ($isDataFormat) {
- out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
- $closingBraces += '}';
- }
- out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
- if ($isData) {
- out += '' + ($schemaValue);
- } else {
- out += '' + (it.util.toQuotedString($schema));
- }
- out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; var ' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true; if (' + ($valid) + ' === undefined) { ' + ($valid) + ' = ' + ($exclusive) + ' ? ' + ($result) + ' ' + ($op) + ' 0 : ' + ($result) + ' ' + ($op) + '= 0; } if (!' + ($valid) + ') var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
- } else {
- var $exclusive = $schemaExcl === true,
- $opStr = $op;
- if (!$exclusive) $opStr += '=';
- var $opExpr = '\'' + $opStr + '\'';
- if ($isData) {
- out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
- $closingBraces += '}';
- }
- if ($isDataFormat) {
- out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
- $closingBraces += '}';
- }
- out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
- if ($isData) {
- out += '' + ($schemaValue);
- } else {
- out += '' + (it.util.toQuotedString($schema));
- }
- out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; if (' + ($valid) + ' === undefined) ' + ($valid) + ' = ' + ($result) + ' ' + ($op);
- if (!$exclusive) {
- out += '=';
- }
- out += ' 0;';
- }
- out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { ';
- var $errorKeyword = $keyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '_formatLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ';
- if ($isData) {
- out += '' + ($schemaValue);
- } else {
- out += '' + (it.util.toQuotedString($schema));
- }
- out += ' , exclusive: ' + ($exclusive) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should be ' + ($opStr) + ' "';
- if ($isData) {
- out += '\' + ' + ($schemaValue) + ' + \'';
- } else {
- out += '' + (it.util.escapeQuotes($schema));
- }
- out += '"\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + (it.util.toQuotedString($schema));
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += '}';
- return out;
-}
-
-},{}],14:[function(require,module,exports){
-'use strict';
-module.exports = function generate__limit(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- var $isMax = $keyword == 'maximum',
- $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',
- $schemaExcl = it.schema[$exclusiveKeyword],
- $isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data,
- $op = $isMax ? '<' : '>',
- $notOp = $isMax ? '>' : '<';
- if ($isDataExcl) {
- var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
- $exclusive = 'exclusive' + $lvl,
- $opExpr = 'op' + $lvl,
- $opStr = '\' + ' + $opExpr + ' + \'';
- out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
- $schemaValueExcl = 'schemaExcl' + $lvl;
- out += ' var exclusive' + ($lvl) + '; if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && typeof ' + ($schemaValueExcl) + ' != \'undefined\') { ';
- var $errorKeyword = $exclusiveKeyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
- if (it.opts.messages !== false) {
- out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } else if( ';
- if ($isData) {
- out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
- }
- out += ' ((exclusive' + ($lvl) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ') || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = exclusive' + ($lvl) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
- } else {
- var $exclusive = $schemaExcl === true,
- $opStr = $op;
- if (!$exclusive) $opStr += '=';
- var $opExpr = '\'' + $opStr + '\'';
- out += ' if ( ';
- if ($isData) {
- out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
- }
- out += ' ' + ($data) + ' ' + ($notOp);
- if ($exclusive) {
- out += '=';
- }
- out += ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') {';
- }
- var $errorKeyword = $keyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should be ' + ($opStr) + ' ';
- if ($isData) {
- out += '\' + ' + ($schemaValue);
- } else {
- out += '' + ($schema) + '\'';
- }
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + ($schema);
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' else { ';
- }
- return out;
-}
-
-},{}],15:[function(require,module,exports){
-'use strict';
-module.exports = function generate__limitItems(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- var $op = $keyword == 'maxItems' ? '>' : '<';
- out += 'if ( ';
- if ($isData) {
- out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
- }
- out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';
- var $errorKeyword = $keyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT have ';
- if ($keyword == 'maxItems') {
- out += 'more';
- } else {
- out += 'less';
- }
- out += ' than ';
- if ($isData) {
- out += '\' + ' + ($schemaValue) + ' + \'';
- } else {
- out += '' + ($schema);
- }
- out += ' items\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + ($schema);
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += '} ';
- if ($breakOnError) {
- out += ' else { ';
- }
- return out;
-}
-
-},{}],16:[function(require,module,exports){
-'use strict';
-module.exports = function generate__limitLength(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- var $op = $keyword == 'maxLength' ? '>' : '<';
- out += 'if ( ';
- if ($isData) {
- out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
- }
- if (it.opts.unicode === false) {
- out += ' ' + ($data) + '.length ';
- } else {
- out += ' ucs2length(' + ($data) + ') ';
- }
- out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';
- var $errorKeyword = $keyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT be ';
- if ($keyword == 'maxLength') {
- out += 'longer';
- } else {
- out += 'shorter';
- }
- out += ' than ';
- if ($isData) {
- out += '\' + ' + ($schemaValue) + ' + \'';
- } else {
- out += '' + ($schema);
- }
- out += ' characters\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + ($schema);
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += '} ';
- if ($breakOnError) {
- out += ' else { ';
- }
- return out;
-}
-
-},{}],17:[function(require,module,exports){
-'use strict';
-module.exports = function generate__limitProperties(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- var $op = $keyword == 'maxProperties' ? '>' : '<';
- out += 'if ( ';
- if ($isData) {
- out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
- }
- out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';
- var $errorKeyword = $keyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT have ';
- if ($keyword == 'maxProperties') {
- out += 'more';
- } else {
- out += 'less';
- }
- out += ' than ';
- if ($isData) {
- out += '\' + ' + ($schemaValue) + ' + \'';
- } else {
- out += '' + ($schema);
- }
- out += ' properties\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + ($schema);
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += '} ';
- if ($breakOnError) {
- out += ' else { ';
- }
- return out;
-}
-
-},{}],18:[function(require,module,exports){
-'use strict';
-module.exports = function generate_allOf(it, $keyword) {
- var out = ' ';
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $it = it.util.copy(it);
- var $closingBraces = '';
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- var $currentBaseId = $it.baseId,
- $allSchemasEmpty = true;
- var arr1 = $schema;
- if (arr1) {
- var $sch, $i = -1,
- l1 = arr1.length - 1;
- while ($i < l1) {
- $sch = arr1[$i += 1];
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
- $allSchemasEmpty = false;
- $it.schema = $sch;
- $it.schemaPath = $schemaPath + '[' + $i + ']';
- $it.errSchemaPath = $errSchemaPath + '/' + $i;
- out += ' ' + (it.validate($it)) + ' ';
- $it.baseId = $currentBaseId;
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- }
- }
- }
- if ($breakOnError) {
- if ($allSchemasEmpty) {
- out += ' if (true) { ';
- } else {
- out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
- }
- }
- out = it.util.cleanUpCode(out);
- return out;
-}
-
-},{}],19:[function(require,module,exports){
-'use strict';
-module.exports = function generate_anyOf(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $errs = 'errs__' + $lvl;
- var $it = it.util.copy(it);
- var $closingBraces = '';
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- var $noEmptySchema = $schema.every(function($sch) {
- return it.util.schemaHasRules($sch, it.RULES.all);
- });
- if ($noEmptySchema) {
- var $currentBaseId = $it.baseId;
- out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';
- var $wasComposite = it.compositeRule;
- it.compositeRule = $it.compositeRule = true;
- var arr1 = $schema;
- if (arr1) {
- var $sch, $i = -1,
- l1 = arr1.length - 1;
- while ($i < l1) {
- $sch = arr1[$i += 1];
- $it.schema = $sch;
- $it.schemaPath = $schemaPath + '[' + $i + ']';
- $it.errSchemaPath = $errSchemaPath + '/' + $i;
- out += ' ' + (it.validate($it)) + ' ';
- $it.baseId = $currentBaseId;
- out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';
- $closingBraces += '}';
- }
- }
- it.compositeRule = $it.compositeRule = $wasComposite;
- out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should match some schema in anyOf\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
- if (it.opts.allErrors) {
- out += ' } ';
- }
- out = it.util.cleanUpCode(out);
- } else {
- if ($breakOnError) {
- out += ' if (true) { ';
- }
- }
- return out;
-}
-
-},{}],20:[function(require,module,exports){
-'use strict';
-module.exports = function generate_constant(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- if (!$isData) {
- out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';
- }
- out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'constant') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should be equal to constant\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' }';
- return out;
-}
-
-},{}],21:[function(require,module,exports){
-'use strict';
-module.exports = function generate_custom(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $errs = 'errs__' + $lvl;
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- var $rule = this,
- $definition = 'definition' + $lvl,
- $rDef = $rule.definition,
- $validate = $rDef.validate,
- $compile, $inline, $macro, $ruleValidate, $validateCode;
- if ($isData && $rDef.$data) {
- $validateCode = 'keywordValidate' + $lvl;
- var $validateSchema = $rDef.validateSchema;
- out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;';
- } else {
- $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
- $schemaValue = 'validate.schema' + $schemaPath;
- $validateCode = $ruleValidate.code;
- $compile = $rDef.compile;
- $inline = $rDef.inline;
- $macro = $rDef.macro;
- }
- var $ruleErrs = $validateCode + '.errors',
- $i = 'i' + $lvl,
- $ruleErr = 'ruleErr' + $lvl,
- $asyncKeyword = $rDef.async;
- if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema');
- if (!($inline || $macro)) {
- out += '' + ($ruleErrs) + ' = null;';
- }
- out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
- if ($validateSchema) {
- out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') {';
- }
- if ($inline) {
- if ($rDef.statements) {
- out += ' ' + ($ruleValidate.validate) + ' ';
- } else {
- out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; ';
- }
- } else if ($macro) {
- var $it = it.util.copy(it);
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- $it.schema = $ruleValidate.validate;
- $it.schemaPath = '';
- var $wasComposite = it.compositeRule;
- it.compositeRule = $it.compositeRule = true;
- var $code = it.validate($it).replace(/validate\.schema/g, $validateCode);
- it.compositeRule = $it.compositeRule = $wasComposite;
- out += ' ' + ($code);
- } else {
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = '';
- out += ' ' + ($validateCode) + '.call( ';
- if (it.opts.passContext) {
- out += 'this';
- } else {
- out += 'self';
- }
- if ($compile || $rDef.schema === false) {
- out += ' , ' + ($data) + ' ';
- } else {
- out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' ';
- }
- out += ' , (dataPath || \'\')';
- if (it.errorPath != '""') {
- out += ' + ' + (it.errorPath);
- }
- var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
- $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
- out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) ';
- var def_callRuleValidate = out;
- out = $$outStack.pop();
- if ($rDef.errors === false) {
- out += ' ' + ($valid) + ' = ';
- if ($asyncKeyword) {
- out += '' + (it.yieldAwait);
- }
- out += '' + (def_callRuleValidate) + '; ';
- } else {
- if ($asyncKeyword) {
- $ruleErrs = 'customErrors' + $lvl;
- out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';
- } else {
- out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; ';
- }
- }
- }
- if ($rDef.modifying) {
- out += ' ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];';
- }
- if ($validateSchema) {
- out += ' }';
- }
- if ($rDef.valid) {
- if ($breakOnError) {
- out += ' if (true) { ';
- }
- } else {
- out += ' if ( ';
- if ($rDef.valid === undefined) {
- out += ' !';
- if ($macro) {
- out += '' + ($nextValid);
- } else {
- out += '' + ($valid);
- }
- } else {
- out += ' ' + (!$rDef.valid) + ' ';
- }
- out += ') { ';
- $errorKeyword = $rule.keyword;
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = '';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- var def_customError = out;
- out = $$outStack.pop();
- if ($inline) {
- if ($rDef.errors) {
- if ($rDef.errors != 'full') {
- out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + ' ' + ($i) + ') { ';
- var $passData = $data + '[' + $i + ']';
- $it.schema = $sch;
- $it.schemaPath = $schemaPath + '[' + $i + ']';
- $it.errSchemaPath = $errSchemaPath + '/' + $i;
- $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
- $it.dataPathArr[$dataNxt] = $i;
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
- } else {
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- }
- }
- }
- if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) {
- $it.schema = $additionalItems;
- $it.schemaPath = it.schemaPath + '.additionalItems';
- $it.errSchemaPath = it.errSchemaPath + '/additionalItems';
- out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
- $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
- var $passData = $data + '[' + $idx + ']';
- $it.dataPathArr[$dataNxt] = $idx;
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
- } else {
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
- }
- if ($breakOnError) {
- out += ' if (!' + ($nextValid) + ') break; ';
- }
- out += ' } } ';
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- }
- } else if (it.util.schemaHasRules($schema, it.RULES.all)) {
- $it.schema = $schema;
- $it.schemaPath = $schemaPath;
- $it.errSchemaPath = $errSchemaPath;
- out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
- $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
- var $passData = $data + '[' + $idx + ']';
- $it.dataPathArr[$dataNxt] = $idx;
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
- } else {
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
- }
- if ($breakOnError) {
- out += ' if (!' + ($nextValid) + ') break; ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- }
- if ($breakOnError) {
- out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
- }
- out = it.util.cleanUpCode(out);
- return out;
-}
-
-},{}],26:[function(require,module,exports){
-'use strict';
-module.exports = function generate_multipleOf(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- out += 'var division' + ($lvl) + ';if (';
- if ($isData) {
- out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
- }
- out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';
- if (it.opts.multipleOfPrecision) {
- out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';
- } else {
- out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';
- }
- out += ' ) ';
- if ($isData) {
- out += ' ) ';
- }
- out += ' ) { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should be multiple of ';
- if ($isData) {
- out += '\' + ' + ($schemaValue);
- } else {
- out += '' + ($schema) + '\'';
- }
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + ($schema);
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += '} ';
- if ($breakOnError) {
- out += ' else { ';
- }
- return out;
-}
-
-},{}],27:[function(require,module,exports){
-'use strict';
-module.exports = function generate_not(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $errs = 'errs__' + $lvl;
- var $it = it.util.copy(it);
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- if (it.util.schemaHasRules($schema, it.RULES.all)) {
- $it.schema = $schema;
- $it.schemaPath = $schemaPath;
- $it.errSchemaPath = $errSchemaPath;
- out += ' var ' + ($errs) + ' = errors; ';
- var $wasComposite = it.compositeRule;
- it.compositeRule = $it.compositeRule = true;
- $it.createErrors = false;
- var $allErrorsOption;
- if ($it.opts.allErrors) {
- $allErrorsOption = $it.opts.allErrors;
- $it.opts.allErrors = false;
- }
- out += ' ' + (it.validate($it)) + ' ';
- $it.createErrors = true;
- if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
- it.compositeRule = $it.compositeRule = $wasComposite;
- out += ' if (' + ($nextValid) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT be valid\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
- if (it.opts.allErrors) {
- out += ' } ';
- }
- } else {
- out += ' var err = '; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT be valid\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- if ($breakOnError) {
- out += ' if (false) { ';
- }
- }
- return out;
-}
-
-},{}],28:[function(require,module,exports){
-'use strict';
-module.exports = function generate_oneOf(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $errs = 'errs__' + $lvl;
- var $it = it.util.copy(it);
- var $closingBraces = '';
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;';
- var $currentBaseId = $it.baseId;
- var $wasComposite = it.compositeRule;
- it.compositeRule = $it.compositeRule = true;
- var arr1 = $schema;
- if (arr1) {
- var $sch, $i = -1,
- l1 = arr1.length - 1;
- while ($i < l1) {
- $sch = arr1[$i += 1];
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
- $it.schema = $sch;
- $it.schemaPath = $schemaPath + '[' + $i + ']';
- $it.errSchemaPath = $errSchemaPath + '/' + $i;
- out += ' ' + (it.validate($it)) + ' ';
- $it.baseId = $currentBaseId;
- } else {
- out += ' var ' + ($nextValid) + ' = true; ';
- }
- if ($i) {
- out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { ';
- $closingBraces += '}';
- }
- out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;';
- }
- }
- it.compositeRule = $it.compositeRule = $wasComposite;
- out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should match exactly one schema in oneOf\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';
- if (it.opts.allErrors) {
- out += ' } ';
- }
- return out;
-}
-
-},{}],29:[function(require,module,exports){
-'use strict';
-module.exports = function generate_pattern(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);
- out += 'if ( ';
- if ($isData) {
- out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
- }
- out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: ';
- if ($isData) {
- out += '' + ($schemaValue);
- } else {
- out += '' + (it.util.toQuotedString($schema));
- }
- out += ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should match pattern "';
- if ($isData) {
- out += '\' + ' + ($schemaValue) + ' + \'';
- } else {
- out += '' + (it.util.escapeQuotes($schema));
- }
- out += '"\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + (it.util.toQuotedString($schema));
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += '} ';
- if ($breakOnError) {
- out += ' else { ';
- }
- return out;
-}
-
-},{}],30:[function(require,module,exports){
-'use strict';
-module.exports = function generate_patternRequired(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $key = 'key' + $lvl,
- $matched = 'patternMatched' + $lvl,
- $closingBraces = '',
- $ownProperties = it.opts.ownProperties;
- out += 'var ' + ($valid) + ' = true;';
- var arr1 = $schema;
- if (arr1) {
- var $pProperty, i1 = -1,
- l1 = arr1.length - 1;
- while (i1 < l1) {
- $pProperty = arr1[i1 += 1];
- out += ' var ' + ($matched) + ' = false; for (var ' + ($key) + ' in ' + ($data) + ') { ';
- if ($ownProperties) {
- out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
- }
- out += ' ' + ($matched) + ' = ' + (it.usePattern($pProperty)) + '.test(' + ($key) + '); if (' + ($matched) + ') break; } ';
- var $missingPattern = it.util.escapeQuotes($pProperty);
- out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
- if ($breakOnError) {
- $closingBraces += '}';
- out += ' else { ';
- }
- }
- }
- out += '' + ($closingBraces);
- return out;
-}
-
-},{}],31:[function(require,module,exports){
-'use strict';
-module.exports = function generate_properties(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $errs = 'errs__' + $lvl;
- var $it = it.util.copy(it);
- var $closingBraces = '';
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- var $key = 'key' + $lvl,
- $dataNxt = $it.dataLevel = it.dataLevel + 1,
- $nextData = 'data' + $dataNxt;
- var $schemaKeys = Object.keys($schema || {}),
- $pProperties = it.schema.patternProperties || {},
- $pPropertyKeys = Object.keys($pProperties),
- $aProperties = it.schema.additionalProperties,
- $someProperties = $schemaKeys.length || $pPropertyKeys.length,
- $noAdditional = $aProperties === false,
- $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,
- $removeAdditional = it.opts.removeAdditional,
- $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,
- $ownProperties = it.opts.ownProperties,
- $currentBaseId = it.baseId;
- var $required = it.schema.required;
- if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required);
- if (it.opts.v5) {
- var $pgProperties = it.schema.patternGroups || {},
- $pgPropertyKeys = Object.keys($pgProperties);
- }
- out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
- if ($checkAdditional) {
- out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
- if ($ownProperties) {
- out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
- }
- if ($someProperties) {
- out += ' var isAdditional' + ($lvl) + ' = !(false ';
- if ($schemaKeys.length) {
- if ($schemaKeys.length > 5) {
- out += ' || validate.schema' + ($schemaPath) + '[' + ($key) + '] ';
- } else {
- var arr1 = $schemaKeys;
- if (arr1) {
- var $propertyKey, i1 = -1,
- l1 = arr1.length - 1;
- while (i1 < l1) {
- $propertyKey = arr1[i1 += 1];
- out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';
- }
- }
- }
- }
- if ($pPropertyKeys.length) {
- var arr2 = $pPropertyKeys;
- if (arr2) {
- var $pProperty, $i = -1,
- l2 = arr2.length - 1;
- while ($i < l2) {
- $pProperty = arr2[$i += 1];
- out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';
- }
- }
- }
- if (it.opts.v5 && $pgPropertyKeys && $pgPropertyKeys.length) {
- var arr3 = $pgPropertyKeys;
- if (arr3) {
- var $pgProperty, $i = -1,
- l3 = arr3.length - 1;
- while ($i < l3) {
- $pgProperty = arr3[$i += 1];
- out += ' || ' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ') ';
- }
- }
- }
- out += ' ); if (isAdditional' + ($lvl) + ') { ';
- }
- if ($removeAdditional == 'all') {
- out += ' delete ' + ($data) + '[' + ($key) + ']; ';
- } else {
- var $currentErrorPath = it.errorPath;
- var $additionalProperty = '\' + ' + $key + ' + \'';
- if (it.opts._errorDataPathProperty) {
- it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
- }
- if ($noAdditional) {
- if ($removeAdditional) {
- out += ' delete ' + ($data) + '[' + ($key) + ']; ';
- } else {
- out += ' ' + ($nextValid) + ' = false; ';
- var $currErrSchemaPath = $errSchemaPath;
- $errSchemaPath = it.errSchemaPath + '/additionalProperties';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT have additional properties\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- $errSchemaPath = $currErrSchemaPath;
- if ($breakOnError) {
- out += ' break; ';
- }
- }
- } else if ($additionalIsSchema) {
- if ($removeAdditional == 'failing') {
- out += ' var ' + ($errs) + ' = errors; ';
- var $wasComposite = it.compositeRule;
- it.compositeRule = $it.compositeRule = true;
- $it.schema = $aProperties;
- $it.schemaPath = it.schemaPath + '.additionalProperties';
- $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
- $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
- var $passData = $data + '[' + $key + ']';
- $it.dataPathArr[$dataNxt] = $key;
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
- } else {
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
- }
- out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } ';
- it.compositeRule = $it.compositeRule = $wasComposite;
- } else {
- $it.schema = $aProperties;
- $it.schemaPath = it.schemaPath + '.additionalProperties';
- $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
- $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
- var $passData = $data + '[' + $key + ']';
- $it.dataPathArr[$dataNxt] = $key;
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
- } else {
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
- }
- if ($breakOnError) {
- out += ' if (!' + ($nextValid) + ') break; ';
- }
- }
- }
- it.errorPath = $currentErrorPath;
- }
- if ($someProperties) {
- out += ' } ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- }
- var $useDefaults = it.opts.useDefaults && !it.compositeRule;
- if ($schemaKeys.length) {
- var arr4 = $schemaKeys;
- if (arr4) {
- var $propertyKey, i4 = -1,
- l4 = arr4.length - 1;
- while (i4 < l4) {
- $propertyKey = arr4[i4 += 1];
- var $sch = $schema[$propertyKey];
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
- var $prop = it.util.getProperty($propertyKey),
- $passData = $data + $prop,
- $hasDefault = $useDefaults && $sch.default !== undefined;
- $it.schema = $sch;
- $it.schemaPath = $schemaPath + $prop;
- $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
- $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
- $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- $code = it.util.varReplace($code, $nextData, $passData);
- var $useData = $passData;
- } else {
- var $useData = $nextData;
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';
- }
- if ($hasDefault) {
- out += ' ' + ($code) + ' ';
- } else {
- if ($requiredHash && $requiredHash[$propertyKey]) {
- out += ' if (' + ($useData) + ' === undefined) { ' + ($nextValid) + ' = false; ';
- var $currentErrorPath = it.errorPath,
- $currErrSchemaPath = $errSchemaPath,
- $missingProperty = it.util.escapeQuotes($propertyKey);
- if (it.opts._errorDataPathProperty) {
- it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
- }
- $errSchemaPath = it.errSchemaPath + '/required';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'';
- if (it.opts._errorDataPathProperty) {
- out += 'is a required property';
- } else {
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- $errSchemaPath = $currErrSchemaPath;
- it.errorPath = $currentErrorPath;
- out += ' } else { ';
- } else {
- if ($breakOnError) {
- out += ' if (' + ($useData) + ' === undefined) { ' + ($nextValid) + ' = true; } else { ';
- } else {
- out += ' if (' + ($useData) + ' !== undefined) { ';
- }
- }
- out += ' ' + ($code) + ' } ';
- }
- }
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- }
- }
- }
- var arr5 = $pPropertyKeys;
- if (arr5) {
- var $pProperty, i5 = -1,
- l5 = arr5.length - 1;
- while (i5 < l5) {
- $pProperty = arr5[i5 += 1];
- var $sch = $pProperties[$pProperty];
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
- $it.schema = $sch;
- $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
- $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
- out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
- if ($ownProperties) {
- out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
- }
- out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';
- $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
- var $passData = $data + '[' + $key + ']';
- $it.dataPathArr[$dataNxt] = $key;
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
- } else {
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
- }
- if ($breakOnError) {
- out += ' if (!' + ($nextValid) + ') break; ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' else ' + ($nextValid) + ' = true; ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- }
- }
- }
- if (it.opts.v5) {
- var arr6 = $pgPropertyKeys;
- if (arr6) {
- var $pgProperty, i6 = -1,
- l6 = arr6.length - 1;
- while (i6 < l6) {
- $pgProperty = arr6[i6 += 1];
- var $pgSchema = $pgProperties[$pgProperty],
- $sch = $pgSchema.schema;
- if (it.util.schemaHasRules($sch, it.RULES.all)) {
- $it.schema = $sch;
- $it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema';
- $it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + it.util.escapeFragment($pgProperty) + '/schema';
- out += ' var pgPropCount' + ($lvl) + ' = 0; for (var ' + ($key) + ' in ' + ($data) + ') { ';
- if ($ownProperties) {
- out += ' if (!Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($key) + ')) continue; ';
- }
- out += ' if (' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ')) { pgPropCount' + ($lvl) + '++; ';
- $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
- var $passData = $data + '[' + $key + ']';
- $it.dataPathArr[$dataNxt] = $key;
- var $code = it.validate($it);
- $it.baseId = $currentBaseId;
- if (it.util.varOccurences($code, $nextData) < 2) {
- out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
- } else {
- out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
- }
- if ($breakOnError) {
- out += ' if (!' + ($nextValid) + ') break; ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' else ' + ($nextValid) + ' = true; ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- $closingBraces += '}';
- }
- var $pgMin = $pgSchema.minimum,
- $pgMax = $pgSchema.maximum;
- if ($pgMin !== undefined || $pgMax !== undefined) {
- out += ' var ' + ($valid) + ' = true; ';
- var $currErrSchemaPath = $errSchemaPath;
- if ($pgMin !== undefined) {
- var $limit = $pgMin,
- $reason = 'minimum',
- $moreOrLess = 'less';
- out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' >= ' + ($pgMin) + '; ';
- $errSchemaPath = it.errSchemaPath + '/patternGroups/minimum';
- out += ' if (!' + ($valid) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } ';
- if ($pgMax !== undefined) {
- out += ' else ';
- }
- }
- if ($pgMax !== undefined) {
- var $limit = $pgMax,
- $reason = 'maximum',
- $moreOrLess = 'more';
- out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' <= ' + ($pgMax) + '; ';
- $errSchemaPath = it.errSchemaPath + '/patternGroups/maximum';
- out += ' if (!' + ($valid) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } ';
- }
- $errSchemaPath = $currErrSchemaPath;
- if ($breakOnError) {
- out += ' if (' + ($valid) + ') { ';
- $closingBraces += '}';
- }
- }
- }
- }
- }
- }
- if ($breakOnError) {
- out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
- }
- out = it.util.cleanUpCode(out);
- return out;
-}
-
-},{}],32:[function(require,module,exports){
-'use strict';
-module.exports = function generate_ref(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $async, $refCode;
- if ($schema == '#' || $schema == '#/') {
- if (it.isRoot) {
- $async = it.async;
- $refCode = 'validate';
- } else {
- $async = it.root.schema.$async === true;
- $refCode = 'root.refVal[0]';
- }
- } else {
- var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);
- if ($refVal === undefined) {
- var $message = 'can\'t resolve reference ' + $schema + ' from id ' + it.baseId;
- if (it.opts.missingRefs == 'fail') {
- console.log($message);
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || '$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- if ($breakOnError) {
- out += ' if (false) { ';
- }
- } else if (it.opts.missingRefs == 'ignore') {
- console.log($message);
- if ($breakOnError) {
- out += ' if (true) { ';
- }
- } else {
- var $error = new Error($message);
- $error.missingRef = it.resolve.url(it.baseId, $schema);
- $error.missingSchema = it.resolve.normalizeId(it.resolve.fullPath($error.missingRef));
- throw $error;
- }
- } else if ($refVal.inline) {
- var $it = it.util.copy(it);
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- $it.schema = $refVal.schema;
- $it.schemaPath = '';
- $it.errSchemaPath = $schema;
- var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code);
- out += ' ' + ($code) + ' ';
- if ($breakOnError) {
- out += ' if (' + ($nextValid) + ') { ';
- }
- } else {
- $async = $refVal.$async === true;
- $refCode = $refVal.code;
- }
- }
- if ($refCode) {
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = '';
- if (it.opts.passContext) {
- out += ' ' + ($refCode) + '.call(this, ';
- } else {
- out += ' ' + ($refCode) + '( ';
- }
- out += ' ' + ($data) + ', (dataPath || \'\')';
- if (it.errorPath != '""') {
- out += ' + ' + (it.errorPath);
- }
- var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
- $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
- out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) ';
- var __callValidate = out;
- out = $$outStack.pop();
- if ($async) {
- if (!it.async) throw new Error('async schema referenced by sync schema');
- out += ' try { ';
- if ($breakOnError) {
- out += 'var ' + ($valid) + ' =';
- }
- out += ' ' + (it.yieldAwait) + ' ' + (__callValidate) + '; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } ';
- if ($breakOnError) {
- out += ' if (' + ($valid) + ') { ';
- }
- } else {
- out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';
- if ($breakOnError) {
- out += ' else { ';
- }
- }
- }
- return out;
-}
-
-},{}],33:[function(require,module,exports){
-'use strict';
-module.exports = function generate_required(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- var $vSchema = 'schema' + $lvl;
- if (!$isData) {
- if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) {
- var $required = [];
- var arr1 = $schema;
- if (arr1) {
- var $property, i1 = -1,
- l1 = arr1.length - 1;
- while (i1 < l1) {
- $property = arr1[i1 += 1];
- var $propertySch = it.schema.properties[$property];
- if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) {
- $required[$required.length] = $property;
- }
- }
- }
- } else {
- var $required = $schema;
- }
- }
- if ($isData || $required.length) {
- var $currentErrorPath = it.errorPath,
- $loopRequired = $isData || $required.length >= it.opts.loopRequired;
- if ($breakOnError) {
- out += ' var missing' + ($lvl) + '; ';
- if ($loopRequired) {
- if (!$isData) {
- out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
- }
- var $i = 'i' + $lvl,
- $propertyPath = 'schema' + $lvl + '[' + $i + ']',
- $missingProperty = '\' + ' + $propertyPath + ' + \'';
- if (it.opts._errorDataPathProperty) {
- it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
- }
- out += ' var ' + ($valid) + ' = true; ';
- if ($isData) {
- out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
- }
- out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined; if (!' + ($valid) + ') break; } ';
- if ($isData) {
- out += ' } ';
- }
- out += ' if (!' + ($valid) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'';
- if (it.opts._errorDataPathProperty) {
- out += 'is a required property';
- } else {
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } else { ';
- } else {
- out += ' if ( ';
- var arr2 = $required;
- if (arr2) {
- var _$property, $i = -1,
- l2 = arr2.length - 1;
- while ($i < l2) {
- _$property = arr2[$i += 1];
- if ($i) {
- out += ' || ';
- }
- var $prop = it.util.getProperty(_$property);
- out += ' ( ' + ($data) + ($prop) + ' === undefined && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? _$property : $prop)) + ') ) ';
- }
- }
- out += ') { ';
- var $propertyPath = 'missing' + $lvl,
- $missingProperty = '\' + ' + $propertyPath + ' + \'';
- if (it.opts._errorDataPathProperty) {
- it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
- }
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'';
- if (it.opts._errorDataPathProperty) {
- out += 'is a required property';
- } else {
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } else { ';
- }
- } else {
- if ($loopRequired) {
- if (!$isData) {
- out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';
- }
- var $i = 'i' + $lvl,
- $propertyPath = 'schema' + $lvl + '[' + $i + ']',
- $missingProperty = '\' + ' + $propertyPath + ' + \'';
- if (it.opts._errorDataPathProperty) {
- it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
- }
- if ($isData) {
- out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'';
- if (it.opts._errorDataPathProperty) {
- out += 'is a required property';
- } else {
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';
- }
- out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined) { var err = '; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'';
- if (it.opts._errorDataPathProperty) {
- out += 'is a required property';
- } else {
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';
- if ($isData) {
- out += ' } ';
- }
- } else {
- var arr3 = $required;
- if (arr3) {
- var $reqProperty, i3 = -1,
- l3 = arr3.length - 1;
- while (i3 < l3) {
- $reqProperty = arr3[i3 += 1];
- var $prop = it.util.getProperty($reqProperty),
- $missingProperty = it.util.escapeQuotes($reqProperty);
- if (it.opts._errorDataPathProperty) {
- it.errorPath = it.util.getPath($currentErrorPath, $reqProperty, it.opts.jsonPointers);
- }
- out += ' if (' + ($data) + ($prop) + ' === undefined) { var err = '; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'';
- if (it.opts._errorDataPathProperty) {
- out += 'is a required property';
- } else {
- out += 'should have required property \\\'' + ($missingProperty) + '\\\'';
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
- }
- }
- }
- }
- it.errorPath = $currentErrorPath;
- } else if ($breakOnError) {
- out += ' if (true) {';
- }
- return out;
-}
-
-},{}],34:[function(require,module,exports){
-'use strict';
-module.exports = function generate_switch(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $errs = 'errs__' + $lvl;
- var $it = it.util.copy(it);
- var $closingBraces = '';
- $it.level++;
- var $nextValid = 'valid' + $it.level;
- var $ifPassed = 'ifPassed' + it.level,
- $currentBaseId = $it.baseId,
- $shouldContinue;
- out += 'var ' + ($ifPassed) + ';';
- var arr1 = $schema;
- if (arr1) {
- var $sch, $caseIndex = -1,
- l1 = arr1.length - 1;
- while ($caseIndex < l1) {
- $sch = arr1[$caseIndex += 1];
- if ($caseIndex && !$shouldContinue) {
- out += ' if (!' + ($ifPassed) + ') { ';
- $closingBraces += '}';
- }
- if ($sch.if && it.util.schemaHasRules($sch.if, it.RULES.all)) {
- out += ' var ' + ($errs) + ' = errors; ';
- var $wasComposite = it.compositeRule;
- it.compositeRule = $it.compositeRule = true;
- $it.createErrors = false;
- $it.schema = $sch.if;
- $it.schemaPath = $schemaPath + '[' + $caseIndex + '].if';
- $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/if';
- out += ' ' + (it.validate($it)) + ' ';
- $it.baseId = $currentBaseId;
- $it.createErrors = true;
- it.compositeRule = $it.compositeRule = $wasComposite;
- out += ' ' + ($ifPassed) + ' = ' + ($nextValid) + '; if (' + ($ifPassed) + ') { ';
- if (typeof $sch.then == 'boolean') {
- if ($sch.then === false) {
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should pass "switch" keyword validation\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- }
- out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
- } else {
- $it.schema = $sch.then;
- $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
- $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
- out += ' ' + (it.validate($it)) + ' ';
- $it.baseId = $currentBaseId;
- }
- out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } } ';
- } else {
- out += ' ' + ($ifPassed) + ' = true; ';
- if (typeof $sch.then == 'boolean') {
- if ($sch.then === false) {
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should pass "switch" keyword validation\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- }
- out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
- } else {
- $it.schema = $sch.then;
- $it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
- $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
- out += ' ' + (it.validate($it)) + ' ';
- $it.baseId = $currentBaseId;
- }
- }
- $shouldContinue = $sch.continue
- }
- }
- out += '' + ($closingBraces) + 'var ' + ($valid) + ' = ' + ($nextValid) + '; ';
- out = it.util.cleanUpCode(out);
- return out;
-}
-
-},{}],35:[function(require,module,exports){
-'use strict';
-module.exports = function generate_uniqueItems(it, $keyword) {
- var out = ' ';
- var $lvl = it.level;
- var $dataLvl = it.dataLevel;
- var $schema = it.schema[$keyword];
- var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
- var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
- var $breakOnError = !it.opts.allErrors;
- var $errorKeyword;
- var $data = 'data' + ($dataLvl || '');
- var $valid = 'valid' + $lvl;
- var $isData = it.opts.v5 && $schema && $schema.$data,
- $schemaValue;
- if ($isData) {
- out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
- $schemaValue = 'schema' + $lvl;
- } else {
- $schemaValue = $schema;
- }
- if (($schema || $isData) && it.opts.uniqueItems !== false) {
- if ($isData) {
- out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { ';
- }
- out += ' var ' + ($valid) + ' = true; if (' + ($data) + '.length > 1) { var i = ' + ($data) + '.length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } } ';
- if ($isData) {
- out += ' } ';
- }
- out += ' if (!' + ($valid) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: ';
- if ($isData) {
- out += 'validate.schema' + ($schemaPath);
- } else {
- out += '' + ($schema);
- }
- out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } ';
- if ($breakOnError) {
- out += ' else { ';
- }
- } else {
- if ($breakOnError) {
- out += ' if (true) { ';
- }
- }
- return out;
-}
-
-},{}],36:[function(require,module,exports){
-'use strict';
-module.exports = function generate_validate(it, $keyword) {
- var out = '';
- var $async = it.schema.$async === true;
- if (it.isTop) {
- var $top = it.isTop,
- $lvl = it.level = 0,
- $dataLvl = it.dataLevel = 0,
- $data = 'data';
- it.rootId = it.resolve.fullPath(it.root.schema.id);
- it.baseId = it.baseId || it.rootId;
- if ($async) {
- it.async = true;
- var $es7 = it.opts.async == 'es7';
- it.yieldAwait = $es7 ? 'await' : 'yield';
- }
- delete it.isTop;
- it.dataPathArr = [undefined];
- out += ' var validate = ';
- if ($async) {
- if ($es7) {
- out += ' (async function ';
- } else {
- if (it.opts.async == 'co*') {
- out += 'co.wrap';
- }
- out += '(function* ';
- }
- } else {
- out += ' (function ';
- }
- out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; var vErrors = null; ';
- out += ' var errors = 0; ';
- out += ' if (rootData === undefined) rootData = data;';
- } else {
- var $lvl = it.level,
- $dataLvl = it.dataLevel,
- $data = 'data' + ($dataLvl || '');
- if (it.schema.id) it.baseId = it.resolve.url(it.baseId, it.schema.id);
- if ($async && !it.async) throw new Error('async schema in sync schema');
- out += ' var errs_' + ($lvl) + ' = errors;';
- }
- var $valid = 'valid' + $lvl,
- $breakOnError = !it.opts.allErrors,
- $closingBraces1 = '',
- $closingBraces2 = '',
- $errorKeyword;
- var $typeSchema = it.schema.type,
- $typeIsArray = Array.isArray($typeSchema);
- if ($typeSchema && it.opts.coerceTypes) {
- var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema);
- if ($coerceToTypes) {
- var $schemaPath = it.schemaPath + '.type',
- $errSchemaPath = it.errSchemaPath + '/type',
- $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
- out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
- var $dataType = 'dataType' + $lvl,
- $coerced = 'coerced' + $lvl;
- out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; ';
- if (it.opts.coerceTypes == 'array') {
- out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; ';
- }
- out += ' var ' + ($coerced) + ' = undefined; ';
- var $bracesCoercion = '';
- var arr1 = $coerceToTypes;
- if (arr1) {
- var $type, $i = -1,
- l1 = arr1.length - 1;
- while ($i < l1) {
- $type = arr1[$i += 1];
- if ($i) {
- out += ' if (' + ($coerced) + ' === undefined) { ';
- $bracesCoercion += '}';
- }
- if (it.opts.coerceTypes == 'array' && $type != 'array') {
- out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } ';
- }
- if ($type == 'string') {
- out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
- } else if ($type == 'number' || $type == 'integer') {
- out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
- if ($type == 'integer') {
- out += ' && !(' + ($data) + ' % 1)';
- }
- out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
- } else if ($type == 'boolean') {
- out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
- } else if ($type == 'null') {
- out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
- } else if (it.opts.coerceTypes == 'array' && $type == 'array') {
- out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
- }
- }
- }
- out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
- if ($typeIsArray) {
- out += '' + ($typeSchema.join(","));
- } else {
- out += '' + ($typeSchema);
- }
- out += '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should be ';
- if ($typeIsArray) {
- out += '' + ($typeSchema.join(","));
- } else {
- out += '' + ($typeSchema);
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } else { ';
- var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
- $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
- out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
- if (!$dataLvl) {
- out += 'if (' + ($parentData) + ' !== undefined)';
- }
- out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } } ';
- }
- }
- var $refKeywords;
- if (it.schema.$ref && ($refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'))) {
- if (it.opts.extendRefs == 'fail') {
- throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '"');
- } else if (it.opts.extendRefs == 'ignore') {
- $refKeywords = false;
- console.log('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
- } else if (it.opts.extendRefs !== true) {
- console.log('$ref: all keywords used in schema at path "' + it.errSchemaPath + '". It will change in the next major version, see issue #260. Use option { extendRefs: true } to keep current behaviour');
- }
- }
- if (it.schema.$ref && !$refKeywords) {
- out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' ';
- if ($breakOnError) {
- out += ' } if (errors === ';
- if ($top) {
- out += '0';
- } else {
- out += 'errs_' + ($lvl);
- }
- out += ') { ';
- $closingBraces2 += '}';
- }
- } else {
- var arr2 = it.RULES;
- if (arr2) {
- var $rulesGroup, i2 = -1,
- l2 = arr2.length - 1;
- while (i2 < l2) {
- $rulesGroup = arr2[i2 += 1];
- if ($shouldUseGroup($rulesGroup)) {
- if ($rulesGroup.type) {
- out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
- }
- if (it.opts.useDefaults && !it.compositeRule) {
- if ($rulesGroup.type == 'object' && it.schema.properties) {
- var $schema = it.schema.properties,
- $schemaKeys = Object.keys($schema);
- var arr3 = $schemaKeys;
- if (arr3) {
- var $propertyKey, i3 = -1,
- l3 = arr3.length - 1;
- while (i3 < l3) {
- $propertyKey = arr3[i3 += 1];
- var $sch = $schema[$propertyKey];
- if ($sch.default !== undefined) {
- var $passData = $data + it.util.getProperty($propertyKey);
- out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = ';
- if (it.opts.useDefaults == 'shared') {
- out += ' ' + (it.useDefault($sch.default)) + ' ';
- } else {
- out += ' ' + (JSON.stringify($sch.default)) + ' ';
- }
- out += '; ';
- }
- }
- }
- } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) {
- var arr4 = it.schema.items;
- if (arr4) {
- var $sch, $i = -1,
- l4 = arr4.length - 1;
- while ($i < l4) {
- $sch = arr4[$i += 1];
- if ($sch.default !== undefined) {
- var $passData = $data + '[' + $i + ']';
- out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = ';
- if (it.opts.useDefaults == 'shared') {
- out += ' ' + (it.useDefault($sch.default)) + ' ';
- } else {
- out += ' ' + (JSON.stringify($sch.default)) + ' ';
- }
- out += '; ';
- }
- }
- }
- }
- }
- var arr5 = $rulesGroup.rules;
- if (arr5) {
- var $rule, i5 = -1,
- l5 = arr5.length - 1;
- while (i5 < l5) {
- $rule = arr5[i5 += 1];
- if ($shouldUseRule($rule)) {
- out += ' ' + ($rule.code(it, $rule.keyword)) + ' ';
- if ($breakOnError) {
- $closingBraces1 += '}';
- }
- }
- }
- }
- if ($breakOnError) {
- out += ' ' + ($closingBraces1) + ' ';
- $closingBraces1 = '';
- }
- if ($rulesGroup.type) {
- out += ' } ';
- if ($typeSchema && $typeSchema === $rulesGroup.type) {
- var $typeChecked = true;
- out += ' else { ';
- var $schemaPath = it.schemaPath + '.type',
- $errSchemaPath = it.errSchemaPath + '/type';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
- if ($typeIsArray) {
- out += '' + ($typeSchema.join(","));
- } else {
- out += '' + ($typeSchema);
- }
- out += '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should be ';
- if ($typeIsArray) {
- out += '' + ($typeSchema.join(","));
- } else {
- out += '' + ($typeSchema);
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' } ';
- }
- }
- if ($breakOnError) {
- out += ' if (errors === ';
- if ($top) {
- out += '0';
- } else {
- out += 'errs_' + ($lvl);
- }
- out += ') { ';
- $closingBraces2 += '}';
- }
- }
- }
- }
- }
- if ($typeSchema && !$typeChecked && !(it.opts.coerceTypes && $coerceToTypes)) {
- var $schemaPath = it.schemaPath + '.type',
- $errSchemaPath = it.errSchemaPath + '/type',
- $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
- out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
- var $$outStack = $$outStack || [];
- $$outStack.push(out);
- out = ''; /* istanbul ignore else */
- if (it.createErrors !== false) {
- out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
- if ($typeIsArray) {
- out += '' + ($typeSchema.join(","));
- } else {
- out += '' + ($typeSchema);
- }
- out += '\' } ';
- if (it.opts.messages !== false) {
- out += ' , message: \'should be ';
- if ($typeIsArray) {
- out += '' + ($typeSchema.join(","));
- } else {
- out += '' + ($typeSchema);
- }
- out += '\' ';
- }
- if (it.opts.verbose) {
- out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
- }
- out += ' } ';
- } else {
- out += ' {} ';
- }
- var __err = out;
- out = $$outStack.pop();
- if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
- if (it.async) {
- out += ' throw new ValidationError([' + (__err) + ']); ';
- } else {
- out += ' validate.errors = [' + (__err) + ']; return false; ';
- }
- } else {
- out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
- }
- out += ' }';
- }
- if ($breakOnError) {
- out += ' ' + ($closingBraces2) + ' ';
- }
- if ($top) {
- if ($async) {
- out += ' if (errors === 0) return true; ';
- out += ' else throw new ValidationError(vErrors); ';
- } else {
- out += ' validate.errors = vErrors; ';
- out += ' return errors === 0; ';
- }
- out += ' }); return validate;';
- } else {
- out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
- }
- out = it.util.cleanUpCode(out);
- if ($top && $breakOnError) {
- out = it.util.cleanUpVarErrors(out, $async);
- }
-
- function $shouldUseGroup($rulesGroup) {
- for (var i = 0; i < $rulesGroup.rules.length; i++)
- if ($shouldUseRule($rulesGroup.rules[i])) return true;
- }
-
- function $shouldUseRule($rule) {
- return it.schema[$rule.keyword] !== undefined || ($rule.keyword == 'properties' && (it.schema.additionalProperties === false || typeof it.schema.additionalProperties == 'object' || (it.schema.patternProperties && Object.keys(it.schema.patternProperties).length) || (it.opts.v5 && it.schema.patternGroups && Object.keys(it.schema.patternGroups).length)));
- }
- return out;
-}
-
-},{}],37:[function(require,module,exports){
-'use strict';
-
-var IDENTIFIER = /^[a-z_$][a-z0-9_$\-]*$/i;
-var customRuleCode = require('./dotjs/custom');
-
-module.exports = {
- add: addKeyword,
- get: getKeyword,
- remove: removeKeyword
-};
-
-/**
- * Define custom keyword
- * @this Ajv
- * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).
- * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
- */
-function addKeyword(keyword, definition) {
- /* jshint validthis: true */
- /* eslint no-shadow: 0 */
- var RULES = this.RULES;
-
- if (RULES.keywords[keyword])
- throw new Error('Keyword ' + keyword + ' is already defined');
-
- if (!IDENTIFIER.test(keyword))
- throw new Error('Keyword ' + keyword + ' is not a valid identifier');
-
- if (definition) {
- if (definition.macro && definition.valid !== undefined)
- throw new Error('"valid" option cannot be used with macro keywords');
-
- var dataType = definition.type;
- if (Array.isArray(dataType)) {
- var i, len = dataType.length;
- for (i=0; i= 0x80 (not a basic code point)',
- 'invalid-input': 'Invalid input'
- },
-
- /** Convenience shortcuts */
- baseMinusTMin = base - tMin,
- floor = Math.floor,
- stringFromCharCode = String.fromCharCode,
-
- /** Temporary variable */
- key;
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * A generic error utility function.
- * @private
- * @param {String} type The error type.
- * @returns {Error} Throws a `RangeError` with the applicable error message.
- */
- function error(type) {
- throw new RangeError(errors[type]);
- }
-
- /**
- * A generic `Array#map` utility function.
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} callback The function that gets called for every array
- * item.
- * @returns {Array} A new array of values returned by the callback function.
- */
- function map(array, fn) {
- var length = array.length;
- var result = [];
- while (length--) {
- result[length] = fn(array[length]);
- }
- return result;
- }
-
- /**
- * A simple `Array#map`-like wrapper to work with domain name strings or email
- * addresses.
- * @private
- * @param {String} domain The domain name or email address.
- * @param {Function} callback The function that gets called for every
- * character.
- * @returns {Array} A new string of characters returned by the callback
- * function.
- */
- function mapDomain(string, fn) {
- var parts = string.split('@');
- var result = '';
- if (parts.length > 1) {
- // In email addresses, only the domain name should be punycoded. Leave
- // the local part (i.e. everything up to `@`) intact.
- result = parts[0] + '@';
- string = parts[1];
- }
- // Avoid `split(regex)` for IE8 compatibility. See #17.
- string = string.replace(regexSeparators, '\x2E');
- var labels = string.split('.');
- var encoded = map(labels, fn).join('.');
- return result + encoded;
- }
-
- /**
- * Creates an array containing the numeric code points of each Unicode
- * character in the string. While JavaScript uses UCS-2 internally,
- * this function will convert a pair of surrogate halves (each of which
- * UCS-2 exposes as separate characters) into a single code point,
- * matching UTF-16.
- * @see `punycode.ucs2.encode`
- * @see
- * @memberOf punycode.ucs2
- * @name decode
- * @param {String} string The Unicode input string (UCS-2).
- * @returns {Array} The new array of code points.
- */
- function ucs2decode(string) {
- var output = [],
- counter = 0,
- length = string.length,
- value,
- extra;
- while (counter < length) {
- value = string.charCodeAt(counter++);
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
- // high surrogate, and there is a next character
- extra = string.charCodeAt(counter++);
- if ((extra & 0xFC00) == 0xDC00) { // low surrogate
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
- } else {
- // unmatched surrogate; only append this code unit, in case the next
- // code unit is the high surrogate of a surrogate pair
- output.push(value);
- counter--;
- }
- } else {
- output.push(value);
- }
- }
- return output;
- }
-
- /**
- * Creates a string based on an array of numeric code points.
- * @see `punycode.ucs2.decode`
- * @memberOf punycode.ucs2
- * @name encode
- * @param {Array} codePoints The array of numeric code points.
- * @returns {String} The new Unicode string (UCS-2).
- */
- function ucs2encode(array) {
- return map(array, function(value) {
- var output = '';
- if (value > 0xFFFF) {
- value -= 0x10000;
- output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
- value = 0xDC00 | value & 0x3FF;
- }
- output += stringFromCharCode(value);
- return output;
- }).join('');
- }
-
- /**
- * Converts a basic code point into a digit/integer.
- * @see `digitToBasic()`
- * @private
- * @param {Number} codePoint The basic numeric code point value.
- * @returns {Number} The numeric value of a basic code point (for use in
- * representing integers) in the range `0` to `base - 1`, or `base` if
- * the code point does not represent a value.
- */
- function basicToDigit(codePoint) {
- if (codePoint - 48 < 10) {
- return codePoint - 22;
- }
- if (codePoint - 65 < 26) {
- return codePoint - 65;
- }
- if (codePoint - 97 < 26) {
- return codePoint - 97;
- }
- return base;
- }
-
- /**
- * Converts a digit/integer into a basic code point.
- * @see `basicToDigit()`
- * @private
- * @param {Number} digit The numeric value of a basic code point.
- * @returns {Number} The basic code point whose value (when used for
- * representing integers) is `digit`, which needs to be in the range
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
- * used; else, the lowercase form is used. The behavior is undefined
- * if `flag` is non-zero and `digit` has no uppercase form.
- */
- function digitToBasic(digit, flag) {
- // 0..25 map to ASCII a..z or A..Z
- // 26..35 map to ASCII 0..9
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
- }
-
- /**
- * Bias adaptation function as per section 3.4 of RFC 3492.
- * https://tools.ietf.org/html/rfc3492#section-3.4
- * @private
- */
- function adapt(delta, numPoints, firstTime) {
- var k = 0;
- delta = firstTime ? floor(delta / damp) : delta >> 1;
- delta += floor(delta / numPoints);
- for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
- delta = floor(delta / baseMinusTMin);
- }
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
- }
-
- /**
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
- * symbols.
- * @memberOf punycode
- * @param {String} input The Punycode string of ASCII-only symbols.
- * @returns {String} The resulting string of Unicode symbols.
- */
- function decode(input) {
- // Don't use UCS-2
- var output = [],
- inputLength = input.length,
- out,
- i = 0,
- n = initialN,
- bias = initialBias,
- basic,
- j,
- index,
- oldi,
- w,
- k,
- digit,
- t,
- /** Cached calculation results */
- baseMinusT;
-
- // Handle the basic code points: let `basic` be the number of input code
- // points before the last delimiter, or `0` if there is none, then copy
- // the first basic code points to the output.
-
- basic = input.lastIndexOf(delimiter);
- if (basic < 0) {
- basic = 0;
- }
-
- for (j = 0; j < basic; ++j) {
- // if it's not a basic code point
- if (input.charCodeAt(j) >= 0x80) {
- error('not-basic');
- }
- output.push(input.charCodeAt(j));
- }
-
- // Main decoding loop: start just after the last delimiter if any basic code
- // points were copied; start at the beginning otherwise.
-
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
-
- // `index` is the index of the next character to be consumed.
- // Decode a generalized variable-length integer into `delta`,
- // which gets added to `i`. The overflow checking is easier
- // if we increase `i` as we go, then subtract off its starting
- // value at the end to obtain `delta`.
- for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
-
- if (index >= inputLength) {
- error('invalid-input');
- }
-
- digit = basicToDigit(input.charCodeAt(index++));
-
- if (digit >= base || digit > floor((maxInt - i) / w)) {
- error('overflow');
- }
-
- i += digit * w;
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
-
- if (digit < t) {
- break;
- }
-
- baseMinusT = base - t;
- if (w > floor(maxInt / baseMinusT)) {
- error('overflow');
- }
-
- w *= baseMinusT;
-
- }
-
- out = output.length + 1;
- bias = adapt(i - oldi, out, oldi == 0);
-
- // `i` was supposed to wrap around from `out` to `0`,
- // incrementing `n` each time, so we'll fix that now:
- if (floor(i / out) > maxInt - n) {
- error('overflow');
- }
-
- n += floor(i / out);
- i %= out;
-
- // Insert `n` at position `i` of the output
- output.splice(i++, 0, n);
-
- }
-
- return ucs2encode(output);
- }
-
- /**
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
- * Punycode string of ASCII-only symbols.
- * @memberOf punycode
- * @param {String} input The string of Unicode symbols.
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
- */
- function encode(input) {
- var n,
- delta,
- handledCPCount,
- basicLength,
- bias,
- j,
- m,
- q,
- k,
- t,
- currentValue,
- output = [],
- /** `inputLength` will hold the number of code points in `input`. */
- inputLength,
- /** Cached calculation results */
- handledCPCountPlusOne,
- baseMinusT,
- qMinusT;
-
- // Convert the input in UCS-2 to Unicode
- input = ucs2decode(input);
-
- // Cache the length
- inputLength = input.length;
-
- // Initialize the state
- n = initialN;
- delta = 0;
- bias = initialBias;
-
- // Handle the basic code points
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue < 0x80) {
- output.push(stringFromCharCode(currentValue));
- }
- }
-
- handledCPCount = basicLength = output.length;
-
- // `handledCPCount` is the number of code points that have been handled;
- // `basicLength` is the number of basic code points.
-
- // Finish the basic string - if it is not empty - with a delimiter
- if (basicLength) {
- output.push(delimiter);
- }
-
- // Main encoding loop:
- while (handledCPCount < inputLength) {
-
- // All non-basic code points < n have been handled already. Find the next
- // larger one:
- for (m = maxInt, j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue >= n && currentValue < m) {
- m = currentValue;
- }
- }
-
- // Increase `delta` enough to advance the decoder's state to ,
- // but guard against overflow
- handledCPCountPlusOne = handledCPCount + 1;
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
- error('overflow');
- }
-
- delta += (m - n) * handledCPCountPlusOne;
- n = m;
-
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
-
- if (currentValue < n && ++delta > maxInt) {
- error('overflow');
- }
-
- if (currentValue == n) {
- // Represent delta as a generalized variable-length integer
- for (q = delta, k = base; /* no condition */; k += base) {
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
- if (q < t) {
- break;
- }
- qMinusT = q - t;
- baseMinusT = base - t;
- output.push(
- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
- );
- q = floor(qMinusT / baseMinusT);
- }
-
- output.push(stringFromCharCode(digitToBasic(q, 0)));
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
- delta = 0;
- ++handledCPCount;
- }
- }
-
- ++delta;
- ++n;
-
- }
- return output.join('');
- }
-
- /**
- * Converts a Punycode string representing a domain name or an email address
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
- * it doesn't matter if you call it on a string that has already been
- * converted to Unicode.
- * @memberOf punycode
- * @param {String} input The Punycoded domain name or email address to
- * convert to Unicode.
- * @returns {String} The Unicode representation of the given Punycode
- * string.
- */
- function toUnicode(input) {
- return mapDomain(input, function(string) {
- return regexPunycode.test(string)
- ? decode(string.slice(4).toLowerCase())
- : string;
- });
- }
-
- /**
- * Converts a Unicode string representing a domain name or an email address to
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
- * i.e. it doesn't matter if you call it with a domain that's already in
- * ASCII.
- * @memberOf punycode
- * @param {String} input The domain name or email address to convert, as a
- * Unicode string.
- * @returns {String} The Punycode representation of the given domain name or
- * email address.
- */
- function toASCII(input) {
- return mapDomain(input, function(string) {
- return regexNonASCII.test(string)
- ? 'xn--' + encode(string)
- : string;
- });
- }
-
- /*--------------------------------------------------------------------------*/
-
- /** Define the public API */
- punycode = {
- /**
- * A string representing the current Punycode.js version number.
- * @memberOf punycode
- * @type String
- */
- 'version': '1.4.1',
- /**
- * An object of methods to convert from JavaScript's internal character
- * representation (UCS-2) to Unicode code points, and back.
- * @see
- * @memberOf punycode
- * @type Object
- */
- 'ucs2': {
- 'decode': ucs2decode,
- 'encode': ucs2encode
- },
- 'decode': decode,
- 'encode': encode,
- 'toASCII': toASCII,
- 'toUnicode': toUnicode
- };
-
- /** Expose `punycode` */
- // Some AMD build optimizers, like r.js, check for specific condition patterns
- // like the following:
- if (
- typeof define == 'function' &&
- typeof define.amd == 'object' &&
- define.amd
- ) {
- define('punycode', function() {
- return punycode;
- });
- } else if (freeExports && freeModule) {
- if (module.exports == freeExports) {
- // in Node.js, io.js, or RingoJS v0.8.0+
- freeModule.exports = punycode;
- } else {
- // in Narwhal or RingoJS v0.7.0-
- for (key in punycode) {
- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
- }
- }
- } else {
- // in Rhino or a web browser
- root.punycode = punycode;
- }
-
-}(this));
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],42:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node 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.
-
-'use strict';
-
-// If obj.hasOwnProperty has been overridden, then calling
-// obj.hasOwnProperty(prop) will break.
-// See: https://github.com/joyent/node/issues/1707
-function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
-}
-
-module.exports = function(qs, sep, eq, options) {
- sep = sep || '&';
- eq = eq || '=';
- var obj = {};
-
- if (typeof qs !== 'string' || qs.length === 0) {
- return obj;
- }
-
- var regexp = /\+/g;
- qs = qs.split(sep);
-
- var maxKeys = 1000;
- if (options && typeof options.maxKeys === 'number') {
- maxKeys = options.maxKeys;
- }
-
- var len = qs.length;
- // maxKeys <= 0 means that we should not limit keys count
- if (maxKeys > 0 && len > maxKeys) {
- len = maxKeys;
- }
-
- for (var i = 0; i < len; ++i) {
- var x = qs[i].replace(regexp, '%20'),
- idx = x.indexOf(eq),
- kstr, vstr, k, v;
-
- if (idx >= 0) {
- kstr = x.substr(0, idx);
- vstr = x.substr(idx + 1);
- } else {
- kstr = x;
- vstr = '';
- }
-
- k = decodeURIComponent(kstr);
- v = decodeURIComponent(vstr);
-
- if (!hasOwnProperty(obj, k)) {
- obj[k] = v;
- } else if (isArray(obj[k])) {
- obj[k].push(v);
- } else {
- obj[k] = [obj[k], v];
- }
- }
-
- return obj;
-};
-
-var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
-};
-
-},{}],43:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node 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.
-
-'use strict';
-
-var stringifyPrimitive = function(v) {
- switch (typeof v) {
- case 'string':
- return v;
-
- case 'boolean':
- return v ? 'true' : 'false';
-
- case 'number':
- return isFinite(v) ? v : '';
-
- default:
- return '';
- }
-};
-
-module.exports = function(obj, sep, eq, name) {
- sep = sep || '&';
- eq = eq || '=';
- if (obj === null) {
- obj = undefined;
- }
-
- if (typeof obj === 'object') {
- return map(objectKeys(obj), function(k) {
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
- if (isArray(obj[k])) {
- return map(obj[k], function(v) {
- return ks + encodeURIComponent(stringifyPrimitive(v));
- }).join(sep);
- } else {
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
- }
- }).join(sep);
-
- }
-
- if (!name) return '';
- return encodeURIComponent(stringifyPrimitive(name)) + eq +
- encodeURIComponent(stringifyPrimitive(obj));
-};
-
-var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
-};
-
-function map (xs, f) {
- if (xs.map) return xs.map(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- res.push(f(xs[i], i));
- }
- return res;
-}
-
-var objectKeys = Object.keys || function (obj) {
- var res = [];
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
- }
- return res;
-};
-
-},{}],44:[function(require,module,exports){
-'use strict';
-
-exports.decode = exports.parse = require('./decode');
-exports.encode = exports.stringify = require('./encode');
-
-},{"./decode":42,"./encode":43}],45:[function(require,module,exports){
-// Copyright Joyent, Inc. and other Node 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.
-
-'use strict';
-
-var punycode = require('punycode');
-var util = require('./util');
-
-exports.parse = urlParse;
-exports.resolve = urlResolve;
-exports.resolveObject = urlResolveObject;
-exports.format = urlFormat;
-
-exports.Url = Url;
-
-function Url() {
- this.protocol = null;
- this.slashes = null;
- this.auth = null;
- this.host = null;
- this.port = null;
- this.hostname = null;
- this.hash = null;
- this.search = null;
- this.query = null;
- this.pathname = null;
- this.path = null;
- this.href = null;
-}
-
-// Reference: RFC 3986, RFC 1808, RFC 2396
-
-// define these here so at least they only have to be
-// compiled once on the first module load.
-var protocolPattern = /^([a-z0-9.+-]+:)/i,
- portPattern = /:[0-9]*$/,
-
- // Special case for a simple path URL
- simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
-
- // RFC 2396: characters reserved for delimiting URLs.
- // We actually just auto-escape these.
- delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
-
- // RFC 2396: characters not allowed for various reasons.
- unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
-
- // Allowed by RFCs, but cause of XSS attacks. Always escape these.
- autoEscape = ['\''].concat(unwise),
- // Characters that are never ever allowed in a hostname.
- // Note that any invalid chars are also handled, but these
- // are the ones that are *expected* to be seen, so we fast-path
- // them.
- nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
- hostEndingChars = ['/', '?', '#'],
- hostnameMaxLen = 255,
- hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
- hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
- // protocols that can allow "unsafe" and "unwise" chars.
- unsafeProtocol = {
- 'javascript': true,
- 'javascript:': true
- },
- // protocols that never have a hostname.
- hostlessProtocol = {
- 'javascript': true,
- 'javascript:': true
- },
- // protocols that always contain a // bit.
- slashedProtocol = {
- 'http': true,
- 'https': true,
- 'ftp': true,
- 'gopher': true,
- 'file': true,
- 'http:': true,
- 'https:': true,
- 'ftp:': true,
- 'gopher:': true,
- 'file:': true
- },
- querystring = require('querystring');
-
-function urlParse(url, parseQueryString, slashesDenoteHost) {
- if (url && util.isObject(url) && url instanceof Url) return url;
-
- var u = new Url;
- u.parse(url, parseQueryString, slashesDenoteHost);
- return u;
-}
-
-Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
- if (!util.isString(url)) {
- throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
- }
-
- // Copy chrome, IE, opera backslash-handling behavior.
- // Back slashes before the query string get converted to forward slashes
- // See: https://code.google.com/p/chromium/issues/detail?id=25916
- var queryIndex = url.indexOf('?'),
- splitter =
- (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
- uSplit = url.split(splitter),
- slashRegex = /\\/g;
- uSplit[0] = uSplit[0].replace(slashRegex, '/');
- url = uSplit.join(splitter);
-
- var rest = url;
-
- // trim before proceeding.
- // This is to support parse stuff like " http://foo.com \n"
- rest = rest.trim();
-
- if (!slashesDenoteHost && url.split('#').length === 1) {
- // Try fast path regexp
- var simplePath = simplePathPattern.exec(rest);
- if (simplePath) {
- this.path = rest;
- this.href = rest;
- this.pathname = simplePath[1];
- if (simplePath[2]) {
- this.search = simplePath[2];
- if (parseQueryString) {
- this.query = querystring.parse(this.search.substr(1));
- } else {
- this.query = this.search.substr(1);
- }
- } else if (parseQueryString) {
- this.search = '';
- this.query = {};
- }
- return this;
- }
- }
-
- var proto = protocolPattern.exec(rest);
- if (proto) {
- proto = proto[0];
- var lowerProto = proto.toLowerCase();
- this.protocol = lowerProto;
- rest = rest.substr(proto.length);
- }
-
- // figure out if it's got a host
- // user@server is *always* interpreted as a hostname, and url
- // resolution will treat //foo/bar as host=foo,path=bar because that's
- // how the browser resolves relative URLs.
- if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
- var slashes = rest.substr(0, 2) === '//';
- if (slashes && !(proto && hostlessProtocol[proto])) {
- rest = rest.substr(2);
- this.slashes = true;
- }
- }
-
- if (!hostlessProtocol[proto] &&
- (slashes || (proto && !slashedProtocol[proto]))) {
-
- // there's a hostname.
- // the first instance of /, ?, ;, or # ends the host.
- //
- // If there is an @ in the hostname, then non-host chars *are* allowed
- // to the left of the last @ sign, unless some host-ending character
- // comes *before* the @-sign.
- // URLs are obnoxious.
- //
- // ex:
- // http://a@b@c/ => user:a@b host:c
- // http://a@b?@c => user:a host:c path:/?@c
-
- // v0.12 TODO(isaacs): This is not quite how Chrome does things.
- // Review our test case against browsers more comprehensively.
-
- // find the first instance of any hostEndingChars
- var hostEnd = -1;
- for (var i = 0; i < hostEndingChars.length; i++) {
- var hec = rest.indexOf(hostEndingChars[i]);
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
- hostEnd = hec;
- }
-
- // at this point, either we have an explicit point where the
- // auth portion cannot go past, or the last @ char is the decider.
- var auth, atSign;
- if (hostEnd === -1) {
- // atSign can be anywhere.
- atSign = rest.lastIndexOf('@');
- } else {
- // atSign must be in auth portion.
- // http://a@b/c@d => host:b auth:a path:/c@d
- atSign = rest.lastIndexOf('@', hostEnd);
- }
-
- // Now we have a portion which is definitely the auth.
- // Pull that off.
- if (atSign !== -1) {
- auth = rest.slice(0, atSign);
- rest = rest.slice(atSign + 1);
- this.auth = decodeURIComponent(auth);
- }
-
- // the host is the remaining to the left of the first non-host char
- hostEnd = -1;
- for (var i = 0; i < nonHostChars.length; i++) {
- var hec = rest.indexOf(nonHostChars[i]);
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
- hostEnd = hec;
- }
- // if we still have not hit it, then the entire thing is a host.
- if (hostEnd === -1)
- hostEnd = rest.length;
-
- this.host = rest.slice(0, hostEnd);
- rest = rest.slice(hostEnd);
-
- // pull out port.
- this.parseHost();
-
- // we've indicated that there is a hostname,
- // so even if it's empty, it has to be present.
- this.hostname = this.hostname || '';
-
- // if hostname begins with [ and ends with ]
- // assume that it's an IPv6 address.
- var ipv6Hostname = this.hostname[0] === '[' &&
- this.hostname[this.hostname.length - 1] === ']';
-
- // validate a little.
- if (!ipv6Hostname) {
- var hostparts = this.hostname.split(/\./);
- for (var i = 0, l = hostparts.length; i < l; i++) {
- var part = hostparts[i];
- if (!part) continue;
- if (!part.match(hostnamePartPattern)) {
- var newpart = '';
- for (var j = 0, k = part.length; j < k; j++) {
- if (part.charCodeAt(j) > 127) {
- // we replace non-ASCII char with a temporary placeholder
- // we need this to make sure size of hostname is not
- // broken by replacing non-ASCII by nothing
- newpart += 'x';
- } else {
- newpart += part[j];
- }
- }
- // we test again with ASCII char only
- if (!newpart.match(hostnamePartPattern)) {
- var validParts = hostparts.slice(0, i);
- var notHost = hostparts.slice(i + 1);
- var bit = part.match(hostnamePartStart);
- if (bit) {
- validParts.push(bit[1]);
- notHost.unshift(bit[2]);
- }
- if (notHost.length) {
- rest = '/' + notHost.join('.') + rest;
- }
- this.hostname = validParts.join('.');
- break;
- }
- }
- }
- }
-
- if (this.hostname.length > hostnameMaxLen) {
- this.hostname = '';
- } else {
- // hostnames are always lower case.
- this.hostname = this.hostname.toLowerCase();
- }
-
- if (!ipv6Hostname) {
- // IDNA Support: Returns a punycoded representation of "domain".
- // It only converts parts of the domain name that
- // have non-ASCII characters, i.e. it doesn't matter if
- // you call it with a domain that already is ASCII-only.
- this.hostname = punycode.toASCII(this.hostname);
- }
-
- var p = this.port ? ':' + this.port : '';
- var h = this.hostname || '';
- this.host = h + p;
- this.href += this.host;
-
- // strip [ and ] from the hostname
- // the host field still retains them, though
- if (ipv6Hostname) {
- this.hostname = this.hostname.substr(1, this.hostname.length - 2);
- if (rest[0] !== '/') {
- rest = '/' + rest;
- }
- }
- }
-
- // now rest is set to the post-host stuff.
- // chop off any delim chars.
- if (!unsafeProtocol[lowerProto]) {
-
- // First, make 100% sure that any "autoEscape" chars get
- // escaped, even if encodeURIComponent doesn't think they
- // need to be.
- for (var i = 0, l = autoEscape.length; i < l; i++) {
- var ae = autoEscape[i];
- if (rest.indexOf(ae) === -1)
- continue;
- var esc = encodeURIComponent(ae);
- if (esc === ae) {
- esc = escape(ae);
- }
- rest = rest.split(ae).join(esc);
- }
- }
-
-
- // chop off from the tail first.
- var hash = rest.indexOf('#');
- if (hash !== -1) {
- // got a fragment string.
- this.hash = rest.substr(hash);
- rest = rest.slice(0, hash);
- }
- var qm = rest.indexOf('?');
- if (qm !== -1) {
- this.search = rest.substr(qm);
- this.query = rest.substr(qm + 1);
- if (parseQueryString) {
- this.query = querystring.parse(this.query);
- }
- rest = rest.slice(0, qm);
- } else if (parseQueryString) {
- // no query string, but parseQueryString still requested
- this.search = '';
- this.query = {};
- }
- if (rest) this.pathname = rest;
- if (slashedProtocol[lowerProto] &&
- this.hostname && !this.pathname) {
- this.pathname = '/';
- }
-
- //to support http.request
- if (this.pathname || this.search) {
- var p = this.pathname || '';
- var s = this.search || '';
- this.path = p + s;
- }
-
- // finally, reconstruct the href based on what has been validated.
- this.href = this.format();
- return this;
-};
-
-// format a parsed object into a url string
-function urlFormat(obj) {
- // ensure it's an object, and not a string url.
- // If it's an obj, this is a no-op.
- // this way, you can call url_format() on strings
- // to clean up potentially wonky urls.
- if (util.isString(obj)) obj = urlParse(obj);
- if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
- return obj.format();
-}
-
-Url.prototype.format = function() {
- var auth = this.auth || '';
- if (auth) {
- auth = encodeURIComponent(auth);
- auth = auth.replace(/%3A/i, ':');
- auth += '@';
- }
-
- var protocol = this.protocol || '',
- pathname = this.pathname || '',
- hash = this.hash || '',
- host = false,
- query = '';
-
- if (this.host) {
- host = auth + this.host;
- } else if (this.hostname) {
- host = auth + (this.hostname.indexOf(':') === -1 ?
- this.hostname :
- '[' + this.hostname + ']');
- if (this.port) {
- host += ':' + this.port;
- }
- }
-
- if (this.query &&
- util.isObject(this.query) &&
- Object.keys(this.query).length) {
- query = querystring.stringify(this.query);
- }
-
- var search = this.search || (query && ('?' + query)) || '';
-
- if (protocol && protocol.substr(-1) !== ':') protocol += ':';
-
- // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
- // unless they had them to begin with.
- if (this.slashes ||
- (!protocol || slashedProtocol[protocol]) && host !== false) {
- host = '//' + (host || '');
- if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
- } else if (!host) {
- host = '';
- }
-
- if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
- if (search && search.charAt(0) !== '?') search = '?' + search;
-
- pathname = pathname.replace(/[?#]/g, function(match) {
- return encodeURIComponent(match);
- });
- search = search.replace('#', '%23');
-
- return protocol + host + pathname + search + hash;
-};
-
-function urlResolve(source, relative) {
- return urlParse(source, false, true).resolve(relative);
-}
-
-Url.prototype.resolve = function(relative) {
- return this.resolveObject(urlParse(relative, false, true)).format();
-};
-
-function urlResolveObject(source, relative) {
- if (!source) return relative;
- return urlParse(source, false, true).resolveObject(relative);
-}
-
-Url.prototype.resolveObject = function(relative) {
- if (util.isString(relative)) {
- var rel = new Url();
- rel.parse(relative, false, true);
- relative = rel;
- }
-
- var result = new Url();
- var tkeys = Object.keys(this);
- for (var tk = 0; tk < tkeys.length; tk++) {
- var tkey = tkeys[tk];
- result[tkey] = this[tkey];
- }
-
- // hash is always overridden, no matter what.
- // even href="" will remove it.
- result.hash = relative.hash;
-
- // if the relative url is empty, then there's nothing left to do here.
- if (relative.href === '') {
- result.href = result.format();
- return result;
- }
-
- // hrefs like //foo/bar always cut to the protocol.
- if (relative.slashes && !relative.protocol) {
- // take everything except the protocol from relative
- var rkeys = Object.keys(relative);
- for (var rk = 0; rk < rkeys.length; rk++) {
- var rkey = rkeys[rk];
- if (rkey !== 'protocol')
- result[rkey] = relative[rkey];
- }
-
- //urlParse appends trailing / to urls like http://www.example.com
- if (slashedProtocol[result.protocol] &&
- result.hostname && !result.pathname) {
- result.path = result.pathname = '/';
- }
-
- result.href = result.format();
- return result;
- }
-
- if (relative.protocol && relative.protocol !== result.protocol) {
- // if it's a known url protocol, then changing
- // the protocol does weird things
- // first, if it's not file:, then we MUST have a host,
- // and if there was a path
- // to begin with, then we MUST have a path.
- // if it is file:, then the host is dropped,
- // because that's known to be hostless.
- // anything else is assumed to be absolute.
- if (!slashedProtocol[relative.protocol]) {
- var keys = Object.keys(relative);
- for (var v = 0; v < keys.length; v++) {
- var k = keys[v];
- result[k] = relative[k];
- }
- result.href = result.format();
- return result;
- }
-
- result.protocol = relative.protocol;
- if (!relative.host && !hostlessProtocol[relative.protocol]) {
- var relPath = (relative.pathname || '').split('/');
- while (relPath.length && !(relative.host = relPath.shift()));
- if (!relative.host) relative.host = '';
- if (!relative.hostname) relative.hostname = '';
- if (relPath[0] !== '') relPath.unshift('');
- if (relPath.length < 2) relPath.unshift('');
- result.pathname = relPath.join('/');
- } else {
- result.pathname = relative.pathname;
- }
- result.search = relative.search;
- result.query = relative.query;
- result.host = relative.host || '';
- result.auth = relative.auth;
- result.hostname = relative.hostname || relative.host;
- result.port = relative.port;
- // to support http.request
- if (result.pathname || result.search) {
- var p = result.pathname || '';
- var s = result.search || '';
- result.path = p + s;
- }
- result.slashes = result.slashes || relative.slashes;
- result.href = result.format();
- return result;
- }
-
- var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
- isRelAbs = (
- relative.host ||
- relative.pathname && relative.pathname.charAt(0) === '/'
- ),
- mustEndAbs = (isRelAbs || isSourceAbs ||
- (result.host && relative.pathname)),
- removeAllDots = mustEndAbs,
- srcPath = result.pathname && result.pathname.split('/') || [],
- relPath = relative.pathname && relative.pathname.split('/') || [],
- psychotic = result.protocol && !slashedProtocol[result.protocol];
-
- // if the url is a non-slashed url, then relative
- // links like ../.. should be able
- // to crawl up to the hostname, as well. This is strange.
- // result.protocol has already been set by now.
- // Later on, put the first path part into the host field.
- if (psychotic) {
- result.hostname = '';
- result.port = null;
- if (result.host) {
- if (srcPath[0] === '') srcPath[0] = result.host;
- else srcPath.unshift(result.host);
- }
- result.host = '';
- if (relative.protocol) {
- relative.hostname = null;
- relative.port = null;
- if (relative.host) {
- if (relPath[0] === '') relPath[0] = relative.host;
- else relPath.unshift(relative.host);
- }
- relative.host = null;
- }
- mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
- }
-
- if (isRelAbs) {
- // it's absolute.
- result.host = (relative.host || relative.host === '') ?
- relative.host : result.host;
- result.hostname = (relative.hostname || relative.hostname === '') ?
- relative.hostname : result.hostname;
- result.search = relative.search;
- result.query = relative.query;
- srcPath = relPath;
- // fall through to the dot-handling below.
- } else if (relPath.length) {
- // it's relative
- // throw away the existing file, and take the new path instead.
- if (!srcPath) srcPath = [];
- srcPath.pop();
- srcPath = srcPath.concat(relPath);
- result.search = relative.search;
- result.query = relative.query;
- } else if (!util.isNullOrUndefined(relative.search)) {
- // just pull out the search.
- // like href='?foo'.
- // Put this after the other two cases because it simplifies the booleans
- if (psychotic) {
- result.hostname = result.host = srcPath.shift();
- //occationaly the auth can get stuck only in host
- //this especially happens in cases like
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
- var authInHost = result.host && result.host.indexOf('@') > 0 ?
- result.host.split('@') : false;
- if (authInHost) {
- result.auth = authInHost.shift();
- result.host = result.hostname = authInHost.shift();
- }
- }
- result.search = relative.search;
- result.query = relative.query;
- //to support http.request
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
- result.path = (result.pathname ? result.pathname : '') +
- (result.search ? result.search : '');
- }
- result.href = result.format();
- return result;
- }
-
- if (!srcPath.length) {
- // no path at all. easy.
- // we've already handled the other stuff above.
- result.pathname = null;
- //to support http.request
- if (result.search) {
- result.path = '/' + result.search;
- } else {
- result.path = null;
- }
- result.href = result.format();
- return result;
- }
-
- // if a url ENDs in . or .., then it must get a trailing slash.
- // however, if it ends in anything else non-slashy,
- // then it must NOT get a trailing slash.
- var last = srcPath.slice(-1)[0];
- var hasTrailingSlash = (
- (result.host || relative.host || srcPath.length > 1) &&
- (last === '.' || last === '..') || last === '');
-
- // strip single dots, resolve double dots to parent dir
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = srcPath.length; i >= 0; i--) {
- last = srcPath[i];
- if (last === '.') {
- srcPath.splice(i, 1);
- } else if (last === '..') {
- srcPath.splice(i, 1);
- up++;
- } else if (up) {
- srcPath.splice(i, 1);
- up--;
- }
- }
-
- // if the path is allowed to go above the root, restore leading ..s
- if (!mustEndAbs && !removeAllDots) {
- for (; up--; up) {
- srcPath.unshift('..');
- }
- }
-
- if (mustEndAbs && srcPath[0] !== '' &&
- (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
- srcPath.unshift('');
- }
-
- if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
- srcPath.push('');
- }
-
- var isAbsolute = srcPath[0] === '' ||
- (srcPath[0] && srcPath[0].charAt(0) === '/');
-
- // put the host back
- if (psychotic) {
- result.hostname = result.host = isAbsolute ? '' :
- srcPath.length ? srcPath.shift() : '';
- //occationaly the auth can get stuck only in host
- //this especially happens in cases like
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
- var authInHost = result.host && result.host.indexOf('@') > 0 ?
- result.host.split('@') : false;
- if (authInHost) {
- result.auth = authInHost.shift();
- result.host = result.hostname = authInHost.shift();
- }
- }
-
- mustEndAbs = mustEndAbs || (result.host && srcPath.length);
-
- if (mustEndAbs && !isAbsolute) {
- srcPath.unshift('');
- }
-
- if (!srcPath.length) {
- result.pathname = null;
- result.path = null;
- } else {
- result.pathname = srcPath.join('/');
- }
-
- //to support request.http
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
- result.path = (result.pathname ? result.pathname : '') +
- (result.search ? result.search : '');
- }
- result.auth = relative.auth || result.auth;
- result.slashes = result.slashes || relative.slashes;
- result.href = result.format();
- return result;
-};
-
-Url.prototype.parseHost = function() {
- var host = this.host;
- var port = portPattern.exec(host);
- if (port) {
- port = port[0];
- if (port !== ':') {
- this.port = port.substr(1);
- }
- host = host.substr(0, host.length - port.length);
- }
- if (host) this.hostname = host;
-};
-
-},{"./util":46,"punycode":41,"querystring":44}],46:[function(require,module,exports){
-'use strict';
-
-module.exports = {
- isString: function(arg) {
- return typeof(arg) === 'string';
- },
- isObject: function(arg) {
- return typeof(arg) === 'object' && arg !== null;
- },
- isNull: function(arg) {
- return arg === null;
- },
- isNullOrUndefined: function(arg) {
- return arg == null;
- }
-};
-
-},{}],47:[function(require,module,exports){
-
-/**
- * slice() reference.
- */
-
-var slice = Array.prototype.slice;
-
-/**
- * Expose `co`.
- */
-
-module.exports = co['default'] = co.co = co;
-
-/**
- * Wrap the given generator `fn` into a
- * function that returns a promise.
- * This is a separate function so that
- * every `co()` call doesn't create a new,
- * unnecessary closure.
- *
- * @param {GeneratorFunction} fn
- * @return {Function}
- * @api public
- */
-
-co.wrap = function (fn) {
- createPromise.__generatorFunction__ = fn;
- return createPromise;
- function createPromise() {
- return co.call(this, fn.apply(this, arguments));
- }
-};
-
-/**
- * Execute the generator function or a generator
- * and return a promise.
- *
- * @param {Function} fn
- * @return {Promise}
- * @api public
- */
-
-function co(gen) {
- var ctx = this;
- var args = slice.call(arguments, 1)
-
- // we wrap everything in a promise to avoid promise chaining,
- // which leads to memory leak errors.
- // see https://github.com/tj/co/issues/180
- return new Promise(function(resolve, reject) {
- if (typeof gen === 'function') gen = gen.apply(ctx, args);
- if (!gen || typeof gen.next !== 'function') return resolve(gen);
-
- onFulfilled();
-
- /**
- * @param {Mixed} res
- * @return {Promise}
- * @api private
- */
-
- function onFulfilled(res) {
- var ret;
- try {
- ret = gen.next(res);
- } catch (e) {
- return reject(e);
- }
- next(ret);
- }
-
- /**
- * @param {Error} err
- * @return {Promise}
- * @api private
- */
-
- function onRejected(err) {
- var ret;
- try {
- ret = gen.throw(err);
- } catch (e) {
- return reject(e);
- }
- next(ret);
- }
-
- /**
- * Get the next value in the generator,
- * return a promise.
- *
- * @param {Object} ret
- * @return {Promise}
- * @api private
- */
-
- function next(ret) {
- if (ret.done) return resolve(ret.value);
- var value = toPromise.call(ctx, ret.value);
- if (value && isPromise(value)) return value.then(onFulfilled, onRejected);
- return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, '
- + 'but the following object was passed: "' + String(ret.value) + '"'));
- }
- });
-}
-
-/**
- * Convert a `yield`ed value into a promise.
- *
- * @param {Mixed} obj
- * @return {Promise}
- * @api private
- */
-
-function toPromise(obj) {
- if (!obj) return obj;
- if (isPromise(obj)) return obj;
- if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj);
- if ('function' == typeof obj) return thunkToPromise.call(this, obj);
- if (Array.isArray(obj)) return arrayToPromise.call(this, obj);
- if (isObject(obj)) return objectToPromise.call(this, obj);
- return obj;
-}
-
-/**
- * Convert a thunk to a promise.
- *
- * @param {Function}
- * @return {Promise}
- * @api private
- */
-
-function thunkToPromise(fn) {
- var ctx = this;
- return new Promise(function (resolve, reject) {
- fn.call(ctx, function (err, res) {
- if (err) return reject(err);
- if (arguments.length > 2) res = slice.call(arguments, 1);
- resolve(res);
- });
- });
-}
-
-/**
- * Convert an array of "yieldables" to a promise.
- * Uses `Promise.all()` internally.
- *
- * @param {Array} obj
- * @return {Promise}
- * @api private
- */
-
-function arrayToPromise(obj) {
- return Promise.all(obj.map(toPromise, this));
-}
-
-/**
- * Convert an object of "yieldables" to a promise.
- * Uses `Promise.all()` internally.
- *
- * @param {Object} obj
- * @return {Promise}
- * @api private
- */
-
-function objectToPromise(obj){
- var results = new obj.constructor();
- var keys = Object.keys(obj);
- var promises = [];
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var promise = toPromise.call(this, obj[key]);
- if (promise && isPromise(promise)) defer(promise, key);
- else results[key] = obj[key];
- }
- return Promise.all(promises).then(function () {
- return results;
- });
-
- function defer(promise, key) {
- // predefine the key in the result
- results[key] = undefined;
- promises.push(promise.then(function (res) {
- results[key] = res;
- }));
- }
-}
-
-/**
- * Check if `obj` is a promise.
- *
- * @param {Object} obj
- * @return {Boolean}
- * @api private
- */
-
-function isPromise(obj) {
- return 'function' == typeof obj.then;
-}
-
-/**
- * Check if `obj` is a generator.
- *
- * @param {Mixed} obj
- * @return {Boolean}
- * @api private
- */
-
-function isGenerator(obj) {
- return 'function' == typeof obj.next && 'function' == typeof obj.throw;
-}
-
-/**
- * Check if `obj` is a generator function.
- *
- * @param {Mixed} obj
- * @return {Boolean}
- * @api private
- */
-function isGeneratorFunction(obj) {
- var constructor = obj.constructor;
- if (!constructor) return false;
- if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true;
- return isGenerator(constructor.prototype);
-}
-
-/**
- * Check for plain object.
- *
- * @param {Mixed} val
- * @return {Boolean}
- * @api private
- */
-
-function isObject(val) {
- return Object == val.constructor;
-}
-
-},{}],48:[function(require,module,exports){
-var json = typeof JSON !== 'undefined' ? JSON : require('jsonify');
-
-module.exports = function (obj, opts) {
- if (!opts) opts = {};
- if (typeof opts === 'function') opts = { cmp: opts };
- var space = opts.space || '';
- if (typeof space === 'number') space = Array(space+1).join(' ');
- var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;
- var replacer = opts.replacer || function(key, value) { return value; };
-
- var cmp = opts.cmp && (function (f) {
- return function (node) {
- return function (a, b) {
- var aobj = { key: a, value: node[a] };
- var bobj = { key: b, value: node[b] };
- return f(aobj, bobj);
- };
- };
- })(opts.cmp);
-
- var seen = [];
- return (function stringify (parent, key, node, level) {
- var indent = space ? ('\n' + new Array(level + 1).join(space)) : '';
- var colonSeparator = space ? ': ' : ':';
-
- if (node && node.toJSON && typeof node.toJSON === 'function') {
- node = node.toJSON();
- }
-
- node = replacer.call(parent, key, node);
-
- if (node === undefined) {
- return;
- }
- if (typeof node !== 'object' || node === null) {
- return json.stringify(node);
- }
- if (isArray(node)) {
- var out = [];
- for (var i = 0; i < node.length; i++) {
- var item = stringify(node, i, node[i], level+1) || json.stringify(null);
- out.push(indent + space + item);
- }
- return '[' + out.join(',') + indent + ']';
- }
- else {
- if (seen.indexOf(node) !== -1) {
- if (cycles) return json.stringify('__cycle__');
- throw new TypeError('Converting circular structure to JSON');
- }
- else seen.push(node);
-
- var keys = objectKeys(node).sort(cmp && cmp(node));
- var out = [];
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var value = stringify(node, key, node[key], level+1);
-
- if(!value) continue;
-
- var keyValue = json.stringify(key)
- + colonSeparator
- + value;
- ;
- out.push(indent + space + keyValue);
- }
- seen.splice(seen.indexOf(node), 1);
- return '{' + out.join(',') + indent + '}';
- }
- })({ '': obj }, '', obj, 0);
-};
-
-var isArray = Array.isArray || function (x) {
- return {}.toString.call(x) === '[object Array]';
-};
-
-var objectKeys = Object.keys || function (obj) {
- var has = Object.prototype.hasOwnProperty || function () { return true };
- var keys = [];
- for (var key in obj) {
- if (has.call(obj, key)) keys.push(key);
- }
- return keys;
-};
-
-},{"jsonify":49}],49:[function(require,module,exports){
-exports.parse = require('./lib/parse');
-exports.stringify = require('./lib/stringify');
-
-},{"./lib/parse":50,"./lib/stringify":51}],50:[function(require,module,exports){
-var at, // The index of the current character
- ch, // The current character
- escapee = {
- '"': '"',
- '\\': '\\',
- '/': '/',
- b: '\b',
- f: '\f',
- n: '\n',
- r: '\r',
- t: '\t'
- },
- text,
-
- error = function (m) {
- // Call error when something is wrong.
- throw {
- name: 'SyntaxError',
- message: m,
- at: at,
- text: text
- };
- },
-
- next = function (c) {
- // If a c parameter is provided, verify that it matches the current character.
- if (c && c !== ch) {
- error("Expected '" + c + "' instead of '" + ch + "'");
- }
-
- // Get the next character. When there are no more characters,
- // return the empty string.
-
- ch = text.charAt(at);
- at += 1;
- return ch;
- },
-
- number = function () {
- // Parse a number value.
- var number,
- string = '';
-
- if (ch === '-') {
- string = '-';
- next('-');
- }
- while (ch >= '0' && ch <= '9') {
- string += ch;
- next();
- }
- if (ch === '.') {
- string += '.';
- while (next() && ch >= '0' && ch <= '9') {
- string += ch;
- }
- }
- if (ch === 'e' || ch === 'E') {
- string += ch;
- next();
- if (ch === '-' || ch === '+') {
- string += ch;
- next();
- }
- while (ch >= '0' && ch <= '9') {
- string += ch;
- next();
- }
- }
- number = +string;
- if (!isFinite(number)) {
- error("Bad number");
- } else {
- return number;
- }
- },
-
- string = function () {
- // Parse a string value.
- var hex,
- i,
- string = '',
- uffff;
-
- // When parsing for string values, we must look for " and \ characters.
- if (ch === '"') {
- while (next()) {
- if (ch === '"') {
- next();
- return string;
- } else if (ch === '\\') {
- next();
- if (ch === 'u') {
- uffff = 0;
- for (i = 0; i < 4; i += 1) {
- hex = parseInt(next(), 16);
- if (!isFinite(hex)) {
- break;
- }
- uffff = uffff * 16 + hex;
- }
- string += String.fromCharCode(uffff);
- } else if (typeof escapee[ch] === 'string') {
- string += escapee[ch];
- } else {
- break;
- }
- } else {
- string += ch;
- }
- }
- }
- error("Bad string");
- },
-
- white = function () {
-
-// Skip whitespace.
-
- while (ch && ch <= ' ') {
- next();
- }
- },
-
- word = function () {
-
-// true, false, or null.
-
- switch (ch) {
- case 't':
- next('t');
- next('r');
- next('u');
- next('e');
- return true;
- case 'f':
- next('f');
- next('a');
- next('l');
- next('s');
- next('e');
- return false;
- case 'n':
- next('n');
- next('u');
- next('l');
- next('l');
- return null;
- }
- error("Unexpected '" + ch + "'");
- },
-
- value, // Place holder for the value function.
-
- array = function () {
-
-// Parse an array value.
-
- var array = [];
-
- if (ch === '[') {
- next('[');
- white();
- if (ch === ']') {
- next(']');
- return array; // empty array
- }
- while (ch) {
- array.push(value());
- white();
- if (ch === ']') {
- next(']');
- return array;
- }
- next(',');
- white();
- }
- }
- error("Bad array");
- },
-
- object = function () {
-
-// Parse an object value.
-
- var key,
- object = {};
-
- if (ch === '{') {
- next('{');
- white();
- if (ch === '}') {
- next('}');
- return object; // empty object
- }
- while (ch) {
- key = string();
- white();
- next(':');
- if (Object.hasOwnProperty.call(object, key)) {
- error('Duplicate key "' + key + '"');
- }
- object[key] = value();
- white();
- if (ch === '}') {
- next('}');
- return object;
- }
- next(',');
- white();
- }
- }
- error("Bad object");
- };
-
-value = function () {
-
-// Parse a JSON value. It could be an object, an array, a string, a number,
-// or a word.
-
- white();
- switch (ch) {
- case '{':
- return object();
- case '[':
- return array();
- case '"':
- return string();
- case '-':
- return number();
- default:
- return ch >= '0' && ch <= '9' ? number() : word();
- }
-};
-
-// Return the json_parse function. It will have access to all of the above
-// functions and variables.
-
-module.exports = function (source, reviver) {
- var result;
-
- text = source;
- at = 0;
- ch = ' ';
- result = value();
- white();
- if (ch) {
- error("Syntax error");
- }
-
- // If there is a reviver function, we recursively walk the new structure,
- // passing each name/value pair to the reviver function for possible
- // transformation, starting with a temporary root object that holds the result
- // in an empty key. If there is not a reviver function, we simply return the
- // result.
-
- return typeof reviver === 'function' ? (function walk(holder, key) {
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }({'': result}, '')) : result;
-};
-
-},{}],51:[function(require,module,exports){
-var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-function quote(string) {
- // If the string contains no control characters, no quote characters, and no
- // backslash characters, then we can safely slap some quotes around it.
- // Otherwise we must also replace the offending characters with safe escape
- // sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
-}
-
-function str(key, holder) {
- // Produce a string from holder[key].
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
- // If the value has a toJSON method, call it to obtain a replacement value.
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
- // If we were called with a replacer function, then call the replacer to
- // obtain a replacement value.
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
- // What happens next depends on the value's type.
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
- // JSON numbers must be finite. Encode non-finite numbers as null.
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
- // If the value is a boolean or null, convert it to a string. Note:
- // typeof null does not produce 'null'. The case is included here in
- // the remote chance that this gets fixed someday.
- return String(value);
-
- case 'object':
- if (!value) return 'null';
- gap += indent;
- partial = [];
-
- // Array.isArray
- if (Object.prototype.toString.apply(value) === '[object Array]') {
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
- // Join all of the elements together, separated with commas, and
- // wrap them in brackets.
- v = partial.length === 0 ? '[]' : gap ?
- '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
- // If the replacer is an array, use it to select the members to be
- // stringified.
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
- else {
- // Otherwise, iterate through all of the keys in the object.
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
- // Join all of the member texts together, separated with commas,
- // and wrap them in braces.
-
- v = partial.length === 0 ? '{}' : gap ?
- '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
- '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
-}
-
-module.exports = function (value, replacer, space) {
- var i;
- gap = '';
- indent = '';
-
- // If the space parameter is a number, make an indent string containing that
- // many spaces.
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
- }
- // If the space parameter is a string, it will be used as the indent string.
- else if (typeof space === 'string') {
- indent = space;
- }
-
- // If there is a replacer, it must be a function or an array.
- // Otherwise, throw an error.
- rep = replacer;
- if (replacer && typeof replacer !== 'function'
- && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
- // Make a fake root object containing our value under the key of ''.
- // Return the result of stringifying the value.
- return str('', {'': value});
-};
-
-},{}],"ajv":[function(require,module,exports){
-'use strict';
-
-var compileSchema = require('./compile')
- , resolve = require('./compile/resolve')
- , Cache = require('./cache')
- , SchemaObject = require('./compile/schema_obj')
- , stableStringify = require('json-stable-stringify')
- , formats = require('./compile/formats')
- , rules = require('./compile/rules')
- , v5 = require('./v5')
- , util = require('./compile/util')
- , async = require('./async')
- , co = require('co');
-
-module.exports = Ajv;
-
-Ajv.prototype.compileAsync = async.compile;
-
-var customKeyword = require('./keyword');
-Ajv.prototype.addKeyword = customKeyword.add;
-Ajv.prototype.getKeyword = customKeyword.get;
-Ajv.prototype.removeKeyword = customKeyword.remove;
-Ajv.ValidationError = require('./compile/validation_error');
-
-var META_SCHEMA_ID = 'http://json-schema.org/draft-04/schema';
-var SCHEMA_URI_FORMAT = /^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i;
-function SCHEMA_URI_FORMAT_FUNC(str) {
- return SCHEMA_URI_FORMAT.test(str);
-}
-
-var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes' ];
-
-/**
- * Creates validator instance.
- * Usage: `Ajv(opts)`
- * @param {Object} opts optional options
- * @return {Object} ajv instance
- */
-function Ajv(opts) {
- if (!(this instanceof Ajv)) return new Ajv(opts);
- var self = this;
-
- opts = this._opts = util.copy(opts) || {};
- this._schemas = {};
- this._refs = {};
- this._fragments = {};
- this._formats = formats(opts.format);
- this._cache = opts.cache || new Cache;
- this._loadingSchemas = {};
- this._compilations = [];
- this.RULES = rules();
-
- // this is done on purpose, so that methods are bound to the instance
- // (without using bind) so that they can be used without the instance
- this.validate = validate;
- this.compile = compile;
- this.addSchema = addSchema;
- this.addMetaSchema = addMetaSchema;
- this.validateSchema = validateSchema;
- this.getSchema = getSchema;
- this.removeSchema = removeSchema;
- this.addFormat = addFormat;
- this.errorsText = errorsText;
-
- this._addSchema = _addSchema;
- this._compile = _compile;
-
- opts.loopRequired = opts.loopRequired || Infinity;
- if (opts.async || opts.transpile) async.setup(opts);
- if (opts.beautify === true) opts.beautify = { indent_size: 2 };
- if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
- this._metaOpts = getMetaSchemaOptions();
-
- if (opts.formats) addInitialFormats();
- addDraft4MetaSchema();
- if (opts.v5) v5.enable(this);
- if (typeof opts.meta == 'object') addMetaSchema(opts.meta);
- addInitialSchemas();
-
-
- /**
- * Validate data using schema
- * Schema will be compiled and cached (using serialized JSON as key. [json-stable-stringify](https://github.com/substack/json-stable-stringify) is used to serialize.
- * @param {String|Object} schemaKeyRef key, ref or schema object
- * @param {Any} data to be validated
- * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
- */
- function validate(schemaKeyRef, data) {
- var v;
- if (typeof schemaKeyRef == 'string') {
- v = getSchema(schemaKeyRef);
- if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
- } else {
- var schemaObj = _addSchema(schemaKeyRef);
- v = schemaObj.validate || _compile(schemaObj);
- }
-
- var valid = v(data);
- if (v.$async === true)
- return self._opts.async == '*' ? co(valid) : valid;
- self.errors = v.errors;
- return valid;
- }
-
-
- /**
- * Create validating function for passed schema.
- * @param {Object} schema schema object
- * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
- * @return {Function} validating function
- */
- function compile(schema, _meta) {
- var schemaObj = _addSchema(schema, undefined, _meta);
- return schemaObj.validate || _compile(schemaObj);
- }
-
-
- /**
- * Adds schema to the instance.
- * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
- * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
- * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
- * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
- */
- function addSchema(schema, key, _skipValidation, _meta) {
- if (Array.isArray(schema)){
- for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used.
- * @param {Object} options optional options with properties `separator` and `dataVar`.
- * @return {String} human readable string with all errors descriptions
- */
- function errorsText(errors, options) {
- errors = errors || self.errors;
- if (!errors) return 'No errors';
- options = options || {};
- var separator = options.separator === undefined ? ', ' : options.separator;
- var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
-
- var text = '';
- for (var i=0; i=1&&t<=12&&a>=1&&a<=m[t]}function o(e,r){var t=e.match(v);if(!t)return!1;var a=t[1],s=t[2],o=t[3],i=t[5];return a<=23&&s<=59&&o<=59&&(!r||i)}function i(e){var r=e.split(w);return 2==r.length&&s(r[0])&&o(r[1],!0)}function n(e){return e.length<=255&&y.test(e)}function l(e){return j.test(e)&&g.test(e)}function c(e){try{return new RegExp(e),!0}catch(e){return!1}}function h(e,r){if(e&&r)return e>r?1:er?1:e=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:r,baseId:t},{index:a,compiling:!1})}function i(e,r,t){var a=n.call(this,e,r,t);a>=0&&this._compilations.splice(a,1)}function n(e,r,t){for(var a=0;a=55296&&r<=56319&&s=r)throw new Error("Cannot access property/index "+a+" levels up, current level is "+r);return t[r-a]}if(a>r)throw new Error("Cannot access data "+a+" levels up, current level is "+r);if(o="data"+(r-a||""),!s)return o}for(var n=o,c=s.split("/"),h=0;h",S="result"+s,$=e.opts.v5&&i&&i.$data;if($?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+s):g=i,w){var x=e.util.getData(b.$data,o,e.dataPathArr),_="exclusive"+s,O="op"+s,R="' + "+O+" + '";a+=" var schemaExcl"+s+" = "+x+"; ",x="schemaExcl"+s,a+=" if (typeof "+x+" != 'boolean' && "+x+" !== undefined) { "+u+" = false; ";var t=E,I=I||[];I.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(t||"_formatExclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var A=a;a=I.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+A+"]); ":" validate.errors = ["+A+"]; return false; ":" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(p+="}",a+=" else { "),$&&(a+=" if ("+g+" === undefined) "+u+" = true; else if (typeof "+g+" != 'string') "+u+" = false; else { ",p+="}"),d&&(a+=" if (!"+y+") "+u+" = true; else { ",p+="}"),a+=" var "+S+" = "+y+"("+h+", ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" ); if ("+S+" === undefined) "+u+" = false; var "+_+" = "+x+" === true; if ("+u+" === undefined) { "+u+" = "+_+" ? "+S+" "+j+" 0 : "+S+" "+j+"= 0; } if (!"+u+") var op"+s+" = "+_+" ? '"+j+"' : '"+j+"=';"}else{var _=b===!0,R=j;_||(R+="=");var O="'"+R+"'";$&&(a+=" if ("+g+" === undefined) "+u+" = true; else if (typeof "+g+" != 'string') "+u+" = false; else { ",p+="}"),d&&(a+=" if (!"+y+") "+u+" = true; else { ",p+="}"),a+=" var "+S+" = "+y+"("+h+", ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" ); if ("+S+" === undefined) "+u+" = false; if ("+u+" === undefined) "+u+" = "+S+" "+j,_||(a+="="),a+=" 0;"}a+=""+p+"if (!"+u+") { ";var t=r,I=I||[];I.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(t||"_formatLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+O+", limit: ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" , exclusive: "+_+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+R+' "',a+=$?"' + "+g+" + '":""+e.util.escapeQuotes(i),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=$?"validate.schema"+n:""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var A=a;return a=I.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+A+"]); ":" validate.errors = ["+A+"]; return false; ":" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="}"}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maximum"==r,p=d?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[p],v=e.opts.v5&&m&&m.$data,y=d?"<":">",g=d?">":"<";if(v){var P=e.util.getData(m.$data,i,e.dataPathArr),E="exclusive"+o,b="op"+o,w="' + "+b+" + '";s+=" var schemaExcl"+o+" = "+P+"; ",P="schemaExcl"+o,s+=" var exclusive"+o+"; if (typeof "+P+" != 'boolean' && typeof "+P+" != 'undefined') { ";var t=p,j=j||[];j.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(t||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var S=s;s=j.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ((exclusive"+o+" = "+P+" === true) ? "+u+" "+g+"= "+a+" : "+u+" "+g+" "+a+") || "+u+" !== "+u+") { var op"+o+" = exclusive"+o+" ? '"+y+"' : '"+y+"=';"}else{var E=m===!0,w=y;E||(w+="=");var b="'"+w+"'";s+=" if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+" "+g,E&&(s+="="),s+=" "+a+" || "+u+" !== "+u+") {"}var t=r,j=j||[];j.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(t||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+b+", limit: "+a+", exclusive: "+E+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be "+w+" ",s+=f?"' + "+a:""+n+"'"),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var S=s;return s=j.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",h&&(s+=" else { "),s}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxItems"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+".length "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(t||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",s+="maxItems"==r?"more":"less",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxLength"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=e.opts.unicode===!1?" "+u+".length ":" ucs2length("+u+") ",s+=" "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(t||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be ",s+="maxLength"==r?"longer":"shorter",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,
-s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxProperties"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+u+").length "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(t||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",s+="maxProperties"==r?"more":"less",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],18:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,h=n.baseId,u=!0,f=a;if(f)for(var d,p=-1,m=f.length-1;p "+x+") { ";var O=h+"["+x+"]";d.schema=$,d.schemaPath=n+"["+x+"]",d.errSchemaPath=l+"/"+x,d.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0),d.dataPathArr[y]=x;var R=e.validate(d);d.baseId=P,a+=e.util.varOccurences(R,g)<2?" "+e.util.varReplace(R,g,O)+" ":" var "+g+" = "+O+"; "+R+" ",a+=" } ",c&&(a+=" if ("+m+") { ",p+="}")}if("object"==typeof E&&e.util.schemaHasRules(E,e.RULES.all)){d.schema=E,d.schemaPath=e.schemaPath+".additionalItems",d.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+m+" = true; if ("+h+".length > "+i.length+") { for (var "+v+" = "+i.length+"; "+v+" < "+h+".length; "+v+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var O=h+"["+v+"]";d.dataPathArr[y]=v;var R=e.validate(d);d.baseId=P,a+=e.util.varOccurences(R,g)<2?" "+e.util.varReplace(R,g,O)+" ":" var "+g+" = "+O+"; "+R+" ",c&&(a+=" if (!"+m+") break; "),a+=" } } ",c&&(a+=" if ("+m+") { ",p+="}")}}else if(e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=n,d.errSchemaPath=l,a+=" for (var "+v+" = 0; "+v+" < "+h+".length; "+v+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var O=h+"["+v+"]";d.dataPathArr[y]=v;var R=e.validate(d);d.baseId=P,a+=e.util.varOccurences(R,g)<2?" "+e.util.varReplace(R,g,O)+" ":" var "+g+" = "+O+"; "+R+" ",c&&(a+=" if (!"+m+") break; "),a+=" } ",c&&(a+=" if ("+m+") { ",p+="}")}return c&&(a+=" "+p+" if ("+f+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],26:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,s+="var division"+o+";if (",f&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+o+" = "+u+" / "+a+", ",s+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+o+" !== parseInt(division"+o+") ",s+=" ) ",f&&(s+=" ) "),s+=" ) { ";var d=d||[];d.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(t||"multipleOf")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+a+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be multiple of ",s+=f?"' + "+a:""+n+"'"),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var p=s;return s=d.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],27:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,h="data"+(o||""),u="errs__"+s,f=e.util.copy(e);f.level++;var d="valid"+f.level;if(e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=n,f.errSchemaPath=l,a+=" var "+u+" = errors; ";var p=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.createErrors=!1;var m;f.opts.allErrors&&(m=f.opts.allErrors,f.opts.allErrors=!1),a+=" "+e.validate(f)+" ",f.createErrors=!0,m&&(f.opts.allErrors=m),e.compositeRule=f.compositeRule=p,a+=" if ("+d+") { ";var v=v||[];v.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(t||"not")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var y=a;a=v.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+y+"]); ":" validate.errors = ["+y+"]; return false; ":" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: '"+(t||"not")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ");return a}},{}],28:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,h="data"+(o||""),u="valid"+s,f="errs__"+s,d=e.util.copy(e),p="";d.level++;var m="valid"+d.level;a+="var "+f+" = errors;var prevValid"+s+" = false;var "+u+" = false;";var v=d.baseId,y=e.compositeRule;e.compositeRule=d.compositeRule=!0;var g=i;if(g)for(var P,E=-1,b=g.length-1;E5)a+=" || validate.schema"+n+"["+v+"] ";else{var D=P;if(D)for(var L,Q=-1,C=D.length-1;Q= "+me+"; ",l=e.errSchemaPath+"/patternGroups/minimum",a+=" if (!"+u+") { ";var K=K||[];K.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(t||"patternGroups")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+ge+"', limit: "+ye+", pattern: '"+e.util.escapeQuotes(N)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have "+Pe+" than "+ye+' properties matching pattern "'+e.util.escapeQuotes(N)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var B=a;a=K.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+B+"]); ":" validate.errors = ["+B+"]; return false; ":" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",void 0!==ve&&(a+=" else ")}if(void 0!==ve){var ye=ve,ge="maximum",Pe="more";a+=" "+u+" = pgPropCount"+s+" <= "+ve+"; ",l=e.errSchemaPath+"/patternGroups/maximum",a+=" if (!"+u+") { ";var K=K||[];K.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(t||"patternGroups")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+ge+"', limit: "+ye+", pattern: '"+e.util.escapeQuotes(N)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have "+Pe+" than "+ye+' properties matching pattern "'+e.util.escapeQuotes(N)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var B=a;a=K.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+B+"]); ":" validate.errors = ["+B+"]; return false; ":" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}l=G,c&&(a+=" if ("+u+") { ",p+="}")}}}}return c&&(a+=" "+p+" if ("+f+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],32:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s,o=" ",i=e.level,n=e.dataLevel,l=e.schema[r],c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(n||""),f="valid"+i;if("#"==l||"#/"==l)e.isRoot?(a=e.async,s="validate"):(a=e.root.schema.$async===!0,s="root.refVal[0]");else{var d=e.resolveRef(e.baseId,l,e.isRoot);if(void 0===d){var p="can't resolve reference "+l+" from id "+e.baseId;if("fail"==e.opts.missingRefs){console.log(p);var m=m||[];m.push(o),o="",e.createErrors!==!1?(o+=" { keyword: '"+(t||"$ref")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",e.opts.messages!==!1&&(o+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(o+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),o+=" } "):o+=" {} ";var v=o;o=m.pop(),o+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(o+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs){var y=new Error(p);throw y.missingRef=e.resolve.url(e.baseId,l),y.missingSchema=e.resolve.normalizeId(e.resolve.fullPath(y.missingRef)),y}console.log(p),h&&(o+=" if (true) { ")}}else if(d.inline){var g=e.util.copy(e);g.level++;var P="valid"+g.level;g.schema=d.schema,g.schemaPath="",g.errSchemaPath=l;var E=e.validate(g).replace(/validate\.schema/g,d.code);o+=" "+E+" ",h&&(o+=" if ("+P+") { ")}else a=d.$async===!0,s=d.code}if(s){var m=m||[];m.push(o),o="",o+=e.opts.passContext?" "+s+".call(this, ":" "+s+"( ",o+=" "+u+", (dataPath || '')",'""'!=e.errorPath&&(o+=" + "+e.errorPath);o+=" , "+(n?"data"+(n-1||""):"parentData")+" , "+(n?e.dataPathArr[n]:"parentDataProperty")+", rootData) ";var b=o;if(o=m.pop(),a){if(!e.async)throw new Error("async schema referenced by sync schema");o+=" try { ",h&&(o+="var "+f+" ="),o+=" "+e.yieldAwait+" "+b+"; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } ",h&&(o+=" if ("+f+") { ")}else o+=" if (!"+b+") { if (vErrors === null) vErrors = "+s+".errors; else vErrors = vErrors.concat("+s+".errors); errors = vErrors.length; } ",h&&(o+=" else { ")}return o}},{}],33:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,h="data"+(o||""),u="valid"+s,f=e.opts.v5&&i&&i.$data;f&&(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var d="schema"+s;if(!f)if(i.length=e.opts.loopRequired;if(c)if(a+=" var missing"+s+"; ",b){f||(a+=" var "+d+" = validate.schema"+n+"; ");var w="i"+s,j="schema"+s+"["+w+"]",S="' + "+j+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,j,e.opts.jsonPointers)),a+=" var "+u+" = true; ",f&&(a+=" if (schema"+s+" === undefined) "+u+" = true; else if (!Array.isArray(schema"+s+")) "+u+" = false; else {"),a+=" for (var "+w+" = 0; "+w+" < "+d+".length; "+w+"++) { "+u+" = "+h+"["+d+"["+w+"]] !== undefined; if (!"+u+") break; } ",f&&(a+=" } "),a+=" if (!"+u+") { ";var $=$||[];$.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(t||"required")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+S+"' } ",e.opts.messages!==!1&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+S+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var x=a;a=$.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var _=p;if(_)for(var O,w=-1,R=_.length-1;w 1) { var i = "+u+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+u+"[i], "+u+"[j])) { "+f+" = false; break outer; } } } } ",d&&(s+=" } "),s+=" if (!"+f+") { ";var p=p||[];p.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(t||"uniqueItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",h&&(s+=" else { ")}else h&&(s+=" if (true) { ");return s}},{}],36:[function(e,r,t){"use strict";r.exports=function(e,r){function t(e){for(var r=0;r1&&(a=t[0]+"@",e=t[1]),e=e.replace(q,"."),a+i(e.split("."),r).join(".")}function l(e){for(var r,t,a=[],s=0,o=e.length;s=55296&&r<=56319&&s65535&&(e-=65536,r+=C(e>>>10&1023|55296),e=56320|1023&e),r+=C(e)}).join("")}function h(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:j}function u(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function f(e,r,t){var a=0;for(e=t?Q(e/_):e>>1,e+=Q(e/r);e>L*$>>1;a+=j)e=Q(e/L);return Q(a+(L+1)*e/(e+x))}function d(e){var r,t,a,s,i,n,l,u,d,p,m=[],v=e.length,y=0,g=R,P=O;for(t=e.lastIndexOf(I),t<0&&(t=0),a=0;a=128&&o("not-basic"),m.push(e.charCodeAt(a));for(s=t>0?t+1:0;s=v&&o("invalid-input"),u=h(e.charCodeAt(s++)),(u>=j||u>Q((w-y)/n))&&o("overflow"),y+=u*n,d=l<=P?S:l>=P+$?$:l-P,!(uQ(w/p)&&o("overflow"),n*=p;r=m.length+1,P=f(y-i,r,0==i),Q(y/r)>w-g&&o("overflow"),g+=Q(y/r),y%=r,m.splice(y++,0,g)}return c(m)}function p(e){var r,t,a,s,i,n,c,h,d,p,m,v,y,g,P,E=[];for(e=l(e),v=e.length,r=R,t=0,i=O,n=0;n=r&&mQ((w-t)/y)&&o("overflow"),t+=(c-r)*y,r=c,n=0;nw&&o("overflow"),m==r){for(h=t,d=j;p=d<=i?S:d>=i+$?$:d-i,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=j-S,Q=Math.floor,C=String.fromCharCode;if(E={version:"1.4.1",ucs2:{decode:l,encode:c},decode:d,encode:p,toASCII:v,toUnicode:m},"function"==typeof e&&"object"==typeof e.amd&&e.amd)e("punycode",function(){return E});else if(y&&g)if(t.exports==y)g.exports=E;else for(b in E)E.hasOwnProperty(b)&&(y[b]=E[b]);else s.punycode=E}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],42:[function(e,r,t){"use strict";function a(e,r){return Object.prototype.hasOwnProperty.call(e,r)}r.exports=function(e,r,t,o){r=r||"&",t=t||"=";var i={};if("string"!=typeof e||0===e.length)return i;var n=/\+/g;e=e.split(r);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var c=e.length;l>0&&c>l&&(c=l);for(var h=0;h=0?(u=m.substr(0,v),f=m.substr(v+1)):(u=m,f=""),d=decodeURIComponent(u),p=decodeURIComponent(f),a(i,d)?s(i[d])?i[d].push(p):i[d]=[i[d],p]:i[d]=p}return i};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],43:[function(e,r,t){"use strict";function a(e,r){if(e.map)return e.map(r);for(var t=[],a=0;a",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(p),v=["%","/","?",";","#"].concat(m),y=["/","?","#"],g=/^[+a-z0-9A-Z_-]{0,63}$/,P=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,E={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},j=e("querystring");a.prototype.parse=function(e,r,t){if(!c.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),s=a!==-1&&a127?"x":k[D];if(!q.match(g)){var Q=I.slice(0,$),C=I.slice($+1),V=k.match(P);V&&(Q.push(V[1]),C.unshift(V[2])),C.length&&(i="/"+C.join(".")+i),this.hostname=Q.join(".");break}}}this.hostname=this.hostname.length>255?"":this.hostname.toLowerCase(),R||(this.hostname=l.toASCII(this.hostname));var z=this.port?":"+this.port:"";this.host=(this.hostname||"")+z,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!E[d])for(var $=0,A=m.length;$0)&&t.host.split("@");j&&(t.auth=j.shift(),t.host=t.hostname=j.shift())}return t.search=e.search,t.query=e.query,c.isNull(t.pathname)&&c.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!P.length)return t.pathname=null,t.path=t.search?"/"+t.search:null,t.href=t.format(),t;for(var S=P.slice(-1)[0],$=(t.host||e.host||P.length>1)&&("."===S||".."===S)||""===S,x=0,_=P.length;_>=0;_--)S=P[_],"."===S?P.splice(_,1):".."===S?(P.splice(_,1),x++):x&&(P.splice(_,1),x--);if(!y&&!g)for(;x--;x)P.unshift("..");!y||""===P[0]||P[0]&&"/"===P[0].charAt(0)||P.unshift(""),$&&"/"!==P.join("/").substr(-1)&&P.push("");var O=""===P[0]||P[0]&&"/"===P[0].charAt(0);if(E){t.hostname=t.host=O?"":P.length?P.shift():"";var j=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@");j&&(t.auth=j.shift(),t.host=t.hostname=j.shift())}return y=y||t.host&&P.length,y&&!O&&P.unshift(""),P.length?t.pathname=P.join("/"):(t.pathname=null,t.path=null),c.isNull(t.pathname)&&c.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},a.prototype.parseHost=function(){var e=this.host,r=u.exec(e);r&&(r=r[0],":"!==r&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)}},{"./util":46,punycode:41,querystring:44}],46:[function(e,r,t){"use strict";r.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],47:[function(e,r,t){function a(e){var r=this,t=f.call(arguments,1);return new Promise(function(a,o){function i(r){var t;try{t=e.next(r)}catch(e){return o(e)}c(t)}function n(r){var t;try{t=e.throw(r)}catch(e){return o(e)}c(t)}function c(e){if(e.done)return a(e.value);var t=s.call(r,e.value);return t&&l(t)?t.then(i,n):n(new TypeError('You may only yield a function, promise, generator, array, or object, but the following object was passed: "'+String(e.value)+'"'))}if("function"==typeof e&&(e=e.apply(r,t)),!e||"function"!=typeof e.next)return a(e);i()})}function s(e){return e?l(e)?e:h(e)||c(e)?a.call(this,e):"function"==typeof e?o.call(this,e):Array.isArray(e)?i.call(this,e):u(e)?n.call(this,e):e:e}function o(e){var r=this;return new Promise(function(t,a){e.call(r,function(e,r){if(e)return a(e);arguments.length>2&&(r=f.call(arguments,1)),t(r)})})}function i(e){return Promise.all(e.map(s,this))}function n(e){function r(e,r){t[r]=void 0,o.push(e.then(function(e){t[r]=e}))}for(var t=new e.constructor,a=Object.keys(e),o=[],i=0;i ="0"&&s<="9";)r+=s,c();if("."===s)for(r+=".";c()&&s>="0"&&s<="9";)r+=s;if("e"===s||"E"===s)for(r+=s,c(),"-"!==s&&"+"!==s||(r+=s,c());s>="0"&&s<="9";)r+=s,c();if(e=+r,isFinite(e))return e;l("Bad number")},u=function(){var e,r,t,a="";if('"'===s)for(;c();){if('"'===s)return c(),a;if("\\"===s)if(c(),"u"===s){for(t=0,r=0;r<4&&(e=parseInt(c(),16),isFinite(e));r+=1)t=16*t+e;a+=String.fromCharCode(t)}else{if("string"!=typeof n[s])break;a+=n[s]}else a+=s}l("Bad string")},f=function(){for(;s&&s<=" ";)c()},d=function(){switch(s){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}l("Unexpected '"+s+"'")},p=function(){var e=[];if("["===s){if(c("["),f(),"]"===s)return c("]"),e;for(;s;){if(e.push(i()),f(),"]"===s)return c("]"),e;c(","),f()}}l("Bad array")},m=function(){var e,r={};if("{"===s){if(c("{"),f(),"}"===s)return c("}"),r;for(;s;){if(e=u(),f(),c(":"),Object.hasOwnProperty.call(r,e)&&l('Duplicate key "'+e+'"'),r[e]=i(),f(),"}"===s)return c("}"),r;c(","),f()}}l("Bad object")};i=function(){switch(f(),s){case"{":return m();case"[":return p();case'"':return u();case"-":return h();default:return s>="0"&&s<="9"?h():d()}},r.exports=function(e,r){var t;return o=e,a=0,s=" ",t=i(),f(),s&&l("Syntax error"),"function"==typeof r?function e(t,a){var s,o,i=t[a];if(i&&"object"==typeof i)for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&(o=e(i,s),void 0!==o?i[s]=o:delete i[s]);return r.call(t,a,i)}({"":t},""):t}},{}],51:[function(e,r,t){function a(e){return l.lastIndex=0,l.test(e)?'"'+e.replace(l,function(e){var r=c[e];return"string"==typeof r?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function s(e,r){var t,l,c,h,u,f=o,d=r[e];switch(d&&"object"==typeof d&&"function"==typeof d.toJSON&&(d=d.toJSON(e)),"function"==typeof n&&(d=n.call(r,e,d)),typeof d){case"string":return a(d);case"number":return isFinite(d)?String(d):"null";case"boolean":case"null":return String(d);case"object":if(!d)return"null";if(o+=i,u=[],"[object Array]"===Object.prototype.toString.apply(d)){for(h=d.length,t=0;t=1&&t<=12&&a>=1&&a<=m[t]}function o(e,r){var t=e.match(v);if(!t)return!1;var a=t[1],s=t[2],o=t[3],i=t[5];return a<=23&&s<=59&&o<=59&&(!r||i)}function i(e){var r=e.split(b);return 2==r.length&&s(r[0])&&o(r[1],!0)}function n(e){return e.length<=255&&y.test(e)}function l(e){return w.test(e)&&g.test(e)}function c(e){try{return new RegExp(e),!0}catch(e){return!1}}function h(e,r){if(e&&r)return e>r?1:er?1:e=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:r,baseId:t},{index:a,compiling:!1})}function i(e,r,t){var a=n.call(this,e,r,t);a>=0&&this._compilations.splice(a,1)}function n(e,r,t){for(var a=0;a=55296&&r<=56319&&s=r)throw new Error("Cannot access property/index "+a+" levels up, current level is "+r);return t[r-a]}if(a>r)throw new Error("Cannot access data "+a+" levels up, current level is "+r);if(o="data"+(r-a||""),!s)return o}for(var n=o,c=s.split("/"),h=0;h",S="result"+s,$=e.opts.v5&&i&&i.$data;if($?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+s):g=i,w){var x=e.util.getData(b.$data,o,e.dataPathArr),_="exclusive"+s,O="op"+s,R="' + "+O+" + '";a+=" var schemaExcl"+s+" = "+x+"; ",x="schemaExcl"+s,a+=" if (typeof "+x+" != 'boolean' && "+x+" !== undefined) { "+u+" = false; ";var t=E,I=I||[];I.push(a),a="",!1!==e.createErrors?(a+=" { keyword: '"+(t||"_formatExclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: '"+E+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var A=a;a=I.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+A+"]); ":" validate.errors = ["+A+"]; return false; ":" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(p+="}",a+=" else { "),$&&(a+=" if ("+g+" === undefined) "+u+" = true; else if (typeof "+g+" != 'string') "+u+" = false; else { ",p+="}"),d&&(a+=" if (!"+y+") "+u+" = true; else { ",p+="}"),a+=" var "+S+" = "+y+"("+h+", ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" ); if ("+S+" === undefined) "+u+" = false; var "+_+" = "+x+" === true; if ("+u+" === undefined) { "+u+" = "+_+" ? "+S+" "+j+" 0 : "+S+" "+j+"= 0; } if (!"+u+") var op"+s+" = "+_+" ? '"+j+"' : '"+j+"=';"}else{var _=!0===b,R=j;_||(R+="=");var O="'"+R+"'";$&&(a+=" if ("+g+" === undefined) "+u+" = true; else if (typeof "+g+" != 'string') "+u+" = false; else { ",p+="}"),d&&(a+=" if (!"+y+") "+u+" = true; else { ",p+="}"),a+=" var "+S+" = "+y+"("+h+", ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" ); if ("+S+" === undefined) "+u+" = false; if ("+u+" === undefined) "+u+" = "+S+" "+j,_||(a+="="),a+=" 0;"}a+=p+"if (!"+u+") { ";var t=r,I=I||[];I.push(a),a="",!1!==e.createErrors?(a+=" { keyword: '"+(t||"_formatLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { comparison: "+O+", limit: ",a+=$?""+g:""+e.util.toQuotedString(i),a+=" , exclusive: "+_+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be "+R+' "',a+=$?"' + "+g+" + '":""+e.util.escapeQuotes(i),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=$?"validate.schema"+n:""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var A=a;return a=I.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+A+"]); ":" validate.errors = ["+A+"]; return false; ":" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="}"}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maximum"==r,p=d?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[p],v=e.opts.v5&&m&&m.$data,y=d?"<":">",g=d?">":"<";if(v){var P=e.util.getData(m.$data,i,e.dataPathArr),E="exclusive"+o,b="op"+o,w="' + "+b+" + '";s+=" var schemaExcl"+o+" = "+P+"; ",P="schemaExcl"+o,s+=" var exclusive"+o+"; if (typeof "+P+" != 'boolean' && typeof "+P+" != 'undefined') { ";var t=p,j=j||[];j.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var S=s;s=j.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ((exclusive"+o+" = "+P+" === true) ? "+u+" "+g+"= "+a+" : "+u+" "+g+" "+a+") || "+u+" !== "+u+") { var op"+o+" = exclusive"+o+" ? '"+y+"' : '"+y+"=';"}else{var E=!0===m,w=y;E||(w+="=");var b="'"+w+"'";s+=" if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+" "+g,E&&(s+="="),s+=" "+a+" || "+u+" !== "+u+") {"}var t=r,j=j||[];j.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+b+", limit: "+a+", exclusive: "+E+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+w+" ",s+=f?"' + "+a:n+"'"),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var S=s;return s=j.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",h&&(s+=" else { "),s}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxItems"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+".length "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==r?"more":"less",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxLength"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=!1===e.opts.unicode?" "+u+".length ":" ucs2length("+u+") ",s+=" "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==r?"longer":"shorter",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,
+s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),f=e.opts.v5&&n&&n.$data;f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var d="maxProperties"==r?">":"<";s+="if ( ",f&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+u+").length "+d+" "+a+") { ";var t=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(t||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==r?"more":"less",s+=" than ",s+=f?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",h&&(s+=" else { "),s}},{}],18:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.schema[r],s=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,n=e.util.copy(e),l="";n.level++;var c="valid"+n.level,h=n.baseId,u=!0,f=a;if(f)for(var d,p=-1,m=f.length-1;p "+$+") { ";var _=c+"["+$+"]";f.schema=S,f.schemaPath=i+"["+$+"]",f.errSchemaPath=n+"/"+$,f.errorPath=e.util.getPathExpr(e.errorPath,$,e.opts.jsonPointers,!0),f.dataPathArr[v]=$;var O=e.validate(f);f.baseId=g,e.util.varOccurences(O,y)<2?t+=" "+e.util.varReplace(O,y,_)+" ":t+=" var "+y+" = "+_+"; "+O+" ",t+=" } ",l&&(t+=" if ("+p+") { ",d+="}")}if("object"==typeof P&&e.util.schemaHasRules(P,e.RULES.all)){f.schema=P,f.schemaPath=e.schemaPath+".additionalItems",f.errSchemaPath=e.errSchemaPath+"/additionalItems",t+=" "+p+" = true; if ("+c+".length > "+o.length+") { for (var "+m+" = "+o.length+"; "+m+" < "+c+".length; "+m+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);var _=c+"["+m+"]";f.dataPathArr[v]=m;var O=e.validate(f);f.baseId=g,e.util.varOccurences(O,y)<2?t+=" "+e.util.varReplace(O,y,_)+" ":t+=" var "+y+" = "+_+"; "+O+" ",l&&(t+=" if (!"+p+") break; "),t+=" } } ",l&&(t+=" if ("+p+") { ",d+="}")}}else if(e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=i,f.errSchemaPath=n,t+=" for (var "+m+" = 0; "+m+" < "+c+".length; "+m+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);var _=c+"["+m+"]";f.dataPathArr[v]=m;var O=e.validate(f);f.baseId=g,e.util.varOccurences(O,y)<2?t+=" "+e.util.varReplace(O,y,_)+" ":t+=" var "+y+" = "+_+"; "+O+" ",l&&(t+=" if (!"+p+") break; "),t+=" } ",l&&(t+=" if ("+p+") { ",d+="}")}return l&&(t+=" "+d+" if ("+u+" == errors) {"),t=e.util.cleanUpCode(t)}},{}],26:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,h="data"+(o||""),u=e.opts.v5&&i&&i.$data;u?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",t="schema"+s):t=i,a+="var division"+s+";if (",u&&(a+=" "+t+" !== undefined && ( typeof "+t+" != 'number' || "),a+=" (division"+s+" = "+h+" / "+t+", ",a+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",u&&(a+=" ) "),a+=" ) { ";var f=f||[];f.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { multipleOf: "+t+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be multiple of ",a+=u?"' + "+t:i+"'"),e.opts.verbose&&(a+=" , schema: ",a+=u?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var d=a;return a=f.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+d+"]); ":" validate.errors = ["+d+"]; return false; ":" var err = "+d+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",c&&(a+=" else { "),a}},{}],27:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),h="errs__"+a,u=e.util.copy(e);u.level++;var f="valid"+u.level;if(e.util.schemaHasRules(o,e.RULES.all)){u.schema=o,u.schemaPath=i,u.errSchemaPath=n,t+=" var "+h+" = errors; ";var d=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.createErrors=!1;var p;u.opts.allErrors&&(p=u.opts.allErrors,u.opts.allErrors=!1),t+=" "+e.validate(u)+" ",u.createErrors=!0,p&&(u.opts.allErrors=p),e.compositeRule=u.compositeRule=d,t+=" if ("+f+") { ";var m=m||[];m.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: {} ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var v=t;t=m.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(t+=" } ")}else t+=" var err = ",!1!==e.createErrors?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: {} ",!1!==e.opts.messages&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l&&(t+=" if (false) { ");return t}},{}],28:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),h="valid"+a,u="errs__"+a,f=e.util.copy(e),d="";f.level++;var p="valid"+f.level;t+="var "+u+" = errors;var prevValid"+a+" = false;var "+h+" = false;";var m=f.baseId,v=e.compositeRule;e.compositeRule=f.compositeRule=!0;var y=o;if(y)for(var g,P=-1,E=y.length-1;P5)t+=" || validate.schema"+i+"["+m+"] ";else{var q=g;if(q)for(var D,L=-1,Q=q.length-1;L= "+pe+"; ",n=e.errSchemaPath+"/patternGroups/minimum",t+=" if (!"+h+") { ";var G=G||[];G.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { reason: '"+ye+"', limit: "+ve+", pattern: '"+e.util.escapeQuotes(M)+"' } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have "+ge+" than "+ve+' properties matching pattern "'+e.util.escapeQuotes(M)+"\"' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var K=t;t=G.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+K+"]); ":" validate.errors = ["+K+"]; return false; ":" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",void 0!==me&&(t+=" else ")}if(void 0!==me){var ve=me,ye="maximum",ge="more";t+=" "+h+" = pgPropCount"+a+" <= "+me+"; ",n=e.errSchemaPath+"/patternGroups/maximum",t+=" if (!"+h+") { ";var G=G||[];G.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { reason: '"+ye+"', limit: "+ve+", pattern: '"+e.util.escapeQuotes(M)+"' } ",!1!==e.opts.messages&&(t+=" , message: 'should NOT have "+ge+" than "+ve+' properties matching pattern "'+e.util.escapeQuotes(M)+"\"' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var K=t;t=G.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+K+"]); ":" validate.errors = ["+K+"]; return false; ":" var err = "+K+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } "}n=J,l&&(t+=" if ("+h+") { ",d+="}")}}}}return l&&(t+=" "+d+" if ("+u+" == errors) {"),t=e.util.cleanUpCode(t)}},{}],32:[function(e,r,t){"use strict";r.exports=function(e,r){var t,a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,h="data"+(i||""),u="valid"+o;if("#"==n||"#/"==n)e.isRoot?(t=e.async,a="validate"):(t=!0===e.root.schema.$async,a="root.refVal[0]");else{var f=e.resolveRef(e.baseId,n,e.isRoot);if(void 0===f){var d="can't resolve reference "+n+" from id "+e.baseId;if("fail"==e.opts.missingRefs){console.log(d);var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(n)+"' } ",!1!==e.opts.messages&&(s+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(n)+"' "),e.opts.verbose&&(s+=" , schema: "+e.util.toQuotedString(n)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),s+=" } "):s+=" {} ";var m=s;s=p.pop(),s+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(s+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs){var v=new Error(d);throw v.missingRef=e.resolve.url(e.baseId,n),v.missingSchema=e.resolve.normalizeId(e.resolve.fullPath(v.missingRef)),v}console.log(d),c&&(s+=" if (true) { ")}}else if(f.inline){var y=e.util.copy(e);y.level++;var g="valid"+y.level;y.schema=f.schema,y.schemaPath="",y.errSchemaPath=n;var P=e.validate(y).replace(/validate\.schema/g,f.code);s+=" "+P+" ",c&&(s+=" if ("+g+") { ")}else t=!0===f.$async,a=f.code}if(a){var p=p||[];p.push(s),s="",s+=e.opts.passContext?" "+a+".call(this, ":" "+a+"( ",s+=" "+h+", (dataPath || '')",'""'!=e.errorPath&&(s+=" + "+e.errorPath);s+=" , "+(i?"data"+(i-1||""):"parentData")+" , "+(i?e.dataPathArr[i]:"parentDataProperty")+", rootData) ";var E=s;if(s=p.pop(),t){if(!e.async)throw new Error("async schema referenced by sync schema");s+=" try { ",c&&(s+="var "+u+" ="),s+=" "+e.yieldAwait+" "+E+"; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } ",c&&(s+=" if ("+u+") { ")}else s+=" if (!"+E+") { if (vErrors === null) vErrors = "+a+".errors; else vErrors = vErrors.concat("+a+".errors); errors = vErrors.length; } ",c&&(s+=" else { ")}return s}},{}],33:[function(e,r,t){"use strict";r.exports=function(e,r){var t=" ",a=e.level,s=e.dataLevel,o=e.schema[r],i=e.schemaPath+e.util.getProperty(r),n=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c="data"+(s||""),h="valid"+a,u=e.opts.v5&&o&&o.$data;u&&(t+=" var schema"+a+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ");var f="schema"+a;if(!u)if(o.length=e.opts.loopRequired;if(l)if(t+=" var missing"+a+"; ",E){u||(t+=" var "+f+" = validate.schema"+i+"; ");var b="i"+a,w="schema"+a+"["+b+"]",j="' + "+w+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,w,e.opts.jsonPointers)),t+=" var "+h+" = true; ",u&&(t+=" if (schema"+a+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+a+")) "+h+" = false; else {"),t+=" for (var "+b+" = 0; "+b+" < "+f+".length; "+b+"++) { "+h+" = "+c+"["+f+"["+b+"]] !== undefined; if (!"+h+") break; } ",u&&(t+=" } "),t+=" if (!"+h+") { ";var S=S||[];S.push(t),t="",!1!==e.createErrors?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(n)+" , params: { missingProperty: '"+j+"' } ",!1!==e.opts.messages&&(t+=" , message: '",t+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+j+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+i+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),t+=" } "):t+=" {} ";var $=t;t=S.pop(),t+=!e.compositeRule&&l?e.async?" throw new ValidationError(["+$+"]); ":" validate.errors = ["+$+"]; return false; ":" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { "}else{t+=" if ( ";var x=d;if(x)for(var _,b=-1,O=x.length-1;b 1) { var i = "+h+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+u+" = false; break outer; } } } } ",f&&(a+=" } "),a+=" if (!"+u+") { ";var d=d||[];d.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",a+=f?"validate.schema"+n:""+i,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),a+=" } "):a+=" {} ";var p=a;a=d.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a}},{}],36:[function(e,r,t){"use strict";r.exports=function(e,r){function t(r){return void 0!==e.schema[r.keyword]||"properties"==r.keyword&&(!1===e.schema.additionalProperties||"object"==typeof e.schema.additionalProperties||e.schema.patternProperties&&Object.keys(e.schema.patternProperties).length||e.opts.v5&&e.schema.patternGroups&&Object.keys(e.schema.patternGroups).length)}var a="",s=!0===e.schema.$async;if(e.isTop){var o=e.isTop,i=e.level=0,n=e.dataLevel=0,l="data";if(e.rootId=e.resolve.fullPath(e.root.schema.id),e.baseId=e.baseId||e.rootId,s){e.async=!0;var c="es7"==e.opts.async;e.yieldAwait=c?"await":"yield"}delete e.isTop,e.dataPathArr=[void 0],a+=" var validate = ",s?c?a+=" (async function ":("co*"==e.opts.async&&(a+="co.wrap"),a+="(function* "):a+=" (function ",a+=" (data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data;"}else{var i=e.level,n=e.dataLevel,l="data"+(n||"");if(e.schema.id&&(e.baseId=e.resolve.url(e.baseId,e.schema.id)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+i+" = errors;"}var h="valid"+i,u=!e.opts.allErrors,f="",d="",p=e.schema.type,m=Array.isArray(p);if(p&&e.opts.coerceTypes){var v=e.util.coerceToTypes(e.opts.coerceTypes,p);if(v){var y=e.schemaPath+".type",g=e.errSchemaPath+"/type",P=m?"checkDataTypes":"checkDataType";a+=" if ("+e.util[P](p,l,!0)+") { ";var E="dataType"+i,b="coerced"+i;a+=" var "+E+" = typeof "+l+"; ","array"==e.opts.coerceTypes&&(a+=" if ("+E+" == 'object' && Array.isArray("+l+")) "+E+" = 'array'; "),a+=" var "+b+" = undefined; ";var w="",j=v;if(j)for(var S,$=-1,x=j.length-1;$2&&(r=f.call(arguments,1)),t(r)})})}function i(e){return Promise.all(e.map(s,this))}function n(e){for(var r=new e.constructor,t=Object.keys(e),a=[],o=0;o="0"&&s<="9";)r+=s,c();if("."===s)for(r+=".";c()&&s>="0"&&s<="9";)r+=s;if("e"===s||"E"===s)for(r+=s,c(),"-"!==s&&"+"!==s||(r+=s,c());s>="0"&&s<="9";)r+=s,c();if(e=+r,isFinite(e))return e;l("Bad number")},u=function(){var e,r,t,a="";if('"'===s)for(;c();){if('"'===s)return c(),a;if("\\"===s)if(c(),"u"===s){for(t=0,r=0;r<4&&(e=parseInt(c(),16),isFinite(e));r+=1)t=16*t+e;a+=String.fromCharCode(t)}else{if("string"!=typeof n[s])break;a+=n[s]}else a+=s}l("Bad string")},f=function(){for(;s&&s<=" ";)c()},d=function(){switch(s){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}l("Unexpected '"+s+"'")},p=function(){var e=[];if("["===s){if(c("["),f(),"]"===s)return c("]"),e;for(;s;){if(e.push(i()),f(),"]"===s)return c("]"),e;c(","),f()}}l("Bad array")},m=function(){var e,r={};if("{"===s){if(c("{"),f(),"}"===s)return c("}"),r;for(;s;){if(e=u(),f(),c(":"),Object.hasOwnProperty.call(r,e)&&l('Duplicate key "'+e+'"'),r[e]=i(),f(),"}"===s)return c("}"),r;c(","),f()}}l("Bad object")};i=function(){switch(f(),s){case"{":return m();case"[":return p();case'"':return u();case"-":return h();default:return s>="0"&&s<="9"?h():d()}},r.exports=function(e,r){var t;return o=e,a=0,s=" ",t=i(),f(),s&&l("Syntax error"),"function"==typeof r?function e(t,a){var s,o,i=t[a];if(i&&"object"==typeof i)for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&(o=e(i,s),void 0!==o?i[s]=o:delete i[s]);return r.call(t,a,i)}({"":t},""):t}},{}],45:[function(e,r,t){function a(e){return l.lastIndex=0,l.test(e)?'"'+e.replace(l,function(e){var r=c[e];return"string"==typeof r?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function s(e,r){var t,l,c,h,u,f=o,d=r[e];switch(d&&"object"==typeof d&&"function"==typeof d.toJSON&&(d=d.toJSON(e)),"function"==typeof n&&(d=n.call(r,e,d)),typeof d){case"string":return a(d);case"number":return isFinite(d)?String(d):"null";case"boolean":case"null":return String(d);case"object":if(!d)return"null";if(o+=i,u=[],"[object Array]"===Object.prototype.toString.apply(d)){for(h=d.length,t=0;t1&&(a=t[0]+"@",e=t[1]),e=e.replace(q,"."),a+i(e.split("."),r).join(".")}function l(e){for(var r,t,a=[],s=0,o=e.length;s=55296&&r<=56319&&s65535&&(e-=65536,r+=C(e>>>10&1023|55296),e=56320|1023&e),r+=C(e)}).join("")}function h(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:j}function u(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function f(e,r,t){var a=0;for(e=t?Q(e/_):e>>1,e+=Q(e/r);e>L*$>>1;a+=j)e=Q(e/L);return Q(a+(L+1)*e/(e+x))}function d(e){var r,t,a,s,i,n,l,u,d,p,m=[],v=e.length,y=0,g=R,P=O;for(t=e.lastIndexOf(I),t<0&&(t=0),a=0;a=128&&o("not-basic"),m.push(e.charCodeAt(a));for(s=t>0?t+1:0;s=v&&o("invalid-input"),u=h(e.charCodeAt(s++)),(u>=j||u>Q((w-y)/n))&&o("overflow"),y+=u*n,d=l<=P?S:l>=P+$?$:l-P,!(uQ(w/p)&&o("overflow"),n*=p;r=m.length+1,P=f(y-i,r,0==i),Q(y/r)>w-g&&o("overflow"),g+=Q(y/r),y%=r,m.splice(y++,0,g)}return c(m)}function p(e){var r,t,a,s,i,n,c,h,d,p,m,v,y,g,P,E=[];for(e=l(e),v=e.length,r=R,t=0,i=O,n=0;n=r&&mQ((w-t)/y)&&o("overflow"),t+=(c-r)*y,r=c,n=0;nw&&o("overflow"),m==r){for(h=t,d=j;p=d<=i?S:d>=i+$?$:d-i,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=j-S,Q=Math.floor,C=String.fromCharCode;if(E={version:"1.4.1",ucs2:{decode:l,encode:c},decode:d,encode:p,toASCII:v,toUnicode:m},"function"==typeof e&&"object"==typeof e.amd&&e.amd)e("punycode",function(){return E});else if(y&&g)if(t.exports==y)g.exports=E;else for(b in E)E.hasOwnProperty(b)&&(y[b]=E[b]);else s.punycode=E}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(e,r,t){"use strict";function a(e,r){return Object.prototype.hasOwnProperty.call(e,r)}r.exports=function(e,r,t,o){r=r||"&",t=t||"=";var i={};if("string"!=typeof e||0===e.length)return i;e=e.split(r);var n=1e3;o&&"number"==typeof o.maxKeys&&(n=o.maxKeys);var l=e.length;n>0&&l>n&&(l=n);for(var c=0;c=0?(h=p.substr(0,m),u=p.substr(m+1)):(h=p,u=""),f=decodeURIComponent(h),d=decodeURIComponent(u),a(i,f)?s(i[f])?i[f].push(d):i[f]=[i[f],d]:i[f]=d}return i};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],48:[function(e,r,t){"use strict";function a(e,r){if(e.map)return e.map(r);for(var t=[],a=0;a",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),m=["'"].concat(p),v=["%","/","?",";","#"].concat(m),y=["/","?","#"],g={javascript:!0,"javascript:":!0},P={javascript:!0,"javascript:":!0},E={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=e("querystring");a.prototype.parse=function(e,r,t){if(!c.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),s=-1!==a&&a127?A+="x":A+=I[k];if(!A.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var D=O.slice(0,j),L=O.slice(j+1),Q=I.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);Q&&(D.push(Q[1]),L.unshift(Q[2])),L.length&&(i="/"+L.join(".")+i),this.hostname=D.join(".");break}}}this.hostname=this.hostname.length>255?"":this.hostname.toLowerCase(),_||(this.hostname=l.toASCII(this.hostname));var C=this.port?":"+this.port:"";this.host=(this.hostname||"")+C,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!g[d])for(var j=0,R=m.length;j0)&&t.host.split("@");j&&(t.auth=j.shift(),t.host=t.hostname=j.shift())}return t.search=e.search,t.query=e.query,c.isNull(t.pathname)&&c.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!b.length)return t.pathname=null,t.path=t.search?"/"+t.search:null,t.href=t.format(),t;for(var S=b.slice(-1)[0],$=(t.host||e.host||b.length>1)&&("."===S||".."===S)||""===S,x=0,_=b.length;_>=0;_--)S=b[_],"."===S?b.splice(_,1):".."===S?(b.splice(_,1),x++):x&&(b.splice(_,1),x--);if(!y&&!g)for(;x--;x)b.unshift("..");!y||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),$&&"/"!==b.join("/").substr(-1)&&b.push("");var O=""===b[0]||b[0]&&"/"===b[0].charAt(0);if(w){t.hostname=t.host=O?"":b.length?b.shift():"";var j=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@");j&&(t.auth=j.shift(),t.host=t.hostname=j.shift())}return y=y||t.host&&b.length,y&&!O&&b.unshift(""),b.length?t.pathname=b.join("/"):(t.pathname=null,t.path=null),c.isNull(t.pathname)&&c.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},a.prototype.parseHost=function(){var e=this.host,r=u.exec(e);r&&(r=r[0],":"!==r&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)}},{"./util":51,punycode:46,querystring:49}],51:[function(e,r,t){"use strict";r.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],ajv:[function(e,r,t){"use strict";function a(e){return g.test(e)}function s(r){function t(e,r){var t;if("string"==typeof e){if(!(t=S(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var a=R(e);t=a.validate||I(a)}var s=t(r);return!0===t.$async?"*"==D._opts.async?m(s):s:(D.errors=t.errors,s)}function v(e,r){var t=R(e,void 0,r);return t.validate||I(t)}function E(e,r,t,a){if(Array.isArray(e))for(var s=0;s=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function m(e){return+e!=e&&(e=0),o.alloc(+e)}function g(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return F(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return R(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return L(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function x(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,u=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}var c;if(i){var l=-1;for(c=n;ca&&(n=a-u),c=n;c>=0;c--){for(var p=!0,h=0;hi&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o239?4:s>223?3:s>191?2:1;if(i+a<=n){var u,c,l,p;switch(a){case 1:s<128&&(o=s);break;case 2:u=e[i+1],128===(192&u)&&(p=(31&s)<<6|63&u,p>127&&(o=p));break;case 3:u=e[i+1],c=e[i+2],128===(192&u)&&128===(192&c)&&(p=(15&s)<<12|(63&u)<<6|63&c,p>2047&&(p<55296||p>57343)&&(o=p));break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128===(192&u)&&128===(192&c)&&128===(192&l)&&(p=(15&s)<<18|(63&u)<<12|(63&c)<<6|63&l,p>65535&&p<1114112&&(o=p))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return T(r)}function T(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function I(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function j(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function M(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,i){return i||M(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function V(e,t,n,r,i){return i||M(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function U(e){if(e=q(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function q(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function Y(e){for(var t=[],n=0;n>8,i=n%256,s.push(i),s.push(r);return s}function J(e){return X.toByteArray(U(e))}function H(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e){return e!==e}var X=e("base64-js"),Z=e("ieee754"),K=e("isarray");n.Buffer=o,n.SlowBuffer=m,n.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return a(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return c(null,e,t,n)},o.allocUnsafe=function(e){return l(null,e)},o.allocUnsafeSlow=function(e){return l(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var s=i-r,a=n-t,u=Math.min(s,a),c=this.slice(r,i),l=e.slice(t,n),p=0;pi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return S(this,e,t,n);case"ascii":return k(this,e,t,n);case"latin1":case"binary":return A(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||$(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||$(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||$(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||$(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||$(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||$(e,t,this.length);for(var r=this[e],i=1,s=0;++s=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||$(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},o.prototype.readInt8=function(e,t){return t||$(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},o.prototype.readInt16LE=function(e,t){t||$(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||$(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||$(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||$(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||$(e,4,this.length),Z.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||$(e,4,this.length),Z.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||$(e,8,this.length),Z.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||$(e,8,this.length),Z.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+i]=e/s&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return V(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return V(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function s(e){var t,n,i,s,o,a,u=e.length;o=r(e),a=new p(3*u/4-o),i=o>0?u-4:u;var c=0;for(t=0,n=0;t>16&255,a[c++]=s>>8&255,a[c++]=255&s;return 2===o?(s=l[e.charCodeAt(t)]<<2|l[e.charCodeAt(t+1)]>>4,a[c++]=255&s):1===o&&(s=l[e.charCodeAt(t)]<<10|l[e.charCodeAt(t+1)]<<4|l[e.charCodeAt(t+2)]>>2,a[c++]=s>>8&255,a[c++]=255&s),a}function o(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function a(e,t,n){for(var r,i=[],s=t;sl?l:u+o));return 1===r?(t=e[n-1],i+=c[t>>2],i+=c[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=c[t>>10],i+=c[t>>4&63],i+=c[t<<2&63],i+="="),s.push(i),s.join("")}n.byteLength=i,n.toByteArray=s,n.fromByteArray=u;for(var c=[],l=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=h.length;f>1,l=-7,p=n?i-1:0,h=n?-1:1,f=e[t+p];for(p+=h,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+p],p+=h,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+p],p+=h,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:(f?-1:1)*(1/0);o+=Math.pow(2,r),s-=c}return(f?-1:1)*o*Math.pow(2,s-r)},n.write=function(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,d=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),t+=o+p>=1?h/u:h*Math.pow(2,1-p),t*u>=2&&(o++,u/=2),o+p>=l?(a=0,o=l):o+p>=1?(a=(t*u-1)*Math.pow(2,i),o+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(o=o<0;e[n+f]=255&o,f+=d,o/=256,c-=8);e[n+f-d]|=128*y}},{}],5:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],6:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),s="/"===o(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&s&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),a=o,u=0;u1)for(var n=1;n]*>)(.*)/i,/(.*)(<\/script>)(.*)/i],o=0,a=!0;t=t.split("\n");for(var u=0;u0){if(!a(e).isAsync)return t(e);delete e.async}return e.type="ReturnStatement",e.$mapped=!0,void(e.argument={type:"CallExpression",callee:_(i,[n]).$error,arguments:[e.argument]})}return a(e).isFunction?(r++,t(e),void r--):void t(e)}if(r>0){if(!a(e).isAsync)return t(e);delete e.async}
-return e.$mapped=!0,void(a(e.argument).isUnaryExpression&&"void"===e.argument.operator?e.argument=e.argument.argument:e.argument={type:"CallExpression",callee:_(i,[n]).$return,arguments:e.argument?[e.argument]:[]})},t)}function N(e,t){return Array.isArray(e)?e.map(function(e){return N(e,t)}):(m.treeWalker(e,function(e,t,n){if(t(),"ConditionalExpression"===e.type&&(c(e.alternate)||c(e.consequent))){f(S("condOp"));s(e,P(m.part("if ($0) return $1 ; return $2",[e.test,e.consequent,e.alternate]).body))}},t),e)}function $(e,t){return Array.isArray(e)?e.map(function(e){return $(e,t)}):(m.treeWalker(e,function(e,t,n){if(t(),"LogicalExpression"===e.type&&c(e.right)){var r,i=f(S("logical"+("&&"===e.operator?"And":"Or")));if("||"===e.operator)r="var $0; if (!($0 = $1)) {$0 = $2} return $0";else{if("&&"!==e.operator)throw new Error(b(e)+"Illegal logical operator: "+e.operator);r="var $0; if ($0 = $1) {$0 = $2} return $0"}s(e,P(m.part(r,[i,e.left,e.right]).body))}},t),e)}function B(e,t,n){if("SwitchCase"!==e.type&&a(e).isBlockStatement)for(var r=0;r0&&a(e).isAsync)return delete e.async,e.argument={type:"CallExpression",callee:"ThrowStatement"===e.type?ge.error:ge.return,arguments:e.argument?[e.argument]:[]},void(e.type="ReturnStatement");n(e)})}function ee(e,t){if(n.noRuntime)throw new Error("Nodent: 'noRuntime' option only compatible with -promise and -engine modes");return m.part("{ return (function*($return,$error){ $:body }).$asyncspawn(Promise,this) }",{return:ge.return,error:ge.error,asyncspawn:ge.asyncspawn,body:K(e).concat(t?[{type:"ReturnStatement",argument:ge.return}]:[])}).body[0]}function te(e){e.$asyncgetwarninig||(e.$asyncgetwarninig=!0,y(b(e)+"'async get "+r(e)+"(){...}' is non-standard. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification"))}function ne(e,t){function r(e,t){m.treeWalker(e,function(n,r,i){n!==e&&a(n).isFunction||(a(n).isAwait?t?(n.$hidden=!0,r()):(delete n.operator,n.delegate=!1,n.type="YieldExpression",r()):r())})}function o(e){var t=n.promises;n.promises=!0,C(e,!0),n.promises=t}function u(e){return"BlockStatement"!==e.body.type&&(e.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:e.body}]}),e}function c(e,n){n.$asyncexitwarninig||(n.$asyncexitwarninig=!0,y(b(e)+"'async "+{ReturnStatement:"return",ThrowStatement:"throw"}[e.type]+"' not possible in "+(t?"engine":"generator")+" mode. Using Promises for function at "+b(n)))}m.treeWalker(e,function(e,n,i){n();var l,p,h;if(a(e).isAsync&&a(e).isFunction){var f;(f=w(i[0].parent))&&a(f).isAsync&&"get"===i[0].parent.kind&&te(i[0].parent.key),(p=Q(e.body))?(c(p,e.body),o(e)):t?"get"!==i[0].parent.kind&&r(e,!0):(l=e,delete l.async,h=E(l),r(l,!1),l=u(l),l.body=ee(l.body.body,p),h&&V(l.body.body,[ve]),l.id&&"ExpressionStatement"===i[0].parent.type?(l.type="FunctionDeclaration",i[1].replace(l)):i[0].replace(l))}else(l=w(e))&&a(l).isAsync&&((p=Q(l))?(c(p,l),o(e)):t&&"get"!==e.kind||(t?o(e):(e.async=!1,h=E(l),r(l,!1),s(l,u(l)),l.body=ee(l.body.body,p)),h&&V(l.body.body,[ve])))});var l=i(n);return n.engine=!1,n.generators=!1,le(e),ae(e),D(e,l.engine),$(e),N(e),W(e,[q,J,I,j,B]),z(e,"warn"),n.engine=l.engine,n.generators=l.generators,e}function re(e,t,n){var r=[];return m.treeWalker(e,function(i,s,o){return i===e?s():t(i,o)?void r.push([].concat(o)):void(n||a(i).isScope||s())}),r}function ie(e,t){var n=[],r={};if(e=e.filter(function(e){return"ExportNamedDeclaration"!==e[0].parent.type}),e.length){var s={};e.forEach(function(e){function t(e){e in s?r[e]=o.declarations[u]:s[e]=o.declarations[u]}for(var n=e[0],o=n.self,a=(o.kind,[]),u=0;u1?{type:"SequenceExpression",expressions:a}:a[0];"For"!==n.parent.type.slice(0,3)&&(p={type:"ExpressionStatement",expression:p}),n.replace(p)}});var o=Object.keys(s);o.length&&(o=o.map(function(e){return{type:"VariableDeclarator",id:f(e),loc:s[e].loc,start:s[e].start,end:s[e].end}}),n[0]&&"VariableDeclaration"===n[0].type?n[0].declarations=n[0].declarations.concat(o):n.unshift({type:"VariableDeclaration",kind:t,declarations:o}))}return{decls:n,duplicates:r}}function se(e){if(!e)return[];if(Array.isArray(e))return e.reduce(function(e,t){return e.concat(se(t.id))},[]);switch(e.type){case"Identifier":return[e.name];case"ArrayPattern":return e.elements.reduce(function(e,t){return e.concat(se(t))},[]);case"ObjectPattern":return e.properties.reduce(function(e,t){return e.concat(se(t))},[]);case"ObjectProperty":case"Property":return se(e.value);case"RestElement":case"RestProperty":return se(e.argument)}}function oe(e){function t(e){y(b(e)+"Possible assignment to 'const "+r(e)+"'")}function n(e){switch(e.type){case"Identifier":"const"===i[e.name]&&t(e);break;case"ArrayPattern":e.elements.forEach(function(e){"const"===i[e.name]&&t(e)});break;case"ObjectPattern":e.properties.forEach(function(e){"const"===i[e.key.name]&&t(e)})}}var i={};m.treeWalker(e,function(e,t,r){var s=a(e).isBlockStatement;if(s){i=Object.create(i);for(var o=0;o=0){var r=n[0];return("left"!=r.field||"ForInStatement"!==r.parent.type&&"ForOfStatement"!==r.parent.type)&&("init"!=r.field||"ForStatement"!==r.parent.type||"const"!==t.kind&&"let"!==t.kind)}}}function n(e,t){return!("FunctionDeclaration"!==e.type||!e.id)&&(a(e).isAsync||!e.$continuation)}oe(e);var i=!1;return m.treeWalker(e,function(e,s,o){var u=i;if(i=i||he(e),a(e).isBlockStatement){if(c(e)){var l,p,h,d,m,g=!o[0].parent||a(o[0].parent).isScope;if(g){p=re(e,t(["const"]),!1);var v={},x={};p.forEach(function(e){e[0].self.declarations.forEach(function(e){se(e.id).forEach(function(t){v[t]||x[t]?(delete v[t],x[t]=e):v[t]=e})})}),p.forEach(function(e){for(var t=0;t=0&&"ReturnStatement"===r[1].self.type){var s=e.$thisCallName,o=i(ye[s].def.body.body);ye[s].$inlined=!0,a(r[1].self).isJump||o.push({type:"ReturnStatement"}),r[1].replace(o)}});var n=Object.keys(ye).map(function(e){return ye[e].$inlined&&ye[e].def});m.treeWalker(e,function(e,t,r){t(),n.indexOf(e)>=0&&r[0].remove()})}if("Program"!==e.type&&"module"!==e.sourceType||!u(e,function(e){return a(e).isES6},!0)){var r=he(e);!function(e){m.treeWalker(e,function(e,t,n){if("Program"===e.type||"FunctionDeclaration"===e.type||"FunctionExpression"===e.type){var i=r;if(r=r||he(e)){t();var s="Program"===e.type?e:e.body,o=re(s,function(e,t){if("FunctionDeclaration"===e.type)return t[0].parent!==s});o=o.map(function(e){return e[0].remove()}),[].push.apply(s.body,o)}else t();r=i}else t()})}(e)}return m.treeWalker(e,function(e,t,n){t(),Object.keys(e).filter(function(e){return"$"===e[0]}).forEach(function(t){delete e[t]})}),e}var ye={},me=1,ge={};Object.keys(n).filter(function(e){return"$"===e[0]}).forEach(function(e){ge[e.slice(1)]=f(n[e])});var ve=m.part("var $0 = arguments",[ge.arguments]).body[0];return n.engine?(e.ast=ce(e.ast,!0),e.ast=ne(e.ast,n.engine),e.ast=pe(e.ast),de(e.ast)):n.generators?(e.ast=ce(e.ast),e.ast=ne(e.ast),e.ast=pe(e.ast),de(e.ast)):(e.ast=ce(e.ast),C(e.ast)),n.babelTree&&m.treeWalker(e.ast,function(e,t,n){t(),"Literal"===e.type&&s(e,x(e.value))}),e}var m=e("./parser"),g=e("./output"),v={start:!0,end:!0,loc:!0,range:!0},b={getScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type?this.node.body.body:"Program"===this.node.type?this.node.body:null},isScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"Program"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type},isFunction:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type},isClass:function(){return"ClassDeclaration"===this.node.type||"ClassExpression"===this.node.type},isBlockStatement:function(){return"ClassBody"===this.node.type||"Program"===this.node.type||"BlockStatement"===this.node.type?this.node.body:"SwitchCase"===this.node.type&&this.node.consequent},isExpressionStatement:function(){return"ExpressionStatement"===this.node.type},isLiteral:function(){return"Literal"===this.node.type||"BooleanLiteral"===this.node.type||"RegExpLiteral"===this.node.type||"NumericLiteral"===this.node.type||"StringLiteral"===this.node.type||"NullLiteral"===this.node.type},isDirective:function(){return"ExpressionStatement"===this.node.type&&("StringLiteral"===this.node.expression.type||"Literal"===this.node.expression.type&&"string"==typeof this.node.expression.value)},isUnaryExpression:function(){return"UnaryExpression"===this.node.type},isAwait:function(){return"AwaitExpression"===this.node.type&&!this.node.$hidden},isAsync:function(){return this.node.async},isStatement:function(){return null!==this.node.type.match(/[a-zA-Z]+Declaration/)||null!==this.node.type.match(/[a-zA-Z]+Statement/)},isExpression:function(){return null!==this.node.type.match(/[a-zA-Z]+Expression/)},isLoop:function(){return"ForStatement"===this.node.type||"WhileStatement"===this.node.type||"DoWhileStatement"===this.node.type},isJump:function(){return"ReturnStatement"===this.node.type||"ThrowStatement"===this.node.type||"BreakStatement"===this.node.type||"ContinueStatement"===this.node.type},isES6:function(){switch(this.node.type){case"ExportNamedDeclaration":case"ExportSpecifier":case"ExportDefaultDeclaration":case"ExportAllDeclaration":case"ImportDeclaration":case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ArrowFunctionExpression":case"ForOfStatement":case"YieldExpression":case"Super":case"RestElement":case"RestProperty":case"SpreadElement":case"TemplateLiteral":case"ClassDeclaration":case"ClassExpression":return!0;case"VariableDeclaration":return this.node.kind&&"var"!==this.node.kind;case"FunctionDeclaration":case"FunctionExpression":return!!this.node.generator}}},x={};Object.keys(b).forEach(function(e){Object.defineProperty(x,e,{get:b[e]})}),t.exports={printNode:r,babelLiteralNode:h,asynchronize:function(e,t,n,r){try{return y(e,t,n,r)}catch(t){if(t instanceof SyntaxError){var i=e.origCode.substr(t.pos-t.loc.column);i=i.split("\n")[0],t.message+=" (nodent)\n"+i+"\n"+i.replace(/[\S ]/g,"-").substring(0,t.loc.column)+"^",t.stack=""}throw t}}}},{"./output":10,"./parser":11}],10:[function(e,t,n){"use strict";function r(e){var t=y[e.type]||y[e.type+e.operator]||y[e.type+e.operator+(e.prefix?"prefix":"")];return void 0!==t?t:20}
-function i(e,t,n){var r=this[n||e.type];r?r.call(this,e,t):t.write(e,"/*"+e.type+"?*/ "+t.sourceAt(e.start,e.end))}function s(e,t,n,i){2===i||r(n)0){this.out(e[0],t,e[0].type);for(var r=1,i=e.length;r>":13,"BinaryExpression>>>":13,"BinaryExpression<":12,"BinaryExpression<=":12,"BinaryExpression>":12,"BinaryExpression>=":12,BinaryExpressionin:12,BinaryExpressioninstanceof:12,"BinaryExpression==":11,"BinaryExpression===":11,"BinaryExpression!=":11,"BinaryExpression!==":11,"BinaryExpression&":10,"BinaryExpression^":9,"BinaryExpression|":8,"LogicalExpression&&":7,"LogicalExpression||":6,ConditionalExpression:5,AssignmentPattern:4,AssignmentExpression:4,yield:3,YieldExpression:3,SpreadElement:2,"comma-separated-list":1.5,SequenceExpression:1},m={type:"comma-separated-list"},g={out:i,expr:s,formatParameters:o,Program:function(e,t){var n,r,i=h(t.indent,t.indentLevel),s=t.lineEnd;n=e.body;for(var o=0,a=n.length;o0){t.write(null,s);for(var a=0,u=n.length;a0){this.out(n[0],t,"VariableDeclarator");for(var i=1;i0){for(var n=0;n0)for(var r=0;r "),"ObjectExpression"===e.body.type||"SequenceExpression"===e.body.type?(t.write(null,"("),this.out(e.body,t,e.body.type),t.write(null,")")):this.out(e.body,t,e.body.type)},ThisExpression:function(e,t){t.write(e,"this")},Super:function(e,t){t.write(e,"super")},RestElement:u=function(e,t){t.write(e,"..."),this.out(e.argument,t,e.argument.type)},SpreadElement:u,YieldExpression:function(e,t){t.write(e,e.delegate?"yield*":"yield"),e.argument&&(t.write(null," "),this.expr(t,e,e.argument))},AwaitExpression:function(e,t){t.write(e,"await "),this.expr(t,e,e.argument)},TemplateLiteral:function(e,t){var n,r=e.quasis,i=e.expressions;t.write(e,"`");for(var s=0,o=i.length;s0)for(var n=e.elements,r=n.length,i=0;;){var s=n[i];if(s&&this.expr(t,m,s),i+=1,(i=r)break;t.lineLength()>t.wrapColumn&&t.write(null,t.lineEnd,h(t.indent,t.indentLevel+1))}t.write(null,"]")},ArrayPattern:l,ObjectExpression:function(e,t){var n,r=h(t.indent,t.indentLevel++),i=t.lineEnd,s=r+t.indent;if(t.write(e,"{"),e.properties.length>0){t.write(null,i);for(var o=e.properties,a=o.length,u=0;n=o[u],t.write(null,s),this.out(n,t,"Property"),++ut.wrapColumn&&t.write(null,t.lineEnd,h(t.indent,t.indentLevel+1));t.write(null,i,r,"}")}else t.write(null,"}");t.indentLevel--},Property:function(e,t){e.method||"get"===e.kind||"set"===e.kind?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write(null,"["),this.out(e.key,t,e.key.type),t.write(null,"]")):this.out(e.key,t,e.key.type),t.write(null,": ")),this.expr(t,m,e.value))},ObjectPattern:function(e,t){if(t.write(e,"{"),e.properties.length>0)for(var n=e.properties,r=n.length,i=0;this.out(n[i],t,"Property"),++i0)for(var i=r.length,s=0;s1&&t.write(e," "),this.expr(t,e,e.argument,!0)):(this.expr(t,e,e.argument),t.write(e,e.operator))},UpdateExpression:function(e,t){e.prefix?(t.write(e,e.operator),this.out(e.argument,t,e.argument.type)):(this.out(e.argument,t,e.argument.type),t.write(e,e.operator))},BinaryExpression:c=function(e,t){var n=e.operator;"in"===n&&t.inForInit&&t.write(null,"("),this.expr(t,e,e.left),t.write(e," ",n," "),this.expr(t,e,e.right,"ArrowFunctionExpression"===e.right.type?2:0),"in"===n&&t.inForInit&&t.write(null,")")},LogicalExpression:c,AssignmentExpression:function(e,t){"ObjectPattern"===e.left.type&&t.write(null,"("),this.BinaryExpression(e,t),"ObjectPattern"===e.left.type&&t.write(null,")")},AssignmentPattern:function(e,t){this.expr(t,e,e.left),t.write(e," = "),this.expr(t,e,e.right)},ConditionalExpression:function(e,t){this.expr(t,e,e.test,!0),t.write(e," ? "),this.expr(t,e,e.consequent),t.write(null," : "),this.expr(t,e,e.alternate)},NewExpression:function(e,t){t.write(e,"new "),this.out(e,t,"CallExpression")},CallExpression:function(e,t){this.expr(t,e,e.callee,"ObjectExpression"===e.callee.type?2:0),t.write(e,"(");var n=e.arguments;if(n.length>0)for(var r=n.length,i=0;i=0&&r({self:i,parent:e,field:a[u],index:!0}):c instanceof Object&&i===c&&r({self:i,parent:e,field:a[u]})}})}return n||(n=[{self:e}],n.replace=function(e,t){n[e].replace(t)}),t(e,s,n),e}function s(e,t){var n=[],r={plugins:{asyncawait:{asyncExits:!0,awaitAnywhere:!0}},ecmaVersion:8,allowHashBang:!0,allowReturnOutsideFunction:!0,allowImportExportEverywhere:!0,locations:!0,onComment:n};if(t)for(var s in t)r[s]=t[s];var o=a.parse(e,r);return i(o,function(e,t,r){for(t();n.length&&e.loc&&e.loc.start.line>=n[0].loc.start.line&&e.loc.end.line>=n[0].loc.end.line;)e.$comments=e.$comments||[],e.$comments.push(n.shift())}),o}function o(e,t){function n(e,r){if(Array.isArray(r)&&!Array.isArray(e))throw new Error("Can't substitute an array for a node");return r=r||{},Object.keys(e).forEach(function(i){function s(e){return"function"==typeof e&&(e=e()),r=r.concat(e)}function o(e){return"function"==typeof e&&(e=e()),r[i]=e,r}if(!(e[i]instanceof Object))return r[i]=e[i];if(Array.isArray(e[i]))return r[i]=n(e[i],[]);var a;if(a=Array.isArray(r)?s:o,"Identifier"===e[i].type&&"$"===e[i].name[0])return a(t[e[i].name.slice(1)]);if("LabeledStatement"===e[i].type&&"$"===e[i].label.name){var u=e[i].body.expression;return a(t[u.name||u.value])}return a("LabeledStatement"===e[i].type&&"$$"===e[i].label.name.slice(0,2)?t[e[i].label.name.slice(2)](n(e[i]).body):n(e[i]))}),r}h[e]||(h[e]=s(e,{locations:!1,ranges:!1,onComment:null}));var r=n(h[e]);return{body:r.body,expr:"ExpressionStatement"===r.body[0].type?r.body[0].expression:null}}var a=e("acorn"),u=e("acorn/dist/walk"),c={AwaitExpression:function(e,t,n){n(e.argument,t,"Expression")},SwitchStatement:function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0;r=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(p,"$1 $3")),e.test(r)}function s(e,t,n,r){var i=new e.constructor(e.options,e.input,t);if(n)for(var s in n)i[s]=n[s];var o=e,a=i;return["inFunction","inAsyncFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in o&&(a[e]=o[e])}),r&&(i.options.preserveParens=!0),i.nextToken(),i}function o(e,t){var n=function(){};e.extend("initialContext",function(r){return function(){return this.options.ecmaVersion<7&&(n=function(t){e.raise(t.start,"async/await keywords only available when ecmaVersion>=7")}),this.reservedWords=new RegExp(this.reservedWords.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrict=new RegExp(this.reservedWordsStrict.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrictBind=new RegExp(this.reservedWordsStrictBind.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.inAsyncFunction=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),r.apply(this,arguments)}}),e.extend("shouldParseExportStatement",function(e){return function(){return!("name"!==this.type.label||"async"!==this.value||!i(c,this))||e.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,o=this.startLoc;if("name"===this.type.label)if(i(c,this,!0)){var a=this.inAsyncFunction;try{this.inAsyncFunction=!0,this.next();var l=this.parseStatement(n,r);return l.async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}finally{this.inAsyncFunction=a}}else if("object"==typeof t&&t.asyncExits&&i(u,this)){this.next();var l=this.parseStatement(n,r);return l.async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(t){var n=e.apply(this,arguments);return this.inAsyncFunction&&"await"===n.name&&0===arguments.length&&this.raise(n.start,"'await' is reserved within async functions"),n}}),e.extend("parseExprAtom",function(e){return function(i){var o,u=this.start,c=this.startLoc,p=e.apply(this,arguments);if("Identifier"===p.type)if("async"!==p.name||r(this,p.end)){if("await"===p.name){var h=this.startNodeAt(p.start,p.loc&&p.loc.start);if(this.inAsyncFunction)return o=this.parseExprSubscripts(),h.operator="await",h.argument=o,h=this.finishNodeAt(h,"AwaitExpression",o.end,o.loc&&o.loc.end),n(h),h;if(this.input.slice(p.end).match(l))return t.awaitAnywhere||"module"!==this.options.sourceType?p:this.raise(p.start,"'await' is reserved within modules");if("object"==typeof t&&t.awaitAnywhere&&(u=this.start,o=s(this,u-4).parseExprSubscripts(),o.end<=u))return o=s(this,u).parseExprSubscripts(),h.operator="await",h.argument=o,h=this.finishNodeAt(h,"AwaitExpression",o.end,o.loc&&o.loc.end),this.pos=o.end,this.end=o.end,this.endLoc=o.endLoc,this.next(),n(h),h;if(!t.awaitAnywhere&&"module"===this.options.sourceType)return this.raise(p.start,"'await' is reserved within modules")}}else{var f=this.inAsyncFunction;try{this.inAsyncFunction=!0;var d=this,y=!1,m={parseFunctionBody:function(e,t){try{var n=y;return y=!0,d.parseFunctionBody.apply(this,arguments)}finally{y=n}},raise:function(){try{return d.raise.apply(this,arguments)}catch(e){throw y?e:a}}};if(o=s(this,this.start,m,!0).parseExpression(),"SequenceExpression"===o.type&&(o=o.expressions[0]),"FunctionExpression"===o.type||"FunctionDeclaration"===o.type||"ArrowFunctionExpression"===o.type)return o=s(this,this.start,m).parseExpression(),"SequenceExpression"===o.type&&(o=o.expressions[0]),o.async=!0,o.start=u,o.loc&&(o.loc.start=c),o.range&&(o.range[0]=u),this.pos=o.end,this.end=o.end,this.endLoc=o.endLoc,this.next(),n(o),o}catch(e){if(e!==a)throw e}finally{this.inAsyncFunction=f}}return p}}),e.extend("finishNodeAt",function(e){return function(t,n,r,i){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("finishNode",function(e){return function(t,n){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}});e.extend("parsePropertyName",function(e){return function(t){var i=(t.key&&t.key.name,e.apply(this,arguments));return"Identifier"!==i.type||"async"!==i.name||r(this,i.end)||this.input.slice(i.end).match(l)||(h.test(this.input.slice(i.end))?(i=e.apply(this,arguments),t.__asyncValue=!0):(n(t),"set"===t.kind&&this.raise(i.start,"'set (value)' cannot be be async"),i=e.apply(this,arguments),"Identifier"===i.type&&"set"===i.name&&this.raise(i.start,"'set (value)' cannot be be async"),t.__asyncValue=!0)),i}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i;n.__asyncValue&&("constructor"===n.kind&&this.raise(n.start,"class constructor() cannot be be async"),i=this.inAsyncFunction,this.inAsyncFunction=!0);var s=e.apply(this,arguments);return this.inAsyncFunction=i,s}}),e.extend("parseMethod",function(e){return function(t){var n;this.__currentProperty&&this.__currentProperty.__asyncValue&&(n=this.inAsyncFunction,this.inAsyncFunction=!0);var r=e.apply(this,arguments);return this.inAsyncFunction=n,r}}),e.extend("parsePropertyValue",function(e){return function(t,n,r,i,s,o){var a=this.__currentProperty;this.__currentProperty=t;var u;t.__asyncValue&&(u=this.inAsyncFunction,this.inAsyncFunction=!0);var c=e.apply(this,arguments);return this.inAsyncFunction=u,this.__currentProperty=a,c}})}var a={},u=/^async[\t ]+(return|throw)/,c=/^async[\t ]+function/,l=/^\s*[():;]/,p=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g,h=/\s*(get|set)\s*\(/;t.exports=o},{}],14:[function(e,t,n){function r(e,t){return e.lineStart>=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(c,"$1 $3")),e.test(r)}function s(e,t,n){var r=new e.constructor(e.options,e.input,t);if(n)for(var i in n)r[i]=n[i];var s=e,o=r;return["inFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in s&&(o[e]=s[e])}),r.nextToken(),r}function o(e,t){t&&"object"==typeof t||(t={}),e.extend("parse",function(n){return function(){return this.inAsync=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),n.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,o=this.startLoc;if("name"===this.type.label&&t.asyncExits&&i(a,this)){this.next();var u=this.parseStatement(n,r);return u.async=!0,u.start=s,u.loc&&(u.loc.start=o),u.range&&(u.range[0]=s),u}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(n){return"module"===this.options.sourceType&&this.options.ecmaVersion>=8&&t.awaitAnywhere?e.call(this,!0):e.apply(this,arguments)}}),e.extend("parseExprAtom",function(e){var n={};return function(r){var i,o=this.start,a=(this.startLoc,e.apply(this,arguments));if("Identifier"===a.type&&"await"===a.name&&!this.inAsync&&t.awaitAnywhere){var u=this.startNodeAt(a.start,a.loc&&a.loc.start);o=this.start;var c={raise:function(){try{return pp.raise.apply(this,arguments)}catch(e){throw n}}};try{if(i=s(this,o-4,c).parseExprSubscripts(),i.end<=o)return i=s(this,o,c).parseExprSubscripts(),u.argument=i,u=this.finishNodeAt(u,"AwaitExpression",i.end,i.loc&&i.loc.end),this.pos=i.end,this.end=i.end,this.endLoc=i.endLoc,this.next(),u}catch(e){if(e===n)return a;throw e}}return a}});var n={undefined:!0,get:!0,set:!0,static:!0,async:!0,constructor:!0};e.extend("parsePropertyName",function(e){return function(t){var i=t.key&&t.key.name,s=e.apply(this,arguments);return"get"===this.value&&(t.__maybeStaticAsyncGetter=!0),n[this.value]?s:("Identifier"!==s.type||"async"!==s.name&&"async"!==i||r(this,s.end)||this.input.slice(s.end).match(u)?delete t.__maybeStaticAsyncGetter:"set"===t.kind||"set"===s.name?this.raise(s.start,"'set (value)' cannot be be async"):(this.__isAsyncProp=!0,s=e.apply(this,arguments),"Identifier"===s.type&&"set"===s.name&&this.raise(s.start,"'set (value)' cannot be be async")),s)}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i=e.apply(this,arguments);return n.__maybeStaticAsyncGetter&&(delete n.__maybeStaticAsyncGetter,n.kind="get"),i}}),e.extend("parseFunctionBody",function(e){return function(t,n){var r=this.inAsync;this.__isAsyncProp&&(t.async=!0,this.inAsync=!0,delete this.__isAsyncProp);var i=e.apply(this,arguments);return this.inAsync=r,i}})}var a=/^async[\t ]+(return|throw)/,u=/^\s*[):;]/,c=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g;t.exports=o},{}],15:[function(e,t,n){!function(e,r){"object"==typeof n&&void 0!==t?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r(e.acorn=e.acorn||{})}(this,function(e){"use strict";function t(e,t){for(var n=65536,r=0;re)return!1;if(n+=t[r+1],n>=e)return!0}}function n(e,n){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&A.test(String.fromCharCode(e)):n!==!1&&t(e,C)))}function r(e,n){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&_.test(String.fromCharCode(e)):n!==!1&&(t(e,C)||t(e,L)))))}function i(e,t){return new P(e,{beforeExpr:!0,binop:t})}function s(e,t){return void 0===t&&(t={}),t.keyword=e,O[e]=new P(e,t)}function o(e){return 10===e||13===e||8232===e||8233===e}function a(e){return"[object Array]"===Object.prototype.toString.call(e)}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){for(var n=1,r=0;;){$.lastIndex=r;var i=$.exec(e);if(!(i&&i.index=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),a(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return a(t.onComment)&&(t.onComment=p(t,t.onComment)),t}function p(e,t){return function(n,r,i,s,o,a){var u={type:n?"Block":"Line",value:r,start:i,end:s};e.locations&&(u.loc=new M(this,o,a)),e.ranges&&(u.range=[i,s]),t.push(u)}}function h(e){return new RegExp("^("+e.replace(/ /g,"|")+")$")}function f(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}function d(e,t,n,r){try{return new RegExp(e,t)}catch(e){if(void 0!==n)throw e instanceof SyntaxError&&r.raise(n,"Error parsing regular expression: "+e.message),e}}function y(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(1023&e)+56320))}function m(e,t){return new U(t,e).parse()}function g(e,t,n){var r=new U(n,e,t);return r.nextToken(),r.parseExpression()}function v(e,t){return new U(t,e)}function b(t,n,r){e.parse_dammit=t,e.LooseParser=n,e.pluginsLoose=r}var x={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},w="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",E={5:w,6:w+" const class extends export import super"
-},S="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",k="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",A=new RegExp("["+S+"]"),_=new RegExp("["+S+k+"]");S=k=null;var C=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],L=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],P=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null},T={beforeExpr:!0},R={startsExpr:!0},O={},F={num:new P("num",R),regexp:new P("regexp",R),string:new P("string",R),name:new P("name",R),eof:new P("eof"),bracketL:new P("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new P("]"),braceL:new P("{",{beforeExpr:!0,startsExpr:!0}),braceR:new P("}"),parenL:new P("(",{beforeExpr:!0,startsExpr:!0}),parenR:new P(")"),comma:new P(",",T),semi:new P(";",T),colon:new P(":",T),dot:new P("."),question:new P("?",T),arrow:new P("=>",T),template:new P("template"),ellipsis:new P("...",T),backQuote:new P("`",R),dollarBraceL:new P("${",{beforeExpr:!0,startsExpr:!0}),eq:new P("=",{beforeExpr:!0,isAssign:!0}),assign:new P("_=",{beforeExpr:!0,isAssign:!0}),incDec:new P("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new P("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=",6),relational:i(">",7),bitShift:i("<>>",8),plusMin:new P("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),starstar:new P("**",{beforeExpr:!0}),_break:s("break"),_case:s("case",T),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",T),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",T),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",R),_if:s("if"),_return:s("return",T),_switch:s("switch"),_throw:s("throw",T),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",R),_super:s("super",R),_class:s("class"),_extends:s("extends",T),_export:s("export"),_import:s("import"),_null:s("null",R),_true:s("true",R),_false:s("false",R),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},N=/\r\n?|\n|\u2028|\u2029/,$=new RegExp(N.source,"g"),B=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,I=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,j=function(e,t){this.line=e,this.column=t};j.prototype.offset=function(e){return new j(this.line,this.column+e)};var M=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)},D={ecmaVersion:7,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{}},V={},U=function(e,t,n){this.options=e=l(e),this.sourceFile=e.sourceFile,this.keywords=h(E[e.ecmaVersion>=6?6:5]);var r="";if(!e.allowReserved){for(var i=e.ecmaVersion;!(r=x[i]);i--);"module"==e.sourceType&&(r+=" await")}this.reservedWords=h(r);var s=(r?r+" ":"")+x.strict;this.reservedWordsStrict=h(s),this.reservedWordsStrictBind=h(s+" "+x.strictBind),this.input=String(t),this.containsEsc=!1,this.loadPlugins(e.plugins),n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(N).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=F.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.strict=this.inModule="module"===e.sourceType,this.potentialArrowAt=-1,this.inFunction=this.inGenerator=this.inAsync=!1,this.yieldPos=this.awaitPos=0,this.labels=[],0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2)};U.prototype.isKeyword=function(e){return this.keywords.test(e)},U.prototype.isReservedWord=function(e){return this.reservedWords.test(e)},U.prototype.extend=function(e,t){this[e]=t(this[e])},U.prototype.loadPlugins=function(e){var t=this;for(var n in e){var r=V[n];if(!r)throw new Error("Plugin '"+n+"' not found");r(t,e[n])}},U.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};var q=U.prototype;q.isUseStrict=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.raw.slice(1,-1)},q.eat=function(e){return this.type===e&&(this.next(),!0)},q.isContextual=function(e){return this.type===F.name&&this.value===e},q.eatContextual=function(e){return this.value===e&&this.eat(F.name)},q.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},q.canInsertSemicolon=function(){return this.type===F.eof||this.type===F.braceR||N.test(this.input.slice(this.lastTokEnd,this.start))},q.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},q.semicolon=function(){this.eat(F.semi)||this.insertSemicolon()||this.unexpected()},q.afterTrailingComma=function(e,t){if(this.type==e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},q.expect=function(e){this.eat(e)||this.unexpected()},q.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var W=function(){this.shorthandAssign=0,this.trailingComma=0};q.checkPatternErrors=function(e,t){var n=e&&e.trailingComma;if(!t)return!!n;n&&this.raise(n,"Comma is not permitted after the rest element")},q.checkExpressionErrors=function(e,t){var n=e&&e.shorthandAssign;if(!t)return!!n;n&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns")},q.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos=6&&(e.sourceType=this.options.sourceType),this.finishNode(e,"Program")};var Y={kind:"loop"},G={kind:"switch"};z.isLet=function(){if(this.type!==F.name||this.options.ecmaVersion<6||"let"!=this.value)return!1;I.lastIndex=this.pos;var e=I.exec(this.input),t=this.pos+e[0].length,i=this.input.charCodeAt(t);if(91===i||123==i)return!0;if(n(i,!0)){for(var s=t+1;r(this.input.charCodeAt(s),!0);++s);var o=this.input.slice(t,s);if(!this.isKeyword(o))return!0}return!1},z.isAsyncFunction=function(){if(this.type!==F.name||this.options.ecmaVersion<8||"async"!=this.value)return!1;I.lastIndex=this.pos;var e=I.exec(this.input),t=this.pos+e[0].length;return!(N.test(this.input.slice(this.pos,t))||"function"!==this.input.slice(t,t+8)||t+8!=this.input.length&&r(this.input.charAt(t+8)))},z.parseStatement=function(e,t,n){var r,i=this.type,s=this.startNode();switch(this.isLet()&&(i=F._var,r="let"),i){case F._break:case F._continue:return this.parseBreakContinueStatement(s,i.keyword);case F._debugger:return this.parseDebuggerStatement(s);case F._do:return this.parseDoStatement(s);case F._for:return this.parseForStatement(s);case F._function:return!e&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1);case F._class:return e||this.unexpected(),this.parseClass(s,!0);case F._if:return this.parseIfStatement(s);case F._return:return this.parseReturnStatement(s);case F._switch:return this.parseSwitchStatement(s);case F._throw:return this.parseThrowStatement(s);case F._try:return this.parseTryStatement(s);case F._const:case F._var:return r=r||this.value,e||"var"==r||this.unexpected(),this.parseVarStatement(s,r);case F._while:return this.parseWhileStatement(s);case F._with:return this.parseWithStatement(s);case F.braceL:return this.parseBlock();case F.semi:return this.parseEmptyStatement(s);case F._export:case F._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===F._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction()&&e)return this.next(),this.parseFunctionStatement(s,!0);var o=this.value,a=this.parseExpression();return i===F.name&&"Identifier"===a.type&&this.eat(F.colon)?this.parseLabeledStatement(s,o,a):this.parseExpressionStatement(s,a)}},z.parseBreakContinueStatement=function(e,t){var n=this,r="break"==t;this.next(),this.eat(F.semi)||this.insertSemicolon()?e.label=null:this.type!==F.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var i=0;i=6?this.eat(F.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},z.parseForStatement=function(e){if(this.next(),this.labels.push(Y),this.expect(F.parenL),this.type===F.semi)return this.parseFor(e,null);var t=this.isLet();if(this.type===F._var||this.type===F._const||t){var n=this.startNode(),r=t?"let":this.value;return this.next(),this.parseVar(n,!0,r),this.finishNode(n,"VariableDeclaration"),!(this.type===F._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==n.declarations.length||"var"!==r&&n.declarations[0].init?this.parseFor(e,n):this.parseForIn(e,n)}var i=new W,s=this.parseExpression(!0,i);return this.type===F._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.checkPatternErrors(i,!0),this.toAssignable(s),this.checkLVal(s),this.parseForIn(e,s)):(this.checkExpressionErrors(i,!0),this.parseFor(e,s))},z.parseFunctionStatement=function(e,t){return this.next(),this.parseFunction(e,!0,!1,t)},z.isFunction=function(){return this.type===F._function||this.isAsyncFunction()},z.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!this.strict&&this.isFunction()),e.alternate=this.eat(F._else)?this.parseStatement(!this.strict&&this.isFunction()):null,this.finishNode(e,"IfStatement")},z.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(F.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},z.parseSwitchStatement=function(e){var t=this;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(F.braceL),this.labels.push(G);for(var n,r=!1;this.type!=F.braceR;)if(t.type===F._case||t.type===F._default){var i=t.type===F._case;n&&t.finishNode(n,"SwitchCase"),e.cases.push(n=t.startNode()),n.consequent=[],t.next(),i?n.test=t.parseExpression():(r&&t.raiseRecoverable(t.lastTokStart,"Multiple default clauses"),r=!0,n.test=null),t.expect(F.colon)}else n||t.unexpected(),n.consequent.push(t.parseStatement(!0));return n&&this.finishNode(n,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},z.parseThrowStatement=function(e){return this.next(),N.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var J=[];z.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===F._catch){var t=this.startNode();this.next(),this.expect(F.parenL),t.param=this.parseBindingAtom(),this.checkLVal(t.param,!0),this.expect(F.parenR),t.body=this.parseBlock(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(F._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},z.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},z.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Y),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"WhileStatement")},z.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},z.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},z.parseLabeledStatement=function(e,t,n){for(var r=this,i=0;i