Fix lint-staged in monorepo

This commit is contained in:
Daniel Karski
2021-02-10 09:00:40 +01:00
parent 3e900d8b2d
commit 6498f13941
28 changed files with 29585 additions and 29557 deletions

View File

@@ -1,5 +1,8 @@
{
"extends": "@mudita",
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",

1
.gitignore vendored
View File

@@ -52,3 +52,4 @@ storybook-static
.env.*
electron-builder.env
tmp/

View File

@@ -1,5 +1,5 @@
{
"hooks": {
"pre-commit": "npm run beforecommit"
"pre-commit": "npm run lint --fix && lint-staged"
}
}

View File

@@ -1,4 +1,4 @@
{
"*.{js,json,css,md,ts,tsx}": ["prettier --write", "git add"],
"*.{ts,tsx}": ["npm run lint --fix", "git add"],
"packages/**/*.{js,json,css,md,ts,tsx}": ["prettier --write", "git add"],
}

View File

@@ -1 +1,7 @@
package.json
node_modules
storybook-static
tmp
dist
coverage

6
package-lock.json generated
View File

@@ -5649,9 +5649,9 @@
"dev": true
},
"lint-staged": {
"version": "10.5.3",
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.5.3.tgz",
"integrity": "sha512-TanwFfuqUBLufxCc3RUtFEkFraSPNR3WzWcGF39R3f2J7S9+iF9W0KTVLfSy09lYGmZS5NDCxjNvhGMSJyFCWg==",
"version": "10.5.4",
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.5.4.tgz",
"integrity": "sha512-EechC3DdFic/TdOPgj/RB3FicqE6932LTHCUm0Y2fsD9KGlLB+RwJl2q1IYBIvEsKzDOgn0D4gll+YxG5RsrKg==",
"dev": true,
"requires": {
"chalk": "^4.1.0",

View File

@@ -51,12 +51,12 @@
},
"homepage": "https://github.com/Mudita/mudita-center",
"devDependencies": {
"lerna": "^3.22.1",
"typescript": "^4.1.3",
"@mudita/eslint-config": "^1.0.14",
"husky": "^4.3.8",
"lint-staged": "^10.5.3",
"prettier": "^2.2.1"
"lerna": "^3.22.1",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"typescript": "^4.1.3"
},
"engines": {
"node": "12.18.4",

View File

@@ -1,6 +1,3 @@
{
"extends": "../../.eslintrc",
"parserOptions": {
"project": "./tsconfig.json"
}
"extends": "../../.eslintrc"
}

View File

@@ -1,7 +1,7 @@
const path = require("path")
const fs = require("fs-extra")
const loader = function(content) {
const loader = function (content) {
const modulePath = this._module.rawRequest.replace(".stories.tsx", ".json")
const filePath = path.join(__dirname, `./tmp/${modulePath}`)

View File

@@ -41,7 +41,6 @@
"translations:send": "node ./scripts/updatePhraseTranslations.js",
"translations:sort": "node ./scripts/sortTranslations.js",
"UTILITY/AUTO COMMANDS": "=================================================",
"beforecommit": "npm run translations:sort && lint-staged",
"postinstall": "electron-builder install-app-deps && electron-rebuild -f",
"electron:rebuild-serialport": "electron-rebuild -f -w serialport",
"prerelease": "npm run translations:overwrite && npm run build",

View File

@@ -1,4 +1,5 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
/***** Basic Options ******/
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
@@ -15,7 +16,9 @@
"es7",
"es2017",
"ESNext",
"esnext.intl", "es2017.intl", "es2018.intl"
"esnext.intl",
"es2017.intl",
"es2018.intl"
],
/* Allow javascript files to be compiled. */
"allowJs": true,

View File

@@ -19,8 +19,8 @@ module.exports = {
env: process.env,
stdio: "inherit",
})
.on("close", code => process.exit(code))
.on("error", spawnError => console.error(spawnError))
.on("close", (code) => process.exit(code))
.on("error", (spawnError) => console.error(spawnError))
}
},
}

View File

@@ -1 +1 @@
module.exports = production => (production ? "none" : "source-map")
module.exports = (production) => (production ? "none" : "source-map")

View File

