eslint-config-xo
Advanced tools
Comparing version 0.15.4 to 0.16.0
'use strict'; | ||
var path = require('path'); | ||
const path = require('path'); | ||
@@ -4,0 +4,0 @@ module.exports = { |
'use strict'; | ||
var path = require('path'); | ||
const path = require('path'); | ||
module.exports = { | ||
extends: path.join(__dirname, 'index.js'), | ||
parser: 'babel-eslint', | ||
plugins: ['babel'], | ||
rules: { | ||
'no-var': 'error', | ||
'object-shorthand': ['error', 'always'], | ||
'prefer-arrow-callback': 'error', | ||
@@ -14,28 +13,14 @@ 'prefer-const': ['error', { | ||
}], | ||
'prefer-numeric-literals': 2, | ||
// disabled since latest Node.js LTS doesn't yet support it | ||
// 'prefer-reflect': ['error', {exceptions: ['delete']}], | ||
// 'prefer-rest-params': 'error', | ||
// disabled because of https://github.com/eslint/eslint/issues/6572 | ||
// 'prefer-template': 'error', | ||
// 'prefer-spread': 'error', | ||
// disable builtin rules that are incompatible with Babel plugin ones | ||
'generator-star-spacing': 'off', | ||
'new-cap': 'off', | ||
'array-bracket-spacing': 'off', | ||
'object-curly-spacing': 'off', | ||
'object-shorthand': 'off', | ||
'arrow-parens': 'off', | ||
'babel/generator-star-spacing': ['error', 'both'], | ||
'babel/new-cap': ['error', { | ||
newIsCap: true, | ||
capIsNew: true | ||
}], | ||
'babel/array-bracket-spacing': ['error', 'never'], | ||
'babel/object-curly-spacing': ['error', 'never'], | ||
'babel/object-shorthand': ['error', 'always'], | ||
'babel/arrow-parens': ['error', 'as-needed'], | ||
'babel/no-await-in-loop': 'error' | ||
} | ||
}; |
21
index.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
parserOptions: { | ||
ecmaVersion: 7, | ||
ecmaVersion: 2017, | ||
sourceType: 'module', | ||
@@ -39,3 +39,2 @@ ecmaFeatures: { | ||
'no-irregular-whitespace': 'error', | ||
'no-negated-in-lhs': 'error', | ||
'no-obj-calls': 'error', | ||
@@ -45,6 +44,8 @@ 'no-prototype-builtins': 'error', | ||
'no-sparse-arrays': 'error', | ||
'no-template-curly-in-string': 'error', | ||
'no-unreachable': 'error', | ||
'no-unsafe-finally': 'error', | ||
'no-unsafe-negation': 'error', | ||
'use-isnan': 'error', | ||
'valid-typeof': 'error', | ||
'valid-typeof': ['error', {requireStringLiterals: true}], | ||
'no-unexpected-multiline': 'error', | ||
@@ -74,2 +75,3 @@ 'accessor-pairs': 'error', | ||
'no-floating-decimal': 'error', | ||
'no-global-assign': 'error', | ||
'no-implicit-coercion': 'error', | ||
@@ -84,3 +86,2 @@ 'no-implicit-globals': 'error', | ||
'no-multi-str': 'error', | ||
'no-native-reassign': 'error', | ||
'no-new-func': 'error', | ||
@@ -95,3 +96,3 @@ 'no-new-wrappers': 'error', | ||
'no-script-url': 'error', | ||
'no-self-assign': 'error', | ||
'no-self-assign': ['error', {props: true}], | ||
'no-self-compare': 'error', | ||
@@ -120,3 +121,3 @@ 'no-sequences': 'error', | ||
}], | ||
'no-unused-vars': 'error', | ||
'no-unused-vars': ['error', {varsIgnorePattern: '^_$'}], | ||
'no-use-before-define': ['error', 'nofunc'], | ||
@@ -148,2 +149,4 @@ // disabled because of https://github.com/eslint/eslint/issues/3420 | ||
'eol-last': 'error', | ||
'func-call-spacing': ['error', 'never'], | ||
'func-names': ['error', 'never'], | ||
'indent': ['error', 'tab', { | ||
@@ -177,3 +180,2 @@ SwitchCase: 1 | ||
}], | ||
'no-nested-ternary': 'warn', | ||
'no-negated-condition': 'error', | ||
@@ -183,3 +185,2 @@ 'no-new-object': 'error', | ||
'no-whitespace-before-property': 'error', | ||
'no-spaced-func': 'error', | ||
'no-trailing-spaces': 'error', | ||
@@ -217,3 +218,4 @@ 'no-unneeded-ternary': 'error', | ||
block: { | ||
markers: ['!'] | ||
markers: ['!'], | ||
balanced: true | ||
} | ||
@@ -242,2 +244,3 @@ }], | ||
'rest-spread-spacing': ['error', 'never'], | ||
'symbol-description': 'error', | ||
'template-curly-spacing': 'error', | ||
@@ -244,0 +247,0 @@ 'yield-star-spacing': ['error', 'both'] |
{ | ||
"name": "eslint-config-xo", | ||
"version": "0.15.4", | ||
"version": "0.16.0", | ||
"description": "ESLint shareable config for XO", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4" | ||
}, | ||
@@ -55,5 +55,3 @@ "scripts": { | ||
"ava": "*", | ||
"babel-eslint": "^6.0.0", | ||
"eslint": "^2.12.0", | ||
"eslint-plugin-babel": "^3.0.0", | ||
"eslint": "^3.6.0", | ||
"is-plain-obj": "^1.0.0", | ||
@@ -63,4 +61,4 @@ "temp-write": "^2.1.0" | ||
"peerDependencies": { | ||
"eslint": ">=2.12.0" | ||
"eslint": ">=3.6.0" | ||
} | ||
} |
@@ -5,5 +5,5 @@ # eslint-config-xo [![Build Status](https://travis-ci.org/sindresorhus/eslint-config-xo.svg?branch=master)](https://travis-ci.org/sindresorhus/eslint-config-xo) | ||
This is for advanced users. You probably want to use XO directly. | ||
This is for advanced users. [You probably want to use XO directly.](#use-the-xo-cli-instead) | ||
See [eslint-plugin-xo](https://github.com/sindresorhus/eslint-plugin-xo) for some additional useful rules. | ||
See [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) for some additional useful rules. | ||
@@ -17,11 +17,3 @@ | ||
For the `esnext` version you'll also need Babel's ESLint [parser](https://github.com/babel/babel-eslint) and [plugin](https://github.com/babel/eslint-plugin-babel): | ||
``` | ||
$ npm install --save-dev babel-eslint eslint-plugin-babel | ||
``` | ||
This will let you use ES2016 features like [`async`/`await`](https://github.com/lukehoban/ecmascript-asyncawait) and [decorators](https://github.com/wycats/javascript-decorators). For a full list of features see [Babel's experimental features](https://babeljs.io/docs/usage/experimental/) and their [Learn ES2015](https://babeljs.io/docs/learn-es2015/). | ||
## Usage | ||
@@ -48,3 +40,3 @@ | ||
Supports parsing ES2015, but doesn't enforce it by default. | ||
Supports parsing ES2015+, but doesn't enforce it by default. | ||
@@ -68,2 +60,21 @@ This package also exposes [`xo/esnext`](esnext.js) if you want ES2015+ rules: | ||
## Use the XO CLI instead | ||
XO is an ESLint wrapper with great defaults. | ||
Here are some reason why you should use the [XO CLI](https://github.com/sindresorhus/xo) instead of this config: | ||
- XO comes bundled with this config. | ||
- [Beautiful output.](https://github.com/sindresorhus/eslint-formatter-pretty) | ||
- 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. | ||
- No need to specify file paths to lint. It will lint all JS files except [commonly ignored paths](https://github.com/sindresorhus/xo#ignores). | ||
- Super simple to add XO to a project: `$ xo --init` | ||
- Specify `indent` and `semicolon` preferences easily without messing with the rule config. | ||
- Config/rule overrides per files/globs. *(ESLint still doesn't support this)* | ||
- Can open all files with errors at the correct line in your editor. *(See the `--open` flag)* | ||
- The [editor plugins](https://github.com/sindresorhus/xo#editor-plugins) are IMHO better than the ESLint ones. *(Subjective)* | ||
tl;dr You miss out on a lot by just using this config. | ||
## Related | ||
@@ -77,2 +88,2 @@ | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
12394
4
85
265