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: readme.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ Uses [ESLint](http://eslint.org) underneath, so issues regarding rules should be
27
27
- No need to specify file paths to lint as it lints all JS files except for [commonly ignored paths](#ignores).
28
28
-[Config overrides per files/globs.](#config-overrides)
29
29
- Includes many useful ESLint plugins, like [`unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn), [`import`](https://github.com/benmosher/eslint-plugin-import), [`ava`](https://github.com/avajs/eslint-plugin-ava), [`node`](https://github.com/mysticatea/eslint-plugin-node) and more.
30
+
- Automatically enable or disable rules based on the [engines](https://docs.npmjs.com/files/package.json#engines) of your `package.json`.
30
31
- Caches results between runs for much better performance.
31
32
- Super simple to add XO to a project with `$ xo --init`.
32
33
- Fix many issues automagically with `$ xo --fix`.
@@ -61,6 +62,7 @@ $ xo --help
61
62
--space Use space indent instead of tabs [Default: 2]
62
63
--no-semicolon Prevent use of semicolons
63
64
--prettier Conform to Prettier code style
65
+
--node-version Range of Node version to support
64
66
--plugin Include third-party plugins [Can be set multiple times]
65
67
--extend Extend defaults with a custom config [Can be set multiple times]
66
68
--open Open files with issues in your editor
@@ -206,6 +208,14 @@ Default: `false`
206
208
207
209
Format code with [Prettier](https://github.com/prettier/prettier). The [Prettier options](https://prettier.io/docs/en/options.html) will be read from the [Prettier config](https://prettier.io/docs/en/configuration.html)
208
210
211
+
### nodeVersion
212
+
213
+
Type: `string`, `boolean`<br>
214
+
Default: value of `engines.node` key in the project `package.json`
215
+
216
+
Enable rules specific to the Node versions within the range configured.
217
+
If set to `false` no rules specific to a Node version will be enable.
218
+
209
219
### plugins
210
220
211
221
Type: `Array`
@@ -303,6 +313,25 @@ If you have a directory structure with nested `package.json` files and you want
303
313
304
314
Put a `package.json` with your config at the root and add `"xo": false` to the `package.json` in your bundled packages.
305
315
316
+
### Transpilation
317
+
318
+
If some files in your project are transpiled in order to support an older Node version you can use the [Config Overrides](#config-overrides) option to set a specific [nodeVersion](#nodeversion) target to these files.
319
+
320
+
For example, if your project targets Node 4 (your `package.json` is configured with `engines.node` 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:
0 commit comments