Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Headlamp
Commits
eb0047ea
Commit
eb0047ea
authored
3 years ago
by
René Dudfield
Browse files
Options
Download
Email Patches
Plain Diff
plugins: Add "npm run lint" so plugins are lint free
parent
11e6275c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
frontend/package.json
+1
-1
frontend/package.json
plugins/headlamp-plugin/bin/headlamp-plugin.js
+36
-0
plugins/headlamp-plugin/bin/headlamp-plugin.js
plugins/headlamp-plugin/package-lock.json
+40
-196
plugins/headlamp-plugin/package-lock.json
plugins/headlamp-plugin/package.json
+8
-0
plugins/headlamp-plugin/package.json
plugins/headlamp-plugin/template/package.json
+8
-0
plugins/headlamp-plugin/template/package.json
plugins/headlamp-plugin/test-headlamp-plugin.sh
+3
-0
plugins/headlamp-plugin/test-headlamp-plugin.sh
with
96 additions
and
197 deletions
+96
-197
frontend/package.json
+
1
-
1
View file @
eb0047ea
...
...
@@ -70,7 +70,7 @@
"build"
:
"if-env PUBLIC_URL react-scripts build || cross-env PUBLIC_URL=./ react-scripts build --max_old_space_size=768 && rimraf build/frontend/index.baseUrl.html"
,
"test"
:
"cross-env TEST_TZ=true react-scripts test"
,
"eject"
:
"react-scripts eject"
,
"lint"
:
"eslint -c package.json --ext .js,.ts,.tsx src/ ../app/electron ../plugins/headlamp-plugin"
,
"lint"
:
"eslint -c package.json --ext .js,.ts,.tsx src/ ../app/electron ../plugins/headlamp-plugin
--ignore-pattern ../plugins/headlamp-plugin/template
"
,
"format"
:
"prettier --config package.json --write src ../app/electron ../plugins/headlamp-plugin/bin ../plugins/headlamp-plugin/lib ../plugins/headlamp-plugin/config"
,
"format-check"
:
"prettier --config package.json --check src ../app/electron ../plugins/headlamp-plugin"
,
"storybook"
:
"start-storybook -p 6006 -s public"
,
...
...
This diff is collapsed.
Click to expand it.
plugins/headlamp-plugin/bin/headlamp-plugin.js
+
36
-
0
View file @
eb0047ea
...
...
@@ -316,6 +316,27 @@ function format(packageFolder) {
return
0
;
}
/**
* Lint code with eslint.
*
* @param packageFolder {string} - folder where the package is.
* @returns {0 | 1} Exit code, where 0 is success, 1 is failure.
*/
function
lint
(
packageFolder
)
{
try
{
child_process
.
execSync
(
'
eslint -c package.json --ext .js,.ts,.tsx src/
'
,
{
stdio
:
'
inherit
'
,
cwd
:
packageFolder
,
encoding
:
'
utf8
'
,
});
}
catch
(
e
)
{
console
.
error
(
`Problem running prettier inside of "
${
packageFolder
}
"`
);
return
1
;
}
return
0
;
}
yargs
(
process
.
argv
.
slice
(
2
))
.
command
(
'
build [package]
'
,
...
...
@@ -390,6 +411,21 @@ yargs(process.argv.slice(2))
process
.
exitCode
=
format
(
argv
.
package
);
}
)
.
command
(
'
lint [package]
'
,
'
Lint the plugin for coding issues with eslint.
'
+
'
<package> defaults to current working directory.
'
,
yargs
=>
{
yargs
.
positional
(
'
package
'
,
{
describe
:
'
Package to lint
'
,
type
:
'
string
'
,
default
:
'
.
'
,
});
},
argv
=>
{
process
.
exitCode
=
lint
(
argv
.
package
);
}
)
.
demandCommand
(
1
,
''
)
.
strict
()
.
help
().
argv
;
This diff is collapsed.
Click to expand it.
plugins/headlamp-plugin/package-lock.json
+
40
-
196
View file @
eb0047ea
This diff is collapsed.
Click to expand it.
plugins/headlamp-plugin/package.json
+
8
-
0
View file @
eb0047ea
...
...
@@ -21,6 +21,14 @@
"babel-loader"
:
"^8.1.0"
,
"env-paths"
:
"^2.2.1"
,
"eslint"
:
"^7.32.0"
,
"eslint-plugin-import"
:
"^2.22.1"
,
"eslint-config-prettier"
:
"^8.3.0"
,
"eslint-plugin-jsx-a11y"
:
"^6.4.1"
,
"eslint-plugin-react"
:
"^7.24.0"
,
"eslint-plugin-react-hooks"
:
"^4.2.0"
,
"eslint-plugin-simple-import-sort"
:
"^7.0.0"
,
"eslint-plugin-unused-imports"
:
"^1.1.2"
,
"@typescript-eslint/eslint-plugin"
:
"^4.28.2"
,
"filemanager-webpack-plugin"
:
"^4.0.0"
,
"fs-extra"
:
"^9.1.0"
,
"imports-loader"
:
"^1.1.0"
,
...
...
This diff is collapsed.
Click to expand it.
plugins/headlamp-plugin/template/package.json
+
8
-
0
View file @
eb0047ea
...
...
@@ -6,6 +6,7 @@
"start"
:
"headlamp-plugin start"
,
"build"
:
"headlamp-plugin build"
,
"format"
:
"headlamp-plugin format"
,
"lint"
:
"headlamp-plugin lint"
,
"tsc"
:
"tsc"
},
"keywords"
:
[
...
...
@@ -15,6 +16,13 @@
"plugins"
],
"prettier"
:
"@kinvolk/eslint-config/prettier-config"
,
"eslintConfig"
:
{
"extends"
:
[
"@kinvolk"
,
"prettier"
,
"plugin:jsx-a11y/recommended"
]
},
"devDependencies"
:
{
"@kinvolk/headlamp-plugin"
:
"^$${headlamp-plugin-version}"
}
...
...
This diff is collapsed.
Click to expand it.
plugins/headlamp-plugin/test-headlamp-plugin.sh
+
3
-
0
View file @
eb0047ea
...
...
@@ -46,3 +46,6 @@ node bin/headlamp-plugin.js create headlamp-myfancy --link
cd
headlamp-myfancy
npm
install
../kinvolk-headlamp-plugin-
*
.tgz
npm run format
# test lint command and default code is lint free
npm run lint
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help