Skip to content

Commit

Permalink
feat: Add prettier for code formatting to enforce common stylistic rules
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed May 7, 2024
1 parent 436a7cc commit 9f55660
Show file tree
Hide file tree
Showing 20 changed files with 4,234 additions and 635 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"extends": [
"@nextcloud",
"prettier"
],
"extends": ["@nextcloud", "prettier"],
"ignorePatterns": ["dist"],
"rules": {
"camelcase": ["error", { "allow": ["__pkg_version", "_nc_event_bus"] }]
Expand Down
18 changes: 9 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: saturday
time: "03:00"
timezone: Europe/Paris
versioning-strategy: increase
open-pull-requests-limit: 10
- package-ecosystem: npm
directory: '/'
schedule:
interval: weekly
day: saturday
time: '03:00'
timezone: Europe/Paris
versioning-strategy: increase
open-pull-requests-limit: 10
91 changes: 91 additions & 0 deletions .github/workflows/lint-prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Lint prettier

on: pull_request

permissions:
contents: read

concurrency:
group: lint-prettier-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
changes:
runs-on: ubuntu-latest

outputs:
src: ${{ steps.changes.outputs.src}}

steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- 'lib/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '.prettierignore'
- '**.js'
- '**.ts'
- '**.vue'
- '**.yml'
- '**.md'
lint:
runs-on: ubuntu-latest

needs: changes
if: needs.changes.outputs.src != 'false'

name: NPM format

steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: '^20'
fallbackNpm: '^10'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies
env:
CYPRESS_INSTALL_BINARY: 0
PUPPETEER_SKIP_DOWNLOAD: true
run: npm ci

- name: Format
run: npm run format

summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [changes, lint]

if: always()

# This is the summary, we just avoid to rename it so that branch protection rules still match
name: prettier

steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# version control systems directories
**/.git

# 3rdparty dependencies
**/node_modules

# Compiled JS output
dist/

# other misc stuff
coverage/
144 changes: 89 additions & 55 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,118 +5,152 @@ All notable changes to this project will be documented in this file.
## [v3.2.0](https://github.com/nextcloud/nextcloud-event-bus/tree/v3.2.0) (2024-04-21)

### Changed
- Add missing nodes typing for docs by @skjnldsv in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/606
- Add missing unit tests and use Typescript also for test by @susnux in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/630
- chore: update node engines to next LTS by @nextcloud-command in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/621
- fix: Use organization workflow for node test ci by @susnux in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/629
- fix(ci): Update documentation workflow from organization by @susnux in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/628

- Add missing nodes typing for docs by @skjnldsv in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/606
- Add missing unit tests and use Typescript also for test by @susnux in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/630
- chore: update node engines to next LTS by @nextcloud-command in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/621
- fix: Use organization workflow for node test ci by @susnux in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/629
- fix(ci): Update documentation workflow from organization by @susnux in https://github.com/nextcloud-libraries/nextcloud-event-bus/pull/628

### Dependencies
- chore(deps-dev): Bump @rollup/plugin-replace from 5.0.2 to 5.0.3 by @dependabot
- chore(deps-dev): Bump @rollup/plugin-typescript from 11.1.1 to 11.1.5 by @dependabot
- chore(deps-dev): Bump @types/node from 20.3.3 to 20.4.1 by @dependabot
- chore(deps-dev): Bump @types/semver from 7.5.0 to 7.5.3 by @dependabot
- chore(deps-dev): Bump jest from 29.5.0 to 29.7.0 by @dependabot
- chore(deps-dev): Bump jest-environment-jsdom from 29.5.0 to 29.7.0 by @dependabot
- chore(deps-dev): Bump rollup from 2.79.1 to 4.0.2 by @dependabot
- chore(deps-dev): Bump semver from 7.5.3 to 7.5.4 by @dependabot
- chore(deps-dev): Bump tslib from 2.5.0 to 2.6.2 by @dependabot
- chore(deps-dev): Bump typedoc from 0.24.7 to 0.25.2 by @dependabot
- chore(deps-dev): Bump typescript from 5.0.4 to 5.2.2 by @dependabot
- chore(deps-dev): Bump word-wrap from 1.2.3 to 1.2.4 by @dependabot
- chore(deps): Bump @types/node from 20.1.7 to 20.8.6 by @dependabot
- chore(deps): Bump semver from 7.5.1 to 7.5.3 by @dependabot
- chore(deps): Bump tough-cookie from 4.1.2 to 4.1.3 by @dependabot

- chore(deps-dev): Bump @rollup/plugin-replace from 5.0.2 to 5.0.3 by @dependabot
- chore(deps-dev): Bump @rollup/plugin-typescript from 11.1.1 to 11.1.5 by @dependabot
- chore(deps-dev): Bump @types/node from 20.3.3 to 20.4.1 by @dependabot
- chore(deps-dev): Bump @types/semver from 7.5.0 to 7.5.3 by @dependabot
- chore(deps-dev): Bump jest from 29.5.0 to 29.7.0 by @dependabot
- chore(deps-dev): Bump jest-environment-jsdom from 29.5.0 to 29.7.0 by @dependabot
- chore(deps-dev): Bump rollup from 2.79.1 to 4.0.2 by @dependabot
- chore(deps-dev): Bump semver from 7.5.3 to 7.5.4 by @dependabot
- chore(deps-dev): Bump tslib from 2.5.0 to 2.6.2 by @dependabot
- chore(deps-dev): Bump typedoc from 0.24.7 to 0.25.2 by @dependabot
- chore(deps-dev): Bump typescript from 5.0.4 to 5.2.2 by @dependabot
- chore(deps-dev): Bump word-wrap from 1.2.3 to 1.2.4 by @dependabot
- chore(deps): Bump @types/node from 20.1.7 to 20.8.6 by @dependabot
- chore(deps): Bump semver from 7.5.1 to 7.5.3 by @dependabot
- chore(deps): Bump tough-cookie from 4.1.2 to 4.1.3 by @dependabot

## [v3.1.0](https://github.com/nextcloud/nextcloud-event-bus/tree/v3.1.0) (2023-05-17)

[Full Changelog](https://github.com/nextcloud/nextcloud-event-bus/compare/v3.0.2...v3.1.0)

### Changed
- Updated dependencies
- Initialize bus on first usage not on import [\#587](https://github.com/nextcloud/nextcloud-event-bus/pull/587) ([susnux](https://github.com/susnux))

- Updated dependencies
- Initialize bus on first usage not on import [\#587](https://github.com/nextcloud/nextcloud-event-bus/pull/587) ([susnux](https://github.com/susnux))

### Fixed
- Allow package to be imported by native Node ES module projects [\#586](https://github.com/nextcloud/nextcloud-event-bus/pull/586) ([susnux](https://github.com/susnux))

- Allow package to be imported by native Node ES module projects [\#586](https://github.com/nextcloud/nextcloud-event-bus/pull/586) ([susnux](https://github.com/susnux))

## [v3.0.2](https://github.com/nextcloud/nextcloud-event-bus/tree/v3.0.2) (2022-09-05)

[Full Changelog](https://github.com/nextcloud/nextcloud-event-bus/compare/v3.0.1...v3.0.2)

### Closed pull requests

- 🩹 Remove type=module [\#534](https://github.com/nextcloud/nextcloud-event-bus/pull/534) ([vinicius73](https://github.com/vinicius73))
- 🩹 Remove type=module [\#534](https://github.com/nextcloud/nextcloud-event-bus/pull/534) ([vinicius73](https://github.com/vinicius73))

## 3.0.1 - 2022-08-24
⚠️ deprecated

⚠️ deprecated

### Changed
- Update dependencies
- Improve native ESM Support

- Update dependencies
- Improve native ESM Support

## 3.0.0 - 2022-05-02

### Changed
- Update dependencies
- Fix rollup build
- Remove babel
- Typescript already is able to generate code that is in compliance with es5
- Remove package.json from generated code.
- Use @rollup/plugin-replace to handle this.
- Add ESM support
- Improve native usage support
- Improve bundle size
- Fix invalid typescript typings export
- Remove unnecessary files from npm package

- Update dependencies
- Fix rollup build
- Remove babel
- Typescript already is able to generate code that is in compliance with es5
- Remove package.json from generated code.
- Use @rollup/plugin-replace to handle this.
- Add ESM support
- Improve native usage support
- Improve bundle size
- Fix invalid typescript typings export
- Remove unnecessary files from npm package

## 2.1.1 – 2021-11-02

### Changed
- Dependency updates

- Dependency updates

## 2.1.0 – 2021-09-28

### Changed
- Dependency updates

- Dependency updates

### Fixed
- Readme examples
- Dependency updates

- Readme examples
- Dependency updates

## 2.0.0 - 2021-05-05

### Breaking
- Bump of @nextcloud/browserlist-config@2.1.0 which drops support for IE11

- Bump of @nextcloud/browserlist-config@2.1.0 which drops support for IE11

### Changed
- Move a single to transpiled library bundle
- Dependency updates

- Move a single to transpiled library bundle
- Dependency updates

## 1.3.0 - 2021-05-05

### Changed
- Move a single to transpiled library bundle
- Dependency updates

- Move a single to transpiled library bundle
- Dependency updates

## 1.2.0 - 2020-06-03

### Changed
- Dependency updates

- Dependency updates

## 1.1.4 - 2020-04-06

### Changed
- Dependency updates

- Dependency updates

### Fixed
- Update vulnerable packages

- Update vulnerable packages

## 1.1.3 - 2020-03-19

### Changed
- Dependency updates

- Dependency updates

### Fixed
- Update vulnerable packages

- Update vulnerable packages

## 1.1.2 - 2020-01-10

### Fixed
- Packaging of corejs

- Packaging of corejs

## 1.1.1 - 2020-01-10

### Fixed
- Module error with semver package

- Module error with semver package

## 1.0.1 - 2020-01-07

### Fixed
- Misleading warning if ProxyBus is used for a compatible bus

- Misleading warning if ProxyBus is used for a compatible bus
Loading

0 comments on commit 9f55660

Please sign in to comment.