eslint-plugin-chai-friendly 0.3.5 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ ; EditorConfig file: https://EditorConfig.org
2
+ ; Install the "EditorConfig" plugin into your editor to use
3
+
4
+ root = true
5
+
6
+ [*]
7
+ charset = utf-8
8
+ end_of_line = lf
9
+ insert_final_newline = true
10
+ indent_style = space
11
+ indent_size = 2
12
+ trim_trailing_whitespace = true
package/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ node_modules
package/.eslintrc.js ADDED
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ extends: ['eslint:recommended'],
3
+ env: {
4
+ node: true
5
+ }
6
+ };
package/README.md CHANGED
@@ -1,33 +1,38 @@
1
1
  # eslint-plugin-chai-friendly
2
2
 
3
- This plugin overrides `no-unused-expressions` to make it friendly towards chai expect statements.
3
+ [![npm](https://img.shields.io/npm/v/eslint-plugin-chai-friendly.svg)](https://www.npmjs.com/package/eslint-plugin-chai-friendly) [![npm](https://img.shields.io/npm/dm/eslint-plugin-chai-friendly.svg)](https://www.npmjs.com/package/eslint-plugin-chai-friendly)
4
+
5
+ This plugin overrides `no-unused-expressions` to make it friendly towards chai `expect` and `should` statements.
6
+
4
7
  ```javascript
5
8
  // this
6
9
  expect(foo).to.be.true;
10
+ foo.should.be.true;
7
11
 
8
12
  // instead of this
9
13
  expect(foo).to.be.true; // eslint-disable-line no-unused-expressions
14
+ foo.should.be.true; // eslint-disable-line no-unused-expressions
10
15
  ```
11
16
 
12
17
  ## Installation
13
18
 
14
19
  You'll first need to install [ESLint](http://eslint.org):
15
20
 
16
- ```
17
- $ npm i eslint --save-dev
21
+ ```bash
22
+ npm i eslint --save-dev
18
23
  ```
19
24
 
20
25
  Next, install `eslint-plugin-chai-friendly`:
21
26
 
22
- ```
23
- $ npm install eslint-plugin-chai-friendly --save-dev
27
+ ```bash
28
+ npm install eslint-plugin-chai-friendly --save-dev
24
29
  ```
25
30
 
26
31
  **Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-chai-friendly` globally.
27
32
 
28
33
  ## Usage
29
34
 
30
- Add `chai-friendly` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
35
+ Add `chai-friendly` to the plugins section of your `.eslintrc.*` configuration file. You can omit the `eslint-plugin-` prefix:
31
36
 
32
37
  ```json
33
38
  {
@@ -49,11 +54,28 @@ Then disable original `no-unused-expressions` rule and configure chai-friendly r
49
54
  }
50
55
  ```
51
56
 
52
- ## Supported Rules
57
+ If you don't need to tweak the above rule settings, you can instead
58
+ just add the following to your config file's `extends` and the above
59
+ will be applied automatically:
60
+
61
+ ```json
62
+ {
63
+ "extends": ["plugin:chai-friendly/recommended"]
64
+ }
65
+ ```
66
+
67
+ ## Options
53
68
 
54
- * chai-friendly/no-unused-expressions
69
+ This rule, in its default state, does not require any arguments. If you would like to enable one or more of the following you may pass an object with the options set as follows:
55
70
 
71
+ - `allowShortCircuit` set to `true` will allow you to use short circuit evaluations in your expressions (Default: `false`).
72
+ - `allowTernary` set to `true` will enable you to use ternary operators in your expressions similarly to short circuit evaluations (Default: `false`).
73
+ - `allowTaggedTemplates` set to `true` will enable you to use tagged template literals in your expressions (Default: `false`).
56
74
 
75
+ These options allow unused expressions only if all of the code paths either directly change the state (for example, assignment statement) or could have side effects (for example, function call).
57
76
 
77
+ More info in the original rule's [docs](http://eslint.org/docs/rules/no-unused-expressions#options).
58
78
 
79
+ ## Supported Rules
59
80
 
81
+ - `chai-friendly/no-unused-expressions`
package/lib/index.js CHANGED
@@ -5,10 +5,16 @@
5
5
  "use strict";
6
6
 
7
7
  module.exports = {
8
+ configs: {
9
+ recommended: {
10
+ plugins: ['chai-friendly'],
11
+ rules: {
12
+ 'chai-friendly/no-unused-expressions': 'error',
13
+ 'no-unused-expressions': 'off'
14
+ }
15
+ }
16
+ },
8
17
  rules: {
9
18
  'no-unused-expressions': require('./rules/no-unused-expressions')
10
19
  }
11
20
  };
12
-
13
-
14
-
@@ -26,6 +26,9 @@ module.exports = {
26
26
  },
27
27
  allowTernary: {
28
28
  type: "boolean"
29
+ },
30
+ allowTaggedTemplates: {
31
+ type: "boolean"
29
32
  }
30
33
  },
31
34
  additionalProperties: false
@@ -35,7 +38,9 @@ module.exports = {
35
38
  create: function (context) {
36
39
  var config = context.options[0] || {},
37
40
  allowShortCircuit = config.allowShortCircuit || false,
38
- allowTernary = config.allowTernary || false;
41
+ allowTernary = config.allowTernary || false,
42
+ allowTaggedTemplates = config.allowTaggedTemplates || false;
43
+
39
44
 
40
45
  /**
41
46
  * @param {ASTNode} node - any node
@@ -101,6 +106,10 @@ module.exports = {
101
106
  }
102
107
  }
103
108
 
109
+ if (allowTaggedTemplates && node.type === "TaggedTemplateExpression") {
110
+ return true;
111
+ }
112
+
104
113
  return /^(?:Assignment|Call|New|Update|Yield|Await)Expression$/.test(node.type) ||
105
114
  (node.type === "UnaryExpression" && ["delete", "void"].indexOf(node.operator) >= 0);
106
115
  }
@@ -111,7 +120,7 @@ module.exports = {
111
120
  * @param {ASTNode} node - any node
112
121
  * @returns {boolean} whether the given node is a chai expectation
113
122
  */
114
- function isChaiExpectation(node) {
123
+ function isChaiExpectCall(node) {
115
124
  var expression = node.expression;
116
125
  if (expression.type !== 'MemberExpression') {
117
126
  return false;
@@ -143,15 +152,59 @@ module.exports = {
143
152
 
144
153
  // Stop search, expect(...) not found
145
154
  return null;
146
- };
155
+ }
156
+
157
+ /**
158
+ * Determines whether or not a given node is a chai's should statement.
159
+ * e.g. foo.should.eventually.be.true;
160
+ * @param {ASTNode} node - any node
161
+ * @returns {boolean} whether the given node is a chai should statement
162
+ */
163
+ function isChaiShouldCall(node) {
164
+ var expression = node.expression;
165
+ if (expression.type !== 'MemberExpression') {
166
+ return false;
167
+ }
168
+
169
+ var hasShouldCall = Boolean(findShouldCall(expression.object));
170
+
171
+ return hasShouldCall;
172
+ }
173
+
174
+ /**
175
+ * Searches for the chai obj.should call down the AST.
176
+ * @param {ASTNode} node - any node
177
+ * @returns {ASTNode} obj.should call expression or null
178
+ */
179
+ function findShouldCall(node) {
180
+ // Found obj.should call, return the node
181
+ if (node.type === 'MemberExpression' && node.property && node.property.name === 'should') {
182
+ return node;
183
+ }
184
+
185
+ // Continue search up the AST if it's a member call
186
+ if (node.type === 'MemberExpression') {
187
+ return findShouldCall(node.object);
188
+ }
189
+ if (node.type === 'CallExpression') {
190
+ return findShouldCall(node.callee);
191
+ }
192
+
193
+ // Stop search, obj.should not found
194
+ return null;
195
+ }
147
196
 
148
197
 
149
198
  return {
150
199
  ExpressionStatement: function(node) {
151
- if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors()) && !isChaiExpectation(node)) {
200
+ var valid = isValidExpression(node.expression)
201
+ || isDirective(node, context.getAncestors())
202
+ || isChaiExpectCall(node)
203
+ || isChaiShouldCall(node);
204
+ if (!valid) {
152
205
  context.report(node, "Expected an assignment or function call and instead saw an expression.");
153
206
  }
154
207
  }
155
208
  };
156
209
  }
157
- };
210
+ };
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @fileoverview Flag expressions in statement position that do not side effect
3
+ * @author Michael Ficarra
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Rule Definition
9
+ //------------------------------------------------------------------------------
10
+
11
+ module.exports = {
12
+ meta: {
13
+ docs: {
14
+ description: "disallow unused expressions",
15
+ category: "Best Practices",
16
+ recommended: false
17
+ },
18
+
19
+ schema: [
20
+ {
21
+ type: "object",
22
+ properties: {
23
+ allowShortCircuit: {
24
+ type: "boolean"
25
+ },
26
+ allowTernary: {
27
+ type: "boolean"
28
+ },
29
+ allowTaggedTemplates: {
30
+ type: "boolean"
31
+ }
32
+ },
33
+ additionalProperties: false
34
+ }
35
+ ]
36
+ },
37
+
38
+ create(context) {
39
+ const config = context.options[0] || {},
40
+ allowShortCircuit = config.allowShortCircuit || false,
41
+ allowTernary = config.allowTernary || false,
42
+ allowTaggedTemplates = config.allowTaggedTemplates || false;
43
+
44
+ /**
45
+ * @param {ASTNode} node - any node
46
+ * @returns {boolean} whether the given node structurally represents a directive
47
+ */
48
+ function looksLikeDirective(node) {
49
+ return node.type === "ExpressionStatement" &&
50
+ node.expression.type === "Literal" && typeof node.expression.value === "string";
51
+ }
52
+
53
+ /**
54
+ * @param {Function} predicate - ([a] -> Boolean) the function used to make the determination
55
+ * @param {a[]} list - the input list
56
+ * @returns {a[]} the leading sequence of members in the given list that pass the given predicate
57
+ */
58
+ function takeWhile(predicate, list) {
59
+ for (let i = 0; i < list.length; ++i) {
60
+ if (!predicate(list[i])) {
61
+ return list.slice(0, i);
62
+ }
63
+ }
64
+ return list.slice();
65
+ }
66
+
67
+ /**
68
+ * @param {ASTNode} node - a Program or BlockStatement node
69
+ * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body
70
+ */
71
+ function directives(node) {
72
+ return takeWhile(looksLikeDirective, node.body);
73
+ }
74
+
75
+ /**
76
+ * @param {ASTNode} node - any node
77
+ * @param {ASTNode[]} ancestors - the given node's ancestors
78
+ * @returns {boolean} whether the given node is considered a directive in its current position
79
+ */
80
+ function isDirective(node, ancestors) {
81
+ const parent = ancestors[ancestors.length - 1],
82
+ grandparent = ancestors[ancestors.length - 2];
83
+
84
+ return (parent.type === "Program" || parent.type === "BlockStatement" &&
85
+ (/Function/.test(grandparent.type))) &&
86
+ directives(parent).indexOf(node) >= 0;
87
+ }
88
+
89
+ /**
90
+ * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags.
91
+ * @param {ASTNode} node - any node
92
+ * @returns {boolean} whether the given node is a valid expression
93
+ */
94
+ function isValidExpression(node) {
95
+ if (allowTernary) {
96
+
97
+ // Recursive check for ternary and logical expressions
98
+ if (node.type === "ConditionalExpression") {
99
+ return isValidExpression(node.consequent) && isValidExpression(node.alternate);
100
+ }
101
+ }
102
+
103
+ if (allowShortCircuit) {
104
+ if (node.type === "LogicalExpression") {
105
+ return isValidExpression(node.right);
106
+ }
107
+ }
108
+
109
+ if (allowTaggedTemplates && node.type === "TaggedTemplateExpression") {
110
+ return true;
111
+ }
112
+
113
+ return /^(?:Assignment|Call|New|Update|Yield|Await)Expression$/.test(node.type) ||
114
+ (node.type === "UnaryExpression" && ["delete", "void"].indexOf(node.operator) >= 0);
115
+ }
116
+
117
+ return {
118
+ ExpressionStatement(node) {
119
+ if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) {
120
+ context.report({ node, message: "Expected an assignment or function call and instead saw an expression." });
121
+ }
122
+ }
123
+ };
124
+
125
+ }
126
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-chai-friendly",
3
- "version": "0.3.5",
3
+ "version": "0.5.0",
4
4
  "description": "This plugin makes 'no-unused-expressions' rule friendly towards chai expect statements.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -18,8 +18,12 @@
18
18
  "url": "https://github.com/ihordiachenko/eslint-plugin-chai-friendly/issues"
19
19
  },
20
20
  "author": "Ihor Diachenko",
21
+ "contributors": [
22
+ "Brett Zamir"
23
+ ],
21
24
  "main": "lib/index.js",
22
25
  "scripts": {
26
+ "lint": "eslint .",
23
27
  "test": "mocha tests --recursive"
24
28
  },
25
29
  "dependencies": {},
@@ -27,8 +31,8 @@
27
31
  "eslint": ">=3.0.0"
28
32
  },
29
33
  "devDependencies": {
30
- "eslint": "~3.11.0",
31
- "mocha": "^3.0.2"
34
+ "eslint": "~6.6.0",
35
+ "mocha": "^6.2.2"
32
36
  },
33
37
  "engines": {
34
38
  "node": ">=0.10.0"
@@ -27,16 +27,16 @@ ruleTester.run("no-unused-expressions", rule, {
27
27
  "f(); g()",
28
28
  "i++",
29
29
  "a()",
30
- { code: "a && a()", options: [{ allowShortCircuit: true }] },
31
- { code: "a() || (b = c)", options: [{ allowShortCircuit: true }] },
32
- { code: "a ? b() : c()", options: [{ allowTernary: true }] },
33
- { code: "a ? b() || (c = d) : e()", options: [{ allowShortCircuit: true, allowTernary: true }] },
30
+ { code: "a && a()", options: [{ allowShortCircuit: true }]},
31
+ { code: "a() || (b = c)", options: [{ allowShortCircuit: true }]},
32
+ { code: "a ? b() : c()", options: [{ allowTernary: true }]},
33
+ { code: "a ? b() || (c = d) : e()", options: [{ allowShortCircuit: true, allowTernary: true }]},
34
34
  "delete foo.bar",
35
35
  "void new C",
36
36
  "\"use strict\";",
37
37
  "\"directive one\"; \"directive two\"; f();",
38
38
  "function foo() {\"use strict\"; return true; }",
39
- { code: "var foo = () => {\"use strict\"; return true; }", parserOptions: { ecmaVersion: 6 } },
39
+ { code: "var foo = () => {\"use strict\"; return true; }", parserOptions: { ecmaVersion: 6 }},
40
40
  "function foo() {\"directive one\"; \"directive two\"; f(); }",
41
41
  "function foo() { var foo = \"use strict\"; return true; }",
42
42
  {
@@ -61,33 +61,77 @@ ruleTester.run("no-unused-expressions", rule, {
61
61
  options: [{ allowTernary: true }],
62
62
  parserOptions: { ecmaVersion: 8 }
63
63
  },
64
- "expect(foo).to.be.ok",
65
- "expect(foo).be.ok",
66
- "expect(foo).to.eventually().be.ok"
64
+ {
65
+ code: "tag`tagged template literal`",
66
+ options: [{ allowTaggedTemplates: true }],
67
+ parserOptions: { ecmaVersion: 6 }
68
+ },
69
+ {
70
+ code: "shouldNotBeAffectedByAllowTemplateTagsOption()",
71
+ options: [{ allowTaggedTemplates: true }],
72
+ parserOptions: { ecmaVersion: 6 }
73
+ },
74
+ // Chai statements
75
+ "expect(foo).to.be.true;",
76
+ "expect(foo).to.have.a.property('bar').which.is.true",
77
+ "foo.should.be.true;",
78
+ "foo.inner.nested.should.be.true",
79
+ "foo.should.have.a.property('bar').which.is.true;"
67
80
  ],
68
81
  invalid: [
69
- { code: "0", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
70
- { code: "a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
71
- { code: "f(), 0", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
72
- { code: "{0}", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
73
- { code: "[]", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
74
- { code: "a && b();", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
75
- { code: "a() || false", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] },
76
- { code: "a || (b = c)", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] },
77
- { code: "a ? b() || (c = d) : e", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] },
82
+ { code: "0", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
83
+ { code: "a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
84
+ { code: "f(), 0", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
85
+ { code: "{0}", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
86
+ { code: "[]", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
87
+ { code: "a && b();", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
88
+ { code: "a() || false", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }]},
89
+ { code: "a || (b = c)", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }]},
90
+ { code: "a ? b() || (c = d) : e", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }]},
78
91
  { code: "a && b()", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }]},
79
92
  { code: "a ? b() : c()", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }]},
80
- { code: "a || b", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
81
- { code: "a() && b", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
82
- { code: "a ? b : 0", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
83
- { code: "a ? b : c()", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
84
- { code: "foo.bar;", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
85
- { code: "!a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
86
- { code: "+a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
87
- { code: "\"directive one\"; f(); \"directive two\";", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
88
- { code: "function foo() {\"directive one\"; f(); \"directive two\"; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
89
- { code: "if (0) { \"not a directive\"; f(); }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
90
- { code: "function foo() { var foo = true; \"use strict\"; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] },
91
- { code: "var foo = () => { var foo = true; \"use strict\"; }", parserOptions: { ecmaVersion: 6 }, errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}] }
93
+ { code: "a || b", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
94
+ { code: "a() && b", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
95
+ { code: "a ? b : 0", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
96
+ { code: "a ? b : c()", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
97
+ { code: "foo.bar;", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
98
+ { code: "!a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
99
+ { code: "+a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
100
+ { code: "\"directive one\"; f(); \"directive two\";", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
101
+ { code: "function foo() {\"directive one\"; f(); \"directive two\"; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
102
+ { code: "if (0) { \"not a directive\"; f(); }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
103
+ { code: "function foo() { var foo = true; \"use strict\"; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
104
+ { code: "var foo = () => { var foo = true; \"use strict\"; }", parserOptions: { ecmaVersion: 6}, errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement"}]},
105
+ {
106
+ code: "`untagged template literal`",
107
+ options: [{ allowTaggedTemplates: true }],
108
+ parserOptions: { ecmaVersion: 6},
109
+ errors: ["Expected an assignment or function call and instead saw an expression."]
110
+ },
111
+ {
112
+ code: "`untagged template literal`",
113
+ options: [{ allowTaggedTemplates: false }],
114
+ parserOptions: { ecmaVersion: 6},
115
+ errors: ["Expected an assignment or function call and instead saw an expression."]
116
+ },
117
+ {
118
+ code: "tag`tagged template literal`",
119
+ options: [{ allowTaggedTemplates: false }],
120
+ parserOptions: { ecmaVersion: 6},
121
+ errors: ["Expected an assignment or function call and instead saw an expression."]
122
+ },
123
+ {
124
+ code: "`untagged template literal`",
125
+ parserOptions: { ecmaVersion: 6 },
126
+ errors: ["Expected an assignment or function call and instead saw an expression."]
127
+ },
128
+ {
129
+ code: "tag`tagged template literal`",
130
+ parserOptions: { ecmaVersion: 6 },
131
+ errors: ["Expected an assignment or function call and instead saw an expression."]
132
+ },
133
+ // Chai statements
134
+ { code: "foo.expect('bar').not.to.pass;", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }]},
135
+ { code: "should.not.pass;", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] },
92
136
  ]
93
- });
137
+ });
package/.npmignore DELETED
@@ -1 +0,0 @@
1
- ./tests