diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index eab3139d4c..0000000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -# https://editorconfig.org/ - -# top-most EditorConfig file -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..7e23248fc1 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: Lint code + +on: + push: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Setup Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + + - name: Install and lint + run: | + yarn + yarn lint diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..ea78de8774 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +public/vendor/ +public/javascript/vendor/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..1154726c26 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,14 @@ +{ + "arrowParens": "avoid", + "proseWrap": "never", + "quoteProps": "consistent", + "trailingComma": "all", + "overrides": [ + { + "files": "*.{json}", + "options": { + "printWidth": 1000 + } + } + ] +} diff --git a/package.json b/package.json index 2cd105e2d4..f1e40337b6 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,13 @@ "yarn": "^1" }, "dependencies": { - "xml2js": "^0.4.19" + "prettier": "2.2.1", + "xml2js": "0.4.19" + }, + "scripts": { + "format": "yarn prettier --write", + "lint": "yarn prettier --list-different", + "prettier": "prettier \"**/*.{ts,js,json,md,scss,yaml,yml}\"" }, "workspaces": [ "ui", diff --git a/yarn.lock b/yarn.lock index 96660a49e7..a96cbd6837 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3506,6 +3506,11 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= +prettier@2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + pretty-bytes@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9" @@ -4770,18 +4775,18 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -xml2js@^0.4.19: - version "0.4.23" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66" - integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== +xml2js@0.4.19: + version "0.4.19" + resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7" + integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q== dependencies: sax ">=0.6.0" - xmlbuilder "~11.0.0" + xmlbuilder "~9.0.1" -xmlbuilder@~11.0.0: - version "11.0.1" - resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3" - integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== +xmlbuilder@~9.0.1: + version "9.0.7" + resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" + integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= "xtend@>=4.0.0 <4.1.0-0", xtend@~4.0.0, xtend@~4.0.1: version "4.0.2"