Skip to content

Commit

Permalink
build(package): update dtslint and fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Oct 15, 2023
1 parent 07d7c98 commit 8062ce8
Show file tree
Hide file tree
Showing 7 changed files with 2,866 additions and 2,229 deletions.
15 changes: 10 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{
"env": {
"jest": true,
"node": true
"node": true,
"jest": true
},
"extends": "eslint:recommended",
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["prettier"],
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-var-requires": "off",
"no-console": "error",
"no-debugger": "error",
"prettier/prettier": "error"
}
}
1 change: 1 addition & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('invalid cases', () => {

describe('iterator', () => {
it('returns null', () => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
expect(parse('color: #foo;', () => {})).toBe(null);
});

Expand Down
16 changes: 0 additions & 16 deletions __tests__/types/index.test.ts

This file was deleted.

16 changes: 16 additions & 0 deletions __tests__/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import StyleToObject from 'style-to-object';

// $ExpectType { [name: string]: string; } | null
StyleToObject('color: red');

// @ts-expect-error: Expected 1-2 arguments, but got 0.
StyleToObject();

// @ts-expect-error: Argument of type 'null' is not assignable to parameter of type 'string'.
StyleToObject(null);

// @ts-expect-error: Argument of type 'number' is not assignable to parameter of type 'string'.
StyleToObject(42);

// @ts-expect-error: Argument of type 'boolean' is not assignable to parameter of type 'string'.
StyleToObject(true);
Loading

0 comments on commit 8062ce8

Please sign in to comment.