Skip to content

Commit 04733f1

Browse files
committed
[BREAKING] upgrade ESLint and get rid of babel-eslint
ESLint now supports ES2017 \o/ This will be a breaking change if you used things like decorators or Flow syntax.
1 parent 980873b commit 04733f1

File tree

8 files changed

+20
-31
lines changed

8 files changed

+20
-31
lines changed

config/overrides.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
'use strict';
22
module.exports = {
3-
// always use the Babel parser so it won't throw
4-
// on esnext features in normal mode
5-
parser: 'babel-eslint',
6-
plugins: ['babel'],
7-
rules: {
8-
'generator-star-spacing': 0,
9-
'new-cap': 0,
10-
'array-bracket-spacing': 0,
11-
'object-curly-spacing': 0,
12-
'arrow-parens': 0,
13-
'babel/generator-star-spacing': [2, 'both'],
14-
'babel/new-cap': [2, {
15-
newIsCap: true,
16-
capIsNew: true
17-
}],
18-
'babel/array-bracket-spacing': [2, 'never'],
19-
'babel/object-curly-spacing': [2, 'never'],
20-
'babel/arrow-parens': [2, 'as-needed']
21-
}
3+
// put rule overrides here
224
};

config/plugins.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
'use strict';
22
module.exports = {
3+
// repeated here from eslint-config-xo in case some plugins set something different
4+
parserOptions: {
5+
ecmaVersion: 2017,
6+
sourceType: 'module',
7+
ecmaFeatures: {
8+
jsx: true,
9+
experimentalObjectRestSpread: true
10+
}
11+
},
312
plugins: [
413
'no-use-extend-native',
514
'ava',

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,12 @@
6262
],
6363
"dependencies": {
6464
"arrify": "^1.0.0",
65-
"babel-eslint": "^6.0.0",
6665
"debug": "^2.2.0",
6766
"deep-assign": "^1.0.0",
68-
"eslint": "^3.5.0",
69-
"eslint-config-xo": "^0.15.0",
67+
"eslint": "^3.6.0",
68+
"eslint-config-xo": "^0.16.0",
7069
"eslint-formatter-pretty": "^1.0.0",
7170
"eslint-plugin-ava": "^3.0.0",
72-
"eslint-plugin-babel": "^3.1.0",
7371
"eslint-plugin-import": "^1.7.0",
7472
"eslint-plugin-no-use-extend-native": "^0.3.2",
7573
"eslint-plugin-promise": "^2.0.1",
@@ -97,6 +95,6 @@
9795
"nyc": "^8.3.0",
9896
"proxyquire": "^1.7.3",
9997
"temp-write": "^2.0.1",
100-
"xo": "file:."
98+
"xo": "sindresorhus/xo#v0.16.0"
10199
}
102100
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Default: `false`
140140

141141
Enforce ES2015+ rules. Enabling this will *prefer* ES2015+ syntax and conventions.
142142

143-
*ES2015+ is parsed even without this option. You can already 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/plugins/#stage-x-experimental-presets) and their [Learn ES2015](https://babeljs.io/docs/learn-es2015/).*
143+
*ES2015+ is parsed even without this option. You can already use ES2017 features like [`async`/`await`](https://github.com/lukehoban/ecmascript-asyncawait).
144144

145145
### envs
146146

test/api.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ test('.lintText()', t => {
1010
});
1111

1212
test('.lintText() - `esnext` option', t => {
13-
const results = fn.lintText('function dec() {}\nconst x = {\n\t@dec()\n\ta: 1\n};\n', {esnext: true}).results;
14-
t.true(hasRule(results, 'no-unused-vars'));
13+
const results = fn.lintText('var foo = true;', {esnext: true}).results;
14+
t.true(hasRule(results, 'no-var'));
1515
});
1616

1717
test('.lintText() - JSX support', t => {
@@ -47,7 +47,7 @@ test('.lintText() - extends support with `esnext` option', t => {
4747
t.true(hasRule(results, 'react/jsx-no-undef'));
4848
});
4949

50-
test('always use the Babel parser so esnext syntax won\'t throw in normal mode', t => {
50+
test('always use the latest ECMAScript parser so esnext syntax won\'t throw in normal mode', t => {
5151
const results = fn.lintText('async function foo() {}\n\nfoo();\n').results;
5252
t.is(results[0].errorCount, 0);
5353
});

test/fixtures/extends.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
module.exports = {
33
rules: {
4-
'babel/object-curly-spacing': 0
4+
'object-curly-spacing': 0
55
}
66
};

test/fixtures/project/node_modules/eslint-config-custom/config.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/options-manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ test('buildConfig: semicolon', t => {
6868
});
6969

7070
test('buildConfig: rules', t => {
71-
const rules = {'babel/object-curly-spacing': [2, 'always']};
71+
const rules = {'object-curly-spacing': [2, 'always']};
7272
const config = manager.buildConfig({rules: rules});
7373
t.deepEqual(config.rules, rules);
7474
});

0 commit comments

Comments
 (0)