зеркало из https://github.com/microsoft/reactxp.git
Replace TSLint on ESLint (#1172)
This commit is contained in:
Родитель
fb9504c354
Коммит
5dafd2b109
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "./tsconfig.json"
|
||||||
|
},
|
||||||
|
"extends": ["skype"],
|
||||||
|
"rules": {},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.tsx"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"PluginBaseChecker.ts"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-unused-vars": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -5,23 +5,25 @@
|
||||||
"author": "ReactXP Team <reactxp@microsoft.com>",
|
"author": "ReactXP Team <reactxp@microsoft.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run tslint && tsc",
|
"build": "tsc",
|
||||||
"tslint": "tslint -p tsconfig.json -r tslint.json -r ./node_modules/tslint-microsoft-contrib --fix || true"
|
"lint": "eslint --ext .ts,.tsx src",
|
||||||
|
"lint:fix": "npm run lint -- --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native-community/netinfo": "^4.6.1"
|
"@react-native-community/netinfo": "^4.6.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"reactxp": "^2.0.0",
|
"reactxp": "^2.0.0",
|
||||||
"react-dom": "^16.3",
|
|
||||||
"react-native": ">=0.57",
|
"react-native": ">=0.57",
|
||||||
"react-native-windows": "^0.57.1"
|
"react-native-windows": "^0.57.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@typescript-eslint/eslint-plugin": "2.15.0",
|
||||||
|
"eslint": "6.8.0",
|
||||||
|
"eslint-config-skype": "1.5.0",
|
||||||
|
"eslint-plugin-import": "2.19.1",
|
||||||
"reactxp": "^2.0.0",
|
"reactxp": "^2.0.0",
|
||||||
"typescript": "3.7.2",
|
"typescript": "3.7.4"
|
||||||
"tslint": "5.20.1",
|
|
||||||
"tslint-microsoft-contrib": "6.2.0"
|
|
||||||
},
|
},
|
||||||
"types": "dist/web/PluginBase.d.ts"
|
"types": "dist/web/PluginBase.d.ts"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,16 @@
|
||||||
* Type check all the pluginbase exports against the desired interface.
|
* Type check all the pluginbase exports against the desired interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Interfaces from './Interfaces';
|
|
||||||
import * as AndroidPlugin from '../android/PluginBase';
|
import * as AndroidPlugin from '../android/PluginBase';
|
||||||
import * as iOSPlugin from '../ios/PluginBase';
|
import * as iOSPlugin from '../ios/PluginBase';
|
||||||
import * as macOSPlugin from '../macos/PluginBase';
|
import * as macOSPlugin from '../macos/PluginBase';
|
||||||
import * as WebPlugin from '../web/PluginBase';
|
import * as WebPlugin from '../web/PluginBase';
|
||||||
import * as WindowsPlugin from '../windows/PluginBase';
|
import * as WindowsPlugin from '../windows/PluginBase';
|
||||||
|
|
||||||
/* tslint:disable:no-unused-variable */
|
import * as Interfaces from './Interfaces';
|
||||||
|
|
||||||
const _typeCheckerAndroid: Interfaces.PluginInterface = AndroidPlugin;
|
const _typeCheckerAndroid: Interfaces.PluginInterface = AndroidPlugin;
|
||||||
const _typeCheckeriOS: Interfaces.PluginInterface = iOSPlugin;
|
const _typeCheckeriOS: Interfaces.PluginInterface = iOSPlugin;
|
||||||
const _typeCheckermacOS: Interfaces.PluginInterface = macOSPlugin;
|
const _typeCheckermacOS: Interfaces.PluginInterface = macOSPlugin;
|
||||||
const _typeCheckerWeb: Interfaces.PluginInterface = WebPlugin;
|
const _typeCheckerWeb: Interfaces.PluginInterface = WebPlugin;
|
||||||
const _typeCheckerWindows: Interfaces.PluginInterface = WindowsPlugin;
|
const _typeCheckerWindows: Interfaces.PluginInterface = WindowsPlugin;
|
||||||
/* tslint:enable:no-unused-variable */
|
|
||||||
|
|
|
@ -24,17 +24,13 @@ export class NetInfo extends Interfaces.NetInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
isConnected(): Promise<boolean> {
|
isConnected(): Promise<boolean> {
|
||||||
return RNNetInfo.fetch().then((state: RNNetInfo.NetInfoState) => {
|
return RNNetInfo.fetch()
|
||||||
return state.isConnected;
|
.then((state: RNNetInfo.NetInfoState) => state.isConnected)
|
||||||
}).catch(() => {
|
.catch(() => Promise.reject('NetInfo.isConnected.fetch() failed'));
|
||||||
return Promise.reject('NetInfo.isConnected.fetch() failed');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getType(): Promise<Types.DeviceNetworkType> {
|
getType(): Promise<Types.DeviceNetworkType> {
|
||||||
return RNNetInfo.fetch().then((state: RNNetInfo.NetInfoState) => {
|
return RNNetInfo.fetch().then((state: RNNetInfo.NetInfoState) => NetInfo._getNetworkTypeFromConnectionInfo(state));
|
||||||
return NetInfo._getNetworkTypeFromConnectionInfo(state);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _getNetworkTypeFromConnectionInfo(state: RNNetInfo.NetInfoState): Types.DeviceNetworkType {
|
private static _getNetworkTypeFromConnectionInfo(state: RNNetInfo.NetInfoState): Types.DeviceNetworkType {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Types from '../common/Types';
|
import * as Types from '../common/Types';
|
||||||
|
|
||||||
import NetInfo from './NetInfo';
|
import NetInfo from './NetInfo';
|
||||||
|
|
||||||
export { NetInfo as default, Types };
|
export { NetInfo as default, Types };
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"noResolve": false,
|
"strictPropertyInitialization": true,
|
||||||
"jsx": "react",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": true,
|
"declaration": true,
|
||||||
"outDir": "dist/",
|
"noResolve": false,
|
||||||
"lib": [
|
"target": "es5",
|
||||||
"es2015.promise",
|
"module": "commonjs",
|
||||||
"es5",
|
"outDir": "dist",
|
||||||
"dom"
|
"jsx": "react",
|
||||||
],
|
"lib": ["es2015.promise", "es5", "DOM"]
|
||||||
"types" : ["lodash", "react", "react-dom", "react-native"]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"include": [
|
"include": [
|
||||||
|
@ -23,7 +22,7 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"dist",
|
"node_modules",
|
||||||
"node_modules"
|
"dist"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
{
|
|
||||||
"rules": {
|
|
||||||
"align": [true, "statements"],
|
|
||||||
"class-name": true,
|
|
||||||
"curly": true,
|
|
||||||
"eofline": true,
|
|
||||||
"forin": true,
|
|
||||||
"indent": [true, "spaces"],
|
|
||||||
"interface-name": [true, "never-prefix"],
|
|
||||||
"label-position": true,
|
|
||||||
"max-line-length": [ true, 140 ],
|
|
||||||
"no-arg": true,
|
|
||||||
"no-bitwise": false,
|
|
||||||
"no-console": [true,
|
|
||||||
"debug",
|
|
||||||
"info",
|
|
||||||
"time",
|
|
||||||
"timeEnd",
|
|
||||||
"trace"
|
|
||||||
],
|
|
||||||
"no-consecutive-blank-lines": true,
|
|
||||||
"no-construct": true,
|
|
||||||
"no-debugger": true,
|
|
||||||
"no-duplicate-variable": true,
|
|
||||||
"no-empty": true,
|
|
||||||
"no-eval": true,
|
|
||||||
"no-switch-case-fall-through": true,
|
|
||||||
"no-trailing-whitespace": false,
|
|
||||||
"no-unused-expression": true,
|
|
||||||
"one-line": [true,
|
|
||||||
"check-open-brace",
|
|
||||||
"check-catch",
|
|
||||||
"check-else",
|
|
||||||
"check-whitespace"
|
|
||||||
],
|
|
||||||
"quotemark": [true, "single", "jsx-single"],
|
|
||||||
"radix": true,
|
|
||||||
"semicolon": true,
|
|
||||||
"triple-equals": [true, "allow-null-check"],
|
|
||||||
"variable-name": false,
|
|
||||||
"whitespace": [true,
|
|
||||||
"check-branch",
|
|
||||||
"check-decl",
|
|
||||||
"check-operator",
|
|
||||||
"check-separator",
|
|
||||||
"check-type"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
Загрузка…
Ссылка в новой задаче