Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-07-30 23:46:34 +0300
committerAnna Henningsen <anna@addaleax.net>2017-08-07 16:17:26 +0300
commit9f319d5dfbd651094c43cbeed25af4c782f2468d (patch)
tree2d837e6bca23aa8c8c294d8666a2c51af30e3f84 /tools
parent5094f2c2994efccfbf39bf8a985c77ec9a41bb4d (diff)
tools: replace assert-throw-arguments custom lint
The functionality of ESLint custom rule assert-throws-arguments can be replaced with no-restricted-syntax entries. PR-URL: https://github.com/nodejs/node/pull/14547 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/eslint-rules/assert-throws-arguments.js60
1 files changed, 0 insertions, 60 deletions
diff --git a/tools/eslint-rules/assert-throws-arguments.js b/tools/eslint-rules/assert-throws-arguments.js
deleted file mode 100644
index 3b51188c0c8..00000000000
--- a/tools/eslint-rules/assert-throws-arguments.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @fileoverview Check that assert.throws is never called with a string as
- * second argument.
- * @author Michaël Zasso
- */
-'use strict';
-
-//------------------------------------------------------------------------------
-// Rule Definition
-//------------------------------------------------------------------------------
-
-function checkThrowsArguments(context, node) {
- if (node.callee.type === 'MemberExpression' &&
- node.callee.object.name === 'assert' &&
- node.callee.property.name === 'throws') {
- const args = node.arguments;
- if (args.length > 3) {
- context.report({
- message: 'Too many arguments',
- node: node
- });
- } else if (args.length > 1) {
- const error = args[1];
- if (error.type === 'Literal' && typeof error.value === 'string' ||
- error.type === 'TemplateLiteral') {
- context.report({
- message: 'Unexpected string as second argument',
- node: error
- });
- }
- } else {
- if (context.options[0].requireTwo) {
- context.report({
- message: 'Expected at least two arguments',
- node: node
- });
- }
- }
- }
-}
-
-module.exports = {
- meta: {
- schema: [
- {
- type: 'object',
- properties: {
- requireTwo: {
- type: 'boolean'
- }
- }
- }
- ]
- },
- create: function(context) {
- return {
- CallExpression: (node) => checkThrowsArguments(context, node)
- };
- }
-};