Skip to content

Commit

Permalink
fix(eslintrc): add babel-eslint parsing if babel is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Dierckens committed Aug 31, 2018
1 parent f063535 commit c98e2db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,19 @@ of the things you can do with `itp-react-scripts`.

Add `npm run lint: "itp-react-scripts lint` to your `package.json` scripts to use it

> Note: caching eslint is enabled by default by itp-react-scripts, if you want to disable it, add `---no-cache`
> Note: To make VCCode recognise eslint: create `.eslintrc` in your project root with the contents of:
> **Note:** caching eslint is enabled by default by itp-react-scripts, if you want to disable it, add `---no-cache`
> **Note:** To make VSCode recognise eslint: create `.eslintrc` in your project root with the contents of:
>
> `{"extends": "./node_modules/@inthepocket/itp-react-scripts/dist/config/eslintrc.js"}`
> Note: for now, you'll have to include an `.eslintignore` in your project until
> **Note:** for now, you'll have to include an `.eslintignore` in your project until
> [this eslint issue is resolved](https://github.com/eslint/eslint/issues/9227).
> **FYI:** want to see how your final eslint config looks like?
> Pipe the result to a log file to take a look.
> `npm run lint --print-config | > someTemporaryLogFile.log`
### Precommit

#### Lintstagedrc
Expand Down
4 changes: 4 additions & 0 deletions src/config/eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ module.exports = {
ifAnyDep('flow-bin', 'eslint-config-prettier/flowtype'),
require.resolve('eslint-config-prettier/react'),
].filter(Boolean),
parser: ifAnyDep(
['babel-cli', 'babel-core', 'babel-eslint', 'babel-loader'],
'babel-eslint',
),
rules: {
'no-use-before-define': [
'error',
Expand Down

0 comments on commit c98e2db

Please sign in to comment.