Skip to content

Commit 062e797

Browse files
Add command to format vue/ts files #10575
1 parent 292b546 commit 062e797

File tree

11 files changed

+33
-21
lines changed

11 files changed

+33
-21
lines changed

.eslintrc.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
"eslint:recommended",
44
'plugin:@typescript-eslint/recommended',
55
'plugin:vue/vue3-recommended',
6+
"prettier"
67
],
78
"root": true,
89
"env": {
@@ -39,9 +40,6 @@ module.exports = {
3940
"overrides": [
4041
{
4142
"files": [ "*.vue" ],
42-
"rules": {
43-
"vue/html-indent": [2, 4],
44-
}
4543
},
4644
{
4745
"files": [ "*.js" ],

.github/workflows/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
rm yarn.lock
5858
yarn && yarn build_test
5959
60+
- name: Check formatting of frontend files
61+
run: yarn && yarn format --check --no-write
62+
6063
- name: Check for missing migrations
6164
run: |
6265
python manage.py makemigrations --check

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleAttributePerLine": true
3+
}

arches/app/src/declarations.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// import declarations from other projects or Arches core
22

33
// declare modules that have been added to your project (should mirror `package.json`)
4-
declare module 'arches';
4+
declare module "arches";
55
declare module "@babel/runtime";
66
declare module "@mapbox/geojson-extent";
77
declare module "@mapbox/geojsonhint";
@@ -69,5 +69,5 @@ declare module "vue3-gettext";
6969
declare module "webpack-bundle-tracker";
7070

7171
// declare filetypes used in `./src/` folder
72-
declare module '*.ts';
73-
declare module '*.vue';
72+
declare module "*.ts";
73+
declare module "*.vue";

arches/install/arches-templates/.eslintrc.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = {
33
"eslint:recommended",
44
'plugin:@typescript-eslint/recommended',
55
'plugin:vue/vue3-recommended',
6+
"prettier"
67
],
78
"root": true,
89
"env": {
@@ -38,9 +39,6 @@ module.exports = {
3839
"overrides": [
3940
{
4041
"files": [ "*.vue" ],
41-
"rules": {
42-
"vue/html-indent": [2, 4],
43-
}
4442
},
4543
{
4644
"files": [ "*.js" ],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleAttributePerLine": true
3+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// import declarations from other projects or Arches core
2-
import('../media/node_modules/arches/arches/app/src/declarations.d.ts');
2+
import("../media/node_modules/arches/arches/app/src/declarations.d.ts");
33

44
// declare modules that have been added to your project (should mirror `package.json`)
5-
declare module 'arches';
5+
declare module "arches";
66

77
// declare filetypes used in `./src/` folder
8-
declare module '*.ts';
9-
declare module '*.vue';
8+
declare module "*.ts";
9+
declare module "*.vue";
1010

arches/management/commands/updateproject.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def handle(self, *args, **options):
1919
"""
2020
This will replace the following files in your project:
2121
.babelrc, eslintrc.js, .eslintignore, .browserslistrc, .stylelintrc.json,
22-
nodemon.json and tsconfig.json, and the entire webpack directory.
22+
.prettierrc, nodemon.json and tsconfig.json, and the entire webpack directory.
2323
2424
Continue?
2525
"""
@@ -87,7 +87,7 @@ def update_to_v7_5(self):
8787

8888
def update_to_v7_6(self):
8989
# ensure project has a `messages.pot` file
90-
for dotfile in ["nodemon.json", "tsconfig.json"]:
90+
for dotfile in ["nodemon.json", "tsconfig.json", ".prettierrc"]:
9191
print("Copying {} to project root directory".format(dotfile))
9292
shutil.copy2(os.path.join(settings.ROOT_DIR, "install", "arches-templates", "project_name", dotfile), settings.APP_ROOT)
9393

package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
"build_development": "yarn eslint:check && yarn ts:check && ./arches/app/media/node_modules/.bin/cross-env NODE_PATH=./arches/app/media/node_modules NODE_OPTIONS=--max-old-space-size=2048 ./arches/app/media/node_modules/.bin/webpack --config ./arches/webpack/webpack.config.dev.js",
77
"build_production": "yarn eslint:check && yarn ts:check && ./arches/app/media/node_modules/.bin/cross-env NODE_PATH=./arches/app/media/node_modules NODE_OPTIONS=--max-old-space-size=2048 NODE_ENV=production ./arches/app/media/node_modules/.bin/webpack --config ./arches/webpack/webpack.config.prod.js",
88
"build_test": "yarn eslint:check && yarn ts:check && ./arches/app/media/node_modules/.bin/cross-env NODE_PATH=./arches/app/media/node_modules NODE_OPTIONS=--max-old-space-size=2048 ./arches/app/media/node_modules/.bin/webpack --config ./arches/webpack/webpack.config.dev.js --env test=true",
9-
"eslint:check": "./arches/app/media/node_modules/.bin/eslint ./arches/app/src --resolve-plugins-relative-to ./arches/app/media --ext .vue,.ts --parser ./arches/app/media/node_modules/vue-eslint-parser/index.js",
10-
"eslint:fix": "./arches/app/media/node_modules/.bin/eslint ./arches/app/src --resolve-plugins-relative-to ./arches/app/media --ext .vue,.ts --parser ./arches/app/media/node_modules/vue-eslint-parser/index.js --fix",
11-
"eslint:watch": "./arches/app/media/node_modules/.bin/nodemon --watch ./arches/app/src --ext ts,vue --exec yarn --silent eslint:check",
9+
"eslint:check": "NODE_PATH=./arches/app/media/node_modules ./arches/app/media/node_modules/.bin/eslint ./arches/app/src --resolve-plugins-relative-to ./arches/app/media --ext .vue,.ts --parser ./arches/app/media/node_modules/vue-eslint-parser/index.js",
10+
"eslint:fix": "NODE_PATH=./arches/app/media/node_modules ./arches/app/media/node_modules/.bin/eslint ./arches/app/src --resolve-plugins-relative-to ./arches/app/media --ext .vue,.ts --parser ./arches/app/media/node_modules/vue-eslint-parser/index.js --fix",
11+
"eslint:watch": "NODE_PATH=./arches/app/media/node_modules ./arches/app/media/node_modules/.bin/nodemon --watch ./arches/app/src --ext ts,vue --exec yarn --silent eslint:check",
12+
"format": "yarn prettier arches/app/src --write",
1213
"gettext:extract": "./arches/app/media/node_modules/.bin/vue-gettext-extract",
1314
"gettext:compile": "./arches/app/media/node_modules/.bin/vue-gettext-compile",
1415
"ts:check": "./arches/app/media/node_modules/.bin/vue-tsc --noEmit",
@@ -20,7 +21,9 @@
2021
"type": "git"
2122
},
2223
"devDependencies": {
23-
"arches-dev-dependencies": "archesproject/arches-dev-dependencies#dev/7.6.x"
24+
"arches-dev-dependencies": "archesproject/arches-dev-dependencies#dev/7.6.x",
25+
"eslint-config-prettier": "9.1.0",
26+
"prettier": "3.2.5"
2427
},
2528
"dependencies": {
2629
"@babel/runtime": "^7.17.2",
@@ -154,4 +157,4 @@
154157
"cytoscape-cola": "node_modules/cytoscape-cola/cytoscape-cola",
155158
"webcola": "node_modules/webcola/WebCola/cola.min"
156159
}
157-
}
160+
}

releases/7.6.0.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ JavaScript:
4848
@babel/plugin-transform-class-properties == 7.23.3
4949
@typescript-eslint/eslint-plugin == 6.18.1
5050
@typescript-eslint/parser == 6.18.1
51+
eslint-config-prettier == 9.1.0
5152
eslint-plugin-vue == 9.20.0
53+
prettier == 3.2.5
5254
primevue == 3.50.0
5355
nodemon == 3.0.2
5456
sass == 1.70.0
5557
ts-loader == 9.5.1
5658
vue3-gettext == 3.0.0-beta.4
5759
vue-tsc == 2.0.6
58-
60+
5961
Removed:
6062
@babel/plugin-proposal-class-properties
6163
eslint-webpack-plugin
@@ -118,6 +120,7 @@ The minimum supported version of Python is now 3.10. Python 3.11 is encouraged,
118120
"eslint:check": "./media/node_modules/.bin/eslint ./src --resolve-plugins-relative-to ./media --ext .vue,.ts --parser ./media/node_modules/vue-eslint-parser/index.js",
119121
"eslint:fix": "./media/node_modules/.bin/eslint ./src --resolve-plugins-relative-to ./media --ext .vue,.ts --parser ./media/node_modules/vue-eslint-parser/index.js --fix",
120122
"eslint:watch": "./media/node_modules/.bin/nodemon --watch ./src --ext ts,vue --exec yarn --silent eslint:check",
123+
"format": "./media/node_modules/.bin/prettier ./src --write",
121124
"gettext:extract": "./media/node_modules/.bin/vue-gettext-extract",
122125
"gettext:compile": "./media/node_modules/.bin/vue-gettext-compile",
123126
"ts:check": "./media/node_modules/.bin/vue-tsc --noEmit",

0 commit comments

Comments
 (0)