eslint-plugin-chai-friendly 0.4.1 → 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 +12 -0
- package/.eslintignore +1 -0
- package/.eslintrc.js +6 -0
- package/README.md +12 -2
- package/lib/index.js +9 -3
- package/lib/rules/no-unused-expressions.js +3 -3
- package/package.json +7 -3
- package/tests/lib/rules/no-unused-expressions.js +1 -1
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
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ npm install eslint-plugin-chai-friendly --save-dev
|
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
35
|
-
Add `chai-friendly` to the plugins section of your `.eslintrc
|
|
35
|
+
Add `chai-friendly` to the plugins section of your `.eslintrc.*` configuration file. You can omit the `eslint-plugin-` prefix:
|
|
36
36
|
|
|
37
37
|
```json
|
|
38
38
|
{
|
|
@@ -54,6 +54,16 @@ Then disable original `no-unused-expressions` rule and configure chai-friendly r
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
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
|
+
|
|
57
67
|
## Options
|
|
58
68
|
|
|
59
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:
|
|
@@ -68,4 +78,4 @@ More info in the original rule's [docs](http://eslint.org/docs/rules/no-unused-e
|
|
|
68
78
|
|
|
69
79
|
## Supported Rules
|
|
70
80
|
|
|
71
|
-
- chai-friendly/no-unused-expressions
|
|
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
|
-
|
|
@@ -152,7 +152,7 @@ module.exports = {
|
|
|
152
152
|
|
|
153
153
|
// Stop search, expect(...) not found
|
|
154
154
|
return null;
|
|
155
|
-
}
|
|
155
|
+
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* Determines whether or not a given node is a chai's should statement.
|
|
@@ -192,7 +192,7 @@ module.exports = {
|
|
|
192
192
|
|
|
193
193
|
// Stop search, obj.should not found
|
|
194
194
|
return null;
|
|
195
|
-
}
|
|
195
|
+
}
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
return {
|
|
@@ -207,4 +207,4 @@ module.exports = {
|
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
};
|
|
210
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-chai-friendly",
|
|
3
|
-
"version": "0.
|
|
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": "~
|
|
31
|
-
"mocha": "^
|
|
34
|
+
"eslint": "~6.6.0",
|
|
35
|
+
"mocha": "^6.2.2"
|
|
32
36
|
},
|
|
33
37
|
"engines": {
|
|
34
38
|
"node": ">=0.10.0"
|
|
@@ -134,4 +134,4 @@ ruleTester.run("no-unused-expressions", rule, {
|
|
|
134
134
|
{ code: "foo.expect('bar').not.to.pass;", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }]},
|
|
135
135
|
{ code: "should.not.pass;", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] },
|
|
136
136
|
]
|
|
137
|
-
});
|
|
137
|
+
});
|