You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config/plugins.js
-3Lines changed: 0 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -185,9 +185,6 @@ module.exports = {
185
185
// }
186
186
// ],
187
187
188
-
// Disabled as the rule doesn't allow to exclude compiled sources
189
-
// 'node/no-unsupported-features': 'error',
190
-
191
188
'node/process-exit-as-throw': 'error',
192
189
193
190
// Disabled as the rule doesn't exclude scripts executed with `node` but not referenced in 'bin'. See https://github.com/mysticatea/eslint-plugin-node/issues/96
Copy file name to clipboardExpand all lines: readme.md
+18-5Lines changed: 18 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -336,23 +336,37 @@ Put a `package.json` with your config at the root and omit the `xo` property in
336
336
337
337
### Transpilation
338
338
339
-
If some files in your project are transpiled in order to support an older Node.js version, you can use the [config overrides](#config-overrides) option to set a specific [`nodeVersion`](#nodeversion) target for these files.
339
+
If some files in your project are transpiled in order to support an older Node.js version, you can use the [config overrides](#config-overrides) option to set a specific [`nodeVersion`](#nodeversion)to target your sources files.
340
340
341
-
For example, if your project targets Node.js 4 (your `package.json` is configured with `engines.node` set to `>=4`) and you are using [AVA](https://github.com/avajs/ava), then your test files are automatically transpiled. You can override `nodeVersion` for the tests files:
341
+
For example, if your project targets Node.js 8 but you want to use the latest JavaScript syntax as supported in Node.js 12:
342
+
1. Set the `engines.node` property of your `package.json` to `>=8`
343
+
2. Configure [Babel](https://babeljs.io) to transpile your source files (in `src` directory in this example)
344
+
3. Make sure to include the transpiled files in your published package with the [`files`](https://docs.npmjs.com/files/package.json#files) and [`main`](https://docs.npmjs.com/files/package.json#main) properties of your `package.json`
345
+
4. Configure the XO `overrides` option to set `nodeVersion` to `>=12` for your source files directory
342
346
343
347
```json
344
348
{
349
+
"engines": {
350
+
"node": ">=8"
351
+
},
352
+
"scripts": {
353
+
"build": "babel src --out-dir dist"
354
+
},
355
+
"main": "dist/index.js",
356
+
"files": ["dist/**/*.js"],
345
357
"xo": {
346
358
"overrides": [
347
359
{
348
-
"files": "{test,tests,spec,__tests__}/**/*.js",
349
-
"nodeVersion": ">=9"
360
+
"files": "{src}/**/*.js",
361
+
"nodeVersion": ">=12"
350
362
}
351
363
]
352
364
}
353
365
}
354
366
```
355
367
368
+
This way your `package.json` will contain the actual minimum Node.js version supported by your published code, but XO will lint your source code as if it targets Node.js 12.
369
+
356
370
### Including files ignored by default
357
371
358
372
To include files that XO [ignores by default](https://github.com/xojs/xo/blob/master/lib/constants.js#L1), add them as negative globs in the `ignores` option:
@@ -367,7 +381,6 @@ To include files that XO [ignores by default](https://github.com/xojs/xo/blob/ma
0 commit comments