Skip to content

Commit a2009ea

Browse files
committed
add vscode extensions and settings, eslint stuff
1 parent c4274d4 commit a2009ea

File tree

7 files changed

+265
-8
lines changed

7 files changed

+265
-8
lines changed

.eslintrc

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
{
2+
"parser": "babel-eslint",
3+
"parserOptions": {
4+
"ecmaFeatures": {
5+
"jsx": true,
6+
"modules": true
7+
}
8+
},
9+
"globals": {
10+
"require": false,
11+
"console": false
12+
},
13+
"plugins": [
14+
"react"
15+
],
16+
"rules": {
17+
/**
18+
* Strict mode
19+
*/
20+
"strict": [
21+
2,
22+
"global"
23+
], // http://eslint.org/docs/rules/strict
24+
/**
25+
* ES6
26+
*/
27+
"no-var": 2, // http://eslint.org/docs/rules/no-var
28+
"prefer-const": 0, // http://eslint.org/docs/rules/prefer-const
29+
/**
30+
* Variables
31+
*/
32+
"no-shadow": 2, // http://eslint.org/docs/rules/no-shadow
33+
"no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
34+
"no-undef": 2, // http://eslint.org/docs/rules/no-undef
35+
"no-unused-vars": [
36+
2,
37+
{ // http://eslint.org/docs/rules/no-unused-vars
38+
"vars": "local",
39+
"args": "none"
40+
}
41+
],
42+
"no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define
43+
/**
44+
* Possible errors
45+
*/
46+
"comma-dangle": [
47+
0,
48+
"always-multiline"
49+
], // http://eslint.org/docs/rules/comma-dangle
50+
"no-cond-assign": [
51+
2,
52+
"always"
53+
], // http://eslint.org/docs/rules/no-cond-assign
54+
"no-console": 1, // http://eslint.org/docs/rules/no-console
55+
"no-debugger": 1, // http://eslint.org/docs/rules/no-debugger
56+
"no-alert": 1, // http://eslint.org/docs/rules/no-alert
57+
"no-constant-condition": 1, // http://eslint.org/docs/rules/no-constant-condition
58+
"no-dupe-keys": 2, // http://eslint.org/docs/rules/no-dupe-keys
59+
"no-duplicate-case": 2, // http://eslint.org/docs/rules/no-duplicate-case
60+
"no-empty": 2, // http://eslint.org/docs/rules/no-empty
61+
"no-ex-assign": 2, // http://eslint.org/docs/rules/no-ex-assign
62+
"no-extra-boolean-cast": 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
63+
"no-extra-semi": 2, // http://eslint.org/docs/rules/no-extra-semi
64+
"no-func-assign": 2, // http://eslint.org/docs/rules/no-func-assign
65+
"no-inner-declarations": 2, // http://eslint.org/docs/rules/no-inner-declarations
66+
"no-invalid-regexp": 2, // http://eslint.org/docs/rules/no-invalid-regexp
67+
"no-irregular-whitespace": 2, // http://eslint.org/docs/rules/no-irregular-whitespace
68+
"no-obj-calls": 2, // http://eslint.org/docs/rules/no-obj-calls
69+
"no-sparse-arrays": 2, // http://eslint.org/docs/rules/no-sparse-arrays
70+
"no-unreachable": 2, // http://eslint.org/docs/rules/no-unreachable
71+
"semi": [
72+
2,
73+
"always"
74+
], // http://eslint.org/docs/rules/semi.html
75+
"use-isnan": 2, // http://eslint.org/docs/rules/use-isnan
76+
"block-scoped-var": 2, // http://eslint.org/docs/rules/block-scoped-var
77+
/**
78+
* Best practices
79+
*/
80+
"consistent-return": 2, // http://eslint.org/docs/rules/consistent-return
81+
"curly": 0, // http://eslint.org/docs/rules/curly [REVISIT ME]
82+
"default-case": 2, // http://eslint.org/docs/rules/default-case
83+
"dot-notation": [
84+
2,
85+
{ // http://eslint.org/docs/rules/dot-notation
86+
"allowKeywords": true
87+
}
88+
],
89+
"eqeqeq": 0, // http://eslint.org/docs/rules/eqeqeq [REVISIT ME]
90+
"guard-for-in": 0, // http://eslint.org/docs/rules/guard-for-in [REVISIT ME]
91+
"jsx-quotes": [
92+
2,
93+
"prefer-double"
94+
], // http://eslint.org/docs/rules/jsx-quotes
95+
"no-caller": 2, // http://eslint.org/docs/rules/no-caller
96+
"no-else-return": 0, // http://eslint.org/docs/rules/no-else-return [REVISIT ME]
97+
"no-eq-null": 2, // http://eslint.org/docs/rules/no-eq-null
98+
"no-eval": 2, // http://eslint.org/docs/rules/no-eval
99+
"no-extend-native": 2, // http://eslint.org/docs/rules/no-extend-native
100+
"no-extra-bind": 2, // http://eslint.org/docs/rules/no-extra-bind
101+
"no-fallthrough": 2, // http://eslint.org/docs/rules/no-fallthrough
102+
"no-floating-decimal": 2, // http://eslint.org/docs/rules/no-floating-decimal
103+
"no-implied-eval": 2, // http://eslint.org/docs/rules/no-implied-eval
104+
"no-lone-blocks": 2, // http://eslint.org/docs/rules/no-lone-blocks
105+
"no-loop-func": 2, // http://eslint.org/docs/rules/no-loop-func
106+
"no-multi-str": 2, // http://eslint.org/docs/rules/no-multi-str
107+
"no-native-reassign": 2, // http://eslint.org/docs/rules/no-native-reassign
108+
"no-new": 2, // http://eslint.org/docs/rules/no-new
109+
"no-new-func": 2, // http://eslint.org/docs/rules/no-new-func
110+
"no-new-wrappers": 2, // http://eslint.org/docs/rules/no-new-wrappers
111+
"no-octal": 2, // http://eslint.org/docs/rules/no-octal
112+
"no-octal-escape": 2, // http://eslint.org/docs/rules/no-octal-escape
113+
"no-param-reassign": 0, // http://eslint.org/docs/rules/no-param-reassign [REVISIT ME]
114+
"no-proto": 2, // http://eslint.org/docs/rules/no-proto
115+
"no-redeclare": 2, // http://eslint.org/docs/rules/no-redeclare
116+
"no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign
117+
"no-script-url": 2, // http://eslint.org/docs/rules/no-script-url
118+
"no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare
119+
"no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
120+
"no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal
121+
"no-with": 2, // http://eslint.org/docs/rules/no-with
122+
"quotes": [
123+
2,
124+
"single",
125+
{
126+
"avoidEscape": true
127+
}
128+
], // http://eslint.org/docs/rules/quotes.html
129+
"radix": 2, // http://eslint.org/docs/rules/radix
130+
"computed-property-spacing": [
131+
2,
132+
"never"
133+
], // http://eslint.org/docs/rules/space-in-brackets.html
134+
"array-bracket-spacing": [
135+
2,
136+
"never"
137+
], // http://eslint.org/docs/rules/space-in-brackets.html
138+
"object-curly-spacing": [
139+
2,
140+
"never"
141+
], // http://eslint.org/docs/rules/space-in-brackets.html
142+
"space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops.html
143+
"vars-on-top": 0, // http://eslint.org/docs/rules/vars-on-top
144+
"wrap-iife": [
145+
2,
146+
"any"
147+
], // http://eslint.org/docs/rules/wrap-iife
148+
"yoda": 2, // http://eslint.org/docs/rules/yoda
149+
/**
150+
* React
151+
*/
152+
"react/display-name": 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
153+
"react/no-multi-comp": [
154+
0,
155+
{
156+
"ignoreStateless": true
157+
}
158+
], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
159+
"react/jsx-key": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
160+
"react/jsx-no-undef": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
161+
"react/jsx-no-duplicate-props": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
162+
"react/jsx-uses-react": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
163+
"react/jsx-uses-vars": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
164+
"react/no-did-mount-set-state": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
165+
"react/no-did-update-set-state": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md"
166+
"react/no-unknown-property": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
167+
"react/prop-types": [
168+
2,
169+
{
170+
"ignore": [
171+
"className",
172+
"children",
173+
"location",
174+
"params"
175+
]
176+
}
177+
],
178+
"react/react-in-jsx-scope": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
179+
"react/self-closing-comp": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
180+
"react/sort-comp": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
181+
"react/jsx-wrap-multilines": 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
182+
/**
183+
* Custom
184+
*/
185+
"getsentry/jsx-needs-il8n": 0, // highlights literals in JSX components w/o translation tags
186+
}
187+
}

