-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a shareable ESLint configuration package #689
Changes from all commits
a4b4fe3
603cff0
2d2e7af
5c9f7ac
8dbfe66
7e55f86
e2dc36e
cfa6880
f2665d8
2db2ebe
0881de1
5c4458c
996bf67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "react-app" | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# eslint-config-react-app | ||
|
||
This package includes the shareable ESLint configuration used by [Create React App](https://github.com/facebookincubator/create-react-app). | ||
|
||
## Usage in Create React App Projects | ||
|
||
The easiest way to use this configuration is with [Create React App](https://github.com/facebookincubator/create-react-app), which includes it by default. **You don’t need to install it separately in Create React App projects.** | ||
|
||
## Usage Outside of Create React App | ||
|
||
If you want to use this ESLint configuration in a project not built with Create React App, you can install it with following steps. | ||
|
||
First, install this package, ESLint and the necessary plugins. | ||
|
||
```sh | ||
npm install --save-dev eslint-config-react-app [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] | ||
``` | ||
|
||
Then create a file named `.eslintrc` with following contents in the root folder of your project: | ||
|
||
```js | ||
{ | ||
"extends": "react-app" | ||
} | ||
``` | ||
|
||
That's it! You can override the settings from `eslint-config-react-app` by editing the `.eslintrc` file. Learn more about [configuring ESLint](http://eslint.org/docs/user-guide/configuring) on the ESLint website. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll also want a readme here, explaining in a few words how to use this package as standalone. |
||
"name": "eslint-config-react-app", | ||
"version": "0.1.0", | ||
"description": "ESLint configuration used by Create React App", | ||
"repository": "facebookincubator/create-react-app", | ||
"license": "BSD-3-Clause", | ||
"bugs": { | ||
"url": "https://github.com/facebookincubator/create-react-app/issues" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"peerDependencies": { | ||
"babel-eslint": "6.1.2", | ||
"eslint": "3.5.0", | ||
"eslint-plugin-flowtype": "2.18.1", | ||
"eslint-plugin-import": "1.12.0", | ||
"eslint-plugin-jsx-a11y": "2.2.2", | ||
"eslint-plugin-react": "5.2.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "react-app" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,11 +165,13 @@ module.exports = { | |
} | ||
] | ||
}, | ||
// @remove-on-eject-begin | ||
// Point ESLint to our predefined config. | ||
eslint: { | ||
configFile: path.join(__dirname, 'eslint.js'), | ||
configFile: path.join(__dirname, '../.eslintrc'), | ||
useEslintrc: false | ||
}, | ||
// @remove-on-eject-end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we need this for prod config too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We copy the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't mean ejected, I meant There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, great point. I forgot we had ESLint for the build too. Updated now. |
||
// We use PostCSS for autoprefixing only. | ||
postcss: function() { | ||
return [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, had no idea you could do that