UNPKG

2.57 kBMarkdownView Raw
1# eslint-config-xo
2
3> ESLint [shareable config](https://eslint.org/docs/developer-guide/shareable-configs.html) for [XO](https://github.com/xojs/xo)
4
5This is for advanced users. [You probably want to use XO directly.](#use-the-xo-cli-instead)
6
7See [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) for some additional useful rules.
8
9**Use the [XO issue tracker](https://github.com/xojs/xo/issues) instead of this one.**
10
11## Install
12
13```
14$ npm install --save-dev eslint-config-xo
15```
16
17## Usage
18
19Add some ESLint config to your `package.json`:
20
21```json
22{
23 "name": "my-awesome-project",
24 "eslintConfig": {
25 "extends": "xo"
26 }
27}
28```
29
30Or to `.eslintrc`:
31
32```json
33{
34 "extends": "xo"
35}
36```
37
38Supports parsing ES2015+, but doesn't enforce it by default.
39
40This package also exposes [`xo/browser`](browser.js) if you're in the browser:
41
42```json
43{
44 "extends": "xo/browser"
45}
46```
47
48## Use the XO CLI instead
49
50XO is an ESLint wrapper with great defaults.
51
52Here are some reason why you should use the [XO CLI](https://github.com/xojs/xo) instead of this config:
53
54- XO comes bundled with this config.
55- [Beautiful output.](https://github.com/sindresorhus/eslint-formatter-pretty)
56- Bundles many useful plugins, like [`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn), [`eslint-plugin-import`](https://github.com/benmosher/eslint-plugin-import), [`eslint-plugin-ava`](https://github.com/avajs/eslint-plugin-ava), and more.
57- No need to specify file paths to lint. It will lint all JS files except [commonly ignored paths](https://github.com/xojs/xo#ignores).
58- Super simple to add XO to a project with [`$ npm init xo`](https://github.com/xojs/create-xo).
59- Specify `indent` and `semicolon` preferences easily without messing with the rule config.
60- Config/rule overrides per files/globs. *(ESLint still doesn't support this)*
61- Can open all files with errors at the correct line in your editor. *(See the `--open` flag)*
62- The [editor plugins](https://github.com/xojs/xo#editor-plugins) are IMHO better than the ESLint ones. *(Subjective)*
63
64tl;dr You miss out on a lot by just using this config.
65
66## Related
67
68- [eslint-config-xo-space](https://github.com/xojs/eslint-config-xo-space) - ESLint shareable config for XO with 2-space indent
69- [eslint-config-xo-react](https://github.com/xojs/eslint-config-xo-react) - ESLint shareable config for React to be used with this config
70- [eslint-config-xo-typescript](https://github.com/xojs/eslint-config-xo-typescript) - ESLint shareable config for TypeScript to be used with this config