Skip to content
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

Add .eslintrc to RN project template #23901

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/eslint-config-react-native-community/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ module.exports = {
},
},

overrides: {
files: ['**/__tests__/**/*.js', '**/?(*.)(spec|test).js'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should include TS and TSX files as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thymikee Are you sure that's something we want to add? TSEslint configuration on the project side will be required anyway. It seems logical to keep it on the project side for the projects that use TS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eslint now supports TS (or is planning to) so it makes sense.

Copy link
Contributor

@satya164 satya164 Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we also need to add the parser as well? Otherwise, ESLint will fail to parse no?

Reference https://github.com/facebook/jest/blob/master/.eslintrc.js#L15

PS: I agree it'll be great to have this by default

env: {
jest: true,
'jest/globals': true,
},
},

// Map from global var to bool specifying if it can be redefined
globals: {
__DEV__: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-react-native-community/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-native-community/eslint-config",
"version": "0.0.2",
"version": "0.0.3",
"description": "ESLint config for React Native",
"main": "index.js",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions template/_eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};