Skip to content

Commit d2ffe2c

Browse files
committed
Require Node.js 10
1 parent d98c277 commit d2ffe2c

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: node_js
22
node_js:
33
- '12'
44
- '10'
5-
- '8'
65
cache:
76
npm: false
87
matrix:

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module.exports = {
5454
'unicorn/prefer-node-remove': 'error',
5555
'unicorn/prefer-query-selector': 'error',
5656
'unicorn/prefer-reflect-apply': 'error',
57+
// TODO: Enable this by default when it's shipping in a Node.js LTS version.
5758
'unicorn/prefer-replace-all': 'off',
5859
'unicorn/prefer-spread': 'error',
5960
'unicorn/prefer-starts-ends-with': 'error',

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"url": "sindresorhus.com"
1212
},
1313
"engines": {
14-
"node": ">=8"
14+
"node": ">=10"
1515
},
1616
"scripts": {
1717
"test": "xo && nyc ava",
@@ -48,7 +48,7 @@
4848
"regexpp": "^3.0.0",
4949
"reserved-words": "^0.1.2",
5050
"safe-regex": "^2.1.1",
51-
"semver": "^6.3.0"
51+
"semver": "^7.1.2"
5252
},
5353
"devDependencies": {
5454
"@lubien/fixture-beta-package": "^1.0.0-beta.1",
@@ -60,10 +60,10 @@
6060
"del": "^5.1.0",
6161
"eslint": "^6.8.0",
6262
"eslint-ava-rule-tester": "^4.0.0",
63-
"eslint-plugin-eslint-plugin": "2.1.0",
63+
"eslint-plugin-eslint-plugin": "^2.2.1",
6464
"execa": "^4.0.0",
6565
"listr": "^0.14.3",
66-
"nyc": "^14.1.1",
66+
"nyc": "^15.0.0",
6767
"outdent": "^0.7.0",
6868
"pify": "^4.0.1",
6969
"tempy": "^0.3.0",
@@ -85,6 +85,9 @@
8585
"extends": [
8686
"plugin:eslint-plugin/all"
8787
],
88+
"rules": {
89+
"prefer-named-capture-group": "off"
90+
},
8891
"overrides": [
8992
{
9093
"files": "rules/utils/*.js",

readme.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ You might want to check out [XO](https://github.com/xojs/xo), which includes thi
88

99
[**Propose or contribute a new rule ➡**](.github/contributing.md)
1010

11-
1211
## Install
1312

1413
```console
1514
$ npm install --save-dev eslint eslint-plugin-unicorn
1615
```
1716

18-
1917
## Usage
2018

2119
Configure it in `package.json`.
@@ -87,7 +85,6 @@ Configure it in `package.json`.
8785
}
8886
```
8987

90-
9188
## Rules
9289

9390
- [catch-error-name](docs/rules/catch-error-name.md) - Enforce a specific parameter name in catch clauses.
@@ -160,15 +157,14 @@ See the [ESLint docs](http://eslint.org/docs/user-guide/configuring#extending-co
160157

161158
**Note**: This config will also enable the correct [parser options](http://eslint.org/docs/user-guide/configuring#specifying-parser-options) and [environment](http://eslint.org/docs/user-guide/configuring#specifying-environments).
162159

163-
164160
## Maintainers
165161

166162
- [Sindre Sorhus](https://github.com/sindresorhus)
167163
- [Adam Babcock](https://github.com/MrHen)
168164
- [futpib](https://github.com/futpib)
169-
- [Sam Verschueren](https://github.com/SamVerschueren)
170165
- [Fisker Cheung](https://github.com/fisker)
171166

172167
###### Former
173168

174169
- [Jeroen Engels](https://github.com/jfmengels)
170+
- [Sam Verschueren](https://github.com/SamVerschueren)

rules/no-zero-fractions.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ const MESSAGE_ZERO_FRACTION = 'Don\'t use a zero fraction in the number.';
55
const MESSAGE_DANGLING_DOT = 'Don\'t use a dangling dot in the number.';
66

77
// Groups:
8-
// 1. Integer part
9-
// 2. Dangling dot or dot with zeroes
10-
// 3. Dot with digits except last zeroes
11-
// 4. Scientific notation
12-
const RE_DANGLINGDOT_OR_ZERO_FRACTIONS = /^([+-]?\d*)(?:(\.0*)|(\.\d*[1-9])0+)(e[+-]?\d+)?$/; // TODO: Possibly use named capture groups when targeting Node.js 10
8+
// 1. Integer part.
9+
// 2. Dangling dot or dot with zeroes.
10+
// 3. Dot with digits except last zeroes.
11+
// 4. Scientific notation.
12+
const RE_DANGLINGDOT_OR_ZERO_FRACTIONS = /^(?<integerPart>[+-]?\d*)(?:(?<dotAndZeroes>\.0*)|(?<dotAndDigits>\.\d*[1-9])0+)(?<scientificNotationSuffix>e[+-]?\d+)?$/;
1313

1414
const create = context => {
1515
return {
@@ -23,7 +23,13 @@ const create = context => {
2323
return;
2424
}
2525

26-
const [, integerPart, dotAndZeroes, dotAndDigits, scientificNotationSuffix] = match;
26+
const {
27+
integerPart,
28+
dotAndZeroes,
29+
dotAndDigits,
30+
scientificNotationSuffix
31+
} = match.groups;
32+
2733
const isDanglingDot = dotAndZeroes === '.';
2834

2935
context.report({

0 commit comments

Comments
 (0)