@grafana/ui lib now contains one components, seperate lint & tsc steps

This commit is contained in:
Torkel Ödegaard
2018-12-21 14:23:32 +01:00
parent 2fec5c7577
commit 52f583fee7
13 changed files with 73 additions and 64 deletions

View File

@@ -4,11 +4,23 @@
"description": "",
"main": "src/index.ts",
"scripts": {
"test": "tsc --noEmit"
"tslint": "tslint -c tslint.json --project tsconfig.json",
"typecheck": "tsc --noEmit"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-popper": "^1.3.0",
"react-highlight-words": "0.11.0",
"@torkelo/react-select": "2.1.1",
"react-transition-group": "^2.2.1",
"react-virtualized": "^9.21.0"
},
"devDependencies": {
"@types/jest": "^23.3.2",
"@types/react": "^16.7.6",
"typescript": "^3.2.2"
}
}

View File

@@ -1,10 +1,10 @@
import React from 'react';
import DeleteButton from './DeleteButton';
import { DeleteButton } from './DeleteButton';
import { shallow } from 'enzyme';
describe('DeleteButton', () => {
let wrapper;
let deleted;
let wrapper: any;
let deleted: any;
beforeAll(() => {
deleted = false;
@@ -12,7 +12,8 @@ describe('DeleteButton', () => {
function deleteItem() {
deleted = true;
}
wrapper = shallow(<DeleteButton onConfirmDelete={() => deleteItem()} />);
wrapper = shallow(<DeleteButton onConfirm={() => deleteItem()} />);
});
it('should show confirm delete when clicked', () => {

View File

@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import React, { PureComponent, SyntheticEvent } from 'react';
interface Props {
onConfirm();
onConfirm(): void;
}
interface State {
@@ -13,7 +13,7 @@ export class DeleteButton extends PureComponent<Props, State> {
showConfirm: false,
};
onClickDelete = event => {
onClickDelete = (event: SyntheticEvent) => {
if (event) {
event.preventDefault();
}
@@ -23,7 +23,7 @@ export class DeleteButton extends PureComponent<Props, State> {
});
};
onClickCancel = event => {
onClickCancel = (event: SyntheticEvent) => {
if (event) {
event.preventDefault();
}

View File

@@ -1,4 +1,5 @@
{
"extends": "../../tsconfig.json",
"include": [
"src/**/*.ts",
"src/**/*.tsx"
@@ -6,30 +7,11 @@
"exclude": [
"dist"
],
"scripts": {
"build": "tsc"
},
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",
"lib": ["es6", "dom"],
"jsx": "react",
"rootDir": ".",
"module": "esnext",
"outDir": "dist",
"declaration": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"noEmitHelpers": true,
"removeComments": false,
"inlineSourceMap": false,
"sourceMap": true,
"noEmitOnError": false,
"emitDecoratorMetadata": false,
"experimentalDecorators": true,
"declaration": true,
"declarationDir": "./dist/types",
"noImplicitAny": true,
"strictNullChecks": true
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../tslint.json"
}