From 427f2f6a4051c9e6e80737eab9237ce598adf08e Mon Sep 17 00:00:00 2001 From: Adam Bergman Date: Wed, 29 Nov 2017 14:36:26 +0100 Subject: [PATCH] fix(eslint): Use babel-eslint parser The eslint config will now use babel-eslint as its parser. So that things like class-properties work out of the box. This commit also adds a couple other things such as env and rules fix #3 --- src/config/eslintrc.js | 22 +++++++++++++++++++++- src/scripts/lint.js | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/config/eslintrc.js b/src/config/eslintrc.js index dea80a9..5aa5644 100644 --- a/src/config/eslintrc.js +++ b/src/config/eslintrc.js @@ -1,10 +1,30 @@ const { ifAnyDep } = require('../utils'); module.exports = { + parser: 'babel-eslint', extends: [ require.resolve('eslint-config-airbnb-base'), ifAnyDep('react', require.resolve('eslint-config-airbnb')), require.resolve('eslint-config-prettier'), ].filter(Boolean), - rules: {}, + plugins: ['babel'], + env: { + browser: true, + node: true, + commonjs: true, + 'shared-node-browser': true, + es6: true, + worker: true, + jest: true, + }, + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: { experimentalObjectRestSpread: true }, + }, + rules: { + 'import/prefer-default-export': 'off', + 'react/jsx-filename-extension': 'off', + 'react/sort-comp': 'off', + }, }; diff --git a/src/scripts/lint.js b/src/scripts/lint.js index e9a7eb9..31c3b10 100644 --- a/src/scripts/lint.js +++ b/src/scripts/lint.js @@ -12,6 +12,7 @@ const useBuiltinConfig = !args.includes('--config') && !hasFile('.eslintrc') && !hasFile('.eslintrc.js') && + !hasFile('.eslintrc.json') && !hasPkgProp('eslintConfig'); const config = useBuiltinConfig