Skip to content

Commit 9876477

Browse files
Merge pull request #7087 from nextcloud/prettier-setup
Setup prettier
2 parents 544a4e7 + 810eb74 commit 9876477

121 files changed

Lines changed: 2657 additions & 3111 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.cjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ module.exports = {
77
root: true,
88
extends: [
99
'@nextcloud',
10+
'prettier',
11+
],
12+
"overrides": [
13+
{
14+
"files": ["**/*.vue"],
15+
"rules": {
16+
"vue/first-attribute-linebreak": "off"
17+
}
18+
}
1019
],
1120
rules: {
1221
'@typescript-eslint/no-unused-vars': ['off'],
Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,54 @@
66
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

9-
name: Lint stylelint
9+
name: Lint prettier
1010

1111
on: pull_request
1212

1313
permissions:
1414
contents: read
1515

1616
concurrency:
17-
group: lint-stylelint-${{ github.head_ref || github.run_id }}
17+
group: lint-prettier-${{ github.head_ref || github.run_id }}
1818
cancel-in-progress: true
1919

2020
jobs:
21+
changes:
22+
runs-on: ubuntu-latest-low
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
27+
outputs:
28+
src: ${{ steps.changes.outputs.src }}
29+
30+
steps:
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
id: changes
33+
continue-on-error: true
34+
with:
35+
filters: |
36+
src:
37+
- '.github/workflows/**'
38+
- 'src/**'
39+
- 'appinfo/info.xml'
40+
- 'package.json'
41+
- 'package-lock.json'
42+
- 'tsconfig.json'
43+
- '.eslintrc.*'
44+
- '.eslintignore'
45+
- '.prettierignore'
46+
- '**.js'
47+
- '**.ts'
48+
- '**.vue'
49+
2150
lint:
2251
runs-on: ubuntu-latest
2352

24-
name: stylelint
53+
needs: changes
54+
if: needs.changes.outputs.src != 'false'
55+
56+
name: prettier
2557

2658
steps:
2759
- name: Checkout
@@ -47,7 +79,23 @@ jobs:
4779
- name: Install dependencies
4880
env:
4981
CYPRESS_INSTALL_BINARY: 0
82+
PUPPETEER_SKIP_DOWNLOAD: true
5083
run: npm ci
5184

5285
- name: Lint
53-
run: npm run stylelint
86+
run: npm run prettier
87+
88+
summary:
89+
permissions:
90+
contents: none
91+
runs-on: ubuntu-latest-low
92+
needs: [changes, lint]
93+
94+
if: always()
95+
96+
# This is the summary, we just avoid to rename it so that branch protection rules still match
97+
name: prettier
98+
99+
steps:
100+
- name: Summary status
101+
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi

.nextcloudignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/.l10nignore
1212
/.nextcloudignore
1313
/.php-cs-fixer.dist.php
14+
/.prettierignore
1415
/.stylelintrc.js
1516
/.travis.yml
1617
/.tx

.prettierignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
# version control systems directories
5+
**/.git
6+
**/.svn
7+
**/.hg
8+
9+
# 3rdparty dependencies
10+
**/node_modules
11+
**/vendor
12+
13+
# Compiled JS output
14+
js/
15+
16+
# PHP
17+
lib/
18+
**/*.php

.stylelintrc.cjs

Lines changed: 0 additions & 9 deletions
This file was deleted.

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ lint:
5454
lint-fix:
5555
npm run lint:fix
5656

57-
# Style linting
58-
stylelint:
59-
npm run stylelint
57+
# Formatting
58+
format-check:
59+
npm run prettier
6060

61-
stylelint-fix:
62-
npm run stylelint:fix
61+
format-fix:
62+
npm run prettier:fix
6363

6464
# Cleaning
6565
clean:

0 commit comments

Comments
 (0)