Skip to content

Commit 79477fa

Browse files
committed
Update gts
1 parent 9528be4 commit 79477fa

19 files changed

+2184
-781
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/node_modules
2+
example/
3+
lib/

.eslintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": ["@react-native-community", "./node_modules/gts"],
3+
"plugins": ["simple-import-sort"],
4+
"root": true,
5+
"rules": {
6+
"@typescript-eslint/member-delimiter-style": [
7+
"error",
8+
{
9+
"multiline": {
10+
"delimiter": "none",
11+
"requireLast": false
12+
},
13+
"singleline": {
14+
"delimiter": "comma"
15+
}
16+
}
17+
],
18+
"simple-import-sort/sort": [
19+
"error",
20+
{ "groups": [["^\\u0000", "^@?\\w", "^[^.]", "^\\."]] }
21+
],
22+
"sort-imports": "off"
23+
}
24+
}

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
...require('gts/.prettierrc.json'),
3+
bracketSpacing: true,
4+
jsxSingleQuote: true,
5+
semi: false,
6+
}

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ npm publish
123123

124124
ℹ️ If you have native code in your library most of the time you will need `.java`, `.h`/`.m` files, `project.pbxproj`, `AndroidManifest.xml` and `build.gradle` aside from TypeScript code and default stuff, so keep an eye on what you are publishing, some configuration/build folders or files might sneak in. Most of them (if not all) are ignored in [package.json](package.json).
125125

126+
## FAQ
127+
128+
### VSCode ESLint plugin does not lint example project
129+
130+
By default, ESLint is configured separately for the library's source code and the example. It uses two `.eslintignore` files, the first one for the library, among others it ignores `/example` folder, and the second one for the example project. Since `/example` folder is ignored in one of these files, the plugin does not lint anything in it, see this [issue](https://github.com/microsoft/vscode-eslint/issues/111). To fix that, go to the VSCode settings and set
131+
132+
```json
133+
"eslint.workingDirectories": [
134+
"./example"
135+
]
136+
```
137+
126138
## License
127139

128140
[MIT](LICENSE)

example/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules

example/.eslintrc.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"extends": ["@react-native-community", "./node_modules/gts"],
3+
"parserOptions": {
4+
"sourceType": "module"
5+
},
6+
"plugins": ["simple-import-sort"],
7+
"root": true,
8+
"rules": {
9+
"@typescript-eslint/member-delimiter-style": [
10+
"error",
11+
{
12+
"multiline": {
13+
"delimiter": "none",
14+
"requireLast": false
15+
},
16+
"singleline": {
17+
"delimiter": "comma"
18+
}
19+
}
20+
],
21+
"node/no-extraneous-require": "off",
22+
"node/no-missing-import": "off",
23+
"node/no-unsupported-features/es-syntax": "off",
24+
"simple-import-sort/sort": [
25+
"error",
26+
{ "groups": [["^\\u0000", "^@?\\w", "^[^.]", "^\\."]] }
27+
],
28+
"sort-imports": "off"
29+
}
30+
}

example/.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
...require('gts/.prettierrc.json'),
3+
bracketSpacing: true,
4+
jsxSingleQuote: true,
5+
semi: false,
6+
}

example/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import { AppRegistry } from 'react-native'
6-
import App from './src/App'
76
import { name as appName } from './app.json'
7+
import App from './src/App'
88

99
AppRegistry.registerComponent(appName, () => App)

example/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
"devDependencies": {
1919
"@babel/core": "^7.9.0",
2020
"@babel/runtime": "^7.9.2",
21+
"@react-native-community/eslint-config": "^1.1.0",
2122
"@types/jest": "^25.2.1",
2223
"@types/react-native": "^0.62.2",
2324
"@types/react-test-renderer": "^16.9.2",
2425
"babel-jest": "^25.3.0",
25-
"gts": "^1.1.2",
26+
"eslint": "^6.8.0",
27+
"eslint-plugin-simple-import-sort": "^5.0.2",
28+
"gts": "^2.0.0",
2629
"jest": "^25.3.0",
2730
"metro-react-native-babel-preset": "^0.59.0",
2831
"react-test-renderer": "^16.13.1",

example/prettier.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)