Skip to content

Commit e556df5

Browse files
committed
chore: eslint and prettier and husky
1 parent 7dbc1e5 commit e556df5

File tree

18 files changed

+5166
-2326
lines changed

18 files changed

+5166
-2326
lines changed

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/dist
2+
plugins/*/dist
3+
plugins/*/mdist

package-lock.json

+4,894-2,114
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+47
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,70 @@
2828
"build:electron:all": "KUI_KEEP_NODE_MODULE=\"$(cat mw-node-modules.txt)\" KUI_HEADLESS_WEBPACK=true KUI_LAUNCHER=$PWD/bin/codeflare kui-build-electron",
2929
"build": "npm run compile && webpack --mode production",
3030
"postinstall": "npm run compile",
31+
"format": "prettier --write '**/*.{scss,css,html,js,json,md,ts,tsx}'",
32+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
3133
"open": "electron . shell",
3234
"start": "WATCH_ARGS='-open' npm run watch",
3335
"test": "echo \"Error: no test specified\" && exit 1"
3436
},
3537
"keywords": [],
3638
"author": "@starpit",
3739
"license": "Apache-2.0",
40+
"eslintConfig": {
41+
"parser": "@typescript-eslint/parser",
42+
"plugins": [
43+
"@typescript-eslint"
44+
],
45+
"env": {
46+
"browser": true,
47+
"node": true
48+
},
49+
"rules": {
50+
"@typescript-eslint/no-unused-vars": "error"
51+
},
52+
"extends": [
53+
"eslint:recommended",
54+
"plugin:@typescript-eslint/recommended"
55+
]
56+
},
57+
"eslintIgnore": [
58+
"mdist",
59+
"dist",
60+
".#*",
61+
"*~"
62+
],
63+
"lint-staged": {
64+
"**/*.{scss,css,html,js,json,md,ts,tsx}": [
65+
"prettier --write",
66+
"git add"
67+
],
68+
"**/*.{js,ts,tsx}": [
69+
"eslint --fix",
70+
"git add"
71+
]
72+
},
73+
"prettier": {
74+
"semi": false,
75+
"printWidth": 120
76+
},
3877
"devDependencies": {
3978
"@kui-shell/builder": "11.5.0-dev-20220523-155545",
4079
"@kui-shell/proxy": "11.5.0-dev-20220523-155545",
4180
"@kui-shell/react": "11.5.0-dev-20220523-155545",
4281
"@kui-shell/webpack": "11.5.0-dev-20220523-155545",
82+
"@types/debug": "^4.1.7",
4383
"@types/node": "14.11.8",
4484
"@types/react": "17.0.39",
4585
"@types/react-dom": "17.0.11",
86+
"@types/uuid": "^8.3.4",
87+
"@typescript-eslint/eslint-plugin": "^5.25.0",
88+
"@typescript-eslint/parser": "^5.25.0",
4689
"concurrently": "7.2.0",
4790
"electron": "18.2.4",
91+
"eslint": "^8.15.0",
92+
"husky": "^8.0.1",
93+
"lint-staged": "^12.4.1",
94+
"prettier": "^2.6.2",
4895
"typescript": "4.6.4"
4996
},
5097
"dependencies": {
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
{
2-
}
1+
{}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"label": "Notebooks",
3-
"submenu": [
4-
]
3+
"submenu": []
54
}

plugins/plugin-client-default/src/index.tsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React from 'react'
17+
import React from "react"
1818

19-
import { Capabilities } from '@kui-shell/core'
20-
import { Kui, KuiProps, ContextWidgets, MeterWidgets, CurrentWorkingDirectory, SpaceFiller } from '@kui-shell/plugin-client-common'
19+
import { Capabilities } from "@kui-shell/core"
20+
import { Kui, KuiProps, ContextWidgets, MeterWidgets } from "@kui-shell/plugin-client-common"
2121

22-
import { CurrentContext, CurrentNamespace } from '@kui-shell/plugin-kubectl/components'
23-
import { Search } from '@kui-shell/plugin-electron-components'
22+
import { CurrentContext, CurrentNamespace } from "@kui-shell/plugin-kubectl/components"
23+
import { Search } from "@kui-shell/plugin-electron-components"
2424

25-
import { version } from '@kui-shell/client/package.json'
26-
import guidebooks from '@kui-shell/client/config.d/notebooks.json'
27-
import { productName } from '@kui-shell/client/config.d/name.json'
25+
import { version } from "@kui-shell/client/package.json"
26+
import guidebooks from "@kui-shell/client/config.d/notebooks.json"
27+
import { productName } from "@kui-shell/client/config.d/name.json"
2828

2929
/**
3030
* We will set this bit when the user dismisses the Welcome to Kui
@@ -56,8 +56,7 @@ export default function renderMain(props: KuiProps) {
5656
toplevel={!Capabilities.inBrowser() && <Search />}
5757
guidebooks={guidebooks.submenu}
5858
>
59-
<ContextWidgets>
60-
</ContextWidgets>
59+
<ContextWidgets></ContextWidgets>
6160

6261
<MeterWidgets>
6362
<CurrentContext />

plugins/plugin-codeflare/src/plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Registrar } from '@kui-shell/core'
17+
// import { Registrar } from '@kui-shell/core'
1818

1919
/** Register Kui Commands */
20-
export default function registerCodeflareCommands(registrar: Registrar) {
20+
export default function registerCodeflareCommands(/* registrar: Registrar */) {
2121
/* e.g. this command will executable as "run"
2222
registrar.listen('/run', args => {
2323
})

0 commit comments

Comments
 (0)