Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 1, 2020
1 parent d98c277 commit d2ffe2c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -2,7 +2,6 @@ language: node_js
node_js:
- '12'
- '10'
- '8'
cache:
npm: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -54,6 +54,7 @@ module.exports = {
'unicorn/prefer-node-remove': 'error',
'unicorn/prefer-query-selector': 'error',
'unicorn/prefer-reflect-apply': 'error',
// TODO: Enable this by default when it's shipping in a Node.js LTS version.
'unicorn/prefer-replace-all': 'off',
'unicorn/prefer-spread': 'error',
'unicorn/prefer-starts-ends-with': 'error',
Expand Down
11 changes: 7 additions & 4 deletions package.json
Expand Up @@ -11,7 +11,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && nyc ava",
Expand Down Expand Up @@ -48,7 +48,7 @@
"regexpp": "^3.0.0",
"reserved-words": "^0.1.2",
"safe-regex": "^2.1.1",
"semver": "^6.3.0"
"semver": "^7.1.2"
},
"devDependencies": {
"@lubien/fixture-beta-package": "^1.0.0-beta.1",
Expand All @@ -60,10 +60,10 @@
"del": "^5.1.0",
"eslint": "^6.8.0",
"eslint-ava-rule-tester": "^4.0.0",
"eslint-plugin-eslint-plugin": "2.1.0",
"eslint-plugin-eslint-plugin": "^2.2.1",
"execa": "^4.0.0",
"listr": "^0.14.3",
"nyc": "^14.1.1",
"nyc": "^15.0.0",
"outdent": "^0.7.0",
"pify": "^4.0.1",
"tempy": "^0.3.0",
Expand All @@ -85,6 +85,9 @@
"extends": [
"plugin:eslint-plugin/all"
],
"rules": {
"prefer-named-capture-group": "off"
},
"overrides": [
{
"files": "rules/utils/*.js",
Expand Down
6 changes: 1 addition & 5 deletions readme.md
Expand Up @@ -8,14 +8,12 @@ You might want to check out [XO](https://github.com/xojs/xo), which includes thi

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


## Install

```console
$ npm install --save-dev eslint eslint-plugin-unicorn
```


## Usage

Configure it in `package.json`.
Expand Down Expand Up @@ -87,7 +85,6 @@ Configure it in `package.json`.
}
```


## Rules

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

**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).


## Maintainers

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

###### Former

- [Jeroen Engels](https://github.com/jfmengels)
- [Sam Verschueren](https://github.com/SamVerschueren)
18 changes: 12 additions & 6 deletions rules/no-zero-fractions.js
Expand Up @@ -5,11 +5,11 @@ const MESSAGE_ZERO_FRACTION = 'Don\'t use a zero fraction in the number.';
const MESSAGE_DANGLING_DOT = 'Don\'t use a dangling dot in the number.';

// Groups:
// 1. Integer part
// 2. Dangling dot or dot with zeroes
// 3. Dot with digits except last zeroes
// 4. Scientific notation
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
// 1. Integer part.
// 2. Dangling dot or dot with zeroes.
// 3. Dot with digits except last zeroes.
// 4. Scientific notation.
const RE_DANGLINGDOT_OR_ZERO_FRACTIONS = /^(?<integerPart>[+-]?\d*)(?:(?<dotAndZeroes>\.0*)|(?<dotAndDigits>\.\d*[1-9])0+)(?<scientificNotationSuffix>e[+-]?\d+)?$/;

const create = context => {
return {
Expand All @@ -23,7 +23,13 @@ const create = context => {
return;
}

const [, integerPart, dotAndZeroes, dotAndDigits, scientificNotationSuffix] = match;
const {
integerPart,
dotAndZeroes,
dotAndDigits,
scientificNotationSuffix
} = match.groups;

const isDanglingDot = dotAndZeroes === '.';

context.report({
Expand Down

0 comments on commit d2ffe2c

Please sign in to comment.