Skip to content

Commit 9b9d761

Browse files
committed
Require Node.js 8 and improve error messages and docs
1 parent d440daa commit 9b9d761

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+290
-211
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ node_js:
33
- '12'
44
- '10'
55
- '8'
6-
- '6'
76
matrix:
87
include:
9-
- node_js: 12
8+
- node_js: '12'
109
env: INTEGRATION=true
1110
script:
1211
- if [ $INTEGRATION == true ]; then npm run integration; else npm test; fi

docs/rules/catch-error-name.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,26 @@ somePromise.catch(_ => {
8282
You can set the `name` option like this:
8383

8484
```js
85-
"unicorn/catch-error-name": ["error", {"name": "error"}]
85+
"unicorn/catch-error-name": [
86+
"error",
87+
{
88+
"name": "error"
89+
}
90+
]
8691
```
8792

8893
### caughtErrorsIgnorePattern
8994

9095
```js
91-
"unicorn/catch-error-name": ["error", {"caughtErrorsIgnorePattern": "^_$"}]
96+
"unicorn/catch-error-name": [
97+
"error",
98+
{
99+
"caughtErrorsIgnorePattern": "^_$"
100+
}
101+
]
92102
```
93103

94-
This option lets you specify a regex pattern for matches to ignore. Default is `^_$`.
104+
This option lets you specify a regex pattern for matches to ignore. The default is `^_$`.
95105

96106
With `^unicorn$`, this would fail:
97107

docs/rules/custom-error-definition.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Enforces the only valid way of `Error` subclassing. It works with any super class that ends in `Error`.
44

5+
This rule is fixable.
6+
57

68
## Fail
79

docs/rules/error-message.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ throw new TypeError();
1818
```
1919

2020
```js
21-
const err = new Error();
22-
throw err;
21+
const error = new Error();
22+
throw error;
2323
```
2424

2525

@@ -34,6 +34,6 @@ throw new TypeError('Foo');
3434
```
3535

3636
```js
37-
const err = new Error('Foo');
38-
throw err;
37+
const error = new Error('Foo');
38+
throw error;
3939
```

docs/rules/escape-case.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Enforces defining escape sequence values with uppercase characters rather than lowercase ones. This promotes readability by making the escaped value more distinguishable from the identifier.
44

5+
This rule is fixable.
6+
57

68
## Fail
79

docs/rules/explicit-length-check.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Enforce explicitly checking the length of a value array in an `if` condition, rather than checking the truthiness of the length.
44

5+
This rule is partly fixable.
6+
57
### Fail
68

79
```js
@@ -57,5 +59,3 @@ The `non-zero` option can be configured with one of the following:
5759
- Enforces non-zero to be checked with: `array.length > 0`
5860
- `greater-than-or-equal`
5961
- Enforces non-zero to be checked with: `array.length >= 1`
60-
61-
It can be auto-fixed.

docs/rules/filename-case.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Enforce a case style for filenames
22

3-
Enforces all linted files to have their names in a certain case style. Default is `kebabCase`.
3+
Enforces all linted files to have their names in a certain case style. The default is `kebabCase`.
44

55
Files named `index.js` are ignored as they can't change case (Only a problem with `pascalCase`).
66

@@ -35,5 +35,10 @@ Files named `index.js` are ignored as they can't change case (Only a problem wit
3535
You can set the `case` option like this:
3636

3737
```js
38-
"unicorn/filename-case": ["error", {"case": "kebabCase"}]
38+
"unicorn/filename-case": [
39+
"error",
40+
{
41+
"case": "kebabCase"
42+
}
43+
]
3944
```

docs/rules/import-index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Enforces importing index file with `.` instead of `./`, `./index` or `./index.js`.
44

5+
This rule is fixable.
6+
57

68
## Fail
79

docs/rules/new-for-builtins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
They work the same, but `new` should be preferred for consistency with other constructors.
44

5-
Enforces the use of `new` for following builtins.
5+
Enforces the use of `new` for following builtins:
66

77
- `Object`
88
- `Array`

docs/rules/no-array-instanceof.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The `instanceof Array` check doesn't work across realms/contexts, for example, frames/windows in browsers or the `vm` module in Node.js.
44

5+
This rule is fixable.
6+
57

68
## Fail
79

0 commit comments

Comments
 (0)