diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 04441d5c98..9c593e3aa0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,6 +23,10 @@ jobs: with: node-version: "14" + - name: Install JS dependencies + run: npm ci + working-directory: ./js + - name: Check JS formatting - run: npx prettier --check src + run: npm run format-check working-directory: ./js diff --git a/js/.prettierrc.json b/js/.prettierrc.json deleted file mode 100644 index 944d65352b..0000000000 --- a/js/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "printWidth": 150, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "es5" -} diff --git a/js/package-lock.json b/js/package-lock.json index 8c3f5f7c09..97ee47fada 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -22,6 +22,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.13.0", + "@flarum/prettier-config": "^1.0.0", "@types/jquery": "^3.5.5", "@types/mithril": "^2.0.7", "@types/punycode": "^2.1.0", @@ -1477,6 +1478,12 @@ "to-fast-properties": "^2.0.0" } }, + "node_modules/@flarum/prettier-config": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@flarum/prettier-config/-/prettier-config-1.0.0.tgz", + "integrity": "sha512-3/AcliIi5jPt4i7COb5hsLv6hm4EeXT9yI9I2EuEvhPi2QR+O9Y/8wrqRuO5mDkRzCIhUY+mjIL/f9770Zwfqg==", + "dev": true + }, "node_modules/@polka/url": { "version": "1.0.0-next.12", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.12.tgz", @@ -8870,6 +8877,12 @@ "to-fast-properties": "^2.0.0" } }, + "@flarum/prettier-config": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@flarum/prettier-config/-/prettier-config-1.0.0.tgz", + "integrity": "sha512-3/AcliIi5jPt4i7COb5hsLv6hm4EeXT9yI9I2EuEvhPi2QR+O9Y/8wrqRuO5mDkRzCIhUY+mjIL/f9770Zwfqg==", + "dev": true + }, "@polka/url": { "version": "1.0.0-next.12", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.12.tgz", diff --git a/js/package.json b/js/package.json index 2e17c875ce..6d3c1a3458 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,7 @@ { "private": true, "name": "@flarum/core", + "prettier": "@flarum/prettier-config", "dependencies": { "@askvortsov/rich-icu-message-formatter": "^0.1.0", "@ultraq/icu-message-formatter": "^0.10.1", @@ -18,6 +19,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.13.0", + "@flarum/prettier-config": "^1.0.0", "@types/jquery": "^3.5.5", "@types/mithril": "^2.0.7", "@types/punycode": "^2.1.0",