Skip to content

Commit 9ab1382

Browse files
committed
tsconfig setup
1 parent c1b2fa1 commit 9ab1382

File tree

4 files changed

+56
-17
lines changed

4 files changed

+56
-17
lines changed

.eslintrc

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
2-
"parser": "babel-eslint",
2+
"parser": "@typescript-eslint/parser",
33
"extends": [
44
"standard",
55
"standard-react",
66
"plugin:prettier/recommended",
77
"prettier/standard",
8-
"prettier/react"
8+
"prettier/react",
9+
"plugin:@typescript-eslint/eslint-recommended"
910
],
1011
"env": {
11-
"node": true,
12-
"browser": true
12+
"browser": true,
13+
"node": true
1314
},
1415
"parserOptions": {
1516
"ecmaVersion": 2020,

src/typings.d.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Default CSS LESS SCSS definition for typescript,
3+
* will be overridden with file-specific definitions by rollup
4+
*/
5+
declare module "*.css" {
6+
const content: { [className: string]: string };
7+
export default content;
8+
}
9+
declare module "*.scss" {
10+
const content: { [className: string]: string };
11+
export default content;
12+
}
13+
declare module "*.less" {
14+
const content: { [className: string]: string };
15+
export default content;
16+
}
17+
18+
interface SvgrComponent
19+
extends React.FunctionComponent<React.SVGAttributes<SVGElement>> {}
20+
21+
declare module "*.svg" {
22+
const svgUrl: string;
23+
const svgComponent: SvgrComponent;
24+
export default svgUrl;
25+
export { svgComponent as ReactComponent };
26+
}

tsconfig.json

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
{
22
// Change this to match your project
3-
"include": ["src/**/*"],
3+
"include": ["src"],
44

55
"compilerOptions": {
6-
// Tells TypeScript to read JS files, as
7-
// normally they are ignored as source files
8-
"allowJs": true,
9-
// Generate d.ts files
6+
"outDir": "dist",
7+
"module": "esnext",
8+
"lib": ["dom", "esnext"],
9+
"moduleResolution": "node",
10+
"jsx": "react",
11+
"sourceMap": true,
1012
"declaration": true,
11-
// This compiler run should
12-
// only output d.ts files
13-
"emitDeclarationOnly": true,
14-
// Types should go into this directory.
15-
// Removing this would place the .d.ts files
16-
// next to the .js files
17-
"outDir": "dist"
18-
}
13+
"esModuleInterop": true,
14+
"noImplicitReturns": true,
15+
"noImplicitThis": true,
16+
"noImplicitAny": true,
17+
"strictNullChecks": true,
18+
"suppressImplicitAnyIndexErrors": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"allowSyntheticDefaultImports": true,
22+
"allowJs": true
23+
},
24+
"exclude": ["node_modules", "dist", "example"]
1925
}

tsconfig.test.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "commonjs"
5+
}
6+
}

0 commit comments

Comments
 (0)