Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Fix "yarn lint" & configure eslint for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlkv committed Feb 22, 2021
1 parent 07956d3 commit e8c57bf
Show file tree
Hide file tree
Showing 9 changed files with 362 additions and 21 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@ module.exports = {
},
rules: {
},
ignorePatterns: ['*.d.ts']
overrides: [{
files: ['*.d.ts'],
extends: [
'standard-with-typescript'
],
parserOptions: {
project: 'tsconfig.json'
}
}]
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
"license": "MIT",
"types": "src/index.d.ts",
"scripts": {
"lint": "eslint --ext .js,.ts",
"lint": "eslint --ext .js,.d.ts .",
"example": "node example",
"profile": "node scripts/profile"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.15.2",
"@typescript-eslint/parser": "^4.15.2",
"babel-eslint": "^10.1.0",
"eslint": "^7.19.0",
"eslint-config-standard": "^16.0.2",
"eslint-config-standard-with-typescript": "^20.0.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/api/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
declare var content: any
declare const content: any
export = content
2 changes: 1 addition & 1 deletion src/profiles/application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import a304 from './a304'
export {
a297,
a304
}
}
10 changes: 5 additions & 5 deletions src/profiles/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type Locale = { languages?: string, locale?: string, acceptLanguages?: string }
type Application = {
interface Locale { languages?: string, locale?: string, acceptLanguages?: string }
interface Application {
apiRoot?: string
userAgent?: string
userAgentStatic?: string
Expand All @@ -14,9 +14,9 @@ type Application = {
}

type Profile = Application & Locale & {
token?: string,
userId?: string,
deviceId?: string,
token?: string
userId?: string
deviceId?: string
fetchOptions?: any
}

Expand Down
7 changes: 4 additions & 3 deletions src/structures/agent.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fetch from "cross-fetch"
import { Profile } from "../profiles"
import fetch from 'cross-fetch'
import { Profile } from '../profiles'

export default function agent(url: string, options: any, customs: Profile): ReturnType<typeof fetch>
declare function agent (url: string, options: any, customs: Profile): ReturnType<typeof fetch>
export default agent
6 changes: 3 additions & 3 deletions src/structures/client.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Profile } from "../profiles";
import { Profile } from '../profiles'

type ClubhouseApiResult<T> = ({ success: true } & T) |
{ success: false, error_message: string }
type ClubhouseApiResult<T> = ({ success: true } & T) | { success: false, error_message: string }

// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export declare class Client {
constructor (options: { profile: Profile })
[k: string]: <T>(...params: any) => Promise<ClubhouseApiResult<T>>
Expand Down
9 changes: 9 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"ESNext"
],
"strictNullChecks": true
}
}
Loading

0 comments on commit e8c57bf

Please sign in to comment.