@@ -1,4 +1,4 @@
module.exports = renderer =>
module.exports = (renderer) =>
renderer
? {
app: ["@babel/polyfill", "./src/renderer/app.tsx"],

View File

@@ -1,6 +1,6 @@
const TerserPlugin = require("terser-webpack-plugin")
module.exports = production => {
module.exports = (production) => {
const config = {
minimize: production,
nodeEnv: production ? "production" : "development",

View File

@@ -1,4 +1,4 @@
const tsxMain = production => ({
const tsxMain = (production) => ({
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "babel-loader",
@@ -12,7 +12,7 @@ const tsxMain = production => ({
},
})
const tsxRenderer = production => ({
const tsxRenderer = (production) => ({
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "babel-loader",

View File

@@ -1 +1 @@
module.exports = renderer => `electron-${renderer ? "renderer" : "main"}`
module.exports = (renderer) => `electron-${renderer ? "renderer" : "main"}`

View File

@@ -1 +1 @@
# Mudita Center - design-system
# Mudita Center - design-system

View File

@@ -51,7 +51,10 @@ export {
SidebarHeaderIcon,
SidebarProps,
} from "../app/src/renderer/components/core/table/table.component"
export { List, ListItem } from "../app/src/renderer/components/core/list/list.component"
export {
List,
ListItem,
} from "../app/src/renderer/components/core/list/list.component"
// Theme
export { default as Theme } from "../app/src/renderer/styles/theming/theme"

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "es5",
"module": "commonjs",
@@ -42,7 +43,10 @@
"declaration": true
},
"include": [
"./index.ts", "../app/src/**/*.d.ts", "../app/src/renderer/images"],
"./index.ts",
"../app/src/**/*.d.ts",
"../app/src/renderer/images"
],
"exclude": [
"../app/dist",
"node_modules",

View File

@@ -1,7 +1,9 @@
import PureDeviceManager, { PureDevice } from "../src"
import { ResponseStatus } from "../dist"
export const establishConnection = async (command: (device: PureDevice) => void) => {
export const establishConnection = async (
command: (device: PureDevice) => void
) => {
const [device] = await PureDeviceManager.getDevices()
if (!device) {

View File

@@ -8,21 +8,23 @@ require("yargs")
"This command allows you to send a single request to the Pure phone",
(yargs: Argv) => {
yargs.option("requestConfigString", {
describe: "it's a stringified RequestConfig, where definition is in pure/src/device.types.ts",
describe:
"it's a stringified RequestConfig, where definition is in pure/src/device.types.ts",
type: "string",
})
},
request,
request
)
.command(
"requests <request-configs-string>",
"This command allows you to send a sequence of requests to the Pure phone",
(yargs: Argv) => {
yargs.option("requestConfigsString", {
describe: "it's a stringified list of RequestConfig, where definition is in pure/src/device.types.ts",
describe:
"it's a stringified list of RequestConfig, where definition is in pure/src/device.types.ts",
type: "string",
})
},
requests,
requests
)
.help().argv

View File

@@ -1,6 +1,9 @@
import { PureDevice, RequestConfig } from "../src"
const singleRequest = async (device: PureDevice, requestConfig: RequestConfig) => {
const singleRequest = async (
device: PureDevice,
requestConfig: RequestConfig
) => {
console.log("request: ", JSON.stringify(requestConfig))
const response = await device.request(requestConfig)

View File

@@ -110,7 +110,9 @@ class BaseDevice implements PureDevice {
this.#eventEmitter.off(eventName, listener)
}
private fileUploadRequest({ filePath }: RequestConfig): Promise<Response<any>> {
private fileUploadRequest({
filePath,
}: RequestConfig): Promise<Response<any>> {
return new Promise((resolve) => {
if (!this.#port || !this.#portBlocked || !filePath) {
resolve({ status: ResponseStatus.ConnectionError })
@@ -173,7 +175,9 @@ class BaseDevice implements PureDevice {
})
}
private deviceUpdateRequest({ filePath }: RequestConfig): Promise<Response<any>> {
private deviceUpdateRequest({
filePath,
}: RequestConfig): Promise<Response<any>> {
return new Promise((resolve) => {
if (!this.#port || !this.#portBlocked || !filePath) {
resolve({ status: ResponseStatus.ConnectionError })

View File

@@ -10,4 +10,3 @@ export class FormatterFactory {
return formatterMap[version] ?? formatterMap[1]
}
}

View File

@@ -1,4 +1,5 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "ES2018",
"module": "commonjs",

1
tsconfig.json Normal file
View File

@@ -0,0 +1 @@
{}