Skip to content

Commit 400e072

Browse files
authored
Add Prettier and format all files (#288)
* Add Prettier and format all files * Add prettier-plugin-tailwindcss for nextjs * Added license to config files. * Added lint check to CI, removed license comments from json files * trying to fix merge conflicts * improved formatting for new files * merge conflicts :( * exclude json files from license checking in licenserc.yaml * Fixed ci to only perform prettier formatting in webui folder, not the root folder. * Re-format all files with tab width 4 * fixing merge conflicts. * fixed formatting of globals.css
1 parent ed7c670 commit 400e072

40 files changed

+1272
-1153
lines changed

.github/licenserc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ header:
2626
- '**/*.yaml'
2727
paths-ignore:
2828
- '**/go.mod'
29-
- '**/go.sum'
29+
- '**/go.sum'
30+
- '**/*.json'

.github/workflows/ci.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ jobs:
6060
export PATH=$PATH:$GOPATH/bin
6161
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.63.4
6262
make lint
63-
63+
64+
- name: Install Prettier in webui
65+
run: cd webui && npm install --save-dev prettier
66+
67+
- name: Run Prettier Lint in webui
68+
run: cd webui && npx prettier --check .
69+
6470
build-test:
6571
name: Build and test
6672
needs: [license-check, lint]

webui/.eslintrc.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
19-
201
{
212
"extends": "next/core-web-vitals",
223
"rules": {

webui/.prettierignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
node_modules
19+
dist
20+
.next
21+
public
22+
build
23+
_build
24+
package-lock.json
25+
yarn.lock

webui/.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"singleQuote": false,
4+
"trailingComma": "es5",
5+
"tabWidth": 4,
6+
"printWidth": 100,
7+
"plugins": ["prettier-plugin-tailwindcss"]
8+
}

webui/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
- to you under the Apache License, Version 2.0 (the
77
- "License"); you may not use this file except in compliance
88
- with the License. You may obtain a copy of the License at
9-
-
9+
-
1010
- http://www.apache.org/licenses/LICENSE-2.0
11-
-
11+
-
1212
- Unless required by applicable law or agreed to in writing,
1313
- software distributed under the License is distributed on an
1414
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1515
- KIND, either express or implied. See the License for the
1616
- specific language governing permissions and limitations
17-
- under the License.
17+
- under the License.
1818
-->
1919

2020
## Requirements

webui/config.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
/*
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information
55
* regarding copyright ownership. The ASF licenses this file
66
* to you under the Apache License, Version 2.0 (the
77
* "License"); you may not use this file except in compliance
88
* with the License. You may obtain a copy of the License at
9-
*
9+
*
1010
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
11+
*
1212
* Unless required by applicable law or agreed to in writing,
1313
* software distributed under the License is distributed on an
1414
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1515
* KIND, either express or implied. See the License for the
1616
* specific language governing permissions and limitations
17-
* under the License.
17+
* under the License.
1818
*/
1919

2020
import { footerConfigType } from "@/app/lib/definitions";
2121

2222
export const footerConfig: footerConfigType = {
2323
links: [
2424
{
25-
title: 'Docs',
25+
title: "Docs",
2626
items: [
2727
{
28-
label: 'Getting started',
29-
to: '/docs/getting-started',
28+
label: "Getting started",
29+
to: "/docs/getting-started",
3030
},
3131
{
32-
label: 'Supported commands',
33-
to: '/docs/supported-commands',
32+
label: "Supported commands",
33+
to: "/docs/supported-commands",
3434
},
3535
{
36-
label: 'How to contribute',
37-
to: '/community/contributing',
38-
}
36+
label: "How to contribute",
37+
to: "/community/contributing",
38+
},
3939
],
4040
},
4141
{
42-
title: 'Community',
42+
title: "Community",
4343
items: [
4444
{
45-
label: 'Zulip',
46-
href: 'https://kvrocks.zulipchat.com/',
45+
label: "Zulip",
46+
href: "https://kvrocks.zulipchat.com/",
4747
},
4848
{
49-
label: 'Issue Tracker',
50-
href: 'https://github.com/apache/kvrocks-controller/issues',
49+
label: "Issue Tracker",
50+
href: "https://github.com/apache/kvrocks-controller/issues",
5151
},
5252
{
53-
label: 'Mailing list',
54-
href: 'https://lists.apache.org/list.html?dev@kvrocks.apache.org',
53+
label: "Mailing list",
54+
href: "https://lists.apache.org/list.html?dev@kvrocks.apache.org",
5555
},
5656
],
5757
},
5858
{
59-
title: 'Repositories',
59+
title: "Repositories",
6060
items: [
6161
{
62-
label: 'Kvrocks',
63-
href: 'https://github.com/apache/kvrocks',
62+
label: "Kvrocks",
63+
href: "https://github.com/apache/kvrocks",
6464
},
6565
{
66-
label: 'Website',
67-
href: 'https://github.com/apache/kvrocks-website',
66+
label: "Website",
67+
href: "https://github.com/apache/kvrocks-website",
6868
},
6969
{
70-
label: 'Controller',
71-
href: 'https://github.com/apache/kvrocks-controller',
72-
}
73-
]
74-
}
70+
label: "Controller",
71+
href: "https://github.com/apache/kvrocks-controller",
72+
},
73+
],
74+
},
7575
],
7676
logo: {
7777
height: 128,
7878
width: 320,
79-
alt: 'Apache logo',
80-
src: '/asf_logo.svg',
81-
href: 'https://www.apache.org/'
79+
alt: "Apache logo",
80+
src: "/asf_logo.svg",
81+
href: "https://www.apache.org/",
8282
},
8383
copyright: `The Apache Software Foundation. Apache Kvrocks, Kvrocks, and its feather logo are trademarks of The Apache Software Foundation. Redis and its cube logo are registered trademarks of Redis Ltd.`,
84-
};
84+
};

