Skip to content

Commit

Permalink
Merge pull request #41 from vikram-raj/prettier-setup
Browse files Browse the repository at this point in the history
ODC-7471: Configure prettier and fix prettier error
  • Loading branch information
openshift-merge-bot[bot] authored Dec 28, 2023
2 parents f13b407 + feae340 commit d749bc4
Show file tree
Hide file tree
Showing 32 changed files with 512 additions and 316 deletions.
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: nodejs-16
namespace: openshift
tag: latest
tag: latest
48 changes: 24 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "Console + Dynamic Plugin",
"dockerComposeFile": "docker-compose.yml",
"service": "plugin",
"workspaceFolder": "/workspace",
"settings": {},
"initializeCommand": ".devcontainer/init.sh",
"postCreateCommand": "yarn && eval 'oc login $OC_URL -u $OC_USER -p $OC_PASS --insecure-skip-tls-verify'",
"forwardPorts": [9000,9001],
"portsAttributes": {
"9000": {
"label": "Console",
},
"9001": {
"label": "Plugin static files",
"onAutoForward": "silent"
}
},
"features": {},
"extensions": [
"ms-azuretools.vscode-docker",
"ms-vscode.vscode-typescript-next",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
],
"name": "Console + Dynamic Plugin",
"dockerComposeFile": "docker-compose.yml",
"service": "plugin",
"workspaceFolder": "/workspace",
"settings": {},
"initializeCommand": ".devcontainer/init.sh",
"postCreateCommand": "yarn && eval 'oc login $OC_URL -u $OC_USER -p $OC_PASS --insecure-skip-tls-verify'",
"forwardPorts": [9000, 9001],
"portsAttributes": {
"9000": {
"label": "Console"
},
"9001": {
"label": "Plugin static files",
"onAutoForward": "silent"
}
},
"features": {},
"extensions": [
"ms-azuretools.vscode-docker",
"ms-vscode.vscode-typescript-next",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org/

root = true

[*]

# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.yarn
__coverage__
**/node_modules
**/dist
**/generated
*.min.js
gui_test_screenshots
public/lib
Godeps
@types
dynamic-demo-plugin
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.cache-loader
.yarn
node_modules
public/dist
coverage
dist
2 changes: 1 addition & 1 deletion .stylelintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rules:
# Disallow CSS classnames prefixed with .pf- or .co- as these prefixes are
# reserved by PatternFly and OpenShift console.
selector-disallowed-list:
- "*"
- '*'
- /\.(pf|co)-/
# Plugins should avoid naked element selectors like `table` and `li` since
# this can impact layout of existing pages in console.
Expand Down
95 changes: 87 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,87 @@
{
"json.schemas": [
{
"fileMatch": ["console-extensions.json", "**/console-extensions.json"],
"url": "./node_modules/@openshift-console/dynamic-plugin-sdk-webpack/schema/console-extensions.json"
}
]
}
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.sortImports": false
}
},
"[javascriptreact]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.sortImports": false
}
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.sortImports": true
}
},
"[typescriptreact]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.sortImports": false
}
},
"[json]": {
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.formatOnSave": true
},
"[graphql]": {
"editor.formatOnSave": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"json",
"graphql"
],
"javascript.validate.enable": false,
"typescript.tsdk": "./node_modules/typescript/lib",
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/.cache-loader": true,
"**/public/dist": true,
"**/.yarn/releases/**": true
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.cache-loader": true,
"**/public/dist": true
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/.hg/store/**": true,
"**/bower_components": true,
"**/.cache-loader": true,
"**/public/dist": true
},
"files.associations": {
"**/console-extensions.json": "jsonc"
},
"json.schemas": [
{
"fileMatch": ["console-extensions.json", "**/console-extensions.json"],
"url": "./node_modules/@openshift-console/dynamic-plugin-sdk-webpack/schema/console-extensions.json"
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
29 changes: 14 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@

Required tools:

* [Node.js](https://nodejs.org/en/) v16 or newer and [yarn](https://yarnpkg.com) are required
to build and run the example.
* To run OpenShift console in a container, either
[Docker](https://www.docker.com) or [podman 3.2.0+](https://podman.io) and
[oc](https://console.redhat.com/openshift/downloads) are required.
- [Node.js](https://nodejs.org/en/) v16 or newer and [yarn](https://yarnpkg.com) are required
to build and run the example.
- To run OpenShift console in a container, either
[Docker](https://www.docker.com) or [podman 3.2.0+](https://podman.io) and
[oc](https://console.redhat.com/openshift/downloads) are required.

You can run the plugin using a local development environment or build an image
to deploy it to a cluster.


### Option 1: Local development, with a local (cloned) console

This option is a good candidate if you build and run the OpenShift Console already on your machine.
Expand Down Expand Up @@ -160,15 +159,15 @@ the message for the current language from the `plugin__pipeline-console-plugin`
namespace. For example:
```json
{
"type": "console.navigation/href",
"properties": {
"id": "pipelines-overview",
"perspective": "admin",
"section": "pipelines",
"name": "%plugin__pipeline-console-plugin~Overview%"
}
{
"type": "console.navigation/href",
"properties": {
"id": "pipelines-overview",
"perspective": "admin",
"section": "pipelines",
"name": "%plugin__pipeline-console-plugin~Overview%"
}
}
```
Running `yarn i18n` updates the JSON files in the `locales` folder of the
Expand Down Expand Up @@ -197,7 +196,7 @@ Steps to generate reports
1. In command prompt, navigate to root folder and execute the command `yarn run cypress-merge`
2. Then execute command `yarn run cypress-generate`
The cypress-report.html file is generated and should be in (/integration-tests/screenshots) directory
The cypress-report.html file is generated and should be in (/integration-tests/screenshots) directory
## References
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ It will be shipped and enabled automatically by the [Tekton CD / OpenShift Pipel

## Rough roadmap

* 2023 / v1: Adds a new **Dashboard** and **Metrics** tab to the Pipeline pages that shows aggregated PipelineRun stats from the [Tekton Results API](https://github.com/tektoncd/results)
* 2024 / v2: Additional pages, like the Pipeline list and details pages are moved from the "static" [pipelines-plugin](https://github.com/openshift/console/tree/master/frontend/packages/pipelines-plugin) from the OpenShift Console into this project.
- 2023 / v1: Adds a new **Dashboard** and **Metrics** tab to the Pipeline pages that shows aggregated PipelineRun stats from the [Tekton Results API](https://github.com/tektoncd/results)
- 2024 / v2: Additional pages, like the Pipeline list and details pages are moved from the "static" [pipelines-plugin](https://github.com/openshift/console/tree/master/frontend/packages/pipelines-plugin) from the OpenShift Console into this project.

## Compatiblity

Expand Down
7 changes: 3 additions & 4 deletions charts/openshift-console-plugin/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "openshift-console-plugin.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "openshift-console-plugin.labels" . | nindent 4 }}
name: { { template "openshift-console-plugin.name" . } }
namespace: { { .Release.Namespace } }
labels: { { - include "openshift-console-plugin.labels" . | nindent 4 } }
data:
nginx.conf: |
error_log /dev/stdout info;
Expand Down
24 changes: 14 additions & 10 deletions charts/openshift-console-plugin/templates/consoleplugin.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
apiVersion: console.openshift.io/v1
kind: ConsolePlugin
metadata:
name: {{ template "openshift-console-plugin.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "openshift-console-plugin.labels" . | nindent 4 }}
name: { { template "openshift-console-plugin.name" . } }
namespace: { { .Release.Namespace } }
labels: { { - include "openshift-console-plugin.labels" . | nindent 4 } }
spec:
displayName: {{ default (printf "%s Plugin" (include "openshift-console-plugin.name" .)) .Values.plugin.description }}
i18n:
displayName:
{
{
default (printf "%s Plugin" (include "openshift-console-plugin.name" .)) .Values.plugin.description,
},
}
i18n:
loadType: Preload
backend:
type: Service
service:
name: {{ template "openshift-console-plugin.name" . }}
namespace: {{ .Release.Namespace }}
port: {{ .Values.plugin.port }}
basePath: {{ .Values.plugin.basePath }}
name: { { template "openshift-console-plugin.name" . } }
namespace: { { .Release.Namespace } }
port: { { .Values.plugin.port } }
basePath: { { .Values.plugin.basePath } }
14 changes: 7 additions & 7 deletions charts/openshift-console-plugin/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
plugin:
name: ""
description: ""
image: ""
name: ''
description: ''
image: ''
imagePullPolicy: IfNotPresent
replicas: 2
port: 9443
Expand All @@ -24,19 +24,19 @@ plugin:
cpu: 10m
memory: 50Mi
basePath: /
certificateSecretName: ""
certificateSecretName: ''
serviceAccount:
create: true
annotations: {}
name: ""
name: ''
patcherServiceAccount:
create: true
annotations: {}
name: ""
name: ''
jobs:
patchConsoles:
enabled: true
image: "registry.redhat.io/openshift4/ose-tools-rhel8@sha256:e44074f21e0cca6464e50cb6ff934747e0bd11162ea01d522433a1a1ae116103"
image: 'registry.redhat.io/openshift4/ose-tools-rhel8@sha256:e44074f21e0cca6464e50cb6ff934747e0bd11162ea01d522433a1a1ae116103'
podSecurityContext:
enabled: true
runAsNonRoot: true
Expand Down
2 changes: 1 addition & 1 deletion i18n-scripts/lexers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const jsonc = require('comment-json');
module.exports.CustomJSONLexer = class extends EventEmitter {
extract(content, filename) {
let keys = [];
console.log(1)
console.log(1);
try {
jsonc.parse(
content,
Expand Down
32 changes: 16 additions & 16 deletions integration-tests/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"env": {
"cypress/globals": true,
"node": true
},
"extends": ["../.eslintrc.yml", "plugin:cypress/recommended"],
"plugins": ["cypress"],
"rules": {
"no-console": "off",
"no-namespace": "off",
"no-redeclare": "off",
"promise/catch-or-return": "off",
"promise/no-nesting": "off",
"@typescript-eslint/no-var-requires":"off",
"@typescript-eslint/no-namespace":"off"
}
}
"env": {
"cypress/globals": true,
"node": true
},
"extends": ["../.eslintrc.yml", "plugin:cypress/recommended"],
"plugins": ["cypress"],
"rules": {
"no-console": "off",
"no-namespace": "off",
"no-redeclare": "off",
"promise/catch-or-return": "off",
"promise/no-nesting": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-namespace": "off"
}
}
Loading

0 comments on commit d749bc4

Please sign in to comment.