.vscode/extensions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dzannotti.vscode-babel-coloring",
6+
"esbenp.prettier-vscode",
7+
"dbaeumer.vscode-eslint",
8+
"lextudio.restructuredtext",
9+
"jmlntw.vscode-ensure-single-final-newline"
10+
]
11+
}

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files.trimTrailingWhitespace": true,
3+
"files.ensureSingleFinalNewline": true,
4+
5+
"prettier.bracketSpacing": false,
6+
"prettier.singleQuote": true,
7+
"prettier.printWidth": 90,
8+
"prettier.jsxBracketSameLine": true,
9+
10+
"[javascript]": {
11+
"editor.formatOnSave": true
12+
}
13+
}

lib/NativeClient.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import {NativeModules, NativeEventEmitter} from 'react-native';
2-
const {RNSentry, RNSentryEventEmitter} = NativeModules;
3-
import {Sentry, SentrySeverity, SentryLog} from './Sentry';
1+
import {NativeModules} from 'react-native';
2+
const {RNSentry} = NativeModules;
43

54
const DEFAULT_MODULE_IGNORES = [
65
'AccessibilityManager',
@@ -104,6 +103,7 @@ export class NativeClient {
104103
this._ignoredModules = {};
105104
const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge');
106105
if (typeof __fbBatchedBridgeConfig !== 'undefined') {
106+
/* global __fbBatchedBridgeConfig */
107107
__fbBatchedBridgeConfig.remoteModuleConfig.forEach((module, moduleID) => {
108108
if (
109109
module !== null &&
@@ -115,7 +115,7 @@ export class NativeClient {
115115
}
116116
});
117117
} else if (BatchedBridge._remoteModuleTable) {
118-
for (var module in BatchedBridge._remoteModuleTable) {
118+
for (let module in BatchedBridge._remoteModuleTable) {
119119
if (BatchedBridge._remoteModuleTable.hasOwnProperty(module)) {
120120
let moduleName = BatchedBridge._remoteModuleTable[module];
121121
if (
@@ -132,6 +132,7 @@ export class NativeClient {
132132
this._overwriteEnqueueNativeCall();
133133
})
134134
.catch(function(reason) {
135+
// eslint-disable-next-line
135136
console.log(reason);
136137
});
137138
};

lib/RavenClient.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Raven from 'raven-js';
2-
import {Sentry, SentrySeverity, SentryLog} from './Sentry';
2+
import {Sentry, SentryLog} from './Sentry';
33

44
export class RavenClient {
55
constructor(dsn, options) {
@@ -19,7 +19,7 @@ export class RavenClient {
1919
},
2020
data => {
2121
if (Sentry.options.internal) {
22-
data.dist = Sentry.options.internal['dist'];
22+
data.dist = Sentry.options.internal.dist;
2323
}
2424
}
2525
);
@@ -31,8 +31,8 @@ export class RavenClient {
3131
if (Sentry.isNativeClientAvailable()) {
3232
// We overwrite the default transport handler when the native
3333
// client is available, because we want to send the event with native
34-
Raven.setTransport(options => {
35-
Sentry._captureEvent(options.data);
34+
Raven.setTransport(transportOptions => {
35+
Sentry._captureEvent(transportOptions.data);
3636
});
3737
Raven.setBreadcrumbCallback(Sentry._breadcrumbCallback);
3838
const oldCaptureBreadcrumb = Raven.captureBreadcrumb;

lib/Sentry.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class Sentry {
6060

6161
static _log(...args) {
6262
if (Sentry.options.logLevel >= 2) {
63+
// eslint-disable-next-line
6364
console.log.apply(null, args);
6465
}
6566
}
@@ -123,11 +124,13 @@ export class Sentry {
123124
static context(options, func, args) {
124125
Sentry._log('react-native-sentry (context)');
125126
if (Sentry._ravenClient) return Sentry._ravenClient.context(options, func, args);
127+
return this;
126128
}
127129

128130
static wrap(options, func, _before) {
129131
Sentry._log('react-native-sentry (wrap)');
130132
if (Sentry._ravenClient) return Sentry._ravenClient.wrap(options, func, _before);
133+
return this;
131134
}
132135

133136
static lastException() {

package-lock.json

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)