webui/next.config.mjs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
/*
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information
55
* regarding copyright ownership. The ASF licenses this file
66
* to you under the Apache License, Version 2.0 (the
77
* "License"); you may not use this file except in compliance
88
* with the License. You may obtain a copy of the License at
9-
*
9+
*
1010
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
11+
*
1212
* Unless required by applicable law or agreed to in writing,
1313
* software distributed under the License is distributed on an
1414
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1515
* KIND, either express or implied. See the License for the
1616
* specific language governing permissions and limitations
17-
* under the License.
17+
* under the License.
1818
*/
19-
20-
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants.js';
19+
20+
import { PHASE_DEVELOPMENT_SERVER } from "next/constants.js";
2121

2222
const apiPrefix = "/api/v1";
2323
const devHost = "127.0.0.1:9379";
2424
const prodHost = "production-api.yourdomain.com";
2525

2626
const nextConfig = (phase, { defaultConfig }) => {
27-
const isDev = phase === PHASE_DEVELOPMENT_SERVER;
28-
const host = isDev ? devHost : prodHost;
27+
const isDev = phase === PHASE_DEVELOPMENT_SERVER;
28+
const host = isDev ? devHost : prodHost;
2929

30-
return {
31-
async rewrites() {
32-
return [
33-
{
34-
source: `${apiPrefix}/:slug*`,
35-
destination: `http://${host}${apiPrefix}/:slug*`,
30+
return {
31+
async rewrites() {
32+
return [
33+
{
34+
source: `${apiPrefix}/:slug*`,
35+
destination: `http://${host}${apiPrefix}/:slug*`,
36+
},
37+
];
3638
},
37-
];
38-
},
39-
};
39+
};
4040
};
4141

42-
export default nextConfig;
42+
export default nextConfig;

webui/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
"autoprefixer": "^10.0.1",
3232
"eslint": "^8",
3333
"eslint-config-next": "14.1.0",
34+
"eslint-config-prettier": "^10.1.1",
3435
"postcss": "^8",
36+
"prettier": "^3.5.3",
37+
"prettier-plugin-tailwindcss": "^0.6.11",
3538
"tailwindcss": "^3.3.0",
3639
"typescript": "^5"
3740
}

webui/postcss.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
/*
1+
/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information
55
* regarding copyright ownership. The ASF licenses this file
66
* to you under the Apache License, Version 2.0 (the
77
* "License"); you may not use this file except in compliance
88
* with the License. You may obtain a copy of the License at
9-
*
9+
*
1010
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
11+
*
1212
* Unless required by applicable law or agreed to in writing,
1313
* software distributed under the License is distributed on an
1414
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1515
* KIND, either express or implied. See the License for the
1616
* specific language governing permissions and limitations
17-
* under the License.
17+
* under the License.
1818
*/
1919

2020
module.exports = {

0 commit comments

Comments
 (0)