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 12, 2020
1 parent ab3e01a commit d7fa875
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 97 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -5,6 +5,5 @@ language: node_js
node_js:
- '12'
- '10'
- '8'
after_success:
- './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls'
49 changes: 23 additions & 26 deletions config/plugins.js
Expand Up @@ -32,13 +32,14 @@ module.exports = {
rules: {
'no-use-extend-native/no-use-extend-native': 'error',

// TODO: Enable this again in the minor XO release.
// TODO: Enable this again in the next XO release.
// Start with just a manual list of some non-contreversial abbreviations.
//
// TODO: Remove this override at some point.
// It's just here to ease users into readable variable names.
// 'unicorn/prevent-abbreviations': [
// 'error',
// {
// checkProperties: false,
// checkFilenames: false,
// replacements: {
// args: false,
Expand All @@ -53,16 +54,14 @@ module.exports = {
// ],
'unicorn/prevent-abbreviations': 'off',

// TODO: Enable this when targeting Node.js 12.
'unicorn/prefer-flat-map': 'off',

// TODO: Remove this override when the rule is more stable.
'unicorn/consistent-function-scoping': 'off',

// TODO: Change the rule default for this.
'unicorn/expiring-todo-comments': [
'error',
{
allowWarningComments: true
}
],
// TODO: Enable it again when the bugs are fixed.
'unicorn/regex-shorthand': 'off',

// TODO: Temporarily disabled as the rule is buggy.
'function-call-argument-newline': 'off',
Expand All @@ -77,10 +76,7 @@ module.exports = {
'promise/no-new-statics': 'error',
'promise/no-return-in-finally': 'error',
'promise/valid-params': 'error',

// TODO: Enable this when XO targets Node.js 8
// 'promise/prefer-await-to-then': 'error',

'promise/prefer-await-to-then': 'error',
'import/default': 'error',
'import/export': 'error',
'import/extensions': [
Expand Down Expand Up @@ -220,7 +216,8 @@ module.exports = {
'error',
'always'
],
// TODO: Enable these when XO targets Node.js 10

// Enable these when targeting Node.js 12.
// 'node/prefer-global/text-decoder': [
// 'error',
// 'always'
Expand All @@ -229,14 +226,17 @@ module.exports = {
// 'error',
// 'always'
// ],
// 'node/prefer-global/url-search-params': [
// 'error',
// 'always'
// ],
// 'node/prefer-global/url': [
// 'error',
// 'always'
// ]

'node/prefer-global/url-search-params': [
'error',
'always'
],
'node/prefer-global/url': [
'error',
'always'
],

// Enable these when targeting Node.js 12.
// 'node/prefer-promises/dns': 'error',
// 'node/prefer-promises/fs': 'error',

Expand All @@ -253,9 +253,6 @@ module.exports = {
// 'eslint-comments/no-unlimited-disable': 'error',

'eslint-comments/no-unused-disable': 'error',
'eslint-comments/no-unused-enable': 'error',

// Disabled by default, enabled only in Node.js >= 11 in option-manager.js
'unicorn/prefer-flat-map': 'off'
'eslint-comments/no-unused-enable': 'error'
}
};
24 changes: 0 additions & 24 deletions lib/options-manager.js
Expand Up @@ -66,12 +66,6 @@ const DEFAULT_CONFIG = {
* With `engines.node` set to `>=8` the rule `plugin/rule` will be used with the config `{prop: 'node-8-conf'}`.
*/
const ENGINE_RULES = {
'promise/prefer-await-to-then': {
'7.6.0': 'error'
},
'prefer-object-spread': {
'8.3.0': 'error'
},
'node/prefer-global/text-decoder': {
'11.0.0': [
'error',
Expand All @@ -84,30 +78,12 @@ const ENGINE_RULES = {
'always'
]
},
'node/prefer-global/url-search-params': {
'10.0.0': [
'error',
'always'
]
},
'node/prefer-global/url': {
'10.0.0': [
'error',
'always'
]
},
'node/prefer-promises/dns': {
'12.0.0': 'error'
},
'node/prefer-promises/fs': {
'12.0.0': 'error'
},
'no-useless-catch': {
'10.0.0': 'error'
},
'prefer-named-capture-group': {
'10.0.0': 'error'
},
'unicorn/prefer-flat-map': {
'11.0.0': 'error'
}
Expand Down
37 changes: 19 additions & 18 deletions package.json
Expand Up @@ -4,14 +4,15 @@
"description": "JavaScript linter with great defaults",
"license": "MIT",
"repository": "xojs/xo",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bin": "cli.js",
"engines": {
"node": ">=8"
"node": ">=10.18"

This comment has been minimized.

Copy link
@rschick

rschick Sep 18, 2020

@sindresorhus just curious if there is a reason you didn't use ">=10"?

This comment has been minimized.

Copy link
@sindresorhus

sindresorhus Sep 18, 2020

Author Member

Yes, it requires features only available on Node 10.18 or later.

},
"scripts": {
"test": "eslint --quiet . && nyc ava"
Expand Down Expand Up @@ -50,18 +51,18 @@
"dependencies": {
"arrify": "^2.0.1",
"debug": "^4.1.0",
"eslint": "^6.4.0",
"eslint-config-prettier": "^6.3.0",
"eslint-config-xo": "^0.27.1",
"eslint-formatter-pretty": "^2.0.0",
"eslint-plugin-ava": "^9.0.0",
"eslint-plugin-eslint-comments": "^3.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-no-use-extend-native": "^0.4.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-unicorn": "^12.0.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-config-xo": "^0.28.0",
"eslint-formatter-pretty": "^3.0.1",
"eslint-plugin-ava": "^10.0.1",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-no-use-extend-native": "^0.4.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-unicorn": "^16.1.1",
"find-cache-dir": "^3.0.0",
"get-stdin": "^7.0.0",
"globby": "^9.0.0",
Expand All @@ -75,18 +76,18 @@
"prettier": "^1.15.2",
"resolve-cwd": "^3.0.0",
"resolve-from": "^5.0.0",
"semver": "^6.3.0",
"semver": "^7.1.3",
"slash": "^3.0.0",
"update-notifier": "^3.0.1"
"update-notifier": "^4.0.0"
},
"devDependencies": {
"ava": "^1.1.0",
"coveralls": "^3.0.6",
"eslint-config-xo-react": "^0.20.0",
"eslint-config-xo-react": "^0.22.0",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^2.0.1",
"execa": "^1.0.0",
"nyc": "^14.1.1",
"execa": "^4.0.0",
"nyc": "^15.0.0",
"pify": "^4.0.0",
"proxyquire": "^2.1.3",
"temp-write": "^4.0.0"
Expand Down

0 comments on commit d7fa875

Please sign in to comment.