Skip to content

Commit c9ec5b0

Browse files
committed
(lint): add standard-with-typescript, fix formatting
- for this commit, just focus on configuration and formatting errors, stricter typings will be in next commits - add tsconfig.eslint.json so that test/ files are linted too
1 parent 6ad3660 commit c9ec5b0

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

.eslintrc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ module.exports = {
22
ignorePatterns: ['dist/'],
33
extends: [
44
'react-app',
5-
'standard'
5+
'standard', // for any JS
6+
'standard-with-typescript' // for all TS
67
],
8+
parserOptions: {
9+
// same as ./tsconfig.json, but adds test dir to be linted
10+
project: './tsconfig.eslint.json',
11+
},
712
rules: {
813
'prettier/prettier': 'off' // override tsdx lint
914
}

package-lock.json

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

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
],
3939
"scripts": {
4040
"start": "parcel example/public/index.html",
41-
"lint": "tsdx lint '**/*.js'",
42-
"lint:fix": "tsdx lint '**/*.js' --fix",
41+
"lint": "tsdx lint '**/*.js' '**/*.ts' '**/*.tsx'",
42+
"lint:fix": "npm run lint -- --fix",
4343
"dist": "tsdx build",
4444
"test": "tsdx test",
4545
"test:pub": "npm run dist && npm pack",
@@ -69,6 +69,7 @@
6969
"enzyme-adapter-react-16": "^1.14.0",
7070
"eslint": "^6.8.0",
7171
"eslint-config-standard": "^14.1.0",
72+
"eslint-config-standard-with-typescript": "^12.0.1",
7273
"eslint-plugin-import": "^2.20.1",
7374
"eslint-plugin-node": "^11.0.0",
7475
"eslint-plugin-promise": "^4.2.1",

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SignaturePad from 'signature_pad'
44
import trimCanvas from 'trim-canvas'
55

66
export interface ReactSignatureCanvasProps extends SignaturePad.SignaturePadOptions {
7-
canvasProps?: React.CanvasHTMLAttributes<HTMLCanvasElement>,
7+
canvasProps?: React.CanvasHTMLAttributes<HTMLCanvasElement>
88
clearOnResize?: boolean
99
}
1010

tsconfig.eslint.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
// adds test dir to be linted
4+
"include": ["src", "typings", "test"]
5+
}

0 commit comments

Comments
 (0)