Skip to content

Commit 07cc2c2

Browse files
committed
Improve web infrastructure
Upgrade npm packages that were locked to old versions due to now-resolved problems Remove unused/unnecessary dependencies and their configurations Fix VS Code format on save Fix VS Code removing EOF newline in JSON files in conflict with npm Remove JSON files from ESLint because it doesn't properly support JSON Add detailed comments to web-related configuration files
1 parent f2f85dd commit 07cc2c2

File tree

9 files changed

+516
-1203
lines changed

9 files changed

+516
-1203
lines changed

.vscode/launch.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
"args": [
1313
"build",
1414
"--bin=graphite",
15-
"--package=graphite"
15+
"--package=graphite",
1616
],
1717
"filter": {
1818
"name": "graphite",
19-
"kind": "bin"
20-
}
19+
"kind": "bin",
20+
},
2121
},
2222
"args": [],
2323
"cwd": "${workspaceFolder}",
2424
"env": {
25-
"RUST_LOG": "error"
26-
}
25+
"RUST_LOG": "error",
26+
},
2727
},
2828
{
2929
"type": "lldb",
@@ -34,15 +34,15 @@
3434
"test",
3535
"--no-run",
3636
"--bin=graphite",
37-
"--package=graphite"
37+
"--package=graphite",
3838
],
3939
"filter": {
4040
"name": "graphite",
41-
"kind": "bin"
42-
}
41+
"kind": "bin",
42+
},
4343
},
4444
"args": [],
45-
"cwd": "${workspaceFolder}"
46-
}
47-
]
48-
}
45+
"cwd": "${workspaceFolder}",
46+
},
47+
],
48+
}

.vscode/settings.json

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,48 @@
11
{
2+
// Rust: save on format
23
"[rust]": {
34
"editor.formatOnSave": true,
45
"editor.formatOnPaste": true,
56
"editor.defaultFormatter": "matklad.rust-analyzer",
67
},
7-
"[typescript, javascript, json, vue]": {
8+
// Web: save on format (consolidate these when https://github.com/microsoft/vscode/issues/51935 is implemented)
9+
"[typescript]": {
810
"editor.codeActionsOnSave": {
9-
"source.fixAll.eslint": true
11+
"source.fixAll.eslint": true,
1012
},
1113
"editor.formatOnSave": true,
1214
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
1315
},
16+
"[javascript]": {
17+
"editor.codeActionsOnSave": {
18+
"source.fixAll.eslint": true,
19+
},
20+
"editor.formatOnSave": true,
21+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
22+
},
23+
"[vue]": {
24+
"editor.codeActionsOnSave": {
25+
"source.fixAll.eslint": true,
26+
},
27+
"editor.formatOnSave": true,
28+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
29+
},
30+
// Rust Analyzer config
1431
"rust-analyzer.experimental.procAttrMacros": true,
1532
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
16-
"files.eol": "\n",
17-
"html.format.wrapLineLength": 200,
33+
// ESLint config
1834
"eslint.format.enable": true,
1935
"eslint.workingDirectories": [
20-
"./frontend"
36+
"./frontend",
2137
],
2238
"eslint.validate": [
2339
"javascript",
2440
"typescript",
2541
],
42+
// Vue config
2643
"vetur.format.enable": false,
27-
}
44+
// VS Code config
45+
"html.format.wrapLineLength": 200,
46+
"files.eol": "\n",
47+
"files.insertFinalNewline": true,
48+
}

frontend/.eslintrc.js

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,77 @@
1+
const webpackConfigPath = require.resolve("@vue/cli-service/webpack.config.js");
2+
13
module.exports = {
24
root: true,
35
env: {
46
browser: true,
57
node: true,
68
es2020: true,
79
},
8-
extends: ["plugin:vue/vue3-essential", "@vue/airbnb", "@vue/typescript/recommended", "plugin:prettier-vue/recommended", "prettier"],
910
parserOptions: {
1011
ecmaVersion: 2020,
1112
},
13+
extends: [
14+
// Vue-specific defaults
15+
"plugin:vue/vue3-essential",
16+
// Vue-compatible JS defaults
17+
"@vue/airbnb",
18+
// Vue-compatible TS defaults
19+
"@vue/typescript/recommended",
20+
// Vue-compatible Prettier defaults
21+
"plugin:prettier-vue/recommended",
22+
// General Prettier defaults
23+
"prettier",
24+
],
1225
settings: {
26+
// https://github.com/import-js/eslint-plugin-import#resolvers
1327
"import/resolver": {
1428
// `node` must be listed first!
1529
node: {},
16-
webpack: { config: require.resolve("@vue/cli-service/webpack.config.js") },
30+
webpack: { config: webpackConfigPath },
1731
},
32+
33+
// https://github.com/meteorlxy/eslint-plugin-prettier-vue
1834
"prettier-vue": {
35+
// Use Prettier to format the HTML, CSS, and JS blocks of .vue single-file components
1936
SFCBlocks: {
2037
template: true,
2138
style: true,
39+
script: true,
2240
},
2341
},
2442
},
25-
ignorePatterns: ["node_modules/", "dist/", "pkg/", "wasm/pkg/*", "!.*.js", "!.*.ts", "!.*.json"],
43+
ignorePatterns: [
44+
// Ignore generated directories
45+
"node_modules/",
46+
"dist/",
47+
"pkg/",
48+
"wasm/pkg/",
49+
50+
// Don't ignore JS and TS dotfiles in this folder
51+
"!.*.js",
52+
"!.*.ts",
53+
],
2654
rules: {
55+
// Standard ESLint config
2756
indent: ["error", "tab", { SwitchCase: 1 }],
2857
quotes: ["error", "double"],
58+
camelcase: ["error", { properties: "always" }],
2959
"linebreak-style": ["error", "unix"],
3060
"eol-last": ["error", "always"],
61+
"max-len": ["error", { code: 200, tabWidth: 4 }],
3162
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
3263
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
3364
"no-param-reassign": ["error", { props: false }],
34-
"import/prefer-default-export": "off",
35-
"max-len": ["error", { code: 200, tabWidth: 4 }],
65+
66+
// TypeScript plugin config
3667
"@typescript-eslint/camelcase": "off",
3768
"@typescript-eslint/no-use-before-define": "off",
3869
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
39-
camelcase: ["error", { properties: "always" }],
70+
71+
// Import plugin config (used to intelligently validate module import statements)
72+
"import/prefer-default-export": "off",
73+
74+
// Prettier plugin config (used to enforce HTML, CSS, and JS formatting styles as an ESLint plugin, where fixes are reported to ESLint to be applied when linting)
4075
"prettier-vue/prettier": [
4176
"error",
4277
{

0 commit comments

Comments
 (0)