Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Prep v2 with Typescript #16

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

78 changes: 73 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,77 @@
{
"extends": "./node_modules/@inthepocket/itp-react-scripts/dist/config/eslintrc.js",
"globals": {
"log": true
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"import/no-unresolved": "off"
"plugins": [
"@typescript-eslint"
],
"env": {
"browser": true,
"node": true,
"es6": true
},
"rules": {
//#region Rules: Core + @typescript-eslint
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/no-extra-semi": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-throw-literal": "off",
"@typescript-eslint/ban-ts-ignore": "warn",
"@typescript-eslint/camelcase": "warn",
"@typescript-eslint/class-name-casing": "warn",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/comma-spacing": ["warn"],
"@typescript-eslint/require-await": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-includes": "warn",
"arrow-body-style": ["warn", "as-needed"],
"no-return-await": "error",
"class-methods-use-this": "off",
"comma-spacing": "off",
"no-async-promise-executor": "warn",
"no-bitwise": [
"error",
{
"allow": [
"<<",
">>",
"&",
"|",
"|="
]
}
],
"no-console": "warn",
"no-duplicate-imports": ["error", { "includeExports": false }],
"no-multiple-empty-lines": ["error", { "max": 1 }],
"no-param-reassign": "error",
"no-shadow": "error",
"no-throw-literal": "error",
"no-useless-computed-key": "error",
"no-else-return": "warn",
"no-useless-return": "warn",
"prefer-destructuring": [
"warn",
{
"object": true,
"array": false
}
]
//#endregion
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ npm-debug.log

# sketch
hubble-sketch-plugin.sketchplugin

dist
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"arrowParens": "avoid",
"parser": "typescript",
"printWidth": 100,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 In The Pocket (In The Pocket)
Copyright (c) 2019 - current In The Pocket (In The Pocket)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
26 changes: 26 additions & 0 deletions decls/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
declare module 'sketch' {
import { Contents, Document, Page } from '@sketch-hq/sketch-file-format-ts/dist/v3-types';

export const UI = {
message: (message: string) => {},
alert: (...messages: string[]) => {},
getStringFromUser: (message: string, defaultValue: string) => string,
getSelectionFromUser: <T = string>(message: string, options: T[]) => T,
}

export function fromNative(document: Contents['document']): {
path: string;
pages: Page[];
save(
callback: (error: Error) => void
): void;
};
}

declare module '@skpm/*';

declare module '@skpm/child_process' {
import { execSync as NodeExecSync } from "child_process";

export const execSync: typeof NodeExecSync;
}
25 changes: 25 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compatibleVersion": 3,
"bundleVersion": 1,
"icon": "icon.png",
"commands": [
{
"name": "Validate document",
"identifier": "hubble-validate",
"script": "./dist/hubble-validate.js"
},
{
"name": "Export to Hubble App",
"identifier": "hubble-export",
"shortcut": "ctrl shift h",
"script": "./dist/hubble-export.js"
}
],
"menu": {
"title": "🛰 Hubble",
"items": [
"hubble-validate",
"hubble-export"
]
}
}
Loading