diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..314f79d3f9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +# https://EditorConfig.org +root = true + +[*] +charset = utf-8 +trim_trailing_whitespace = true +end_of_line = lf +insert_final_newline = true +indent_style = space + +[*.{rs,toml}] +indent_size = 4 + +[*.ts] +indent_size = 4 +[*.js] +indent_size = 4 +[*.json] +indent_size = 4 diff --git a/editors/code/.eslintrc.js b/editors/code/.eslintrc.js index 631d956da2..518c5d0755 100644 --- a/editors/code/.eslintrc.js +++ b/editors/code/.eslintrc.js @@ -3,6 +3,7 @@ module.exports = { "es6": true, "node": true }, + "extends": ["prettier"], "parser": "@typescript-eslint/parser", "parserOptions": { "project": "tsconfig.eslint.json", diff --git a/editors/code/.prettierignore b/editors/code/.prettierignore new file mode 100644 index 0000000000..13baf68d7c --- /dev/null +++ b/editors/code/.prettierignore @@ -0,0 +1,3 @@ +node_modules +.vscode-test +out diff --git a/editors/code/.prettierrc.js b/editors/code/.prettierrc.js new file mode 100644 index 0000000000..cafb12f0e6 --- /dev/null +++ b/editors/code/.prettierrc.js @@ -0,0 +1,5 @@ +module.exports = { + // use 100 because it's Rustfmt's default + // https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#max_width + printWidth: 100, +}; diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index 74cda037d8..d766f9f1c9 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json @@ -22,6 +22,8 @@ "cross-env": "^7.0.3", "esbuild": "^0.14.27", "eslint": "^8.11.0", + "eslint-config-prettier": "^8.5.0", + "prettier": "^2.6.2", "tslib": "^2.3.0", "typescript": "^4.6.3", "typescript-formatter": "^7.2.2", @@ -1988,6 +1990,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", + "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -3130,6 +3144,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz", + "integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -5509,6 +5538,13 @@ } } }, + "eslint-config-prettier": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz", + "integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==", + "dev": true, + "requires": {} + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -6386,6 +6422,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz", + "integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", diff --git a/editors/code/package.json b/editors/code/package.json index 04006d7434..e2888a088d 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -48,6 +48,8 @@ "cross-env": "^7.0.3", "esbuild": "^0.14.27", "eslint": "^8.11.0", + "eslint-config-prettier": "^8.5.0", + "prettier": "^2.6.2", "tslib": "^2.3.0", "typescript": "^4.6.3", "typescript-formatter": "^7.2.2",